@fabricorg/platform 1.3.0 → 1.5.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 +12 -0
- package/dist/actions/index.cjs +6 -6
- package/dist/actions/index.d.cts +14 -0
- package/dist/actions/index.d.ts +14 -0
- package/dist/actions/index.js +1 -1
- package/dist/adapters/index.cjs +9 -9
- package/dist/adapters/index.d.cts +17 -1
- package/dist/adapters/index.d.ts +17 -1
- package/dist/adapters/index.js +1 -1
- package/dist/certification/index.cjs +25 -0
- package/dist/certification/index.cjs.map +1 -0
- package/dist/certification/index.d.cts +42 -0
- package/dist/certification/index.d.ts +42 -0
- package/dist/certification/index.js +8 -0
- package/dist/certification/index.js.map +1 -0
- package/dist/{chunk-LDPBQ72C.cjs → chunk-2AE6TMAX.cjs} +6 -2
- package/dist/{chunk-LDPBQ72C.cjs.map → chunk-2AE6TMAX.cjs.map} +1 -1
- package/dist/{chunk-4QOA3VU5.js → chunk-2W6FORTE.js} +2 -2
- package/dist/{chunk-4QOA3VU5.js.map → chunk-2W6FORTE.js.map} +1 -1
- package/dist/{chunk-NHGBTPPE.js → chunk-B5DOGDPG.js} +6 -2
- package/dist/{chunk-NHGBTPPE.js.map → chunk-B5DOGDPG.js.map} +1 -1
- package/dist/{chunk-AWP6JDD5.js → chunk-DCC3UIUJ.js} +3 -3
- package/dist/{chunk-AWP6JDD5.js.map → chunk-DCC3UIUJ.js.map} +1 -1
- package/dist/chunk-DDO4EQ2J.js +98 -0
- package/dist/chunk-DDO4EQ2J.js.map +1 -0
- package/dist/{chunk-DTY3CHQZ.js → chunk-FAG2RTPM.js} +2 -2
- package/dist/chunk-FAG2RTPM.js.map +1 -0
- package/dist/{chunk-KADDDQHO.js → chunk-GRBZYDEV.js} +5 -3
- package/dist/chunk-GRBZYDEV.js.map +1 -0
- package/dist/{chunk-G6WXP5ZZ.cjs → chunk-KIVQBZOA.cjs} +6 -4
- package/dist/chunk-KIVQBZOA.cjs.map +1 -0
- package/dist/{chunk-ZOOGUUY4.js → chunk-MC3GSVJ6.js} +3 -3
- package/dist/{chunk-ZOOGUUY4.js.map → chunk-MC3GSVJ6.js.map} +1 -1
- package/dist/{chunk-BFQNKQJE.cjs → chunk-MSABJAED.cjs} +2 -2
- package/dist/{chunk-BFQNKQJE.cjs.map → chunk-MSABJAED.cjs.map} +1 -1
- package/dist/chunk-PFKTD7V5.cjs +102 -0
- package/dist/chunk-PFKTD7V5.cjs.map +1 -0
- package/dist/{chunk-3BGFHSSK.cjs → chunk-USDLP4E7.cjs} +4 -4
- package/dist/{chunk-3BGFHSSK.cjs.map → chunk-USDLP4E7.cjs.map} +1 -1
- package/dist/{chunk-N2BBUKCX.cjs → chunk-XZQZQ5SW.cjs} +2 -2
- package/dist/chunk-XZQZQ5SW.cjs.map +1 -0
- package/dist/{chunk-7HPNONN7.cjs → chunk-ZBXFRJON.cjs} +6 -6
- package/dist/{chunk-7HPNONN7.cjs.map → chunk-ZBXFRJON.cjs.map} +1 -1
- package/dist/events/index.cjs +2 -2
- package/dist/events/index.js +1 -1
- package/dist/index.cjs +137 -124
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +10 -9
- package/dist/manifest/index.cjs +9 -9
- package/dist/manifest/index.d.cts +1 -1
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.js +3 -3
- package/dist/modules/index.cjs +10 -10
- package/dist/modules/index.js +2 -2
- package/dist/testing/index.cjs +5 -5
- package/dist/testing/index.js +2 -2
- package/package.json +11 -1
- package/dist/chunk-DTY3CHQZ.js.map +0 -1
- package/dist/chunk-G6WXP5ZZ.cjs.map +0 -1
- package/dist/chunk-KADDDQHO.js.map +0 -1
- package/dist/chunk-N2BBUKCX.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @fabricorg/platform
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 07e3c65: `STRICT_EXECUTION_CONTRACT_PROFILE` and `executionContractProfile()` under a new `certification` entry. The base action type keeps the execution contract and its `sensitivity` optional, because making them mandatory breaks every manifest that predates them; a deployment that wants the guarantee applies the profile at certification. The strict profile fails any action with no contract, any dimension missing or outside its permitted values, no sensitivity, an `accepted` or `long-running` completion without `completionDeadlineMs`, or an `immediate` completion with one. A manifest reaches certification without the registry, so the contract's content is checked and not only its presence. It validates a manifest or a module, asserts, and exposes the compiler's conformance adapter shape. Additive.
|
|
8
|
+
|
|
9
|
+
## 1.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 4c358ad: `ActionExecutionContract` gains an optional `completionDeadlineMs`. The registry refuses it on `completion: "immediate"`, since nothing external completes such an action, and refuses a non-positive value; both are new fields and break no existing manifest. `AdapterExecutionResult` gains `acceptedExternalOperation`, the explicit signal that a successful adapter call handed the work to an external system that will finish it by the given reference. Four host lifecycle event types are added: `ExternalOperationAccepted`, `ExternalOperationCompleted`, `ExternalOperationFailed`, `ExternalOperationContradicted`. All additive.
|
|
14
|
+
|
|
3
15
|
## 1.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/actions/index.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMSABJAED_cjs = require('../chunk-MSABJAED.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "ACTOR_TYPES", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkMSABJAED_cjs.ACTOR_TYPES; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "assertActionId", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkMSABJAED_cjs.assertActionId; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "assertActorType", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkMSABJAED_cjs.assertActorType; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "createActionRegistry", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkMSABJAED_cjs.createActionRegistry; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "isActorType", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkMSABJAED_cjs.isActorType; }
|
|
26
26
|
});
|
|
27
27
|
//# sourceMappingURL=index.cjs.map
|
|
28
28
|
//# sourceMappingURL=index.cjs.map
|
package/dist/actions/index.d.cts
CHANGED
|
@@ -99,7 +99,21 @@ interface ActionExecutionContract {
|
|
|
99
99
|
connectivity: ActionConnectivity;
|
|
100
100
|
authorityMoment: AuthorityMoment;
|
|
101
101
|
idempotency: ActionIdempotencyStance;
|
|
102
|
+
/**
|
|
103
|
+
* `immediate`: the invocation settles within the host's execution.
|
|
104
|
+
* `accepted` and `long-running`: an adapter may hand the work to an
|
|
105
|
+
* external system and the invocation stays running until that system
|
|
106
|
+
* completes it by reference through the host's completion ingress.
|
|
107
|
+
* Declare `completionDeadlineMs` on a `long-running` action so a callback
|
|
108
|
+
* that never comes is noticed rather than waited on forever.
|
|
109
|
+
*/
|
|
102
110
|
completion: ActionCompletionMode;
|
|
111
|
+
/**
|
|
112
|
+
* How long an accepted handoff may wait for its completion before the host
|
|
113
|
+
* moves the invocation to reconciliation. Without it, nothing sweeps the
|
|
114
|
+
* handoff. Refused on `immediate`, since nothing external completes it.
|
|
115
|
+
*/
|
|
116
|
+
completionDeadlineMs?: number;
|
|
103
117
|
consistency: ActionConsistency;
|
|
104
118
|
sensitivity?: ActionDataSensitivity;
|
|
105
119
|
}
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -99,7 +99,21 @@ interface ActionExecutionContract {
|
|
|
99
99
|
connectivity: ActionConnectivity;
|
|
100
100
|
authorityMoment: AuthorityMoment;
|
|
101
101
|
idempotency: ActionIdempotencyStance;
|
|
102
|
+
/**
|
|
103
|
+
* `immediate`: the invocation settles within the host's execution.
|
|
104
|
+
* `accepted` and `long-running`: an adapter may hand the work to an
|
|
105
|
+
* external system and the invocation stays running until that system
|
|
106
|
+
* completes it by reference through the host's completion ingress.
|
|
107
|
+
* Declare `completionDeadlineMs` on a `long-running` action so a callback
|
|
108
|
+
* that never comes is noticed rather than waited on forever.
|
|
109
|
+
*/
|
|
102
110
|
completion: ActionCompletionMode;
|
|
111
|
+
/**
|
|
112
|
+
* How long an accepted handoff may wait for its completion before the host
|
|
113
|
+
* moves the invocation to reconciliation. Without it, nothing sweeps the
|
|
114
|
+
* handoff. Refused on `immediate`, since nothing external completes it.
|
|
115
|
+
*/
|
|
116
|
+
completionDeadlineMs?: number;
|
|
103
117
|
consistency: ActionConsistency;
|
|
104
118
|
sensitivity?: ActionDataSensitivity;
|
|
105
119
|
}
|
package/dist/actions/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ACTOR_TYPES, assertActionId, assertActorType, createActionRegistry, isActorType } from '../chunk-
|
|
1
|
+
export { ACTOR_TYPES, assertActionId, assertActorType, createActionRegistry, isActorType } from '../chunk-2W6FORTE.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/adapters/index.cjs
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXZQZQ5SW_cjs = require('../chunk-XZQZQ5SW.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 chunkXZQZQ5SW_cjs.AdapterRegistry; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "MissingAdapterRegistrationError", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkXZQZQ5SW_cjs.MissingAdapterRegistrationError; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "assertAdapterOutcomeConsistency", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkXZQZQ5SW_cjs.assertAdapterOutcomeConsistency; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "classifyAdapterOutcome", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkXZQZQ5SW_cjs.classifyAdapterOutcome; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "executeWithAdapterRetry", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkXZQZQ5SW_cjs.executeWithAdapterRetry; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "getRetryDelayMs", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkXZQZQ5SW_cjs.getRetryDelayMs; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "resolveAdapterRetryPolicy", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkXZQZQ5SW_cjs.resolveAdapterRetryPolicy; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "shouldRetryAdapterOutcome", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkXZQZQ5SW_cjs.shouldRetryAdapterOutcome; }
|
|
38
38
|
});
|
|
39
39
|
//# sourceMappingURL=index.cjs.map
|
|
40
40
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -44,6 +44,20 @@ interface AdapterOutcomeEvidence {
|
|
|
44
44
|
effectMayHaveApplied?: boolean;
|
|
45
45
|
observedAt: Date | string;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* An adapter handed the work to an external system that will finish it later.
|
|
49
|
+
*
|
|
50
|
+
* Explicit rather than inferred from evidence: a successful adapter call that
|
|
51
|
+
* merely records a reference is not the same as one that has left the outcome
|
|
52
|
+
* in someone else's hands. The host keeps the invocation running and expects a
|
|
53
|
+
* completion carrying this reference through its completion ingress.
|
|
54
|
+
*/
|
|
55
|
+
interface AcceptedExternalOperation {
|
|
56
|
+
/** Opaque, non-secret reference the external system will complete by. */
|
|
57
|
+
externalReference: string;
|
|
58
|
+
/** When the external system said it expects to finish, if it said. */
|
|
59
|
+
expectedBy?: Date | string;
|
|
60
|
+
}
|
|
47
61
|
interface AdapterExecutionResult {
|
|
48
62
|
success: boolean;
|
|
49
63
|
correlationId?: string;
|
|
@@ -52,6 +66,8 @@ interface AdapterExecutionResult {
|
|
|
52
66
|
outcome?: AdapterOutcomeKind;
|
|
53
67
|
/** Durable evidence for ambiguous or timeout outcomes requiring reconciliation. */
|
|
54
68
|
outcomeEvidence?: AdapterOutcomeEvidence;
|
|
69
|
+
/** Present when a successful call handed the work off to finish elsewhere. */
|
|
70
|
+
acceptedExternalOperation?: AcceptedExternalOperation;
|
|
55
71
|
}
|
|
56
72
|
type AdapterExecutor = (input: Record<string, unknown>, context: AdapterExecutionContext) => Promise<AdapterExecutionResult>;
|
|
57
73
|
interface AdapterRetryPolicy {
|
|
@@ -155,4 +171,4 @@ declare function shouldRetryAdapterOutcome(kind: AdapterOutcomeKind, idempotent:
|
|
|
155
171
|
declare function assertAdapterOutcomeConsistency(result: AdapterExecutionResult): void;
|
|
156
172
|
declare function executeWithAdapterRetry<T>(options: ExecuteWithRetryOptions<T>): Promise<T>;
|
|
157
173
|
|
|
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 };
|
|
174
|
+
export { type AcceptedExternalOperation, 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
|
@@ -44,6 +44,20 @@ interface AdapterOutcomeEvidence {
|
|
|
44
44
|
effectMayHaveApplied?: boolean;
|
|
45
45
|
observedAt: Date | string;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* An adapter handed the work to an external system that will finish it later.
|
|
49
|
+
*
|
|
50
|
+
* Explicit rather than inferred from evidence: a successful adapter call that
|
|
51
|
+
* merely records a reference is not the same as one that has left the outcome
|
|
52
|
+
* in someone else's hands. The host keeps the invocation running and expects a
|
|
53
|
+
* completion carrying this reference through its completion ingress.
|
|
54
|
+
*/
|
|
55
|
+
interface AcceptedExternalOperation {
|
|
56
|
+
/** Opaque, non-secret reference the external system will complete by. */
|
|
57
|
+
externalReference: string;
|
|
58
|
+
/** When the external system said it expects to finish, if it said. */
|
|
59
|
+
expectedBy?: Date | string;
|
|
60
|
+
}
|
|
47
61
|
interface AdapterExecutionResult {
|
|
48
62
|
success: boolean;
|
|
49
63
|
correlationId?: string;
|
|
@@ -52,6 +66,8 @@ interface AdapterExecutionResult {
|
|
|
52
66
|
outcome?: AdapterOutcomeKind;
|
|
53
67
|
/** Durable evidence for ambiguous or timeout outcomes requiring reconciliation. */
|
|
54
68
|
outcomeEvidence?: AdapterOutcomeEvidence;
|
|
69
|
+
/** Present when a successful call handed the work off to finish elsewhere. */
|
|
70
|
+
acceptedExternalOperation?: AcceptedExternalOperation;
|
|
55
71
|
}
|
|
56
72
|
type AdapterExecutor = (input: Record<string, unknown>, context: AdapterExecutionContext) => Promise<AdapterExecutionResult>;
|
|
57
73
|
interface AdapterRetryPolicy {
|
|
@@ -155,4 +171,4 @@ declare function shouldRetryAdapterOutcome(kind: AdapterOutcomeKind, idempotent:
|
|
|
155
171
|
declare function assertAdapterOutcomeConsistency(result: AdapterExecutionResult): void;
|
|
156
172
|
declare function executeWithAdapterRetry<T>(options: ExecuteWithRetryOptions<T>): Promise<T>;
|
|
157
173
|
|
|
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 };
|
|
174
|
+
export { type AcceptedExternalOperation, 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, assertAdapterOutcomeConsistency, classifyAdapterOutcome, executeWithAdapterRetry, getRetryDelayMs, resolveAdapterRetryPolicy, shouldRetryAdapterOutcome } from '../chunk-
|
|
1
|
+
export { AdapterRegistry, MissingAdapterRegistrationError, assertAdapterOutcomeConsistency, classifyAdapterOutcome, executeWithAdapterRetry, getRetryDelayMs, resolveAdapterRetryPolicy, shouldRetryAdapterOutcome } from '../chunk-FAG2RTPM.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkPFKTD7V5_cjs = require('../chunk-PFKTD7V5.cjs');
|
|
4
|
+
require('../chunk-ZBXFRJON.cjs');
|
|
5
|
+
require('../chunk-KIVQBZOA.cjs');
|
|
6
|
+
require('../chunk-IFW43ELT.cjs');
|
|
7
|
+
require('../chunk-CXR6KEKQ.cjs');
|
|
8
|
+
require('../chunk-2AE6TMAX.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Object.defineProperty(exports, "STRICT_EXECUTION_CONTRACT_PROFILE", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkPFKTD7V5_cjs.STRICT_EXECUTION_CONTRACT_PROFILE; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "STRICT_EXECUTION_CONTRACT_PROFILE_ID", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkPFKTD7V5_cjs.STRICT_EXECUTION_CONTRACT_PROFILE_ID; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "executionContractProfile", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkPFKTD7V5_cjs.executionContractProfile; }
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=index.cjs.map
|
|
25
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ActionCompletionMode } from '../actions/index.cjs';
|
|
2
|
+
import { ModuleManifest } from '../manifest/index.cjs';
|
|
3
|
+
import { FabricModule } from '../modules/index.cjs';
|
|
4
|
+
import '../objects/index.cjs';
|
|
5
|
+
import '../policies/index.cjs';
|
|
6
|
+
import '../state-machines/index.cjs';
|
|
7
|
+
import '../projections/index.cjs';
|
|
8
|
+
|
|
9
|
+
type ExecutionContractFindingCode = "missing_execution_contract" | "invalid_execution_dimension" | "missing_sensitivity" | "missing_completion_deadline" | "unexpected_completion_deadline";
|
|
10
|
+
interface ExecutionContractFinding {
|
|
11
|
+
code: ExecutionContractFindingCode;
|
|
12
|
+
actionId: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
interface ExecutionContractProfileOptions {
|
|
16
|
+
/** Adapter and profile id. Defaults to the strict profile's id. */
|
|
17
|
+
id?: string;
|
|
18
|
+
/** Require `sensitivity`, which the base contract leaves optional. Defaults to true. */
|
|
19
|
+
requireSensitivity?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Completion modes that must declare `completionDeadlineMs`. Defaults to
|
|
22
|
+
* both modes that hand work off, since without a deadline nothing sweeps a
|
|
23
|
+
* callback that never comes.
|
|
24
|
+
*/
|
|
25
|
+
requireDeadlineFor?: readonly ActionCompletionMode[];
|
|
26
|
+
}
|
|
27
|
+
interface ExecutionContractProfile {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
validate(manifest: ModuleManifest): ExecutionContractFinding[];
|
|
30
|
+
assert(subject: FabricModule<unknown> | ModuleManifest): void;
|
|
31
|
+
/** For certification tooling: the compiler's conformance adapter shape. */
|
|
32
|
+
readonly adapter: {
|
|
33
|
+
id: string;
|
|
34
|
+
evaluate(manifest: ModuleManifest): ExecutionContractFinding[];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
declare const STRICT_EXECUTION_CONTRACT_PROFILE_ID = "fabric.execution-contract.strict";
|
|
38
|
+
declare function executionContractProfile(options?: ExecutionContractProfileOptions): ExecutionContractProfile;
|
|
39
|
+
/** All six dimensions on every action, and a deadline wherever work is handed off. */
|
|
40
|
+
declare const STRICT_EXECUTION_CONTRACT_PROFILE: ExecutionContractProfile;
|
|
41
|
+
|
|
42
|
+
export { type ExecutionContractFinding, type ExecutionContractFindingCode, type ExecutionContractProfile, type ExecutionContractProfileOptions, STRICT_EXECUTION_CONTRACT_PROFILE, STRICT_EXECUTION_CONTRACT_PROFILE_ID, executionContractProfile };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ActionCompletionMode } from '../actions/index.js';
|
|
2
|
+
import { ModuleManifest } from '../manifest/index.js';
|
|
3
|
+
import { FabricModule } from '../modules/index.js';
|
|
4
|
+
import '../objects/index.js';
|
|
5
|
+
import '../policies/index.js';
|
|
6
|
+
import '../state-machines/index.js';
|
|
7
|
+
import '../projections/index.js';
|
|
8
|
+
|
|
9
|
+
type ExecutionContractFindingCode = "missing_execution_contract" | "invalid_execution_dimension" | "missing_sensitivity" | "missing_completion_deadline" | "unexpected_completion_deadline";
|
|
10
|
+
interface ExecutionContractFinding {
|
|
11
|
+
code: ExecutionContractFindingCode;
|
|
12
|
+
actionId: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
interface ExecutionContractProfileOptions {
|
|
16
|
+
/** Adapter and profile id. Defaults to the strict profile's id. */
|
|
17
|
+
id?: string;
|
|
18
|
+
/** Require `sensitivity`, which the base contract leaves optional. Defaults to true. */
|
|
19
|
+
requireSensitivity?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Completion modes that must declare `completionDeadlineMs`. Defaults to
|
|
22
|
+
* both modes that hand work off, since without a deadline nothing sweeps a
|
|
23
|
+
* callback that never comes.
|
|
24
|
+
*/
|
|
25
|
+
requireDeadlineFor?: readonly ActionCompletionMode[];
|
|
26
|
+
}
|
|
27
|
+
interface ExecutionContractProfile {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
validate(manifest: ModuleManifest): ExecutionContractFinding[];
|
|
30
|
+
assert(subject: FabricModule<unknown> | ModuleManifest): void;
|
|
31
|
+
/** For certification tooling: the compiler's conformance adapter shape. */
|
|
32
|
+
readonly adapter: {
|
|
33
|
+
id: string;
|
|
34
|
+
evaluate(manifest: ModuleManifest): ExecutionContractFinding[];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
declare const STRICT_EXECUTION_CONTRACT_PROFILE_ID = "fabric.execution-contract.strict";
|
|
38
|
+
declare function executionContractProfile(options?: ExecutionContractProfileOptions): ExecutionContractProfile;
|
|
39
|
+
/** All six dimensions on every action, and a deadline wherever work is handed off. */
|
|
40
|
+
declare const STRICT_EXECUTION_CONTRACT_PROFILE: ExecutionContractProfile;
|
|
41
|
+
|
|
42
|
+
export { type ExecutionContractFinding, type ExecutionContractFindingCode, type ExecutionContractProfile, type ExecutionContractProfileOptions, STRICT_EXECUTION_CONTRACT_PROFILE, STRICT_EXECUTION_CONTRACT_PROFILE_ID, executionContractProfile };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { STRICT_EXECUTION_CONTRACT_PROFILE, STRICT_EXECUTION_CONTRACT_PROFILE_ID, executionContractProfile } from '../chunk-DDO4EQ2J.js';
|
|
2
|
+
import '../chunk-MC3GSVJ6.js';
|
|
3
|
+
import '../chunk-GRBZYDEV.js';
|
|
4
|
+
import '../chunk-ZAEVQSB5.js';
|
|
5
|
+
import '../chunk-JG35DT2G.js';
|
|
6
|
+
import '../chunk-B5DOGDPG.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -12,6 +12,10 @@ var BUILT_IN_EVENT_TYPES = Object.freeze([
|
|
|
12
12
|
"AdapterInvocationStarted",
|
|
13
13
|
"AdapterInvocationSucceeded",
|
|
14
14
|
"AdapterInvocationFailed",
|
|
15
|
+
"ExternalOperationAccepted",
|
|
16
|
+
"ExternalOperationCompleted",
|
|
17
|
+
"ExternalOperationFailed",
|
|
18
|
+
"ExternalOperationContradicted",
|
|
15
19
|
"WebhookReceived"
|
|
16
20
|
]);
|
|
17
21
|
function createEventContractRegistry(input = {}) {
|
|
@@ -36,5 +40,5 @@ function createEventContractRegistry(input = {}) {
|
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
exports.createEventContractRegistry = createEventContractRegistry;
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-2AE6TMAX.cjs.map
|
|
44
|
+
//# sourceMappingURL=chunk-2AE6TMAX.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../events/index.ts"],"names":[],"mappings":";;;AAgCA,IAAM,sBAAA,GAAyB,OAAO,MAAA,CAAO;AAAA,EAC5C,kBAAA;AAAA,EACA,kBAAA;AAAA,EACA;AACD,CAAC,CAAA;AAED,IAAM,oBAAA,GAAuB,OAAO,MAAA,CAAO;AAAA,EAC1C,mBAAA;AAAA,EACA,mBAAA;AAAA,EACA,0BAAA;AAAA,EACA,4BAAA;AAAA,EACA,yBAAA;AAAA,EACA;AACD,CAAC,CAAA;AAeM,SAAS,2BAAA,CAA4B,KAAA,GAA8E,EAAC,EAA0B;AACpJ,EAAA,MAAM,UAAA,mBAAa,IAAI,GAAA,CAAI,CAAC,GAAG,oBAAA,EAAsB,GAAI,KAAA,CAAM,UAAA,IAAc,EAAG,CAAC,CAAA;AACjF,EAAA,MAAM,YAAA,mBAAe,IAAI,GAAA,CAAI,CAAC,G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AI,GAAA,CAAI,CAAC,GAAG,oBAAA,EAAsB,GAAI,KAAA,CAAM,UAAA,IAAc,EAAG,CAAC,CAAA;AACjF,EAAA,MAAM,YAAA,mBAAe,IAAI,GAAA,CAAI,CAAC,GAAG,sBAAA,EAAwB,GAAI,KAAA,CAAM,YAAA,IAAgB,EAAG,CAAC,CAAA;AACvF,EAAA,OAAO;AAAA,IACN,kBAAkB,SAAA,EAAW;AAC5B,MAAA,IAAI,CAAC,SAAA,EAAW;AACf,QAAA,MAAM,IAAI,MAAM,4BAA4B,CAAA;AAAA,MAC7C;AACA,MAAA,UAAA,CAAW,IAAI,SAAS,CAAA;AAAA,IACzB,CAAA;AAAA,IACA,oBAAoB,WAAA,EAAa;AAChC,MAAA,IAAI,CAAC,WAAA,EAAa,MAAM,IAAI,MAAM,8BAA8B,CAAA;AAChE,MAAA,YAAA,CAAa,IAAI,WAAW,CAAA;AAAA,IAC7B,CAAA;AAAA,IACA,YAAA,EAAc,CAAC,SAAA,KAAc,UAAA,CAAW,IAAI,SAAS,CAAA;AAAA,IACrD,cAAA,EAAgB,CAAC,WAAA,KAAgB,YAAA,CAAa,IAAI,WAAW,CAAA;AAAA,IAC7D,YAAY,MAAM,KAAA,CAAM,IAAA,CAAK,UAAU,EAAE,IAAA,EAAK;AAAA,IAC9C,cAAc,MAAM,KAAA,CAAM,IAAA,CAAK,YAAY,EAAE,IAAA;AAAK,GACnD;AACD","file":"chunk-2AE6TMAX.cjs","sourcesContent":["export interface AssetEventEnvelope<TPayload = unknown> {\n\tid: string;\n\ttenantId: string;\n\tspaceId: string;\n\teventType: string;\n\teventSchemaVersion: number;\n\tsubjectType: string;\n\tsubjectId: string;\n\tactorId: string;\n\tactorType: string;\n\tactionInvocationId?: string;\n\tpayload: TPayload;\n\tsequence: number;\n\toccurredAt: Date;\n\trecordedAt: Date;\n\tcorrelationId: string;\n\tcausationId?: string;\n\tprovenance?: EventProvenance;\n\t/**\n\t * Mirrors the emitting action's declared consistency. Present only when the\n\t * action declares `provisional-until-reconciled`, so a consumer can tell a\n\t * settled fact from one still awaiting reconciliation without a lookup.\n\t * Additive and optional: tolerant consumers that ignore it stay correct.\n\t */\n\tconsistency?: \"authoritative-now\" | \"provisional-until-reconciled\";\n}\n\nexport interface EventProvenance {\n\tsource: \"ui\" | \"api\" | \"agent\" | \"worker\" | \"system\" | (string & {});\n\tauditAttributes?: Record<string, string>;\n}\n\nconst BUILT_IN_SUBJECT_TYPES = Object.freeze([\n\t\"ActionInvocation\",\n\t\"PolicyEvaluation\",\n\t\"AdapterInvocation\",\n]);\n\nconst BUILT_IN_EVENT_TYPES = Object.freeze([\n\t\"ComplianceBlocked\",\n\t\"StateTransitioned\",\n\t\"AdapterInvocationStarted\",\n\t\"AdapterInvocationSucceeded\",\n\t\"AdapterInvocationFailed\",\n\t\"ExternalOperationAccepted\",\n\t\"ExternalOperationCompleted\",\n\t\"ExternalOperationFailed\",\n\t\"ExternalOperationContradicted\",\n\t\"WebhookReceived\",\n]);\n\nexport type AssetEventSubjectType = string;\nexport type AssetEventType = string;\nexport type AssetEventActorType = \"natural_person\" | \"agent\" | \"adapter\" | \"system\" | \"service_account\" | \"external_system\" | \"integration\";\n\nexport interface EventContractRegistry {\n\tregisterEventType(eventType: string): void;\n\tregisterSubjectType(subjectType: string): void;\n\thasEventType(eventType: string): boolean;\n\thasSubjectType(subjectType: string): boolean;\n\teventTypes(): string[];\n\tsubjectTypes(): string[];\n}\n\nexport function createEventContractRegistry(input: { eventTypes?: readonly string[]; subjectTypes?: readonly string[] } = {}): EventContractRegistry {\n\tconst eventTypes = new Set([...BUILT_IN_EVENT_TYPES, ...(input.eventTypes ?? [])]);\n\tconst subjectTypes = new Set([...BUILT_IN_SUBJECT_TYPES, ...(input.subjectTypes ?? [])]);\n\treturn {\n\t\tregisterEventType(eventType) {\n\t\t\tif (!eventType) {\n\t\t\t\tthrow new Error(\"Event type cannot be empty\");\n\t\t\t}\n\t\t\teventTypes.add(eventType);\n\t\t},\n\t\tregisterSubjectType(subjectType) {\n\t\t\tif (!subjectType) throw new Error(\"Subject type cannot be empty\");\n\t\t\tsubjectTypes.add(subjectType);\n\t\t},\n\t\thasEventType: (eventType) => eventTypes.has(eventType),\n\t\thasSubjectType: (subjectType) => subjectTypes.has(subjectType),\n\t\teventTypes: () => Array.from(eventTypes).sort(),\n\t\tsubjectTypes: () => Array.from(subjectTypes).sort(),\n\t};\n}\n"]}
|
|
@@ -43,5 +43,5 @@ function createActionRegistry(definitions = []) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export { ACTOR_TYPES, assertActionId, assertActorType, createActionRegistry, isActorType };
|
|
46
|
-
//# sourceMappingURL=chunk-
|
|
47
|
-
//# sourceMappingURL=chunk-
|
|
46
|
+
//# sourceMappingURL=chunk-2W6FORTE.js.map
|
|
47
|
+
//# sourceMappingURL=chunk-2W6FORTE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../actions/index.ts"],"names":[],"mappings":";AAwBO,IAAM,WAAA,GAAoC;AAAA,EAChD,gBAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACD;AAEO,SAAS,YAAY,KAAA,EAAmC;AAC9D,EAAA,OAAQ,WAAA,CAAkC,SAAS,KAAK,CAAA;AACzD;AAEO,SAAS,gBAAgB,KAAA,EAA2C;AAC1E,EAAA,IAAI,CAAC,WAAA,CAAY,KAAK,CAAA,EAAG;AACxB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,mBAAA,EAAsB,KAAK,CAAA,CAAE,CAAA;AAAA,EAC9C;AACD;AA2KO,SAAS,eAAe,QAAA,EAAgD;AAC9E,EAAA,IAAI,CAAC,oCAAA,CAAqC,IAAA,CAAK,QAAQ,CAAA,EAAG;AACzD,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,mBAAA,EAAsB,QAAQ,CAAA,CAAE,CAAA;AAAA,EACjD;AACD;AAU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nexport type SchemaParseResult<T = unknown> =\n\t| { success: true; data: T }\n\t| { success: false; error: { issues: SchemaParseIssue[] } };\n\nexport interface SchemaValidator<T = unknown> {\n\tparse(input: unknown): T;\n\tsafeParse(input: unknown): SchemaParseResult<T>;\n}\n\nexport type ActorType =\n\t| \"natural_person\"\n\t| \"agent\"\n\t| \"system\"\n\t| \"service_account\"\n\t| \"external_system\"\n\t| \"integration\";\n\nexport const ACTOR_TYPES: readonly ActorType[] = [\n\t\"natural_person\",\n\t\"agent\",\n\t\"system\",\n\t\"service_account\",\n\t\"external_system\",\n\t\"integration\",\n] as const;\n\nexport function isActorType(value: string): value is ActorType {\n\treturn (ACTOR_TYPES as readonly string[]).includes(value);\n}\n\nexport function assertActorType(value: string): asserts value is ActorType {\n\tif (!isActorType(value)) {\n\t\tthrow new Error(`Invalid actorType: ${value}`);\n\t}\n}\n\nexport type ActionStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"blocked_by_policy\"\n\t| \"waiting_for_approval\"\n\t| \"reconciliation_required\"\n\t| \"validation_failed\";\n\nexport interface FabricRuntimeServices {\n\treadonly [serviceName: string]: unknown;\n}\n\nexport interface ActionContext<TDb = unknown> {\n\tactionInvocationId: string;\n\ttenantId: string;\n\tspaceId: string;\n\tactorId: string;\n\tactorType: ActorType;\n\tcorrelationId: string;\n\tcausationId?: string;\n\tprovenance?: { source: string; auditAttributes?: Record<string, string> };\n\tdb: TDb;\n\tservices?: FabricRuntimeServices;\n}\n\nexport interface ActionResult {\n\tsuccess: boolean;\n\tdata?: Record<string, unknown>;\n\terror?: string;\n}\n\nexport type ActionHandler<TDb = unknown> = (\n\tctx: ActionContext<TDb>,\n\tparams: unknown,\n) => Promise<ActionResult>;\n\nexport interface AdapterStepRetryPolicy {\n\tidempotent: boolean;\n\tmaxAttempts?: number;\n\tinitialDelayMs?: number;\n\tbackoffMultiplier?: number;\n\tmaxDelayMs?: number;\n}\n\nexport interface AdapterStep {\n\tadapterType: string;\n\toperation: string;\n\tretryPolicy?: AdapterStepRetryPolicy;\n\tgetInput: (\n\t\tparams: unknown,\n\t\thandlerResult: Record<string, unknown>,\n\t) => Record<string, unknown> | undefined;\n}\n\nexport interface ActionStateMachineBinding {\n\tentityType: string;\n\ttargetState: string | ((params: unknown) => string);\n\tgetEntityId: (params: unknown) => string | undefined;\n}\n\nexport interface ActionDefinition<TDb = unknown> {\n\tactionId: ActionId;\n\tnamespace: string;\n\tversion: number;\n\tschema: SchemaValidator;\n\t/** Optional validation contract for the public handler result data. */\n\tresultSchema?: SchemaValidator;\n\thandler?: ActionHandler<TDb>;\n\trequiredRoles?: string[];\n\trequiredPermissions?: string[];\n\tpolicies?: `${string}.v${number}`[];\n\temitsEvents: string[];\n\tidempotent: boolean;\n\tmutatesDomain: boolean;\n\t/** Portable execution semantics used by hosts, gateways, and generated capability contracts. */\n\texecution?: ActionExecutionContract;\n\tstateMachine?: ActionStateMachineBinding;\n\tadapterSteps?: AdapterStep[];\n\t/** Completion actions can attest only after all external adapter work succeeds. */\n\teventPhase?: \"before_adapters\" | \"after_adapters\";\n\t/**\n\t * If \"saga\", the action is a multi-step orchestration. The worker dispatches\n\t * to a registered saga implementation instead of running `handler` directly.\n\t */\n\tkind?: \"atomic\" | \"saga\";\n}\n\nexport type ActionConnectivity = \"online-required\" | \"offline-capturable\";\nexport type AuthorityMoment = \"capture\" | \"execution\" | \"both\";\nexport type ActionIdempotencyStance = \"required\" | \"supported\" | \"prohibited\";\nexport type ActionCompletionMode = \"immediate\" | \"accepted\" | \"long-running\";\nexport type ActionConsistency = \"authoritative-now\" | \"provisional-until-reconciled\";\nexport type ActionDataSensitivity = \"public\" | \"internal\" | \"confidential\" | \"restricted\";\n\nexport interface ActionExecutionContract {\n\tconnectivity: ActionConnectivity;\n\tauthorityMoment: AuthorityMoment;\n\tidempotency: ActionIdempotencyStance;\n\tcompletion: ActionCompletionMode;\n\tconsistency: ActionConsistency;\n\tsensitivity?: ActionDataSensitivity;\n}\n\nexport interface SagaContext {\n\tactionInvocationId: string;\n\ttenantId: string;\n\tspaceId: string;\n\tparameters: unknown;\n\tsleep?: (delayMs: number) => Promise<void>;\n\tquery?: <T = unknown>(model: string, operation: string, args: unknown) => Promise<T>;\n\t/**\n\t * Wait for a named external signal carrying a payload of `T`, with a timeout.\n\t *\n\t * Resolves with the payload of the first signal received, or `null` if the timeout\n\t * fires first. Subsequent signals with the same name received before another\n\t * `awaitSignal` call are buffered (FIFO) so no signal is lost.\n\t *\n\t * Intended for agent-driven and webhook-driven coordination: replace polling loops\n\t * with push-based wakeups while preserving the saga's deterministic replay\n\t * semantics (the runtime is responsible for capturing signals into workflow history).\n\t *\n\t * Optional. Runtimes that cannot implement push-based signaling (e.g. an in-memory\n\t * test harness) may omit this; sagas should treat absence as a fallback condition\n\t * and use `sleep` + `query` polling instead.\n\t *\n\t * Signal *senders* are runtime-specific (e.g. a Temporal `WorkflowClient.signal()`\n\t * call from an action handler). Apps that need to send signals from action\n\t * handlers should expose a coordination service via `ActionContext.services`\n\t * — the platform does not prescribe the sender API.\n\t *\n\t * @example\n\t * const payload = await ctx.awaitSignal?.<{ result: Record<string, unknown> }>(\n\t * \"userInputProcessed\",\n\t * 5 * 60 * 1000,\n\t * );\n\t * if (payload) { /* handle pushed result *\\/ }\n\t * else { /* timeout — fall back to deterministic path *\\/ }\n\t */\n\tawaitSignal?: <T = unknown>(signalName: string, timeoutMs: number) => Promise<T | null>;\n}\n\nexport interface SagaChildActionInput {\n\tsuffix: string;\n\tactionId: string;\n\tparameters: Record<string, unknown>;\n}\n\nexport type SagaRunChild = (input: SagaChildActionInput) => Promise<Record<string, unknown>>;\n\nexport interface SagaCompletionEvent {\n\teventType: string;\n\tsubjectType: string;\n\tsubjectId: string;\n\tpayload: unknown;\n\teventSchemaVersion?: number;\n}\n\nexport interface SagaCompletion {\n\tresultData: Record<string, unknown>;\n\tevent?: SagaCompletionEvent;\n}\n\nexport type SagaImplementation = (\n\tctx: SagaContext,\n\trunChild: SagaRunChild,\n) => Promise<SagaCompletion>;\n\nexport function assertActionId(actionId: string): asserts actionId is ActionId {\n\tif (!/^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_]*$/.test(actionId)) {\n\t\tthrow new Error(`Invalid action ID: ${actionId}`);\n\t}\n}\n\nexport interface ActionRegistry<TDb = unknown> {\n\tregister(definition: ActionDefinition<TDb>): void;\n\tregisterIfMissing(definition: ActionDefinition<TDb>): void;\n\tresolve(actionId: ActionId): ActionDefinition<TDb> | undefined;\n\thas(actionId: string): actionId is ActionId;\n\tids(): ActionId[];\n}\n\nexport function createActionRegistry<TDb = unknown>(definitions: readonly ActionDefinition<TDb>[] = []): ActionRegistry<TDb> {\n\tconst actions = new Map<ActionId, ActionDefinition<TDb>>();\n\tconst register = (definition: ActionDefinition<TDb>): void => {\n\t\tassertActionId(definition.actionId);\n\t\tif (actions.has(definition.actionId)) throw new Error(`Action \"${definition.actionId}\" is already registered`);\n\t\tif (definition.mutatesDomain && definition.emitsEvents.length === 0) {\n\t\t\tthrow new Error(`Action \"${definition.actionId}\" mutates domain but emits no events. Every mutating action must emit at least one AssetEvent.`);\n\t\t}\n\t\tactions.set(definition.actionId, definition);\n\t};\n\tfor (const definition of definitions) register(definition);\n\treturn {\n\t\tregister,\n\t\tregisterIfMissing(definition) {\n\t\t\tif (!actions.has(definition.actionId)) register(definition);\n\t\t},\n\t\tresolve: (actionId) => actions.get(actionId),\n\t\thas: (actionId): actionId is ActionId => actions.has(actionId as ActionId),\n\t\tids: () => Array.from(actions.keys()),\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../actions/index.ts"],"names":[],"mappings":";AAwBO,IAAM,WAAA,GAAoC;AAAA,EAChD,gBAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACD;AAEO,SAAS,YAAY,KAAA,EAAmC;AAC9D,EAAA,OAAQ,WAAA,CAAkC,SAAS,K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A,CAAI,WAAW,QAAQ,CAAA,WAAY,UAAU,CAAA;AAAA,IAC3D,CAAA;AAAA,IACA,OAAA,EAAS,CAAC,QAAA,KAAa,OAAA,CAAQ,IAAI,QAAQ,CAAA;AAAA,IAC3C,GAAA,EAAK,CAAC,QAAA,KAAmC,OAAA,CAAQ,IAAI,QAAoB,CAAA;AAAA,IACzE,KAAK,MAAM,KAAA,CAAM,IAAA,CAAK,OAAA,CAAQ,MAAM;AAAA,GACrC;AACD","file":"chunk-2W6FORTE.js","sourcesContent":["export type ActionId = `${string}.${string}`;\n\nexport interface SchemaParseIssue {\n\tpath: PropertyKey[];\n\tmessage: string;\n}\n\nexport type SchemaParseResult<T = unknown> =\n\t| { success: true; data: T }\n\t| { success: false; error: { issues: SchemaParseIssue[] } };\n\nexport interface SchemaValidator<T = unknown> {\n\tparse(input: unknown): T;\n\tsafeParse(input: unknown): SchemaParseResult<T>;\n}\n\nexport type ActorType =\n\t| \"natural_person\"\n\t| \"agent\"\n\t| \"system\"\n\t| \"service_account\"\n\t| \"external_system\"\n\t| \"integration\";\n\nexport const ACTOR_TYPES: readonly ActorType[] = [\n\t\"natural_person\",\n\t\"agent\",\n\t\"system\",\n\t\"service_account\",\n\t\"external_system\",\n\t\"integration\",\n] as const;\n\nexport function isActorType(value: string): value is ActorType {\n\treturn (ACTOR_TYPES as readonly string[]).includes(value);\n}\n\nexport function assertActorType(value: string): asserts value is ActorType {\n\tif (!isActorType(value)) {\n\t\tthrow new Error(`Invalid actorType: ${value}`);\n\t}\n}\n\nexport type ActionStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"blocked_by_policy\"\n\t| \"waiting_for_approval\"\n\t| \"reconciliation_required\"\n\t| \"validation_failed\";\n\nexport interface FabricRuntimeServices {\n\treadonly [serviceName: string]: unknown;\n}\n\nexport interface ActionContext<TDb = unknown> {\n\tactionInvocationId: string;\n\ttenantId: string;\n\tspaceId: string;\n\tactorId: string;\n\tactorType: ActorType;\n\tcorrelationId: string;\n\tcausationId?: string;\n\tprovenance?: { source: string; auditAttributes?: Record<string, string> };\n\tdb: TDb;\n\tservices?: FabricRuntimeServices;\n}\n\nexport interface ActionResult {\n\tsuccess: boolean;\n\tdata?: Record<string, unknown>;\n\terror?: string;\n}\n\nexport type ActionHandler<TDb = unknown> = (\n\tctx: ActionContext<TDb>,\n\tparams: unknown,\n) => Promise<ActionResult>;\n\nexport interface AdapterStepRetryPolicy {\n\tidempotent: boolean;\n\tmaxAttempts?: number;\n\tinitialDelayMs?: number;\n\tbackoffMultiplier?: number;\n\tmaxDelayMs?: number;\n}\n\nexport interface AdapterStep {\n\tadapterType: string;\n\toperation: string;\n\tretryPolicy?: AdapterStepRetryPolicy;\n\tgetInput: (\n\t\tparams: unknown,\n\t\thandlerResult: Record<string, unknown>,\n\t) => Record<string, unknown> | undefined;\n}\n\nexport interface ActionStateMachineBinding {\n\tentityType: string;\n\ttargetState: string | ((params: unknown) => string);\n\tgetEntityId: (params: unknown) => string | undefined;\n}\n\nexport interface ActionDefinition<TDb = unknown> {\n\tactionId: ActionId;\n\tnamespace: string;\n\tversion: number;\n\tschema: SchemaValidator;\n\t/** Optional validation contract for the public handler result data. */\n\tresultSchema?: SchemaValidator;\n\thandler?: ActionHandler<TDb>;\n\trequiredRoles?: string[];\n\trequiredPermissions?: string[];\n\tpolicies?: `${string}.v${number}`[];\n\temitsEvents: string[];\n\tidempotent: boolean;\n\tmutatesDomain: boolean;\n\t/** Portable execution semantics used by hosts, gateways, and generated capability contracts. */\n\texecution?: ActionExecutionContract;\n\tstateMachine?: ActionStateMachineBinding;\n\tadapterSteps?: AdapterStep[];\n\t/** Completion actions can attest only after all external adapter work succeeds. */\n\teventPhase?: \"before_adapters\" | \"after_adapters\";\n\t/**\n\t * If \"saga\", the action is a multi-step orchestration. The worker dispatches\n\t * to a registered saga implementation instead of running `handler` directly.\n\t */\n\tkind?: \"atomic\" | \"saga\";\n}\n\nexport type ActionConnectivity = \"online-required\" | \"offline-capturable\";\nexport type AuthorityMoment = \"capture\" | \"execution\" | \"both\";\nexport type ActionIdempotencyStance = \"required\" | \"supported\" | \"prohibited\";\nexport type ActionCompletionMode = \"immediate\" | \"accepted\" | \"long-running\";\nexport type ActionConsistency = \"authoritative-now\" | \"provisional-until-reconciled\";\nexport type ActionDataSensitivity = \"public\" | \"internal\" | \"confidential\" | \"restricted\";\n\nexport interface ActionExecutionContract {\n\tconnectivity: ActionConnectivity;\n\tauthorityMoment: AuthorityMoment;\n\tidempotency: ActionIdempotencyStance;\n\t/**\n\t * `immediate`: the invocation settles within the host's execution.\n\t * `accepted` and `long-running`: an adapter may hand the work to an\n\t * external system and the invocation stays running until that system\n\t * completes it by reference through the host's completion ingress.\n\t * Declare `completionDeadlineMs` on a `long-running` action so a callback\n\t * that never comes is noticed rather than waited on forever.\n\t */\n\tcompletion: ActionCompletionMode;\n\t/**\n\t * How long an accepted handoff may wait for its completion before the host\n\t * moves the invocation to reconciliation. Without it, nothing sweeps the\n\t * handoff. Refused on `immediate`, since nothing external completes it.\n\t */\n\tcompletionDeadlineMs?: number;\n\tconsistency: ActionConsistency;\n\tsensitivity?: ActionDataSensitivity;\n}\n\nexport interface SagaContext {\n\tactionInvocationId: string;\n\ttenantId: string;\n\tspaceId: string;\n\tparameters: unknown;\n\tsleep?: (delayMs: number) => Promise<void>;\n\tquery?: <T = unknown>(model: string, operation: string, args: unknown) => Promise<T>;\n\t/**\n\t * Wait for a named external signal carrying a payload of `T`, with a timeout.\n\t *\n\t * Resolves with the payload of the first signal received, or `null` if the timeout\n\t * fires first. Subsequent signals with the same name received before another\n\t * `awaitSignal` call are buffered (FIFO) so no signal is lost.\n\t *\n\t * Intended for agent-driven and webhook-driven coordination: replace polling loops\n\t * with push-based wakeups while preserving the saga's deterministic replay\n\t * semantics (the runtime is responsible for capturing signals into workflow history).\n\t *\n\t * Optional. Runtimes that cannot implement push-based signaling (e.g. an in-memory\n\t * test harness) may omit this; sagas should treat absence as a fallback condition\n\t * and use `sleep` + `query` polling instead.\n\t *\n\t * Signal *senders* are runtime-specific (e.g. a Temporal `WorkflowClient.signal()`\n\t * call from an action handler). Apps that need to send signals from action\n\t * handlers should expose a coordination service via `ActionContext.services`\n\t * — the platform does not prescribe the sender API.\n\t *\n\t * @example\n\t * const payload = await ctx.awaitSignal?.<{ result: Record<string, unknown> }>(\n\t * \"userInputProcessed\",\n\t * 5 * 60 * 1000,\n\t * );\n\t * if (payload) { /* handle pushed result *\\/ }\n\t * else { /* timeout — fall back to deterministic path *\\/ }\n\t */\n\tawaitSignal?: <T = unknown>(signalName: string, timeoutMs: number) => Promise<T | null>;\n}\n\nexport interface SagaChildActionInput {\n\tsuffix: string;\n\tactionId: string;\n\tparameters: Record<string, unknown>;\n}\n\nexport type SagaRunChild = (input: SagaChildActionInput) => Promise<Record<string, unknown>>;\n\nexport interface SagaCompletionEvent {\n\teventType: string;\n\tsubjectType: string;\n\tsubjectId: string;\n\tpayload: unknown;\n\teventSchemaVersion?: number;\n}\n\nexport interface SagaCompletion {\n\tresultData: Record<string, unknown>;\n\tevent?: SagaCompletionEvent;\n}\n\nexport type SagaImplementation = (\n\tctx: SagaContext,\n\trunChild: SagaRunChild,\n) => Promise<SagaCompletion>;\n\nexport function assertActionId(actionId: string): asserts actionId is ActionId {\n\tif (!/^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_]*$/.test(actionId)) {\n\t\tthrow new Error(`Invalid action ID: ${actionId}`);\n\t}\n}\n\nexport interface ActionRegistry<TDb = unknown> {\n\tregister(definition: ActionDefinition<TDb>): void;\n\tregisterIfMissing(definition: ActionDefinition<TDb>): void;\n\tresolve(actionId: ActionId): ActionDefinition<TDb> | undefined;\n\thas(actionId: string): actionId is ActionId;\n\tids(): ActionId[];\n}\n\nexport function createActionRegistry<TDb = unknown>(definitions: readonly ActionDefinition<TDb>[] = []): ActionRegistry<TDb> {\n\tconst actions = new Map<ActionId, ActionDefinition<TDb>>();\n\tconst register = (definition: ActionDefinition<TDb>): void => {\n\t\tassertActionId(definition.actionId);\n\t\tif (actions.has(definition.actionId)) throw new Error(`Action \"${definition.actionId}\" is already registered`);\n\t\tif (definition.mutatesDomain && definition.emitsEvents.length === 0) {\n\t\t\tthrow new Error(`Action \"${definition.actionId}\" mutates domain but emits no events. Every mutating action must emit at least one AssetEvent.`);\n\t\t}\n\t\tactions.set(definition.actionId, definition);\n\t};\n\tfor (const definition of definitions) register(definition);\n\treturn {\n\t\tregister,\n\t\tregisterIfMissing(definition) {\n\t\t\tif (!actions.has(definition.actionId)) register(definition);\n\t\t},\n\t\tresolve: (actionId) => actions.get(actionId),\n\t\thas: (actionId): actionId is ActionId => actions.has(actionId as ActionId),\n\t\tids: () => Array.from(actions.keys()),\n\t};\n}\n"]}
|
|
@@ -10,6 +10,10 @@ var BUILT_IN_EVENT_TYPES = Object.freeze([
|
|
|
10
10
|
"AdapterInvocationStarted",
|
|
11
11
|
"AdapterInvocationSucceeded",
|
|
12
12
|
"AdapterInvocationFailed",
|
|
13
|
+
"ExternalOperationAccepted",
|
|
14
|
+
"ExternalOperationCompleted",
|
|
15
|
+
"ExternalOperationFailed",
|
|
16
|
+
"ExternalOperationContradicted",
|
|
13
17
|
"WebhookReceived"
|
|
14
18
|
]);
|
|
15
19
|
function createEventContractRegistry(input = {}) {
|
|
@@ -34,5 +38,5 @@ function createEventContractRegistry(input = {}) {
|
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
export { createEventContractRegistry };
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
41
|
+
//# sourceMappingURL=chunk-B5DOGDPG.js.map
|
|
42
|
+
//# sourceMappingURL=chunk-B5DOGDPG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../events/index.ts"],"names":[],"mappings":";AAgCA,IAAM,sBAAA,GAAyB,OAAO,MAAA,CAAO;AAAA,EAC5C,kBAAA;AAAA,EACA,kBAAA;AAAA,EAC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MAAM,KAAA,CAAM,IAAA,CAAK,YAAY,EAAE,IAAA;AAAK,GACnD;AACD","file":"chunk-B5DOGDPG.js","sourcesContent":["export interface AssetEventEnvelope<TPayload = unknown> {\n\tid: string;\n\ttenantId: string;\n\tspaceId: string;\n\teventType: string;\n\teventSchemaVersion: number;\n\tsubjectType: string;\n\tsubjectId: string;\n\tactorId: string;\n\tactorType: string;\n\tactionInvocationId?: string;\n\tpayload: TPayload;\n\tsequence: number;\n\toccurredAt: Date;\n\trecordedAt: Date;\n\tcorrelationId: string;\n\tcausationId?: string;\n\tprovenance?: EventProvenance;\n\t/**\n\t * Mirrors the emitting action's declared consistency. Present only when the\n\t * action declares `provisional-until-reconciled`, so a consumer can tell a\n\t * settled fact from one still awaiting reconciliation without a lookup.\n\t * Additive and optional: tolerant consumers that ignore it stay correct.\n\t */\n\tconsistency?: \"authoritative-now\" | \"provisional-until-reconciled\";\n}\n\nexport interface EventProvenance {\n\tsource: \"ui\" | \"api\" | \"agent\" | \"worker\" | \"system\" | (string & {});\n\tauditAttributes?: Record<string, string>;\n}\n\nconst BUILT_IN_SUBJECT_TYPES = Object.freeze([\n\t\"ActionInvocation\",\n\t\"PolicyEvaluation\",\n\t\"AdapterInvocation\",\n]);\n\nconst BUILT_IN_EVENT_TYPES = Object.freeze([\n\t\"ComplianceBlocked\",\n\t\"StateTransitioned\",\n\t\"AdapterInvocationStarted\",\n\t\"AdapterInvocationSucceeded\",\n\t\"AdapterInvocationFailed\",\n\t\"ExternalOperationAccepted\",\n\t\"ExternalOperationCompleted\",\n\t\"ExternalOperationFailed\",\n\t\"ExternalOperationContradicted\",\n\t\"WebhookReceived\",\n]);\n\nexport type AssetEventSubjectType = string;\nexport type AssetEventType = string;\nexport type AssetEventActorType = \"natural_person\" | \"agent\" | \"adapter\" | \"system\" | \"service_account\" | \"external_system\" | \"integration\";\n\nexport interface EventContractRegistry {\n\tregisterEventType(eventType: string): void;\n\tregisterSubjectType(subjectType: string): void;\n\thasEventType(eventType: string): boolean;\n\thasSubjectType(subjectType: string): boolean;\n\teventTypes(): string[];\n\tsubjectTypes(): string[];\n}\n\nexport function createEventContractRegistry(input: { eventTypes?: readonly string[]; subjectTypes?: readonly string[] } = {}): EventContractRegistry {\n\tconst eventTypes = new Set([...BUILT_IN_EVENT_TYPES, ...(input.eventTypes ?? [])]);\n\tconst subjectTypes = new Set([...BUILT_IN_SUBJECT_TYPES, ...(input.subjectTypes ?? [])]);\n\treturn {\n\t\tregisterEventType(eventType) {\n\t\t\tif (!eventType) {\n\t\t\t\tthrow new Error(\"Event type cannot be empty\");\n\t\t\t}\n\t\t\teventTypes.add(eventType);\n\t\t},\n\t\tregisterSubjectType(subjectType) {\n\t\t\tif (!subjectType) throw new Error(\"Subject type cannot be empty\");\n\t\t\tsubjectTypes.add(subjectType);\n\t\t},\n\t\thasEventType: (eventType) => eventTypes.has(eventType),\n\t\thasSubjectType: (subjectType) => subjectTypes.has(subjectType),\n\t\teventTypes: () => Array.from(eventTypes).sort(),\n\t\tsubjectTypes: () => Array.from(subjectTypes).sort(),\n\t};\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdapterRegistry } from './chunk-
|
|
1
|
+
import { AdapterRegistry } from './chunk-FAG2RTPM.js';
|
|
2
2
|
|
|
3
3
|
// testing/index.ts
|
|
4
4
|
function createFakeActionContext(options = {}) {
|
|
@@ -23,5 +23,5 @@ function createDeterministicIdFactory(prefix = "test") {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export { createDeterministicIdFactory, createFakeActionContext, createInMemoryAdapterRegistry };
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-DCC3UIUJ.js.map
|
|
27
|
+
//# sourceMappingURL=chunk-DCC3UIUJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../testing/index.ts"],"names":[],"mappings":";;;AAeO,SAAS,u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AAQ,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,IAAI,eAAA,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-DCC3UIUJ.js","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"]}
|