stitchkit 0.71.0 → 0.72.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 (57) hide show
  1. package/README.md +1 -1
  2. package/dist/application/admission.d.ts +22 -2
  3. package/dist/application/admission.d.ts.map +1 -1
  4. package/dist/application/channel.d.ts +28 -0
  5. package/dist/application/channel.d.ts.map +1 -1
  6. package/dist/application/diagnostic-journal-contract.d.ts +20 -0
  7. package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
  8. package/dist/application/diagnostic-journal-lock.d.ts +17 -0
  9. package/dist/application/diagnostic-journal-lock.d.ts.map +1 -0
  10. package/dist/application/diagnostic-journal-manager.d.ts +2 -1
  11. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  12. package/dist/application/diagnostic-journal-storage.d.ts +4 -1
  13. package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
  14. package/dist/application/diagnostic-journal.d.ts +4 -2
  15. package/dist/application/diagnostic-journal.d.ts.map +1 -1
  16. package/dist/application-opentelemetry.js +1 -1
  17. package/dist/application.d.ts +3 -3
  18. package/dist/application.d.ts.map +1 -1
  19. package/dist/application.js +134 -21
  20. package/dist/browser/resumable.d.ts +56 -0
  21. package/dist/browser/resumable.d.ts.map +1 -0
  22. package/dist/{index-zpyj7hsv.js → index-3cwck0rm.js} +98 -33
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +103 -14
  26. package/dist/primitives/audit.d.ts +52 -0
  27. package/dist/primitives/audit.d.ts.map +1 -0
  28. package/dist/primitives/deadline.d.ts +39 -0
  29. package/dist/primitives/deadline.d.ts.map +1 -0
  30. package/dist/primitives/decimal.d.ts +10 -0
  31. package/dist/primitives/decimal.d.ts.map +1 -0
  32. package/dist/primitives/delivery.d.ts +96 -0
  33. package/dist/primitives/delivery.d.ts.map +1 -0
  34. package/dist/primitives/event.d.ts +42 -0
  35. package/dist/primitives/event.d.ts.map +1 -0
  36. package/dist/primitives/export-operation.d.ts +89 -0
  37. package/dist/primitives/export-operation.d.ts.map +1 -0
  38. package/dist/primitives/index.d.ts +12 -0
  39. package/dist/primitives/index.d.ts.map +1 -0
  40. package/dist/primitives/lifecycle.d.ts +90 -0
  41. package/dist/primitives/lifecycle.d.ts.map +1 -0
  42. package/dist/primitives/migration-checks.d.ts +15 -0
  43. package/dist/primitives/migration-checks.d.ts.map +1 -0
  44. package/dist/primitives/money.d.ts +43 -0
  45. package/dist/primitives/money.d.ts.map +1 -0
  46. package/dist/primitives/owner-scope.d.ts +30 -0
  47. package/dist/primitives/owner-scope.d.ts.map +1 -0
  48. package/dist/primitives/permission.d.ts +28 -0
  49. package/dist/primitives/permission.d.ts.map +1 -0
  50. package/dist/primitives/quantity.d.ts +57 -0
  51. package/dist/primitives/quantity.d.ts.map +1 -0
  52. package/dist/primitives.d.ts +3 -0
  53. package/dist/primitives.d.ts.map +1 -0
  54. package/dist/primitives.js +750 -0
  55. package/llms-full.txt +246 -3
  56. package/llms.txt +1 -0
  57. package/package.json +6 -2
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ export declare const BackoffPolicySchema: z.ZodReadonly<z.ZodObject<{
3
+ minDelayMs: z.ZodNumber;
4
+ maxDelayMs: z.ZodNumber;
5
+ jitter: z.ZodNumber;
6
+ }, z.core.$strict>>;
7
+ export type BackoffPolicy = z.infer<typeof BackoffPolicySchema>;
8
+ export interface Backoff {
9
+ /** The next delay in milliseconds, doubling from `minDelayMs` and jittered. */
10
+ next(): number;
11
+ reset(): void;
12
+ }
13
+ /**
14
+ * Exponential backoff with jitter, as a value.
15
+ *
16
+ * Jitter is the part that is easy to leave out and expensive to leave out: without it every
17
+ * consumer that lost the same server retries at the same instant, and the recovering server is
18
+ * hit by the whole fleet at once instead of a spread. The randomisation is subtractive — a delay
19
+ * is never longer than the ceiling the caller declared, only shorter — so `maxDelayMs` remains a
20
+ * real bound rather than an average.
21
+ */
22
+ export declare function createBackoff(policy: BackoffPolicy, random?: () => number): Backoff;
23
+ export interface ResumableAttempt {
24
+ /** 1 for the first re-open after a failure, growing until a delivery resets it. */
25
+ readonly number: number;
26
+ readonly delayMs: number;
27
+ readonly error: unknown;
28
+ }
29
+ export interface ResumableIteratorConfig<T, CURSOR> {
30
+ /** Open the stream, from the last cursor a delivered item advanced to. */
31
+ open(cursor: CURSOR | undefined): AsyncIterable<T> | Promise<AsyncIterable<T>>;
32
+ /** The cursor that would resume after this item. The framework never reads inside it. */
33
+ advance(item: T, cursor: CURSOR | undefined): CURSOR;
34
+ /** An item that ends the stream for good instead of triggering a re-open. */
35
+ isTerminal?(item: T): boolean;
36
+ retry?: BackoffPolicy;
37
+ signal?: AbortSignal;
38
+ /** Called before each wait. A reconnect loop nobody can see is the shape of this defect. */
39
+ onAttempt?(attempt: ResumableAttempt): void;
40
+ /** Deterministic jitter for tests; defaults to `Math.random`. */
41
+ random?(): number;
42
+ }
43
+ /**
44
+ * Re-open a long-lived stream from the last delivered position.
45
+ *
46
+ * The caller owns every domain decision: `open` knows the transport, `advance` knows what a
47
+ * cursor means and `isTerminal` knows which item ends the stream. What this owns is the part
48
+ * that is the same everywhere and wrong in most hand-written copies — retrying with a bounded,
49
+ * jittered delay, resuming rather than restarting, resetting the backoff once the stream
50
+ * delivers again, and stopping promptly when the caller aborts.
51
+ *
52
+ * A failure while opening and a failure mid-stream are one case: both re-open from the cursor
53
+ * the last delivered item produced.
54
+ */
55
+ export declare function resumableIterator<T, CURSOR>(config: ResumableIteratorConfig<T, CURSOR>): AsyncGenerator<T, void, undefined>;
56
+ //# sourceMappingURL=resumable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resumable.d.ts","sourceRoot":"","sources":["../../src/browser/resumable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,mBAAmB;;;;mBAW5B,CAAC;AACL,MAAM,MAAM,aAAa,GAAG,CA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 +200,8 @@ var CreditWindowSnapshotSchema = z.object({
200
200
  leasedBytes: z.number().int().nonnegative(),
