@camunda8/sdk 8.6.13 → 8.6.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +24 -2
  3. package/dist/admin/lib/AdminApiClient.js +1 -0
  4. package/dist/admin/lib/AdminApiClient.js.map +1 -1
  5. package/dist/c8/index.d.ts +21 -10
  6. package/dist/c8/index.js +33 -15
  7. package/dist/c8/index.js.map +1 -1
  8. package/dist/c8/lib/C8Dto.d.ts +282 -0
  9. package/dist/c8/lib/C8Dto.js +97 -0
  10. package/dist/c8/lib/C8Dto.js.map +1 -0
  11. package/dist/c8/lib/C8Logger.d.ts +9 -0
  12. package/dist/c8/lib/C8Logger.js +35 -0
  13. package/dist/c8/lib/C8Logger.js.map +1 -0
  14. package/dist/c8/lib/CamundaJobWorker.d.ts +52 -0
  15. package/dist/c8/lib/CamundaJobWorker.js +125 -0
  16. package/dist/c8/lib/CamundaJobWorker.js.map +1 -0
  17. package/dist/c8/lib/CamundaRestClient.d.ts +311 -0
  18. package/dist/c8/lib/CamundaRestClient.js +645 -0
  19. package/dist/c8/lib/CamundaRestClient.js.map +1 -0
  20. package/dist/c8/lib/RestApiJobClassFactory.d.ts +3 -0
  21. package/dist/c8/lib/RestApiJobClassFactory.js +36 -0
  22. package/dist/c8/lib/RestApiJobClassFactory.js.map +1 -0
  23. package/dist/c8/lib/RestApiProcessInstanceClassFactory.d.ts +3 -0
  24. package/dist/c8/lib/RestApiProcessInstanceClassFactory.js +33 -0
  25. package/dist/c8/lib/RestApiProcessInstanceClassFactory.js.map +1 -0
  26. package/dist/index.d.ts +5 -3
  27. package/dist/index.js +12 -2
  28. package/dist/index.js.map +1 -1
  29. package/dist/lib/Configuration.d.ts +15 -6
  30. package/dist/lib/Configuration.js +9 -1
  31. package/dist/lib/Configuration.js.map +1 -1
  32. package/dist/lib/CreateDtoInstance.d.ts +16 -0
  33. package/dist/lib/CreateDtoInstance.js +25 -0
  34. package/dist/lib/CreateDtoInstance.js.map +1 -0
  35. package/dist/lib/GotErrors.d.ts +1 -1
  36. package/dist/lib/GotHooks.js +4 -2
  37. package/dist/lib/GotHooks.js.map +1 -1
  38. package/dist/lib/LosslessJsonParser.d.ts +43 -6
  39. package/dist/lib/LosslessJsonParser.js +158 -24
  40. package/dist/lib/LosslessJsonParser.js.map +1 -1
  41. package/dist/lib/index.d.ts +1 -0
  42. package/dist/lib/index.js +1 -0
  43. package/dist/lib/index.js.map +1 -1
  44. package/dist/modeler/lib/ModelerAPIClient.js +1 -0
  45. package/dist/modeler/lib/ModelerAPIClient.js.map +1 -1
  46. package/dist/operate/lib/OperateApiClient.js +1 -0
  47. package/dist/operate/lib/OperateApiClient.js.map +1 -1
  48. package/dist/optimize/lib/OptimizeApiClient.js +1 -0
  49. package/dist/optimize/lib/OptimizeApiClient.js.map +1 -1
  50. package/dist/proto/zeebe.proto +22 -0
  51. package/dist/tasklist/lib/TasklistApiClient.js +1 -0
  52. package/dist/tasklist/lib/TasklistApiClient.js.map +1 -1
  53. package/dist/zeebe/lib/GrpcClient.js +1 -6
  54. package/dist/zeebe/lib/GrpcClient.js.map +1 -1
  55. package/dist/zeebe/lib/ZBWorkerBase.js +2 -3
  56. package/dist/zeebe/lib/ZBWorkerBase.js.map +1 -1
  57. package/dist/zeebe/lib/interfaces-1.0.d.ts +101 -8
  58. package/dist/zeebe/lib/interfaces-1.0.js.map +1 -1
  59. package/dist/zeebe/lib/interfaces-grpc-1.0.d.ts +22 -3
  60. package/dist/zeebe/lib/interfaces-grpc-1.0.js.map +1 -1
  61. package/dist/zeebe/lib/stringifyVariables.d.ts +8 -0
  62. package/dist/zeebe/lib/stringifyVariables.js +18 -4
  63. package/dist/zeebe/lib/stringifyVariables.js.map +1 -1
  64. package/dist/zeebe/zb/ZeebeGrpcClient.d.ts +9 -7
  65. package/dist/zeebe/zb/ZeebeGrpcClient.js +41 -9
  66. package/dist/zeebe/zb/ZeebeGrpcClient.js.map +1 -1
  67. package/dist/zeebe/zb/ZeebeRESTClient.d.ts +3 -0
  68. package/dist/zeebe/zb/ZeebeRESTClient.js +3 -0
  69. package/dist/zeebe/zb/ZeebeRESTClient.js.map +1 -1
  70. package/package.json +7 -2
