Skip to content

Commit 26d3c87

Browse files
authored
Merge pull request #15 from yepcode/bugfix/schedule-parameters-type
Align schedule input parameter types with executeProcessSync
2 parents 3204d4f + ddcc12c commit 26d3c87

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

src/api/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export interface DependenciesConfigInput {
4343
autoDetect?: boolean;
4444
}
4545
export interface ExecuteProcessInput {
46-
parameters?: string;
46+
parameters?: Record<string, any>,
4747
tag?: string;
4848
comment?: string;
4949
settings?: ExecuteProcessSettingsInput;

src/api/yepcodeApi.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,15 @@ export class YepCodeApi {
496496
processIdOrSlug: string,
497497
data: ScheduledProcessInput
498498
): Promise<Schedule> {
499+
const sanitizedData = {
500+
...data,
501+
input: {
502+
...data.input,
503+
parameters: JSON.stringify(data.input?.parameters),
504+
},
505+
};
499506
return this.request("POST", `/processes/${processIdOrSlug}/schedule`, {
500-
data,
507+
data: sanitizedData,
501508
});
502509
}
503510

@@ -579,7 +586,16 @@ export class YepCodeApi {
579586
id: string,
580587
data: ScheduledProcessInput
581588
): Promise<Schedule> {
582-
return this.request("PATCH", `/schedules/${id}`, { data });
589+
const sanitizedData = {
590+
...data,
591+
input: {
592+
...data.input,
593+
parameters: JSON.stringify(data.input?.parameters),
594+
},
595+
};
596+
return this.request("PATCH", `/schedules/${id}`, {
597+
data: sanitizedData,
598+
});
583599
}
584600

585601
async getVariables(

0 commit comments

Comments
 (0)