201
201
  acquired: z.number().int().nonnegative(),
202
202
  refused: z.number().int().nonnegative(),
203
- replenishedBytes: z.number().int().nonnegative()
203
+ replenishedBytes: z.number().int().nonnegative(),
204
+ waiting: z.number().int().nonnegative()
204
205
  }).strict().readonly();
205
206
  function createCreditWindow(config) {
206
207
  const capacityBytes = PositiveSafeIntegerSchema.parse(config.capacityBytes);
@@ -209,6 +210,7 @@ function createCreditWindow(config) {
209
210
  let acquired = 0;
210
211
  let refused = 0;
211
212
  let replenishedBytes = 0;
213
+ const waiters = new Set;
212
214
  const snapshot = () => CreditWindowSnapshotSchema.parse({
213
215
  state,
214
216
  capacityBytes,
@@ -216,46 +218,109 @@ function createCreditWindow(config) {
216
218
  leasedBytes: capacityBytes - availableBytes,
217
219
  acquired,
218
220
  refused,
219
- replenishedBytes
221
+ replenishedBytes,
222
+ waiting: waiters.size
220
223
  });
221
- return {
222
- acquire(bytes) {
223
- const requested = PositiveSafeIntegerSchema.parse(bytes);
224
- if (state === "closed") {
225
- refused += 1;
226
- return { outcome: "refused", reason: "closed" };
227
- }
228
- if (requested > capacityBytes) {
229
- refused += 1;
230
- return { outcome: "refused", reason: "larger-than-window" };
231
- }
232
- if (requested > availableBytes) {
233
- refused += 1;
234
- return { outcome: "refused", reason: "insufficient-credit" };
224
+ const serveWaiters = () => {
225
+ for (const waiter of waiters) {
226
+ if (waiter.bytes > availableBytes)
227
+ return;
228
+ waiter.settle({ outcome: "leased", lease: lease(waiter.bytes) });
229
+ }
230
+ };
231
+ const lease = (requested) => {
232
+ availableBytes -= requested;
233
+ acquired += 1;
234
+ let leaseReleased = false;
235
+ return {
236
+ bytes: requested,
237
+ get released() {
238
+ return leaseReleased;
239
+ },
240
+ release() {
241
+ if (leaseReleased)
242
+ return;
243
+ leaseReleased = true;
244
+ availableBytes += requested;
245
+ replenishedBytes += requested;
246
+ if (availableBytes > capacityBytes) {
247
+ throw new Error("Credit window accounting exceeded its capacity");
248
+ }
249
+ serveWaiters();
235
250
  }
236
- availableBytes -= requested;
237
- acquired += 1;
238
- let leaseReleased = false;
239
- const lease = {
251
+ };
252
+ };
253
+ const tryLease = (requested) => {
254
+ if (state === "closed")
255
+ return { outcome: "refused", reason: "closed" };
256
+ if (requested > capacityBytes) {
257
+ return { outcome: "refused", reason: "larger-than-window" };
258
+ }
259
+ if (requested > availableBytes) {
260
+ return { outcome: "refused", reason: "insufficient-credit" };
261
+ }
262
+ return { outcome: "leased", lease: lease(requested) };
263
+ };
264
+ const acquireNow = (requested) => {
265
+ const result = tryLease(requested);
266
+ if (result.outcome === "refused")
267
+ refused += 1;
268
+ return result;
269
+ };
270
+ const acquireWaiting = (requested, options) => {
271
+ const timeoutMs = options.timeoutMs === undefined ? undefined : PositiveSafeIntegerSchema.parse(options.timeoutMs);
272
+ const immediate = tryLease(requested);
273
+ if (immediate.outcome === "leased")
274
+ return Promise.resolve(immediate);
275
+ if (immediate.reason !== "insufficient-credit") {
276
+ refused += 1;
277
+ return Promise.resolve({ outcome: "refused", reason: immediate.reason });
278
+ }
279
+ if (options.signal?.aborted) {
280
+ refused += 1;
281
+ return Promise.resolve({ outcome: "refused", reason: "aborted" });
282
+ }
283
+ return new Promise((resolve) => {
284
+ let settled = false;
285
+ let timer;
286
+ const waiter = {
240
287
  bytes: requested,
241
- get released() {
242
- return leaseReleased;
243
- },
244
- release() {
245
- if (leaseReleased)
288
+ settle(result) {
289
+ if (settled)
246
290
  return;
247
- leaseReleased = true;
248
- availableBytes += requested;
249
- replenishedBytes += requested;
250
- if (availableBytes > capacityBytes) {
251
- throw new Error("Credit window accounting exceeded its capacity");
252
- }
291
+ settled = true;
292
+ if (timer !== undefined)
293
+ clearTimeout(timer);
294
+ options.signal?.removeEventListener("abort", onAbort);
295
+ waiters.delete(waiter);
296
+ if (result.outcome === "refused")
297
+ refused += 1;
298
+ resolve(result);
253
299
  }
254
300
  };
255
- return { outcome: "leased", lease };
256
- },
301
+ function onAbort() {
302
+ waiter.settle({ outcome: "refused", reason: "aborted" });
303
+ }
304
+ waiters.add(waiter);
305
+ options.signal?.addEventListener("abort", onAbort, { once: true });
306
+ if (timeoutMs !== undefined) {
307
+ timer = setTimeout(() => {
308
+ waiter.settle({ outcome: "refused", reason: "timed-out" });
309
+ }, timeoutMs);
310
+ }
311
+ });
312
+ };
313
+ function acquire(bytes, options) {
314
+ const requested = PositiveSafeIntegerSchema.parse(bytes);
315
+ return options === undefined ? acquireNow(requested) : acquireWaiting(requested, options);
316
+ }
317
+ return {
318
+ acquire,
257
319
  close() {
258
320
  state = "closed";
321
+ for (const waiter of [...waiters]) {
322
+ waiter.settle({ outcome: "refused", reason: "closed" });
323
+ }
259
324
  return snapshot();
260
325
  },
261
326
  getSnapshot: snapshot
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { type ClientConfig, type ClientContract, type ClientFetch, type ClientRegistryValue, type ContractClientConfig, contractEndpointMatchers, createClient, createClients, createScopedClients, createScopedUrlBuilders, createUrlBuilder, createUrlBuilders, type PathPrefixArgs, type RegistryScope, type ScopeClientConfigs, type ScopedClientRegistry, type ScopedUrlBuilderRegistry, type UrlBuilderConfig, } from './browser/client.js';
2
2
  export { ApiError, type ApiEvent, type ApiEventListener, type ConfiguredHttpClient, createHttpClient, type HeaderProvider, type HttpClient, type HttpClientConfig, type RequestOptions, type UnauthorizedMatcher, } from './browser/http.js';
3
3
  export { createLiveStateController, type LiveStateController, type LiveStateControllerConfig, type LiveStateControllerError, type LiveStateControllerSnapshot, type LiveStateControllerStatus, LiveStateControllerStatusSchema, type LiveStateEventDecision, type LiveStatePhase, LiveStatePhaseSchema, type LiveStateSource, type LiveStateSourceOpenInput, type LiveStateSourceOpenResult, type LiveStateStopReason, LiveStateStopReasonSchema, type LiveStateSubscriberError, } from './browser/live-state.js';
4
+ export { type Backoff, type BackoffPolicy, BackoffPolicySchema, createBackoff, type ResumableAttempt, type ResumableIteratorConfig, resumableIterator, } from './browser/resumable.js';
4
5
  export type { BindRealtimeClientOptions, BoundRealtimeClient, RealtimeClient, RealtimeClientOptions, RealtimeClientTransport, SocketEventMap, SocketIOClient, SocketIOClientConfig, SocketIOClientPeerLoaders, } from './browser/socket-io.js';
5
6
  export { bindRealtimeClient, createRealtimeClient, createSocketIOClient, } from './browser/socket-io.js';
6
7
  export { type ParseNDJSONOptions, type ParseSSEOptions, parseNDJSON, parseSSE, } from './browser/stream.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,+BAA+B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,yB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8 @@ var CreditWindowSnapshotSchema = z2.object({
1292
1292
  leasedBytes: z2.number().int().nonnegative(),
1293
1293
  acquired: z2.number().int().nonnegative(),
1294
1294
  refused: z2.number().int().nonnegative(),
1295
- replenishedBytes: z2.number().int().nonnegative()
1295
+ replenishedBytes: z2.number().int().nonnegative(),
1296
+ waiting: z2.number().int().nonnegative()
1296
1297
  }).strict().readonly();
1297
1298
 
1298
1299
  // src/browser/live-state.ts
@@ -1682,6 +1683,91 @@ function createLiveStateController(config) {
1682
1683
  close
1683
1684
  };
1684
1685
  }
1686
+ // src/browser/resumable.ts
1687
+ import { z as z4 } from "zod";
1688
+ var PositiveSafeIntegerSchema3 = z4.number().int().positive().safe();
1689
+ var BackoffPolicySchema = z4.object({
1690
+ minDelayMs: PositiveSafeIntegerSchema3,
1691
+ maxDelayMs: PositiveSafeIntegerSchema3,
1692
+ jitter: z4.number().min(0).max(1)
1693
+ }).strict().readonly().refine((policy) => policy.maxDelayMs >= policy.minDelayMs, {
1694
+ message: "maxDelayMs must be at least minDelayMs"
1695
+ });
1696
+ function createBackoff(policy, random = Math.random) {
1697
+ const { minDelayMs, maxDelayMs, jitter } = BackoffPolicySchema.parse(policy);
1698
+ let attempt = 0;
1699
+ return {
1700
+ next() {
1701
+ const exponential = Math.min(maxDelayMs, minDelayMs * 2 ** attempt);
1702
+ attempt += 1;
1703
+ const spread = exponential * jitter * random();
1704
+ return Math.max(1, Math.round(exponential - spread));
1705
+ },
1706
+ reset() {
1707
+ attempt = 0;
1708
+ }
1709
+ };
1710
+ }
1711
+ var DEFAULT_RETRY = { minDelayMs: 100, maxDelayMs: 30000, jitter: 0.5 };
1712
+
1713
+ class ResumableAbortError extends Error {
1714
+ constructor() {
1715
+ super("Resumable iterator was aborted");
1716
+ this.name = "ResumableAbortError";
1717
+ }
1718
+ }
1719
+ function sleep(ms, signal) {
1720
+ return new Promise((resolve, reject) => {
1721
+ const timer = setTimeout(() => {
1722
+ signal?.removeEventListener("abort", onAbort);
1723
+ resolve();
1724
+ }, ms);
1725
+ function onAbort() {
1726
+ clearTimeout(timer);
1727
+ reject(new ResumableAbortError);
1728
+ }
1729
+ if (signal?.aborted) {
1730
+ clearTimeout(timer);
1731
+ reject(new ResumableAbortError);
1732
+ return;
1733
+ }
1734
+ signal?.addEventListener("abort", onAbort, { once: true });
1735
+ });
1736
+ }
1737
+ async function* resumableIterator(config) {
1738
+ const backoff = createBackoff(config.retry ?? DEFAULT_RETRY, config.random);
1739
+ let cursor;
1740
+ let attempt = 0;
1741
+ for (;; ) {
1742
+ if (config.signal?.aborted)
1743
+ return;
1744
+ try {
1745
+ const source = await config.open(cursor);
1746
+ for await (const item of source) {
1747
+ if (config.signal?.aborted)
1748
+ return;
1749
+ attempt = 0;
1750
+ backoff.reset();
1751
+ cursor = config.advance(item, cursor);
1752
+ yield item;
1753
+ if (config.isTerminal?.(item))
1754
+ return;
1755
+ }
1756
+ throw new Error("Resumable source ended without a terminal item");
1757
+ } catch (error) {
1758
+ if (config.signal?.aborted || error instanceof ResumableAbortError)
1759
+ return;
1760
+ attempt += 1;
1761
+ const delayMs = backoff.next();
1762
+ config.onAttempt?.({ number: attempt, delayMs, error });
1763
+ try {
1764
+ await sleep(delayMs, config.signal);
1765
+ } catch {
1766
+ return;
1767
+ }
1768
+ }
1769
+ }
1770
+ }
1685
1771
  // src/internal/optional-peer.ts
1686
1772
  function isModuleNotFound(error) {
1687
1773
  if (typeof error !== "object" || error === null)
@@ -1692,19 +1778,19 @@ function isModuleNotFound(error) {
1692
1778
  }
1693
1779
 
1694
1780
  // src/realtime/request.ts
1695
- import { z as z4 } from "zod";
1696
- var RealtimeRequestPhaseSchema = z4.enum([
1781
+ import { z as z5 } from "zod";
1782
+ var RealtimeRequestPhaseSchema = z5.enum([
1697
1783
  "engine-handoff",
1698
1784
  "engine-ack-received",
1699
1785
  "settled",
1700
1786
  "timeout",
1701
1787
  "disconnected"
1702
1788
  ]);
1703
- var RealtimeRequestPhaseEventSchema = z4.object({
1704
- requestId: z4.string().min(1),
1705
- event: z4.string().min(1),
1789
+ var RealtimeRequestPhaseEventSchema = z5.object({
1790
+ requestId: z5.string().min(1),
1791
+ event: z5.string().min(1),
1706
1792
  phase: RealtimeRequestPhaseSchema,
1707
- elapsedMs: z4.number().finite().nonnegative()
1793
+ elapsedMs: z5.number().finite().nonnegative()
1708
1794
  }).strict();
1709
1795
 
1710
1796
  class RealtimeRequestTimeoutError extends Error {
@@ -1794,9 +1880,9 @@ function parseIssues(value) {
1794
1880
  }
1795
1881
 
1796
1882
  // src/realtime/rejection.ts
1797
- import { z as z5 } from "zod";
1883
+ import { z as z6 } from "zod";
1798
1884
  function realtimeContractViolation(options) {
1799
- const issues = options.cause instanceof z5.ZodError ? zodIssues(options.cause) : undefined;
1885
+ const issues = options.cause instanceof z6.ZodError ? zodIssues(options.cause) : undefined;
1800
1886
  const reason = options.reason.replaceAll("-", " ");
1801
1887
  const error = new AppError("REALTIME_CONTRACT_VIOLATION", `Realtime event "${options.event}" (${options.direction}, ${options.phase}): ${reason}`, 500, {
1802
1888
  event: options.event,
@@ -2532,27 +2618,28 @@ function createSocketIOClientInternal(config, onRequestPhase) {
2532
2618
  };
2533
2619
  }
2534
2620
  // src/realtime/contract.ts
2535
- import { z as z6 } from "zod";
2621
+ import { z as z7 } from "zod";
2536
2622
  function defineRealtimeContract(contract) {
2537
2623
  return contract;
2538
2624
  }
2539
- var RealtimeRejectDirectionSchema = z6.enum([
2625
+ var RealtimeRejectDirectionSchema = z7.enum([
2540
2626
  "client-inbound",
2541
2627
  "client-outbound",
2542
2628
  "server-inbound",
2543
2629
  "server-outbound"
2544
2630
  ]);
2545
- var RealtimeRejectPhaseSchema = z6.enum(["arguments", "acknowledgement"]);
2546
- var RealtimeRejectReasonSchema = z6.enum([
2631
+ var RealtimeRejectPhaseSchema = z7.enum(["arguments", "acknowledgement"]);
2632
+ var RealtimeRejectReasonSchema = z7.enum([
2547
2633
  "unknown-event",
2548
2634
  "invalid-arguments",
2549
2635
  "invalid-acknowledgement-value",
2550
2636
  "missing-acknowledgement",
2551
2637
  "rejected-by-peer"
2552
2638
  ]);
2553
- var RealtimeRejectFaultSchema = z6.enum(["peer", "local"]);
2639
+ var RealtimeRejectFaultSchema = z7.enum(["peer", "local"]);
2554
2640
  export {
2555
2641
  unauthorized,
2642
+ resumableIterator,
2556
2643
  rateLimited,
2557
2644
  parseTraceparent,
2558
2645
  parseSSE,
@@ -2580,6 +2667,7 @@ export {
2580
2667
  createContractFactory,
2581
2668
  createClients,
2582
2669
  createClient,
2670
+ createBackoff,
2583
2671
  contractEndpointMatchers,
2584
2672
  conflict,
2585
2673
  childSpan,
@@ -2602,6 +2690,7 @@ export {
2602
2690
  LiveStateControllerStatusSchema,
2603
2691
  DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
2604
2692
  ContractStreamFrameSchema,
2693
+ BackoffPolicySchema,
2605
2694
  AppError,
2606
2695
  ApiError,
2607
2696
  ALL_TRANSPORTS
@@ -0,0 +1,52 @@
1
+ import { type ZodType, z } from 'zod';
2
+ import type { ContractDef } from '../contract/index.js';
3
+ import { type DomainEventActor, type DomainEventSubject } from './event.js';
4
+ export interface AuditRecordPolicy<TChange extends ZodType = ZodType> {
5
+ readonly mode: 'record';
6
+ readonly change: TChange;
7
+ }
8
+ export interface AuditOmitPolicy {
9
+ readonly mode: 'omit';
10
+ readonly reason: string;
11
+ }
12
+ export type AuditPolicy = AuditRecordPolicy | AuditOmitPolicy;
13
+ export declare const AuditChangeSchema: z.ZodObject<{
14
+ operation: z.ZodString;
15
+ change: z.ZodUnknown;
16
+ }, z.core.$strip>;
17
+ export declare const AuditRecordSchema: z.ZodObject<{
18
+ id: z.ZodString;
19
+ type: z.ZodString;
20
+ occurredAt: z.ZodISODateTime;
21
+ actor: z.ZodOptional<z.ZodObject<{
22
+ id: z.ZodString;
23
+ role: z.ZodString;
24
+ }, z.core.$strip>>;
25
+ subject: z.ZodObject<{
26
+ type: z.ZodString;
27
+ id: z.ZodString;
28
+ }, z.core.$strip>;
29
+ payload: z.ZodObject<{
30
+ operation: z.ZodString;
31
+ change: z.ZodUnknown;
32
+ }, z.core.$strip>;
33
+ }, z.core.$strip>;
34
+ export type AuditRecord = z.infer<typeof AuditRecordSchema>;
35
+ export declare const audit: Readonly<{
36
+ record<TChange extends ZodType>(change: TChange): AuditRecordPolicy<TChange>;
37
+ omit(reason: string): AuditOmitPolicy;
38
+ }>;
39
+ /** Refuse a contract whose operation author did not make an explicit audit decision. */
40
+ export declare function assertAuditDeclared(contract: ContractDef): void;
41
+ export interface CreateAuditRecordInput<TChange> {
42
+ readonly id: string;
43
+ readonly occurredAt: string;
44
+ readonly operation: string;
45
+ readonly actor: DomainEventActor;
46
+ readonly subject: DomainEventSubject;
47
+ readonly policy: AuditRecordPolicy<ZodType<TChange>>;
48
+ readonly change: TChange;
49
+ }
50
+ /** Validate the declared change and return the same event value journals and delivery consume. */
51
+ export declare function createAuditRecord<TChange>(input: CreateAuditRecordInput<TChange>): AuditRecord;
52
+ //# sourceMappingURL=audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/primitives/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,aAAa,CAAC;AAC5D,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,OAAO,GAAG,OAAO;IAClE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAE9D,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;iBAA6C,CAAC;AAC5E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,KAAK;WACT,OAAO,SAAS,OAAO,UAAU,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC;iBAG/D,MAAM,GAAG,eAAe;EAIrC,CAAC;AAuBH,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAQ/D;AAED,MAAM,WAAW,sBAAsB,CAAC,OAAO;IAC7C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,kGAAkG;AAClG,wBAAgB,iBAAiB,CAAC,OAAO,EACvC,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACrC,WAAW,CAUb"}
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ export declare const DeadlineResultSchema: z.ZodObject<{
3
+ dueAt: z.ZodISODateTime;
4
+ remainingDays: z.ZodNumber;
5
+ overdueDays: z.ZodNumber;
6
+ category: z.ZodString;
7
+ }, z.core.$strip>;
8
+ export type DeadlineResult = z.infer<typeof DeadlineResultSchema>;
9
+ export declare function defineDeadlinePolicy<const TOnTrack extends string, const TWarning extends string, const TOverdue extends string>(config: {
10
+ readonly boundary: 'elapsed-day' | 'calendar-day';
11
+ readonly timeZone: string;
12
+ readonly warningDays: number;
13
+ readonly categories: {
14
+ readonly onTrack: TOnTrack;
15
+ readonly warning: TWarning;
16
+ readonly overdue: TOverdue;
17
+ };
18
+ }): Readonly<{
19
+ definition: {
20
+ readonly boundary: 'elapsed-day' | 'calendar-day';
21
+ readonly timeZone: string;
22
+ readonly warningDays: number;
23
+ readonly categories: {
24
+ readonly onTrack: TOnTrack;
25
+ readonly warning: TWarning;
26
+ readonly overdue: TOverdue;
27
+ };
28
+ };
29
+ evaluate(input: {
30
+ readonly anchorAt: Date;
31
+ readonly durationDays: number;
32
+ readonly now: Date;
33
+ }): DeadlineResult;
34
+ queryBoundary(now: Date): Readonly<{
35
+ overdueBefore: string;
36
+ warningBefore: string;
37
+ }>;
38
+ }>;
39
+ //# sourceMappingURL=deadline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deadline.d.ts","sourceRoot":"","sources":["../../src/primitives/deadline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,oBAAoB;;;;;iBAK/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AA8ElE,wBAAgB,oBAAoB,CAClC,KAAK,CAAC,QAAQ,SAAS,MAAM,EAC7B,KAAK,CAAC,QAAQ,SAAS,MAAM,EAC7B,KAAK,CAAC,QAAQ,SAAS,MAAM,EAC7B,MAAM,EAAE;IACR,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC5B,CAAC;CACH;;2BARoB,aAAa,GAAG,cAAc;2BAC9B,MAAM;8BACH,MAAM;6BACP;YACnB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;YAC3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;YAC3B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;SAC5B;;oBAYiB;QACd,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;QACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;KACpB,GAAG,cAAc;uBAsBC,IAAI;;;;GAO1B"}
@@ -0,0 +1,10 @@
1
+ export interface DecimalParts {
2
+ readonly coefficient: bigint;
3
+ readonly scale: number;
4
+ }
5
+ export declare function parseDecimal(value: string): DecimalParts;
6
+ export declare function normalizeDecimal(parts: DecimalParts): DecimalParts;
7
+ export declare function formatDecimal(parts: DecimalParts): string;
8
+ export declare function addDecimal(left: DecimalParts, right: DecimalParts): DecimalParts;
9
+ export declare function multiplyDecimalRatio(value: DecimalParts, numerator: bigint, denominator: bigint): DecimalParts;
10
+ //# sourceMappingURL=decimal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../src/primitives/decimal.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAOxD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAQlE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAQzD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAKhF;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,YAAY,CAYd"}
@@ -0,0 +1,96 @@
1
+ import { z } from 'zod';
2
+ import { type DomainEvent } from './event.js';
3
+ export declare const DomainEventDestinationSchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ transport: z.ZodString;
6
+ address: z.ZodString;
7
+ }, z.core.$strip>;
8
+ export type DomainEventDestination = z.infer<typeof DomainEventDestinationSchema>;
9
+ export declare const DomainEventDeliveryOutcomeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
10
+ outcome: z.ZodLiteral<"delivered">;
11
+ receipt: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>, z.ZodObject<{
13
+ outcome: z.ZodLiteral<"retryable">;
14
+ code: z.ZodString;
15
+ retryAt: z.ZodISODateTime;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ outcome: z.ZodLiteral<"terminal">;
18
+ code: z.ZodString;
19
+ }, z.core.$strip>, z.ZodObject<{
20
+ outcome: z.ZodLiteral<"unknown">;
21
+ code: z.ZodString;
22
+ }, z.core.$strip>], "outcome">;
23
+ export type DomainEventDeliveryOutcome = z.infer<typeof DomainEventDeliveryOutcomeSchema>;
24
+ export declare const DomainEventDeliveryClaimSchema: z.ZodObject<{
25
+ event: z.ZodObject<{
26
+ id: z.ZodString;
27
+ type: z.ZodString;
28
+ occurredAt: z.ZodISODateTime;
29
+ actor: z.ZodOptional<z.ZodObject<{
30
+ id: z.ZodString;
31
+ role: z.ZodString;
32
+ }, z.core.$strip>>;
33
+ subject: z.ZodObject<{
34
+ type: z.ZodString;
35
+ id: z.ZodString;
36
+ }, z.core.$strip>;
37
+ payload: z.ZodUnknown;
38
+ }, z.core.$strip>;
39
+ destination: z.ZodObject<{
40
+ id: z.ZodString;
41
+ transport: z.ZodString;
42
+ address: z.ZodString;
43
+ }, z.core.$strip>;
44
+ attempt: z.ZodNumber;
45
+ }, z.core.$strip>;
46
+ export type DomainEventDeliveryClaim = z.infer<typeof DomainEventDeliveryClaimSchema>;
47
+ export interface DomainEventOutbox {
48
+ /** Atomically claim one already committed destination, or return undefined. */
49
+ claim(eventId: string): Promise<DomainEventDeliveryClaim | undefined>;
50
+ /** Mark a successful claim complete. */
51
+ delivered(claim: DomainEventDeliveryClaim, outcome: Extract<DomainEventDeliveryOutcome, {
52
+ outcome: 'delivered';
53
+ }>): Promise<void>;
54
+ /** Schedule the next claim at the declared instant. */
55
+ retry(claim: DomainEventDeliveryClaim, outcome: Extract<DomainEventDeliveryOutcome, {
56
+ outcome: 'retryable';
57
+ }>): Promise<void>;
58
+ /** Retire a destination after a definitive refusal. */
59
+ terminal(claim: DomainEventDeliveryClaim, outcome: Extract<DomainEventDeliveryOutcome, {
60
+ outcome: 'terminal';
61
+ }>): Promise<void>;
62
+ /** Hold an unclassified failure for inspection; it must not become an automatic retry. */
63
+ unknown(claim: DomainEventDeliveryClaim, outcome: Extract<DomainEventDeliveryOutcome, {
64
+ outcome: 'unknown';
65
+ }>): Promise<void>;
66
+ }
67
+ export interface DomainEventRoute {
68
+ readonly type: string;
69
+ readonly destinations: (event: DomainEvent) => readonly DomainEventDestination[];
70
+ }
71
+ export interface DomainEventTransport {
72
+ readonly send: (event: DomainEvent, destination: DomainEventDestination) => Promise<DomainEventDeliveryOutcome>;
73
+ }
74
+ export interface DomainEventDeliveryPlan {
75
+ readonly event: DomainEvent;
76
+ readonly destinations: readonly DomainEventDestination[];
77
+ }
78
+ export interface DomainEventDispatchResult {
79
+ readonly eventId: string;
80
+ readonly attempts: number;
81
+ readonly exhausted: boolean;
82
+ }
83
+ /**
84
+ * Compose routing with an application-owned committed outbox. The dispatcher cannot accept a raw
85
+ * event: callers persist `plan(event)` transactionally, then dispatch only by stable event id.
86
+ */
87
+ export declare function defineDomainEventDelivery(config: {
88
+ readonly routes: readonly DomainEventRoute[];
89
+ readonly transports: Readonly<Record<string, DomainEventTransport>>;
90
+ readonly outbox: DomainEventOutbox;
91
+ readonly maxClaimsPerDispatch?: number;
92
+ }): Readonly<{
93
+ plan(eventInput: DomainEvent): DomainEventDeliveryPlan;
94
+ dispatch(eventId: string): Promise<DomainEventDispatchResult>;
95
+ }>;
96
+ //# sourceMappingURL=delivery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../../src/primitives/delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,SAAS,CAAC;AAE9D,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;8BAS3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;iBAIzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAC;IACtE,wCAAwC;IACxC,SAAS,CACP,KAAK,EAAE,wBAAwB,EAC/B,OAAO,EAAE,OAAO,CAAC,0BAA0B,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC,GACrE,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,uDAAuD;IACvD,KAAK,CACH,KAAK,EAAE,wBAAwB,EAC/B,OAAO,EA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