@hotmeshio/hotmesh 0.26.2 → 0.26.3
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/escalations/client.d.ts +30 -1
- package/build/services/escalations/client.js +52 -7
- package/build/services/escalations/index.d.ts +1 -0
- package/build/services/escalations/index.js +3 -1
- package/build/services/store/providers/postgres/postgres.d.ts +7 -0
- package/build/services/store/providers/postgres/postgres.js +38 -0
- package/build/types/hmsh_escalations.d.ts +78 -0
- package/build/types/index.d.ts +1 -1
- package/package.json +1 -1
package/build/package.json
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { HotMesh } from '../hotmesh';
|
|
2
2
|
import { EventsConfig } from '../../types/system_events';
|
|
3
3
|
import { Connection } from '../../types/durable';
|
|
4
|
-
import { EscalationEntry, ClaimEscalationResult, ClaimByMetadataResult, ReleaseEscalationResult, ResolveEscalationResult, CancelEscalationResult, ListEscalationsParams, StatsEscalationsParams, EscalationStats, CreateEscalationParams, UpdateEscalationParams, AppendMilestonesParams, ClaimEscalationParams, ClaimByMetadataParams, ReleaseEscalationParams, ResolveEscalationParams, ResolveByMetadataParams, EscalateToRoleParams, MigrateEscalationParams, ClaimManyParams, EscalateManyToRoleParams, UpdateManyPriorityParams, ResolveManyParams, ResolveAllOrNoneParams, ResolveAllOrNoneResult, PruneEscalationsParams, PruneEscalationsResult } from '../../types/hmsh_escalations';
|
|
4
|
+
import { EscalationEntry, ClaimEscalationResult, ClaimByMetadataResult, ReleaseEscalationResult, ResolveEscalationResult, CancelEscalationResult, ListEscalationsParams, StatsEscalationsParams, EscalationStats, CreateEscalationParams, UpdateEscalationParams, AppendMilestonesParams, ClaimEscalationParams, ClaimByMetadataParams, ReleaseEscalationParams, ResolveEscalationParams, ResolveByMetadataParams, EscalateToRoleParams, MigrateEscalationParams, ClaimManyParams, EscalateManyToRoleParams, UpdateManyPriorityParams, ResolveManyParams, ResolveAllOrNoneParams, ResolveAllOrNoneResult, PruneEscalationsParams, PruneEscalationsResult, ClaimManyByQueryParams } from '../../types/hmsh_escalations';
|
|
5
|
+
/**
|
|
6
|
+
* Reserved signal-payload key carrying resolution provenance
|
|
7
|
+
* (`EscalationResolution`) to the waiting workflow. The `$` prefix marks the
|
|
8
|
+
* control-key namespace — consumer payload fields never collide with it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ESCALATION_RESOLUTION_KEY = "$resolution";
|
|
5
11
|
export type GetHotMeshFn = (topic: string | null, namespace?: string) => Promise<HotMesh>;
|
|
6
12
|
export interface EscalationClientConfig {
|
|
7
13
|
/** Postgres connection options — used when creating a standalone EscalationClient. */
|
|
@@ -71,6 +77,17 @@ export declare class EscalationClientService {
|
|
|
71
77
|
private _emitMany;
|
|
72
78
|
private _makeEngineFactory;
|
|
73
79
|
private _hashConnection;
|
|
80
|
+
/**
|
|
81
|
+
* Composes the signal `data` delivered to the waiting workflow. When the
|
|
82
|
+
* resolving caller supplies `resolvedBy`, resolution provenance (escalation
|
|
83
|
+
* id + resolver identity) rides under the reserved `$resolution` key —
|
|
84
|
+
* making the waiter's payload contract deterministic per call site. Without
|
|
85
|
+
* `resolvedBy` the payload passes through byte-identical, so callers that
|
|
86
|
+
* exact-match on payloads are unaffected. The enrichment rides the SIGNAL
|
|
87
|
+
* only — the stored `resolver_payload` column receives the caller's payload
|
|
88
|
+
* untouched.
|
|
89
|
+
*/
|
|
90
|
+
private _signalData;
|
|
74
91
|
private _deliverEscalationSignal;
|
|
75
92
|
/**
|
|
76
93
|
* Builds the wake as a webhook message so the store can commit it
|
|
@@ -207,6 +224,18 @@ export declare class EscalationClientService {
|
|
|
207
224
|
claimed: number;
|
|
208
225
|
skipped: number;
|
|
209
226
|
}>;
|
|
227
|
+
/**
|
|
228
|
+
* Atomic query-form bulk claim: one UPDATE selects and claims every pending,
|
|
229
|
+
* claimable row matching the selector (role/type/priority equality, metadata
|
|
230
|
+
* `@>` containment). Prefer this over `list()` + `claimMany({ids})` when the
|
|
231
|
+
* population is describable by filter — a row that re-parks between a search
|
|
232
|
+
* and an ids-claim is invisible to the ids form but claimed by this one.
|
|
233
|
+
* Returns the claimed rows.
|
|
234
|
+
*/
|
|
235
|
+
claimManyByQuery(params: ClaimManyByQueryParams): Promise<{
|
|
236
|
+
claimed: number;
|
|
237
|
+
entries: EscalationEntry[];
|
|
238
|
+
}>;
|
|
210
239
|
/**
|
|
211
240
|
* Bulk-reassigns pending escalations to a new role, clearing any current claim.
|
|
212
241
|
* Returns the count of rows updated.
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EscalationClientService = void 0;
|
|
3
|
+
exports.EscalationClientService = exports.ESCALATION_RESOLUTION_KEY = void 0;
|
|
4
4
|
const enums_1 = require("../../modules/enums");
|
|
5
5
|
const utils_1 = require("../../modules/utils");
|
|
6
6
|
const hotmesh_1 = require("../hotmesh");
|
|
7
7
|
const types_1 = require("../../types");
|
|
8
8
|
const stream_1 = require("../../types/stream");
|
|
9
9
|
const factory_1 = require("../durable/schemas/factory");
|
|
10
|
+
/**
|
|
11
|
+
* Reserved signal-payload key carrying resolution provenance
|
|
12
|
+
* (`EscalationResolution`) to the waiting workflow. The `$` prefix marks the
|
|
13
|
+
* control-key namespace — consumer payload fields never collide with it.
|
|
14
|
+
*/
|
|
15
|
+
exports.ESCALATION_RESOLUTION_KEY = '$resolution';
|
|
10
16
|
/**
|
|
11
17
|
* Standalone client for the `public.hmsh_escalations` signal-pause surface.
|
|
12
18
|
*
|
|
@@ -122,6 +128,28 @@ class EscalationClientService {
|
|
|
122
128
|
return parts.join('');
|
|
123
129
|
}
|
|
124
130
|
// ─── Signal delivery ───────────────────────────────────────────────────────
|
|
131
|
+
/**
|
|
132
|
+
* Composes the signal `data` delivered to the waiting workflow. When the
|
|
133
|
+
* resolving caller supplies `resolvedBy`, resolution provenance (escalation
|
|
134
|
+
* id + resolver identity) rides under the reserved `$resolution` key —
|
|
135
|
+
* making the waiter's payload contract deterministic per call site. Without
|
|
136
|
+
* `resolvedBy` the payload passes through byte-identical, so callers that
|
|
137
|
+
* exact-match on payloads are unaffected. The enrichment rides the SIGNAL
|
|
138
|
+
* only — the stored `resolver_payload` column receives the caller's payload
|
|
139
|
+
* untouched.
|
|
140
|
+
*/
|
|
141
|
+
_signalData(payload, escalationId, resolvedBy) {
|
|
142
|
+
if (!resolvedBy)
|
|
143
|
+
return payload ?? {};
|
|
144
|
+
return {
|
|
145
|
+
...(payload ?? {}),
|
|
146
|
+
[exports.ESCALATION_RESOLUTION_KEY]: {
|
|
147
|
+
escalationId,
|
|
148
|
+
resolvedBy: resolvedBy.id,
|
|
149
|
+
...(resolvedBy.email ? { resolvedByEmail: resolvedBy.email } : {}),
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
}
|
|
125
153
|
async _deliverEscalationSignal(ns, topic, signalPayload) {
|
|
126
154
|
if (topic) {
|
|
127
155
|
try {
|
|
@@ -365,7 +393,7 @@ class EscalationClientService {
|
|
|
365
393
|
let wakeCommand = null;
|
|
366
394
|
const preview = await store.getEscalation(params.id, params.namespace);
|
|
367
395
|
if (preview?.signal_key) {
|
|
368
|
-
wakeCommand = await this._buildWakeCommand(ns, preview.topic, preview.signal_key, params.resolverPayload
|
|
396
|
+
wakeCommand = await this._buildWakeCommand(ns, preview.topic, preview.signal_key, this._signalData(params.resolverPayload, params.id, params.resolvedBy));
|
|
369
397
|
}
|
|
370
398
|
const dbResult = await store.resolveEscalation({ id: params.id, resolverPayload: params.resolverPayload, metadata: params.metadata, assertClaim: params.assertClaim }, wakeCommand ?? undefined);
|
|
371
399
|
if (!dbResult.ok)
|
|
@@ -375,7 +403,7 @@ class EscalationClientService {
|
|
|
375
403
|
//enqueue was rolled back to its savepoint) — deliver post-commit
|
|
376
404
|
await this._deliverEscalationSignal(ns, dbResult.topic, {
|
|
377
405
|
id: dbResult.signalKey,
|
|
378
|
-
data: params.resolverPayload
|
|
406
|
+
data: this._signalData(params.resolverPayload, params.id, params.resolvedBy),
|
|
379
407
|
});
|
|
380
408
|
}
|
|
381
409
|
this._emit('resolved', dbResult.entry);
|
|
@@ -403,7 +431,10 @@ class EscalationClientService {
|
|
|
403
431
|
namespace: params.namespace,
|
|
404
432
|
});
|
|
405
433
|
if (preview?.signalKey) {
|
|
406
|
-
|
|
434
|
+
//the wake embeds the previewed row's id; forSignalKey pins it to that
|
|
435
|
+
//row, so a different row winning the race falls through to post-commit
|
|
436
|
+
//delivery where the winner's own id is used
|
|
437
|
+
wakeCommand = await this._buildWakeCommand(ns, preview.topic, preview.signalKey, this._signalData(params.resolverPayload, preview.id, params.resolvedBy));
|
|
407
438
|
}
|
|
408
439
|
const dbResult = await store.resolveEscalationByMetadata({ key: params.key, value: params.value, resolverPayload: params.resolverPayload, roles: params.roles, metadata: params.metadata }, wakeCommand ?? undefined);
|
|
409
440
|
if (!dbResult.ok)
|
|
@@ -411,7 +442,7 @@ class EscalationClientService {
|
|
|
411
442
|
if (dbResult.signalKey && !dbResult.wakeEnqueued) {
|
|
412
443
|
await this._deliverEscalationSignal(ns, dbResult.topic, {
|
|
413
444
|
id: dbResult.signalKey,
|
|
414
|
-
data: params.resolverPayload
|
|
445
|
+
data: this._signalData(params.resolverPayload, dbResult.entry.id, params.resolvedBy),
|
|
415
446
|
});
|
|
416
447
|
}
|
|
417
448
|
this._emit('resolved', dbResult.entry);
|
|
@@ -446,6 +477,20 @@ class EscalationClientService {
|
|
|
446
477
|
this._emitMany('claimed', entries);
|
|
447
478
|
return { claimed: entries.length, skipped };
|
|
448
479
|
}
|
|
480
|
+
/**
|
|
481
|
+
* Atomic query-form bulk claim: one UPDATE selects and claims every pending,
|
|
482
|
+
* claimable row matching the selector (role/type/priority equality, metadata
|
|
483
|
+
* `@>` containment). Prefer this over `list()` + `claimMany({ids})` when the
|
|
484
|
+
* population is describable by filter — a row that re-parks between a search
|
|
485
|
+
* and an ids-claim is invisible to the ids form but claimed by this one.
|
|
486
|
+
* Returns the claimed rows.
|
|
487
|
+
*/
|
|
488
|
+
async claimManyByQuery(params) {
|
|
489
|
+
const hm = await this._engine(null, params.namespace);
|
|
490
|
+
const entries = await hm.engine.store.claimManyEscalationsByQuery(params);
|
|
491
|
+
this._emitMany('claimed', entries);
|
|
492
|
+
return { claimed: entries.length, entries };
|
|
493
|
+
}
|
|
449
494
|
/**
|
|
450
495
|
* Bulk-reassigns pending escalations to a new role, clearing any current claim.
|
|
451
496
|
* Returns the count of rows updated.
|
|
@@ -524,7 +569,7 @@ class EscalationClientService {
|
|
|
524
569
|
for (const row of previews) {
|
|
525
570
|
if (!row.signal_key)
|
|
526
571
|
continue;
|
|
527
|
-
const cmd = await this._buildWakeCommand(ns, row.topic, row.signal_key, payloadById.get(row.id)
|
|
572
|
+
const cmd = await this._buildWakeCommand(ns, row.topic, row.signal_key, this._signalData(payloadById.get(row.id), row.id, params.resolvedBy));
|
|
528
573
|
if (cmd)
|
|
529
574
|
wakeCommands.push(cmd);
|
|
530
575
|
}
|
|
@@ -543,7 +588,7 @@ class EscalationClientService {
|
|
|
543
588
|
if (entry.signal_key && !enqueuedKeys.has(entry.signal_key)) {
|
|
544
589
|
await this._deliverEscalationSignal(ns, entry.topic, {
|
|
545
590
|
id: entry.signal_key,
|
|
546
|
-
data: payloadById.get(entry.id)
|
|
591
|
+
data: this._signalData(payloadById.get(entry.id), entry.id, params.resolvedBy),
|
|
547
592
|
});
|
|
548
593
|
}
|
|
549
594
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EscalationClientService = exports.Escalations = void 0;
|
|
3
|
+
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; } });
|
|
@@ -69,3 +69,5 @@ EscalationsClass.guid = utils_1.guid;
|
|
|
69
69
|
* when calling `client.migrate()` or any direct UUID column insert.
|
|
70
70
|
*/
|
|
71
71
|
EscalationsClass.uuid = utils_1.uuid;
|
|
72
|
+
var client_2 = require("./client");
|
|
73
|
+
Object.defineProperty(exports, "ESCALATION_RESOLUTION_KEY", { enumerable: true, get: function () { return client_2.ESCALATION_RESOLUTION_KEY; } });
|
|
@@ -325,6 +325,13 @@ declare class PostgresStoreService extends StoreService<ProviderClient, Provider
|
|
|
325
325
|
entries: import('../../../../types/hmsh_escalations').EscalationEntry[];
|
|
326
326
|
skipped: number;
|
|
327
327
|
}>;
|
|
328
|
+
/**
|
|
329
|
+
* Atomic query-form bulk claim: the selector composes into the UPDATE's own
|
|
330
|
+
* WHERE via `_escalationFilterConditions`, so selection and claim are one
|
|
331
|
+
* statement — no SELECT-then-claim window. `status='pending'` and the
|
|
332
|
+
* claimability guard are forced regardless of the selector.
|
|
333
|
+
*/
|
|
334
|
+
claimManyEscalationsByQuery(params: import('../../../../types/hmsh_escalations').ClaimManyByQueryParams): Promise<import('../../../../types/hmsh_escalations').EscalationEntry[]>;
|
|
328
335
|
escalateManyEscalationsToRole(params: import('../../../../types/hmsh_escalations').EscalateManyToRoleParams): Promise<number>;
|
|
329
336
|
updateManyEscalationsPriority(params: import('../../../../types/hmsh_escalations').UpdateManyPriorityParams): Promise<number>;
|
|
330
337
|
resolveManyEscalations(params: import('../../../../types/hmsh_escalations').ResolveManyParams): Promise<import('../../../../types/hmsh_escalations').EscalationEntry[]>;
|
|
@@ -2203,6 +2203,44 @@ class PostgresStoreService extends __1.StoreService {
|
|
|
2203
2203
|
const entries = result.rows;
|
|
2204
2204
|
return { entries, skipped: ids.length - entries.length };
|
|
2205
2205
|
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Atomic query-form bulk claim: the selector composes into the UPDATE's own
|
|
2208
|
+
* WHERE via `_escalationFilterConditions`, so selection and claim are one
|
|
2209
|
+
* statement — no SELECT-then-claim window. `status='pending'` and the
|
|
2210
|
+
* claimability guard are forced regardless of the selector.
|
|
2211
|
+
*/
|
|
2212
|
+
async claimManyEscalationsByQuery(params) {
|
|
2213
|
+
const { query, namespace, assignee, durationMinutes = 1 } = params;
|
|
2214
|
+
const selectorIsEmpty = !query.role && !query.roles?.length && !query.type && !query.subtype &&
|
|
2215
|
+
!query.entity && query.priority === undefined &&
|
|
2216
|
+
!(query.metadata && Object.keys(query.metadata).length);
|
|
2217
|
+
if (selectorIsEmpty) {
|
|
2218
|
+
throw new Error('claimManyEscalationsByQuery: empty selector — an unbounded bulk claim is not allowed');
|
|
2219
|
+
}
|
|
2220
|
+
const { conditions, values, idx } = this._escalationFilterConditions({
|
|
2221
|
+
namespace,
|
|
2222
|
+
role: query.role,
|
|
2223
|
+
roles: query.roles,
|
|
2224
|
+
type: query.type,
|
|
2225
|
+
subtype: query.subtype,
|
|
2226
|
+
entity: query.entity,
|
|
2227
|
+
priority: query.priority,
|
|
2228
|
+
metadata: query.metadata,
|
|
2229
|
+
}, 1);
|
|
2230
|
+
const assigneeIdx = idx;
|
|
2231
|
+
const durationIdx = idx + 1;
|
|
2232
|
+
const result = await this.pgClient.query(`UPDATE public.hmsh_escalations
|
|
2233
|
+
SET assigned_to = $${assigneeIdx},
|
|
2234
|
+
claimed_at = NOW(),
|
|
2235
|
+
claim_expires_at = NOW() + ($${durationIdx} * INTERVAL '1 minute'),
|
|
2236
|
+
assigned_until = NOW() + ($${durationIdx} * INTERVAL '1 minute'),
|
|
2237
|
+
updated_at = NOW()
|
|
2238
|
+
WHERE ${conditions.join(' AND ')}
|
|
2239
|
+
AND status = 'pending'
|
|
2240
|
+
AND (assigned_to IS NULL OR assigned_until IS NULL OR assigned_until <= NOW() OR assigned_to = $${assigneeIdx})
|
|
2241
|
+
RETURNING *`, [...values, assignee, durationMinutes]);
|
|
2242
|
+
return result.rows;
|
|
2243
|
+
}
|
|
2206
2244
|
async escalateManyEscalationsToRole(params) {
|
|
2207
2245
|
const { ids, namespace, targetRole } = params;
|
|
2208
2246
|
const result = await this.pgClient.query(`UPDATE public.hmsh_escalations
|
|
@@ -117,6 +117,43 @@ export interface EscalationWakeCommand {
|
|
|
117
117
|
forSignalKey: string;
|
|
118
118
|
message: string;
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Resolution provenance delivered to the waiting workflow alongside the
|
|
122
|
+
* resolver payload, under the reserved `$resolution` key. Present exactly when
|
|
123
|
+
* the resolving caller supplied `resolvedBy` — without it the signal payload
|
|
124
|
+
* passes through byte-identical, so existing waiters are unaffected. The
|
|
125
|
+
* `$`-prefixed key namespace is reserved for control data riding the signal
|
|
126
|
+
* (like `$escalation_id` on the legacy routing path); consumer payload fields
|
|
127
|
+
* never collide with it. The stored `resolver_payload` row column stays clean —
|
|
128
|
+
* provenance rides the signal only.
|
|
129
|
+
*
|
|
130
|
+
* A waiting workflow declares the key in its `condition()` payload generic:
|
|
131
|
+
*
|
|
132
|
+
* ```typescript
|
|
133
|
+
* const decision = await Durable.workflow.condition<{
|
|
134
|
+
* approved: boolean;
|
|
135
|
+
* $resolution?: EscalationResolution;
|
|
136
|
+
* }>(signalId, config);
|
|
137
|
+
* decision.$resolution?.resolvedBy; // who resolved it
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export interface EscalationResolution {
|
|
141
|
+
/** The id of the escalation row whose resolve delivered this signal. */
|
|
142
|
+
escalationId: string;
|
|
143
|
+
/** Resolver's user id. */
|
|
144
|
+
resolvedBy: string;
|
|
145
|
+
/** Resolver's email — present when supplied alongside the id. */
|
|
146
|
+
resolvedByEmail?: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Resolver identity, supplied by the resolving caller (the API layer that
|
|
150
|
+
* authenticated the human or agent). Delivered to the waiting workflow inside
|
|
151
|
+
* `$resolution`; never written to the stored `resolver_payload`.
|
|
152
|
+
*/
|
|
153
|
+
export interface ResolvedByIdentity {
|
|
154
|
+
id: string;
|
|
155
|
+
email?: string;
|
|
156
|
+
}
|
|
120
157
|
export type ReleaseEscalationResult = {
|
|
121
158
|
ok: true;
|
|
122
159
|
entry: EscalationEntry;
|
|
@@ -319,6 +356,12 @@ export interface ResolveEscalationParams {
|
|
|
319
356
|
* claim-race window for interactive claim-then-resolve flows.
|
|
320
357
|
*/
|
|
321
358
|
assertClaim?: string;
|
|
359
|
+
/**
|
|
360
|
+
* Resolver identity, delivered to the waiting workflow under the reserved
|
|
361
|
+
* `$resolution` signal key (see {@link EscalationResolution}). Never written
|
|
362
|
+
* to the stored `resolver_payload`.
|
|
363
|
+
*/
|
|
364
|
+
resolvedBy?: ResolvedByIdentity;
|
|
322
365
|
}
|
|
323
366
|
export interface ResolveByMetadataParams {
|
|
324
367
|
key: string;
|
|
@@ -332,12 +375,42 @@ export interface ResolveByMetadataParams {
|
|
|
332
375
|
* `key`/`value` selector used to find the row. See {@link ResolveEscalationParams.metadata}.
|
|
333
376
|
*/
|
|
334
377
|
metadata?: Record<string, unknown>;
|
|
378
|
+
/** Resolver identity delivered under `$resolution`. See {@link ResolveEscalationParams.resolvedBy}. */
|
|
379
|
+
resolvedBy?: ResolvedByIdentity;
|
|
335
380
|
}
|
|
336
381
|
export interface EscalateToRoleParams {
|
|
337
382
|
id: string;
|
|
338
383
|
targetRole: string;
|
|
339
384
|
namespace?: string;
|
|
340
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* Query selector for `claimManyByQuery()` — the filterable subset of
|
|
388
|
+
* `ListEscalationsParams` that describes a claimable population. `status` is
|
|
389
|
+
* not accepted: the claim targets pending rows by definition, enforced in SQL.
|
|
390
|
+
*/
|
|
391
|
+
export interface ClaimManyQuerySelector {
|
|
392
|
+
role?: string;
|
|
393
|
+
roles?: string[];
|
|
394
|
+
type?: string;
|
|
395
|
+
subtype?: string;
|
|
396
|
+
entity?: string;
|
|
397
|
+
priority?: number;
|
|
398
|
+
/** GIN-indexed `@>` containment against row metadata — the facet filter. */
|
|
399
|
+
metadata?: Record<string, unknown>;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Atomic query-form bulk claim: one UPDATE selects and claims every matching
|
|
403
|
+
* pending, claimable row — no SELECT-then-claim window. Prefer this over
|
|
404
|
+
* `list()` + `claimMany({ids})` whenever the population is describable by
|
|
405
|
+
* filter: a row that re-parks between a search and an ids-claim is invisible
|
|
406
|
+
* to the ids form but claimed by this one.
|
|
407
|
+
*/
|
|
408
|
+
export interface ClaimManyByQueryParams {
|
|
409
|
+
query: ClaimManyQuerySelector;
|
|
410
|
+
namespace?: string;
|
|
411
|
+
assignee: string;
|
|
412
|
+
durationMinutes?: number;
|
|
413
|
+
}
|
|
341
414
|
export interface ClaimManyParams {
|
|
342
415
|
ids: string[];
|
|
343
416
|
namespace?: string;
|
|
@@ -387,6 +460,11 @@ export interface ResolveAllOrNoneParams {
|
|
|
387
460
|
* principal between the caller's claim and this resolve blocks the batch.
|
|
388
461
|
*/
|
|
389
462
|
assertAssignee?: string;
|
|
463
|
+
/**
|
|
464
|
+
* Resolver identity delivered to EVERY item's waiting workflow under
|
|
465
|
+
* `$resolution` (one resolver per batch). See {@link ResolveEscalationParams.resolvedBy}.
|
|
466
|
+
*/
|
|
467
|
+
resolvedBy?: ResolvedByIdentity;
|
|
390
468
|
}
|
|
391
469
|
/** Why a specific row blocked a `resolveAllOrNone()` batch. */
|
|
392
470
|
export type ResolveAllOrNoneBlockReason = 'not-found' | 'already-resolved' | 'already-cancelled' | 'already-expired' | 'assignee-mismatch';
|
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, } 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, } from './hmsh_escalations';
|
|
29
29
|
export { EscalationVerb, EngineVerb, WorkerVerb, SystemEvent, EventsConfig } from './system_events';
|