@hotmeshio/hotmesh 0.28.0 → 0.29.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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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_PARTIAL_ON_TIMEOUT_KEY = exports.ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH = 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`. */
@@ -11,5 +11,41 @@ exports.ESCALATION_BATCH_COUNT_KEY = 'batch_count';
11
11
  /** Metadata facet: the full declared item-key list, immutable after creation. */
12
12
  exports.ESCALATION_BATCH_KEYS_KEY = 'batch_keys';
13
13
  /** Envelope key: the payload accumulator (`Record<itemKey, payload>`).
14
- * Payloads are plumbing, not facets — they live in the unindexed envelope. */
14
+ * Payloads are plumbing, not facets — they live in the unindexed envelope.
15
+ * Payload keys are caller-owned: the platform will never reserve names
16
+ * inside `batch_items` values. */
15
17
  exports.ESCALATION_BATCH_ITEMS_KEY = 'batch_items';
18
+ /** Envelope key: per-item fill timestamps (`Record<itemKey, iso8601>`),
19
+ * stamped by the DATABASE clock inside the same guarded fill statement —
20
+ * row truth, not caller clocks. The attempt timeline for free. */
21
+ exports.ESCALATION_BATCH_FILLED_AT_KEY = 'batch_filled_at';
22
+ /** Item keys are non-empty strings up to this length. Any characters are
23
+ * accepted (keys are always parameterized and stored as jsonb text); prefer
24
+ * URL/query-friendly names (e.g. `u1-L`) for endpoint ergonomics. */
25
+ exports.ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH = 128;
26
+ /** Envelope key: set by `partialOnTimeout` on a batch row so the expiry
27
+ * statement knows to deliver the filled items with `$trigger: 'timeout'`. */
28
+ exports.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY = 'batch_partial_on_timeout';
29
+ // ─── Open accumulation ────────────────────────────────────────────────────────
30
+ /** Metadata facet: number of items currently held. Recomputed from
31
+ * `accumulate_keys` in every add/remove statement so the two never drift. */
32
+ exports.ESCALATION_ACCUMULATE_COUNT_KEY = 'accumulate_count';
33
+ /** Metadata facet: the count trigger, or `null` when the accumulator is
34
+ * unbounded. `metadata @> '{"accumulate_max": 4}'` finds four-slot rows. */
35
+ exports.ESCALATION_ACCUMULATE_MAX_KEY = 'accumulate_max';
36
+ /** Metadata facet: held item keys (jsonb string array).
37
+ * `metadata @> '{"accumulate_keys":["order-1"]}'` finds the row holding it. */
38
+ exports.ESCALATION_ACCUMULATE_KEYS_KEY = 'accumulate_keys';
39
+ /** Envelope key: the item store, `Record<itemKey, AccumulatedEntry>`. Each
40
+ * entry carries `at` (database clock), optional `payload`, `actor`, and
41
+ * `reciprocalId`. Payloads are plumbing, not facets. */
42
+ exports.ESCALATION_ACCUMULATE_ITEMS_KEY = 'accumulate_items';
43
+ /** Envelope key: the folded declaration (`{ unique, resolveAtMax }`) the
44
+ * add statement reads to decide replacement and completion. */
45
+ exports.ESCALATION_ACCUMULATE_CONFIG_KEY = 'accumulate_config';
46
+ /** Reserved signal-payload key: the ordered collection delivered to the
47
+ * waiter of an accumulator row. */
48
+ exports.ESCALATION_ACCUMULATED_KEY = '$accumulated';
49
+ /** Reserved signal-payload key: which terminal path delivered the
50
+ * collection (`count` | `timeout` | `resolve`). */
51
+ exports.ESCALATION_TRIGGER_KEY = '$trigger';
@@ -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, } 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_PARTIAL_ON_TIMEOUT_KEY, ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH, 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';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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_BATCH_ITEM_KEY_MAX_LENGTH = exports.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_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");
@@ -24,3 +24,13 @@ Object.defineProperty(exports, "ESCALATION_BATCH_PENDING_KEY", { enumerable: tru
24
24
  Object.defineProperty(exports, "ESCALATION_BATCH_COUNT_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_COUNT_KEY; } });
25
25
  Object.defineProperty(exports, "ESCALATION_BATCH_KEYS_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_KEYS_KEY; } });
26
26
  Object.defineProperty(exports, "ESCALATION_BATCH_ITEMS_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_ITEMS_KEY; } });
27
+ Object.defineProperty(exports, "ESCALATION_BATCH_FILLED_AT_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_FILLED_AT_KEY; } });
28
+ Object.defineProperty(exports, "ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_PARTIAL_ON_TIMEOUT_KEY; } });
29
+ Object.defineProperty(exports, "ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_BATCH_ITEM_KEY_MAX_LENGTH; } });
30
+ Object.defineProperty(exports, "ESCALATION_ACCUMULATE_COUNT_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_COUNT_KEY; } });
31
+ Object.defineProperty(exports, "ESCALATION_ACCUMULATE_MAX_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_MAX_KEY; } });
32
+ Object.defineProperty(exports, "ESCALATION_ACCUMULATE_KEYS_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_KEYS_KEY; } });
33
+ Object.defineProperty(exports, "ESCALATION_ACCUMULATE_ITEMS_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_ITEMS_KEY; } });
34
+ Object.defineProperty(exports, "ESCALATION_ACCUMULATE_CONFIG_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATE_CONFIG_KEY; } });
35
+ Object.defineProperty(exports, "ESCALATION_ACCUMULATED_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_ACCUMULATED_KEY; } });
36
+ Object.defineProperty(exports, "ESCALATION_TRIGGER_KEY", { enumerable: true, get: function () { return hmsh_escalations_1.ESCALATION_TRIGGER_KEY; } });
@@ -115,7 +115,7 @@
115
115
  * ```
116
116
  */
117
117
  /** Verbs for escalation lifecycle transitions. */
118
- export type EscalationVerb = 'created' | 'claimed' | 'released' | 'reassigned' | 'resolved' | 'cancelled' | 'batch-item';
118
+ export type EscalationVerb = 'created' | 'claimed' | 'released' | 'reassigned' | 'resolved' | 'cancelled' | 'expired' | 'batch-item' | 'accumulated' | 'removed';
119
119
  /** Verbs for engine lifecycle transitions. */
120
120
  export type EngineVerb = 'started' | 'stopped' | 'deployed';
121
121
  /** Verbs for worker lifecycle transitions. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Durable Workflow",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -52,6 +52,7 @@
52
52
  "test:durable:unknown": "vitest run tests/durable/unknown/postgres.test.ts",
53
53
  "test:durable:escalations": "HMSH_LOGLEVEL=info vitest run tests/durable/escalations",
54
54
  "test:durable:escalations-batch": "HMSH_LOGLEVEL=info vitest run tests/durable/escalations-batch",
55
+ "test:durable:escalations-accumulate": "HMSH_LOGLEVEL=info vitest run tests/durable/escalations-accumulate",
55
56
  "test:durable:exporter": "HMSH_LOGLEVEL=info vitest run tests/durable/exporter",
56
57
  "test:durable:exporter:debug": "EXPORT_DEBUG=1 HMSH_LOGLEVEL=error vitest run tests/durable/basic/postgres.test.ts",
57
58
  "test:durable:codec": "vitest run tests/durable/codec/postgres.test.ts",