Skip to content

Commit

Permalink
fix to add variables which are not string through the .variable(...) …
Browse files Browse the repository at this point in the history
…method
  • Loading branch information
vzickner committed Jan 16, 2025
1 parent bb92b60 commit a760070
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/external-worker-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ describe('ExternalWorkerClient', () => {
callbackHandler(acquiredJob: ExternalWorkerAcquireJobResponse, workResultBuilder: WorkerResultBuilder) {
job = acquiredJob;
return workResultBuilder.success()
.variable('testVar', 'test content', 'string');
.variable('testVar', 'test content', 'string')
.variable('testVar2', 12, 'integer');
},
waitPeriodSeconds: 0.2
});
Expand Down
7 changes: 4 additions & 3 deletions src/external-worker-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
FlowableExternalWorkerRestClient
} from "./rest-client";
import {ExternalWorkerAcquireJobResponse} from "./external-worker-acquire-job-response";
import { EngineRestVariableType } from "./engine-rest-variable";

export class ExternalWorkerClient {

Expand Down Expand Up @@ -112,7 +113,7 @@ export class WorkerResultSuccess implements WorkResult {
this.completeJobParams = {jobId: job.id, variables: null};
}

public variable(name: string, value: string, type: string): WorkerResultSuccess {
public variable(name: string, value: any, type: EngineRestVariableType | string): WorkerResultSuccess {
this.completeJobParams.variables = this.completeJobParams.variables || [];
this.completeJobParams.variables.push({name, value, type, valueUrl: null});
return this;
Expand Down Expand Up @@ -164,7 +165,7 @@ export class WorkerResultBpmnError implements WorkResult {
this.bpmnErrorParams = {jobId: job.id};
}

public variable(name: string, value: string, type: string): WorkerResultBpmnError {
public variable(name: string, value: any, type: EngineRestVariableType | string): WorkerResultBpmnError {
this.bpmnErrorParams.variables = this.bpmnErrorParams.variables || [];
this.bpmnErrorParams.variables.push({name, value, type, valueUrl: null});
return this;
Expand All @@ -187,7 +188,7 @@ export class WorkerResultCmmnTerminate implements WorkResult {
this.cmmnTerminateParams = {jobId: job.id};
}

public variable(name: string, value: string, type: string): WorkerResultCmmnTerminate {
public variable(name: string, value: any, type: EngineRestVariableType | string): WorkerResultCmmnTerminate {
this.cmmnTerminateParams.variables = this.cmmnTerminateParams.variables || [];
this.cmmnTerminateParams.variables.push({name, value, type, valueUrl: null});
return this;
Expand Down
6 changes: 6 additions & 0 deletions src/fixtures/complete-job-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
"type": "string",
"value": "test content",
"valueUrl": null
},
{
"name": "testVar2",
"type": "integer",
"value": 12,
"valueUrl": null
}
]
}

0 comments on commit a760070

Please sign in to comment.