@quantumbpm/sdk 0.0.1 → 1.0.1

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 (82) hide show
  1. package/README.md +6 -0
  2. package/dist/bpmn.d.ts +35 -2
  3. package/dist/bpmn.js +10 -5
  4. package/dist/dmn.d.ts +5 -0
  5. package/dist/dmn.js +3 -1
  6. package/dist/generated/index.d.ts +5 -3
  7. package/dist/generated/index.js +4 -4
  8. package/dist/generated/models/BatchEvaluateDesignRequest.d.ts +3 -2
  9. package/dist/generated/models/BatchEvaluateDesignRequest.js +1 -1
  10. package/dist/generated/models/BpmnIncidentRecord.d.ts +88 -0
  11. package/dist/generated/models/BpmnIncidentRecord.js +23 -0
  12. package/dist/generated/models/BpmnIncidentRecordPaginatedResponse.d.ts +9 -0
  13. package/dist/generated/models/BpmnIncidentRecordPaginatedResponse.js +3 -0
  14. package/dist/generated/models/BpmnInstance.d.ts +24 -0
  15. package/dist/generated/models/BpmnInstance.js +1 -1
  16. package/dist/generated/models/BpmnInstanceState.d.ts +28 -5
  17. package/dist/generated/models/BpmnInstanceState.js +1 -1
  18. package/dist/generated/models/BpmnProcessVersion.d.ts +16 -0
  19. package/dist/generated/models/BpmnProcessVersion.js +1 -1
  20. package/dist/generated/models/EvaluateStoredRequest.d.ts +4 -0
  21. package/dist/generated/models/EvaluateStoredRequest.js +1 -1
  22. package/dist/generated/models/Execution.d.ts +4 -0
  23. package/dist/generated/models/Execution.js +1 -1
  24. package/dist/generated/models/ExternalJob.d.ts +8 -0
  25. package/dist/generated/models/ExternalJob.js +1 -1
  26. package/dist/generated/models/FeelNumber.d.ts +1 -1
  27. package/dist/generated/models/FeelNumber.js +1 -1
  28. package/dist/generated/models/StartBpmnInstanceRequest.d.ts +4 -0
  29. package/dist/generated/models/StartBpmnInstanceRequest.js +1 -1
  30. package/dist/generated/models/StartBpmnTestInstanceRequest.d.ts +4 -0
  31. package/dist/generated/models/StartBpmnTestInstanceRequest.js +1 -1
  32. package/dist/generated/models/SuspendBpmnDefinitionRequest.d.ts +6 -0
  33. package/dist/generated/models/SuspendBpmnDefinitionRequest.js +3 -0
  34. package/dist/generated/models/SuspendBpmnInstanceRequest.d.ts +9 -0
  35. package/dist/generated/models/SuspendBpmnInstanceRequest.js +3 -0
  36. package/dist/generated/models/SuspensionEntry.d.ts +22 -0
  37. package/dist/generated/models/SuspensionEntry.js +3 -0
  38. package/dist/generated/models/UserTask.d.ts +4 -0
  39. package/dist/generated/models/UserTask.js +1 -1
  40. package/dist/generated/services/BpmnService.d.ts +177 -22
  41. package/dist/generated/services/BpmnService.js +189 -28
  42. package/dist/generated/services/DefaultService.d.ts +33 -12
  43. package/dist/generated/services/DefaultService.js +37 -16
  44. package/dist/tracing.d.ts +17 -0
  45. package/dist/tracing.js +38 -0
  46. package/dist/workers.d.ts +25 -2
  47. package/dist/workers.js +53 -6
  48. package/package.json +2 -1
  49. package/src/bpmn.ts +46 -2
  50. package/src/dmn.ts +7 -0
  51. package/src/generated/index.ts +5 -3
  52. package/src/generated/models/BatchEvaluateDesignRequest.ts +3 -2
  53. package/src/generated/models/BpmnIncidentRecord.ts +93 -0
  54. package/src/generated/models/BpmnIncidentRecordPaginatedResponse.ts +14 -0
  55. package/src/generated/models/BpmnInstance.ts +24 -0
  56. package/src/generated/models/BpmnInstanceState.ts +28 -5
  57. package/src/generated/models/BpmnProcessVersion.ts +16 -0
  58. package/src/generated/models/EvaluateStoredRequest.ts +4 -0
  59. package/src/generated/models/Execution.ts +4 -0
  60. package/src/generated/models/ExternalJob.ts +8 -0
  61. package/src/generated/models/FeelNumber.ts +1 -1
  62. package/src/generated/models/StartBpmnInstanceRequest.ts +4 -0
  63. package/src/generated/models/StartBpmnTestInstanceRequest.ts +4 -0
  64. package/src/generated/models/SuspendBpmnDefinitionRequest.ts +11 -0
  65. package/src/generated/models/SuspendBpmnInstanceRequest.ts +14 -0
  66. package/src/generated/models/SuspensionEntry.ts +27 -0
  67. package/src/generated/models/UserTask.ts +4 -0
  68. package/src/generated/services/BpmnService.ts +265 -30
  69. package/src/generated/services/DefaultService.ts +48 -13
  70. package/src/index.test.ts +180 -0
  71. package/src/tracing.ts +49 -0
  72. package/src/workers.test.ts +117 -0
  73. package/src/workers.ts +75 -7
  74. package/dist/generated/models/BpmnActivityState.d.ts +0 -52
  75. package/dist/generated/models/BpmnActivityState.js +0 -17
  76. package/dist/generated/models/ExternalJobActiveWorkersItem.d.ts +0 -7
  77. package/dist/generated/models/ExternalJobActiveWorkersItem.js +0 -3
  78. package/dist/generated/models/ExternalJobActiveWorkersResponse.d.ts +0 -7
  79. package/dist/generated/models/ExternalJobActiveWorkersResponse.js +0 -3
  80. package/src/generated/models/BpmnActivityState.ts +0 -57
  81. package/src/generated/models/ExternalJobActiveWorkersItem.ts +0 -12
  82. package/src/generated/models/ExternalJobActiveWorkersResponse.ts +0 -12