@@ -0,0 +1,645 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CamundaRestClient = void 0;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const debug_1 = require("debug");
9
+ const form_data_1 = __importDefault(require("form-data"));
10
+ const got_1 = __importDefault(require("got"));
11
+ const lossless_json_1 = require("lossless-json");
12
+ const lib_1 = require("../../lib");
13
+ const types_1 = require("../../zeebe/types");
14
+ const C8Dto_1 = require("./C8Dto");
15
+ const C8Logger_1 = require("./C8Logger");
16
+ const CamundaJobWorker_1 = require("./CamundaJobWorker");
17
+ const RestApiJobClassFactory_1 = require("./RestApiJobClassFactory");
18
+ const RestApiProcessInstanceClassFactory_1 = require("./RestApiProcessInstanceClassFactory");
19
+ const trace = (0, debug_1.debug)('camunda:zeebe-rest');
20
+ const CAMUNDA_REST_API_VERSION = 'v2';
21
+ class DefaultLosslessDto extends lib_1.LosslessDto {
22
+ }
23
+ /**
24
+ * The client for the unified Camunda 8 REST API.
25
+ *
26
+ * Logging: to enable debug tracing during development, you can set `DEBUG=camunda:zeebe-rest`.
27
+ *
28
+ * For production, you can pass in an instance of [winston.Logger](https://github.com/winstonjs/winston) to the constructor as `logger`.
29
+ *
30
+ * `CAMUNDA_LOG_LEVEL` in the environment or the constructor options can be used to set the log level to one of 'error', 'warn', 'info', 'http', 'verbose', 'debug', or 'silly'.
31
+ *
32
+ * @since 8.6.0
33
+ * @experimental this API may be moved to an ESM package in a future release. Can you use ESM in your project? Comment [on this issue](https://github.com/camunda/camunda-8-js-sdk/issues/267).
34
+ */
35
+ class CamundaRestClient {
36
+ /**
37
+ * All constructor parameters for configuration are optional. If no configuration is provided, the SDK will use environment variables to configure itself.
38
+ */
39
+ constructor(options) {
40
+ this.addJobMethods = (job) => {
41
+ return {
42
+ ...job,
43
+ cancelWorkflow: () => {
44
+ throw new Error('Not Implemented');
45
+ },
46
+ complete: (variables = {}) => this.completeJob({
47
+ jobKey: job.jobKey,
48
+ variables,
49
+ }),
50
+ error: (error) => this.errorJob({
51
+ ...error,
52
+ jobKey: job.jobKey,
53
+ }),
54
+ fail: (failJobRequest) => this.failJob(failJobRequest),
55
+ /* This has an effect in a Job Worker, decrementing the currently active job count */
56
+ forward: () => types_1.JOB_ACTION_ACKNOWLEDGEMENT,
57
+ modifyJobTimeout: ({ newTimeoutMs }) => this.updateJob({ jobKey: job.jobKey, timeout: newTimeoutMs }),
58
+ };
59
+ };
60
+ const config = lib_1.CamundaEnvironmentConfigurator.mergeConfigWithEnvironment(options?.config ?? {});
61
+ this.log = (0, C8Logger_1.getLogger)(config);
62
+ this.log.debug(`Using REST API version ${CAMUNDA_REST_API_VERSION}`);
63
+ trace('options.config', options?.config);
64
+ trace('config', config);
65
+ this.oAuthProvider =
66
+ options?.oAuthProvider ?? (0, lib_1.constructOAuthProvider)(config);
67
+ this.userAgentString = (0, lib_1.createUserAgentString)(config);
68
+ this.tenantId = config.CAMUNDA_TENANT_ID;
69
+ const baseUrl = (0, lib_1.RequireConfiguration)(config.ZEEBE_REST_ADDRESS, 'ZEEBE_REST_ADDRESS');
70
+ const prefixUrl = `${baseUrl}/${CAMUNDA_REST_API_VERSION}`;
71
+ this.rest = (0, lib_1.GetCustomCertificateBuffer)(config).then((certificateAuthority) => got_1.default.extend({
72
+ prefixUrl,
73
+ retry: lib_1.GotRetryConfig,
74
+ https: {
75
+ certificateAuthority,
76
+ },
77
+ handlers: [lib_1.gotErrorHandler],
78
+ hooks: {
79
+ beforeRetry: [
80
+ (0, lib_1.makeBeforeRetryHandlerFor401TokenRetry)(this.getHeaders.bind(this)),
81
+ ],
82
+ beforeError: [lib_1.gotBeforeErrorHook],
83
+ beforeRequest: [
84
+ (options) => {
85
+ const body = options.body;
86
+ const path = options.url.href;
87
+ const method = options.method;
88
+ trace(`${method} ${path}`);
89
+ trace(body);
90
+ this.log.debug(`${method} ${path}`);
91
+ this.log.trace(body?.toString());
92
+ },
93
+ ...(config.middleware ?? []),
94
+ ],
95
+ },
96
+ }));
97
+ }
98
+ async getHeaders() {
99
+ const token = await this.oAuthProvider.getToken('ZEEBE');
100
+ const headers = {
101
+ 'content-type': 'application/json',
102
+ authorization: `Bearer ${token}`,
103
+ 'user-agent': this.userAgentString,
104
+ accept: '*/*',
105
+ };
106
+ const safeHeaders = {
107
+ ...headers,
108
+ authorization: headers.authorization.substring(0, 15) +
109
+ (headers.authorization.length > 8)
110
+ ? '...'
111
+ : '',
112
+ };
113
+ trace('headers', safeHeaders);
114
+ return headers;
115
+ }
116
+ /**
117
+ * Manage the permissions assigned to authorization.
118
+ *
119
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/patch-authorization/
120
+ *
121
+ * @since 8.6.0
122
+ */
123
+ async modifyAuthorization(req) {
124
+ const headers = await this.getHeaders();
125
+ const { ownerKey, ...request } = req;
126
+ return this.rest.then((rest) => rest
127
+ .patch(`authorizations/${ownerKey}`, {
128
+ headers,
129
+ body: (0, lossless_json_1.stringify)(request),
130
+ })
131
+ .json());
132
+ }
133
+ /**
134
+ * Broadcast a signal.
135
+ *
136
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/broadcast-signal/
137
+ *
138
+ * @since 8.6.0
139
+ */
140
+ async broadcastSignal(req) {
141
+ const headers = await this.getHeaders();
142
+ const request = this.addDefaultTenantId(req);
143
+ return this.rest.then((rest) => rest
144
+ .post(`signals/broadcast`, {
145
+ headers,
146
+ body: (0, lossless_json_1.stringify)(request),
147
+ parseJson: (text) => (0, lib_1.losslessParse)(text, C8Dto_1.BroadcastSignalResponse),
148
+ })
149
+ .json());
150
+ }
151
+ /* Get the topology of the Zeebe cluster. */
152
+ async getTopology() {
153
+ const headers = await this.getHeaders();
154
+ return this.rest.then((rest) => rest.get('topology', { headers }).json());
155
+ }
156
+ /**
157
+ * Complete a user task with the given key. The method either completes the task or throws 400, 404, or 409.
158
+ *
159
+ * Documentation: https://docs.camunda.io/docs/apis-tools/zeebe-api-rest/specifications/complete-a-user-task/
160
+ *
161
+ * @since 8.6.0
162
+ */
163
+ async completeUserTask({ userTaskKey, variables = {}, action = 'complete', }) {
164
+ const headers = await this.getHeaders();
165
+ return this.rest.then((rest) => rest
166
+ .post(`user-tasks/${userTaskKey}/completion`, {
167
+ body: (0, lib_1.losslessStringify)({
168
+ variables,
169
+ action,
170
+ }),
171
+ headers,
172
+ })
173
+ .json());
174
+ }
175
+ /**
176
+ * Assign a user task with the given key to the given assignee.
177
+ *
178
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/assign-user-task/
179
+ *
180
+ * @since 8.6.0
181
+ */
182
+ async assignTask({ userTaskKey, assignee, allowOverride = true, action = 'assign', }) {
183
+ const headers = await this.getHeaders();
184
+ const req = {
185
+ allowOverride,
186
+ action,
187
+ assignee,
188
+ };
189
+ return this.rest.then((rest) => rest
190
+ .post(`user-tasks/${userTaskKey}/assignment`, {
191
+ body: (0, lib_1.losslessStringify)(req),
192
+ headers,
193
+ })
194
+ .json());
195
+ }
196
+ /**
197
+ * Update a user task with the given key.
198
+ *
199
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/update-user-task/
200
+ *
201
+ * @since 8.6.0
202
+ */
203
+ async updateTask({ userTaskKey, changeset, }) {
204
+ const headers = await this.getHeaders();
205
+ return this.rest.then((rest) => rest
206
+ .patch(`user-tasks/${userTaskKey}/update`, {
207
+ body: (0, lib_1.losslessStringify)(changeset),
208
+ headers,
209
+ })
210
+ .json());
211
+ }
212
+ /**
213
+ * Remove the assignee of a task with the given key.
214
+ *
215
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/unassign-user-task/
216
+ *
217
+ * @since 8.6.0
218
+ */
219
+ async unassignTask({ userTaskKey }) {
220
+ const headers = await this.getHeaders();
221
+ return this.rest.then((rest) => rest.delete(`user-tasks/${userTaskKey}/assignee`, { headers }).json());
222
+ }
223
+ /**
224
+ * Create a user.
225
+ *
226
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/create-user/
227
+ *
228
+ * @since 8.6.0
229
+ */
230
+ async createUser(newUserInfo) {
231
+ const headers = await this.getHeaders();
232
+ return this.rest.then((rest) => rest
233
+ .post(`users`, {
234
+ body: JSON.stringify(newUserInfo),
235
+ headers,
236
+ })
237
+ .json());
238
+ }
239
+ /**
240
+ * Search for user tasks based on given criteria.
241
+ *
242
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/query-user-tasks-alpha/
243
+ * @experimental
244
+ */
245
+ // public async queryTasks() {}
246
+ /**
247
+ * Publish a Message and correlates it to a subscription. If correlation is successful it will return the first process instance key the message correlated with.
248
+ *
249
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/correlate-a-message/
250
+ *
251
+ * @since 8.6.0
252
+ */
253
+ async correlateMessage(message) {
254
+ const headers = await this.getHeaders();
255
+ const req = this.addDefaultTenantId(message);
256
+ const body = (0, lib_1.losslessStringify)(req);
257
+ return this.rest.then((rest) => rest
258
+ .post(`messages/correlation`, {
259
+ body,
260
+ headers,
261
+ parseJson: (text) => (0, lib_1.losslessParse)(text, C8Dto_1.CorrelateMessageResponse),
262
+ })
263
+ .json());
264
+ }
265
+ /**
266
+ * Publish a single message. Messages are published to specific partitions computed from their correlation keys. This method does not wait for a correlation result. Use `correlateMessage` for such use cases.
267
+ *
268
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/publish-a-message/
269
+ *
270
+ * @since 8.6.0
271
+ */
272
+ async publishMessage(publishMessageRequest) {
273
+ const headers = await this.getHeaders();
274
+ const req = this.addDefaultTenantId(publishMessageRequest);
275
+ const body = (0, lib_1.losslessStringify)(req);
276
+ return this.rest.then((rest) => rest
277
+ .post(`messages/publication`, {
278
+ headers,
279
+ body,
280
+ parseJson: (text) => (0, lib_1.losslessParse)(text, C8Dto_1.PublishMessageResponse),
281
+ })
282
+ .json());
283
+ }
284
+ /**
285
+ * Obtains the status of the current Camunda license.
286
+ *
287
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/get-status-of-camunda-license/
288
+ *
289
+ * @since 8.6.0
290
+ */
291
+ async getLicenseStatus() {
292
+ return this.rest.then((rest) => rest.get(`license`).json());
293
+ }
294
+ /**
295
+ * Create a new polling Job Worker.
296
+ * You can pass in an optional winston.Logger instance as `logger`. This enables you to have distinct logging levels for different workers.
297
+ *
298
+ * @since 8.6.0
299
+ */
300
+ createJobWorker(config) {
301
+ const worker = new CamundaJobWorker_1.CamundaJobWorker(config, this);
302
+ // worker.start()
303
+ return worker;
304
+ }
305
+ /**
306
+ * Iterate through all known partitions and activate jobs up to the requested maximum.
307
+ *
308
+ * The parameter `inputVariablesDto` is a Dto to decode the job payload. The `customHeadersDto` parameter is a Dto to decode the custom headers.
309
+ * Pass in a Dto class that extends LosslessDto to provide both type information in your code,
310
+ * and safe interoperability with applications that use the `int64` type in variables.
311
+ *
312
+ * @since 8.6.0
313
+ */
314
+ async activateJobs(request) {
315
+ const headers = await this.getHeaders();
316
+ const { inputVariableDto = lib_1.LosslessDto, customHeadersDto = lib_1.LosslessDto, tenantIds = this.tenantId ? [this.tenantId] : undefined, ...req } = request;
317
+ /**
318
+ * The ActivateJobs endpoint can take multiple tenantIds, and activate jobs for multiple tenants at once.
319
+ */
320
+ const body = (0, lib_1.losslessStringify)({
321
+ ...req,
322
+ tenantIds,
323
+ });
324
+ const jobDto = (0, RestApiJobClassFactory_1.createSpecializedRestApiJobClass)(inputVariableDto, customHeadersDto);
325
+ return this.rest.then((rest) => rest
326
+ .post(`jobs/activation`, {
327
+ body,
328
+ headers,
329
+ parseJson: (text) => (0, lib_1.losslessParse)(text, jobDto, 'jobs'),
330
+ })
331
+ .json()
332
+ .then((activatedJobs) => activatedJobs.map(this.addJobMethods)));
333
+ }
334
+ /**
335
+ * Fails a job using the provided job key. This method sends a POST request to the endpoint '/jobs/{jobKey}/fail' with the failure reason and other details specified in the failJobRequest object.
336
+ *
337
+ * Documentation: https://docs.camunda.io/docs/next/apis-tools/camunda-api-rest/specifications/fail-job/
338
+ *
339
+ * @since 8.6.0
340
+ */
341
+ async failJob(failJobRequest) {
342
+ const { jobKey } = failJobRequest;
343
+ const headers = await this.getHeaders();
344
+ return this.rest.then((rest) => rest
345
+ .post(`jobs/${jobKey}/failure`, {
346
+ body: (0, lib_1.losslessStringify)(failJobRequest),
347
+ headers,
348
+ })
349
+ .then(() => types_1.JOB_ACTION_ACKNOWLEDGEMENT));
350
+ }
351
+ /**
352
+ * Report a business error (i.e. non-technical) that occurs while processing a job.
353
+ *
354
+ * Documentation: https://docs.camunda.io/docs/next/apis-tools/camunda-api-rest/specifications/report-error-for-job/
355
+ *
356
+ * @since 8.6.0
357
+ */
358
+ async errorJob(errorJobRequest) {
359
+ const { jobKey, ...request } = errorJobRequest;
360
+ const headers = await this.getHeaders();
361
+ return this.rest.then((rest) => rest
362
+ .post(`jobs/${jobKey}/error`, {
363
+ body: (0, lib_1.losslessStringify)(request),
364
+ headers,
365
+ parseJson: (text) => (0, lib_1.losslessParse)(text),
366
+ })
367
+ .then(() => types_1.JOB_ACTION_ACKNOWLEDGEMENT));
368
+ }
369
+ /**
370
+ * Complete a job with the given payload, which allows completing the associated service task.
371
+ *
372
+ * Documentation: https://docs.camunda.io/docs/next/apis-tools/camunda-api-rest/specifications/complete-job/
373
+ *
374
+ * @since 8.6.0
375
+ */
376
+ async completeJob(completeJobRequest) {
377
+ const { jobKey } = completeJobRequest;
378
+ const headers = await this.getHeaders();
379
+ const req = { variables: completeJobRequest.variables };
380
+ return this.rest.then((rest) => rest
381
+ .post(`jobs/${jobKey}/completion`, {
382
+ body: (0, lib_1.losslessStringify)(req),
383
+ headers,
384
+ })
385
+ .then(() => types_1.JOB_ACTION_ACKNOWLEDGEMENT));
386
+ }
387
+ /**
388
+ * Update a job with the given key.
389
+ *
390
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/update-a-job/
391
+ *
392
+ * @since 8.6.0
393
+ */
394
+ async updateJob(jobChangeset) {
395
+ const { jobKey, ...changeset } = jobChangeset;
396
+ const headers = await this.getHeaders();
397
+ return this.rest.then((rest) => rest.patch(`jobs/${jobKey}`, {
398
+ body: JSON.stringify(changeset),
399
+ headers,
400
+ }));
401
+ }
402
+ /**
403
+ * Marks the incident as resolved; most likely a call to Update job will be necessary to reset the job's retries, followed by this call.
404
+ *
405
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/resolve-incident/
406
+ *
407
+ * @since 8.6.0
408
+ */
409
+ async resolveIncident(incidentKey) {
410
+ const headers = await this.getHeaders();
411
+ return this.rest.then((rest) => rest.post(`incidents/${incidentKey}/resolution`, {
412
+ headers,
413
+ }));
414
+ }
415
+ async createProcessInstance(request) {
416
+ const headers = await this.getHeaders();
417
+ const outputVariablesDto = request.outputVariablesDto ?? DefaultLosslessDto;
418
+ const CreateProcessInstanceResponseWithVariablesDto = (0, RestApiProcessInstanceClassFactory_1.createSpecializedCreateProcessInstanceResponseClass)(outputVariablesDto);
419
+ return this.rest.then((rest) => rest
420
+ .post(`process-instances`, {
421
+ body: (0, lib_1.losslessStringify)(this.addDefaultTenantId(request)),
422
+ headers,
423
+ parseJson: (text) => (0, lib_1.losslessParse)(text, CreateProcessInstanceResponseWithVariablesDto),
424
+ })
425
+ .json());
426
+ }
427
+ async createProcessInstanceWithResult(request) {
428
+ /**
429
+ * We override the type system to make `awaitCompletion` hidden from end-users. This has been done because supporting the permutations of
430
+ * creating a process with/without awaiting the result and with/without an outputVariableDto in a single method is complex. I could not get all
431
+ * the cases to work with intellisense for the end-user using either generics or with signature overloads.
432
+ *
433
+ * To address this, createProcessInstance has all the functionality, but hides the `awaitCompletion` attribute from the signature. This method
434
+ * is a wrapper around createProcessInstance that sets `awaitCompletion` to true, and explicitly informs the type system via signature overloads.
435
+ *
436
+ * This is not ideal, but it is the best solution I could come up with.
437
+ */
438
+ return this.createProcessInstance({
439
+ ...request,
440
+ awaitCompletion: true,
441
+ outputVariablesDto: request.outputVariablesDto,
442
+ });
443
+ }
444
+ /**
445
+ * Cancel an active process instance
446
+ */
447
+ async cancelProcessInstance({ processInstanceKey, operationReference, }) {
448
+ const headers = await this.getHeaders();
449
+ return this.rest.then((rest) => rest.post(`process-instances/${processInstanceKey}/cancellation`, {
450
+ body: JSON.stringify({ operationReference }),
451
+ headers,
452
+ }));
453
+ }
454
+ /**
455
+ * Migrates a process instance to a new process definition.
456
+ * This request can contain multiple mapping instructions to define mapping between the active process instance's elements and target process definition elements.
457
+ * Use this to upgrade a process instance to a new version of a process or to a different process definition, e.g. to keep your running instances up-to-date with the latest process improvements.
458
+ *
459
+ * Documentation: https://docs.camunda.io/docs/next/apis-tools/camunda-api-rest/specifications/migrate-process-instance/
460
+ *
461
+ * @since 8.6.0
462
+ */
463
+ async migrateProcessInstance(req) {
464
+ const headers = await this.getHeaders();
465
+ const { processInstanceKey, ...request } = req;
466
+ this.log.debug(`Migrating process instance ${processInstanceKey}`, {
467
+ component: 'C8RestClient',
468
+ });
469
+ return this.rest.then((rest) => rest.post(`process-instances/${processInstanceKey}/migration`, {
470
+ headers,
471
+ body: (0, lib_1.losslessStringify)(request),
472
+ }));
473
+ }
474
+ /**
475
+ * Deploy resources to the broker.
476
+ * @param resources - An array of binary data strings representing the resources to deploy.
477
+ * @param tenantId - Optional tenant ID to deploy the resources to. If not provided, the default tenant ID is used.
478
+ *
479
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/deploy-resources/
480
+ *
481
+ * @since 8.6.0
482
+ */
483
+ async deployResources(resources, tenantId) {
484
+ const headers = await this.getHeaders();
485
+ const formData = new form_data_1.default();
486
+ resources.forEach((resource) => {
487
+ formData.append(`resources`, resource.content, {
488
+ filename: resource.name,
489
+ });
490
+ });
491
+ if (tenantId || this.tenantId) {
492
+ formData.append('tenantId', tenantId ?? this.tenantId);
493
+ }
494
+ this.log.debug(`Deploying ${resources.length} resources`);
495
+ const res = await this.rest.then((rest) => rest
496
+ .post('deployments', {
497
+ body: formData,
498
+ headers: {
499
+ ...headers,
500
+ ...formData.getHeaders(),
501
+ Accept: 'application/json',
502
+ },
503
+ parseJson: (text) => (0, lossless_json_1.parse)(text), // we parse the response with LosslessNumbers, with no Dto
504
+ })
505
+ .json());
506
+ /**
507
+ * Now we need to examine the response and parse the deployments to lossless Dtos
508
+ * We dynamically construct the response object for the caller, by examining the lossless response
509
+ * and re-parsing each of the deployments with the correct Dto.
510
+ */
511
+ const deploymentResponse = new C8Dto_1.DeployResourceResponse();
512
+ deploymentResponse.deploymentKey = res.deploymentKey.toString();
513
+ deploymentResponse.tenantId = res.tenantId;
514
+ deploymentResponse.deployments = [];
515
+ deploymentResponse.processes = [];
516
+ deploymentResponse.decisions = [];
517
+ deploymentResponse.decisionRequirements = [];
518
+ deploymentResponse.forms = [];
519
+ /**
520
+ * Type-guard assertions to correctly type the deployments. The API returns an array with mixed types.
521
+ */
522
+ const isProcessDeployment = (deployment) => !!deployment.processDefinition;
523
+ const isDecisionDeployment = (deployment) => !!deployment.decisionDefinition;
524
+ const isDecisionRequirementsDeployment = (deployment) => !!deployment.decisionRequirements;
525
+ const isFormDeployment = (deployment) => !!deployment.form;
526
+ /**
527
+ * Here we examine each of the deployments returned from the API, and create a correctly typed
528
+ * object for each one. We also populate subkeys per type. This allows SDK users to work with
529
+ * types known ahead of time.
530
+ */
531
+ res.deployments.forEach((deployment) => {
532
+ if (isProcessDeployment(deployment)) {
533
+ const processDeployment = (0, lib_1.losslessParse)((0, lossless_json_1.stringify)(deployment.processDefinition), C8Dto_1.ProcessDeployment);
534
+ deploymentResponse.deployments.push({
535
+ processDefinition: processDeployment,
536
+ });
537
+ deploymentResponse.processes.push(processDeployment);
538
+ }
539
+ if (isDecisionDeployment(deployment)) {
540
+ const decisionDeployment = (0, lib_1.losslessParse)((0, lossless_json_1.stringify)(deployment), C8Dto_1.DecisionDeployment);
541
+ deploymentResponse.deployments.push({
542
+ decisionDefinition: decisionDeployment,
543
+ });
544
+ deploymentResponse.decisions.push(decisionDeployment);
545
+ }
546
+ if (isDecisionRequirementsDeployment(deployment)) {
547
+ const decisionRequirementsDeployment = (0, lib_1.losslessParse)((0, lossless_json_1.stringify)(deployment), C8Dto_1.DecisionRequirementsDeployment);
548
+ deploymentResponse.deployments.push({
549
+ decisionRequirements: decisionRequirementsDeployment,
550
+ });
551
+ deploymentResponse.decisionRequirements.push(decisionRequirementsDeployment);
552
+ }
553
+ if (isFormDeployment(deployment)) {
554
+ const formDeployment = (0, lib_1.losslessParse)((0, lossless_json_1.stringify)(deployment), C8Dto_1.FormDeployment);
555
+ deploymentResponse.deployments.push({ form: formDeployment });
556
+ deploymentResponse.forms.push(formDeployment);
557
+ }
558
+ });
559
+ return deploymentResponse;
560
+ }
561
+ /**
562
+ * Deploy resources to Camunda 8 from files
563
+ * @param files an array of file paths
564
+ *
565
+ * @since 8.6.0
566
+ */
567
+ async deployResourcesFromFiles(files) {
568
+ const resources = [];
569
+ for (const file of files) {
570
+ resources.push({
571
+ content: node_fs_1.default.readFileSync(file, { encoding: 'binary' }),
572
+ name: file,
573
+ });
574
+ }
575
+ return this.deployResources(resources);
576
+ }
577
+ /**
578
+ * Deletes a deployed resource. This can be a process definition, decision requirements definition, or form definition deployed using the deploy resources endpoint. Specify the resource you want to delete in the resourceKey parameter.
579
+ *
580
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/delete-resource/
581
+ *
582
+ * @since 8.6.0
583
+ */
584
+ async deleteResource(req) {
585
+ const headers = await this.getHeaders();
586
+ const { resourceKey, operationReference } = req;
587
+ return this.rest.then((rest) => rest.post(`resources/${resourceKey}/deletion`, {
588
+ headers,
589
+ body: (0, lossless_json_1.stringify)({ operationReference }),
590
+ }));
591
+ }
592
+ /**
593
+ * Set a precise, static time for the Zeebe engine's internal clock.
594
+ * When the clock is pinned, it remains at the specified time and does not advance.
595
+ * To change the time, the clock must be pinned again with a new timestamp, or reset.
596
+ *
597
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/pin-internal-clock/
598
+ *
599
+ * @since 8.6.0
600
+ */
601
+ async pinInternalClock(epochMs) {
602
+ const headers = await this.getHeaders();
603
+ return this.rest.then((rest) => rest.put(`clock`, {
604
+ headers,
605
+ body: JSON.stringify({ timestamp: epochMs }),
606
+ }));
607
+ }
608
+ /**
609
+ * Resets the Zeebe engine's internal clock to the current system time, enabling it to tick in real-time.
610
+ * This operation is useful for returning the clock to normal behavior after it has been pinned to a specific time.
611
+ *
612
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/reset-internal-clock/
613
+ *
614
+ * @since 8.6.0
615
+ */
616
+ async resetClock() {
617
+ const headers = await this.getHeaders();
618
+ return this.rest.then((rest) => rest.post(`clock/reset`, { headers }));
619
+ }
620
+ /**
621
+ * Updates all the variables of a particular scope (for example, process instance, flow element instance) with the given variable data.
622
+ * Specify the element instance in the elementInstanceKey parameter.
623
+ *
624
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/update-element-instance-variables/
625
+ *
626
+ * @since 8.6.0
627
+ */
628
+ async updateElementInstanceVariables(req) {
629
+ const headers = await this.getHeaders();
630
+ const { elementInstanceKey, ...request } = req;
631
+ return this.rest.then((rest) => rest.post(`element-instances/${elementInstanceKey}/variables`, {
632
+ headers,
633
+ body: (0, lossless_json_1.stringify)(request),
634
+ }));
635
+ }
636
+ /**
637
+ * Helper method to add the default tenantIds if we are not passed explicit tenantIds
638
+ */
639
+ addDefaultTenantId(request) {
640
+ const tenantId = request.tenantId ?? this.tenantId;
641
+ return { ...request, tenantId };
642
+ }
643
+ }
644
+ exports.CamundaRestClient = CamundaRestClient;
645
+ //# sourceMappingURL=CamundaRestClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CamundaRestClient.js","sourceRoot":"","sources":["../../../src/c8/lib/CamundaRestClient.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAwB;AAExB,iCAA6B;AAC7B,0DAAgC;AAChC,8CAAqB;AACrB,iDAAgD;AAEhD,mCAckB;AAElB,6CAY0B;AAE1B,mCAoBgB;AAChB,yCAA8C;AAC9C,yDAA6E;AAC7E,qEAA2E;AAC3E,6FAA0G;AAE1G,MAAM,KAAK,GAAG,IAAA,aAAK,EAAC,oBAAoB,CAAC,CAAA;AAEzC,MAAM,wBAAwB,GAAG,IAAI,CAAA;AAErC,MAAM,kBAAmB,SAAQ,iBAAW;CAAG;AAC/C;;;;;;;;;;;GAWG;AACH,MAAa,iBAAiB;IAO7B;;OAEG;IACH,YAAY,OAGX;QAw0BO,kBAAa,GAAG,CACvB,GAAsC,EAEQ,EAAE;YAChD,OAAO;gBACN,GAAG,GAAG;gBACN,cAAc,EAAE,GAAG,EAAE;oBACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;gBACnC,CAAC;gBACD,QAAQ,EAAE,CAAC,YAA+B,EAAE,EAAE,EAAE,CAC/C,IAAI,CAAC,WAAW,CAAC;oBAChB,MAAM,EAAE,GAAG,CAAC,MAAM;oBAClB,SAAS;iBACT,CAAC;gBACH,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAChB,IAAI,CAAC,QAAQ,CAAC;oBACb,GAAG,KAAK;oBACR,MAAM,EAAE,GAAG,CAAC,MAAM;iBAClB,CAAC;gBACH,IAAI,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;gBACtD,qFAAqF;gBACrF,OAAO,EAAE,GAAG,EAA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