@quantumbpm/sdk 1.1.0 → 1.3.0

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 (80) hide show
  1. package/README.md +38 -2
  2. package/dist/bpmn.d.ts +4 -2
  3. package/dist/bpmn.js +4 -4
  4. package/dist/generated/RawClient.js +2 -2
  5. package/dist/generated/core/OpenAPI.js +2 -2
  6. package/dist/generated/index.d.ts +3 -0
  7. package/dist/generated/index.js +4 -2
  8. package/dist/generated/models/BatchEvaluateDesignRequest.d.ts +2 -0
  9. package/dist/generated/models/BatchEvaluateDesignRequest.js +1 -1
  10. package/dist/generated/models/BpmnIncident.d.ts +6 -0
  11. package/dist/generated/models/BpmnIncident.js +5 -1
  12. package/dist/generated/models/BpmnIncidentRecord.d.ts +8 -6
  13. package/dist/generated/models/BpmnIncidentRecord.js +3 -1
  14. package/dist/generated/models/BpmnInstance.d.ts +19 -0
  15. package/dist/generated/models/BpmnInstance.js +1 -1
  16. package/dist/generated/models/BpmnInstanceState.d.ts +18 -2
  17. package/dist/generated/models/BpmnInstanceState.js +1 -1
  18. package/dist/generated/models/CorrelationKeyNumber.d.ts +1 -1
  19. package/dist/generated/models/CorrelationKeyNumber.js +1 -1
  20. package/dist/generated/models/Error.d.ts +6 -0
  21. package/dist/generated/models/Error.js +5 -1
  22. package/dist/generated/models/ErrorMode.d.ts +15 -0
  23. package/dist/generated/models/ErrorMode.js +24 -0
  24. package/dist/generated/models/EvaluateStoredRequest.d.ts +6 -1
  25. package/dist/generated/models/EvaluateStoredRequest.js +1 -1
  26. package/dist/generated/models/EvaluationResult.d.ts +5 -0
  27. package/dist/generated/models/EvaluationResult.js +1 -1
  28. package/dist/generated/models/ExternalJob.d.ts +1 -1
  29. package/dist/generated/models/ExternalJob.js +1 -1
  30. package/dist/generated/models/ExternalJobBatchResponse.d.ts +2 -2
  31. package/dist/generated/models/ExternalJobBatchResponse.js +1 -1
  32. package/dist/generated/models/FeelWarning.d.ts +17 -0
  33. package/dist/generated/models/FeelWarning.js +3 -0
  34. package/dist/generated/models/JoinArrivals.d.ts +8 -0
  35. package/dist/generated/models/JoinArrivals.js +3 -0
  36. package/dist/generated/models/ModificationInstruction.d.ts +1 -1
  37. package/dist/generated/models/ModificationInstruction.js +1 -1
  38. package/dist/generated/models/PollBpmnJobRequest.d.ts +1 -1
  39. package/dist/generated/models/PollBpmnJobRequest.js +1 -1
  40. package/dist/generated/models/SuspensionEntry.d.ts +2 -2
  41. package/dist/generated/models/SuspensionEntry.js +1 -1
  42. package/dist/generated/models/UpdateDefinitionRequest.d.ts +3 -3
  43. package/dist/generated/models/UpdateDefinitionRequest.js +1 -1
  44. package/dist/generated/models/UpdateUserTaskAssignmentRequest.d.ts +11 -4
  45. package/dist/generated/models/UpdateUserTaskAssignmentRequest.js +1 -1
  46. package/dist/generated/services/BpmnService.d.ts +25 -17
  47. package/dist/generated/services/BpmnService.js +52 -6
  48. package/dist/generated/services/DefaultService.d.ts +25 -16
  49. package/dist/generated/services/DefaultService.js +47 -14
  50. package/dist/workers.d.ts +39 -5
  51. package/dist/workers.js +184 -52
  52. package/package.json +1 -1
  53. package/src/bpmn.ts +7 -4
  54. package/src/generated/RawClient.ts +1 -1
  55. package/src/generated/core/OpenAPI.ts +1 -1
  56. package/src/generated/index.ts +3 -0
  57. package/src/generated/models/BatchEvaluateDesignRequest.ts +2 -0
  58. package/src/generated/models/BpmnIncident.ts +6 -0
  59. package/src/generated/models/BpmnIncidentRecord.ts +8 -6
  60. package/src/generated/models/BpmnInstance.ts +19 -0
  61. package/src/generated/models/BpmnInstanceState.ts +18 -2
  62. package/src/generated/models/CorrelationKeyNumber.ts +1 -1
  63. package/src/generated/models/Error.ts +6 -0
  64. package/src/generated/models/ErrorMode.ts +19 -0
  65. package/src/generated/models/EvaluateStoredRequest.ts +6 -1
  66. package/src/generated/models/EvaluationResult.ts +5 -0
  67. package/src/generated/models/ExternalJob.ts +1 -1
  68. package/src/generated/models/ExternalJobBatchResponse.ts +2 -2
  69. package/src/generated/models/FeelWarning.ts +22 -0
  70. package/src/generated/models/JoinArrivals.ts +13 -0
  71. package/src/generated/models/ModificationInstruction.ts +1 -1
  72. package/src/generated/models/PollBpmnJobRequest.ts +1 -1
  73. package/src/generated/models/SuspensionEntry.ts +2 -2
  74. package/src/generated/models/UpdateDefinitionRequest.ts +3 -3
  75. package/src/generated/models/UpdateUserTaskAssignmentRequest.ts +11 -4
  76. package/src/generated/services/BpmnService.ts +62 -17
  77. package/src/generated/services/DefaultService.ts +53 -17
  78. package/src/index.test.ts +3 -0
  79. package/src/workers.test.ts +279 -1
  80. package/src/workers.ts +196 -57