@@ -3,8 +3,8 @@
3
3
  /* tslint:disable */
4
4
  /* eslint-disable */
5
5
  import type { ActiveScope } from './ActiveScope';
6
- import type { BpmnActivityState } from './BpmnActivityState';
7
6
  import type { BpmnIncident } from './BpmnIncident';
7
+ import type { SuspensionEntry } from './SuspensionEntry';
8
8
  /**
9
9
  * Full runtime state of a BPMN process instance.
10
10
  */
@@ -21,6 +21,14 @@ export type BpmnInstanceState = {
21
21
  * Execution identifier of the parent instance that started this one via a CallActivity. Empty for top-level instances.
22
22
  */
23
23
  parentWorkflowID?: string;
24
+ /**
25
+ * BPMN process definition ID this instance was started from.
26
+ */
27
+ processId?: string;
28
+ /**
29
+ * Version of the BPMN process definition this instance is currently running. Updated by migration operations.
30
+ */
31
+ processVersion?: number;
24
32
  /**
25
33
  * Current lifecycle status of the instance (e.g. RUNNING, COMPLETED, FAILED, TERMINATED).
26
34
  */
@@ -29,10 +37,6 @@ export type BpmnInstanceState = {
29
37
  * All variables currently in scope for the root process.
30
38
  */
31
39
  variables?: Record<string, any>;
32
- /**
33
- * Ordered list of activity execution records.
34
- */
35
- history?: Array<BpmnActivityState>;
36
40
  /**
37
41
  * True when the instance has an unresolved incident.
38
42
  */
@@ -49,5 +53,24 @@ export type BpmnInstanceState = {
49
53
  * Error message from the workflow when status is FAILED.
50
54
  */
51
55
  failureReason?: string;
56
+ /**
57
+ * Present when this instance has been explicitly suspended by an
58
+ * operator. Persisted across CaN rotations. Clear via the resume
59
+ * instance endpoint. Composes with `definitionSuspension` — both must
60
+ * be null for the instance to dispatch tokens.
61
+ *
62
+ */
63
+ instanceSuspension?: SuspensionEntry;
64
+ /**
65
+ * Present when the instance's process definition has been suspended.
66
+ * Clear via the resume definition endpoint (the backend fans out to
67
+ * every running instance of the definition).
68
+ *
69
+ */
70
+ definitionSuspension?: SuspensionEntry;
71
+ /**
72
+ * Caller-supplied correlation key set when the instance was started.
73
+ */
74
+ businessId?: string;
52
75
  };
53
76
 
@@ -42,5 +42,21 @@ export type BpmnProcessVersion = {
42
42
  * All instances of this version across statuses.
43
43
  */
44
44
  totalCount: number;
45
+ /**
46
+ * Timestamp at which this definition was paused. While set, the start
47
+ * endpoint rejects new instances of this definition with 409, and every
48
+ * already-running instance was sent a definition-scope suspend signal.
49
+ * Empty when active.
50
+ *
51
+ */
52
+ suspendedAt?: string;
53
+ /**
54
+ * Operator who suspended this definition. Empty when active.
55
+ */
56
+ suspendedBy?: string;
57
+ /**
58
+ * Free-text reason captured at suspend time.
59
+ */
60
+ suspendReason?: string;
45
61
  };
46
62
 
@@ -20,5 +20,9 @@ export type EvaluateStoredRequest = {
20
20
  * Names of decisions or decision services to evaluate. If empty, all decisions are evaluated.
21
21
  */
22
22
  decisions?: Array<string>;
23
+ /**
24
+ * Optional caller-supplied correlation key persisted with the resulting execution row for cross-system tracing.
25
+ */
26
+ businessId?: string;
23
27
  };
24
28
 
@@ -30,5 +30,9 @@ export type Execution = {
30
30
  * The DMN XML's `<definitions id="…">` value, useful for grouping executions across versions.
31
31
  */
32
32
  definitionsID?: string;
33
+ /**
34
+ * Caller-supplied correlation key passed at evaluation time (REST) or inherited from the parent BPMN process (business rule task).
35
+ */
36
+ businessId?: string;
33
37
  };
34
38
 
@@ -66,6 +66,14 @@ export type ExternalJob = {
66
66
  * Best-effort label describing why a CANCELED job was interrupted (e.g. instance cancelled, instance terminated).
67
67
  */
68
68
  cancelReason?: string;
69
+ /**
70
+ * Caller-supplied correlation key inherited from the parent BPMN process. Workers can use it for log correlation or downstream tracing.
71
+ */
72
+ businessId?: string;
73
+ /**
74
+ * W3C trace-propagation carrier (e.g. `traceparent`/`tracestate`) captured from the originating process instance. Present only when distributed tracing is enabled on the server. SDK workers pass this map to their OpenTelemetry propagator's extract so the worker span joins the instance's trace; plain workers can ignore it.
75
+ */
76
+ traceContext?: Record<string, string>;
69
77
  };
70
78
  export namespace ExternalJob {
71
79
  /**
@@ -3,6 +3,6 @@
3
3
  /* tslint:disable */
4
4
  /* eslint-disable */
5
5
  /**
6
- * FEEL number. Maps to a decimal value at runtime.
6
+ * FEEL number. Maps to a decimal value at runtime. Exact decimal semantics end-to-end — the Go types use json.Number so values are never narrowed through float64.
7
7
  */
8
8
  export type FeelNumber = number;
@@ -14,5 +14,9 @@ export type StartBpmnInstanceRequest = {
14
14
  * Initial process variables. Available to FEEL expressions and service tasks from the first activity onward.
15
15
  */
16
16
  variables?: Record<string, any>;
17
+ /**
18
+ * Optional caller-supplied correlation key (order number, ticket ID, etc.) indexed for filtering and stamped on every child instance, external job, user task, and DMN execution emitted by this process.
19
+ */
20
+ businessId?: string;
17
21
  };
18
22
 
@@ -14,5 +14,9 @@ export type StartBpmnTestInstanceRequest = {
14
14
  * Initial process variables.
15
15
  */
16
16
  variables?: Record<string, any>;
17
+ /**
18
+ * Optional caller-supplied correlation key.
19
+ */
20
+ businessId?: string;
17
21
  };
18
22
 
@@ -0,0 +1,11 @@
1
+ /* generated using openapi-typescript-codegen -- do not edit */
2
+ /* istanbul ignore file */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /**
6
+ * Optional metadata captured with a definition-scope suspension. The same reason cascades to each running instance.
7
+ */
8
+ export type SuspendBpmnDefinitionRequest = {
9
+ reason?: string;
10
+ };
11
+
@@ -0,0 +1,14 @@
1
+ /* generated using openapi-typescript-codegen -- do not edit */
2
+ /* istanbul ignore file */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /**
6
+ * Optional metadata captured with an instance-scope suspension.
7
+ */
8
+ export type SuspendBpmnInstanceRequest = {
9
+ /**
10
+ * Free-text rationale. Surfaces in the operator UI and the workflow's history audit.
11
+ */
12
+ reason?: string;
13
+ };
14
+
@@ -0,0 +1,27 @@
1
+ /* generated using openapi-typescript-codegen -- do not edit */
2
+ /* istanbul ignore file */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /**
6
+ * Audit-shaped record of an active suspension at one scope (instance or
7
+ * definition). Returned inline on `BpmnInstanceState` — `null` when not
8
+ * suspended at that scope. An instance is "effectively suspended" if either
9
+ * scope's entry is present; the dispatcher pauses forward token dispatch
10
+ * while either flag is set.
11
+ *
12
+ */
13
+ export type SuspensionEntry = {
14
+ /**
15
+ * Unix epoch nanoseconds at which the suspension was applied.
16
+ */
17
+ suspendedAt: number;
18
+ /**
19
+ * Identifier of the operator (or service account) that initiated the suspension.
20
+ */
21
+ suspendedBy?: string;
22
+ /**
23
+ * Free-text reason captured at suspend time; surfaces in the operator UI alongside the action.
24
+ */
25
+ reason?: string;
26
+ };
27
+
@@ -82,6 +82,10 @@ export type UserTask = {
82
82
  * Timestamp when the task reached a terminal status.
83
83
  */
84
84
  completedAt?: string;
85
+ /**
86
+ * Caller-supplied correlation key inherited from the parent BPMN process.
87
+ */
88
+ businessId?: string;
85
89
  };
86
90
  export namespace UserTask {
87
91
  /**
@@ -2,6 +2,7 @@
2
2
  /* istanbul ignore file */
3
3
  /* tslint:disable */
4
4
  /* eslint-disable */
5
+ import type { BpmnIncidentRecordPaginatedResponse } from '../models/BpmnIncidentRecordPaginatedResponse';
5
6
  import type { BpmnInstanceChildrenResponse } from '../models/BpmnInstanceChildrenResponse';
6
7
  import type { BpmnProcessSummaryPaginatedResponse } from '../models/BpmnProcessSummaryPaginatedResponse';
7
8
  import type { BpmnProcessVersionPaginatedResponse } from '../models/BpmnProcessVersionPaginatedResponse';
@@ -12,13 +13,14 @@ import type { BpmnUserTaskPaginatedResponse } from '../models/BpmnUserTaskPagina
12
13
  import type { BpmnValidateResponse } from '../models/BpmnValidateResponse';
13
14
  import type { CorrelationKeys } from '../models/CorrelationKeys';
14
15
  import type { CreateBpmnResourceRequest } from '../models/CreateBpmnResourceRequest';
15
- import type { ExternalJobActiveWorkersResponse } from '../models/ExternalJobActiveWorkersResponse';
16
16
  import type { ExternalJobBatchResponse } from '../models/ExternalJobBatchResponse';
17
17
  import type { ExternalJobQueueDepthResponse } from '../models/ExternalJobQueueDepthResponse';
18
18
  import type { MigrateBpmnInstanceRequest } from '../models/MigrateBpmnInstanceRequest';
19
19
  import type { MigrationValidationResult } from '../models/MigrationValidationResult';
20
20
  import type { ModifyBpmnInstanceRequest } from '../models/ModifyBpmnInstanceRequest';
21
21
  import type { StartBpmnTestInstanceRequest } from '../models/StartBpmnTestInstanceRequest';
22
+ import type { SuspendBpmnDefinitionRequest } from '../models/SuspendBpmnDefinitionRequest';
23
+ import type { SuspendBpmnInstanceRequest } from '../models/SuspendBpmnInstanceRequest';
22
24
  import type { UpdateUserTaskAssignmentRequest } from '../models/UpdateUserTaskAssignmentRequest';
23
25
  import type { UserTask } from '../models/UserTask';
24
26
  import type { ValidateBpmnResourceRequest } from '../models/ValidateBpmnResourceRequest';
@@ -424,6 +426,60 @@ export class BpmnService {
424
426
  mediaType: 'application/json',
425
427
  });
426
428
  }
429
+ /**
430
+ * List BPMN incidents
431
+ * Cross-instance audit listing of incidents in the project. By default
432
+ * returns open incidents first (unresolved), ordered by recency.
433
+ * Filterable by definition, error type, status, and time window.
434
+ *
435
+ * Each row carries the parent process metadata (processID, processName)
436
+ * so a single page render needs no follow-up queries against the
437
+ * instances endpoint. Click-through to a specific instance still uses
438
+ * the workflow-scoped detail endpoint.
439
+ *
440
+ * @param projectId
441
+ * @param definitionId Restrict to incidents on instances of a single process definition.
442
+ * @param workflowId Restrict to incidents on a single instance — useful for an instance-detail "all incidents ever raised here" view that includes resolved rows.
443
+ * @param status Filter by lifecycle status. `open` returns unresolved incidents;
444
+ * `resolved` returns only resolved ones. Omit to return both.
445
+ *
446
+ * @param errorType Restrict to a single error category (matches `BpmnIncidentRecord.errorType`).
447
+ * @param since Earliest `raisedAt` to include (inclusive).
448
+ * @param until Latest `raisedAt` to include (exclusive).
449
+ * @param page
450
+ * @param pageSize
451
+ * @returns BpmnIncidentRecordPaginatedResponse OK
452
+ * @throws ApiError
453
+ */
454
+ public listBpmnIncidents(
455
+ projectId: string,
456
+ definitionId?: string,
457
+ workflowId?: string,
458
+ status?: 'open' | 'resolved',
459
+ errorType?: 'BpmnError' | 'EscalationError' | 'CompensationError' | 'FeelError' | 'NoHandler' | 'GatewayNoMatch' | 'TimerResolution' | 'LinkNotFound' | 'MigrationError' | 'Unknown',
460
+ since?: string,
461
+ until?: string,
462
+ page?: number,
463
+ pageSize?: number,
464
+ ): CancelablePromise<BpmnIncidentRecordPaginatedResponse> {
465
+ return this.httpRequest.request({
466
+ method: 'GET',
467
+ url: '/projects/{projectID}/bpmn/incidents',
468
+ path: {
469
+ 'projectID': projectId,
470
+ },
471
+ query: {
472
+ 'definitionID': definitionId,
473
+ 'workflowID': workflowId,
474
+ 'status': status,
475
+ 'errorType': errorType,
476
+ 'since': since,
477
+ 'until': until,
478
+ 'page': page,
479
+ 'pageSize': pageSize,
480
+ },
481
+ });
482
+ }
427
483
  /**
428
484
  * Migrate a running instance to a newer process version
429
485
  * Moves a running instance from its current process version to a newer
@@ -578,57 +634,181 @@ export class BpmnService {
578
634
  });
579
635
  }
580
636
  /**
581
- * PENDING job counts grouped by taskType
582
- * Returns one entry per `taskType` with at least one PENDING job. Useful for
583
- * monitoring queue backlogs and capacity-planning external job workers.
637
+ * Suspend a BPMN instance
638
+ * Pauses forward token dispatch on a single running instance. The
639
+ * instance's lifecycle status stays RUNNING; an orthogonal `suspendedAt`
640
+ * flag layers on top. Idempotent — a second call against an already-
641
+ * suspended instance is a no-op.
642
+ *
643
+ * While suspended: cancel / terminate / migrate / force-rotate / resolve-
644
+ * incident / variable update / modify all still work. Parked tokens
645
+ * released by signal demuxes or timer fires queue internally and dispatch
646
+ * on resume.
647
+ *
648
+ * The audit (operator, reason, timestamp) is also recorded in the
649
+ * workflow's Temporal history as a `SuspendInstanceEvent` so the timeline
650
+ * view on the instance detail page can render the cycle.
584
651
  *
585
652
  * @param projectId
586
- * @param createdAfter Only count jobs created at or after this timestamp. Should match the time-range selector used by the list endpoint so totals stay consistent.
587
- * @returns ExternalJobQueueDepthResponse OK
653
+ * @param workflowId
654
+ * @param requestBody
655
+ * @returns void
588
656
  * @throws ApiError
589
657
  */
590
- public getBpmnExternalJobsQueueDepth(
658
+ public suspendBpmnInstance(
591
659
  projectId: string,
592
- createdAfter?: string,
593
- ): CancelablePromise<ExternalJobQueueDepthResponse> {
660
+ workflowId: string,
661
+ requestBody?: SuspendBpmnInstanceRequest,
662
+ ): CancelablePromise<void> {
594
663
  return this.httpRequest.request({
595
- method: 'GET',
596
- url: '/projects/{projectID}/bpmn/external-jobs/queue-depth',
664
+ method: 'POST',
665
+ url: '/projects/{projectID}/bpmn/instances/{workflowID}/suspend',
597
666
  path: {
598
667
  'projectID': projectId,
668
+ 'workflowID': workflowId,
599
669
  },
600
- query: {
601
- 'createdAfter': createdAfter,
670
+ body: requestBody,
671
+ mediaType: 'application/json',
672
+ });
673
+ }
674
+ /**
675
+ * Resume a suspended BPMN instance
676
+ * Clears the instance-scope suspension. If the parent definition is also
677
+ * suspended the instance remains effectively paused until the definition
678
+ * is resumed as well. Idempotent.
679
+ *
680
+ * @param projectId
681
+ * @param workflowId
682
+ * @returns void
683
+ * @throws ApiError
684
+ */
685
+ public resumeBpmnInstance(
686
+ projectId: string,
687
+ workflowId: string,
688
+ ): CancelablePromise<void> {
689
+ return this.httpRequest.request({
690
+ method: 'POST',
691
+ url: '/projects/{projectID}/bpmn/instances/{workflowID}/resume',
692
+ path: {
693
+ 'projectID': projectId,
694
+ 'workflowID': workflowId,
695
+ },
696
+ });
697
+ }
698
+ /**
699
+ * Suspend every running instance of a BPMN definition
700
+ * Pauses every running instance of one deployed process definition AND
701
+ * rejects new instance starts on that definition until it is resumed.
702
+ *
703
+ * The handler acquires a row-level lock on the definition before flipping
704
+ * the flag so a `StartBpmnInstance` racing the suspend can't slip through.
705
+ * It then iterates over every running instance (`status='RUNNING'`) and
706
+ * sends each one a definition-scope suspend signal via the engine API.
707
+ * Instances that were also explicitly instance-suspended stay paused
708
+ * after a definition-scope resume — the operator must clear that scope
709
+ * too.
710
+ *
711
+ * Idempotent. The reason cascades to every affected instance's history
712
+ * audit (`SuspendDefinitionEvent`) so the UI can render where the pause
713
+ * came from.
714
+ *
715
+ * @param projectId
716
+ * @param definitionId Platform identifier of the process definition version (same UUID `BpmnProcessVersion.id` exposes).
717
+ * @param requestBody
718
+ * @returns void
719
+ * @throws ApiError
720
+ */
721
+ public suspendBpmnDefinition(
722
+ projectId: string,
723
+ definitionId: string,
724
+ requestBody?: SuspendBpmnDefinitionRequest,
725
+ ): CancelablePromise<void> {
726
+ return this.httpRequest.request({
727
+ method: 'POST',
728
+ url: '/projects/{projectID}/bpmn/definitions/{definitionID}/suspend',
729
+ path: {
730
+ 'projectID': projectId,
731
+ 'definitionID': definitionId,
732
+ },
733
+ body: requestBody,
734
+ mediaType: 'application/json',
735
+ errors: {
736
+ 404: `Definition not found`,
602
737
  },
603
738
  });
604
739
  }
605
740
  /**
606
- * Live count of long-poll workers grouped by taskType
607
- * Returns the count of workers currently long-polling for each `taskType`.
608
- * Reflects only currently-connected workers; long-polls that have timed out
609
- * or disconnected are not counted.
741
+ * Resume a suspended BPMN definition
742
+ * Clears the definition-scope suspension and fans out a resume signal to
743
+ * every running instance of the definition. Instances that were also
744
+ * instance-suspended stay paused until their own scope is cleared. New
745
+ * instance starts are accepted again once the definition flag clears.
746
+ * Idempotent.
610
747
  *
611
748
  * @param projectId
612
- * @returns ExternalJobActiveWorkersResponse OK
749
+ * @param definitionId
750
+ * @returns void
613
751
  * @throws ApiError
614
752
  */
615
- public getBpmnExternalJobsActiveWorkers(
753
+ public resumeBpmnDefinition(
616
754
  projectId: string,
617
- ): CancelablePromise<ExternalJobActiveWorkersResponse> {
755
+ definitionId: string,
756
+ ): CancelablePromise<void> {
757
+ return this.httpRequest.request({
758
+ method: 'POST',
759
+ url: '/projects/{projectID}/bpmn/definitions/{definitionID}/resume',
760
+ path: {
761
+ 'projectID': projectId,
762
+ 'definitionID': definitionId,
763
+ },
764
+ errors: {
765
+ 404: `Definition not found`,
766
+ },
767
+ });
768
+ }
769
+ /**
770
+ * PENDING job counts grouped by taskType
771
+ * Returns one entry per `taskType` with at least one PENDING job. Useful for
772
+ * monitoring queue backlogs and capacity-planning external job workers.
773
+ *
774
+ * @param projectId
775
+ * @param createdAfter Only count jobs created at or after this timestamp. Should match the time-range selector used by the list endpoint so totals stay consistent.
776
+ * @returns ExternalJobQueueDepthResponse OK
777
+ * @throws ApiError
778
+ */
779
+ public getBpmnExternalJobsQueueDepth(
780
+ projectId: string,
781
+ createdAfter?: string,
782
+ ): CancelablePromise<ExternalJobQueueDepthResponse> {
618
783
  return this.httpRequest.request({
619
784
  method: 'GET',
620
- url: '/projects/{projectID}/bpmn/external-jobs/workers',
785
+ url: '/projects/{projectID}/bpmn/external-jobs/queue-depth',
621
786
  path: {
622
787
  'projectID': projectId,
623
788
  },
789
+ query: {
790
+ 'createdAfter': createdAfter,
791
+ },
624
792
  });
625
793
  }
626
794
  /**
627
795
  * Fail an external job with a BPMN error code
628
- * Reports that the worker could not handle the job. The `errorCode` is
629
- * raised as a BPMN error, triggering any matching boundary error event
630
- * on the originating service task. If the job has remaining retries it
631
- * is requeued; otherwise the originating instance gets an incident.
796
+ * Reports that the worker could not handle the job.
797
+ *
798
+ * The `retryable` flag decides how the failure is treated:
799
+ *
800
+ * * `retryable: true` (the default) - a **technical/transient** failure.
801
+ * If the job has remaining retries it is requeued for another attempt
802
+ * and the retry budget is decremented; the process is NOT notified. Only
803
+ * once retries are exhausted is the `errorCode` raised as a BPMN error,
804
+ * triggering any matching boundary error event on the originating service
805
+ * task (or an incident if none matches).
806
+ * * `retryable: false` - a **business** BPMN error. The `errorCode` is
807
+ * raised on the process immediately, bypassing the retry budget entirely,
808
+ * so a matching boundary error event fires (or an incident is raised)
809
+ * without wasting retries. Use this for domain outcomes a retry could
810
+ * never fix (e.g. `PAYMENT_DECLINED`). SDK workers send this automatically
811
+ * when a handler throws a typed `BpmnError`.
632
812
  *
633
813
  * @param projectId
634
814
  * @param executionKey
@@ -641,6 +821,27 @@ export class BpmnService {
641
821
  executionKey: string,
642
822
  requestBody: {
643
823
  errorCode: string;
824
+ /**
825
+ * Optional worker identity (the same `clientID` used to poll).
826
+ * When supplied, the error is applied only if this worker still
827
+ * holds the job's lock, so a stale report can't requeue or fail
828
+ * a job a peer is actively holding. Omit for the legacy
829
+ * unchecked behavior.
830
+ *
831
+ */
832
+ clientID?: string;
833
+ /**
834
+ * Whether this failure should consume the retry budget before
835
+ * reaching the process. `true` (default) treats it as a
836
+ * technical failure: requeue while retries remain, raise the
837
+ * BPMN error only at exhaustion. `false` treats `errorCode` as a
838
+ * business BPMN error and raises it immediately, bypassing
839
+ * retries so a boundary error event fires (or an incident is
840
+ * raised) at once. SDK workers set `false` for a handler-thrown
841
+ * `BpmnError` and `true` for any other exception.
842
+ *
843
+ */
844
+ retryable?: boolean;
644
845
  variables?: Record<string, any>;
645
846
  },
646
847
  ): CancelablePromise<any> {
@@ -669,6 +870,15 @@ export class BpmnService {
669
870
  public completeBpmnExternalJobsBatch(
670
871
  projectId: string,
671
872
  requestBody: {
873
+ /**
874
+ * Optional worker identity (the same `clientID` used to poll)
875
+ * applied to every item in the batch — a batch is one worker's
876
+ * report. When supplied, an item is completed only if this
877
+ * worker still holds its lock; items re-acquired by a peer drop
878
+ * out silently. Omit for the legacy unchecked behavior.
879
+ *
880
+ */
881
+ clientID?: string;
672
882
  items: Array<{
673
883
  executionKey: string;
674
884
  workflowID: string;
@@ -688,11 +898,14 @@ export class BpmnService {
688
898
  }
689
899
  /**
690
900
  * Fail external jobs in batch
691
- * Reports a batch of worker failures in one request. Each item's
692
- * remaining retry budget determines whether it requeues for another
693
- * attempt or surfaces as an incident on the originating instance.
694
- * Per-item status is returned so a partial failure does not sink the
695
- * whole batch.
901
+ * Reports a batch of worker failures in one request. With `retryable: true`
902
+ * (the default) each item's remaining retry budget decides whether it
903
+ * requeues for another attempt or surfaces its `errorCode` as a BPMN
904
+ * error/incident on the originating instance. With `retryable: false` every
905
+ * item is treated as a business BPMN error and raised immediately, bypassing
906
+ * the retry budget (see the single-job error endpoint for the full
907
+ * semantics). Per-item status is returned so a partial failure does not sink
908
+ * the whole batch.
696
909
  *
697
910
  * @param projectId
698
911
  * @param requestBody
@@ -702,6 +915,25 @@ export class BpmnService {
702
915
  public throwBpmnExternalJobErrorsBatch(
703
916
  projectId: string,
704
917
  requestBody: {
918
+ /**
919
+ * Optional worker identity (the same `clientID` used to poll)
920
+ * applied to every item in the batch — a batch is one worker's
921
+ * report. When supplied, an item is requeued/failed only if this
922
+ * worker still holds its lock; items held by a peer are reported
923
+ * as an error and left untouched. Omit for the legacy unchecked
924
+ * behavior.
925
+ *
926
+ */
927
+ clientID?: string;
928
+ /**
929
+ * Applies to every item in the batch. `true` (default) consumes
930
+ * each item's retry budget before raising its BPMN error; `false`
931
+ * raises every item's `errorCode` as a business BPMN error
932
+ * immediately, bypassing retries. See the single-job error
933
+ * endpoint for the full semantics.
934
+ *
935
+ */
936
+ retryable?: boolean;
705
937
  items: Array<{
706
938
  executionKey: string;
707
939
  workflowID: string;
@@ -732,6 +964,7 @@ export class BpmnService {
732
964
  * @param assignee
733
965
  * @param candidateUser
734
966
  * @param candidateGroup
967
+ * @param businessId Exact-match filter on the caller-supplied correlation key.
735
968
  * @param page
736
969
  * @param pageSize
737
970
  * @returns BpmnUserTaskPaginatedResponse OK
@@ -744,6 +977,7 @@ export class BpmnService {
744
977
  assignee?: string,
745
978
  candidateUser?: string,
746
979
  candidateGroup?: string,
980
+ businessId?: string,
747
981
  page?: number,
748
982
  pageSize?: number,
749
983
  ): CancelablePromise<BpmnUserTaskPaginatedResponse> {
@@ -759,6 +993,7 @@ export class BpmnService {
759
993
  'assignee': assignee,
760
994
  'candidateUser': candidateUser,
761
995
  'candidateGroup': candidateGroup,
996
+ 'businessId': businessId,
762
997
  'page': page,
763
998
  'pageSize': pageSize,
764
999
  },