@hotmeshio/hotmesh 0.31.3 → 0.32.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.
- package/build/package.json +1 -1
- package/build/services/durable/workflow/condition.d.ts +20 -0
- package/build/services/durable/workflow/condition.js +20 -0
- package/build/services/escalations/batch.d.ts +4 -2
- package/build/services/escalations/batch.js +32 -2
- package/build/services/escalations/client.d.ts +7 -2
- package/build/services/escalations/client.js +8 -3
- package/build/services/escalations/fold.d.ts +2 -1
- package/build/services/escalations/fold.js +8 -1
- package/build/services/escalations/index.d.ts +1 -1
- package/build/services/escalations/index.js +5 -1
- package/build/services/store/providers/postgres/postgres.js +37 -7
- package/build/types/hmsh_escalations.d.ts +42 -6
- package/build/types/hmsh_escalations.js +19 -2
- package/build/types/index.d.ts +1 -1
- package/build/types/index.js +5 -1
- package/package.json +1 -1
package/build/package.json
CHANGED
|
@@ -125,6 +125,26 @@ import { ConditionQueueConfig } from '../../../types/hmsh_escalations';
|
|
|
125
125
|
* });
|
|
126
126
|
* ```
|
|
127
127
|
*
|
|
128
|
+
* `wakeOnFill` resumes the wait on a fill, so the workflow acts on each
|
|
129
|
+
* item as it lands: `true` for every key, or a list of keys. The fill
|
|
130
|
+
* resolves the row and the wait returns the items so far with
|
|
131
|
+
* `$filled: [itemKey]`, `$filledAt`, `$filledBy`, and `$trigger: 'fill'`.
|
|
132
|
+
* The next round parks with every fill carried forward; the last key
|
|
133
|
+
* completes as on any batch.
|
|
134
|
+
*
|
|
135
|
+
* ```typescript
|
|
136
|
+
* let filled;
|
|
137
|
+
* for (;;) {
|
|
138
|
+
* const out = await Durable.workflow.condition(`receive-${Durable.guid()}`, {
|
|
139
|
+
* role: 'receiving', batch: boxes, wakeOnFill: true, ...(filled ? { filled } : {}),
|
|
140
|
+
* });
|
|
141
|
+
* if (!out || out.$trigger !== 'fill') return out; // complete, expired, or cancelled
|
|
142
|
+
* await recordReceipt(out.$filled[0]); // a proxied activity
|
|
143
|
+
* filled = Object.fromEntries(Object.keys(out.$filledAt).map((key) =>
|
|
144
|
+
* [key, { payload: out[key], at: out.$filledAt[key], actor: out.$filledBy?.[key] }]));
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*
|
|
128
148
|
* ## Placement: call escalation-bearing waits from main workflow code
|
|
129
149
|
*
|
|
130
150
|
* The resolve/signal delivery pipeline routes to the main flow's waiter.
|
|
@@ -131,6 +131,26 @@ const didRun_1 = require("./didRun");
|
|
|
131
131
|
* });
|
|
132
132
|
* ```
|
|
133
133
|
*
|
|
134
|
+
* `wakeOnFill` resumes the wait on a fill, so the workflow acts on each
|
|
135
|
+
* item as it lands: `true` for every key, or a list of keys. The fill
|
|
136
|
+
* resolves the row and the wait returns the items so far with
|
|
137
|
+
* `$filled: [itemKey]`, `$filledAt`, `$filledBy`, and `$trigger: 'fill'`.
|
|
138
|
+
* The next round parks with every fill carried forward; the last key
|
|
139
|
+
* completes as on any batch.
|
|
140
|
+
*
|
|
141
|
+
* ```typescript
|
|
142
|
+
* let filled;
|
|
143
|
+
* for (;;) {
|
|
144
|
+
* const out = await Durable.workflow.condition(`receive-${Durable.guid()}`, {
|
|
145
|
+
* role: 'receiving', batch: boxes, wakeOnFill: true, ...(filled ? { filled } : {}),
|
|
146
|
+
* });
|
|
147
|
+
* if (!out || out.$trigger !== 'fill') return out; // complete, expired, or cancelled
|
|
148
|
+
* await recordReceipt(out.$filled[0]); // a proxied activity
|
|
149
|
+
* filled = Object.fromEntries(Object.keys(out.$filledAt).map((key) =>
|
|
150
|
+
* [key, { payload: out[key], at: out.$filledAt[key], actor: out.$filledBy?.[key] }]));
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
134
154
|
* ## Placement: call escalation-bearing waits from main workflow code
|
|
135
155
|
*
|
|
136
156
|
* The resolve/signal delivery pipeline routes to the main flow's waiter.
|
|
@@ -5,7 +5,8 @@ import { AccumulateConfig, BatchFilledEntry, FlagBatchItemParams } from '../../t
|
|
|
5
5
|
* `batch_keys`) and the payload accumulator in `envelope`
|
|
6
6
|
* (`batch_items: {}`). `partialOnTimeout` is stored beside the items so
|
|
7
7
|
* the expiry statement delivers the filled items instead of `false`;
|
|
8
|
-
* `wakeOnFlag` is stored the same way so a flag ends the wait
|
|
8
|
+
* `wakeOnFlag` is stored the same way so a flag ends the wait, and
|
|
9
|
+
* `wakeOnFill` (`true` or its list of keys) so a fill ends it.
|
|
9
10
|
* `filled` entries start satisfied: they are left out of `batch_pending`
|
|
10
11
|
* and written into `batch_items`, `batch_filled_at`, and (when an entry
|
|
11
12
|
* names an actor) `batch_filled_by`. Pure
|
|
@@ -17,11 +18,12 @@ export declare function foldBatchConfig<T extends {
|
|
|
17
18
|
batch?: string[];
|
|
18
19
|
partialOnTimeout?: boolean;
|
|
19
20
|
wakeOnFlag?: boolean;
|
|
21
|
+
wakeOnFill?: boolean | string[];
|
|
20
22
|
filled?: Record<string, BatchFilledEntry>;
|
|
21
23
|
accumulate?: AccumulateConfig;
|
|
22
24
|
metadata?: Record<string, unknown>;
|
|
23
25
|
envelope?: Record<string, unknown>;
|
|
24
|
-
}>(config: T): Omit<T, 'batch' | 'partialOnTimeout' | 'wakeOnFlag' | 'filled'>;
|
|
26
|
+
}>(config: T): Omit<T, 'batch' | 'partialOnTimeout' | 'wakeOnFlag' | 'wakeOnFill' | 'filled'>;
|
|
25
27
|
/**
|
|
26
28
|
* Validates a `flagBatchItem()` request before any read or write: exactly
|
|
27
29
|
* one row selector, a non-empty key and label within their limits, object
|
|
@@ -14,7 +14,29 @@ const RESERVED_ENVELOPE_KEYS = new Set([
|
|
|
14
14
|
hmsh_escalations_1.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY,
|
|
15
15
|
hmsh_escalations_1.ESCALATION_BATCH_FLAGS_KEY,
|
|
16
16
|
hmsh_escalations_1.ESCALATION_BATCH_WAKE_ON_FLAG_KEY,
|
|
17
|
+
hmsh_escalations_1.ESCALATION_BATCH_WAKE_ON_FILL_KEY,
|
|
17
18
|
]);
|
|
19
|
+
/**
|
|
20
|
+
* Validates `wakeOnFill` against the declared keys and returns its stored
|
|
21
|
+
* form: `true`, the de-duplicated key list, or `null` when the opt-in is
|
|
22
|
+
* absent, `false`, or an empty list.
|
|
23
|
+
*/
|
|
24
|
+
function foldWakeOnFill(batch, wakeOnFill) {
|
|
25
|
+
if (wakeOnFill === undefined || wakeOnFill === false)
|
|
26
|
+
return null;
|
|
27
|
+
if (wakeOnFill === true)
|
|
28
|
+
return true;
|
|
29
|
+
if (!Array.isArray(wakeOnFill)) {
|
|
30
|
+
throw new Error('wakeOnFill must be a boolean or a list of batch keys');
|
|
31
|
+
}
|
|
32
|
+
for (const key of wakeOnFill) {
|
|
33
|
+
if (typeof key !== 'string' || !batch.includes(key)) {
|
|
34
|
+
throw new Error(`wakeOnFill key '${String(key)}' is not declared in batch`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const keys = [...new Set(wakeOnFill)];
|
|
38
|
+
return keys.length ? keys : null;
|
|
39
|
+
}
|
|
18
40
|
/**
|
|
19
41
|
* Validates `filled` against the declared keys and splits it into the
|
|
20
42
|
* envelope maps. Pure: `at` is normalized from the caller's value, never
|
|
@@ -68,7 +90,8 @@ function foldFilledEntries(batch, filled) {
|
|
|
68
90
|
* `batch_keys`) and the payload accumulator in `envelope`
|
|
69
91
|
* (`batch_items: {}`). `partialOnTimeout` is stored beside the items so
|
|
70
92
|
* the expiry statement delivers the filled items instead of `false`;
|
|
71
|
-
* `wakeOnFlag` is stored the same way so a flag ends the wait
|
|
93
|
+
* `wakeOnFlag` is stored the same way so a flag ends the wait, and
|
|
94
|
+
* `wakeOnFill` (`true` or its list of keys) so a fill ends it.
|
|
72
95
|
* `filled` entries start satisfied: they are left out of `batch_pending`
|
|
73
96
|
* and written into `batch_items`, `batch_filled_at`, and (when an entry
|
|
74
97
|
* names an actor) `batch_filled_by`. Pure
|
|
@@ -77,7 +100,7 @@ function foldFilledEntries(batch, filled) {
|
|
|
77
100
|
* durable write.
|
|
78
101
|
*/
|
|
79
102
|
function foldBatchConfig(config) {
|
|
80
|
-
const { batch, partialOnTimeout, wakeOnFlag, filled, ...rest } = config;
|
|
103
|
+
const { batch, partialOnTimeout, wakeOnFlag, wakeOnFill, filled, ...rest } = config;
|
|
81
104
|
if (!batch) {
|
|
82
105
|
if (partialOnTimeout !== undefined) {
|
|
83
106
|
throw new Error('partialOnTimeout requires a batch declaration');
|
|
@@ -85,6 +108,9 @@ function foldBatchConfig(config) {
|
|
|
85
108
|
if (wakeOnFlag !== undefined) {
|
|
86
109
|
throw new Error('wakeOnFlag requires a batch declaration');
|
|
87
110
|
}
|
|
111
|
+
if (wakeOnFill !== undefined) {
|
|
112
|
+
throw new Error('wakeOnFill requires a batch declaration');
|
|
113
|
+
}
|
|
88
114
|
if (filled !== undefined) {
|
|
89
115
|
throw new Error('filled requires a batch declaration');
|
|
90
116
|
}
|
|
@@ -125,6 +151,7 @@ function foldBatchConfig(config) {
|
|
|
125
151
|
throw new Error(`envelope key '${reserved}' is reserved for batch state`);
|
|
126
152
|
}
|
|
127
153
|
}
|
|
154
|
+
const wakeKeys = foldWakeOnFill(batch, wakeOnFill);
|
|
128
155
|
const fills = foldFilledEntries(batch, filled);
|
|
129
156
|
return {
|
|
130
157
|
...rest,
|
|
@@ -145,6 +172,9 @@ function foldBatchConfig(config) {
|
|
|
145
172
|
? { [hmsh_escalations_1.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY]: true }
|
|
146
173
|
: {}),
|
|
147
174
|
...(wakeOnFlag ? { [hmsh_escalations_1.ESCALATION_BATCH_WAKE_ON_FLAG_KEY]: true } : {}),
|
|
175
|
+
...(wakeKeys !== null
|
|
176
|
+
? { [hmsh_escalations_1.ESCALATION_BATCH_WAKE_ON_FILL_KEY]: wakeKeys }
|
|
177
|
+
: {}),
|
|
148
178
|
},
|
|
149
179
|
};
|
|
150
180
|
}
|
|
@@ -215,7 +215,8 @@ export declare class EscalationClientService {
|
|
|
215
215
|
* Shared post-statement handling for both batch-item forms: post-commit
|
|
216
216
|
* wake fallback (the committed `resolver_payload` — the full assembled
|
|
217
217
|
* collection — is the recovery record) and lifecycle events
|
|
218
|
-
* (`batch-item` on interim fills, `resolved` on completion
|
|
218
|
+
* (`batch-item` on interim fills, `resolved` on completion and on a
|
|
219
|
+
* `wakeOnFill` wake).
|
|
219
220
|
*/
|
|
220
221
|
private _settleBatchItemResult;
|
|
221
222
|
/**
|
|
@@ -227,7 +228,11 @@ export declare class EscalationClientService {
|
|
|
227
228
|
* item — the row resolves with the assembled collection as its
|
|
228
229
|
* `resolver_payload` and the waiting workflow's wake commits WITH the
|
|
229
230
|
* fill (same durability contract as `resolve()`). The caller that lands
|
|
230
|
-
* the last item learns it from `outcome: 'completed'`.
|
|
231
|
+
* the last item learns it from `outcome: 'completed'`. On a row whose wait
|
|
232
|
+
* declared `wakeOnFill` for this key, the same statement resolves the row
|
|
233
|
+
* early and the waiter wakes with the items filled so far, `$filled`,
|
|
234
|
+
* `$filledAt`, `$filledBy`, and `$trigger: 'fill'` (outcome `woke`,
|
|
235
|
+
* `remaining` > 0).
|
|
231
236
|
*
|
|
232
237
|
* Fills are claim-agnostic by default — a batch accumulates contributions
|
|
233
238
|
* from multiple principals. Pass `assertClaim` to opt into the same
|
|
@@ -493,12 +493,13 @@ class EscalationClientService {
|
|
|
493
493
|
* Shared post-statement handling for both batch-item forms: post-commit
|
|
494
494
|
* wake fallback (the committed `resolver_payload` — the full assembled
|
|
495
495
|
* collection — is the recovery record) and lifecycle events
|
|
496
|
-
* (`batch-item` on interim fills, `resolved` on completion
|
|
496
|
+
* (`batch-item` on interim fills, `resolved` on completion and on a
|
|
497
|
+
* `wakeOnFill` wake).
|
|
497
498
|
*/
|
|
498
499
|
async _settleBatchItemResult(ns, dbResult, resolvedBy) {
|
|
499
500
|
if (!dbResult.ok)
|
|
500
501
|
return dbResult;
|
|
501
|
-
if (dbResult.outcome === 'completed') {
|
|
502
|
+
if (dbResult.outcome === 'completed' || dbResult.outcome === 'woke') {
|
|
502
503
|
if (dbResult.signalKey && !dbResult.wakeEnqueued) {
|
|
503
504
|
await this._deliverEscalationSignal(ns, dbResult.topic, {
|
|
504
505
|
id: dbResult.signalKey,
|
|
@@ -526,7 +527,11 @@ class EscalationClientService {
|
|
|
526
527
|
* item — the row resolves with the assembled collection as its
|
|
527
528
|
* `resolver_payload` and the waiting workflow's wake commits WITH the
|
|
528
529
|
* fill (same durability contract as `resolve()`). The caller that lands
|
|
529
|
-
* the last item learns it from `outcome: 'completed'`.
|
|
530
|
+
* the last item learns it from `outcome: 'completed'`. On a row whose wait
|
|
531
|
+
* declared `wakeOnFill` for this key, the same statement resolves the row
|
|
532
|
+
* early and the waiter wakes with the items filled so far, `$filled`,
|
|
533
|
+
* `$filledAt`, `$filledBy`, and `$trigger: 'fill'` (outcome `woke`,
|
|
534
|
+
* `remaining` > 0).
|
|
530
535
|
*
|
|
531
536
|
* Fills are claim-agnostic by default — a batch accumulates contributions
|
|
532
537
|
* from multiple principals. Pass `assertClaim` to opt into the same
|
|
@@ -3,6 +3,7 @@ type Foldable = {
|
|
|
3
3
|
batch?: string[];
|
|
4
4
|
partialOnTimeout?: boolean;
|
|
5
5
|
wakeOnFlag?: boolean;
|
|
6
|
+
wakeOnFill?: boolean | string[];
|
|
6
7
|
filled?: Record<string, BatchFilledEntry>;
|
|
7
8
|
accumulate?: AccumulateConfig;
|
|
8
9
|
metadata?: Record<string, unknown>;
|
|
@@ -14,5 +15,5 @@ type Foldable = {
|
|
|
14
15
|
* config through untouched. The single entry point for both the
|
|
15
16
|
* `condition()` path and standalone `create()`.
|
|
16
17
|
*/
|
|
17
|
-
export declare function foldEscalationConfig<T extends Foldable>(config: T): Omit<T, 'batch' | 'partialOnTimeout' | 'wakeOnFlag' | 'filled' | 'accumulate'>;
|
|
18
|
+
export declare function foldEscalationConfig<T extends Foldable>(config: T): Omit<T, 'batch' | 'partialOnTimeout' | 'wakeOnFlag' | 'wakeOnFill' | 'filled' | 'accumulate'>;
|
|
18
19
|
export {};
|
|
@@ -10,7 +10,7 @@ const batch_1 = require("./batch");
|
|
|
10
10
|
* `condition()` path and standalone `create()`.
|
|
11
11
|
*/
|
|
12
12
|
function foldEscalationConfig(config) {
|
|
13
|
-
const { batch, partialOnTimeout, wakeOnFlag, filled, accumulate, ...rest } = config;
|
|
13
|
+
const { batch, partialOnTimeout, wakeOnFlag, wakeOnFill, filled, accumulate, ...rest } = config;
|
|
14
14
|
if (batch) {
|
|
15
15
|
if (accumulate) {
|
|
16
16
|
throw new Error('accumulate and batch are mutually exclusive');
|
|
@@ -20,6 +20,7 @@ function foldEscalationConfig(config) {
|
|
|
20
20
|
batch,
|
|
21
21
|
partialOnTimeout,
|
|
22
22
|
wakeOnFlag,
|
|
23
|
+
wakeOnFill,
|
|
23
24
|
filled,
|
|
24
25
|
});
|
|
25
26
|
}
|
|
@@ -30,6 +31,9 @@ function foldEscalationConfig(config) {
|
|
|
30
31
|
if (wakeOnFlag !== undefined) {
|
|
31
32
|
throw new Error('wakeOnFlag applies to batch only');
|
|
32
33
|
}
|
|
34
|
+
if (wakeOnFill !== undefined) {
|
|
35
|
+
throw new Error('wakeOnFill applies to batch only');
|
|
36
|
+
}
|
|
33
37
|
return (0, accumulate_1.foldAccumulateConfig)({ ...rest, accumulate });
|
|
34
38
|
}
|
|
35
39
|
if (partialOnTimeout !== undefined) {
|
|
@@ -41,6 +45,9 @@ function foldEscalationConfig(config) {
|
|
|
41
45
|
if (wakeOnFlag !== undefined) {
|
|
42
46
|
throw new Error('wakeOnFlag requires a batch declaration');
|
|
43
47
|
}
|
|
48
|
+
if (wakeOnFill !== undefined) {
|
|
49
|
+
throw new Error('wakeOnFill requires a batch declaration');
|
|
50
|
+
}
|
|
44
51
|
return rest;
|
|
45
52
|
}
|
|
46
53
|
exports.foldEscalationConfig = foldEscalationConfig;
|
|
@@ -68,4 +68,4 @@ export { ESCALATION_RESOLUTION_KEY } from './client';
|
|
|
68
68
|
export { foldBatchConfig } from './batch';
|
|
69
69
|
export { foldAccumulateConfig, assertAccumulateItemKey } from './accumulate';
|
|
70
70
|
export { foldEscalationConfig } from './fold';
|
|
71
|
-
export { ESCALATION_BATCH_PENDING_KEY, ESCALATION_BATCH_COUNT_KEY, ESCALATION_BATCH_KEYS_KEY, ESCALATION_BATCH_ITEMS_KEY, ESCALATION_BATCH_FILLED_AT_KEY, ESCALATION_BATCH_FILLED_BY_KEY, ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY, ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH, ESCALATION_BATCH_FLAGS_KEY, ESCALATION_BATCH_WAKE_ON_FLAG_KEY, ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH, ESCALATION_FLAGS_KEY, ESCALATION_ACCUMULATE_COUNT_KEY, ESCALATION_ACCUMULATE_MAX_KEY, ESCALATION_ACCUMULATE_KEYS_KEY, ESCALATION_ACCUMULATE_ITEMS_KEY, ESCALATION_ACCUMULATE_CONFIG_KEY, ESCALATION_ACCUMULATED_KEY, ESCALATION_TRIGGER_KEY, } from '../../types/hmsh_escalations';
|
|
71
|
+
export { ESCALATION_BATCH_PENDING_KEY, ESCALATION_BATCH_COUNT_KEY, ESCALATION_BATCH_KEYS_KEY, ESCALATION_BATCH_ITEMS_KEY, ESCALATION_BATCH_FILLED_AT_KEY, ESCALATION_BATCH_FILLED_BY_KEY, ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY, ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH, ESCALATION_BATCH_FLAGS_KEY, ESCALATION_BATCH_WAKE_ON_FLAG_KEY, ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH, ESCALATION_FLAGS_KEY, ESCALATION_BATCH_WAKE_ON_FILL_KEY, ESCALATION_FILLED_KEY, ESCALATION_FILLED_AT_KEY, ESCALATION_FILLED_BY_KEY, ESCALATION_ACCUMULATE_COUNT_KEY, ESCALATION_ACCUMULATE_MAX_KEY, ESCALATION_ACCUMULATE_KEYS_KEY, ESCALATION_ACCUMULATE_ITEMS_KEY, ESCALATION_ACCUMULATE_CONFIG_KEY, ESCALATION_ACCUMULATED_KEY, ESCALATION_TRIGGER_KEY, } from '../../types/hmsh_escalations';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ESCALATION_TRIGGER_KEY = exports.ESCALATION_ACCUMULATED_KEY = exports.ESCALATION_ACCUMULATE_CONFIG_KEY = exports.ESCALATION_ACCUMULATE_ITEMS_KEY = exports.ESCALATION_ACCUMULATE_KEYS_KEY = exports.ESCALATION_ACCUMULATE_MAX_KEY = exports.ESCALATION_ACCUMULATE_COUNT_KEY = exports.ESCALATION_FLAGS_KEY = exports.ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH = exports.ESCALATION_BATCH_WAKE_ON_FLAG_KEY = exports.ESCALATION_BATCH_FLAGS_KEY = exports.ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH = exports.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY = exports.ESCALATION_BATCH_FILLED_BY_KEY = exports.ESCALATION_BATCH_FILLED_AT_KEY = exports.ESCALATION_BATCH_ITEMS_KEY = exports.ESCALATION_BATCH_KEYS_KEY = exports.ESCALATION_BATCH_COUNT_KEY = exports.ESCALATION_BATCH_PENDING_KEY = exports.foldEscalationConfig = exports.assertAccumulateItemKey = exports.foldAccumulateConfig = exports.foldBatchConfig = exports.ESCALATION_RESOLUTION_KEY = exports.EscalationClientService = exports.Escalations = void 0;
|
|
3
|
+
exports.ESCALATION_TRIGGER_KEY = exports.ESCALATION_ACCUMULATED_KEY = exports.ESCALATION_ACCUMULATE_CONFIG_KEY = exports.ESCALATION_ACCUMULATE_ITEMS_KEY = exports.ESCALATION_ACCUMULATE_KEYS_KEY = exports.ESCALATION_ACCUMULATE_MAX_KEY = exports.ESCALATION_ACCUMULATE_COUNT_KEY = exports.ESCALATION_FILLED_BY_KEY = exports.ESCALATION_FILLED_AT_KEY = exports.ESCALATION_FILLED_KEY = exports.ESCALATION_BATCH_WAKE_ON_FILL_KEY = exports.ESCALATION_FLAGS_KEY = exports.ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH = exports.ESCALATION_BATCH_WAKE_ON_FLAG_KEY = exports.ESCALATION_BATCH_FLAGS_KEY = exports.ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH = exports.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY = exports.ESCALATION_BATCH_FILLED_BY_KEY = exports.ESCALATION_BATCH_FILLED_AT_KEY = exports.ESCALATION_BATCH_ITEMS_KEY = exports.ESCALATION_BATCH_KEYS_KEY = exports.ESCALATION_BATCH_COUNT_KEY = exports.ESCALATION_BATCH_PENDING_KEY = exports.foldEscalationConfig = exports.assertAccumulateItemKey = exports.foldAccumulateConfig = exports.foldBatchConfig = exports.ESCALATION_RESOLUTION_KEY = exports.EscalationClientService = exports.Escalations = void 0;
|
|
4
4
|
const utils_1 = require("../../modules/utils");
|
|
5
5
|
const client_1 = require("./client");
|
|
6
6
|
Object.defineProperty(exports, "EscalationClientService", { enumerable: true, get: function () { return client_1.EscalationClientService; } });
|
|
@@ -91,6 +91,10 @@ Object.defineProperty(exports, "ESCALATION_BATCH_FLAGS_KEY", { enumerable: true,
|
|
|
91
91
|
Object.defineProperty(exports, "ESCALATION_BATCH_WAKE_ON_FLAG_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_WAKE_ON_FLAG_KEY; } });
|
|
92
92
|
Object.defineProperty(exports, "ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH; } });
|
|
93
93
|
Object.defineProperty(exports, "ESCALATION_FLAGS_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_FLAGS_KEY; } });
|
|
94
|
+
Object.defineProperty(exports, "ESCALATION_BATCH_WAKE_ON_FILL_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_WAKE_ON_FILL_KEY; } });
|
|
95
|
+
Object.defineProperty(exports, "ESCALATION_FILLED_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_FILLED_KEY; } });
|
|
96
|
+
Object.defineProperty(exports, "ESCALATION_FILLED_AT_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_FILLED_AT_KEY; } });
|
|
97
|
+
Object.defineProperty(exports, "ESCALATION_FILLED_BY_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_FILLED_BY_KEY; } });
|
|
94
98
|
Object.defineProperty(exports, "ESCALATION_ACCUMULATE_COUNT_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_COUNT_KEY; } });
|
|
95
99
|
Object.defineProperty(exports, "ESCALATION_ACCUMULATE_MAX_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_MAX_KEY; } });
|
|
96
100
|
Object.defineProperty(exports, "ESCALATION_ACCUMULATE_KEYS_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_KEYS_KEY; } });
|
|
@@ -2170,6 +2170,13 @@ class PostgresStoreService extends __1.StoreService {
|
|
|
2170
2170
|
*/
|
|
2171
2171
|
_batchItemStatement(targetCTE, itemKeyIdx, payloadIdx, metaIdx, claimIdx, actorIdx, wakeCTE, wakeCount) {
|
|
2172
2172
|
const remaining = `jsonb_array_length((e.metadata->'batch_pending') - $${itemKeyIdx}::text)`;
|
|
2173
|
+
// a wakeOnFill row resolves on this fill: every key (true) or a listed key
|
|
2174
|
+
const wakes = `(target.wake_on_fill = 'true'::jsonb
|
|
2175
|
+
OR (jsonb_typeof(target.wake_on_fill) = 'array'
|
|
2176
|
+
AND target.wake_on_fill ? $${itemKeyIdx}::text))`;
|
|
2177
|
+
const resolves = `(${remaining} = 0 OR ${wakes})`;
|
|
2178
|
+
const collected = `COALESCE(e.envelope->'batch_items', '{}'::jsonb)
|
|
2179
|
+
|| jsonb_build_object($${itemKeyIdx}::text, $${payloadIdx}::jsonb)`;
|
|
2173
2180
|
return `
|
|
2174
2181
|
WITH target AS MATERIALIZED (${targetCTE}),
|
|
2175
2182
|
filled AS (
|
|
@@ -2193,11 +2200,28 @@ class PostgresStoreService extends __1.StoreService {
|
|
|
2193
2200
|
|| jsonb_build_object(
|
|
2194
2201
|
'batch_pending', (e.metadata->'batch_pending') - $${itemKeyIdx}::text,
|
|
2195
2202
|
'batch_count', ${remaining}),
|
|
2196
|
-
status = CASE WHEN ${
|
|
2197
|
-
resolved_at = CASE WHEN ${
|
|
2203
|
+
status = CASE WHEN ${resolves} THEN 'resolved' ELSE e.status END,
|
|
2204
|
+
resolved_at = CASE WHEN ${resolves} THEN NOW() ELSE e.resolved_at END,
|
|
2198
2205
|
resolver_payload = CASE WHEN ${remaining} = 0
|
|
2199
|
-
THEN
|
|
2200
|
-
|
|
2206
|
+
THEN ${collected}
|
|
2207
|
+
WHEN ${wakes}
|
|
2208
|
+
THEN ${collected}
|
|
2209
|
+
|| jsonb_build_object(
|
|
2210
|
+
'$filled', jsonb_build_array($${itemKeyIdx}::text),
|
|
2211
|
+
'$trigger', 'fill',
|
|
2212
|
+
'$filledAt',
|
|
2213
|
+
COALESCE(e.envelope->'batch_filled_at', '{}'::jsonb)
|
|
2214
|
+
|| jsonb_build_object($${itemKeyIdx}::text, to_jsonb(NOW())))
|
|
2215
|
+
|| CASE WHEN $${actorIdx}::text IS NULL
|
|
2216
|
+
AND e.envelope->'batch_filled_by' IS NULL
|
|
2217
|
+
THEN '{}'::jsonb
|
|
2218
|
+
ELSE jsonb_build_object(
|
|
2219
|
+
'$filledBy',
|
|
2220
|
+
COALESCE(e.envelope->'batch_filled_by', '{}'::jsonb)
|
|
2221
|
+
|| CASE WHEN $${actorIdx}::text IS NULL THEN '{}'::jsonb
|
|
2222
|
+
ELSE jsonb_build_object($${itemKeyIdx}::text, $${actorIdx}::text)
|
|
2223
|
+
END)
|
|
2224
|
+
END
|
|
2201
2225
|
ELSE e.resolver_payload END,
|
|
2202
2226
|
updated_at = NOW()
|
|
2203
2227
|
FROM target
|
|
@@ -2214,6 +2238,8 @@ class PostgresStoreService extends __1.StoreService {
|
|
|
2214
2238
|
)${wakeCTE}
|
|
2215
2239
|
SELECT t.id, t.status AS prior_status, t.signal_key, t.topic, t.assigned_to,
|
|
2216
2240
|
CASE
|
|
2241
|
+
WHEN f.id IS NOT NULL AND f.status = 'resolved'
|
|
2242
|
+
AND jsonb_array_length(f.metadata->'batch_pending') > 0 THEN 'woke'
|
|
2217
2243
|
WHEN f.id IS NOT NULL AND f.status = 'resolved' THEN 'completed'
|
|
2218
2244
|
WHEN f.id IS NOT NULL THEN 'accepted'
|
|
2219
2245
|
WHEN t.id IS NULL THEN 'not-found'
|
|
@@ -2238,7 +2264,9 @@ class PostgresStoreService extends __1.StoreService {
|
|
|
2238
2264
|
_mapBatchItemRow(row, assertClaim) {
|
|
2239
2265
|
if (!row || row.outcome === 'not-found')
|
|
2240
2266
|
return { ok: false, outcome: 'not-found' };
|
|
2241
|
-
if (row.outcome === 'completed' ||
|
|
2267
|
+
if (row.outcome === 'completed' ||
|
|
2268
|
+
row.outcome === 'accepted' ||
|
|
2269
|
+
row.outcome === 'woke') {
|
|
2242
2270
|
return {
|
|
2243
2271
|
ok: true,
|
|
2244
2272
|
outcome: row.outcome,
|
|
@@ -2293,7 +2321,8 @@ class PostgresStoreService extends __1.StoreService {
|
|
|
2293
2321
|
const targetCTE = `
|
|
2294
2322
|
SELECT id, signal_key, topic, status, assigned_to, assigned_until,
|
|
2295
2323
|
metadata->'batch_keys' AS batch_keys,
|
|
2296
|
-
metadata->'batch_pending' AS batch_pending
|
|
2324
|
+
metadata->'batch_pending' AS batch_pending,
|
|
2325
|
+
envelope->'batch_wake_on_fill' AS wake_on_fill
|
|
2297
2326
|
FROM public.hmsh_escalations
|
|
2298
2327
|
WHERE ${id ? 'id' : 'signal_key'} = $1${nsClause}
|
|
2299
2328
|
LIMIT 1 FOR UPDATE`;
|
|
@@ -2327,7 +2356,8 @@ class PostgresStoreService extends __1.StoreService {
|
|
|
2327
2356
|
const targetCTE = `
|
|
2328
2357
|
SELECT id, signal_key, topic, status, assigned_to, assigned_until,
|
|
2329
2358
|
metadata->'batch_keys' AS batch_keys,
|
|
2330
|
-
metadata->'batch_pending' AS batch_pending
|
|
2359
|
+
metadata->'batch_pending' AS batch_pending,
|
|
2360
|
+
envelope->'batch_wake_on_fill' AS wake_on_fill
|
|
2331
2361
|
FROM public.hmsh_escalations
|
|
2332
2362
|
WHERE ${nsClause}
|
|
2333
2363
|
metadata @> $1::jsonb
|
|
@@ -43,6 +43,19 @@ export interface ConditionQueueConfig {
|
|
|
43
43
|
* recorded on the row and the wait continues.
|
|
44
44
|
*/
|
|
45
45
|
wakeOnFlag?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* With `batch`, a `resolveBatchItem()` fill ends the wait: the row
|
|
48
|
+
* resolves and the wait resumes with the items filled so far, the key
|
|
49
|
+
* that woke it (`$filled: [itemKey]`), `$trigger: 'fill'`, each filled
|
|
50
|
+
* key's fill time (`$filledAt`) and recorded actor (`$filledBy`). `true`
|
|
51
|
+
* wakes on every fill; a list of declared keys wakes only when one of
|
|
52
|
+
* those keys fills. The last fill completes the wait as on any batch.
|
|
53
|
+
* Pair with `filled` to park the next round with the items carried
|
|
54
|
+
* forward: `$filledAt` and `$filledBy` supply each entry's `at` and
|
|
55
|
+
* `actor`. Off by default: a fill is then recorded on the row and the
|
|
56
|
+
* wait continues until the last key.
|
|
57
|
+
*/
|
|
58
|
+
wakeOnFill?: boolean | string[];
|
|
46
59
|
/**
|
|
47
60
|
* With `batch`, entries already satisfied when the row is created (for
|
|
48
61
|
* example, received before the wait began). Each key must be declared in
|
|
@@ -365,6 +378,8 @@ export interface CreateEscalationParams {
|
|
|
365
378
|
partialOnTimeout?: boolean;
|
|
366
379
|
/** See {@link ConditionQueueConfig.wakeOnFlag}. */
|
|
367
380
|
wakeOnFlag?: boolean;
|
|
381
|
+
/** See {@link ConditionQueueConfig.wakeOnFill}. */
|
|
382
|
+
wakeOnFill?: boolean | string[];
|
|
368
383
|
/** See {@link ConditionQueueConfig.filled}. */
|
|
369
384
|
filled?: Record<string, BatchFilledEntry>;
|
|
370
385
|
/**
|
|
@@ -528,6 +543,22 @@ export declare const ESCALATION_BATCH_WAKE_ON_FLAG_KEY = "batch_wake_on_flag";
|
|
|
528
543
|
/** Reserved signal-payload key: the flags delivered when a flag ends the
|
|
529
544
|
* wait (`wakeOnFlag`). */
|
|
530
545
|
export declare const ESCALATION_FLAGS_KEY = "$flags";
|
|
546
|
+
/** Envelope key: set by `wakeOnFill` on a batch row (`true`, or the list of
|
|
547
|
+
* keys that wake) so the fill statement resolves the row and wakes the
|
|
548
|
+
* waiter. */
|
|
549
|
+
export declare const ESCALATION_BATCH_WAKE_ON_FILL_KEY = "batch_wake_on_fill";
|
|
550
|
+
/** Reserved signal-payload key: the item key whose fill ended the wait
|
|
551
|
+
* (`wakeOnFill`), as a one-element array. */
|
|
552
|
+
export declare const ESCALATION_FILLED_KEY = "$filled";
|
|
553
|
+
/** Reserved signal-payload key: when a fill ends the wait (`wakeOnFill`),
|
|
554
|
+
* the database-clock fill time of every filled key
|
|
555
|
+
* (`Record<itemKey, ISO-8601>`), the source of record for `filled[key].at`
|
|
556
|
+
* when the workflow parks its next round. */
|
|
557
|
+
export declare const ESCALATION_FILLED_AT_KEY = "$filledAt";
|
|
558
|
+
/** Reserved signal-payload key: when a fill ends the wait (`wakeOnFill`),
|
|
559
|
+
* the recorded actor of every filled key that has one
|
|
560
|
+
* (`Record<itemKey, actor>`). Present when at least one fill named an actor. */
|
|
561
|
+
export declare const ESCALATION_FILLED_BY_KEY = "$filledBy";
|
|
531
562
|
/** Flag labels are non-empty strings up to this length. */
|
|
532
563
|
export declare const ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH = 128;
|
|
533
564
|
/** Metadata facet: number of items currently held. Recomputed from
|
|
@@ -550,7 +581,8 @@ export declare const ESCALATION_ACCUMULATE_CONFIG_KEY = "accumulate_config";
|
|
|
550
581
|
* waiter of an accumulator row. */
|
|
551
582
|
export declare const ESCALATION_ACCUMULATED_KEY = "$accumulated";
|
|
552
583
|
/** Reserved signal-payload key: which terminal path delivered the
|
|
553
|
-
* collection (`count` | `timeout` | `resolve`; `flag` on a batch
|
|
584
|
+
* collection (`count` | `timeout` | `resolve`; `flag` or `fill` on a batch
|
|
585
|
+
* row). */
|
|
554
586
|
export declare const ESCALATION_TRIGGER_KEY = "$trigger";
|
|
555
587
|
export interface AccumulateConfig {
|
|
556
588
|
/** Count trigger. Absent means unbounded: only `timeout` or a manual
|
|
@@ -737,12 +769,15 @@ export interface ExpireEscalationResult {
|
|
|
737
769
|
* - `completed` — this was the LAST item: the row resolved and the waiting
|
|
738
770
|
* workflow was woken with the full collection, in the same statement.
|
|
739
771
|
* - `accepted` — interim fill: the item landed, the row stays `pending`.
|
|
772
|
+
* - `woke` — the item landed and the row resolved before every key was
|
|
773
|
+
* filled, because its wait declared `wakeOnFill` for this key: the waiter
|
|
774
|
+
* woke with the items filled so far, `$filled`, and `$trigger: 'fill'`.
|
|
740
775
|
* - `duplicate-item` — the key was declared but already filled.
|
|
741
776
|
* - `unknown-item` — the key was never declared in `batch_keys`.
|
|
742
777
|
* - `not-batch` — the row carries no batch declaration.
|
|
743
778
|
* - Remaining values match {@link ResolveEscalationResult} semantics.
|
|
744
779
|
*/
|
|
745
|
-
export type BatchItemOutcome = 'completed' | 'accepted' | 'duplicate-item' | 'unknown-item' | 'not-batch' | 'not-found' | 'already-resolved' | 'already-cancelled' | 'already-expired' | 'claim-expired' | 'claimed-by-other';
|
|
780
|
+
export type BatchItemOutcome = 'completed' | 'accepted' | 'woke' | 'duplicate-item' | 'unknown-item' | 'not-batch' | 'not-found' | 'already-resolved' | 'already-cancelled' | 'already-expired' | 'claim-expired' | 'claimed-by-other';
|
|
746
781
|
export interface ResolveBatchItemParams {
|
|
747
782
|
/** Row selector — exactly one of `id` | `signalKey`. */
|
|
748
783
|
id?: string;
|
|
@@ -764,8 +799,9 @@ export interface ResolveBatchItemParams {
|
|
|
764
799
|
/** Recorded under `envelope.batch_filled_by[itemKey]` in the same
|
|
765
800
|
* statement as the fill. */
|
|
766
801
|
actor?: string;
|
|
767
|
-
/** Resolver identity. Delivered under `$resolution`
|
|
768
|
-
* item's
|
|
802
|
+
/** Resolver identity. Delivered under `$resolution` on the signal that
|
|
803
|
+
* ends the wait: the completing item's, or a `wakeOnFill` fill's. See
|
|
804
|
+
* {@link ResolveEscalationParams.resolvedBy}. */
|
|
769
805
|
resolvedBy?: ResolvedByIdentity;
|
|
770
806
|
}
|
|
771
807
|
export interface ResolveBatchItemByMetadataParams {
|
|
@@ -790,12 +826,12 @@ export interface ResolveBatchItemByMetadataParams {
|
|
|
790
826
|
*/
|
|
791
827
|
export type ResolveBatchItemResult = {
|
|
792
828
|
ok: true;
|
|
793
|
-
outcome: 'completed' | 'accepted';
|
|
829
|
+
outcome: 'completed' | 'accepted' | 'woke';
|
|
794
830
|
remaining: number;
|
|
795
831
|
entry: EscalationEntry;
|
|
796
832
|
} | {
|
|
797
833
|
ok: false;
|
|
798
|
-
outcome: Exclude<BatchItemOutcome, 'completed' | 'accepted'>;
|
|
834
|
+
outcome: Exclude<BatchItemOutcome, 'completed' | 'accepted' | 'woke'>;
|
|
799
835
|
};
|
|
800
836
|
/** One flag on a batch item, stored under `envelope.batch_flags[itemKey]`. */
|
|
801
837
|
export interface BatchItemFlag {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ESCALATION_TRIGGER_KEY = exports.ESCALATION_ACCUMULATED_KEY = exports.ESCALATION_ACCUMULATE_CONFIG_KEY = exports.ESCALATION_ACCUMULATE_ITEMS_KEY = exports.ESCALATION_ACCUMULATE_KEYS_KEY = exports.ESCALATION_ACCUMULATE_MAX_KEY = exports.ESCALATION_ACCUMULATE_COUNT_KEY = exports.ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH = exports.ESCALATION_FLAGS_KEY = exports.ESCALATION_BATCH_WAKE_ON_FLAG_KEY = exports.ESCALATION_BATCH_FLAGS_KEY = exports.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY = exports.ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH = exports.ESCALATION_BATCH_FILLED_BY_KEY = exports.ESCALATION_BATCH_FILLED_AT_KEY = exports.ESCALATION_BATCH_ITEMS_KEY = exports.ESCALATION_BATCH_KEYS_KEY = exports.ESCALATION_BATCH_COUNT_KEY = exports.ESCALATION_BATCH_PENDING_KEY = void 0;
|
|
3
|
+
exports.ESCALATION_TRIGGER_KEY = exports.ESCALATION_ACCUMULATED_KEY = exports.ESCALATION_ACCUMULATE_CONFIG_KEY = exports.ESCALATION_ACCUMULATE_ITEMS_KEY = exports.ESCALATION_ACCUMULATE_KEYS_KEY = exports.ESCALATION_ACCUMULATE_MAX_KEY = exports.ESCALATION_ACCUMULATE_COUNT_KEY = exports.ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH = exports.ESCALATION_FILLED_BY_KEY = exports.ESCALATION_FILLED_AT_KEY = exports.ESCALATION_FILLED_KEY = exports.ESCALATION_BATCH_WAKE_ON_FILL_KEY = exports.ESCALATION_FLAGS_KEY = exports.ESCALATION_BATCH_WAKE_ON_FLAG_KEY = exports.ESCALATION_BATCH_FLAGS_KEY = exports.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY = exports.ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH = exports.ESCALATION_BATCH_FILLED_BY_KEY = exports.ESCALATION_BATCH_FILLED_AT_KEY = exports.ESCALATION_BATCH_ITEMS_KEY = exports.ESCALATION_BATCH_KEYS_KEY = exports.ESCALATION_BATCH_COUNT_KEY = exports.ESCALATION_BATCH_PENDING_KEY = void 0;
|
|
4
4
|
// ─── Batch accumulation ───────────────────────────────────────────────────────
|
|
5
5
|
/** Metadata facet: item keys still awaiting submission (jsonb string array).
|
|
6
6
|
* `metadata @> '{"batch_pending":["x"]}'` finds rows still missing item `x`. */
|
|
@@ -40,6 +40,22 @@ exports.ESCALATION_BATCH_WAKE_ON_FLAG_KEY = 'batch_wake_on_flag';
|
|
|
40
40
|
/** Reserved signal-payload key: the flags delivered when a flag ends the
|
|
41
41
|
* wait (`wakeOnFlag`). */
|
|
42
42
|
exports.ESCALATION_FLAGS_KEY = '$flags';
|
|
43
|
+
/** Envelope key: set by `wakeOnFill` on a batch row (`true`, or the list of
|
|
44
|
+
* keys that wake) so the fill statement resolves the row and wakes the
|
|
45
|
+
* waiter. */
|
|
46
|
+
exports.ESCALATION_BATCH_WAKE_ON_FILL_KEY = 'batch_wake_on_fill';
|
|
47
|
+
/** Reserved signal-payload key: the item key whose fill ended the wait
|
|
48
|
+
* (`wakeOnFill`), as a one-element array. */
|
|
49
|
+
exports.ESCALATION_FILLED_KEY = '$filled';
|
|
50
|
+
/** Reserved signal-payload key: when a fill ends the wait (`wakeOnFill`),
|
|
51
|
+
* the database-clock fill time of every filled key
|
|
52
|
+
* (`Record<itemKey, ISO-8601>`), the source of record for `filled[key].at`
|
|
53
|
+
* when the workflow parks its next round. */
|
|
54
|
+
exports.ESCALATION_FILLED_AT_KEY = '$filledAt';
|
|
55
|
+
/** Reserved signal-payload key: when a fill ends the wait (`wakeOnFill`),
|
|
56
|
+
* the recorded actor of every filled key that has one
|
|
57
|
+
* (`Record<itemKey, actor>`). Present when at least one fill named an actor. */
|
|
58
|
+
exports.ESCALATION_FILLED_BY_KEY = '$filledBy';
|
|
43
59
|
/** Flag labels are non-empty strings up to this length. */
|
|
44
60
|
exports.ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH = 128;
|
|
45
61
|
// ─── Open accumulation ────────────────────────────────────────────────────────
|
|
@@ -63,5 +79,6 @@ exports.ESCALATION_ACCUMULATE_CONFIG_KEY = 'accumulate_config';
|
|
|
63
79
|
* waiter of an accumulator row. */
|
|
64
80
|
exports.ESCALATION_ACCUMULATED_KEY = '$accumulated';
|
|
65
81
|
/** Reserved signal-payload key: which terminal path delivered the
|
|
66
|
-
* collection (`count` | `timeout` | `resolve`; `flag` on a batch
|
|
82
|
+
* collection (`count` | `timeout` | `resolve`; `flag` or `fill` on a batch
|
|
83
|
+
* row). */
|
|
67
84
|
exports.ESCALATION_TRIGGER_KEY = '$trigger';
|
package/build/types/index.d.ts
CHANGED
|
@@ -25,5 +25,5 @@ export { ReclaimedMessageType, RetryPolicy, RouterConfig, StreamCode, StreamConf
|
|
|
25
25
|
export { context, Context, Counter, Meter, metrics, propagation, SpanContext, Span, SpanStatus, SpanStatusCode, SpanKind, trace, Tracer, ValueType, } from './telemetry';
|
|
26
26
|
export { WorkListTaskType } from './task';
|
|
27
27
|
export { TransitionMatch, TransitionRule, Transitions } from './transition';
|
|
28
|
-
export { ConditionQueueConfig, EscalationEntry, ClaimEscalationResult, ClaimByMetadataResult, ReleaseEscalationResult, ResolveEscalationResult, CancelEscalationResult, ListEscalationsParams, CreateEscalationParams, UpdateEscalationParams, AppendMilestonesParams, ClaimEscalationParams, ClaimByMetadataParams, ReleaseEscalationParams, ResolveEscalationParams, ResolveByMetadataParams, ResolveAllOrNoneItem, ResolveAllOrNoneParams, ResolveAllOrNoneBlockReason, ResolveAllOrNoneResult, EscalateToRoleParams, MigrateEscalationParams, EscalationResolution, ResolvedByIdentity, ClaimManyQuerySelector, ClaimManyByQueryParams, BatchItemOutcome, ResolveBatchItemParams, ResolveBatchItemByMetadataParams, ResolveBatchItemResult, ESCALATION_BATCH_PENDING_KEY, ESCALATION_BATCH_COUNT_KEY, ESCALATION_BATCH_KEYS_KEY, ESCALATION_BATCH_ITEMS_KEY, ESCALATION_BATCH_FILLED_AT_KEY, ESCALATION_BATCH_FILLED_BY_KEY, ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY, ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH, ESCALATION_BATCH_FLAGS_KEY, ESCALATION_BATCH_WAKE_ON_FLAG_KEY, ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH, ESCALATION_FLAGS_KEY, BatchItemFlag, FlagBatchItemParams, FlagBatchItemOutcome, FlagBatchItemResult, UnflagBatchItemParams, UnflagBatchItemOutcome, UnflagBatchItemResult, BatchFilledEntry, AccumulateConfig, AccumulatedEntry, AccumulatedItem, AccumulatorTrigger, AccumulatorResult, AccumulateReciprocalSelector, AccumulateItemOutcome, AccumulateItemParams, AccumulateItemByMetadataParams, AccumulateReciprocalResult, AccumulateItemResult, RemoveAccumulatedItemOutcome, RemoveAccumulatedItemParams, RemoveAccumulatedItemByMetadataParams, RemoveAccumulatedItemResult, ExpireEscalationResult, ESCALATION_ACCUMULATE_COUNT_KEY, ESCALATION_ACCUMULATE_MAX_KEY, ESCALATION_ACCUMULATE_KEYS_KEY, ESCALATION_ACCUMULATE_ITEMS_KEY, ESCALATION_ACCUMULATE_CONFIG_KEY, ESCALATION_ACCUMULATED_KEY, ESCALATION_TRIGGER_KEY, } from './hmsh_escalations';
|
|
28
|
+
export { ConditionQueueConfig, EscalationEntry, ClaimEscalationResult, ClaimByMetadataResult, ReleaseEscalationResult, ResolveEscalationResult, CancelEscalationResult, ListEscalationsParams, CreateEscalationParams, UpdateEscalationParams, AppendMilestonesParams, ClaimEscalationParams, ClaimByMetadataParams, ReleaseEscalationParams, ResolveEscalationParams, ResolveByMetadataParams, ResolveAllOrNoneItem, ResolveAllOrNoneParams, ResolveAllOrNoneBlockReason, ResolveAllOrNoneResult, EscalateToRoleParams, MigrateEscalationParams, EscalationResolution, ResolvedByIdentity, ClaimManyQuerySelector, ClaimManyByQueryParams, BatchItemOutcome, ResolveBatchItemParams, ResolveBatchItemByMetadataParams, ResolveBatchItemResult, ESCALATION_BATCH_PENDING_KEY, ESCALATION_BATCH_COUNT_KEY, ESCALATION_BATCH_KEYS_KEY, ESCALATION_BATCH_ITEMS_KEY, ESCALATION_BATCH_FILLED_AT_KEY, ESCALATION_BATCH_FILLED_BY_KEY, ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY, ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH, ESCALATION_BATCH_FLAGS_KEY, ESCALATION_BATCH_WAKE_ON_FLAG_KEY, ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH, ESCALATION_FLAGS_KEY, ESCALATION_BATCH_WAKE_ON_FILL_KEY, ESCALATION_FILLED_KEY, ESCALATION_FILLED_AT_KEY, ESCALATION_FILLED_BY_KEY, BatchItemFlag, FlagBatchItemParams, FlagBatchItemOutcome, FlagBatchItemResult, UnflagBatchItemParams, UnflagBatchItemOutcome, UnflagBatchItemResult, BatchFilledEntry, AccumulateConfig, AccumulatedEntry, AccumulatedItem, AccumulatorTrigger, AccumulatorResult, AccumulateReciprocalSelector, AccumulateItemOutcome, AccumulateItemParams, AccumulateItemByMetadataParams, AccumulateReciprocalResult, AccumulateItemResult, RemoveAccumulatedItemOutcome, RemoveAccumulatedItemParams, RemoveAccumulatedItemByMetadataParams, RemoveAccumulatedItemResult, ExpireEscalationResult, ESCALATION_ACCUMULATE_COUNT_KEY, ESCALATION_ACCUMULATE_MAX_KEY, ESCALATION_ACCUMULATE_KEYS_KEY, ESCALATION_ACCUMULATE_ITEMS_KEY, ESCALATION_ACCUMULATE_CONFIG_KEY, ESCALATION_ACCUMULATED_KEY, ESCALATION_TRIGGER_KEY, } from './hmsh_escalations';
|
|
29
29
|
export { EscalationVerb, EngineVerb, WorkerVerb, SystemEvent, EventsConfig } from './system_events';
|
package/build/types/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ESCALATION_TRIGGER_KEY = exports.ESCALATION_ACCUMULATED_KEY = exports.ESCALATION_ACCUMULATE_CONFIG_KEY = exports.ESCALATION_ACCUMULATE_ITEMS_KEY = exports.ESCALATION_ACCUMULATE_KEYS_KEY = exports.ESCALATION_ACCUMULATE_MAX_KEY = exports.ESCALATION_ACCUMULATE_COUNT_KEY = exports.ESCALATION_FLAGS_KEY = exports.ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH = exports.ESCALATION_BATCH_WAKE_ON_FLAG_KEY = exports.ESCALATION_BATCH_FLAGS_KEY = exports.ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH = exports.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY = exports.ESCALATION_BATCH_FILLED_BY_KEY = exports.ESCALATION_BATCH_FILLED_AT_KEY = exports.ESCALATION_BATCH_ITEMS_KEY = exports.ESCALATION_BATCH_KEYS_KEY = exports.ESCALATION_BATCH_COUNT_KEY = exports.ESCALATION_BATCH_PENDING_KEY = exports.ValueType = exports.trace = exports.SpanKind = exports.SpanStatusCode = exports.propagation = exports.metrics = exports.context = exports.StreamStatus = exports.StreamRole = exports.StreamDataType = exports.KeyType = exports.HookGate = exports.CollationFaultType = void 0;
|
|
3
|
+
exports.ESCALATION_TRIGGER_KEY = exports.ESCALATION_ACCUMULATED_KEY = exports.ESCALATION_ACCUMULATE_CONFIG_KEY = exports.ESCALATION_ACCUMULATE_ITEMS_KEY = exports.ESCALATION_ACCUMULATE_KEYS_KEY = exports.ESCALATION_ACCUMULATE_MAX_KEY = exports.ESCALATION_ACCUMULATE_COUNT_KEY = exports.ESCALATION_FILLED_BY_KEY = exports.ESCALATION_FILLED_AT_KEY = exports.ESCALATION_FILLED_KEY = exports.ESCALATION_BATCH_WAKE_ON_FILL_KEY = exports.ESCALATION_FLAGS_KEY = exports.ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH = exports.ESCALATION_BATCH_WAKE_ON_FLAG_KEY = exports.ESCALATION_BATCH_FLAGS_KEY = exports.ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH = exports.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY = exports.ESCALATION_BATCH_FILLED_BY_KEY = exports.ESCALATION_BATCH_FILLED_AT_KEY = exports.ESCALATION_BATCH_ITEMS_KEY = exports.ESCALATION_BATCH_KEYS_KEY = exports.ESCALATION_BATCH_COUNT_KEY = exports.ESCALATION_BATCH_PENDING_KEY = exports.ValueType = exports.trace = exports.SpanKind = exports.SpanStatusCode = exports.propagation = exports.metrics = exports.context = exports.StreamStatus = exports.StreamRole = exports.StreamDataType = exports.KeyType = exports.HookGate = exports.CollationFaultType = void 0;
|
|
4
4
|
var collator_1 = require("./collator");
|
|
5
5
|
Object.defineProperty(exports, "CollationFaultType", { enumerable: true, get: function () { return collator_1.CollationFaultType; } });
|
|
6
6
|
var hook_1 = require("./hook");
|
|
@@ -32,6 +32,10 @@ Object.defineProperty(exports, "ESCALATION_BATCH_FLAGS_KEY", { enumerable: true,
|
|
|
32
32
|
Object.defineProperty(exports, "ESCALATION_BATCH_WAKE_ON_FLAG_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_WAKE_ON_FLAG_KEY; } });
|
|
33
33
|
Object.defineProperty(exports, "ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_FLAG_LABEL_MAX_LENGTH; } });
|
|
34
34
|
Object.defineProperty(exports, "ESCALATION_FLAGS_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_FLAGS_KEY; } });
|
|
35
|
+
Object.defineProperty(exports, "ESCALATION_BATCH_WAKE_ON_FILL_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_WAKE_ON_FILL_KEY; } });
|
|
36
|
+
Object.defineProperty(exports, "ESCALATION_FILLED_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_FILLED_KEY; } });
|
|
37
|
+
Object.defineProperty(exports, "ESCALATION_FILLED_AT_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_FILLED_AT_KEY; } });
|
|
38
|
+
Object.defineProperty(exports, "ESCALATION_FILLED_BY_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_FILLED_BY_KEY; } });
|
|
35
39
|
Object.defineProperty(exports, "ESCALATION_ACCUMULATE_COUNT_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_COUNT_KEY; } });
|
|
36
40
|
Object.defineProperty(exports, "ESCALATION_ACCUMULATE_MAX_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_MAX_KEY; } });
|
|
37
41
|
Object.defineProperty(exports, "ESCALATION_ACCUMULATE_KEYS_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_KEYS_KEY; } });
|