@@ -54,6 +54,8 @@ export type BpmnIncident = {
54
54
  * * `SnapshotSizeExceeded` - A ContinueAsNew snapshot exceeded the configured size cap.
55
55
  * * `CallActivityCanceled` - A call-activity child terminated as Canceled out-of-band.
56
56
  * * `ExternalRowRefreshError` - A migration could not rewrite a parked wait's external row (job, user task or subscription) against the target definition. Resolving re-runs the refresh.
57
+ * * `JobLockLost` - An external job's worker lock ran out, by missed heartbeats or the maximum hold, with no retries left.
58
+ * * `DecisionNotFound` - A business rule task called a decision, or a pinned version of one, that is not deployed.
57
59
  * * `Unknown` - Internal error not classified above.
58
60
  *
59
61
  */
@@ -84,6 +86,8 @@ export namespace BpmnIncident {
84
86
  * * `SnapshotSizeExceeded` - A ContinueAsNew snapshot exceeded the configured size cap.
85
87
  * * `CallActivityCanceled` - A call-activity child terminated as Canceled out-of-band.
86
88
  * * `ExternalRowRefreshError` - A migration could not rewrite a parked wait's external row (job, user task or subscription) against the target definition. Resolving re-runs the refresh.
89
+ * * `JobLockLost` - An external job's worker lock ran out, by missed heartbeats or the maximum hold, with no retries left.
90
+ * * `DecisionNotFound` - A business rule task called a decision, or a pinned version of one, that is not deployed.
87
91
  * * `Unknown` - Internal error not classified above.
88
92
  *
89
93
  */
@@ -102,6 +106,8 @@ export namespace BpmnIncident {
102
106
  SNAPSHOT_SIZE_EXCEEDED = 'SnapshotSizeExceeded',
103
107
  CALL_ACTIVITY_CANCELED = 'CallActivityCanceled',
104
108
  EXTERNAL_ROW_REFRESH_ERROR = 'ExternalRowRefreshError',
109
+ JOB_LOCK_LOST = 'JobLockLost',
110
+ DECISION_NOT_FOUND = 'DecisionNotFound',
105
111
  UNKNOWN = 'Unknown',
106
112
  }
107
113
  }
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * A persisted incident - the cross-instance audit row that backs the
7
7
  * "Incidents" view. The same incident is also available in
8
- * `BpmnInstanceState.incidents` while it is still open in the engine; the
8
+ * `BpmnInstanceState.incidents` while it is open and the instance runs. The
9
9
  * persisted row additionally carries `raisedAt` / `resolvedAt` /
10
10
  * `resolvedBy` and the parent process metadata so it can be listed and
11
11
  * filtered without joining back to the instance.
@@ -13,11 +13,7 @@
13
13
  */
14
14
  export type BpmnIncidentRecord = {
15
15
  /**
16
- * Surrogate row identifier; stable across resolves.
17
- */
18
- id: string;
19
- /**
20
- * Engine-assigned incident identifier, unique within the workflow.
16
+ * Engine-assigned incident identifier, unique within the workflow. Resolve the incident with it.
21
17
  */
22
18
  incidentID: string;
23
19
  /**
@@ -36,6 +32,10 @@ export type BpmnIncidentRecord = {
36
32
  * Human-readable name of the parent process definition.
37
33
  */
38
34
  processName?: string;
35
+ /**
36
+ * Version of that process definition. With `processID` it addresses the exact version the incident was raised on.
37
+ */
38
+ processVersion?: number;
39
39
  /**
40
40
  * ID of the BPMN node where the error occurred.
41
41
  */
@@ -100,6 +100,8 @@ export namespace BpmnIncidentRecord {
100
100
  SNAPSHOT_SIZE_EXCEEDED = 'SnapshotSizeExceeded',
101
101
  CALL_ACTIVITY_CANCELED = 'CallActivityCanceled',
102
102
  EXTERNAL_ROW_REFRESH_ERROR = 'ExternalRowRefreshError',
103
+ JOB_LOCK_LOST = 'JobLockLost',
104
+ DECISION_NOT_FOUND = 'DecisionNotFound',
103
105
  UNKNOWN = 'Unknown',
104
106
  }
105
107
  }
@@ -61,10 +61,29 @@ export type BpmnInstance = {
61
61
  *
62
62
  */
63
63
  definitionSuspended?: boolean;
64
+ /**
65
+ * True when an instance above this running call-activity child in the
66
+ * call chain is paused, which pauses this one too. It clears when that
67
+ * instance is resumed.
68
+ *
69
+ */
70
+ parentSuspended?: boolean;
64
71
  /**
65
72
  * Caller-supplied correlation key set when the instance was started. Inherited unchanged on child instances spawned via CallActivity.
66
73
  */
67
74
  businessId?: string;
75
+ /**
76
+ * BPMN process ID of the definition this instance was started from. Together with `processVersion` it addresses the version, which `definitionID` alone does not.
77
+ */
78
+ processId?: string;
79
+ /**
80
+ * Human-readable name of that process definition.
81
+ */
82
+ processName?: string;
83
+ /**
84
+ * Version of the process definition this instance was started from.
85
+ */
86
+ processVersion?: number;
68
87
  };
69
88
  export namespace BpmnInstance {
70
89
  /**
@@ -4,6 +4,7 @@
4
4
  /* eslint-disable */
5
5
  import type { ActiveScope } from './ActiveScope';
6
6
  import type { BpmnIncident } from './BpmnIncident';
7
+ import type { JoinArrivals } from './JoinArrivals';
7
8
  import type { SuspensionEntry } from './SuspensionEntry';
8
9
  /**
9
10
  * Full runtime state of a BPMN process instance.
@@ -38,11 +39,14 @@ export type BpmnInstanceState = {
38
39
  */
39
40
  variables?: Record<string, any>;
40
41
  /**
41
- * True when the instance has an unresolved incident.
42
+ * True when the instance failed or has an unresolved incident.
42
43
  */
43
44
  error?: boolean;
44
45
  /**
45
- * Active incidents that require resolution before the process can continue.
46
+ * Active incidents that require resolution before the process can
47
+ * continue. Empty once the instance has finished: the incident list keeps
48
+ * each one with `resolvedBy` set to `system:<status>`.
49
+ *
46
50
  */
47
51
  incidents?: Array<BpmnIncident>;
48
52
  /**
@@ -68,6 +72,18 @@ export type BpmnInstanceState = {
68
72
  *
69
73
  */
70
74
  definitionSuspension?: SuspensionEntry;
75
+ /**
76
+ * Present on a call-activity child while an instance above it in the
77
+ * call chain is suspended, carrying that suspension. It clears when that
78
+ * instance is resumed. A suspension of the child itself stays until the
79
+ * child is resumed.
80
+ *
81
+ */
82
+ parentSuspension?: SuspensionEntry;
83
+ /**
84
+ * Joins still waiting to fire, with the flows that have reached them.
85
+ */
86
+ pendingJoinArrivals?: Array<JoinArrivals>;
71
87
  /**
72
88
  * Caller-supplied correlation key set when the instance was started.
73
89
  */
@@ -3,6 +3,6 @@
3
3
  /* tslint:disable */
4
4
  /* eslint-disable */
5
5
  /**
6
- * A scalar numeric correlation value.
6
+ * A scalar numeric correlation value, kept exact (json.Number) so large ids such as order numbers correlate.
7
7
  */
8
8
  export type CorrelationKeyNumber = number;
@@ -12,6 +12,8 @@ export type Error = {
12
12
  * * `UNAUTHORIZED` - request lacks or has an invalid authentication token.
13
13
  * * `FORBIDDEN` - caller is authenticated but lacks permission, or has hit a quota.
14
14
  * * `NOT_FOUND` - the addressed resource does not exist.
15
+ * * `CONFLICT` - the request collides with the resource's current state, such as reporting on a job this worker no longer holds.
16
+ * * `UNAVAILABLE` - the resource cannot answer right now, such as a running instance whose workflow task is being retried. Try again shortly.
15
17
  * * `INTERNAL_ERROR` - unexpected server-side failure.
16
18
  *
17
19
  */
@@ -32,6 +34,8 @@ export namespace Error {
32
34
  * * `UNAUTHORIZED` - request lacks or has an invalid authentication token.
33
35
  * * `FORBIDDEN` - caller is authenticated but lacks permission, or has hit a quota.
34
36
  * * `NOT_FOUND` - the addressed resource does not exist.
37
+ * * `CONFLICT` - the request collides with the resource's current state, such as reporting on a job this worker no longer holds.
38
+ * * `UNAVAILABLE` - the resource cannot answer right now, such as a running instance whose workflow task is being retried. Try again shortly.
35
39
  * * `INTERNAL_ERROR` - unexpected server-side failure.
36
40
  *
37
41
  */
@@ -40,6 +44,8 @@ export namespace Error {
40
44
  UNAUTHORIZED = 'UNAUTHORIZED',
41
45
  FORBIDDEN = 'FORBIDDEN',
42
46
  NOT_FOUND = 'NOT_FOUND',
47
+ CONFLICT = 'CONFLICT',
48
+ UNAVAILABLE = 'UNAVAILABLE',
43
49
  INTERNAL_ERROR = 'INTERNAL_ERROR',
44
50
  }
45
51
  }
@@ -0,0 +1,19 @@
1
+ /* generated using openapi-typescript-codegen -- do not edit */
2
+ /* istanbul ignore file */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /**
6
+ * How the evaluation reacts to FEEL errors and failing decisions (DMN 1.5, section 7.3.8):
7
+ * * `strict` - the evaluation stops at the first error and the call reports it, with the
8
+ * line and column where the failing part of the expression starts.
9
+ * * `lenient` - a FEEL runtime error such as `string length(null)` makes only that part of
10
+ * the expression `null` and is listed in the `warnings` of the decision's result. A
11
+ * decision that still fails evaluates to `null` and carries its message in the `error`
12
+ * field of its own result, while the decisions around it keep evaluating.
13
+ * Omit it to use the mode the server is configured with.
14
+ *
15
+ */
16
+ export enum ErrorMode {
17
+ STRICT = 'strict',
18
+ LENIENT = 'lenient',
19
+ }
@@ -2,16 +2,21 @@
2
2
  /* istanbul ignore file */
3
3
  /* tslint:disable */
4
4
  /* eslint-disable */
5
+ import type { ErrorMode } from './ErrorMode';
5
6
  import type { FeelContext } from './FeelContext';
6
7
  /**
7
8
  * Payload for evaluating a stored DMN definition.
8
9
  */
9
10
  export type EvaluateStoredRequest = {
10
11
  /**
11
- * Specific definition version to evaluate. Defaults to the latest version.
12
+ * Specific definition version to evaluate when evaluating by definitions id. Defaults to the
13
+ * latest version. The `version` query parameter does the same, and a request giving both with
14
+ * different values is rejected. Evaluating by definition UUID ignores it, as the UUID names one version.
15
+ *
12
16
  */
13
17
  version?: number;
14
18
  context: FeelContext;
19
+ errorMode?: ErrorMode;
15
20
  /**
16
21
  * Names of decision services to evaluate. If empty, no decision services are evaluated.
17
22
  */
@@ -3,6 +3,7 @@
3
3
  /* tslint:disable */
4
4
  /* eslint-disable */
5
5
  import type { FeelValue } from './FeelValue';
6
+ import type { FeelWarning } from './FeelWarning';
6
7
  import type { HitRule } from './HitRule';
7
8
  /**
8
9
  * Result of evaluating a single decision (or decision service / BKM / input data) within a DMN evaluation.
@@ -20,6 +21,10 @@ export type EvaluationResult = {
20
21
  * Error message if the decision failed to evaluate. Null on success.
21
22
  */
22
23
  error?: string | null;
24
+ /**
25
+ * FEEL runtime errors that lenient mode replaced with `null` while this decision was evaluated. Absent when there were none.
26
+ */
27
+ warnings?: Array<FeelWarning>;
23
28
  /**
24
29
  * Kind of DMN element that produced this result:
25
30
  * * `DECISION` - a decision node, the typical case.
@@ -39,7 +39,7 @@ export type ExternalJob = {
39
39
  */
40
40
  status: ExternalJob.status;
41
41
  /**
42
- * Remaining retry budget. Decremented each time the worker reports a failure that the BPMN model maps to a retry.
42
+ * Remaining retry budget. A retryable worker error and a lock that runs out each use one.
43
43
  */
44
44
  retries?: number;
45
45
  /**
@@ -14,9 +14,9 @@ export type ExternalJobBatchResponse = {
14
14
  /**
15
15
  * Outcome for this item:
16
16
  * * `completed` - the job was completed successfully.
17
- * * `failed` - the job exhausted its retries and surfaced as an incident.
17
+ * * `failed` - the error was raised on the process, because no retries were left or `retryable` was false. An error boundary catches it, or it raises an incident.
18
18
  * * `requeued` - a retry budget remained, the job is back in PENDING.
19
- * * `error` - the per-item operation itself failed; the job's state is unchanged.
19
+ * * `error` - the per-item operation itself failed, and the job's state is unchanged.
20
20
  *
21
21
  */
22
22
  status: 'completed' | 'failed' | 'requeued' | 'error';
@@ -0,0 +1,22 @@
1
+ /* generated using openapi-typescript-codegen -- do not edit */
2
+ /* istanbul ignore file */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /**
6
+ * A FEEL runtime error that lenient mode replaced with `null`.
7
+ */
8
+ export type FeelWarning = {
9
+ /**
10
+ * What failed, for example `string length: argument cannot be null`.
11
+ */
12
+ message: string;
13
+ /**
14
+ * Line in the expression where the failing part starts. Absent when unknown.
15
+ */
16
+ line?: number;
17
+ /**
18
+ * Column in the expression where the failing part starts. Absent when unknown.
19
+ */
20
+ column?: number;
21
+ };
22
+
@@ -0,0 +1,13 @@
1
+ /* generated using openapi-typescript-codegen -- do not edit */
2
+ /* istanbul ignore file */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /**
6
+ * The flows that have delivered tokens to a join that has not fired yet.
7
+ */
8
+ export type JoinArrivals = {
9
+ nodeId: string;
10
+ scopeId: string;
11
+ incomingFlows: Array<string>;
12
+ };
13
+
@@ -18,7 +18,7 @@ export type ModificationInstruction = {
18
18
  */
19
19
  nodeID: string;
20
20
  /**
21
- * Scope to apply the instruction in. Empty applies to the root process scope.
21
+ * Scope to apply the instruction in, as reported by the instance's active scopes. Empty applies to the root process scope, for both instruction types. A scope that is not live on the instance is rejected with a 400.
22
22
  */
23
23
  scopeID?: string;
24
24
  /**
@@ -15,7 +15,7 @@ export type PollBpmnJobRequest = {
15
15
  */
16
16
  clientID: string;
17
17
  /**
18
- * Exclusive lock duration on each acquired job. Accepts Go duration strings (e.g. `5s`, `2m`). Defaults to `30s`.
18
+ * How long each acquired job stays locked to this worker without a heartbeat. Accepts Go duration strings (e.g. `5s`, `2m`). Defaults to `30s`, clamped by the server to 10s..5m.
19
19
  */
20
20
  lockDuration?: string;
21
21
  /**
@@ -12,9 +12,9 @@
12
12
  */
13
13
  export type SuspensionEntry = {
14
14
  /**
15
- * Unix epoch nanoseconds at which the suspension was applied.
15
+ * When the suspension was applied.
16
16
  */
17
- suspendedAt: number;
17
+ suspendedAt: string;
18
18
  /**
19
19
  * Identifier of the operator (or service account) that initiated the suspension.
20
20
  */
@@ -3,15 +3,15 @@
3
3
  /* tslint:disable */
4
4
  /* eslint-disable */
5
5
  /**
6
- * Payload for updating metadata on an existing definition version.
6
+ * Payload for updating an existing definition version.
7
7
  */
8
8
  export type UpdateDefinitionRequest = {
9
9
  /**
10
- * Replacement XML. The `definitionsID` and `version` from the original are preserved.
10
+ * Replacement XML. The `definitionsID` is read from its `<definitions id>`, falling back to the original.
11
11
  */
12
12
  xml?: string;
13
13
  /**
14
- * Optional explicit version override. Generally not used during update.
14
+ * Omit to overwrite the version in place. 0 stores the change as the next version instead.
15
15
  */
16
16
  version?: number;
17
17
  /**
@@ -4,16 +4,23 @@
4
4
  /* eslint-disable */
5
5
  /**
6
6
  * Reassign a CREATED user task. All fields are optional but at least one
7
- * must be present. Fields are REPLACED atomically - pass the full set of
8
- * candidateUsers / candidateGroups you want stored, not a delta.
7
+ * must be present, an empty body is rejected with 400. A field you leave out
8
+ * keeps its value. A list you send replaces the stored one, so pass the full
9
+ * set of candidateUsers / candidateGroups you want, not a delta.
9
10
  *
10
11
  */
11
12
  export type UpdateUserTaskAssignmentRequest = {
12
13
  /**
13
- * New assignee. Pass null to clear.
14
+ * New assignee. An empty string clears it.
15
+ */
16
+ assignee?: string;
17
+ /**
18
+ * Replaces the candidate users. An empty list clears them.
14
19
  */
15
- assignee?: string | null;
16
20
  candidateUsers?: Array<string>;
21
+ /**
22
+ * Replaces the candidate groups. An empty list clears them.
23
+ */
17
24
  candidateGroups?: Array<string>;
18
25
  };
19
26
 
@@ -98,6 +98,9 @@ export class BpmnService {
98
98
  'projectID': projectId,
99
99
  'resourceID': resourceId,
100
100
  },
101
+ errors: {
102
+ 404: `Not Found`,
103
+ },
101
104
  });
102
105
  }
103
106
  /**
@@ -182,14 +185,16 @@ export class BpmnService {
182
185
  errors: {
183
186
  400: `Bad Request`,
184
187
  401: `Unauthorized`,
188
+ 404: `Not Found`,
185
189
  500: `Internal Server Error`,
186
190
  },
187
191
  });
188
192
  }
189
193
  /**
190
- * Start a test instance from a draft resource
191
- * Starts a process instance against a draft (non-deployed) resource.
192
- * Useful for trying out an in-progress design before deploying.
194
+ * Start a test instance from a resource
195
+ * Starts a test instance of a resource, draft or deployed. A draft can
196
+ * only be started this way, which makes it the way to try out an
197
+ * in-progress design before deploying.
193
198
  * Test instances run with the same engine as production but are flagged
194
199
  * so they can be filtered out of dashboards.
195
200
  *
@@ -221,6 +226,7 @@ export class BpmnService {
221
226
  errors: {
222
227
  400: `Bad Request`,
223
228
  401: `Unauthorized`,
229
+ 404: `Not Found`,
224
230
  500: `Internal Server Error`,
225
231
  },
226
232
  });
@@ -456,7 +462,7 @@ export class BpmnService {
456
462
  definitionId?: string,
457
463
  workflowId?: string,
458
464
  status?: 'open' | 'resolved',
459
- errorType?: 'BpmnError' | 'EscalationError' | 'CompensationError' | 'FeelError' | 'NoHandler' | 'GatewayNoMatch' | 'TimerResolution' | 'LinkNotFound' | 'MigrationError' | 'SubscriptionError' | 'RotationLimitError' | 'SnapshotSizeExceeded' | 'CallActivityCanceled' | 'ExternalRowRefreshError' | 'Unknown',
465
+ errorType?: 'BpmnError' | 'EscalationError' | 'CompensationError' | 'FeelError' | 'NoHandler' | 'GatewayNoMatch' | 'TimerResolution' | 'LinkNotFound' | 'MigrationError' | 'SubscriptionError' | 'RotationLimitError' | 'SnapshotSizeExceeded' | 'CallActivityCanceled' | 'ExternalRowRefreshError' | 'JobLockLost' | 'DecisionNotFound' | 'Unknown',
460
466
  since?: string,
461
467
  until?: string,
462
468
  page?: number,
@@ -545,6 +551,13 @@ export class BpmnService {
545
551
  * running instance. Useful for unblocking instances that have ended up
546
552
  * in unintended states. Restricted to project administrators.
547
553
  *
554
+ * The instructions are validated against the live instance before
555
+ * anything is applied, and the whole batch is refused with a 400 if any
556
+ * of them cannot be: an unknown scope, a `START_BEFORE_NODE` naming a
557
+ * node the instance's process version does not contain, or a
558
+ * `CANCEL_TOKEN` with no live token, scope or incident at its target.
559
+ * A batch is applied whole or not at all.
560
+ *
548
561
  * @param projectId
549
562
  * @param workflowId
550
563
  * @param requestBody
@@ -565,6 +578,10 @@ export class BpmnService {
565
578
  },
566
579
  body: requestBody,
567
580
  mediaType: 'application/json',
581
+ errors: {
582
+ 400: `Bad Request`,
583
+ 404: `Not Found`,
584
+ },
568
585
  });
569
586
  }
570
587
  /**
@@ -823,10 +840,10 @@ export class BpmnService {
823
840
  errorCode: string;
824
841
  /**
825
842
  * 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.
843
+ * When supplied, a worker that no longer holds the job's lock
844
+ * gets 409 and its report is discarded, so a stale report can't
845
+ * requeue or fail the job. Omit for the legacy unchecked
846
+ * behavior.
830
847
  *
831
848
  */
832
849
  clientID?: string;
@@ -854,6 +871,13 @@ export class BpmnService {
854
871
  },
855
872
  body: requestBody,
856
873
  mediaType: 'application/json',
874
+ errors: {
875
+ 404: `No job has this execution key.`,
876
+ 409: `This worker no longer holds the job, so the report was discarded.
877
+ Its lock ran out, another worker holds it, or the job has finished.
878
+ The message says when the job was cancelled.
879
+ `,
880
+ },
857
881
  });
858
882
  }
859
883
  /**
@@ -873,9 +897,9 @@ export class BpmnService {
873
897
  /**
874
898
  * Optional worker identity (the same `clientID` used to poll)
875
899
  * 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.
900
+ * report. When supplied, an item this worker no longer holds
901
+ * comes back with status `error` and its result is discarded.
902
+ * Omit for the legacy unchecked behavior.
879
903
  *
880
904
  */
881
905
  clientID?: string;
@@ -918,10 +942,9 @@ export class BpmnService {
918
942
  /**
919
943
  * Optional worker identity (the same `clientID` used to poll)
920
944
  * 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.
945
+ * report. When supplied, an item this worker no longer holds
946
+ * comes back with status `error` and the job is left untouched.
947
+ * Omit for the legacy unchecked behavior.
925
948
  *
926
949
  */
927
950
  clientID?: string;
@@ -1059,7 +1082,8 @@ export class BpmnService {
1059
1082
  }
1060
1083
  /**
1061
1084
  * Update User Task Assignment
1062
- * Reassign / change candidates on a CREATED user task. Returns 404 if the
1085
+ * Reassign / change candidates on a CREATED user task. Only the fields in
1086
+ * the body change. Returns 400 for a body with none of them, and 404 if the
1063
1087
  * task does not exist or is no longer in CREATED state. Requires Executor
1064
1088
  * role on the project.
1065
1089
  *
@@ -1084,6 +1108,7 @@ export class BpmnService {
1084
1108
  body: requestBody,
1085
1109
  mediaType: 'application/json',
1086
1110
  errors: {
1111
+ 400: `Bad Request`,
1087
1112
  404: `Not Found`,
1088
1113
  },
1089
1114
  });
@@ -1120,6 +1145,10 @@ export class BpmnService {
1120
1145
  errors: {
1121
1146
  403: `Forbidden - caller is not Executor and not assigned to the task`,
1122
1147
  404: `User task not found`,
1148
+ 409: `The task is no longer open: it was already completed or failed,
1149
+ possibly by another user a moment earlier, or it was cancelled.
1150
+ Nothing was applied.
1151
+ `,
1123
1152
  },
1124
1153
  });
1125
1154
  }
@@ -1155,6 +1184,10 @@ export class BpmnService {
1155
1184
  errors: {
1156
1185
  403: `Forbidden - caller is not Executor and not assigned to the task`,
1157
1186
  404: `User task not found`,
1187
+ 409: `The task is no longer open: it was already completed or failed,
1188
+ possibly by another user a moment earlier, or it was cancelled.
1189
+ Nothing was applied.
1190
+ `,
1158
1191
  },
1159
1192
  });
1160
1193
  }
@@ -1202,6 +1235,12 @@ export class BpmnService {
1202
1235
  },
1203
1236
  body: requestBody,
1204
1237
  mediaType: 'application/json',
1238
+ errors: {
1239
+ 400: `A message start event for \`messageName\` belongs to a suspended
1240
+ process definition, so the message would not start it. Nothing was
1241
+ published or buffered. Publish again once the definition is resumed.
1242
+ `,
1243
+ },
1205
1244
  });
1206
1245
  }
1207
1246
  /**
@@ -1247,6 +1286,12 @@ export class BpmnService {
1247
1286
  },
1248
1287
  body: requestBody,
1249
1288
  mediaType: 'application/json',
1289
+ errors: {
1290
+ 400: `A signal start event for \`signalName\` belongs to a suspended process
1291
+ definition, so the signal would not start it. Nothing was published
1292
+ or buffered. Publish again once the definition is resumed.
1293
+ `,
1294
+ },
1250
1295
  });
1251
1296
  }
1252
1297
  /**
@@ -1258,7 +1303,7 @@ export class BpmnService {
1258
1303
  * @param projectId
1259
1304
  * @param page
1260
1305
  * @param pageSize
1261
- * @param q Optional case-insensitive substring match against process id or process name.
1306
+ * @param q Optional case-insensitive prefix match against process id or process name.
1262
1307
  * @param createdAfter Bounds the totalCount aggregate to instances created at or after this
1263
1308
  * timestamp. Strongly recommended for monitoring views - instance
1264
1309
  * history accumulates indefinitely and unfiltered totals scan the full