pipework 0.8.11 → 0.8.13

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 (97) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cli/commands/test.d.ts +1 -0
  3. package/dist/cli/commands/test.d.ts.map +1 -1
  4. package/dist/cli/commands/test.js +24 -1
  5. package/dist/cli/commands/test.js.map +1 -1
  6. package/dist/cli/index.d.ts.map +1 -1
  7. package/dist/cli/index.js +4 -0
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/core/config/namespace.d.ts +1 -0
  10. package/dist/core/config/namespace.d.ts.map +1 -1
  11. package/dist/core/config/schema.d.ts +3 -0
  12. package/dist/core/config/schema.d.ts.map +1 -1
  13. package/dist/core/config/schema.js +2 -0
  14. package/dist/core/config/schema.js.map +1 -1
  15. package/dist/data/migrate/internal-definitions.d.ts.map +1 -1
  16. package/dist/data/migrate/internal-definitions.js +4 -0
  17. package/dist/data/migrate/internal-definitions.js.map +1 -1
  18. package/dist/data/valve/artifact.d.ts +18 -0
  19. package/dist/data/valve/artifact.d.ts.map +1 -0
  20. package/dist/data/valve/artifact.js +15 -0
  21. package/dist/data/valve/artifact.js.map +1 -0
  22. package/dist/data/valve/contract-diff.d.ts +15 -0
  23. package/dist/data/valve/contract-diff.d.ts.map +1 -0
  24. package/dist/data/valve/contract-diff.js +12 -0
  25. package/dist/data/valve/contract-diff.js.map +1 -0
  26. package/dist/data/valve/cross.d.ts +15 -0
  27. package/dist/data/valve/cross.d.ts.map +1 -0
  28. package/dist/data/valve/cross.js +48 -0
  29. package/dist/data/valve/cross.js.map +1 -0
  30. package/dist/data/valve/crossing-ledger.d.ts +24 -0
  31. package/dist/data/valve/crossing-ledger.d.ts.map +1 -0
  32. package/dist/data/valve/crossing-ledger.js +38 -0
  33. package/dist/data/valve/crossing-ledger.js.map +1 -0
  34. package/dist/data/valve/decision.d.ts +29 -0
  35. package/dist/data/valve/decision.d.ts.map +1 -0
  36. package/dist/data/valve/decision.js +19 -0
  37. package/dist/data/valve/decision.js.map +1 -0
  38. package/dist/data/valve/durable-crossing.d.ts +25 -0
  39. package/dist/data/valve/durable-crossing.d.ts.map +1 -0
  40. package/dist/data/valve/durable-crossing.js +32 -0
  41. package/dist/data/valve/durable-crossing.js.map +1 -0
  42. package/dist/data/valve/execute-crossing.d.ts +17 -0
  43. package/dist/data/valve/execute-crossing.d.ts.map +1 -0
  44. package/dist/data/valve/execute-crossing.js +58 -0
  45. package/dist/data/valve/execute-crossing.js.map +1 -0
  46. package/dist/data/valve/faucet.d.ts +18 -0
  47. package/dist/data/valve/faucet.d.ts.map +1 -0
  48. package/dist/data/valve/faucet.js +34 -0
  49. package/dist/data/valve/faucet.js.map +1 -0
  50. package/dist/data/valve/gate.d.ts +28 -0
  51. package/dist/data/valve/gate.d.ts.map +1 -0
  52. package/dist/data/valve/gate.js +74 -0
  53. package/dist/data/valve/gate.js.map +1 -0
  54. package/dist/data/valve/graph.d.ts +28 -0
  55. package/dist/data/valve/graph.d.ts.map +1 -0
  56. package/dist/data/valve/graph.js +43 -0
  57. package/dist/data/valve/graph.js.map +1 -0
  58. package/dist/data/valve/index.d.ts +24 -0
  59. package/dist/data/valve/index.d.ts.map +1 -0
  60. package/dist/data/valve/index.js +14 -0
  61. package/dist/data/valve/index.js.map +1 -0
  62. package/dist/data/valve/namespace.d.ts +57 -0
  63. package/dist/data/valve/namespace.d.ts.map +1 -0
  64. package/dist/data/valve/namespace.js +57 -0
  65. package/dist/data/valve/namespace.js.map +1 -0
  66. package/dist/data/valve/registry.d.ts +14 -0
  67. package/dist/data/valve/registry.d.ts.map +1 -0
  68. package/dist/data/valve/registry.js +41 -0
  69. package/dist/data/valve/registry.js.map +1 -0
  70. package/dist/data/valve/schema/valve-crossing-fields.d.ts +37 -0
  71. package/dist/data/valve/schema/valve-crossing-fields.d.ts.map +1 -0
  72. package/dist/data/valve/schema/valve-crossing-fields.js +22 -0
  73. package/dist/data/valve/schema/valve-crossing-fields.js.map +1 -0
  74. package/dist/data/valve/schema/valve-crossing.d.ts +37 -0
  75. package/dist/data/valve/schema/valve-crossing.d.ts.map +1 -0
  76. package/dist/data/valve/schema/valve-crossing.js +8 -0
  77. package/dist/data/valve/schema/valve-crossing.js.map +1 -0
  78. package/dist/data/valve/supply.d.ts +33 -0
  79. package/dist/data/valve/supply.d.ts.map +1 -0
  80. package/dist/data/valve/supply.js +96 -0
  81. package/dist/data/valve/supply.js.map +1 -0
  82. package/dist/data/valve/types.d.ts +150 -0
  83. package/dist/data/valve/types.d.ts.map +1 -0
  84. package/dist/data/valve/types.js +2 -0
  85. package/dist/data/valve/types.js.map +1 -0
  86. package/dist/index.d.ts +2 -0
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +1 -0
  89. package/dist/index.js.map +1 -1
  90. package/dist/test/reap.d.ts +33 -0
  91. package/dist/test/reap.d.ts.map +1 -0
  92. package/dist/test/reap.js +117 -0
  93. package/dist/test/reap.js.map +1 -0
  94. package/dist/test/setup.d.ts.map +1 -1
  95. package/dist/test/setup.js +49 -8
  96. package/dist/test/setup.js.map +1 -1
  97. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The decision outcome — the load-bearing seam of the transition-gate form
