@yaks/effects 0.0.0-stage → 0.2.36

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 (101) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +979 -2
  3. package/_dist/docs.d.ts +10 -0
  4. package/_dist/docs.d.ts.map +1 -0
  5. package/_dist/enqueue.d.ts +12 -0
  6. package/_dist/enqueue.d.ts.map +1 -0
  7. package/_dist/expire.d.ts +31 -0
  8. package/_dist/expire.d.ts.map +1 -0
  9. package/_dist/invocation.d.ts +36 -0
  10. package/_dist/invocation.d.ts.map +1 -0
  11. package/_dist/lease.d.ts +98 -0
  12. package/_dist/lease.d.ts.map +1 -0
  13. package/_dist/mod.d.ts +89 -0
  14. package/_dist/mod.d.ts.map +1 -0
  15. package/_dist/outage.d.ts +48 -0
  16. package/_dist/outage.d.ts.map +1 -0
  17. package/_dist/pool.d.ts +148 -0
  18. package/_dist/pool.d.ts.map +1 -0
  19. package/_dist/provisional.d.ts +8 -0
  20. package/_dist/provisional.d.ts.map +1 -0
  21. package/_dist/ready.d.ts +3 -0
  22. package/_dist/ready.d.ts.map +1 -0
  23. package/_dist/registration.d.ts +17 -0
  24. package/_dist/registration.d.ts.map +1 -0
  25. package/_dist/registry.d.ts +153 -0
  26. package/_dist/registry.d.ts.map +1 -0
  27. package/_dist/tools.d.ts +21 -0
  28. package/_dist/tools.d.ts.map +1 -0
  29. package/_dist/trace.d.ts +63 -0
  30. package/_dist/trace.d.ts.map +1 -0
  31. package/_dist/views.d.ts +15 -0
  32. package/_dist/views.d.ts.map +1 -0
  33. package/_dist/vocab.d.ts +11 -0
  34. package/_dist/vocab.d.ts.map +1 -0
  35. package/_dist/worker.d.ts +19 -0
  36. package/_dist/worker.d.ts.map +1 -0
  37. package/_dist/write.d.ts +25 -0
  38. package/_dist/write.d.ts.map +1 -0
  39. package/cleanup.js +75 -0
  40. package/cleanup.js.map +1 -0
  41. package/cleanup.ts +83 -0
  42. package/deno.json +1 -0
  43. package/docs.js +13 -0
  44. package/docs.js.map +1 -0
  45. package/docs.ts +13 -0
  46. package/enqueue.js +71 -0
  47. package/enqueue.js.map +1 -0
  48. package/enqueue.ts +86 -0
  49. package/expire.js +225 -0
  50. package/expire.js.map +1 -0
  51. package/expire.ts +244 -0
  52. package/invocation.js +245 -0
  53. package/invocation.js.map +1 -0
  54. package/invocation.ts +250 -0
  55. package/lease.js +343 -0
  56. package/lease.js.map +1 -0
  57. package/lease.ts +444 -0
  58. package/mod.js +89 -0
  59. package/mod.js.map +1 -0
  60. package/mod.ts +92 -0
  61. package/outage.js +77 -0
  62. package/outage.js.map +1 -0
  63. package/outage.ts +84 -0
  64. package/package.json +52 -4
  65. package/page.js +315 -0
  66. package/page.js.map +1 -0
  67. package/page.ts +524 -0
  68. package/pool.js +1474 -0
  69. package/pool.js.map +1 -0
  70. package/pool.ts +1635 -0
  71. package/provisional.js +20 -0
  72. package/provisional.js.map +1 -0
  73. package/provisional.ts +26 -0
  74. package/ready.js +48 -0
  75. package/ready.js.map +1 -0
  76. package/ready.ts +93 -0
  77. package/registration.js +21 -0
  78. package/registration.js.map +1 -0
  79. package/registration.ts +43 -0
  80. package/registry.js +872 -0
  81. package/registry.js.map +1 -0
  82. package/registry.ts +1196 -0
  83. package/tools.js +182 -0
  84. package/tools.js.map +1 -0
  85. package/tools.ts +229 -0
  86. package/trace.js +167 -0
  87. package/trace.js.map +1 -0
  88. package/trace.ts +217 -0
  89. package/views.js +18 -0
  90. package/views.js.map +1 -0
  91. package/views.ts +18 -0
  92. package/vocab.js +18 -0
  93. package/vocab.js.map +1 -0
  94. package/vocab.json +364 -0
  95. package/vocab.ts +20 -0
  96. package/worker.js +114 -0
  97. package/worker.js.map +1 -0
  98. package/worker.ts +146 -0
  99. package/write.js +38 -0
  100. package/write.js.map +1 -0
  101. package/write.ts +60 -0
