@fabricorg/platform 1.1.0 → 1.2.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.
- package/CHANGELOG.md +46 -0
- package/README.md +20 -7
- package/dist/adapters/index.cjs +18 -6
- package/dist/adapters/index.d.cts +76 -1
- package/dist/adapters/index.d.ts +76 -1
- package/dist/adapters/index.js +1 -1
- package/dist/{chunk-YZKUEC2J.cjs → chunk-3BGFHSSK.cjs} +4 -4
- package/dist/{chunk-YZKUEC2J.cjs.map → chunk-3BGFHSSK.cjs.map} +1 -1
- package/dist/{chunk-6T6F3TNQ.cjs → chunk-3UBX7KQM.cjs} +12 -11
- package/dist/chunk-3UBX7KQM.cjs.map +1 -0
- package/dist/{chunk-53YJK3LK.js → chunk-63MYMAEX.js} +5 -4
- package/dist/chunk-63MYMAEX.js.map +1 -0
- package/dist/{chunk-OWSSGFNY.js → chunk-7GAWSUOG.js} +22 -3
- package/dist/chunk-7GAWSUOG.js.map +1 -0
- package/dist/{chunk-IFMZPLM4.js → chunk-AWP6JDD5.js} +3 -3
- package/dist/{chunk-IFMZPLM4.js.map → chunk-AWP6JDD5.js.map} +1 -1
- package/dist/{chunk-M5FGWXT3.cjs → chunk-CXR6KEKQ.cjs} +11 -10
- package/dist/chunk-CXR6KEKQ.cjs.map +1 -0
- package/dist/{chunk-3ZW5USXF.js → chunk-DTY3CHQZ.js} +24 -5
- package/dist/chunk-DTY3CHQZ.js.map +1 -0
- package/dist/chunk-IFW43ELT.cjs +331 -0
- package/dist/chunk-IFW43ELT.cjs.map +1 -0
- package/dist/{chunk-J5LS5BSI.js → chunk-JG35DT2G.js} +11 -10
- package/dist/chunk-JG35DT2G.js.map +1 -0
- package/dist/{chunk-ETONSTUW.js → chunk-LZNXUTJQ.js} +4 -3
- package/dist/chunk-LZNXUTJQ.js.map +1 -0
- package/dist/{chunk-NPVIFZQV.cjs → chunk-N2BBUKCX.cjs} +26 -4
- package/dist/chunk-N2BBUKCX.cjs.map +1 -0
- package/dist/{chunk-ANPJYXBK.cjs → chunk-TBS2S5AX.cjs} +8 -2
- package/dist/chunk-TBS2S5AX.cjs.map +1 -0
- package/dist/{chunk-A2VTSATF.cjs → chunk-UITRHBZH.cjs} +7 -6
- package/dist/chunk-UITRHBZH.cjs.map +1 -0
- package/dist/{chunk-WAI4UNWQ.cjs → chunk-WI7CWNYI.cjs} +22 -2
- package/dist/chunk-WI7CWNYI.cjs.map +1 -0
- package/dist/{chunk-3OWMPDBD.js → chunk-Y2PJLRIY.js} +8 -2
- package/dist/chunk-Y2PJLRIY.js.map +1 -0
- package/dist/chunk-ZAEVQSB5.js +326 -0
- package/dist/chunk-ZAEVQSB5.js.map +1 -0
- package/dist/governance/index.cjs +4 -4
- package/dist/governance/index.d.cts +4 -0
- package/dist/governance/index.d.ts +4 -0
- package/dist/governance/index.js +1 -1
- package/dist/index.cjs +62 -42
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/manifest/index.cjs +10 -10
- package/dist/manifest/index.d.cts +1 -0
- package/dist/manifest/index.d.ts +1 -0
- package/dist/manifest/index.js +4 -4
- package/dist/modules/index.cjs +11 -11
- package/dist/modules/index.d.cts +2 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -3
- package/dist/objects/index.cjs +8 -4
- package/dist/objects/index.d.cts +11 -1
- package/dist/objects/index.d.ts +11 -1
- package/dist/objects/index.js +1 -1
- package/dist/projections/index.cjs +5 -5
- package/dist/projections/index.d.cts +9 -1
- package/dist/projections/index.d.ts +9 -1
- package/dist/projections/index.js +1 -1
- package/dist/state-machines/index.cjs +7 -3
- package/dist/state-machines/index.d.cts +10 -1
- package/dist/state-machines/index.d.ts +10 -1
- package/dist/state-machines/index.js +1 -1
- package/dist/testing/index.cjs +5 -5
- package/dist/testing/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-3OWMPDBD.js.map +0 -1
- package/dist/chunk-3ZW5USXF.js.map +0 -1
- package/dist/chunk-53YJK3LK.js.map +0 -1
- package/dist/chunk-6T6F3TNQ.cjs.map +0 -1
- package/dist/chunk-A2VTSATF.cjs.map +0 -1
- package/dist/chunk-ANPJYXBK.cjs.map +0 -1
- package/dist/chunk-CBY6GRJP.cjs +0 -140
- package/dist/chunk-CBY6GRJP.cjs.map +0 -1
- package/dist/chunk-ETONSTUW.js.map +0 -1
- package/dist/chunk-J5LS5BSI.js.map +0 -1
- package/dist/chunk-M5FGWXT3.cjs.map +0 -1
- package/dist/chunk-NETLRKDS.js +0 -136
- package/dist/chunk-NETLRKDS.js.map +0 -1
- package/dist/chunk-NPVIFZQV.cjs.map +0 -1
- package/dist/chunk-OWSSGFNY.js.map +0 -1
- package/dist/chunk-WAI4UNWQ.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @fabricorg/platform
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ef4e3eb: Classify adapter outcomes: add additive `AdapterOutcomeKind` (`success`, `transient_failure`,
|
|
8
|
+
`permanent_failure`, `timeout`, `ambiguous`) and `AdapterOutcomeEvidence` to the portable adapter
|
|
9
|
+
contract. The retry layer now retries only transient idempotent outcomes; permanent failures,
|
|
10
|
+
timeouts, and ambiguous results are never retried. Ambiguous outcomes are routed to
|
|
11
|
+
`reconciliation_required` with durable `ExternalReconciliation` evidence and an
|
|
12
|
+
`AdapterInvocationAmbiguous` lifecycle event. Add deadline and cancellation context to
|
|
13
|
+
`AdapterExecutionContext`. Backward compatible: adapters that omit `outcome` behave as before.
|
|
14
|
+
- 293561d: Close adapter and saga correctness gaps: deliver actual deadline and AbortSignal context to adapters, require the governed Host to classify thrown adapter failures before retrying, reject contradictory successful ambiguous outcomes, reserve parent lifecycle identity prefixes, and provide a durable Platform Host parent lifecycle adapter tested through public store seams. Direct `executeWithAdapterRetry` callers retain the prior idempotent retry default when they omit a classifier.
|
|
15
|
+
- 9a145a3: Add assembly and initiating SDUI release digests to durable governance runtime
|
|
16
|
+
evidence. Hosts can attach both through trusted configuration, including a
|
|
17
|
+
per-submission release resolver, and validate digest shape before creating the
|
|
18
|
+
invocation. Composition-bound hosts verify their assembly lockfile against the
|
|
19
|
+
exact loaded capability artifacts before accepting submissions.
|
|
20
|
+
- b932767: Add portable parameter schemas and validation for projection views. Projection snapshot keys now
|
|
21
|
+
include a canonical parameter identity, generated capability and experience contracts preserve view
|
|
22
|
+
parameter schemas, and compatible snapshots continue through the explicit `upgradeSnapshot` seam.
|
|
23
|
+
- fb14d67: Execute state guards with trusted Host context, correct filtered-ledger replay semantics, make
|
|
24
|
+
dispatcher failure retryable, fail closed for unsafe saga and non-idempotent recovery paths, preserve
|
|
25
|
+
outbox consistency, and bound and redact OPA HTTP failures.
|
|
26
|
+
|
|
27
|
+
### Additional release notes
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- Add additive adapter outcome classification (`AdapterOutcomeKind`: `success`, `transient_failure`,
|
|
32
|
+
`permanent_failure`, `timeout`, `ambiguous`) and `AdapterOutcomeEvidence`. The retry layer retries
|
|
33
|
+
only transient idempotent outcomes. Add deadline and cancellation context to
|
|
34
|
+
`AdapterExecutionContext`. Backward compatible: adapters that omit `outcome` behave as before.
|
|
35
|
+
- Add `signal?: AbortSignal` to `AdapterExecutionContext` so the host can deliver a real
|
|
36
|
+
cancellation signal to adapters. Add `classifyThrownError` to `ExecuteWithRetryOptions`:
|
|
37
|
+
thrown errors are never retried without explicit classification (fail safe). Add
|
|
38
|
+
`assertAdapterOutcomeConsistency` to reject contradictory results where `success` is true
|
|
39
|
+
but the explicit `outcome` is a non-success kind.
|
|
40
|
+
- Add guard-aware state transition evaluation that fails closed on guard denial or exceptions.
|
|
41
|
+
- Clarify that projection `sequence` is a global ledger cursor and add optional
|
|
42
|
+
`subjectSequence` for sources that can prove subject-local continuity.
|
|
43
|
+
- Add portable JSON Schema validation for projection parameters and expose
|
|
44
|
+
`ViewContract.parameterSchema` for parameterized view variants.
|
|
45
|
+
- Add optional module `version` and compiler `manifestDigest` identity for
|
|
46
|
+
assembly-verified runtime registration, plus durable assembly and initiating
|
|
47
|
+
release digests in `GovernanceRuntimeEvidence`.
|
|
48
|
+
|
|
3
49
|
## 1.1.0
|
|
4
50
|
|
|
5
51
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ That's what this package gives you. Nothing more.
|
|
|
44
44
|
| `@fabricorg/platform` | Re-exports everything below |
|
|
45
45
|
| `@fabricorg/platform/actions` | `ActionDefinition`, `ActionContext`, `SagaImplementation` |
|
|
46
46
|
| `@fabricorg/platform/policies` | `PolicyEvaluator`, `PolicyContext`, code/data/hybrid evaluation |
|
|
47
|
-
| `@fabricorg/platform/state-machines` | `StateMachineDefinition`,
|
|
47
|
+
| `@fabricorg/platform/state-machines` | `StateMachineDefinition`, structural and guard-aware transition evaluation |
|
|
48
48
|
| `@fabricorg/platform/events` | `AssetEventEnvelope`, `EventTypeRegistry` |
|
|
49
49
|
| `@fabricorg/platform/projections` | Replay/snapshot framework |
|
|
50
50
|
| `@fabricorg/platform/adapters` | `AdapterRegistry`, retry + circuit-breaker |
|
|
@@ -57,10 +57,12 @@ That's what this package gives you. Nothing more.
|
|
|
57
57
|
| `@fabricorg/platform/objects` | Shared object-type contracts |
|
|
58
58
|
| `@fabricorg/platform/testing` | In-memory adapter registry, fake `ActionContext`, deterministic IDs |
|
|
59
59
|
|
|
60
|
-
Modules may publish versioned `ViewContract`s.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
Modules may publish versioned `ViewContract`s. A view may also declare a portable `parameterSchema`;
|
|
61
|
+
ProjectionHost validates those inputs and keeps each canonical parameter identity in a separate
|
|
62
|
+
snapshot. `replayView` filters declared event schema versions and requires an explicit
|
|
63
|
+
`upgradeSnapshot` function before resuming an older compatible snapshot; manifests serialize the
|
|
64
|
+
logical shape, parameter schema, and metadata but never executable functions or initial state.
|
|
65
|
+
Physical stores remain adapter concerns.
|
|
64
66
|
|
|
65
67
|
## Composing a vertical
|
|
66
68
|
|
|
@@ -105,9 +107,9 @@ An entity schema does not validate arbitrary writes through `TDb`. Persisted-rec
|
|
|
105
107
|
Every `invokeAction(id, params)` call goes through:
|
|
106
108
|
|
|
107
109
|
1. **`evaluatePolicies`** — every policy registered for the action runs (code/data/hybrid). A single `block` halts the invocation. Policies may return `guidance` (`factsUsed` + typed `correctiveActions`) so hosts can show exactly why a block happened and what the operator can do next. Corrective actions declare `kind: "invoke_action" | "navigate" | "manual"` so UIs do not guess whether a remediation is executable.
|
|
108
|
-
2. **State-machine validation** — if the action's target entity is bound to a state machine, the requested transition
|
|
110
|
+
2. **State-machine validation** — if the action's target entity is bound to a state machine, the Host reads authoritative state at the mutation boundary, validates the requested transition, and executes its guard with trusted entity, actor, parameter, invocation, and database context. A false or throwing guard fails closed.
|
|
109
111
|
3. **Handler** — `actionDef.handler(ctx, params)` runs inside a single `TDb` transaction. Handler parses its own input via its `schema` (single source of truth).
|
|
110
|
-
4. **Adapters** — for each `actionDef.adapterSteps`, the registered implementation runs via `executeWithAdapterRetry` (idempotent retry, exponential backoff, circuit breaker).
|
|
112
|
+
4. **Adapters** — for each `actionDef.adapterSteps`, the registered implementation runs via `executeWithAdapterRetry` (idempotent retry, exponential backoff, circuit breaker). Adapters may classify outcomes as `success`, `transient_failure`, `permanent_failure`, `timeout`, or `ambiguous`; only transient idempotent outcomes are retried. Ambiguous outcomes are routed to `reconciliation_required` with durable evidence.
|
|
111
113
|
5. **Events** — domain events are appended; projections derive read models on next replay.
|
|
112
114
|
6. **Completion** — invocation status is marked, telemetry emitted.
|
|
113
115
|
|
|
@@ -136,6 +138,17 @@ export const ingestSaga: SagaImplementation = async (ctx, runChild) => {
|
|
|
136
138
|
|
|
137
139
|
Your worker maps action IDs to implementations. The platform dispatches generically — no platform code references vertical action IDs.
|
|
138
140
|
|
|
141
|
+
`PlatformHost` does not execute a `kind: "saga"` definition as an atomic handler. Configure a
|
|
142
|
+
durable dispatcher and map the action to its saga implementation in the workflow worker. Direct
|
|
143
|
+
execution fails closed so a handlerless saga cannot be recorded as completed.
|
|
144
|
+
|
|
145
|
+
## Projection sequence semantics
|
|
146
|
+
|
|
147
|
+
`ReplayableAssetEvent.sequence` is the ordering cursor of the complete tenant/space ledger. A view
|
|
148
|
+
usually filters that ledger by event type and subject, so gaps in this global cursor do not prove
|
|
149
|
+
that subject events are missing. Event sources that can guarantee contiguous per-subject ordering
|
|
150
|
+
may also provide `subjectSequence`; only that explicit sequence is used for missing-event warnings.
|
|
151
|
+
|
|
139
152
|
## Portability boundary
|
|
140
153
|
|
|
141
154
|
The repository Boundary Guard scans source and packed artifacts and fails CI if any of these leak in:
|
package/dist/adapters/index.cjs
CHANGED
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkN2BBUKCX_cjs = require('../chunk-N2BBUKCX.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "AdapterRegistry", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkN2BBUKCX_cjs.AdapterRegistry; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "MissingAdapterRegistrationError", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkN2BBUKCX_cjs.MissingAdapterRegistrationError; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "assertAdapterOutcomeConsistency", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkN2BBUKCX_cjs.assertAdapterOutcomeConsistency; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "classifyAdapterOutcome", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkN2BBUKCX_cjs.classifyAdapterOutcome; }
|
|
14
22
|
});
|
|
15
23
|
Object.defineProperty(exports, "executeWithAdapterRetry", {
|
|
16
24
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkN2BBUKCX_cjs.executeWithAdapterRetry; }
|
|
18
26
|
});
|
|
19
27
|
Object.defineProperty(exports, "getRetryDelayMs", {
|
|
20
28
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkN2BBUKCX_cjs.getRetryDelayMs; }
|
|
22
30
|
});
|
|
23
31
|
Object.defineProperty(exports, "resolveAdapterRetryPolicy", {
|
|
24
32
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkN2BBUKCX_cjs.resolveAdapterRetryPolicy; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "shouldRetryAdapterOutcome", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkN2BBUKCX_cjs.shouldRetryAdapterOutcome; }
|
|
26
38
|
});
|
|
27
39
|
//# sourceMappingURL=index.cjs.map
|
|
28
40
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -7,11 +7,51 @@ interface AdapterExecutionContext {
|
|
|
7
7
|
causationId?: string;
|
|
8
8
|
attempt: number;
|
|
9
9
|
maxAttempts: number;
|
|
10
|
+
/** Epoch-millis deadline after which the adapter should abandon the call. */
|
|
11
|
+
deadlineMs?: number;
|
|
12
|
+
/** Set by the host when the invocation has been cancelled; adapters should stop work. */
|
|
13
|
+
cancelled?: boolean;
|
|
14
|
+
/** Non-secret reason the invocation was cancelled. */
|
|
15
|
+
cancellationReason?: string;
|
|
16
|
+
/**
|
|
17
|
+
* AbortSignal the host aborts when the deadline expires or the invocation is
|
|
18
|
+
* cancelled. Adapters should propagate this to underlying HTTP/database
|
|
19
|
+
* clients so in-flight work is abandoned rather than left dangling.
|
|
20
|
+
*/
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Additive classification of an adapter outcome so the retry layer can
|
|
25
|
+
* distinguish retryable transient failures from permanent rejections,
|
|
26
|
+
* timeouts, and ambiguous results that require manual reconciliation.
|
|
27
|
+
*
|
|
28
|
+
* When `outcome` is absent on an {@link AdapterExecutionResult}, the retry
|
|
29
|
+
* layer treats a non-success result as `transient_failure` for backward
|
|
30
|
+
* compatibility.
|
|
31
|
+
*/
|
|
32
|
+
type AdapterOutcomeKind = "success" | "transient_failure" | "permanent_failure" | "timeout" | "ambiguous";
|
|
33
|
+
/**
|
|
34
|
+
* Durable, non-secret evidence attached to a classified adapter outcome.
|
|
35
|
+
* Used by the host to record reconciliation evidence when an adapter returns
|
|
36
|
+
* an ambiguous result whose external effect may or may not have been applied.
|
|
37
|
+
*/
|
|
38
|
+
interface AdapterOutcomeEvidence {
|
|
39
|
+
kind: AdapterOutcomeKind;
|
|
40
|
+
reason?: string;
|
|
41
|
+
/** Opaque, non-secret reference to external operation state for reconciliation. */
|
|
42
|
+
externalReference?: string;
|
|
43
|
+
/** Whether the external effect may have been applied (true for ambiguous/timeout). */
|
|
44
|
+
effectMayHaveApplied?: boolean;
|
|
45
|
+
observedAt: Date | string;
|
|
10
46
|
}
|
|
11
47
|
interface AdapterExecutionResult {
|
|
12
48
|
success: boolean;
|
|
13
49
|
correlationId?: string;
|
|
14
50
|
error?: string;
|
|
51
|
+
/** Additive outcome classification. Omitted = infer from `success`. */
|
|
52
|
+
outcome?: AdapterOutcomeKind;
|
|
53
|
+
/** Durable evidence for ambiguous or timeout outcomes requiring reconciliation. */
|
|
54
|
+
outcomeEvidence?: AdapterOutcomeEvidence;
|
|
15
55
|
}
|
|
16
56
|
type AdapterExecutor = (input: Record<string, unknown>, context: AdapterExecutionContext) => Promise<AdapterExecutionResult>;
|
|
17
57
|
interface AdapterRetryPolicy {
|
|
@@ -64,6 +104,20 @@ interface ExecuteWithRetryOptions<T> {
|
|
|
64
104
|
execute: (attempt: number, maxAttempts: number) => Promise<T>;
|
|
65
105
|
isSuccessful: (result: T) => boolean;
|
|
66
106
|
getError: (result: T) => string | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Optional outcome classifier. When provided, the retry layer retries only
|
|
109
|
+
* `transient_failure` outcomes (and only when the policy is idempotent).
|
|
110
|
+
* `permanent_failure`, `timeout`, and `ambiguous` outcomes are never retried.
|
|
111
|
+
* When omitted, all non-success results are treated as transient (backward compatible).
|
|
112
|
+
*/
|
|
113
|
+
classifyOutcome?: (result: T) => AdapterOutcomeKind;
|
|
114
|
+
/**
|
|
115
|
+
* Optional classifier for errors thrown by the execute callback (not returned
|
|
116
|
+
* as results). When provided, the retry layer retries only `transient_failure`
|
|
117
|
+
* classifications. When omitted, thrown errors are never retried — the caller
|
|
118
|
+
* must explicitly opt into retrying a thrown failure by classifying it.
|
|
119
|
+
*/
|
|
120
|
+
classifyThrownError?: (error: unknown) => AdapterOutcomeKind;
|
|
67
121
|
sleep?: (delayMs: number) => Promise<void>;
|
|
68
122
|
onAttempt?: (attempt: AdapterAttempt<T>) => Promise<void> | void;
|
|
69
123
|
}
|
|
@@ -78,6 +132,27 @@ declare class AdapterRegistry {
|
|
|
78
132
|
}
|
|
79
133
|
declare function resolveAdapterRetryPolicy(policy: AdapterRetryPolicy | undefined, defaultIdempotent: boolean): ResolvedAdapterRetryPolicy;
|
|
80
134
|
declare function getRetryDelayMs(attempt: number, policy: ResolvedAdapterRetryPolicy): number;
|
|
135
|
+
/**
|
|
136
|
+
* Classify an {@link AdapterExecutionResult} into an {@link AdapterOutcomeKind}.
|
|
137
|
+
* When `outcome` is explicitly set, it is returned directly, after rejecting a
|
|
138
|
+
* contradictory result where `success` is true but the outcome is non-success.
|
|
139
|
+
* Otherwise a successful result maps to `success` and a failed result maps to
|
|
140
|
+
* `transient_failure` (the historical default).
|
|
141
|
+
*/
|
|
142
|
+
declare function classifyAdapterOutcome(result: AdapterExecutionResult): AdapterOutcomeKind;
|
|
143
|
+
/**
|
|
144
|
+
* Determine whether an outcome kind is retryable. Only `transient_failure`
|
|
145
|
+
* is retryable, and only when the adapter policy is idempotent. Permanent
|
|
146
|
+
* failures, timeouts, and ambiguous outcomes are never retried.
|
|
147
|
+
*/
|
|
148
|
+
declare function shouldRetryAdapterOutcome(kind: AdapterOutcomeKind, idempotent: boolean): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Reject a contradictory adapter result where `success` is true but the
|
|
151
|
+
* explicit `outcome` is a non-success kind. A successful result claiming an
|
|
152
|
+
* ambiguous, permanent, timeout, or transient outcome is a programming
|
|
153
|
+
* error — the adapter cannot have both succeeded and require reconciliation.
|
|
154
|
+
*/
|
|
155
|
+
declare function assertAdapterOutcomeConsistency(result: AdapterExecutionResult): void;
|
|
81
156
|
declare function executeWithAdapterRetry<T>(options: ExecuteWithRetryOptions<T>): Promise<T>;
|
|
82
157
|
|
|
83
|
-
export { type AdapterAttempt, type AdapterCircuitBreakerConfig, type AdapterExecutionContext, type AdapterExecutionResult, type AdapterExecutor, type AdapterImplementation, AdapterRegistry, type AdapterRetryPolicy, type ExecuteWithRetryOptions, MissingAdapterRegistrationError, type ResolvedAdapterRetryPolicy, executeWithAdapterRetry, getRetryDelayMs, resolveAdapterRetryPolicy };
|
|
158
|
+
export { type AdapterAttempt, type AdapterCircuitBreakerConfig, type AdapterExecutionContext, type AdapterExecutionResult, type AdapterExecutor, type AdapterImplementation, type AdapterOutcomeEvidence, type AdapterOutcomeKind, AdapterRegistry, type AdapterRetryPolicy, type ExecuteWithRetryOptions, MissingAdapterRegistrationError, type ResolvedAdapterRetryPolicy, assertAdapterOutcomeConsistency, classifyAdapterOutcome, executeWithAdapterRetry, getRetryDelayMs, resolveAdapterRetryPolicy, shouldRetryAdapterOutcome };
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -7,11 +7,51 @@ interface AdapterExecutionContext {
|
|
|
7
7
|
causationId?: string;
|
|
8
8
|
attempt: number;
|
|
9
9
|
maxAttempts: number;
|
|
10
|
+
/** Epoch-millis deadline after which the adapter should abandon the call. */
|
|
11
|
+
deadlineMs?: number;
|
|
12
|
+
/** Set by the host when the invocation has been cancelled; adapters should stop work. */
|
|
13
|
+
cancelled?: boolean;
|
|
14
|
+
/** Non-secret reason the invocation was cancelled. */
|
|
15
|
+
cancellationReason?: string;
|
|
16
|
+
/**
|
|
17
|
+
* AbortSignal the host aborts when the deadline expires or the invocation is
|
|
18
|
+
* cancelled. Adapters should propagate this to underlying HTTP/database
|
|
19
|
+
* clients so in-flight work is abandoned rather than left dangling.
|
|
20
|
+
*/
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Additive classification of an adapter outcome so the retry layer can
|
|
25
|
+
* distinguish retryable transient failures from permanent rejections,
|
|
26
|
+
* timeouts, and ambiguous results that require manual reconciliation.
|
|
27
|
+
*
|
|
28
|
+
* When `outcome` is absent on an {@link AdapterExecutionResult}, the retry
|
|
29
|
+
* layer treats a non-success result as `transient_failure` for backward
|
|
30
|
+
* compatibility.
|
|
31
|
+
*/
|
|
32
|
+
type AdapterOutcomeKind = "success" | "transient_failure" | "permanent_failure" | "timeout" | "ambiguous";
|
|
33
|
+
/**
|
|
34
|
+
* Durable, non-secret evidence attached to a classified adapter outcome.
|
|
35
|
+
* Used by the host to record reconciliation evidence when an adapter returns
|
|
36
|
+
* an ambiguous result whose external effect may or may not have been applied.
|
|
37
|
+
*/
|
|
38
|
+
interface AdapterOutcomeEvidence {
|
|
39
|
+
kind: AdapterOutcomeKind;
|
|
40
|
+
reason?: string;
|
|
41
|
+
/** Opaque, non-secret reference to external operation state for reconciliation. */
|
|
42
|
+
externalReference?: string;
|
|
43
|
+
/** Whether the external effect may have been applied (true for ambiguous/timeout). */
|
|
44
|
+
effectMayHaveApplied?: boolean;
|
|
45
|
+
observedAt: Date | string;
|
|
10
46
|
}
|
|
11
47
|
interface AdapterExecutionResult {
|
|
12
48
|
success: boolean;
|
|
13
49
|
correlationId?: string;
|
|
14
50
|
error?: string;
|
|
51
|
+
/** Additive outcome classification. Omitted = infer from `success`. */
|
|
52
|
+
outcome?: AdapterOutcomeKind;
|
|
53
|
+
/** Durable evidence for ambiguous or timeout outcomes requiring reconciliation. */
|
|
54
|
+
outcomeEvidence?: AdapterOutcomeEvidence;
|
|
15
55
|
}
|
|
16
56
|
type AdapterExecutor = (input: Record<string, unknown>, context: AdapterExecutionContext) => Promise<AdapterExecutionResult>;
|
|
17
57
|
interface AdapterRetryPolicy {
|
|
@@ -64,6 +104,20 @@ interface ExecuteWithRetryOptions<T> {
|
|
|
64
104
|
execute: (attempt: number, maxAttempts: number) => Promise<T>;
|
|
65
105
|
isSuccessful: (result: T) => boolean;
|
|
66
106
|
getError: (result: T) => string | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Optional outcome classifier. When provided, the retry layer retries only
|
|
109
|
+
* `transient_failure` outcomes (and only when the policy is idempotent).
|
|
110
|
+
* `permanent_failure`, `timeout`, and `ambiguous` outcomes are never retried.
|
|
111
|
+
* When omitted, all non-success results are treated as transient (backward compatible).
|
|
112
|
+
*/
|
|
113
|
+
classifyOutcome?: (result: T) => AdapterOutcomeKind;
|
|
114
|
+
/**
|
|
115
|
+
* Optional classifier for errors thrown by the execute callback (not returned
|
|
116
|
+
* as results). When provided, the retry layer retries only `transient_failure`
|
|
117
|
+
* classifications. When omitted, thrown errors are never retried — the caller
|
|
118
|
+
* must explicitly opt into retrying a thrown failure by classifying it.
|
|
119
|
+
*/
|
|
120
|
+
classifyThrownError?: (error: unknown) => AdapterOutcomeKind;
|
|
67
121
|
sleep?: (delayMs: number) => Promise<void>;
|
|
68
122
|
onAttempt?: (attempt: AdapterAttempt<T>) => Promise<void> | void;
|
|
69
123
|
}
|
|
@@ -78,6 +132,27 @@ declare class AdapterRegistry {
|
|
|
78
132
|
}
|
|
79
133
|
declare function resolveAdapterRetryPolicy(policy: AdapterRetryPolicy | undefined, defaultIdempotent: boolean): ResolvedAdapterRetryPolicy;
|
|
80
134
|
declare function getRetryDelayMs(attempt: number, policy: ResolvedAdapterRetryPolicy): number;
|
|
135
|
+
/**
|
|
136
|
+
* Classify an {@link AdapterExecutionResult} into an {@link AdapterOutcomeKind}.
|
|
137
|
+
* When `outcome` is explicitly set, it is returned directly, after rejecting a
|
|
138
|
+
* contradictory result where `success` is true but the outcome is non-success.
|
|
139
|
+
* Otherwise a successful result maps to `success` and a failed result maps to
|
|
140
|
+
* `transient_failure` (the historical default).
|
|
141
|
+
*/
|
|
142
|
+
declare function classifyAdapterOutcome(result: AdapterExecutionResult): AdapterOutcomeKind;
|
|
143
|
+
/**
|
|
144
|
+
* Determine whether an outcome kind is retryable. Only `transient_failure`
|
|
145
|
+
* is retryable, and only when the adapter policy is idempotent. Permanent
|
|
146
|
+
* failures, timeouts, and ambiguous outcomes are never retried.
|
|
147
|
+
*/
|
|
148
|
+
declare function shouldRetryAdapterOutcome(kind: AdapterOutcomeKind, idempotent: boolean): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Reject a contradictory adapter result where `success` is true but the
|
|
151
|
+
* explicit `outcome` is a non-success kind. A successful result claiming an
|
|
152
|
+
* ambiguous, permanent, timeout, or transient outcome is a programming
|
|
153
|
+
* error — the adapter cannot have both succeeded and require reconciliation.
|
|
154
|
+
*/
|
|
155
|
+
declare function assertAdapterOutcomeConsistency(result: AdapterExecutionResult): void;
|
|
81
156
|
declare function executeWithAdapterRetry<T>(options: ExecuteWithRetryOptions<T>): Promise<T>;
|
|
82
157
|
|
|
83
|
-
export { type AdapterAttempt, type AdapterCircuitBreakerConfig, type AdapterExecutionContext, type AdapterExecutionResult, type AdapterExecutor, type AdapterImplementation, AdapterRegistry, type AdapterRetryPolicy, type ExecuteWithRetryOptions, MissingAdapterRegistrationError, type ResolvedAdapterRetryPolicy, executeWithAdapterRetry, getRetryDelayMs, resolveAdapterRetryPolicy };
|
|
158
|
+
export { type AdapterAttempt, type AdapterCircuitBreakerConfig, type AdapterExecutionContext, type AdapterExecutionResult, type AdapterExecutor, type AdapterImplementation, type AdapterOutcomeEvidence, type AdapterOutcomeKind, AdapterRegistry, type AdapterRetryPolicy, type ExecuteWithRetryOptions, MissingAdapterRegistrationError, type ResolvedAdapterRetryPolicy, assertAdapterOutcomeConsistency, classifyAdapterOutcome, executeWithAdapterRetry, getRetryDelayMs, resolveAdapterRetryPolicy, shouldRetryAdapterOutcome };
|
package/dist/adapters/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AdapterRegistry, MissingAdapterRegistrationError, executeWithAdapterRetry, getRetryDelayMs, resolveAdapterRetryPolicy } from '../chunk-
|
|
1
|
+
export { AdapterRegistry, MissingAdapterRegistrationError, assertAdapterOutcomeConsistency, classifyAdapterOutcome, executeWithAdapterRetry, getRetryDelayMs, resolveAdapterRetryPolicy, shouldRetryAdapterOutcome } from '../chunk-DTY3CHQZ.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkN2BBUKCX_cjs = require('./chunk-N2BBUKCX.cjs');
|
|
4
4
|
|
|
5
5
|
// testing/index.ts
|
|
6
6
|
function createFakeActionContext(options = {}) {
|
|
@@ -17,7 +17,7 @@ function createFakeActionContext(options = {}) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
function createInMemoryAdapterRegistry() {
|
|
20
|
-
return new
|
|
20
|
+
return new chunkN2BBUKCX_cjs.AdapterRegistry();
|
|
21
21
|
}
|
|
22
22
|
function createDeterministicIdFactory(prefix = "test") {
|
|
23
23
|
let sequence = 0;
|
|
@@ -27,5 +27,5 @@ function createDeterministicIdFactory(prefix = "test") {
|
|
|
27
27
|
exports.createDeterministicIdFactory = createDeterministicIdFactory;
|
|
28
28
|
exports.createFakeActionContext = createFakeActionContext;
|
|
29
29
|
exports.createInMemoryAdapterRegistry = createInMemoryAdapterRegistry;
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-3BGFHSSK.cjs.map
|
|
31
|
+
//# sourceMappingURL=chunk-3BGFHSSK.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../testing/index.ts"],"names":["AdapterRegistry"],"mappings":";;;;;AAeO,SAAS,uBAAA,CACf,OAAA,GAAyC,EAAC,EACrB;AACrB,EAAA,OAAO;AAAA,IACN,kBAAA,EAAoB,QAAQ,kBAAA,IAAsB,UAAA;AAAA,IAClD,QAAA,EAAU,QAAQ,QAAA,IAAY,aAAA;AAAA,IAC9B,OAAA,EAAS,QAAQ,OAAA,IAAW,YAAA;AAAA,IAC5B,OAAA,EAAS,QAAQ,OAAA,IAAW,YAAA;AAAA,IAC5B,SAAA,EAAW,QAAQ,SAAA,IAAa,QAAA;AAAA,IAChC,aAAA,EAAe,QAAQ,aAAA,IAAiB,WAAA;AAAA,IACxC,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,EAAA,EAAI,OAAA,CAAQ,EAAA,IAAO,EAAC;AAAA,IACpB,QAAA,EAAU,OAAA,CAAQ,QAAA,IAAY;AAAC,GAChC;AACD;AAEO,SAAS,6BAAA,GAAiD;AAChE,EAAA,OAAO,IAAIA,iCAAA,EAAgB;AAC5B;AAEO,SAAS,4BAAA,CAA6B,SAAS,MAAA,EAAsB;AAC3E,EAAA,IAAI,QAAA,GAAW,CAAA;AACf,EAAA,OAAO,MAAM,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,MAAA,CAAO,EAAE,QAAQ,CAAA,CAAE,QAAA,CAAS,CAAA,EAAG,GAAG,CAAC,CAAA,CAAA;AAC9D","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../testing/index.ts"],"names":["AdapterRegistry"],"mappings":";;;;;AAeO,SAAS,uBAAA,CACf,OAAA,GAAyC,EAAC,EACrB;AACrB,EAAA,OAAO;AAAA,IACN,kBAAA,EAAoB,QAAQ,kBAAA,IAAsB,UAAA;AAAA,IAClD,QAAA,EAAU,QAAQ,QAAA,IAAY,aAAA;AAAA,IAC9B,OAAA,EAAS,QAAQ,OAAA,IAAW,YAAA;AAAA,IAC5B,OAAA,EAAS,QAAQ,OAAA,IAAW,YAAA;AAAA,IAC5B,SAAA,EAAW,QAAQ,SAAA,IAAa,QAAA;AAAA,IAChC,aAAA,EAAe,QAAQ,aAAA,IAAiB,WAAA;AAAA,IACxC,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,EAAA,EAAI,OAAA,CAAQ,EAAA,IAAO,EAAC;AAAA,IACpB,QAAA,EAAU,OAAA,CAAQ,QAAA,IAAY;AAAC,GAChC;AACD;AAEO,SAAS,6BAAA,GAAiD;AAChE,EAAA,OAAO,IAAIA,iCAAA,EAAgB;AAC5B;AAEO,SAAS,4BAAA,CAA6B,SAAS,MAAA,EAAsB;AAC3E,EAAA,IAAI,QAAA,GAAW,CAAA;AACf,EAAA,OAAO,MAAM,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,MAAA,CAAO,EAAE,QAAQ,CAAA,CAAE,QAAA,CAAS,CAAA,EAAG,GAAG,CAAC,CAAA,CAAA;AAC9D","file":"chunk-3BGFHSSK.cjs","sourcesContent":["import { AdapterRegistry } from \"../adapters\";\nimport type { ActionContext, ActorType } from \"../actions\";\n\nexport interface FakeActionContextOptions<TDb = Record<string, never>> {\n\tactionInvocationId?: string;\n\ttenantId?: string;\n\tspaceId?: string;\n\tactorId?: string;\n\tactorType?: ActorType;\n\tcorrelationId?: string;\n\tcausationId?: string;\n\tdb?: TDb;\n\tservices?: Record<string, unknown>;\n}\n\nexport function createFakeActionContext<TDb = Record<string, never>>(\n\toptions: FakeActionContextOptions<TDb> = {},\n): ActionContext<TDb> {\n\treturn {\n\t\tactionInvocationId: options.actionInvocationId ?? \"act_test\",\n\t\ttenantId: options.tenantId ?? \"tenant-test\",\n\t\tspaceId: options.spaceId ?? \"space-test\",\n\t\tactorId: options.actorId ?? \"actor-test\",\n\t\tactorType: options.actorType ?? \"system\",\n\t\tcorrelationId: options.correlationId ?? \"corr-test\",\n\t\tcausationId: options.causationId,\n\t\tdb: options.db ?? ({} as TDb),\n\t\tservices: options.services ?? {},\n\t};\n}\n\nexport function createInMemoryAdapterRegistry(): AdapterRegistry {\n\treturn new AdapterRegistry();\n}\n\nexport function createDeterministicIdFactory(prefix = \"test\"): () => string {\n\tlet sequence = 0;\n\treturn () => `${prefix}_${String(++sequence).padStart(6, \"0\")}`;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkIFW43ELT_cjs = require('./chunk-IFW43ELT.cjs');
|
|
4
|
+
var chunkCXR6KEKQ_cjs = require('./chunk-CXR6KEKQ.cjs');
|
|
5
5
|
var chunkLDPBQ72C_cjs = require('./chunk-LDPBQ72C.cjs');
|
|
6
6
|
|
|
7
7
|
// modules/index.ts
|
|
@@ -36,7 +36,7 @@ function createModuleRegistry(modules = []) {
|
|
|
36
36
|
const definition = machine;
|
|
37
37
|
return [definition.entityType, definition];
|
|
38
38
|
})));
|
|
39
|
-
const views = new Map(orderedModules.flatMap((module) => (module.views ?? []).map((view) => [
|
|
39
|
+
const views = new Map(orderedModules.flatMap((module) => (module.views ?? []).map((view) => [chunkCXR6KEKQ_cjs.viewContractKey(view), view])));
|
|
40
40
|
return {
|
|
41
41
|
modules: registered,
|
|
42
42
|
orderedModules,
|
|
@@ -74,7 +74,7 @@ function qualifiedObjectType(namespace, type) {
|
|
|
74
74
|
function validateObjectDefinition(objectType, namespace, context) {
|
|
75
75
|
if (typeof objectType === "string") return;
|
|
76
76
|
if (objectType.schema !== void 0) {
|
|
77
|
-
|
|
77
|
+
chunkIFW43ELT_cjs.assertPortableJsonSchema(objectType.schema, `Module "${namespace}" object "${objectType.type}" schema`);
|
|
78
78
|
}
|
|
79
79
|
if (objectType.semantics !== void 0) {
|
|
80
80
|
assertJsonValue(objectType.semantics, `Module "${namespace}" object "${objectType.type}" semantics`);
|
|
@@ -181,12 +181,12 @@ function validateManifest(module, context = {}) {
|
|
|
181
181
|
}
|
|
182
182
|
validateCapabilityWorkflows(module, context);
|
|
183
183
|
}
|
|
184
|
-
for (const eventType of module.eventTypes ?? []) if (typeof eventType !== "string" && eventType.schema)
|
|
184
|
+
for (const eventType of module.eventTypes ?? []) if (typeof eventType !== "string" && eventType.schema) chunkIFW43ELT_cjs.assertPortableJsonSchema(eventType.schema, `Event "${eventType.eventType}" schema`);
|
|
185
185
|
for (const action of module.actions ?? []) {
|
|
186
186
|
if (action.execution?.idempotency === "required" && !action.idempotent) throw new Error(`Action "${action.actionId}" requires idempotency but is not declared idempotent.`);
|
|
187
187
|
if (action.execution?.connectivity === "offline-capturable" && action.execution.idempotency === "prohibited") throw new Error(`Offline action "${action.actionId}" cannot prohibit idempotency.`);
|
|
188
188
|
}
|
|
189
|
-
for (const view of module.views ?? []) if (view.usage?.collection?.filterSchema)
|
|
189
|
+
for (const view of module.views ?? []) if (view.usage?.collection?.filterSchema) chunkIFW43ELT_cjs.assertPortableJsonSchema(view.usage.collection.filterSchema, `View "${view.name}" filter schema`);
|
|
190
190
|
for (const dependency of dependencies) {
|
|
191
191
|
validateModuleNamespace(dependency);
|
|
192
192
|
if (dependency === module.namespace) {
|
|
@@ -224,14 +224,14 @@ function validateManifest(module, context = {}) {
|
|
|
224
224
|
} catch {
|
|
225
225
|
parameterSchema = void 0;
|
|
226
226
|
}
|
|
227
|
-
if (parameterSchema !== void 0)
|
|
227
|
+
if (parameterSchema !== void 0) chunkIFW43ELT_cjs.assertPortableJsonSchema(parameterSchema, `Action "${action.actionId}" parameters`);
|
|
228
228
|
let resultSchema;
|
|
229
229
|
try {
|
|
230
230
|
resultSchema = action.resultSchema?.toJSONSchema?.();
|
|
231
231
|
} catch {
|
|
232
232
|
resultSchema = void 0;
|
|
233
233
|
}
|
|
234
|
-
if (resultSchema !== void 0)
|
|
234
|
+
if (resultSchema !== void 0) chunkIFW43ELT_cjs.assertPortableJsonSchema(resultSchema, `Action "${action.actionId}" result`);
|
|
235
235
|
if (!/^[a-z][a-z0-9-]*\.[a-z][a-z0-9_]*$/.test(action.actionId)) {
|
|
236
236
|
throw new Error(`Invalid action ID: ${action.actionId}`);
|
|
237
237
|
}
|
|
@@ -260,7 +260,8 @@ function validateManifest(module, context = {}) {
|
|
|
260
260
|
const key = `${view.name}@${view.version}`;
|
|
261
261
|
if (viewKeys.has(key)) throw new Error(`Module "${module.namespace}" has duplicate view contract "${key}".`);
|
|
262
262
|
viewKeys.add(key);
|
|
263
|
-
|
|
263
|
+
chunkIFW43ELT_cjs.assertPortableJsonSchema(view.shape, `View "${key}" shape`);
|
|
264
|
+
if (view.parameterSchema !== void 0) chunkIFW43ELT_cjs.assertPortableJsonSchema(view.parameterSchema, `View "${key}" parameters`);
|
|
264
265
|
if (!Number.isInteger(view.snapshotVersion) || view.snapshotVersion < 1) {
|
|
265
266
|
throw new Error(`View "${key}" snapshotVersion must be a positive integer.`);
|
|
266
267
|
}
|
|
@@ -382,5 +383,5 @@ exports.registerFabricModule = registerFabricModule;
|
|
|
382
383
|
exports.registerFabricModules = registerFabricModules;
|
|
383
384
|
exports.validateAndOrderFabricModules = validateAndOrderFabricModules;
|
|
384
385
|
exports.validateModuleNamespace = validateModuleNamespace;
|
|
385
|
-
//# sourceMappingURL=chunk-
|
|
386
|
-
//# sourceMappingURL=chunk-
|
|
386
|
+
//# sourceMappingURL=chunk-3UBX7KQM.cjs.map
|
|
387
|
+
//# sourceMappingURL=chunk-3UBX7KQM.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../modules/index.ts"],"names":["viewContractKey","assertPortableJsonSchema","createEventContractRegistry"],"mappings":";;;;;;;AAwLO,SAAS,6BAA6B,UAAA,EAA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MAAA,EAAiC;AACpF,EAAA,6BAAA,CAA8B,CAAC,MAAM,CAAC,CAAA;AACvC","file":"chunk-3UBX7KQM.cjs","sourcesContent":["import type { ActionDefinition } from \"../actions\";\nimport { createEventContractRegistry } from \"../events\";\nimport {\n\tassertPortableJsonSchema,\n\ttype JsonValue,\n\ttype PortableJsonSchema,\n} from \"../objects\";\nimport type { PolicyEvaluator, PolicyId } from \"../policies\";\nimport type { StateMachineDefinition } from \"../state-machines\";\nimport { viewContractKey, type ViewContract } from \"../projections\";\n\nexport interface ModuleDependency {\n\tnamespace: string;\n\tversion?: string;\n\toptional?: boolean;\n}\n\nexport type ModuleDependencyInput = string | ModuleDependency;\n\nexport interface IdPrefixRegistration {\n\tprefix: string;\n\tname: string;\n\tmodule: string;\n}\n\nexport interface EventTypeRegistration {\n\teventType: string;\n\tschemaVersion: number;\n\tdescription?: string;\n\tschema?: PortableJsonSchema;\n}\n\nexport type EventTypeRegistrationInput = string | EventTypeRegistration;\n\nexport interface ObjectTypeRegistration {\n\ttype: string;\n\tdisplayName?: string;\n\tidPrefix?: string;\n\tisCoreModuleType?: boolean;\n\tschema?: PortableJsonSchema;\n\tsemantics?: Record<string, JsonValue>;\n\trelations?: ObjectRelationDefinition[];\n\tinvariants?: DeclarativeInvariant[];\n}\n\nexport type ObjectRelationCardinality = \"one\" | \"many\";\nexport type ObjectRelationSemantics = \"reference\" | \"owned\";\nexport type ObjectRelationDeleteBehavior = \"restrict\" | \"cascade\" | \"set-null\";\n\nexport interface ObjectRelationDefinition {\n\tname: string;\n\ttarget: `${string}.${string}`;\n\tcardinality: ObjectRelationCardinality;\n\trequired?: boolean;\n\tsemantics: ObjectRelationSemantics;\n\tonTargetDelete: ObjectRelationDeleteBehavior;\n}\n\nexport type InvariantEnforcement =\n\t| \"json-schema\"\n\t| \"state-machine\"\n\t| \"policy\"\n\t| \"host-adapter\"\n\t| \"application\";\n\nexport interface DeclarativeInvariant {\n\tid: string;\n\tdescription: string;\n\trequired?: boolean;\n\tenforcement: InvariantEnforcement;\n\tenforcementRef?: string;\n}\n\nexport type ObjectTypeRegistrationInput = string | ObjectTypeRegistration;\n\nexport interface PolicyRegistration {\n\tid: string;\n\tversion?: string;\n\tdescription?: string;\n}\n\nexport interface StateMachineRegistration {\n\tentityType: string;\n\tstates: string[];\n}\n\nexport interface CapabilityPortRequirement {\n\tname: string;\n\tversion?: string;\n\tstandard?: { name: string; version?: string };\n}\n\nexport interface CapabilityRequirements {\n\tports?: CapabilityPortRequirement[];\n\tpermissions?: string[];\n\tentitlements?: string[];\n\tfeatureFlags?: string[];\n}\n\nexport interface CapabilityWorkflowTimer {\n\t/** Workflow-local identity of the deadline, for example \"right-to-cure\". */\n\tname: string;\n\t/** Configuration key the duration is resolved from when the workflow starts. */\n\tconfigKey: string;\n\tdescription?: string;\n}\n\nexport interface CapabilityWorkflowCompensation {\n\t/** Workflow step whose effect this reverses. */\n\tstep: string;\n\t/** Governed action that performs the reversal. Must belong to the declaring module. */\n\tactionId: `${string}.${string}`;\n}\n\n/**\n * A durable workflow this capability owns. Declaring it makes durability a\n * reviewable fact of the contract rather than a property of worker deployment:\n * the queue it runs on, the deadlines it carries, and what reverses each step\n * are all diffable.\n */\nexport interface CapabilityWorkflowDeclaration {\n\tname: string;\n\t/** Routing identity, conventionally `capability.vertical`. */\n\ttaskQueue: string;\n\t/** Event type whose arrival starts this workflow by choreography. */\n\tstartedBy?: string;\n\ttimers?: CapabilityWorkflowTimer[];\n\tcompensations?: CapabilityWorkflowCompensation[];\n}\n\nexport interface CapabilityMetadata {\n\tdisplayName: string;\n\tdescription: string;\n\tstability: \"experimental\" | \"beta\" | \"stable\" | \"deprecated\";\n\tdeprecated?: { since: string; replacement?: string; message: string };\n\trequirements?: CapabilityRequirements;\n\tcertification?: { profile: string; required: boolean };\n\t/** Durable workflows this capability owns, with their queues, deadlines and reversals. */\n\tworkflows?: CapabilityWorkflowDeclaration[];\n\t/** Namespaced declared data preserved by Platform and interpreted only by its owning package. */\n\textensions?: Record<string, JsonValue>;\n}\n\nexport interface FabricModule<TDb = unknown> {\n\tnamespace: string;\n\tversion?: string;\n\t/** Compiler manifest digest for exact runtime assembly verification. */\n\tmanifestDigest?: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\tcapability?: CapabilityMetadata;\n\tdependencies?: ModuleDependencyInput[];\n\tobjectTypes?: ObjectTypeRegistrationInput[];\n\tsubjectTypes?: string[];\n\tidPrefixes?: IdPrefixRegistration[];\n\teventTypes?: EventTypeRegistrationInput[];\n\tactions?: ActionDefinition<TDb>[];\n\tpolicies?: unknown[];\n\tstateMachines?: unknown[];\n\tadapterDefinitions?: unknown[];\n\tpermissions?: unknown[];\n\troles?: unknown[];\n\tredactionRules?: unknown[];\n\tdataClassifications?: unknown[];\n\tretentionRules?: unknown[];\n\tevidenceRenderers?: unknown[];\n\tviews?: ViewContract[];\n}\n\nexport interface ModuleRegistry<TDb = unknown> {\n\tmodules: ReadonlyMap<string, FabricModule<TDb>>;\n\torderedModules: readonly FabricModule<TDb>[];\n\tresolveAction(actionId: `${string}.${string}`): ActionDefinition<TDb> | undefined;\n\tresolvePolicy(policyId: PolicyId): PolicyEvaluator | undefined;\n\tresolveStateMachine(entityType: string): StateMachineDefinition | undefined;\n\tresolveView(name: string, version: string): ViewContract | undefined;\n}\n\ninterface ModuleValidationContext {\n\tavailableNamespaces?: Set<string>;\n\tplannedEventTypes?: Set<string>;\n\tavailableObjectTypes?: Set<string>;\n}\n\nexport function getModuleDependencyNamespace(dependency: ModuleDependencyInput): string {\n\treturn typeof dependency === \"string\" ? dependency : dependency.namespace;\n}\n\nexport function getObjectTypeName(objectType: ObjectTypeRegistrationInput): string {\n\treturn typeof objectType === \"string\" ? objectType : objectType.type;\n}\n\nexport function getEventTypeName(eventType: EventTypeRegistrationInput): string {\n\treturn typeof eventType === \"string\" ? eventType : eventType.eventType;\n}\n\nexport function validateModuleNamespace(namespace: string): void {\n\tif (!namespace) {\n\t\tthrow new Error(\"Module namespace cannot be empty\");\n\t}\n\tif (!/^[a-z][a-z0-9-]*$/.test(namespace)) {\n\t\tthrow new Error(\n\t\t\t`Invalid module namespace: \"${namespace}\". Must be lowercase letters, numbers, and hyphens only.`,\n\t\t);\n\t}\n}\n\nexport function createModuleRegistry<TDb = unknown>(\n\tmodules: FabricModule<TDb>[] = [],\n): ModuleRegistry<TDb> {\n\tconst orderedModules = validateAndOrderFabricModules(modules);\n\tconst registered = new Map(orderedModules.map((module) => [module.namespace, module]));\n\tconst actions = new Map(orderedModules.flatMap((module) => (module.actions ?? []).map((action) => [action.actionId, action] as const)));\n\tconst policies = new Map(orderedModules.flatMap((module) => (module.policies ?? []).map((policy) => {\n\t\tconst evaluator = policy as PolicyEvaluator;\n\t\treturn [evaluator.policyId, evaluator] as const;\n\t})));\n\tconst machines = new Map(orderedModules.flatMap((module) => (module.stateMachines ?? []).map((machine) => {\n\t\tconst definition = machine as StateMachineDefinition;\n\t\treturn [definition.entityType, definition] as const;\n\t})));\n\tconst views = new Map(orderedModules.flatMap((module) => (module.views ?? []).map((view) => [viewContractKey(view), view] as const)));\n\treturn {\n\t\tmodules: registered,\n\t\torderedModules,\n\t\tresolveAction: (actionId) => actions.get(actionId),\n\t\tresolvePolicy: (policyId) => policies.get(policyId),\n\t\tresolveStateMachine: (entityType) => machines.get(entityType),\n\t\tresolveView: (name, version) => views.get(`${name}@${version}`),\n\t};\n}\n\nfunction validateIdentifierList(\n\tvalues: string[] | undefined,\n\tlabel: string,\n\tnamespace: string,\n): void {\n\tfor (const value of values ?? []) {\n\t\tif (!value) {\n\t\t\tthrow new Error(`Module \"${namespace}\" has an empty ${label} entry.`);\n\t\t}\n\t}\n}\n\nfunction assertJsonValue(value: unknown, path: string): asserts value is JsonValue {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return;\n\tif (typeof value === \"number\" && Number.isFinite(value)) return;\n\tif (Array.isArray(value)) {\n\t\tvalue.forEach((item, index) => assertJsonValue(item, `${path}[${index}]`));\n\t\treturn;\n\t}\n\tif (typeof value === \"object\") {\n\t\tfor (const [key, child] of Object.entries(value as Record<string, unknown>)) {\n\t\t\tassertJsonValue(child, `${path}.${key}`);\n\t\t}\n\t\treturn;\n\t}\n\tthrow new Error(`${path} must contain JSON-serializable values.`);\n}\n\nfunction qualifiedObjectType(namespace: string, type: string): string {\n\treturn `${namespace}.${type}`;\n}\n\nfunction validateObjectDefinition(\n\tobjectType: ObjectTypeRegistrationInput,\n\tnamespace: string,\n\tcontext: ModuleValidationContext,\n): void {\n\tif (typeof objectType === \"string\") return;\n\tif (objectType.schema !== undefined) {\n\t\tassertPortableJsonSchema(objectType.schema, `Module \"${namespace}\" object \"${objectType.type}\" schema`);\n\t}\n\tif (objectType.semantics !== undefined) {\n\t\tassertJsonValue(objectType.semantics, `Module \"${namespace}\" object \"${objectType.type}\" semantics`);\n\t}\n\tconst relationNames = new Set<string>();\n\tfor (const relation of objectType.relations ?? []) {\n\t\tif (!/^[a-z][a-zA-Z0-9]*$/.test(relation.name)) {\n\t\t\tthrow new Error(`Module \"${namespace}\" object \"${objectType.type}\" has invalid relation name \"${relation.name}\".`);\n\t\t}\n\t\tif (relationNames.has(relation.name)) {\n\t\t\tthrow new Error(`Module \"${namespace}\" object \"${objectType.type}\" has duplicate relation \"${relation.name}\".`);\n\t\t}\n\t\trelationNames.add(relation.name);\n\t\tif (!/^[a-z][a-z0-9-]*\\.[A-Z][a-zA-Z0-9]*$/.test(relation.target)) {\n\t\t\tthrow new Error(`Relation \"${relation.name}\" target \"${relation.target}\" must be module-qualified.`);\n\t\t}\n\t\tif (context.availableObjectTypes && !context.availableObjectTypes.has(relation.target)) {\n\t\t\tthrow new Error(`Relation \"${relation.name}\" targets missing object type \"${relation.target}\".`);\n\t\t}\n\t\tif (relation.required && relation.onTargetDelete === \"set-null\") {\n\t\t\tthrow new Error(`Required relation \"${relation.name}\" cannot use onTargetDelete \"set-null\".`);\n\t\t}\n\t}\n\tconst invariantIds = new Set<string>();\n\tfor (const invariant of objectType.invariants ?? []) {\n\t\tif (!invariant.id.trim() || !invariant.description.trim()) {\n\t\t\tthrow new Error(`Module \"${namespace}\" object \"${objectType.type}\" has an invariant without an id or description.`);\n\t\t}\n\t\tif (invariantIds.has(invariant.id)) {\n\t\t\tthrow new Error(`Module \"${namespace}\" object \"${objectType.type}\" has duplicate invariant \"${invariant.id}\".`);\n\t\t}\n\t\tinvariantIds.add(invariant.id);\n\t\tif (invariant.required && !invariant.enforcementRef?.trim()) {\n\t\t\tthrow new Error(`Required invariant \"${invariant.id}\" must declare enforcementRef.`);\n\t\t}\n\t}\n}\n\nfunction validateCapabilityWorkflows(module: FabricModule<unknown>, context: ModuleValidationContext): void {\n\tconst workflows = module.capability?.workflows ?? [];\n\tconst actionsById = new Map((module.actions ?? []).map((action) => [action.actionId, action]));\n\tconst names = new Set<string>();\n\tfor (const workflow of workflows) {\n\t\tif (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(workflow.name)) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" declares invalid workflow name \"${workflow.name}\".`);\n\t\t}\n\t\tif (names.has(workflow.name)) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" declares duplicate workflow \"${workflow.name}\".`);\n\t\t}\n\t\tnames.add(workflow.name);\n\t\tif (!/^[a-z][a-z0-9-]*(\\.[a-z][a-z0-9-]*)*$/.test(workflow.taskQueue)) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares invalid task queue \"${workflow.taskQueue}\".`);\n\t\t}\n\t\tif (workflow.startedBy !== undefined) {\n\t\t\tconst known = context.plannedEventTypes?.has(workflow.startedBy)\n\t\t\t\t?? (module.eventTypes ?? []).some((eventType) => getEventTypeName(eventType) === workflow.startedBy);\n\t\t\tif (!known) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" is started by unknown event type \"${workflow.startedBy}\".`);\n\t\t\t}\n\t\t}\n\t\tconst timerNames = new Set<string>();\n\t\tfor (const timer of workflow.timers ?? []) {\n\t\t\tif (!timer.name.trim() || !timer.configKey.trim()) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" has a timer without a name or configKey.`);\n\t\t\t}\n\t\t\tif (timerNames.has(timer.name)) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares duplicate timer \"${timer.name}\".`);\n\t\t\t}\n\t\t\ttimerNames.add(timer.name);\n\t\t}\n\t\tconst steps = new Set<string>();\n\t\tfor (const compensation of workflow.compensations ?? []) {\n\t\t\tif (!compensation.step.trim()) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" has a compensation without a step.`);\n\t\t\t}\n\t\t\tif (steps.has(compensation.step)) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares duplicate compensation for step \"${compensation.step}\".`);\n\t\t\t}\n\t\t\tsteps.add(compensation.step);\n\t\t\tconst compensatingAction = actionsById.get(compensation.actionId);\n\t\t\tif (!compensatingAction) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" compensates step \"${compensation.step}\" with unknown action \"${compensation.actionId}\".`);\n\t\t\t}\n\t\t\t// An unwind is retried like any other durable step, so a reversal that cannot be\n\t\t\t// safely repeated would turn one failure into a different kind of corruption.\n\t\t\tif (!compensatingAction.idempotent || compensatingAction.execution?.idempotency === \"prohibited\") {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" compensates step \"${compensation.step}\" with non-idempotent action \"${compensation.actionId}\"; a reversal must be safely repeatable.`);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction validateManifest(module: FabricModule<unknown>, context: ModuleValidationContext = {}): void {\n\tvalidateModuleNamespace(module.namespace);\n\n\tconst dependencies = (module.dependencies ?? []).map(getModuleDependencyNamespace);\n\tconst objectTypes = (module.objectTypes ?? []).map(getObjectTypeName);\n\tconst eventTypes = (module.eventTypes ?? []).map(getEventTypeName);\n\tif (module.capability) {\n\t\tif (!module.capability.displayName.trim() || !module.capability.description.trim()) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" capability requires displayName and description.`);\n\t\t}\n\t\tfor (const namespace of Object.keys(module.capability.extensions ?? {})) {\n\t\t\tif (!/^[a-z][a-z0-9.-]*\\.[a-z0-9.-]+\\/v[1-9][0-9]*$/.test(namespace)) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" capability has invalid extension namespace \"${namespace}\".`);\n\t\t\t}\n\t\t}\n\t\tfor (const port of module.capability.requirements?.ports ?? []) {\n\t\t\tif (!/^[a-z][a-z0-9-]*$/.test(port.name)) throw new Error(`Module \"${module.namespace}\" capability has invalid port requirement \"${port.name}\".`);\n\t\t}\n\t\tvalidateCapabilityWorkflows(module, context);\n\t}\n\tfor (const eventType of module.eventTypes ?? []) if (typeof eventType !== \"string\" && eventType.schema) assertPortableJsonSchema(eventType.schema, `Event \"${eventType.eventType}\" schema`);\n\tfor (const action of module.actions ?? []) {\n\t\tif (action.execution?.idempotency === \"required\" && !action.idempotent) throw new Error(`Action \"${action.actionId}\" requires idempotency but is not declared idempotent.`);\n\t\tif (action.execution?.connectivity === \"offline-capturable\" && action.execution.idempotency === \"prohibited\") throw new Error(`Offline action \"${action.actionId}\" cannot prohibit idempotency.`);\n\t}\n\tfor (const view of module.views ?? []) if (view.usage?.collection?.filterSchema) assertPortableJsonSchema(view.usage.collection.filterSchema, `View \"${view.name}\" filter schema`);\n\n\tfor (const dependency of dependencies) {\n\t\tvalidateModuleNamespace(dependency);\n\t\tif (dependency === module.namespace) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" cannot depend on itself.`);\n\t\t}\n\t\tif (context.availableNamespaces && !context.availableNamespaces.has(dependency)) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" depends on missing module \"${dependency}\".`);\n\t\t}\n\t}\n\n\tvalidateIdentifierList(objectTypes, \"objectTypes\", module.namespace);\n\tvalidateIdentifierList(module.subjectTypes, \"subjectTypes\", module.namespace);\n\tvalidateIdentifierList(eventTypes, \"eventTypes\", module.namespace);\n\n\tfor (const objectType of objectTypes) {\n\t\tif (!/^[A-Z][a-zA-Z0-9]*$/.test(objectType)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid object type: \"${objectType}\". Object types must be PascalCase alphanumeric.`,\n\t\t\t);\n\t\t}\n\t}\n\tfor (const objectType of module.objectTypes ?? []) {\n\t\tif (typeof objectType !== \"string\") {\n\t\t\tfor (const relation of objectType.relations ?? []) {\n\t\t\t\tconst targetNamespace = relation.target.slice(0, relation.target.indexOf(\".\"));\n\t\t\t\tif (targetNamespace !== module.namespace && !dependencies.includes(targetNamespace)) {\n\t\t\t\t\tthrow new Error(`Module \"${module.namespace}\" relation \"${relation.name}\" targets module \"${targetNamespace}\" without declaring it as a dependency.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvalidateObjectDefinition(objectType, module.namespace, context);\n\t}\n\n\tfor (const action of module.actions ?? []) {\n\t\tlet parameterSchema: unknown;\n\t\ttry { parameterSchema = (action.schema as { toJSONSchema?: () => unknown }).toJSONSchema?.(); } catch { parameterSchema = undefined; }\n\t\tif (parameterSchema !== undefined) assertPortableJsonSchema(parameterSchema, `Action \"${action.actionId}\" parameters`);\n\t\tlet resultSchema: unknown;\n\t\ttry { resultSchema = (action.resultSchema as { toJSONSchema?: () => unknown } | undefined)?.toJSONSchema?.(); } catch { resultSchema = undefined; }\n\t\tif (resultSchema !== undefined) assertPortableJsonSchema(resultSchema, `Action \"${action.actionId}\" result`);\n\t\tif (!/^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_]*$/.test(action.actionId)) {\n\t\t\tthrow new Error(`Invalid action ID: ${action.actionId}`);\n\t\t}\n\n\t\tif (action.namespace !== module.namespace) {\n\t\t\tthrow new Error(\n\t\t\t\t`Action \"${action.actionId}\" declares namespace \"${action.namespace}\" ` +\n\t\t\t\t\t`but is registered by module \"${module.namespace}\".`,\n\t\t\t);\n\t\t}\n\n\t\tif (!action.actionId.startsWith(`${module.namespace}.`)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Action \"${action.actionId}\" must start with module namespace \"${module.namespace}.\"`,\n\t\t\t);\n\t\t}\n\n\t\tif (action.mutatesDomain && action.emitsEvents.length === 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`Action \"${action.actionId}\" mutates domain but emits no events. ` +\n\t\t\t\t\t`Every mutating action must emit at least one AssetEvent.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst viewKeys = new Set<string>();\n\tfor (const view of module.views ?? []) {\n\t\tif (!view.name.startsWith(`${module.namespace}/`) || !/^[a-z][a-z0-9-]*\\/[a-z][a-z0-9/_-]*$/.test(view.name)) {\n\t\t\tthrow new Error(`View \"${view.name}\" must start with module namespace \"${module.namespace}/\" and use lowercase path segments.`);\n\t\t}\n\t\tif (!view.version.trim()) throw new Error(`View \"${view.name}\" must declare a version.`);\n\t\tconst key = `${view.name}@${view.version}`;\n\t\tif (viewKeys.has(key)) throw new Error(`Module \"${module.namespace}\" has duplicate view contract \"${key}\".`);\n\t\tviewKeys.add(key);\n\t\tassertPortableJsonSchema(view.shape, `View \"${key}\" shape`);\n\t\tif (view.parameterSchema !== undefined) assertPortableJsonSchema(view.parameterSchema, `View \"${key}\" parameters`);\n\t\tif (!Number.isInteger(view.snapshotVersion) || view.snapshotVersion < 1) {\n\t\t\tthrow new Error(`View \"${key}\" snapshotVersion must be a positive integer.`);\n\t\t}\n\t\tif ((view.compatibleSnapshotVersions?.some((version) => version !== view.snapshotVersion) ?? false) && !view.upgradeSnapshot) {\n\t\t\tthrow new Error(`View \"${key}\" declares older compatible snapshots but no upgradeSnapshot function.`);\n\t\t}\n\t\tfor (const consumption of view.consumes) {\n\t\t\tconst isPlanned = context.plannedEventTypes?.has(consumption.eventType) ?? false;\n\t\t\tconst isModuleEvent = eventTypes.includes(consumption.eventType);\n\t\t\tif (!isPlanned && !isModuleEvent) {\n\t\t\t\tthrow new Error(`View \"${key}\" consumes unknown event type \"${consumption.eventType}\".`);\n\t\t\t}\n\t\t\tif (consumption.schemaVersions.length === 0 || consumption.schemaVersions.some((version) => !Number.isInteger(version) || version < 1)) {\n\t\t\t\tthrow new Error(`View \"${key}\" must declare positive consumed schema versions for \"${consumption.eventType}\".`);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction sortModulesByDependency(\n\tmodules: FabricModule<unknown>[],\n\tregisteredNamespaces: ReadonlySet<string> = new Set(),\n): FabricModule<unknown>[] {\n\tconst modulesByNamespace = new Map<string, FabricModule<unknown>>();\n\n\tfor (const module of modules) {\n\t\tvalidateModuleNamespace(module.namespace);\n\t\tif (modulesByNamespace.has(module.namespace)) {\n\t\t\tthrow new Error(`Duplicate FabricModule namespace \"${module.namespace}\".`);\n\t\t}\n\t\tmodulesByNamespace.set(module.namespace, module);\n\t}\n\n\tconst sorted: FabricModule<unknown>[] = [];\n\tconst visiting = new Set<string>();\n\tconst visited = new Set<string>();\n\n\tfunction visit(module: FabricModule<unknown>, path: string[]): void {\n\t\tif (visited.has(module.namespace)) {\n\t\t\treturn;\n\t\t}\n\t\tif (visiting.has(module.namespace)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Cyclic Fabric module dependency detected: ${[...path, module.namespace].join(\" -> \")}`,\n\t\t\t);\n\t\t}\n\n\t\tvisiting.add(module.namespace);\n\t\tfor (const dependency of (module.dependencies ?? []).map(getModuleDependencyNamespace)) {\n\t\t\tconst dependencyModule = modulesByNamespace.get(dependency);\n\t\t\tif (!dependencyModule) {\n\t\t\t\tif (registeredNamespaces.has(dependency)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" depends on missing module \"${dependency}\".`);\n\t\t\t}\n\t\t\tvisit(dependencyModule, [...path, module.namespace]);\n\t\t}\n\t\tvisiting.delete(module.namespace);\n\t\tvisited.add(module.namespace);\n\t\tsorted.push(module);\n\t}\n\n\tfor (const module of modules) {\n\t\tvisit(module, []);\n\t}\n\n\treturn sorted;\n}\n\nfunction assertAcyclicRelations(modules: FabricModule<unknown>[]): void {\n\tconst relationKinds = [\n\t\t{ label: \"owned containment\", include: (relation: ObjectRelationDefinition) => relation.semantics === \"owned\" },\n\t\t{ label: \"cascade-delete\", include: (relation: ObjectRelationDefinition) => relation.onTargetDelete === \"cascade\" },\n\t\t{ label: \"required-construction\", include: (relation: ObjectRelationDefinition) => relation.required === true },\n\t];\n\tfor (const kind of relationKinds) {\n\t\tconst edges = new Map<string, string[]>();\n\t\tfor (const module of modules) {\n\t\t\tfor (const objectType of module.objectTypes ?? []) {\n\t\t\t\tif (typeof objectType === \"string\") continue;\n\t\t\t\tconst source = qualifiedObjectType(module.namespace, objectType.type);\n\t\t\t\tedges.set(source, (objectType.relations ?? []).filter(kind.include).map((relation) => relation.target));\n\t\t\t}\n\t\t}\n\t\tconst visiting = new Set<string>();\n\t\tconst visited = new Set<string>();\n\t\tconst visit = (node: string, path: string[]): void => {\n\t\t\tif (visiting.has(node)) {\n\t\t\t\tthrow new Error(`${kind.label} relation cycle detected: ${[...path, node].join(\" -> \")}`);\n\t\t\t}\n\t\t\tif (visited.has(node)) return;\n\t\t\tvisiting.add(node);\n\t\t\tfor (const target of edges.get(node) ?? []) visit(target, [...path, node]);\n\t\t\tvisiting.delete(node);\n\t\t\tvisited.add(node);\n\t\t};\n\t\tfor (const node of edges.keys()) visit(node, []);\n\t}\n}\n\nexport function validateAndOrderFabricModules<TDb = unknown>(modules: FabricModule<TDb>[]): FabricModule<TDb>[] {\n\tconst availableNamespaces = new Set(modules.map((module) => module.namespace));\n\tconst plannedEventTypes = new Set(\n\t\tmodules.flatMap((module) => (module.eventTypes ?? []).map(getEventTypeName)),\n\t);\n\tfor (const eventType of createEventContractRegistry().eventTypes()) plannedEventTypes.add(eventType);\n\tconst availableObjectTypes = new Set([\n\t\t...modules.flatMap((module) =>\n\t\t\t(module.objectTypes ?? []).map((objectType) => qualifiedObjectType(module.namespace, getObjectTypeName(objectType))),\n\t\t),\n\t]);\n\n\tfor (const module of modules) {\n\t\tvalidateManifest(module as FabricModule<unknown>, { availableNamespaces, plannedEventTypes, availableObjectTypes });\n\t}\n\tassertAcyclicRelations(modules as FabricModule<unknown>[]);\n\treturn sortModulesByDependency(modules as FabricModule<unknown>[]) as FabricModule<TDb>[];\n}\n\n/** @deprecated Use createModuleRegistry(); registration is now explicit and instance-scoped. */\nexport function registerFabricModules<TDb = unknown>(modules: FabricModule<TDb>[]): FabricModule<TDb>[] {\n\treturn validateAndOrderFabricModules(modules);\n}\n\n/** @deprecated Use createModuleRegistry([module]); registration is now explicit and instance-scoped. */\nexport function registerFabricModule<TDb = unknown>(module: FabricModule<TDb>): void {\n\tvalidateAndOrderFabricModules([module]);\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { assertPortableJsonSchema } from './chunk-
|
|
2
|
-
import { viewContractKey } from './chunk-
|
|
1
|
+
import { assertPortableJsonSchema } from './chunk-ZAEVQSB5.js';
|
|
2
|
+
import { viewContractKey } from './chunk-JG35DT2G.js';
|
|
3
3
|
import { createEventContractRegistry } from './chunk-NHGBTPPE.js';
|
|
4
4
|
|
|
5
5
|
// modules/index.ts
|
|
@@ -259,6 +259,7 @@ function validateManifest(module, context = {}) {
|
|
|
259
259
|
if (viewKeys.has(key)) throw new Error(`Module "${module.namespace}" has duplicate view contract "${key}".`);
|
|
260
260
|
viewKeys.add(key);
|
|
261
261
|
assertPortableJsonSchema(view.shape, `View "${key}" shape`);
|
|
262
|
+
if (view.parameterSchema !== void 0) assertPortableJsonSchema(view.parameterSchema, `View "${key}" parameters`);
|
|
262
263
|
if (!Number.isInteger(view.snapshotVersion) || view.snapshotVersion < 1) {
|
|
263
264
|
throw new Error(`View "${key}" snapshotVersion must be a positive integer.`);
|
|
264
265
|
}
|
|
@@ -373,5 +374,5 @@ function registerFabricModule(module) {
|
|
|
373
374
|
}
|
|
374
375
|
|
|
375
376
|
export { createModuleRegistry, getEventTypeName, getModuleDependencyNamespace, getObjectTypeName, registerFabricModule, registerFabricModules, validateAndOrderFabricModules, validateModuleNamespace };
|
|
376
|
-
//# sourceMappingURL=chunk-
|
|
377
|
-
//# sourceMappingURL=chunk-
|
|
377
|
+
//# sourceMappingURL=chunk-63MYMAEX.js.map
|
|
378
|
+
//# sourceMappingURL=chunk-63MYMAEX.js.map
|