3
+ * (#307 field 13). A gate's `.decision()` hook returns one of three branches.
4
+ * The three-way partition is fixed here by the primitive; the business verdict
5
+ * that *picks* a branch is consumer-silo application code.
6
+ */
7
+ /** Cross the valve: deliver `payload` to the consumer. */
8
+ export function cross(payload) {
9
+ return { kind: 'cross', payload };
10
+ }
11
+ /** Hold the crossing: it enters a provisional, reviewable state carrying `reason`. */
12
+ export function held(reason) {
13
+ return { kind: 'held', reason };
14
+ }
15
+ /** Evaluation failed: a retryable, dead-letterable outcome — never a thrown exception. */
16
+ export function failed(error) {
17
+ return { kind: 'failed', error };
18
+ }
19
+ //# sourceMappingURL=decision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision.js","sourceRoot":"","sources":["../../../src/data/valve/decision.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH,0DAA0D;AAC1D,MAAM,UAAU,KAAK,CAAW,OAAiB;IAC/C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AACnC,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,IAAI,CAAU,MAAe;IAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AACjC,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,MAAM,CAAC,KAAY;IACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;AAClC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { DB } from '../db/namespace.js';
2
+ import type { Queue } from '../../async/jobs/queue.js';
3
+ import type { CrossingResult } from './types.js';
4
+ /** Job type for a durable valve crossing. */
5
+ export declare const VALVE_CROSSING_JOB_TYPE = "pipework:valve-crossing";
6
+ /** The payload of a durable-crossing job. */
7
+ export interface CrossingJobPayload {
8
+ readonly valve: string;
9
+ readonly source: unknown;
10
+ }
11
+ /**
12
+ * Enqueue a handoff crossing to run durably. The job queue retries it with
13
+ * backoff and dead-letters it on retry exhaustion — failure-to-cross becomes a
14
+ * terminal job outcome, not an exception that vanishes.
15
+ */
16
+ export declare function enqueueCrossing(queue: Queue, db: DB, valve: string, source: unknown): Promise<string>;
17
+ /**
18
+ * The job-handler body for a durable crossing. Wire it into a worker — e.g.
19
+ * `fitting().job(VALVE_CROSSING_JOB_TYPE).fit(({ input, db }) => runCrossingJob(input, db))`.
20
+ * The valve must be registered in the worker process; the crossing runs
21
+ * recorded and idempotent on the job's transaction. A throw fails the job,
22
+ * which the queue retries and finally dead-letters.
23
+ */
24
+ export declare function runCrossingJob(payload: CrossingJobPayload, tx: DB): Promise<CrossingResult>;
25
+ //# sourceMappingURL=durable-crossing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-crossing.d.ts","sourceRoot":"","sources":["../../../src/data/valve/durable-crossing.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,YAAY,CAAA;AAElE,6CAA6C;AAC7C,eAAO,MAAM,uBAAuB,4BAA4B,CAAA;AAEhE,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACzB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,CAAC,CAGjB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAcjG"}
@@ -0,0 +1,32 @@
1
+ import { getValve } from './registry.js';
2
+ import { executeSupplyCrossing } from './execute-crossing.js';
3
+ /** Job type for a durable valve crossing. */
4
+ export const VALVE_CROSSING_JOB_TYPE = 'pipework:valve-crossing';
5
+ /**
6
+ * Enqueue a handoff crossing to run durably. The job queue retries it with
7
+ * backoff and dead-letters it on retry exhaustion — failure-to-cross becomes a
8
+ * terminal job outcome, not an exception that vanishes.
9
+ */
10
+ export async function enqueueCrossing(queue, db, valve, source) {
11
+ const payload = { valve, source };
12
+ return queue.enqueue(db, { type: VALVE_CROSSING_JOB_TYPE, payload });
13
+ }
14
+ /**
15
+ * The job-handler body for a durable crossing. Wire it into a worker — e.g.
16
+ * `fitting().job(VALVE_CROSSING_JOB_TYPE).fit(({ input, db }) => runCrossingJob(input, db))`.
17
+ * The valve must be registered in the worker process; the crossing runs
18
+ * recorded and idempotent on the job's transaction. A throw fails the job,
19
+ * which the queue retries and finally dead-letters.
20
+ */
21
+ export async function runCrossingJob(payload, tx) {
22
+ const definition = getValve(payload.valve);
23
+ if (definition === undefined) {
24
+ throw new Error(`[pipework] Durable crossing names an unregistered valve: "${payload.valve}".\n\n` +
25
+ ' The valve declaration must be imported in the worker process so it registers.\n');
26
+ }
27
+ if (definition.kind !== 'handoff') {
28
+ throw new Error(`[pipework] Durable crossing supports handoff valves; "${payload.valve}" is a ${definition.kind}.\n`);
29
+ }
30
+ return executeSupplyCrossing(definition, payload.source, tx);
31
+ }
32
+ //# sourceMappingURL=durable-crossing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-crossing.js","sourceRoot":"","sources":["../../../src/data/valve/durable-crossing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAK7D,6CAA6C;AAC7C,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAA;AAQhE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAY,EACZ,EAAM,EACN,KAAa,EACb,MAAe;IAEf,MAAM,OAAO,GAAuB,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,CAAC,CAAA;AACtE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAA2B,EAAE,EAAM;IACtE,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC1C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,6DAA6D,OAAO,CAAC,KAAK,QAAQ;YAClF,mFAAmF,CACpF,CAAA;IACH,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,yDAAyD,OAAO,CAAC,KAAK,UAAU,UAAU,CAAC,IAAI,KAAK,CACrG,CAAA;IACH,CAAC;IACD,OAAO,qBAAqB,CAAC,UAAgD,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACpG,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { DB } from '../db/namespace.js';
2
+ import type { CrossingResult, GateCrossingResult, GateDefinition, SupplyDefinition } from './types.js';
3
+ /**
4
+ * Execute a handoff crossing with idempotency and provenance, on the caller's
5
+ * transaction. If the supply declares an idempotency key and a `crossed` row
6
+ * already exists for it, the crossing is skipped — its effect already landed.
7
+ * Otherwise the crossing runs and its outcome is appended to the ledger
8
+ * atomically with it.
9
+ */
10
+ export declare function executeSupplyCrossing<TSource, TPayload>(definition: SupplyDefinition<TSource, TPayload>, source: TSource, tx: DB): Promise<CrossingResult>;
11
+ /**
12
+ * Execute a transition-gate crossing with provenance. Each fanned-out crossing
13
+ * — crossed, held, or failed — is appended to the ledger as its own row, on the
14
+ * caller's transaction.
15
+ */
16
+ export declare function executeGateCrossing<TEvent>(definition: GateDefinition<TEvent>, event: TEvent, context: Readonly<Record<string, unknown>>, tx: DB): Promise<readonly GateCrossingResult[]>;
17
+ //# sourceMappingURL=execute-crossing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-crossing.d.ts","sourceRoot":"","sources":["../../../src/data/valve/execute-crossing.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EACjB,MAAM,YAAY,CAAA;AAiBnB;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAC3D,UAAU,EAAE,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAC/C,MAAM,EAAE,OAAO,EACf,EAAE,EAAE,EAAE,GACL,OAAO,CAAC,cAAc,CAAC,CAezB;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAC9C,UAAU,EAAE,cAAc,CAAC,MAAM,CAAC,EAClC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1C,EAAE,EAAE,EAAE,GACL,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC,CAaxC"}
@@ -0,0 +1,58 @@
1
+ import { crossSupply, crossGate } from './cross.js';
2
+ import { recordCrossing, findCrossing } from './crossing-ledger.js';
3
+ function lineageOf(definition, source) {
4
+ if (definition.lineageField === undefined)
5
+ return null;
6
+ const value = source[definition.lineageField];
7
+ return typeof value === 'string' ? value : null;
8
+ }
9
+ function detailOf(result) {
10
+ if (result.kind === 'held')
11
+ return { reason: result.reason };
12
+ if (result.kind === 'failed')
13
+ return { error: result.error.message };
14
+ return null;
15
+ }
16
+ /**
17
+ * Execute a handoff crossing with idempotency and provenance, on the caller's
18
+ * transaction. If the supply declares an idempotency key and a `crossed` row
19
+ * already exists for it, the crossing is skipped — its effect already landed.
20
+ * Otherwise the crossing runs and its outcome is appended to the ledger
21
+ * atomically with it.
22
+ */
23
+ export async function executeSupplyCrossing(definition, source, tx) {
24
+ const key = definition.idempotentBy !== undefined ? definition.idempotentBy(source) : null;
25
+ if (key !== null && await findCrossing(tx, definition.name, key)) {
26
+ return { kind: 'skipped' };
27
+ }
28
+ const result = await crossSupply(definition, source, tx);
29
+ await recordCrossing(tx, {
30
+ valve: definition.name,
31
+ idempotencyKey: key,
32
+ outcome: result.kind,
33
+ payload: result.kind === 'crossed' ? result.payload : null,
34
+ detail: null,
35
+ lineageId: lineageOf(definition, source),
36
+ });
37
+ return result;
38
+ }
39
+ /**
40
+ * Execute a transition-gate crossing with provenance. Each fanned-out crossing
41
+ * — crossed, held, or failed — is appended to the ledger as its own row, on the
42
+ * caller's transaction.
43
+ */
44
+ export async function executeGateCrossing(definition, event, context, tx) {
45
+ const results = await crossGate(definition, event, context);
46
+ for (const result of results) {
47
+ await recordCrossing(tx, {
48
+ valve: definition.name,
49
+ idempotencyKey: null,
50
+ outcome: result.kind,
51
+ payload: result.kind === 'crossed' ? result.payload : null,
52
+ detail: detailOf(result),
53
+ lineageId: null,
54
+ });
55
+ }
56
+ return results;
57
+ }
58
+ //# sourceMappingURL=execute-crossing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-crossing.js","sourceRoot":"","sources":["../../../src/data/valve/execute-crossing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AASnE,SAAS,SAAS,CAChB,UAA+C,EAC/C,MAAe;IAEf,IAAI,UAAU,CAAC,YAAY,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IACtD,MAAM,KAAK,GAAI,MAAkC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;IAC1E,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;AACjD,CAAC;AAED,SAAS,QAAQ,CAAC,MAA0B;IAC1C,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IAC5D,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAA;IACpE,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,UAA+C,EAC/C,MAAe,E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,CAAC,CAAC,CAAC,IAAI;YAC1D,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC;YACxB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { FaucetDefinition, FaucetHandler } from './types.js';
2
+ /**
3
+ * The consumer-side builder. A faucet binds to a valve by name — never to the
4
+ * producer silo — and lands every (re-validated) payload in a consumer entity.
5
+ * `.on()` is terminal: supplying the intake handler registers the faucet.
6
+ */
7
+ export interface FaucetBuilder<TPayload> {
8
+ /** The consumer entity the payload lands in. */
9
+ into(target: string): FaucetBuilder<TPayload>;
10
+ /** The intake handler. Terminal — registers the faucet and returns its definition. */
11
+ on(handler: FaucetHandler<TPayload>): FaucetDefinition<TPayload>;
12
+ }
13
+ /**
14
+ * Declare a faucet — the consumer side of a `supply -> faucet` edge. `valve` is
15
+ * the name of the producer valve this faucet consumes.
16
+ */
17
+ export declare function faucet<TPayload = unknown>(valve: string): FaucetBuilder<TPayload>;
18
+ //# sourceMappingURL=faucet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faucet.d.ts","sourceRoot":"","sources":["../../../src/data/valve/faucet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEjE;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,QAAQ;IACrC,gDAAgD;IAChD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IAC7C,sFAAsF;IACtF,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;CACjE;AAwBD;;;GAGG;AACH,wBAAgB,MAAM,CAAC,QAAQ,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,CAcjF"}
@@ -0,0 +1,34 @@
1
+ import { registerFaucet } from './registry.js';
2
+ function finalizeFaucet(state, handler) {
3
+ if (state.target === undefined) {
4
+ throw new Error(`[pipework] Faucet for valve "${state.valve}" is missing .into(...).\n\n` +
5
+ ' A faucet must declare the consumer entity its payload lands in before .on(...).\n' +
6
+ ' Example: faucet("frozen-outcome").into("ledger-entries").on(handler)\n');
7
+ }
8
+ const definition = {
9
+ valve: state.valve,
10
+ target: state.target,
11
+ handler,
12
+ };
13
+ registerFaucet(definition);
14
+ return definition;
15
+ }
16
+ /**
17
+ * Declare a faucet — the consumer side of a `supply -> faucet` edge. `valve` is
18
+ * the name of the producer valve this faucet consumes.
19
+ */
20
+ export function faucet(valve) {
21
+ const state = { valve, target: undefined };
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- the builder erases the payload generic; FaucetBuilder is the precise public surface
23
+ const builder = {
24
+ into(target) {
25
+ state.target = target;
26
+ return builder;
27
+ },
28
+ on(handler) {
29
+ return finalizeFaucet(state, handler);
30
+ },
31
+ };
32
+ return builder;
33
+ }
34
+ //# sourceMappingURL=faucet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faucet.js","sourceRoot":"","sources":["../../../src/data/valve/faucet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAoB9C,SAAS,cAAc,CAAC,KAAkB,EAAE,OAA+B;IACzE,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,gCAAgC,KAAK,CAAC,KAAK,8BAA8B;YACzE,qFAAqF;YACrF,0EAA0E,CAC3E,CAAA;IACH,CAAC;IACD,MAAM,UAAU,GAA8B;QAC5C,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO;KACR,CAAA;IACD,cAAc,CAAC,UAAU,CAAC,CAAA;IAC1B,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAqB,KAAa;IACtD,MAAM,KAAK,GAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAA;IAEvD,qJAAqJ;IACrJ,MAAM,OAAO,GAAQ;QACnB,IAAI,CAAC,MAAc;YACjB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;YACrB,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,EAAE,CAAC,OAA+B;YAChC,OAAO,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACvC,CAAC;KACF,CAAA;IACD,OAAO,OAAkC,CAAA;AAC3C,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { GateDecision, GateDefinition, GateRetraction, GateTrigger } from './types.js';
2
+ /**
3
+ * The producer-side builder for a transition-gate valve. `.on()` fixes the
4
+ * source event type; `.fanOut()` and `.decision()` are checked against it.
5
+ * `.decision()` is terminal — the async hook is the load-bearing seam, and
6
+ * supplying it registers the gate.
7
+ */
8
+ export interface GateBuilder<TEvent> {
9
+ /** The source entity and the set of triggers that fire the gate. */
10
+ on<TOnEvent = TEvent>(source: string, triggers: readonly GateTrigger[]): GateBuilder<TOnEvent>;
11
+ /** Enrichment context — context key -> inbound valve name. Fed by inbound faucets. */
12
+ context(inbound: Record<string, string>): GateBuilder<TEvent>;
13
+ /** Names the computed signals the decision may read. */
14
+ signals(names: readonly string[]): GateBuilder<TEvent>;
15
+ /** Fans one trigger out to N independently-keyed crossings. */
16
+ fanOut(items: (event: TEvent) => readonly unknown[]): GateBuilder<TEvent>;
17
+ /** Declares that a trigger supersedes and retracts the prior crossing. */
18
+ retracts(config: GateRetraction): GateBuilder<TEvent>;
19
+ /** The async decision hook. Terminal — registers the gate and returns its definition. */
20
+ decision(hook: GateDecision<TEvent>): GateDefinition<TEvent>;
21
+ }
22
+ /**
23
+ * Declare a transition-gate valve. A gate modulates a state change within one
24
+ * silo, so `silo` is both producer and consumer. Chain the anatomy and finish
25
+ * with `.decision(hook)`.
26
+ */
27
+ export declare function gate(name: string, silo: string): GateBuilder<unknown>;
28
+ //# sourceMappingURL=gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../../src/data/valve/gate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE3F;;;;;GAKG;AACH,MAAM,WAAW,WAAW,CAAC,MAAM;IACjC,oEAAoE;IACpE,EAAE,CAAC,QAAQ,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,WAAW,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC9F,sFAAsF;IACtF,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IAC7D,wDAAwD;IACxD,OAAO,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IACtD,+DAA+D;IAC/D,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,OAAO,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IACzE,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IACrD,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;CAC7D;AA6CD;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAyCrE"}
@@ -0,0 +1,74 @@
1
+ import { registerValve } from './registry.js';
2
+ function finalizeGate(state, hook) {
3
+ if (state.source === undefined || state.triggers === undefined) {
4
+ throw new Error(`[pipework] Valve "${state.name}" is missing .on(...).\n\n` +
5
+ ' A gate must declare its source entity and trigger set before .decision(...).\n' +
6
+ ' Example: gate("event-verification", "events")\n' +
7
+ ' .on("event-versions", [{ trigger: "admission" }])\n');
8
+ }
9
+ if (state.triggers.length === 0) {
10
+ throw new Error(`[pipework] Valve "${state.name}" has an empty trigger set.\n\n` +
11
+ ' .on(...) must declare at least one trigger — a gate that never fires is dead.\n');
12
+ }
13
+ const definition = {
14
+ name: state.name,
15
+ kind: 'transition-gate',
16
+ topology: { producer: state.silo, consumer: state.silo },
17
+ source: state.source,
18
+ triggers: state.triggers,
19
+ context: { ...state.context },
20
+ signals: [...state.signals],
21
+ fanOut: state.fanOut,
22
+ decision: hook,
23
+ retraction: state.retraction,
24
+ };
25
+ registerValve(definition);
26
+ return definition;
27
+ }
28
+ /**
29
+ * Declare a transition-gate valve. A gate modulates a state change within one
30
+ * silo, so `silo` is both producer and consumer. Chain the anatomy and finish
31
+ * with `.decision(hook)`.
32
+ */
33
+ export function gate(name, silo) {
34
+ const state = {
35
+ name,
36
+ silo,
37
+ source: undefined,
38
+ triggers: undefined,
39
+ context: {},
40
+ signals: [],
41
+ fanOut: undefined,
42
+ retraction: undefined,
43
+ };
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- builder type param narrows per stage; the public GateBuilder type is precise
45
+ const builder = {
46
+ on(source, triggers) {
47
+ state.source = source;
48
+ state.triggers = triggers;
49
+ return builder;
50
+ },
51
+ context(inbound) {
52
+ state.context = inbound;
53
+ return builder;
54
+ },
55
+ signals(names) {
56
+ state.signals = names;
57
+ return builder;
58
+ },
59
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- fan-out event generic erased into state; see GateState
60
+ fanOut(items) {
61
+ state.fanOut = items;
62
+ return builder;
63
+ },
64
+ retracts(config) {
65
+ state.retraction = config;
66
+ return builder;
67
+ },
68
+ decision(hook) {
69
+ return finalizeGate(state, hook);
70
+ },
71
+ };
72
+ return builder;
73
+ }
74
+ //# sourceMappingURL=gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.js","sourceRoot":"","sources":["../../../src/data/valve/gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAoC7C,SAAS,YAAY,CAAC,KAAgB,EAAE,IAA2B;IACjE,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC/D,MAAM,IAAI,KAAK,CACb,qBAAqB,KAAK,CAAC,IAAI,4BAA4B;YAC3D,kFAAkF;YAClF,mDAAmD;YACnD,kEAAkE,CACnE,CAAA;IACH,CAAC;IACD,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,qBAAqB,KAAK,CAAC,IAAI,iCAAiC;YAChE,mFAAmF,CACpF,CAAA;IACH,CAAC;IACD,MAAM,UAAU,GAA4B;QAC1C,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE;QACxD,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,OAAO,EAAE,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE;QAC7B,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;QAC3B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,KAAK,CAAC,UAAU;KAC7B,CAAA;IACD,aAAa,CAAC,UAAU,CAAC,CAAA;IACzB,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,IAAY;IAC7C,MAAM,KAAK,GAAc;QACvB,IAAI;QACJ,IAAI;QACJ,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,SAAS;QACnB,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,SAAS;KACtB,CAAA;IAED,8IAA8I;IAC9I,MAAM,OAAO,GAAQ;QACnB,EAAE,CAAC,MAAc,EAAE,QAAgC;YACjD,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;YACrB,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;YACzB,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,OAAO,CAAC,OAA+B;YACrC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAA;YACvB,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,OAAO,CAAC,KAAwB;YAC9B,KAAK,CAAC,OAAO,GAAG,KAAK,CAAA;YACrB,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,wHAAwH;QACxH,MAAM,CAAC,KAAyC;YAC9C,KAAK,CAAC,MAAM,GAAG,KAAK,CAAA;YACpB,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,QAAQ,CAAC,MAAsB;YAC7B,KAAK,CAAC,UAAU,GAAG,MAAM,CAAA;YACzB,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,QAAQ,CAAC,IAA2B;YAClC,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAAA;IACD,OAAO,OAA+B,CAAA;AACxC,CAAC"}
@@ -0,0 +1,28 @@
1
+ export type ValveNodeKind = 'supply' | 'gate' | 'faucet';
2
+ export interface ValveGraphNode {
3
+ readonly id: string;
4
+ readonly kind: ValveNodeKind;
5
+ }
6
+ /**
7
+ * `crossing` — a producer delivers to a faucet. `context` — a gate's enrichment
8
+ * depends on an inbound valve. `retraction` — a superseded crossing invalidates
9
+ * the downstream it fed.
10
+ */
11
+ export type ValveEdgeKind = 'crossing' | 'context' | 'retraction';
12
+ export interface ValveGraphEdge {
13
+ readonly kind: ValveEdgeKind;
14
+ readonly from: string;
15
+ readonly to: string;
16
+ }
17
+ /** The directional data-dependency graph, distinct from the package graph. */
18
+ export interface ValveGraph {
19
+ readonly nodes: readonly ValveGraphNode[];
20
+ readonly edges: readonly ValveGraphEdge[];
21
+ }
22
+ /** Assemble the valve graph from every registered valve and faucet. */
23
+ export declare function buildValveGraph(): ValveGraph;
24
+ /** Faucet node ids fed by the named valve — the direct downstream of a crossing. */
25
+ export declare function downstreamFaucets(graph: ValveGraph, valveName: string): readonly string[];
26
+ /** Gate valve names whose enrichment context depends on the named valve. */
27
+ export declare function contextDependents(graph: ValveGraph, valveName: string): readonly string[];
28
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/data/valve/graph.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAA;AAExD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;CAC7B;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,CAAA;AAEjE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CACpB;AAED,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAA;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAA;CAC1C;AAMD,uEAAuE;AACvE,wBAAgB,eAAe,IAAI,UAAU,CA4B5C;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAIzF;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAIzF"}
@@ -0,0 +1,43 @@
1
+ import { valves, faucetsOf } from './registry.js';
2
+ function faucetNodeId(valve, target) {
3
+ return `${valve}::${target}`;
4
+ }
5
+ /** Assemble the valve graph from every registered valve and faucet. */
6
+ export function buildValveGraph() {
7
+ const nodes = new Map();
8
+ const edges = [];
9
+ for (const [name, definition] of valves()) {
10
+ nodes.set(name, { id: name, kind: definition.kind === 'transition-gate' ? 'gate' : 'supply' });
11
+ const consumers = faucetsOf(name);
12
+ for (const consumer of consumers) {
13
+ const faucetId = faucetNodeId(name, consumer.target);
14
+ nodes.set(faucetId, { id: faucetId, kind: 'faucet' });
15
+ edges.push({ kind: 'crossing', from: name, to: faucetId });
16
+ }
17
+ if (definition.kind === 'transition-gate') {
18
+ const gateDef = definition;
19
+ for (const inbound of Object.values(gateDef.context)) {
20
+ edges.push({ kind: 'context', from: name, to: inbound });
21
+ }
22
+ if (gateDef.retraction !== undefined) {
23
+ for (const consumer of consumers) {
24
+ edges.push({ kind: 'retraction', from: name, to: faucetNodeId(name, consumer.target) });
25
+ }
26
+ }
27
+ }
28
+ }
29
+ return { nodes: [...nodes.values()], edges };
30
+ }
31
+ /** Faucet node ids fed by the named valve — the direct downstream of a crossing. */
32
+ export function downstreamFaucets(graph, valveName) {
33
+ return graph.edges
34
+ .filter((edge) => edge.kind === 'crossing' && edge.from === valveName)
35
+ .map((edge) => edge.to);
36
+ }
37
+ /** Gate valve names whose enrichment context depends on the named valve. */
38
+ export function contextDependents(graph, valveName) {
39
+ return graph.edges
40
+ .filter((edge) => edge.kind === 'context' && edge.to === valveName)
41
+ .map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A;AAC7B,CAAC"}
@@ -0,0 +1,24 @@
1
+ export { cross, held, failed } from './decision.js';
2
+ export type { Crossed, Held, Failed, DecisionOutcome } from './decision.js';
3
+ export { registerValve, valves, getValve, registerFaucet, faucetsOf, clearValveRegistry, } from './registry.js';
4
+ export { supply } from './supply.js';
5
+ export type { SupplyBuilder } from './supply.js';
6
+ export { gate } from './gate.js';
7
+ export type { GateBuilder } from './gate.js';
8
+ export { faucet } from './faucet.js';
9
+ export type { FaucetBuilder } from './faucet.js';
10
+ export { crossSupply, crossGate } from './cross.js';
11
+ export { executeSupplyCrossing, executeGateCrossing } from './execute-crossing.js';
12
+ export { enqueueCrossing, runCrossingJob, VALVE_CROSSING_JOB_TYPE } from './durable-crossing.js';
13
+ export type { CrossingJobPayload } from './durable-crossing.js';
14
+ export { recordCrossing, findCrossing } from './crossing-ledger.js';
15
+ export type { CrossingRecord } from './crossing-ledger.js';
16
+ export { valveCrossing } from './schema/valve-crossing.js';
17
+ export { buildValveGraph, downstreamFaucets, contextDependents } from './graph.js';
18
+ export type { ValveGraph, ValveGraphNode, ValveGraphEdge, ValveNodeKind, ValveEdgeKind } from './graph.js';
19
+ export { diffContract } from './contract-diff.js';
20
+ export type { ContractDiff } from './contract-diff.js';
21
+ export { emitArtifact } from './artifact.js';
22
+ export type { ContractArtifact } from './artifact.js';
23
+ export type { ValveKind, ValveTopology, ValveDefinition, HandoffTrigger, CrossingMode, ContractShape, ContractPayload, SupplyDefinition, GateTrigger, GateRetraction, GateDecision, GateDefinition, FaucetHandler, FaucetDefinition, CrossedResult, BlockedResult, HeldResult, FailedResult, SkippedResult, SupplyCrossingResult, GateCrossingResult, CrossingResult, } from './types.js';
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/valve/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA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C5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,YAAY,EACV,SAAS,EACT,aAAa,EACb,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,GACf,MAAM,YAAY,CAAA"}
@@ -0,0 +1,14 @@
1
+ export { cross, held, failed } from './decision.js';
2
+ export { registerValve, valves, getValve, registerFaucet, faucetsOf, clearValveRegistry, } from './registry.js';
3
+ export { supply } from './supply.js';
4
+ export { gate } from './gate.js';
5
+ export { faucet } from './faucet.js';
6
+ export { crossSupply, crossGate } from './cross.js';
7
+ export { executeSupplyCrossing, executeGateCrossing } from './execute-crossing.js';
8
+ export { enqueueCrossing, runCrossingJob, VALVE_CROSSING_JOB_TYPE } from './durable-crossing.js';
9
+ export { recordCrossing, findCrossing } from './crossing-ledger.js';
10
+ export { valveCrossing } from './schema/valve-crossing.js';
11
+ export { buildValveGraph, downstreamFaucets, contextDependents } from './graph.js';
12
+ export { diffContract } from './contract-diff.js';
13
+ export { emitArtifact } from './artifact.js';
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data/valve/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,EACL,aAAa,EACb,MAAM,EACN,QAAQ,EACR,cAAc,EACd,SAAS,EACT,kBAAkB,GACnB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAEhG,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,57 @@
1
+ import { supply } from './supply.js';
2
+ import { gate } from './gate.js';
3
+ import { faucet } from './faucet.js';
4
+ import { cross, held, failed } from './decision.js';
5
+ import { crossSupply, crossGate } from './cross.js';
6
+ import { executeSupplyCrossing, executeGateCrossing } from './execute-crossing.js';
7
+ import { enqueueCrossing, runCrossingJob } from './durable-crossing.js';
8
+ import { buildValveGraph, downstreamFaucets, contextDependents } from './graph.js';
9
+ import { diffContract } from './contract-diff.js';
10
+ import { emitArtifact } from './artifact.js';
11
+ import { valves, getValve, faucetsOf } from './registry.js';
12
+ /** Valve namespace — typed, directional, gated boundaries between code silos. */
13
+ export declare const valve: {
14
+ /** Declare a handoff valve — the producer side of a payload crossing. */
15
+ supply: typeof supply;
16
+ /** Declare a transition-gate valve — the producer side of a gated state change. */
17
+ gate: typeof gate;
18
+ /** Declare a faucet — the consumer side of a `supply -> faucet` edge. */
19
+ faucet: typeof faucet;
20
+ /** Decision outcome: cross the valve, delivering the payload. */
21
+ cross: typeof cross;
22
+ /** Decision outcome: hold the crossing in a provisional, reviewable state. */
23
+ held: typeof held;
24
+ /** Decision outcome: evaluation failed — retryable, never a thrown exception. */
25
+ failed: typeof failed;
26
+ /** Execute a handoff crossing in the caller's transaction (unrecorded mechanics). */
27
+ crossSupply: typeof crossSupply;
28
+ /** Execute a transition-gate crossing (unrecorded mechanics). */
29
+ crossGate: typeof crossGate;
30
+ /** Execute a handoff crossing with idempotency and provenance recording. */
31
+ executeSupplyCrossing: typeof executeSupplyCrossing;
32
+ /** Execute a transition-gate crossing with provenance recording. */
33
+ executeGateCrossing: typeof executeGateCrossing;
34
+ /** Enqueue a handoff crossing to run durably as a retried, dead-letterable job. */
35
+ enqueueCrossing: typeof enqueueCrossing;
36
+ /** The durable-crossing job-handler body — wire into a worker. */
37
+ runCrossingJob: typeof runCrossingJob;
38
+ /** Job type for a durable valve crossing. */
39
+ VALVE_CROSSING_JOB_TYPE: string;
40
+ /** Assemble the directional valve graph from every registered valve and faucet. */
41
+ graph: typeof buildValveGraph;
42
+ /** The faucet nodes a valve feeds. */
43
+ downstreamFaucets: typeof downstreamFaucets;
44
+ /** The gates whose enrichment context depends on a valve. */
45
+ contextDependents: typeof contextDependents;
46
+ /** Diff a valve contract between two versions. */
47
+ diffContract: typeof diffContract;
48
+ /** Project a handoff supply to its lightweight contract artifact. */
49
+ emitArtifact: typeof emitArtifact;
50
+ /** All registered producer valves, keyed by name. */
51
+ valves: typeof valves;
52
+ /** Look up a registered valve by name. */
53
+ getValve: typeof getValve;
54
+ /** The faucets consuming a named valve. */
55
+ faucetsOf: typeof faucetsOf;
56
+ };
57
+ //# sourceMappingURL=namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/data/valve/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,cAAc,EAA2B,MAAM,uBAAuB,CAAA;AAChG,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE3D,iFAAiF;AACjF,eAAO,MAAM,KAAK;IAChB,yEAAyE;;IAEzE,mFAAmF;;IAEnF,yEAAyE;;IAEzE,iEAAiE;;IAEjE,8EAA8E;;IAE9E,iFAAiF;;IAEjF,qFAAqF;;IAErF,iEAAiE;;IAEjE,4EAA4E;;IAE5E,oEAAoE;;IAEpE,mFAAmF;;IAEnF,kEAAkE;;IAElE,6CAA6C;;IAE7C,mFAAmF;;IAEnF,sCAAsC;;IAEtC,6DAA6D;;IAE7D,kDAAkD;;IAElD,qEAAqE;;IAErE,qDAAqD;;IAErD,0CAA0C;;IAE1C,2CAA2C;;CAE5C,CAAA"}
@@ -0,0 +1,57 @@
1
+ import { supply } from './supply.js';
2
+ import { gate } from './gate.js';
3
+ import { faucet } from './faucet.js';
4
+ import { cross, held, failed } from './decision.js';
5
+ import { crossSupply, crossGate } from './cross.js';
6
+ import { executeSupplyCrossing, executeGateCrossing } from './execute-crossing.js';
7
+ import { enqueueCrossing, runCrossingJob, VALVE_CROSSING_JOB_TYPE } from './durable-crossing.js';
8
+ import { buildValveGraph, downstreamFaucets, contextDependents } from './graph.js';
9
+ import { diffContract } from './contract-diff.js';
10
+ import { emitArtifact } from './artifact.js';
11
+ import { valves, getValve, faucetsOf } from './registry.js';
12
+ /** Valve namespace — typed, directional, gated boundaries between code silos. */
13
+ export const valve = {
14
+ /** Declare a handoff valve — the producer side of a payload crossing. */
15
+ supply,
16
+ /** Declare a transition-gate valve — the producer side of a gated state change. */
17
+ gate,
18
+ /** Declare a faucet — the consumer side of a `supply -> faucet` edge. */
19
+ faucet,
20
+ /** Decision outcome: cross the valve, delivering the payload. */
21
+ cross,
22
+ /** Decision outcome: hold the crossing in a provisional, reviewable state. */
23
+ held,
24
+ /** Decision outcome: evaluation failed — retryable, never a thrown exception. */
25
+ failed,
26
+ /** Execute a handoff crossing in the caller's transaction (unrecorded mechanics). */
27
+ crossSupply,
28
+ /** Execute a transition-gate crossing (unrecorded mechanics). */
29
+ crossGate,
30
+ /** Execute a handoff crossing with idempotency and provenance recording. */
31
+ executeSupplyCrossing,
32
+ /** Execute a transition-gate crossing with provenance recording. */
33
+ executeGateCrossing,
34
+ /** Enqueue a handoff crossing to run durably as a retried, dead-letterable job. */
35
+ enqueueCrossing,
36
+ /** The durable-crossing job-handler body — wire into a worker. */
37
+ runCrossingJob,
38
+ /** Job type for a durable valve crossing. */
39
+ VALVE_CROSSING_JOB_TYPE,
40
+ /** Assemble the directional valve graph from every registered valve and faucet. */
41
+ graph: buildValveGraph,
42
+ /** The faucet nodes a valve feeds. */
43
+ downstreamFaucets,
44
+ /** The gates whose enrichment context depends on a valve. */
45
+ contextDependents,
46
+ /** Diff a valve contract between two versions. */
47
+ diffContract,
48
+ /** Project a handoff supply to its lightweight contract artifact. */
49
+ emitArtifact,
50
+ /** All registered producer valves, keyed by name. */
51
+ valves,
52
+ /** Look up a registered valve by name. */
53
+ getValve,
54
+ /** The faucets consuming a named valve. */
55
+ faucetsOf,
56
+ };
57
+ //# sourceMappingURL=namespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/data/valve/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,E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