@hotmeshio/hotmesh 0.22.2 → 0.22.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 +2 -1
- package/build/services/escalations/client.d.ts +50 -12
- package/build/services/escalations/client.js +70 -12
- package/build/services/store/providers/postgres/kvtables.js +153 -6
- package/build/services/store/providers/postgres/postgres.d.ts +10 -16
- package/build/services/store/providers/postgres/postgres.js +271 -202
- package/build/types/hmsh_escalations.d.ts +70 -0
- package/package.json +2 -2
|
@@ -54,6 +54,8 @@ export interface EscalationEntry {
|
|
|
54
54
|
trace_id: string | null;
|
|
55
55
|
span_id: string | null;
|
|
56
56
|
expires_at: Date | null;
|
|
57
|
+
/** Nullable passthrough column — populated when downstream needs task-level context. */
|
|
58
|
+
task_id: string | null;
|
|
57
59
|
created_at: Date;
|
|
58
60
|
updated_at: Date;
|
|
59
61
|
/** Computed by list(): true when the row is claimable (no active assignee or expired claim). */
|
|
@@ -68,6 +70,7 @@ export interface EscalationEntry {
|
|
|
68
70
|
export type ClaimEscalationResult = {
|
|
69
71
|
ok: true;
|
|
70
72
|
entry: EscalationEntry;
|
|
73
|
+
isExtension: boolean;
|
|
71
74
|
} | {
|
|
72
75
|
ok: false;
|
|
73
76
|
reason: 'not-found' | 'conflict';
|
|
@@ -89,12 +92,14 @@ export type ClaimByMetadataResult = {
|
|
|
89
92
|
};
|
|
90
93
|
export type ResolveEscalationResult = {
|
|
91
94
|
ok: true;
|
|
95
|
+
entry: EscalationEntry;
|
|
92
96
|
} | {
|
|
93
97
|
ok: false;
|
|
94
98
|
reason: 'not-found' | 'already-resolved' | 'already-cancelled';
|
|
95
99
|
};
|
|
96
100
|
export type ReleaseEscalationResult = {
|
|
97
101
|
ok: true;
|
|
102
|
+
entry: EscalationEntry;
|
|
98
103
|
} | {
|
|
99
104
|
ok: false;
|
|
100
105
|
reason: 'not-found' | 'wrong-assignee';
|
|
@@ -119,11 +124,51 @@ export interface ListEscalationsParams {
|
|
|
119
124
|
originId?: string;
|
|
120
125
|
/** When true, returns only rows without an active claim. When false, returns only actively claimed rows. */
|
|
121
126
|
available?: boolean;
|
|
127
|
+
/** Exact priority match. */
|
|
128
|
+
priority?: number;
|
|
129
|
+
/** JSONB containment filter — rows whose `metadata` contains all provided keys/values. */
|
|
130
|
+
metadata?: Record<string, unknown>;
|
|
131
|
+
/** Filter by a set of UUIDs. */
|
|
132
|
+
ids?: string[];
|
|
133
|
+
/** Filter by `task_id` column. */
|
|
134
|
+
taskId?: string;
|
|
122
135
|
sortBy?: 'created_at' | 'priority' | 'updated_at';
|
|
123
136
|
sortOrder?: 'asc' | 'desc';
|
|
137
|
+
/**
|
|
138
|
+
* Multi-column sort. When provided, supersedes `sortBy`/`sortOrder`.
|
|
139
|
+
* Columns are applied left to right.
|
|
140
|
+
*/
|
|
141
|
+
orderBy?: Array<{
|
|
142
|
+
column: 'priority' | 'created_at' | 'updated_at' | 'resolved_at' | 'role' | 'type';
|
|
143
|
+
direction: 'asc' | 'desc';
|
|
144
|
+
}>;
|
|
124
145
|
limit?: number;
|
|
125
146
|
offset?: number;
|
|
126
147
|
}
|
|
148
|
+
export interface StatsEscalationsParams {
|
|
149
|
+
namespace?: string;
|
|
150
|
+
/** RBAC scope — when an empty array is provided, all counts are zero. */
|
|
151
|
+
roles?: string[];
|
|
152
|
+
/** Counting window for created/resolved. Default: '24h'. */
|
|
153
|
+
period?: '1h' | '24h' | '7d' | '30d';
|
|
154
|
+
}
|
|
155
|
+
export interface EscalationStats {
|
|
156
|
+
pending: number;
|
|
157
|
+
claimed: number;
|
|
158
|
+
created: number;
|
|
159
|
+
resolved: number;
|
|
160
|
+
by_role: Array<{
|
|
161
|
+
role: string;
|
|
162
|
+
pending: number;
|
|
163
|
+
claimed: number;
|
|
164
|
+
}>;
|
|
165
|
+
by_type: Array<{
|
|
166
|
+
type: string;
|
|
167
|
+
pending: number;
|
|
168
|
+
claimed: number;
|
|
169
|
+
resolved: number;
|
|
170
|
+
}>;
|
|
171
|
+
}
|
|
127
172
|
export interface CreateEscalationParams {
|
|
128
173
|
namespace?: string;
|
|
129
174
|
appId?: string;
|
|
@@ -144,6 +189,7 @@ export interface CreateEscalationParams {
|
|
|
144
189
|
createdBy?: string;
|
|
145
190
|
traceId?: string;
|
|
146
191
|
spanId?: string;
|
|
192
|
+
taskId?: string;
|
|
147
193
|
escalationPayload?: Record<string, unknown>;
|
|
148
194
|
metadata?: Record<string, unknown>;
|
|
149
195
|
envelope?: Record<string, unknown>;
|
|
@@ -161,6 +207,7 @@ export interface UpdateEscalationParams {
|
|
|
161
207
|
description?: string;
|
|
162
208
|
priority?: number;
|
|
163
209
|
role?: string;
|
|
210
|
+
taskId?: string;
|
|
164
211
|
/** Merged into existing metadata (keys overwritten, others preserved) */
|
|
165
212
|
metadata?: Record<string, unknown>;
|
|
166
213
|
/** Replaces existing envelope */
|
|
@@ -195,6 +242,8 @@ export interface ClaimByMetadataParams {
|
|
|
195
242
|
assignee?: string;
|
|
196
243
|
durationMinutes?: number;
|
|
197
244
|
roles?: string[];
|
|
245
|
+
/** Merged (not replaced) into the claimed row's metadata in the same atomic UPDATE. */
|
|
246
|
+
metadata?: Record<string, unknown>;
|
|
198
247
|
}
|
|
199
248
|
export interface ReleaseEscalationParams {
|
|
200
249
|
id: string;
|
|
@@ -219,6 +268,27 @@ export interface EscalateToRoleParams {
|
|
|
219
268
|
targetRole: string;
|
|
220
269
|
namespace?: string;
|
|
221
270
|
}
|
|
271
|
+
export interface ClaimManyParams {
|
|
272
|
+
ids: string[];
|
|
273
|
+
namespace?: string;
|
|
274
|
+
assignee: string;
|
|
275
|
+
durationMinutes?: number;
|
|
276
|
+
}
|
|
277
|
+
export interface EscalateManyToRoleParams {
|
|
278
|
+
ids: string[];
|
|
279
|
+
namespace?: string;
|
|
280
|
+
targetRole: string;
|
|
281
|
+
}
|
|
282
|
+
export interface UpdateManyPriorityParams {
|
|
283
|
+
ids: string[];
|
|
284
|
+
namespace?: string;
|
|
285
|
+
priority: number;
|
|
286
|
+
}
|
|
287
|
+
export interface ResolveManyParams {
|
|
288
|
+
ids: string[];
|
|
289
|
+
namespace?: string;
|
|
290
|
+
resolverPayload?: Record<string, unknown>;
|
|
291
|
+
}
|
|
222
292
|
/**
|
|
223
293
|
* Full-fidelity migration params. Extends `CreateEscalationParams` with:
|
|
224
294
|
* - `id` (required) — preserves the original UUID; no auto-generation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.3",
|
|
4
4
|
"description": "Durable Workflow",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
"test:trigger": "vitest run tests/unit/services/activities/trigger.test.ts",
|
|
87
87
|
"test:virtual": "vitest run tests/virtual",
|
|
88
88
|
"test:unit": "vitest run tests/unit",
|
|
89
|
-
|
|
90
89
|
"prove": "docker compose exec hotmesh npx vitest run tests/durable 2>&1 | tee /tmp/hmsh-durable.txt && grep -E 'FAIL|Tests |Files ' /tmp/hmsh-durable.txt | tail -5",
|
|
91
90
|
"prove:escalations": "docker compose exec hotmesh npx vitest run tests/durable/escalations/postgres.test.ts 2>&1 | tee /tmp/hmsh-escalations.txt && grep -E 'FAIL|Tests |Files ' /tmp/hmsh-escalations.txt | tail -5",
|
|
91
|
+
"prove:migrations": "docker compose exec hotmesh npx vitest run tests/durable/migrations/postgres.test.ts 2>&1 | tee /tmp/hmsh-migrations.txt && grep -E 'FAIL|Tests |Files ' /tmp/hmsh-migrations.txt | tail -5",
|
|
92
92
|
"prove:functional": "docker compose exec hotmesh npx vitest run tests/functional 2>&1 | tee /tmp/hmsh-functional.txt && grep -E 'FAIL|Tests |Files ' /tmp/hmsh-functional.txt | tail -5",
|
|
93
93
|
"prove:all": "docker compose exec hotmesh npx vitest run tests/ 2>&1 | tee /tmp/hmsh-all.txt && grep -E 'FAIL|Tests |Files ' /tmp/hmsh-all.txt | tail -5",
|
|
94
94
|
"prove:file": "f() { docker compose exec hotmesh npx vitest run \"$@\" 2>&1 | tee /tmp/hmsh-file.txt && grep -E 'FAIL|Tests |Files ' /tmp/hmsh-file.txt | tail -5; }; f"
|