@camunda8/sdk 8.6.13 → 8.6.15

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 (71) hide show
  1. package/CHANGELOG.md +37 -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 +13 -6
  45. package/dist/modeler/lib/ModelerAPIClient.js.map +1 -1
  46. package/dist/modeler/lib/ModelerDto.d.ts +4 -5
  47. package/dist/operate/lib/OperateApiClient.js +1 -0
  48. package/dist/operate/lib/OperateApiClient.js.map +1 -1
  49. package/dist/optimize/lib/OptimizeApiClient.js +1 -0
  50. package/dist/optimize/lib/OptimizeApiClient.js.map +1 -1
  51. package/dist/proto/zeebe.proto +22 -0
  52. package/dist/tasklist/lib/TasklistApiClient.js +1 -0
  53. package/dist/tasklist/lib/TasklistApiClient.js.map +1 -1
  54. package/dist/zeebe/lib/GrpcClient.js +1 -6
  55. package/dist/zeebe/lib/GrpcClient.js.map +1 -1
  56. package/dist/zeebe/lib/ZBWorkerBase.js +2 -3
  57. package/dist/zeebe/lib/ZBWorkerBase.js.map +1 -1
  58. package/dist/zeebe/lib/interfaces-1.0.d.ts +101 -8
  59. package/dist/zeebe/lib/interfaces-1.0.js.map +1 -1
  60. package/dist/zeebe/lib/interfaces-grpc-1.0.d.ts +22 -3
  61. package/dist/zeebe/lib/interfaces-grpc-1.0.js.map +1 -1
  62. package/dist/zeebe/lib/stringifyVariables.d.ts +8 -0
  63. package/dist/zeebe/lib/stringifyVariables.js +18 -4
  64. package/dist/zeebe/lib/stringifyVariables.js.map +1 -1
  65. package/dist/zeebe/zb/ZeebeGrpcClient.d.ts +9 -7
  66. package/dist/zeebe/zb/ZeebeGrpcClient.js +41 -9
  67. package/dist/zeebe/zb/ZeebeGrpcClient.js.map +1 -1
  68. package/dist/zeebe/zb/ZeebeRESTClient.d.ts +3 -0
  69. package/dist/zeebe/zb/ZeebeRESTClient.js +3 -0
  70. package/dist/zeebe/zb/ZeebeRESTClient.js.map +1 -1
  71. package/package.json +7 -2
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PublishMessageResponse = exports.CorrelateMessageResponse = exports.BroadcastSignalResponse = exports.CreateProcessInstanceResponse = exports.DeployResourceResponse = exports.DeployResourceResponseDto = exports.FormDeployment = exports.DecisionRequirementsDeployment = exports.DecisionDeployment = exports.ProcessDeployment = exports.RestApiJob = void 0;
10
+ const lib_1 = require("../../lib");
11
+ class RestApiJob extends lib_1.LosslessDto {
12
+ }
13
+ exports.RestApiJob = RestApiJob;
14
+ __decorate([
15
+ lib_1.Int64String
16
+ ], RestApiJob.prototype, "jobKey", void 0);
17
+ __decorate([
18
+ lib_1.Int64String
19
+ ], RestApiJob.prototype, "processInstanceKey", void 0);
20
+ __decorate([
21
+ lib_1.Int64String
22
+ ], RestApiJob.prototype, "processDefinitionKey", void 0);
23
+ __decorate([
24
+ lib_1.Int64String
25
+ ], RestApiJob.prototype, "elementInstanceKey", void 0);
26
+ __decorate([
27
+ lib_1.Int64String
28
+ ], RestApiJob.prototype, "deadline", void 0);
29
+ class ProcessDeployment extends lib_1.LosslessDto {
30
+ }
31
+ exports.ProcessDeployment = ProcessDeployment;
32
+ __decorate([
33
+ lib_1.Int64String
34
+ ], ProcessDeployment.prototype, "processDefinitionKey", void 0);
35
+ class DecisionDeployment extends lib_1.LosslessDto {
36
+ }
37
+ exports.DecisionDeployment = DecisionDeployment;
38
+ __decorate([
39
+ lib_1.Int64String
40
+ ], DecisionDeployment.prototype, "decisionKey", void 0);
41
+ __decorate([
42
+ lib_1.Int64String
43
+ ], DecisionDeployment.prototype, "dmnDecisionRequirementsKey", void 0);
44
+ class DecisionRequirementsDeployment extends lib_1.LosslessDto {
45
+ }
46
+ exports.DecisionRequirementsDeployment = DecisionRequirementsDeployment;
47
+ __decorate([
48
+ lib_1.Int64String
49
+ ], DecisionRequirementsDeployment.prototype, "dmnDecisionRequirementsKey", void 0);
50
+ class FormDeployment {
51
+ }
52
+ exports.FormDeployment = FormDeployment;
53
+ __decorate([
54
+ lib_1.Int64String
55
+ ], FormDeployment.prototype, "formKey", void 0);
56
+ class DeployResourceResponseDto extends lib_1.LosslessDto {
57
+ }
58
+ exports.DeployResourceResponseDto = DeployResourceResponseDto;
59
+ __decorate([
60
+ lib_1.Int64String
61
+ ], DeployResourceResponseDto.prototype, "deploymentKey", void 0);
62
+ class DeployResourceResponse extends DeployResourceResponseDto {
63
+ }
64
+ exports.DeployResourceResponse = DeployResourceResponse;
65
+ class CreateProcessInstanceResponse {
66
+ }
67
+ exports.CreateProcessInstanceResponse = CreateProcessInstanceResponse;
68
+ __decorate([
69
+ lib_1.Int64String
70
+ ], CreateProcessInstanceResponse.prototype, "processDefinitionKey", void 0);
71
+ __decorate([
72
+ lib_1.Int64String
73
+ ], CreateProcessInstanceResponse.prototype, "processInstanceKey", void 0);
74
+ /** The signal was broadcast. */
75
+ class BroadcastSignalResponse extends lib_1.LosslessDto {
76
+ }
77
+ exports.BroadcastSignalResponse = BroadcastSignalResponse;
78
+ __decorate([
79
+ lib_1.Int64String
80
+ /** The unique ID of the signal that was broadcast. */
81
+ ], BroadcastSignalResponse.prototype, "signalKey", void 0);
82
+ class CorrelateMessageResponse extends lib_1.LosslessDto {
83
+ }
84
+ exports.CorrelateMessageResponse = CorrelateMessageResponse;
85
+ __decorate([
86
+ lib_1.Int64String
87
+ ], CorrelateMessageResponse.prototype, "key", void 0);
88
+ __decorate([
89
+ lib_1.Int64String
90
+ ], CorrelateMessageResponse.prototype, "processInstanceKey", void 0);
91
+ class PublishMessageResponse extends lib_1.LosslessDto {
92
+ }
93
+ exports.PublishMessageResponse = PublishMessageResponse;
94
+ __decorate([
95
+ lib_1.Int64String
96
+ ], PublishMessageResponse.prototype, "key", void 0);
97
+ //# sourceMappingURL=C8Dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"C8Dto.js","sourceRoot":"","sources":["../../../src/c8/lib/C8Dto.ts"],"names":[],"mappings":";;;;;;;;;AAEA,mCAAoD;AAGpD,MAAa,UAGX,SAAQ,iBAAW;CAoBpB;AAvBD,gCAuBC;AAlBA;IADC,iBAAW;0CACG;AAGf;IADC,iBAAW;sDACe;AAI3B;IADC,iBAAW;wDACiB;AAG7B;IADC,iBAAW;sDACe;AAK3B;IADC,iBAAW;4CACK;AAuClB,MAAa,iBAAkB,SAAQ,iBAAW;CAOjD;AAPD,8CAOC;AAHA;IADC,iBAAW;+DACiB;AAK9B,MAAa,kBAAmB,SAAQ,iBAAW;CAUlD;AAVD,gDAUC;AANA;IADC,iBAAW;uDACQ;AAKpB;IADC,iBAAW;sEACuB;AAGpC,MAAa,8BAA+B,SAAQ,iBAAW;CAQ9D;AARD,wEAQC;AAFA;IADC,iBAAW;kFACuB;AAGpC,MAAa,cAAc;CAO1B;AAPD,wCAOC;AAHA;IADC,iBAAW;+CACI;AAKjB,MAAa,yBAA0B,SAAQ,iBAAW;CAUzD;AAVD,8DAUC;AARA;IADC,iBAAW;gEACU;AAUvB,MAAa,sBAAuB,SAAQ,yBAAyB;CAKpE;AALD,wDAKC;AAED,MAAa,6BAA6B;CAyBzC;AAzBD,sEAyBC;AAnBS;IADR,iBAAW;2EAC0B;AAU7B;IADR,iBAAW;yEACwB;AA8BrC,gCAAgC;AAChC,MAAa,uBAAwB,SAAQ,iBAAW;CAMvD;AAND,0DAMC;AAHA;IAFC,iBAAW;IACZ,sDAAsD;0DACpC;AA4BnB,MAAa,wBAAyB,SAAQ,iBAAW;CASxD;AATD,4DASC;AANA;IADC,iBAAW;qDACA;AAKZ;IADC,iBAAW;oEACe;AAG5B,MAAa,sBAAuB,SAAQ,iBAAW;CAMtD;AAND,wDAMC;AAHA;IADC,iBAAW;mDACA"}
@@ -0,0 +1,9 @@
1
+ import { Camunda8ClientConfiguration } from '../../lib';
2
+ export type Logger = {
3
+ info: (message: string | undefined, ...meta: any[]) => void;
4
+ warn: (message: string | undefined, ...meta: any[]) => void;
5
+ error: (message: string | undefined, ...meta: any[]) => void;
6
+ debug: (message: string | undefined, ...meta: any[]) => void;
7
+ trace: (message: string | undefined, ...meta: any[]) => void;
8
+ };
9
+ export declare function getLogger(config?: Camunda8ClientConfiguration): Logger;
@@ -0,0 +1,35 @@
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.getLogger = void 0;
7
+ const winston_1 = __importDefault(require("winston")); // Import Winston
8
+ const lib_1 = require("../../lib");
9
+ let defaultLogger;
10
+ let cachedLogger;
11
+ function getLogger(config) {
12
+ const configuration = lib_1.CamundaEnvironmentConfigurator.mergeConfigWithEnvironment(config ?? {});
13
+ // We assume that the SDK user uses a single winston instance for 100% of logging, or no logger at all (in which case we create our own)
14
+ if (config?.logger && cachedLogger !== config.logger) {
15
+ cachedLogger = config.logger;
16
+ config.logger.debug(`Using supplied logger`);
17
+ }
18
+ if (!defaultLogger) {
19
+ // Define the default logger
20
+ const logger = winston_1.default.createLogger({
21
+ level: configuration.CAMUNDA_LOG_LEVEL,
22
+ format: winston_1.default.format.combine(winston_1.default.format.timestamp(), winston_1.default.format.colorize(), winston_1.default.format.simple()),
23
+ transports: [new winston_1.default.transports.Console()],
24
+ }); // eslint-disable-line @typescript-eslint/no-explicit-any
25
+ logger.trace = logger.silly;
26
+ defaultLogger = logger;
27
+ }
28
+ if (!cachedLogger) {
29
+ defaultLogger.debug(`Using default winston logger`);
30
+ cachedLogger = defaultLogger;
31
+ }
32
+ return config?.logger ?? defaultLogger;
33
+ }
34
+ exports.getLogger = getLogger;
35
+ //# sourceMappingURL=C8Logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"C8Logger.js","sourceRoot":"","sources":["../../../src/c8/lib/C8Logger.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B,CAAC,iBAAiB;AAE/C,mCAGkB;AAYlB,IAAI,aAAqB,CAAA;AACzB,IAAI,YAAgC,CAAA;AAEpC,SAAgB,SAAS,CAAC,MAAoC;IAC7D,MAAM,aAAa,GAClB,oCAA8B,CAAC,0BAA0B,CAAC,MAAM,IAAI,EAAE,CAAC,CAAA;IACxE,wIAAwI;IACxI,IAAI,MAAM,EAAE,MAAM,IAAI,YAAY,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;QACtD,YAAY,GAAG,MAAM,CAAC,MAAM,CAAA;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;IAC7C,CAAC;IACD,IAAI,CAAC,aAAa,EAAE,CAAC;QACpB,4BAA4B;QAC5B,MAAM,MAAM,GAGR,iBAAO,CAAC,YAAY,CAAC;YACxB,KAAK,EAAE,aAAa,CAAC,iBAAiB;YACtC,MAAM,EAAE,iBAAO,CAAC,MAAM,CAAC,OAAO,CAC7B,iBAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAC1B,iBAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EACzB,iBAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CACvB;YACD,UAAU,EAAE,CAAC,IAAI,iBAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;SAC9C,CAAQ,CAAA,CAAC,yDAAyD;QAEnE,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;QAC3B,aAAa,GAAG,MAAM,CAAA;IACvB,CAAC;IACD,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,aAAa,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;QACnD,YAAY,GAAG,aAAa,CAAA;IAC7B,CAAC;IACD,OAAO,MAAM,EAAE,MAAM,IAAI,aAAa,CAAA;AACvC,CAAC;AA/BD,8BA+BC"}
@@ -0,0 +1,52 @@
1
+ import TypedEmitter from 'typed-emitter';
2
+ import { LosslessDto } from '../../lib';
3
+ import { ActivateJobsRequest, IProcessVariables, JobCompletionInterfaceRest, MustReturnJobActionAcknowledgement } from '../../zeebe/types';
4
+ import { Ctor, RestJob } from './C8Dto';
5
+ import { Logger } from './C8Logger';
6
+ import { CamundaRestClient } from './CamundaRestClient';
7
+ type CamundaJobWorkerEvents = {
8
+ pollError: (error: Error) => void;
9
+ start: () => void;
10
+ stop: () => void;
11
+ poll: ({ currentlyActiveJobCount, maxJobsToActivate, worker, }: {
12
+ currentlyActiveJobCount: number;
13
+ maxJobsToActivate: number;
14
+ worker: string;
15
+ }) => void;
16
+ };
17
+ export interface CamundaJobWorkerConfig<VariablesDto extends LosslessDto, CustomHeadersDto extends LosslessDto> extends ActivateJobsRequest {
18
+ inputVariableDto?: Ctor<VariablesDto>;
19
+ customHeadersDto?: Ctor<CustomHeadersDto>;
20
+ /** How often the worker will poll for new jobs. Defaults to 30s */
21
+ pollIntervalMs?: number;
22
+ jobHandler: (job: RestJob<VariablesDto, CustomHeadersDto> & JobCompletionInterfaceRest<IProcessVariables>, log: Logger) => MustReturnJobActionAcknowledgement;
23
+ logger?: Logger;
24
+ /** Default: true. Start the worker polling immediately. If set to `false`, call the worker's `start()` method to start polling for work. */
25
+ autoStart?: boolean;
26
+ }
27
+ declare const CamundaJobWorker_base: new () => TypedEmitter<CamundaJobWorkerEvents>;
28
+ export declare class CamundaJobWorker<VariablesDto extends LosslessDto, CustomHeadersDto extends LosslessDto> extends CamundaJobWorker_base {
29
+ private readonly config;
30
+ private readonly restClient;
31
+ currentlyActiveJobCount: number;
32
+ capacity: number;
33
+ private loopHandle?;
34
+ private pollInterval;
35
+ log: Logger;
36
+ logMeta: () => {
37
+ worker: string;
38
+ type: string;
39
+ pollIntervalMs: number;
40
+ capacity: number;
41
+ currentload: number;
42
+ };
43
+ constructor(config: CamundaJobWorkerConfig<VariablesDto, CustomHeadersDto>, restClient: CamundaRestClient);
44
+ start(): void;
45
+ /** Stops the Job Worker polling for more jobs. If await this call, and it will return as soon as all currently active jobs are completed.
46
+ * The deadline for all currently active jobs to complete is 30s by default. If the active jobs do not complete by the deadline, this method will throw.
47
+ */
48
+ stop(deadlineMs?: number): Promise<unknown>;
49
+ private poll;
50
+ private handleJob;
51
+ }
52
+ export {};
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CamundaJobWorker = void 0;
4
+ const events_1 = require("events");
5
+ const C8Logger_1 = require("./C8Logger");
6
+ // Make this class extend event emitter and have a typed event 'pollError'
7
+ class CamundaJobWorker extends events_1.EventEmitter {
8
+ constructor(config, restClient) {
9
+ super();
10
+ this.config = config;
11
+ this.restClient = restClient;
12
+ this.currentlyActiveJobCount = 0;
13
+ this.pollInterval = config.pollIntervalMs ?? 30000;
14
+ this.capacity = this.config.maxJobsToActivate;
15
+ this.log = (0, C8Logger_1.getLogger)({ logger: config.logger });
16
+ this.logMeta = () => ({
17
+ worker: this.config.worker,
18
+ type: this.config.type,
19
+ pollIntervalMs: this.pollInterval,
20
+ capacity: this.config.maxJobsToActivate,
21
+ currentload: this.currentlyActiveJobCount,
22
+ });
23
+ this.log.debug(`Created REST Job Worker`, this.logMeta());
24
+ if (config.autoStart ?? true) {
25
+ this.start();
26
+ }
27
+ }
28
+ start() {
29
+ this.log.debug(`Starting poll loop`, this.logMeta());
30
+ this.emit('start');
31
+ this.poll();
32
+ this.loopHandle = setInterval(() => this.poll(), this.pollInterval);
33
+ }
34
+ /** Stops the Job Worker polling for more jobs. If await this call, and it will return as soon as all currently active jobs are completed.
35
+ * The deadline for all currently active jobs to complete is 30s by default. If the active jobs do not complete by the deadline, this method will throw.
36
+ */
37
+ async stop(deadlineMs = 30000) {
38
+ this.log.debug(`Stop requested`, this.logMeta());
39
+ /** Stopping polling for new jobs */
40
+ clearInterval(this.loopHandle);
41
+ return new Promise((resolve, reject) => {
42
+ if (this.currentlyActiveJobCount === 0) {
43
+ this.log.debug(`All jobs drained. Worker stopped.`, this.logMeta());
44
+ this.emit('stop');
45
+ return resolve(null);
46
+ }
47
+ /** This is an error timeout - if we don't complete all active jobs before the specified deadline, we reject the Promise */
48
+ const timeout = setTimeout(() => {
49
+ clearInterval(wait);
50
+ this.log.debug(`Failed to drain all jobs in ${deadlineMs}ms`, this.logMeta());
51
+ return reject(`Failed to drain all jobs in ${deadlineMs}ms`);
52
+ }, deadlineMs);
53
+ /** Check every 500ms to see if our active job count has hit zero, i.e: all active work is stopped */
54
+ const wait = setInterval(() => {
55
+ if (this.currentlyActiveJobCount === 0) {
56
+ this.log.debug(`All jobs drained. Worker stopped.`, this.logMeta());
57
+ clearInterval(wait);
58
+ clearTimeout(timeout);
59
+ this.emit('stop');
60
+ return resolve(null);
61
+ }
62
+ this.log.debug(`Stopping - waiting for active jobs to complete.`, this.logMeta());
63
+ }, 500);
64
+ });
65
+ }
66
+ poll() {
67
+ this.emit('poll', {
68
+ currentlyActiveJobCount: this.currentlyActiveJobCount,
69
+ maxJobsToActivate: this.config.maxJobsToActivate,
70
+ worker: this.config.worker,
71
+ });
72
+ if (this.currentlyActiveJobCount >= this.config.maxJobsToActivate) {
73
+ this.log.debug(`At capacity - not requesting more jobs`, this.logMeta());
74
+ return;
75
+ }
76
+ this.log.trace(`Polling for jobs`, this.logMeta());
77
+ const remainingJobCapacity = this.config.maxJobsToActivate - this.currentlyActiveJobCount;
78
+ this.restClient
79
+ .activateJobs({
80
+ ...this.config,
81
+ maxJobsToActivate: remainingJobCapacity,
82
+ })
83
+ .then((jobs) => {
84
+ const count = jobs.length;
85
+ this.currentlyActiveJobCount += count;
86
+ this.log.debug(`Activated ${count} jobs`, this.logMeta());
87
+ // The job handlers for the activated jobs will run in parallel
88
+ jobs.forEach((job) => this.handleJob(job));
89
+ })
90
+ .catch((e) => this.emit('pollError', e));
91
+ }
92
+ async handleJob(job) {
93
+ try {
94
+ this.log.debug(`Invoking job handler for job ${job.jobKey}`, this.logMeta());
95
+ await this.config.jobHandler(job, this.log);
96
+ this.log.debug(`Completed job handler for job ${job.jobKey}.`, this.logMeta());
97
+ }
98
+ catch (e) {
99
+ /** Unhandled exception in the job handler */
100
+ if (e instanceof Error) {
101
+ // If err is an instance of Error, we can safely access its properties
102
+ this.log.error(`Unhandled exception in job handler for job ${job.jobKey}`, this.logMeta());
103
+ this.log.error(`Error: ${e.message}`, {
104
+ stack: e.stack,
105
+ ...this.logMeta(),
106
+ });
107
+ }
108
+ else {
109
+ // If err is not an Error, log it as is
110
+ this.log.error('An unknown error occurred while executing a job handler', { error: e, ...this.logMeta() });
111
+ }
112
+ this.log.error(`Failing the job`, this.logMeta());
113
+ await job.fail({
114
+ errorMessage: e.toString(),
115
+ retries: job.retries - 1,
116
+ });
117
+ }
118
+ finally {
119
+ /** Decrement the active job count in all cases */
120
+ this.currentlyActiveJobCount--;
121
+ }
122
+ }
123
+ }
124
+ exports.CamundaJobWorker = CamundaJobWorker;
125
+ //# sourceMappingURL=CamundaJobWorker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CamundaJobWorker.js","sourceRoot":"","sources":["../../../src/c8/lib/CamundaJobWorker.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAarC,yCAA8C;AAmC9C,0EAA0E;AAC1E,MAAa,gBAGX,SAAS,qBAA+D;IAczE,YACkB,MAGhB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;gBACrC,OAAO,EAAE,GAAG,CAAC,OAAO,GAAG,CAAC;aACxB,CAAC,CAAA;QACH,CAAC;gBAAS,CAAC;YACV,kDAAkD;YAClD,IAAI,CAAC,uBAAuB,EAAE,CAAA;QAC/B,CAAC;IACF,CAAC;CACD;AAhKD,4CAgKC"}
@@ -0,0 +1,311 @@
1
+ import { Camunda8ClientConfiguration, LosslessDto } from '../../lib';
2
+ import { IOAuthProvider } from '../../oauth';
3
+ import { ActivateJobsRequest, BroadcastSignalReq, CompleteJobRequest, ErrorJobWithVariables, FailJobRequest, IProcessVariables, JobCompletionInterfaceRest, JSONDoc, PublishMessageRequest, TopologyResponse } from '../../zeebe/types';
4
+ import { BroadcastSignalResponse, CorrelateMessageResponse, CreateProcessInstanceReq, CreateProcessInstanceResponse, Ctor, DeployResourceResponse, JobUpdateChangeset, MigrationRequest, NewUserInfo, PatchAuthorizationRequest, PublishMessageResponse, RestJob, TaskChangeSet, UpdateElementVariableRequest } from './C8Dto';
5
+ import { Logger } from './C8Logger';
6
+ import { CamundaJobWorker, CamundaJobWorkerConfig } from './CamundaJobWorker';
7
+ /**
8
+ * The client for the unified Camunda 8 REST API.
9
+ *
10
+ * Logging: to enable debug tracing during development, you can set `DEBUG=camunda:zeebe-rest`.
11
+ *
12
+ * For production, you can pass in an instance of [winston.Logger](https://github.com/winstonjs/winston) to the constructor as `logger`.
13
+ *
14
+ * `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'.
15
+ *
16
+ * @since 8.6.0
17
+ * @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).
18
+ */
19
+ export declare class CamundaRestClient {
20
+ private userAgentString;
21
+ private oAuthProvider;
22
+ private rest;
23
+ private tenantId?;
24
+ log: Logger;
25
+ /**
26
+ * All constructor parameters for configuration are optional. If no configuration is provided, the SDK will use environment variables to configure itself.
27
+ */
28
+ constructor(options?: {
29
+ config?: Camunda8ClientConfiguration;
30
+ oAuthProvider?: IOAuthProvider;
31
+ });
32
+ private getHeaders;
33
+ /**
34
+ * Manage the permissions assigned to authorization.
35
+ *
36
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/patch-authorization/
37
+ *
38
+ * @since 8.6.0
39
+ */
40
+ modifyAuthorization(req: PatchAuthorizationRequest): Promise<unknown>;
41
+ /**
42
+ * Broadcast a signal.
43
+ *
44
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/broadcast-signal/
45
+ *
46
+ * @since 8.6.0
47
+ */
48
+ broadcastSignal(req: BroadcastSignalReq): Promise<BroadcastSignalResponse>;
49
+ getTopology(): Promise<TopologyResponse>;
50
+ /**
51
+ * Complete a user task with the given key. The method either completes the task or throws 400, 404, or 409.
52
+ *
53
+ * Documentation: https://docs.camunda.io/docs/apis-tools/zeebe-api-rest/specifications/complete-a-user-task/
54
+ *
55
+ * @since 8.6.0
56
+ */
57
+ completeUserTask({ userTaskKey, variables, action, }: {
58
+ userTaskKey: string;
59
+ variables?: Record<string, unknown>;
60
+ action?: string;
61
+ }): Promise<unknown>;
62
+ /**
63
+ * Assign a user task with the given key to the given assignee.
64
+ *
65
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/assign-user-task/
66
+ *
67
+ * @since 8.6.0
68
+ */
69
+ assignTask({ userTaskKey, assignee, allowOverride, action, }: {
70
+ /** The key of the user task to assign. */
71
+ userTaskKey: string;
72
+ /** The assignee for the user task. The assignee must not be empty or null. */
73
+ assignee: string;
74
+ /** By default, the task is reassigned if it was already assigned. Set this to false to return an error in such cases. The task must then first be unassigned to be assigned again. Use this when you have users picking from group task queues to prevent race conditions. */
75
+ allowOverride?: boolean;
76
+ /** A custom action value that will be accessible from user task events resulting from this endpoint invocation. If not provided, it will default to "assign". */
77
+ action: string;
78
+ }): Promise<unknown>;
79
+ /**
80
+ * Update a user task with the given key.
81
+ *
82
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/update-user-task/
83
+ *
84
+ * @since 8.6.0
85
+ */
86
+ updateTask({ userTaskKey, changeset, }: {
87
+ userTaskKey: string;
88
+ changeset: TaskChangeSet;
89
+ }): Promise<unknown>;
90
+ /**
91
+ * Remove the assignee of a task with the given key.
92
+ *
93
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/unassign-user-task/
94
+ *
95
+ * @since 8.6.0
96
+ */
97
+ unassignTask({ userTaskKey }: {
98
+ userTaskKey: string;
99
+ }): Promise<unknown>;
100
+ /**
101
+ * Create a user.
102
+ *
103
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/create-user/
104
+ *
105
+ * @since 8.6.0
106
+ */
107
+ createUser(newUserInfo: NewUserInfo): Promise<unknown>;
108
+ /**
109
+ * Search for user tasks based on given criteria.
110
+ *
111
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/query-user-tasks-alpha/
112
+ * @experimental
113
+ */
114
+ /**
115
+ * 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.
116
+ *
117
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/correlate-a-message/
118
+ *
119
+ * @since 8.6.0
120
+ */
121
+ correlateMessage(message: Pick<PublishMessageRequest, 'name' | 'correlationKey' | 'variables' | 'tenantId'>): Promise<CorrelateMessageResponse>;
122
+ /**
123
+ * 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.
124
+ *
125
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/publish-a-message/
126
+ *
127
+ * @since 8.6.0
128
+ */
129
+ publishMessage(publishMessageRequest: PublishMessageRequest): Promise<PublishMessageResponse>;
130
+ /**
131
+ * Obtains the status of the current Camunda license.
132
+ *
133
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/get-status-of-camunda-license/
134
+ *
135
+ * @since 8.6.0
136
+ */
137
+ getLicenseStatus(): Promise<{
138
+ vaildLicense: boolean;
139
+ licenseType: string;
140
+ }>;
141
+ /**
142
+ * Create a new polling Job Worker.
143
+ * You can pass in an optional winston.Logger instance as `logger`. This enables you to have distinct logging levels for different workers.
144
+ *
145
+ * @since 8.6.0
146
+ */
147
+ createJobWorker<Variables extends LosslessDto, CustomHeaders extends LosslessDto>(config: CamundaJobWorkerConfig<Variables, CustomHeaders>): CamundaJobWorker<Variables, CustomHeaders>;
148
+ /**
149
+ * Iterate through all known partitions and activate jobs up to the requested maximum.
150
+ *
151
+ * The parameter `inputVariablesDto` is a Dto to decode the job payload. The `customHeadersDto` parameter is a Dto to decode the custom headers.
152
+ * Pass in a Dto class that extends LosslessDto to provide both type information in your code,
153
+ * and safe interoperability with applications that use the `int64` type in variables.
154
+ *
155
+ * @since 8.6.0
156
+ */
157
+ activateJobs<VariablesDto extends LosslessDto, CustomHeadersDto extends LosslessDto>(request: ActivateJobsRequest & {
158
+ inputVariableDto?: Ctor<VariablesDto>;
159
+ customHeadersDto?: Ctor<CustomHeadersDto>;
160
+ }): Promise<(RestJob<VariablesDto, CustomHeadersDto> & JobCompletionInterfaceRest<IProcessVariables>)[]>;
161
+ /**
162
+ * 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.
163
+ *
164
+ * Documentation: https://docs.camunda.io/docs/next/apis-tools/camunda-api-rest/specifications/fail-job/
165
+ *
166
+ * @since 8.6.0
167
+ */
168
+ failJob(failJobRequest: FailJobRequest): Promise<"JOB_ACTION_ACKNOWLEDGEMENT">;
169
+ /**
170
+ * Report a business error (i.e. non-technical) that occurs while processing a job.
171
+ *
172
+ * Documentation: https://docs.camunda.io/docs/next/apis-tools/camunda-api-rest/specifications/report-error-for-job/
173
+ *
174
+ * @since 8.6.0
175
+ */
176
+ errorJob(errorJobRequest: ErrorJobWithVariables & {
177
+ jobKey: string;
178
+ }): Promise<"JOB_ACTION_ACKNOWLEDGEMENT">;
179
+ /**
180
+ * Complete a job with the given payload, which allows completing the associated service task.
181
+ *
182
+ * Documentation: https://docs.camunda.io/docs/next/apis-tools/camunda-api-rest/specifications/complete-job/
183
+ *
184
+ * @since 8.6.0
185
+ */
186
+ completeJob(completeJobRequest: CompleteJobRequest): Promise<"JOB_ACTION_ACKNOWLEDGEMENT">;
187
+ /**
188
+ * Update a job with the given key.
189
+ *
190
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/update-a-job/
191
+ *
192
+ * @since 8.6.0
193
+ */
194
+ updateJob(jobChangeset: JobUpdateChangeset & {
195
+ jobKey: string;
196
+ }): Promise<import("got").Response<string>>;
197
+ /**
198
+ * 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.
199
+ *
200
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/resolve-incident/
201
+ *
202
+ * @since 8.6.0
203
+ */
204
+ resolveIncident(incidentKey: string): Promise<import("got").Response<string>>;
205
+ /**
206
+ * Create and start a process instance. This method does not await the outcome of the process. For that, use `createProcessInstanceWithResult`.
207
+ *
208
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/create-process-instance/
209
+ *
210
+ * @since 8.6.0
211
+ */
212
+ createProcessInstance<T extends JSONDoc | LosslessDto>(request: CreateProcessInstanceReq<T>): Promise<CreateProcessInstanceResponse<never>>;
213
+ /**
214
+ * Create and start a process instance. This method awaits the outcome of the process.
215
+ *
216
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/create-process-instance/
217
+ *
218
+ * @since 8.6.0
219
+ */
220
+ createProcessInstanceWithResult<T extends JSONDoc | LosslessDto>(request: CreateProcessInstanceReq<T> & {
221
+ /** An array of variable names to fetch. If not supplied, all visible variables in the root scope will be returned */
222
+ fetchVariables?: string[];
223
+ }): Promise<CreateProcessInstanceResponse<unknown>>;
224
+ createProcessInstanceWithResult<T extends JSONDoc | LosslessDto, V extends LosslessDto>(request: CreateProcessInstanceReq<T> & {
225
+ /** An array of variable names to fetch. If not supplied, all visible variables in the root scope will be returned */
226
+ fetchVariables?: string[];
227
+ /** A Dto specifying the shape of the output variables. If not supplied, the output variables will be returned as a `LosslessDto` of type `unknown`. */
228
+ outputVariablesDto: Ctor<V>;
229
+ }): Promise<CreateProcessInstanceResponse<V>>;
230
+ /**
231
+ * Cancel an active process instance
232
+ */
233
+ cancelProcessInstance({ processInstanceKey, operationReference, }: {
234
+ processInstanceKey: string;
235
+ operationReference?: number;
236
+ }): Promise<import("got").Response<string>>;
237
+ /**
238
+ * Migrates a process instance to a new process definition.
239
+ * This request can contain multiple mapping instructions to define mapping between the active process instance's elements and target process definition elements.
240
+ * 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.
241
+ *
242
+ * Documentation: https://docs.camunda.io/docs/next/apis-tools/camunda-api-rest/specifications/migrate-process-instance/
243
+ *
244
+ * @since 8.6.0
245
+ */
246
+ migrateProcessInstance(req: MigrationRequest): Promise<import("got").Response<string>>;
247
+ /**
248
+ * Deploy resources to the broker.
249
+ * @param resources - An array of binary data strings representing the resources to deploy.
250
+ * @param tenantId - Optional tenant ID to deploy the resources to. If not provided, the default tenant ID is used.
251
+ *
252
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/deploy-resources/
253
+ *
254
+ * @since 8.6.0
255
+ */
256
+ deployResources(resources: {
257
+ content: string;
258
+ name: string;
259
+ }[], tenantId?: string): Promise<DeployResourceResponse>;
260
+ /**
261
+ * Deploy resources to Camunda 8 from files
262
+ * @param files an array of file paths
263
+ *
264
+ * @since 8.6.0
265
+ */
266
+ deployResourcesFromFiles(files: string[]): Promise<DeployResourceResponse>;
267
+ /**
268
+ * 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.
269
+ *
270
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/delete-resource/
271
+ *
272
+ * @since 8.6.0
273
+ */
274
+ deleteResource(req: {
275
+ resourceKey: string;
276
+ operationReference?: number;
277
+ }): Promise<import("got").Response<string>>;
278
+ /**
279
+ * Set a precise, static time for the Zeebe engine's internal clock.
280
+ * When the clock is pinned, it remains at the specified time and does not advance.
281
+ * To change the time, the clock must be pinned again with a new timestamp, or reset.
282
+ *
283
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/pin-internal-clock/
284
+ *
285
+ * @since 8.6.0
286
+ */
287
+ pinInternalClock(epochMs: number): Promise<import("got").Response<string>>;
288
+ /**
289
+ * Resets the Zeebe engine's internal clock to the current system time, enabling it to tick in real-time.
290
+ * This operation is useful for returning the clock to normal behavior after it has been pinned to a specific time.
291
+ *
292
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/reset-internal-clock/
293
+ *
294
+ * @since 8.6.0
295
+ */
296
+ resetClock(): Promise<import("got").Response<string>>;
297
+ /**
298
+ * Updates all the variables of a particular scope (for example, process instance, flow element instance) with the given variable data.
299
+ * Specify the element instance in the elementInstanceKey parameter.
300
+ *
301
+ * Documentation: https://docs.camunda.io/docs/apis-tools/camunda-api-rest/specifications/update-element-instance-variables/
302
+ *
303
+ * @since 8.6.0
304
+ */
305
+ updateElementInstanceVariables(req: UpdateElementVariableRequest): Promise<import("got").Response<string>>;
306
+ private addJobMethods;
307
+ /**
308
+ * Helper method to add the default tenantIds if we are not passed explicit tenantIds
309
+ */
310
+ private addDefaultTenantId;
311
+ }