Skip to content

Commit a760070

Browse files
committed
fix to add variables which are not string through the .variable(...) method
1 parent bb92b60 commit a760070

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/external-worker-client.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ describe('ExternalWorkerClient', () => {
148148
callbackHandler(acquiredJob: ExternalWorkerAcquireJobResponse, workResultBuilder: WorkerResultBuilder) {
149149
job = acquiredJob;
150150
return workResultBuilder.success()
151-
.variable('testVar', 'test content', 'string');
151+
.variable('testVar', 'test content', 'string')
152+
.variable('testVar2', 12, 'integer');
152153
},
153154
waitPeriodSeconds: 0.2
154155
});

src/external-worker-client.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
FlowableExternalWorkerRestClient
99
} from "./rest-client";
1010
import {ExternalWorkerAcquireJobResponse} from "./external-worker-acquire-job-response";
11+
import { EngineRestVariableType } from "./engine-rest-variable";
1112

1213
export class ExternalWorkerClient {
1314

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

115-
public variable(name: string, value: string, type: string): WorkerResultSuccess {
116+
public variable(name: string, value: any, type: EngineRestVariableType | string): WorkerResultSuccess {
116117
this.completeJobParams.variables = this.completeJobParams.variables || [];
117118
this.completeJobParams.variables.push({name, value, type, valueUrl: null});
118119
return this;
@@ -164,7 +165,7 @@ export class WorkerResultBpmnError implements WorkResult {
164165
this.bpmnErrorParams = {jobId: job.id};
165166
}
166167

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

190-
public variable(name: string, value: string, type: string): WorkerResultCmmnTerminate {
191+
public variable(name: string, value: any, type: EngineRestVariableType | string): WorkerResultCmmnTerminate {
191192
this.cmmnTerminateParams.variables = this.cmmnTerminateParams.variables || [];
192193
this.cmmnTerminateParams.variables.push({name, value, type, valueUrl: null});
193194
return this;

src/fixtures/complete-job-request.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
"type": "string",
77
"value": "test content",
88
"valueUrl": null
9+
},
10+
{
11+
"name": "testVar2",
12+
"type": "integer",
13+
"value": 12,
14+
"valueUrl": null
915
}
1016
]
1117
}

0 commit comments

Comments
 (0)