@@ -0,0 +1,10 @@
1
+ import type { VocabDoc } from "@yaks/vocab";
2
+ /**
3
+ * This package's components, to load beside your own when effects should be
4
+ * written down and worked by a pool: `loadVocab([effectDoc, ...mine])`. Four
5
+ * components, one document — `effect`, a run owed, whose every property is
6
+ * server-owned; `lease` (./lease.ts), a duty held by one process at a time;
7
+ * `worker` (./worker.ts), what a process working the pool says about itself;
8
+ * and `provisional` (./provisional.ts), an entity whose step is unfinished.
9
+ */ export declare let effectDoc: VocabDoc;
10
+ //# sourceMappingURL=docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.d.ts","sources":["../docs.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,2BAAgC;AAGtD;;;;;;;CAOC,GACD,OAAO,YAAI,WAAW,SAAc"}
@@ -0,0 +1,12 @@
1
+ import { type Access, type Bundle, type Eid, type Entity, type Tx } from "@yaks/graph";
2
+ import type { HookContext } from "@yaks/graph/plugin";
3
+ /** Owe one fresh invocation independently of a component transition. */ export declare let enqueue: (g: Access, handler: string, target: Eid) => Bundle[] | Promise<Bundle[]>;
4
+ /** The durable invocation patch, for a trusted writer already in a batch,
5
+ * due at `next` (an ISO time) or at once. */ export declare let effectInvocation: (handler: string, target: Eid, next?: string) => Bundle;
6
+ /** The patch that puts a run back to pending with a fresh allowance, guarded
7
+ * on the state it was read in (`was`, failed unless said), so a run a worker
8
+ * has since touched is left alone. */ export declare let effectRetry: (run: Eid, was?: string) => Bundle;
9
+ /** Owe one fresh invocation from a hook inside a write's own transaction (a
10
+ * `commit` hook's `tx`), so the run commits or rolls back with the write that
11
+ * owes it, due at `next` or at once. */ export declare let owe: (tx: Tx, context: HookContext | undefined, handler: string, target: Eid, next?: string) => Entity[] | Promise<Entity[]>;
12
+ //# sourceMappingURL=enqueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enqueue.d.ts","sources":["../enqueue.ts"],"names":[],"mappings":"AACA,SACE,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,MAAM,EAEX,KAAK,EAAE,2BACsB;AAC/B,cAAc,WAAW,kCAAuC;AAKhE,sEAAsE,GACtE,OAAO,YAAI,UACT,GAAG,QACH,SAAS,MAAM,EACf,QAAQ,QACP,WAAW,QAAQ,UAMrB;AAED;2CAC2C,GAC3C,OAAO,YAAI,mBACT,SAAS,MAAM,EACf,QAAQ,KACR,OAAO,MAAM,KACZ,OAYD;AAeF;;oCAEoC,GACpC,OAAO,YAAI,cAAe,KAAK,KAAK,iBAAiB,OAInD;AAMF;;sCAEsC,GACtC,OAAO,YAAI,MACT,IAAI,IACJ,SAAS,cAAc,SAAS,EAChC,SAAS,MAAM,EACf,QAAQ,KACR,OAAO,MAAM,KACZ,WAAW,QAAQ,UAGrB"}
@@ -0,0 +1,31 @@
1
+ import type { Access } from "@yaks/graph";
2
+ /** The daily expiration duty shared by every effects worker. */ export declare let EXPIRE: string;
3
+ /** A day in milliseconds between successful expiration passes. */ export declare let DAY: number;
4
+ /** The former tombstone retention, retained for callers that display it.
5
+ * Tombstones and their trash no longer expire. */ export declare let TOMBSTONES: any;
6
+ /** Remove matching regenerable component rows in bounded transactions.
7
+ * The returned count is component rows, not entities: another component keeps
8
+ * its owner alive. Trash is retained until a person chooses to purge it.
9
+ * Each declaration is constrained to its own component even when its query
10
+ * contains an OR. */ export declare let expire: (g: Access, opts?: {
11
+ batch?: number;
12
+ now?: number;
13
+ page?: number;
14
+ signal?: AbortSignal;
15
+ /** Ignored: retained trash has no automatic expiration. */ tombstones?: number;
16
+ }) => Promise<number>;
17
+ /** How many of a component's owners one read of a sweep walks past. */ export declare let PAGE: number;
18
+ /** One due daily pass, contended by the workers' existing lease mechanism.
19
+ * Leave the lease standing for a day after success. A crash or failure leaves
20
+ * only a short hold, so another worker can recover rather than skip the day. */ export declare let expireDaily: (g: Access, opts: {
21
+ owner: string;
22
+ now?: () => number;
23
+ signal?: AbortSignal;
24
+ }) => Promise<void>;
25
+ /** Expiration's upkeep duty, independent of the pool's work selection. */ export declare let expiration: (g: Access, opts: {
26
+ owner: string;
27
+ signal: AbortSignal;
28
+ now?: () => number;
29
+ report: (error: unknown) => void;
30
+ }) => Promise<void>;
31
+ //# sourceMappingURL=expire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expire.d.ts","sources":["../expire.ts"],"names":[],"mappings":"AAaA,cAAc,MAAM,2BAA8C;AAMlE,8DAA8D,GAC9D,OAAO,YAAI,eAA+B;AAC1C,gEAAgE,GAChE,OAAO,YAAI,YAAgB;AAC3B;gDACgD,GAChD,OAAO,YAAI,gBAAqB;AAEhC;;;;mBAImB,GACnB,OAAO,YAAI,SACT,GAAG,QACH;EACE,QAAQ,MAAM;EACd,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,SAAS;EACT,yDAAyD,GACzD,aAAa,MAAM;MAEpB,QAAQ,MAAM,EAiDhB;AAmBD,qEAAqE,GACrE,OAAO,YAAI,aAAW;AAwDtB;;8EAE8E,GAC9E,OAAO,YAAI,cACT,GAAG,QACH;EAAQ,OAAO,MAAM;EAAE,YAAY,MAAM;EAAE,SAAS;MACnD,QAAQ,IAAI,EAkDd;AAED,wEAAwE,GACxE,OAAO,YAAI,aACT,GAAG,QACH;EACE,OAAO,MAAM;EACb,QAAQ;EACR,YAAY,MAAM;EAClB,SAAS,OAAO,OAAO,KAAK,IAAI;MAEjC,QAAQ,IAAI,EASd"}
@@ -0,0 +1,36 @@
1
+ import { type Actor, type Bundle, type Comp, type Eid, type Graph } from "@yaks/graph";
2
+ import type { Handler } from "./registry.js";
3
+ /** A callable effect's vocabulary entity. */ export declare let effectEid: (name: string) => Eid;
4
+ /** The effect run owned by this call. */ export declare let callRun: (call: Eid) => Eid;
5
+ /** The answer kept for this invocation. */ export declare let effectResult: (id: Eid) => Eid;
6
+ /** What a declared match committed for an invocation, before platform I/O. */ export type Invocation = {
7
+ args: Record<string, unknown>;
8
+ call?: Eid;
9
+ /** A recurring firing's new call, prepared from the schedule. */ each?: Bundle;
10
+ actor?: Actor;
11
+ match?: string;
12
+ id?: string;
13
+ };
14
+ /** Who asked, and where a streaming operation may publish partial results. */ export type OperationContext = {
15
+ id: Eid;
16
+ source: Eid;
17
+ actor?: Actor;
18
+ progress: (answer: EffectAnswer) => Promise<void>;
19
+ };
20
+ /** The words and data one operation answers together. */ export type EffectAnswer = {
21
+ body?: string;
22
+ value?: Comp;
23
+ };
24
+ /** One operation over a capability lent by a host. */ export type Operation = (args: Record<string, unknown>, context: OperationContext) => EffectAnswer | Promise<EffectAnswer>;
25
+ /** Interpret literals and the values captured by a declared match. */ export declare let boundArgs: (args: Record<string, unknown>, vars: Record<string, unknown>) => Record<string, unknown>;
26
+ /** Capture a call as it stood when it became due. */ export declare let invocationOf: (row: Bundle) => Invocation;
27
+ /** Record an operation's result against its call, or its matched subject. */ export declare let answering: (name: string, run: Operation) => Handler;
28
+ /** Ask a callable effect and await its recorded answer. Cancelling the wait
29
+ * leaves the durable invocation to finish. */ export declare let requestEffect: (g: Graph, name: string, args: Comp | (() => Promise<Comp>), options: {
30
+ id: Eid;
31
+ source?: Eid;
32
+ actor?: Actor | null;
33
+ signal?: AbortSignal;
34
+ defer?: boolean;
35
+ }) => Promise<Bundle>;
36
+ //# sourceMappingURL=invocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invocation.d.ts","sources":["../invocation.ts"],"names":[],"mappings":"AACA,SACE,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,GAAG,EACR,KAAK,KAAK,2BAMmB;AAM/B,cAAc,OAAO,wBAAuB;AAE5C,2CAA2C,GAC3C,OAAO,YAAI,YAAY,MAAM,MAAM,KAAK,IAAiC;AAEzE,uCAAuC,GACvC,OAAO,YAAI,UAAW,MAAM,QAAM,IAAwC;AAE1E,yCAAyC,GACzC,OAAO,YAAI,eAAgB,IAAI,QAAM,IAAwC;AAE7E,4EAA4E,GAC5E,YAAY;EACV,MAAM,OAAO,MAAM,EAAE,OAAO;EAC5B,OAAO;EACP,+DAA+D,GAC/D,OAAO;EACP,QAAQ;EACR,QAAQ,MAAM;EACd,KAAK,MAAM;;AAGb,4EAA4E,GAC5E,YAAY;EACV,IAAI;EACJ,QAAQ;EACR,QAAQ;EACR,WAAW,QAAQ,iBAAiB,QAAQ,IAAI;;AAGlD,uDAAuD,GACvD,YAAY;EAAiB,OAAO,MAAM;EAAE,QAAQ;;AAEpD,oDAAoD,GACpD,YAAY,aACV,MAAM,OAAO,MAAM,EAAE,OAAO,GAC5B,SAAS,qBACN,eAAe,QAAQ;AAE5B,oEAAoE,GACpE,OAAO,YAAI,YACT,MAAM,OAAO,MAAM,EAAE,OAAO,GAC5B,MAAM,OAAO,MAAM,EAAE,OAAO,MAC3B,OAAO,MAAM,EAAE,OAAO,EAWxB;AAED,mDAAmD,GACnD,OAAO,YAAI,eAAgB,KAAK,WAAS,WAqBxC;AAED,2EAA2E,GAC3E,OAAO,YAAI,YACR,MAAM,MAAM,EAAE,KAAK,cAAY,QAsG/B;AAEH;4CAC4C,GAC5C,OAAO,YAAI,gBACT,GAAG,OACH,MAAM,MAAM,EACZ,MAAM,cAAc,QAAQ,QAC5B;EACE,IAAI;EACJ,SAAS;EACT,QAAQ,QAAQ,IAAI;EACpB,SAAS;EACT,QAAQ,OAAO;MAEhB,QAAQ,QAgCV"}
@@ -0,0 +1,98 @@
1
+ import type { Access, Bundle, Eid } from "@yaks/graph";
2
+ /** The name of the component a lease is stored as. */ export declare let LEASE: string;
3
+ /** How long a take stands before another process may have it (ms). */ export declare let HOLD: number;
4
+ /** A lease row, as it is held. */ export type Lease = {
5
+ /** the duty being held — the eid is derived from it */ name?: string | null;
6
+ /** the process holding it */ holder?: Eid | null;
7
+ /** when it expires, ISO-8601 */ until?: string | null;
8
+ };
9
+ /**
10
+ * The eid a lease is stored at: `sha256("lease|<name>")` formatted as a uuid,
11
+ * the same derivation an edge's eid gets.
12
+ *
13
+ * ```ts
14
+ * leaseEid('@yaks/wake') == leaseEid('@yaks/wake') // true
15
+ * ```
16
+ */ export declare let leaseEid: (name: string) => Eid;
17
+ /** The arguments to a take: who is asking, and for how long. */ export type HoldOpts = {
18
+ /** the process asking — what `holder` names */ holder: Eid;
19
+ /** how long the take stands (default {@link HOLD}) */ hold?: number;
20
+ /** the clock, in milliseconds (default `Date.now`) */ now?: () => number;
21
+ /** whether a holder is known to be over (@yaks/process `gone`): its take no
22
+ * longer stands, so the lease is had now rather than at its expiry (default:
23
+ * nobody is known to be) */ gone?: (holder: Eid) => boolean | Promise<boolean>;
24
+ };
25
+ /**
26
+ * Take a lease, or find out somebody else holds it. Returns whether it is now
27
+ * ours — a holder taking its own again is a renewal, and pushes `until` out.
28
+ *
29
+ * ```ts
30
+ * import { take } from '@yaks/effects'
31
+ *
32
+ * // if (await take(graph, '@yaks/wake', { holder: me })) …
33
+ * ```
34
+ */ export declare let take: (g: Access, name: string, o: HoldOpts) => Promise<boolean>;
35
+ /**
36
+ * Release a lease, if we are the one holding it. The row stays — the duty
37
+ * outlives whoever was doing it — and the next process to ask gets it without
38
+ * waiting for the expiry.
39
+ */ export declare let drop: (g: Access, name: string, o: {
40
+ holder: Eid;
41
+ }) => Promise<void>;
42
+ /**
43
+ * Every duty and effect lease a holder has, as bundles that release them,
44
+ * guarded against a concurrent handover — to be applied
45
+ * in the same batch that records the holder's ending, because they are one
46
+ * fact: a process that is over is not doing anything, and the next one to ask
47
+ * should not have to wait out an expiry nobody is using. Its pending startup
48
+ * runs end with it: another process owes its own startup, not this closure.
49
+ */ export declare let released: (g: Access, holder: Eid) => Bundle[] | Promise<Bundle[]>;
50
+ /** Who holds a lease right now, if anybody — the read a check makes. */ export declare let held: (g: Access, name: string) => Promise<Lease | undefined>;
51
+ /** Wait, unless we are done waiting: a sleep the signal cuts short, so a pass
52
+ * between renewals releases the lease the moment it is asked to. */ export { sleep } from "@yaks/fp";
53
+ /** How a lease is held for a while: {@link HoldOpts}, plus what signals that
54
+ * we are done, how often to retry while somebody else holds it, and where a
55
+ * store that failed to answer is told. */ export type HoldingOpts = HoldOpts & {
56
+ /** abort to release the lease. Already aborted means one pass and out — a
57
+ * CLI command does what nobody else is doing and never queues for what
58
+ * somebody else is. */ signal?: AbortSignal;
59
+ /** whether to wait out a holder ahead of this one (default: while the
60
+ * signal is live). Not waiting answers at once, leaving the work to them —
61
+ * one run of something whose holder already runs it, like a transcript's
62
+ * turn — and a take the store fails is then thrown, for the caller to try
63
+ * again, rather than waited out. */ wait?: boolean;
64
+ /** how often to ask again while somebody else holds it (default a tenth of
65
+ * the hold) */ poll?: number;
66
+ /** a take or a renewal the store failed (default `console.error`); it is
67
+ * asked again, since a busy store is not an answer */ report?: (err: unknown) => void;
68
+ };
69
+ /**
70
+ * Run a duty for as long as this process is up: take the lease, renew it
71
+ * while the work runs, and release it at the end. Answers what the work last
72
+ * answered, or `undefined` where it never ran.
73
+ *
74
+ * The same call serves a process of either shape, which is the point — nothing
75
+ * here assumes a separate one. A server or a TUI passes a live signal and
76
+ * holds the lease until that aborts, waiting for the holder ahead of it to
77
+ * expire; a one-shot CLI command passes a signal that has already aborted,
78
+ * does the pass if nobody else is, and releases on the way out. Either way the
79
+ * lease is renewed for as long as the work runs.
80
+ *
81
+ * The work is handed a signal that also aborts when the lease is lost: a
82
+ * renewal that finds another process holding it means that process is doing
83
+ * the duty now, so this one stops, and goes back to waiting in case that one
84
+ * stops too. Renewals run on a timer beside the work, so the work has to
85
+ * yield to timers (a sleep, a wait on I/O) more often than a third of the
86
+ * hold; a step that blocks longer can lapse, and the next renewal to run
87
+ * finds out and stops it.
88
+ *
89
+ * ```ts
90
+ * import { holding } from '@yaks/effects'
91
+ *
92
+ * // await holding(graph, '@yaks/wake', { holder: me, signal }, (s) => loop(g, { signal: s }))
93
+ * ```
94
+ */ export declare let holding: <T = void>(g: Access, name: string, o: HoldingOpts, work: (signal: AbortSignal) => T | Promise<T>) => Promise<T | undefined>;
95
+ /** A promise that keeps a lease held and does nothing else, until the signal
96
+ * reports that we are done — what a pass that has already finished its work
97
+ * waits on, so the lease stays this process's while it is up. */ export declare let until: (signal: AbortSignal)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D,UAAU,KAAK,OAAO,KAAK,IAAI;;AAgGjC;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,OAAO,YAAI,UAAiB,IAAI,IAAI,EAClC,GAAG,QACH,MAAM,MAAM,EACZ,GAAG,aACH,OAAO,QAAQ,gBAAgB,IAAI,QAAQ,OAC1C,QAAQ,IAAI,SAAS,EAmCvB;AAED;;+DAE+D,GAC/D,OAAO,YAAI,QAAS,QAAQ,gBAAc,QAAQ,IAAI,EAOjD"}
package/_dist/mod.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @yaks/effects — what a graph does about the data it commits, kept out of the
3
+ * write path and out of the writer.
4
+ *
5
+ * A write is settled by {@link https://jsr.io/@yaks/graph | @yaks/graph}'s
6
+ * `apply()`. An effect is the other half: work a commit owes, run after the
7
+ * transaction commits. When a letter is written, send it. When an order is
8
+ * paid, print a receipt.
9
+ *
10
+ * A batch, here and throughout, is bundles applied in one
11
+ * transaction: the array passed to `apply()`, written in full or not at all.
12
+ *
13
+ * ## Declared, then handled
14
+ * An effect is declared in a vocabulary, beside the components it is about,
15
+ * so every process that loads the vocabulary knows what a write owes:
16
+ *
17
+ * ```json
18
+ * { "$defs": { "send_receipt": { "effect": true, "changed": ["order.paid"] } } }
19
+ * ```
20
+ *
21
+ * and the code that runs it is registered by name, by a process that runs
22
+ * effects:
23
+ *
24
+ * ```ts
25
+ * import { graph } from '@yaks/graph'
26
+ * import { loadVocab } from '@yaks/vocab'
27
+ * import { ram } from '@yaks/ram'
28
+ * import { effects } from '@yaks/effects'
29
+ *
30
+ * let paid = { type: 'boolean' }
31
+ * let vocab = loadVocab([{
32
+ * $defs: {
33
+ * order: { component: true, properties: { paid } },
34
+ * send_receipt: { effect: true, changed: ['order.paid'] },
35
+ * },
36
+ * }])
37
+ * let fx = effects(vocab)
38
+ * let g = graph({ storage: ram(vocab), vocab, plugins: [fx] })
39
+ * fx.handle({ send_receipt: (e) => console.log(e.entity.eid) })
40
+ * ```
41
+ *
42
+ * Where the vocabulary also loads {@link effectDoc}, a commit writes every run
43
+ * it owes into the graph, in its own transaction, and any number of processes
44
+ * work the pool ({@link Effects.work}): each claims a run, runs it, and retries
45
+ * it on the terms its declaration set. Where it does not, a handled effect
46
+ * runs in the process that committed, at most once.
47
+ *
48
+ * ## Observers
49
+ * A process can also watch its own commits, for as long as it runs:
50
+ * `fx.created('post', redraw)` calls `redraw` for each post a commit makes,
51
+ * and `fx.on('$call .call, !results', show)` calls `show` wherever a commit
52
+ * leaves a call without results.
53
+ *
54
+ * An observer is known only to the process that registered it, so it runs
55
+ * there, after that process's commits, and is never written down.
56
+ *
57
+ * ## The promises
58
+ * - **Post-commit only.** A handler cannot reject a write; by the time it runs,
59
+ * the write is durable. A batch that was refused owes nothing.
60
+ * - **Isolated.** A handler that throws is passed to `report` and the next
61
+ * handler still runs.
62
+ * - **Written with the write.** Where the pool is kept, a run is committed with
63
+ * the batch that owes it, so no crash between the two can lose it.
64
+ *
65
+ * ## Writing back
66
+ * An effect that writes has one route, and it is the graph's own `apply()`:
67
+ * `effects(vocab, { write: (b) => g.apply(b, { trusted: true }) })`.
68
+ *
69
+ * So the write is admitted, stamped, journaled and broadcast like any other. A
70
+ * write from an effect could trigger an effect; that loop is stopped in one
71
+ * place: every batch carries its {@link generation} — 0 when it came from a
72
+ * client, 1 for an effect's write — and a batch past `depth` (default 1) owes
73
+ * nothing.
74
+ *
75
+ * It imports no platform API, so the same registry runs on a server, in a
76
+ * worker, and in a browser tab.
77
+ *
78
+ * @module
79
+ */ export * from "./trace.js";
80
+ export * from "./write.js";
81
+ export * from "./registry.js";
82
+ export * from "./pool.js";
83
+ export * from "./lease.js";
84
+ export * from "./provisional.js";
85
+ export { type Listed, WORKER, type Worker } from "./worker.js";
86
+ export * from "./expire.js";
87
+ export { effectInvocation, effectRetry, enqueue, owe } from "./enqueue.js";
88
+ export { firstPending } from "./ready.js";
89
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EC,GAED,2BAA0B;AAC1B,2BAA0B;AAC1B,8BAA6B;AAC7B,0BAAyB;AACzB,2BAA0B;AAC1B,iCAAgC;AAChC,SAAS,KAAK,MAAM,EAAE,MAAM,EAAE,KAAK,MAAM,sBAAqB;AAE9D,4BAA2B;AAE3B,SAAS,gBAAgB,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,uBAAsB;AAC1E,SAAS,YAAY,qBAAoB"}
@@ -0,0 +1,48 @@
1
+ /** A failure that lasts: since when, the cause it fails by where the caller
2
+ * names one, and whether its lasting has been reported. */ export type Outage = {
3
+ since: number;
4
+ cause?: string;
5
+ told?: true;
6
+ };
7
+ /** What one failure makes of the outage it met. */ export type Failing = {
8
+ /** the outage it started or rides on in; the one it met while nothing
9
+ * changed */ outage: Outage;
10
+ /** it started the outage, or failed by a cause other than the one before */ fresh: boolean;
11
+ /** how long the outage has lasted, the one time a failure finds it at
12
+ * `limit` or past it */ stayed?: number;
13
+ };
14
+ /**
15
+ * A failure at `now`. Met with no outage, it starts one; else it rides on in
16
+ * it, keeping its `since`. A `cause` other than the outage's is fresh, as a
17
+ * new bug is; without one, the outage keeps its own. An outage a failure
18
+ * finds lasted `limit` (default: never) has `stayed`, once.
19
+ *
20
+ * ```ts
21
+ * import { failing } from '@yaks/effects/outage'
22
+ * import { equal } from '@yaks/testing'
23
+ * let { outage } = failing(null, 0)
24
+ * equal(failing(null, 0), { outage: { since: 0 }, fresh: true })
25
+ * equal(failing(outage, 60_000, { limit: 300_000 }), { outage, fresh: false })
26
+ * equal(failing(outage, 300_000, { limit: 300_000 }), {
27
+ * outage: { since: 0, told: true },
28
+ * fresh: false,
29
+ * stayed: 300_000,
30
+ * })
31
+ * equal(failing({ since: 0, cause: 'Error: a' }, 9, { cause: 'Error: b' }), {
32
+ * outage: { since: 0, cause: 'Error: b' },
33
+ * fresh: true,
34
+ * })
35
+ * ```
36
+ */ export declare let failing: (outage: Outage | null | undefined, now: number, _dts_1: never) => Failing;
37
+ /**
38
+ * An answer at `now`: how long the outage it ends had lasted, where it met
39
+ * one.
40
+ *
41
+ * ```ts
42
+ * import { answered } from '@yaks/effects/outage'
43
+ * import { equal } from '@yaks/testing'
44
+ * equal(answered({ since: 1_000 }, 91_000), 90_000)
45
+ * equal(answered(null, 91_000), undefined)
46
+ * ```
47
+ */ export declare let answered: (outage: Outage | null | undefined, now: number) => number | undefined;
48
+ //# sourceMappingURL=outage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outage.d.ts","sources":["../outage.ts"],"names":[],"mappings":"AAYA;yDACyD,GACzD,YAAY;EAAW,OAAO,MAAM;EAAE,QAAQ,MAAM;EAAE,OAAO,IAAI;;AAEjE,iDAAiD,GACjD,YAAY;EACV;aACW,GACX,QAAQ;EACR,0EAA0E,GAC1E,OAAO,OAAO;EACd;wBACsB,GACtB,SAAS,MAAM;;AAGjB;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,YAAI,UACT,QAAQ,SAAS,IAAI,GAAG,SAAS,EACjC,KAAK,MAAM,EACX,kBACC,QAYF;AAED;;;;;;;;;;CAUC,GACD,OAAO,YAAI,WACT,QAAQ,SAAS,IAAI,GAAG,SAAS,EACjC,KAAK,MAAM,KACV,MAAM,GAAG,SAAS,CAA2C"}
@@ -0,0 +1,148 @@
1
+ import type { Access, Comp, Eid, HookContext, Tx } from "@yaks/graph";
2
+ import { type Clock } from "@yaks/fp";
3
+ import type { Report, Slot } from "./registry.js";
4
+ import type { Event } from "./trace.js";
5
+ import type { Write } from "./write.js";
6
+ export { effectDoc } from "./docs.js";
7
+ /** The pool's component, by the name ./vocab.json declares it. */ export declare let EFFECT: string;
8
+ /** How many of a ranked fifo queue's oldest runs its rank orders. */ export declare let QUEUE: number;
9
+ /** The most attempts a run gets where its declaration does not say: the
10
+ * first, and two more. */ export declare let TRIES: number;
11
+ /** How long after the nth attempt the next one falls due: a second, doubling,
12
+ * and never more than five minutes apart.
13
+ *
14
+ * ```ts
15
+ * import { backoff } from '@yaks/effects'
16
+ *
17
+ * [1, 2, 3, 10].map(backoff) // [1000, 2000, 4000, 300000]
18
+ * ```
19
+ */ export { backoff } from "@yaks/fp";
20
+ /** A run the pool started, as its handler sees it. */ export type Attempt = {
21
+ /** Whether this attempt is the run's last: if it fails now, it is left
22
+ * failed, so what the handler records about the failure is what stands. */ last: () => boolean;
23
+ /** Wait for a dependency without spending an attempt. The same run remains
24
+ * pending for at least this delay, with the reason alongside it. */ defer?: (delay: number, reason?: string) => Promise<void>;
25
+ /** The run got somewhere: a failure after this counts as its first attempt,
26
+ * not one more in a row. For a run that does many steps, where one success
27
+ * should give the next failure its full tries back. */ progressed: () => Promise<void>;
28
+ /** Retry a local completion without replaying the handler's external work.
29
+ * Uses this run's remaining tries and backoff without releasing the run,
30
+ * until the worker leaves: a failure after that is thrown, and the run goes
31
+ * back to the pool with the tries it has left. */ retry?: <T>(body: () => Promise<T>) => Promise<T>;
32
+ };
33
+ /** The longest a worker waits between passes (ms): how soon a run another
34
+ * process wrote is picked up when nothing hears it land. */ export declare let CAP: number;
35
+ /** How late a worker's turn may come back (ms) and it still take more runs:
36
+ * past this, its event loop is full. */ export declare let LATE: number;
37
+ /** What every worker's presence lease is named under: `@yaks/effects/<eid>`. */ export declare let POOL: string;
38
+ /** How a pool is worked. */ export type PoolOpts = {
39
+ /** One process exclusively owns this store (for example a Durable Object).
40
+ * Drain recorded runs without claims, presence leases, or expiration
41
+ * duties. Persist attempts and outcomes for crash recovery and retries,
42
+ * but for a start-up run started at once, whose recovery is the host's
43
+ * pass and which writes only a failure. Never enable this for a shared box
44
+ * store. */ singleOwner?: boolean;
45
+ /** When start-up runs are owed: on joining the pool (`join`, the default
46
+ * for shared workers), or only when the host calls startup (`manual`, the
47
+ * default for single-owner stores). */ startup?: 'join' | 'manual';
48
+ /** Effects explicitly disabled by this configuration, whose unclaimed runs owe no work. */ disabled?: string[];
49
+ /** who this process is: what its claims and its presence lease name. A
50
+ * worker that names nobody claims under a fresh id and holds no presence
51
+ * lease, since a lease's holder is an entity */ owner: Eid;
52
+ /** Maximum handlers this worker runs together (default: no bound but its
53
+ * event loop, {@link LATE}). */ max?: number;
54
+ /** Ask the host to wake after a commit owes work or a full pool frees a slot. */ nudge?: () => void;
55
+ /** Positive integer maximum candidates examined per pass, including fresh
56
+ * start-up admission (default: 32). */ page?: number;
57
+ /** The code version this process runs (a Worker version's id): what a run
58
+ * records as its attempt starts, so one cut off by a deploy runs again as
59
+ * the same attempt while one whose process crashed under the same code
60
+ * spends one. Without it, every interruption spends an attempt. */ version?: string;
61
+ /** Leave committed runs for work() instead of starting them on the writer. */ defer?: boolean;
62
+ /** how long a claim holds, in milliseconds (default: 60_000) */ lease?: number;
63
+ /** the most attempts a run gets where its declaration says none (default:
64
+ * {@link TRIES}) */ tries?: number;
65
+ /** how long after the nth attempt the next is due, in milliseconds
66
+ * (default: {@link backoff}) */ backoff?: (attempts: number) => number;
67
+ /** the time the pool keeps, in milliseconds, and the timers it waits on:
68
+ * a retry's backoff, the turn and the nap between passes, a claim's renewal
69
+ * (default: the runtime's, @yaks/fp `system`) */ clock?: Clock;
70
+ /** ids for the rows it writes (default: `crypto.randomUUID()`) */ mint?: () => Eid;
71
+ /** whether a process is known to be over (@yaks/process `gone`), so its
72
+ * presence need not be waited out. Ending processes release their claims;
73
+ * otherwise claims recover when their leases expire. */ gone?: (holder: Eid) => boolean | Promise<boolean>;
74
+ /** The CPU time this process has spent so far, in ms (`process.cpuUsage`,
75
+ * user and system together): a worker that stays says from it how busy its
76
+ * process is. Without it, a worker says nothing of its CPU. */ cpu?: () => number;
77
+ /** Hear the runs another process commits soon after they land (@yaks/sqlite
78
+ * `Store.watch` of the `effect` component): `heard` is called, and a
79
+ * worker that stays passes at once instead of at the next pass, up to
80
+ * {@link CAP} away. Answers a stop. */ watch?: (heard: () => void) => () => void;
81
+ /** Make the pool's write of how a run ended, where the storage would
82
+ * refuse it for a while (@yaks/durable-object `Ceiling.free`): a run that
83
+ * finished and could not say so would run again. Without it the write is
84
+ * made as any other. */ free?: <T>(write: () => Promise<T>) => Promise<T>;
85
+ /** Run the pool's work apart from whatever started it: a request's ambient
86
+ * context (a Worker's count of its round trips) does not reach the runs a
87
+ * write nudged. Every start of the pool goes through it. Without it the
88
+ * work runs where it was called. */ apart?: <T>(work: () => T) => T;
89
+ };
90
+ /** A run this process claimed as it wrote it, to start after the commit. */ export type Owed = {
91
+ eid: Eid;
92
+ row: Comp;
93
+ };
94
+ /** What the pool is given by the registry it serves. */ export type Ctx = {
95
+ /** every registration, declared and observed */ slots: () => Slot[];
96
+ /** the write callback a run writes through, a generation on */ writer: (gen: number, context?: HookContext) => Write;
97
+ report: Report;
98
+ };
99
+ /** Work requested by one host invocation. */ export type WorkOpts = {
100
+ /** Maximum discovery passes; omitted, drain until nothing is left to start. */ passes?: number;
101
+ /** A drain starts another bounded pass only while the host has capacity. */ while?: () => boolean;
102
+ /** The instant (ms, the pool's clock) a drain stops starting runs: what it
103
+ * started goes on, and what is owed waits for the host's next call. */ until?: number;
104
+ /** Owe fresh start-up runs and start those fitting the worker's free slots. */ startup?: boolean;
105
+ };
106
+ /** The pool over one registry: what a commit owes, and the worker. */ export type Pool = {
107
+ /** Write down the runs a batch owes, inside its transaction — claimed by
108
+ * this process where it works the pool and can run them. Returns those. */ owe: (tx: Tx, found: [Slot, Event][], gen: number) => Owed[] | Promise<Owed[]>;
109
+ /** Start what this process claimed as it wrote it, once the commit is
110
+ * done. */ start: (owed: Owed[]) => void;
111
+ /** Persist handled start-up runs without joining or draining the pool.
112
+ * Each call owes a fresh run, targeting owner; the host chooses when.
113
+ * A failed write rejects so the host can retry its start-up pass. */ startup: (g: Access) => Promise<void>;
114
+ /** Work the pool: with a live signal, until it aborts; with an aborted
115
+ * one, pass after pass until nothing is left to start, giving way to the
116
+ * host between them — and none at all where a process that stays up is
117
+ * already working it. Repeated live calls share the current worker; its
118
+ * first signal owns its lifetime. A finite drain answers whether it
119
+ * admitted or settled any work. */ work: (g: Access, signal?: AbortSignal, options?: number | WorkOpts) => Promise<boolean>;
120
+ /** Look again now, rather than at the next pass: what a thread beside this
121
+ * one says after it wrote runs down (./registry.ts `nudge`). */ wake: () => void;
122
+ /** Settles once every run started here has, and a worker whose signal
123
+ * aborted has stopped, keeping their claims while it waits. */ idle: () => Promise<void>;
124
+ /** Leave the pool: claim nothing more — what this process commits from
125
+ * now on is left for the others — and settle what was started. */ stop: () => Promise<void>;
126
+ /** Set the earliest takeover of unfinished claims before a forced process
127
+ * exit. The caller must have stopped admission and exit before `at`. */ handoff: (at: number) => Promise<void>;
128
+ /** The runs going in this process, oldest first. */ running: () => Run[];
129
+ /** When the soonest run this process can take falls due (ms, the pool's
130
+ * clock): `now` when one is due already, null when none is owed. What a
131
+ * host that sleeps between passes sets its wake by. */ next: (g: Access, now?: number) => Promise<number | null>;
132
+ };
133
+ /** A run going in this process: its row, what it is, and when it started
134
+ * (ms, the pool's clock). */ export type Run = {
135
+ eid: Eid;
136
+ handler: string;
137
+ target: Eid;
138
+ since: number;
139
+ };
140
+ /** Whether a process that stays up is working the pool over `g`: a presence
141
+ * lease other than `except`'s, still standing, held by a process not known
142
+ * to be gone. */ export declare let working: (g: Access, o?: {
143
+ /** the asking process, whose own presence does not count */ except?: Eid;
144
+ /** the clock, in milliseconds (default: `Date.now()`) */ now?: number;
145
+ gone?: PoolOpts['gone'];
146
+ }) => Promise<boolean>;
147
+ /** The pool over one registry: what a commit owes, and the worker. */ export declare let pool: (ctx: Ctx, opts?: Partial<PoolOpts>) => Pool;
148
+ //# sourceMappingURL=pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool.d.ts","sources":["../pool.ts"],"names":[],"mappings":"AA2GA,cACE,MAAM,EAGN,IAAI,EACJ,G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AAQ;EAAK,OAAO,MAAM;;AAEzE;;eAEe,GACf,OAAO,YAAI,UACT,GAAG,QACH;EACE,0DAA0D,GAC1D,SAAS;EACT,uDAAuD,GACvD,MAAM,MAAM;EACZ,OAAO,SAAS;MAEjB,QAAQ,OAAO,EAcjB;AA8BD,oEAAoE,GACpE,OAAO,YAAI,OAAQ,KAAK,KAAK,OAAM,QAAQ,cAAiB,KAkpC3D"}
@@ -0,0 +1,8 @@
1
+ import { type VocabDoc } from "@yaks/vocab/runtime";
2
+ /** The mark's component, by the name ./vocab.json declares it. */ export declare let PROVISIONAL: string;
3
+ /**
4
+ * The mark on its own, for a vocabulary that wants it without the pool's
5
+ * rows: `loadVocab([provisionalDoc, ...mine])`. {@link effectDoc} carries it
6
+ * too, so a host loads one or the other, never both.
7
+ */ export declare let provisionalDoc: VocabDoc;
8
+ //# sourceMappingURL=provisional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provisional.d.ts","sources":["../provisional.ts"],"names":[],"mappings":"AAUA,SAAe,KAAK,QAAQ,mCAAwC;AAGpE,gEAAgE,GAChE,OAAO,YAAI,oBAA2B;AAEtC;;;;CAIC,GACD,OAAO,YAAI,gBAAgB,SAI1B"}
@@ -0,0 +1,3 @@
1
+ import type { Access, Bundle } from "@yaks/graph";
2
+ /** The first outstanding run in request order, even if held or deferred. */ export declare let firstPending: (g: Pick<Access, 'read'>, handler: string) => Promise<Bundle | undefined>;
3
+ //# sourceMappingURL=ready.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ready.d.ts","sources":["../ready.ts"],"names":[],"mappings":"AAEA,cAAc,MAAM,EAAE,MAAM,2BAAgC;AAe5D,0EAA0E,GAC1E,OAAO,YAAI,eACT,GAAG,KAAK,QAAQ,SAChB,SAAS,MAAM,KACd,QAAQ,SAAS,SAAS,EAStB"}
@@ -0,0 +1,17 @@
1
+ import type { Plugin } from "@yaks/graph";
2
+ import type { Handler } from "./registry.js";
3
+ /** What an observer says about itself. */ export type Policy = {
4
+ /** What it does, available from registry introspection. */ doc?: string;
5
+ /** Additional reads to gather for it before the batch commits. */ wants?: Plugin['wants'];
6
+ };
7
+ /** A component's related observers, registered and documented together. */ export type Registration = Policy & {
8
+ /** The component appeared. */ created?: Handler;
9
+ /** A patch carried one of these properties. */ changed?: Record<string, Handler>;
10
+ /** The component went away. */ removed?: Handler;
11
+ };
12
+ /** One entry in the registry's documentation, derived from its slots. */ export type Description = {
13
+ comp: string;
14
+ hooks: string[];
15
+ doc?: string;
16
+ };
17
+ //# sourceMappingURL=registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registration.d.ts","sources":["../registration.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,2BAAgC;AACpD,cAAc,OAAO,wBAA6B;AAElD,wCAAwC,GACxC,YAAY;EACV,yDAAyD,GACzD,MAAM,MAAM;EACZ,gEAAgE,GAChE,QAAQ,OAAO;;AAGjB,yEAAyE,GACzE,YAAY,eAAe;EACzB,4BAA4B,GAC5B,UAAU;EACV,6CAA6C,GAC7C,UAAU,OAAO,MAAM,EAAE;EACzB,6BAA6B,GAC7B,UAAU;;AAGZ,uEAAuE,GACvE,YAAY;EACV,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,MAAM,MAAM"}