@fabricorg/platform 1.9.0 → 1.10.1
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 +56 -0
- package/README.md +48 -2
- package/dist/actions/index.cjs +45 -26
- package/dist/actions/index.cjs.map +1 -1
- package/dist/actions/index.d.cts +225 -226
- package/dist/actions/index.d.ts +225 -226
- package/dist/actions/index.js +41 -2
- package/dist/actions/index.js.map +1 -1
- package/dist/adapters/index.cjs +696 -66
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +367 -365
- package/dist/adapters/index.d.ts +367 -365
- package/dist/adapters/index.js +682 -2
- package/dist/adapters/index.js.map +1 -1
- package/dist/agent-hitl/index.cjs +21 -10
- package/dist/agent-hitl/index.cjs.map +1 -1
- package/dist/agent-hitl/index.d.cts +30 -30
- package/dist/agent-hitl/index.d.ts +30 -30
- package/dist/agent-hitl/index.js +21 -2
- package/dist/agent-hitl/index.js.map +1 -1
- package/dist/certification/index.cjs +109 -24
- package/dist/certification/index.cjs.map +1 -1
- package/dist/certification/index.d.cts +33 -39
- package/dist/certification/index.d.ts +33 -39
- package/dist/certification/index.js +107 -8
- package/dist/certification/index.js.map +1 -1
- package/dist/discovery/index.cjs +12 -10
- package/dist/discovery/index.cjs.map +1 -1
- package/dist/discovery/index.d.cts +2 -10
- package/dist/discovery/index.d.ts +2 -10
- package/dist/discovery/index.js +12 -2
- package/dist/discovery/index.js.map +1 -1
- package/dist/engine-B4csEOEc.js +223 -0
- package/dist/engine-B4csEOEc.js.map +1 -0
- package/dist/engine-BqScuhrT.cjs +246 -0
- package/dist/engine-BqScuhrT.cjs.map +1 -0
- package/dist/events/index.cjs +39 -10
- package/dist/events/index.cjs.map +1 -1
- package/dist/events/index.d.cts +43 -43
- package/dist/events/index.d.ts +43 -43
- package/dist/events/index.js +39 -2
- package/dist/events/index.js.map +1 -1
- package/dist/evidence/index.cjs +12 -50
- package/dist/evidence/index.d.cts +2 -229
- package/dist/evidence/index.d.ts +2 -229
- package/dist/evidence/index.js +1 -5
- package/dist/evidence-BuCICb0c.js +516 -0
- package/dist/evidence-BuCICb0c.js.map +1 -0
- package/dist/evidence-Cq48eDvA.cjs +575 -0
- package/dist/evidence-Cq48eDvA.cjs.map +1 -0
- package/dist/governance/index.cjs +24 -18
- package/dist/governance/index.cjs.map +1 -1
- package/dist/governance/index.d.cts +80 -83
- package/dist/governance/index.d.ts +80 -83
- package/dist/governance/index.js +22 -2
- package/dist/governance/index.js.map +1 -1
- package/dist/ids/index.cjs +52 -22
- package/dist/ids/index.cjs.map +1 -1
- package/dist/ids/index.d.cts +17 -17
- package/dist/ids/index.d.ts +17 -17
- package/dist/ids/index.js +49 -2
- package/dist/ids/index.js.map +1 -1
- package/dist/index-9jasmw76.d.cts +124 -0
- package/dist/index-BXpeFdk2.d.cts +190 -0
- package/dist/index-BXpeFdk2.d.ts +190 -0
- package/dist/index-BnbsKZsT.d.cts +231 -0
- package/dist/index-CIl1rYRv.d.cts +11 -0
- package/dist/index-CIl1rYRv.d.ts +11 -0
- package/dist/index-CVHA1ypT.d.cts +262 -0
- package/dist/index-DZ4mnNb7.d.cts +78 -0
- package/dist/index-DZ4mnNb7.d.ts +78 -0
- package/dist/index-IqcDvl69.d.ts +124 -0
- package/dist/index-fmUiRBXu.d.cts +57 -0
- package/dist/index-fmUiRBXu.d.ts +57 -0
- package/dist/index-sPUPs8pr.d.ts +262 -0
- package/dist/index-z9-CYOIo.d.ts +231 -0
- package/dist/index.cjs +111 -385
- package/dist/index.d.cts +18 -17
- package/dist/index.d.ts +18 -17
- package/dist/index.js +19 -20
- package/dist/manifest/index.cjs +224 -35
- package/dist/manifest/index.cjs.map +1 -1
- package/dist/manifest/index.d.cts +130 -131
- package/dist/manifest/index.d.ts +130 -131
- package/dist/manifest/index.js +219 -7
- package/dist/manifest/index.js.map +1 -1
- package/dist/modules/index.cjs +281 -42
- package/dist/modules/index.cjs.map +1 -1
- package/dist/modules/index.d.cts +157 -159
- package/dist/modules/index.d.ts +157 -159
- package/dist/modules/index.js +274 -6
- package/dist/modules/index.js.map +1 -1
- package/dist/objects/index.cjs +355 -22
- package/dist/objects/index.cjs.map +1 -1
- package/dist/objects/index.d.cts +2 -77
- package/dist/objects/index.d.ts +2 -77
- package/dist/objects/index.js +352 -2
- package/dist/objects/index.js.map +1 -1
- package/dist/policies/index.cjs +14 -48
- package/dist/policies/index.d.cts +2 -247
- package/dist/policies/index.d.ts +2 -247
- package/dist/policies/index.js +1 -3
- package/dist/policies-DH_GCXQ-.js +627 -0
- package/dist/policies-DH_GCXQ-.js.map +1 -0
- package/dist/policies-Nxbp1CH8.cjs +698 -0
- package/dist/policies-Nxbp1CH8.cjs.map +1 -0
- package/dist/privacy/index.cjs +26 -43
- package/dist/privacy/index.cjs.map +1 -1
- package/dist/privacy/index.d.cts +2 -189
- package/dist/privacy/index.d.ts +2 -189
- package/dist/privacy/index.js +18 -3
- package/dist/privacy/index.js.map +1 -1
- package/dist/projections/index.cjs +241 -23
- package/dist/projections/index.cjs.map +1 -1
- package/dist/projections/index.d.cts +2 -125
- package/dist/projections/index.d.ts +2 -125
- package/dist/projections/index.js +238 -3
- package/dist/projections/index.js.map +1 -1
- package/dist/state-machines/index.cjs +76 -18
- package/dist/state-machines/index.cjs.map +1 -1
- package/dist/state-machines/index.d.cts +2 -55
- package/dist/state-machines/index.d.ts +2 -55
- package/dist/state-machines/index.js +74 -2
- package/dist/state-machines/index.js.map +1 -1
- package/dist/testing/index.cjs +27 -19
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +17 -19
- package/dist/testing/index.d.ts +17 -19
- package/dist/testing/index.js +25 -3
- package/dist/testing/index.js.map +1 -1
- package/package.json +6 -5
- package/dist/chunk-2AE6TMAX.cjs +0 -44
- package/dist/chunk-2AE6TMAX.cjs.map +0 -1
- package/dist/chunk-6HY35TKB.cjs +0 -491
- package/dist/chunk-6HY35TKB.cjs.map +0 -1
- package/dist/chunk-6UGEIDLC.cjs +0 -26
- package/dist/chunk-6UGEIDLC.cjs.map +0 -1
- package/dist/chunk-7GAWSUOG.js +0 -64
- package/dist/chunk-7GAWSUOG.js.map +0 -1
- package/dist/chunk-AFXFAEWA.js +0 -673
- package/dist/chunk-AFXFAEWA.js.map +0 -1
- package/dist/chunk-AFXKSIVI.cjs +0 -540
- package/dist/chunk-AFXKSIVI.cjs.map +0 -1
- package/dist/chunk-B5DOGDPG.js +0 -42
- package/dist/chunk-B5DOGDPG.js.map +0 -1
- package/dist/chunk-BJGZE3GE.js +0 -20
- package/dist/chunk-BJGZE3GE.js.map +0 -1
- package/dist/chunk-CRZXTZ36.cjs +0 -258
- package/dist/chunk-CRZXTZ36.cjs.map +0 -1
- package/dist/chunk-D4SWRBUH.cjs +0 -22
- package/dist/chunk-D4SWRBUH.cjs.map +0 -1
- package/dist/chunk-DBTAUI6C.cjs +0 -395
- package/dist/chunk-DBTAUI6C.cjs.map +0 -1
- package/dist/chunk-EMSAFNPX.js +0 -98
- package/dist/chunk-EMSAFNPX.js.map +0 -1
- package/dist/chunk-F3E5SXPN.cjs +0 -28
- package/dist/chunk-F3E5SXPN.cjs.map +0 -1
- package/dist/chunk-HEYMMVDP.js +0 -480
- package/dist/chunk-HEYMMVDP.js.map +0 -1
- package/dist/chunk-IFW43ELT.cjs +0 -331
- package/dist/chunk-IFW43ELT.cjs.map +0 -1
- package/dist/chunk-LFE74IJX.js +0 -20
- package/dist/chunk-LFE74IJX.js.map +0 -1
- package/dist/chunk-LZSE6QGQ.cjs +0 -60
- package/dist/chunk-LZSE6QGQ.cjs.map +0 -1
- package/dist/chunk-MCWSUGB3.cjs +0 -102
- package/dist/chunk-MCWSUGB3.cjs.map +0 -1
- package/dist/chunk-MLBALEUR.js +0 -290
- package/dist/chunk-MLBALEUR.js.map +0 -1
- package/dist/chunk-NNXQZPB3.cjs +0 -31
- package/dist/chunk-NNXQZPB3.cjs.map +0 -1
- package/dist/chunk-OFCCZ27Z.js +0 -26
- package/dist/chunk-OFCCZ27Z.js.map +0 -1
- package/dist/chunk-PDN5DOLQ.js +0 -242
- package/dist/chunk-PDN5DOLQ.js.map +0 -1
- package/dist/chunk-PIDZQAEL.js +0 -50
- package/dist/chunk-PIDZQAEL.js.map +0 -1
- package/dist/chunk-Q4Q4JPR3.js +0 -524
- package/dist/chunk-Q4Q4JPR3.js.map +0 -1
- package/dist/chunk-RALMUSOX.js +0 -55
- package/dist/chunk-RALMUSOX.js.map +0 -1
- package/dist/chunk-SNTV45LH.cjs +0 -295
- package/dist/chunk-SNTV45LH.cjs.map +0 -1
- package/dist/chunk-TBS2S5AX.cjs +0 -40
- package/dist/chunk-TBS2S5AX.cjs.map +0 -1
- package/dist/chunk-TYNIFC7J.js +0 -253
- package/dist/chunk-TYNIFC7J.js.map +0 -1
- package/dist/chunk-UGWGHTNC.cjs +0 -56
- package/dist/chunk-UGWGHTNC.cjs.map +0 -1
- package/dist/chunk-WI7CWNYI.cjs +0 -68
- package/dist/chunk-WI7CWNYI.cjs.map +0 -1
- package/dist/chunk-WNZP53GI.js +0 -386
- package/dist/chunk-WNZP53GI.js.map +0 -1
- package/dist/chunk-WQ3BYI7T.cjs +0 -249
- package/dist/chunk-WQ3BYI7T.cjs.map +0 -1
- package/dist/chunk-Y2PJLRIY.js +0 -36
- package/dist/chunk-Y2PJLRIY.js.map +0 -1
- package/dist/chunk-YGIPN3TU.cjs +0 -684
- package/dist/chunk-YGIPN3TU.cjs.map +0 -1
- package/dist/chunk-ZAEVQSB5.js +0 -326
- package/dist/chunk-ZAEVQSB5.js.map +0 -1
- package/dist/chunk-ZMQTV5OJ.js +0 -27
- package/dist/chunk-ZMQTV5OJ.js.map +0 -1
- package/dist/evidence/index.cjs.map +0 -1
- package/dist/evidence/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/policies/index.cjs.map +0 -1
- package/dist/policies/index.js.map +0 -1
package/dist/actions/index.d.cts
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { SurfaceDeclaration } from
|
|
2
|
-
|
|
3
|
-
type ActionId = `${string}.${string}`;
|
|
4
|
-
interface SchemaParseIssue {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { t as SurfaceDeclaration } from "../index-CIl1rYRv.cjs";
|
|
2
|
+
//#region actions/index.d.ts
|
|
3
|
+
export type ActionId = `${string}.${string}`;
|
|
4
|
+
export interface SchemaParseIssue {
|
|
5
|
+
path: PropertyKey[];
|
|
6
|
+
message: string;
|
|
7
7
|
}
|
|
8
|
-
type SchemaParseResult<T = unknown> = {
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export type SchemaParseResult<T = unknown> = {
|
|
9
|
+
success: true;
|
|
10
|
+
data: T;
|
|
11
11
|
} | {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
success: false;
|
|
13
|
+
error: {
|
|
14
|
+
issues: SchemaParseIssue[];
|
|
15
|
+
};
|
|
16
16
|
};
|
|
17
|
-
interface SchemaValidator<T = unknown> {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
export interface SchemaValidator<T = unknown> {
|
|
18
|
+
parse(input: unknown): T;
|
|
19
|
+
safeParse(input: unknown): SchemaParseResult<T>;
|
|
20
20
|
}
|
|
21
|
-
type ActorType = "natural_person" | "agent" | "system" | "service_account" | "external_system" | "integration";
|
|
22
|
-
declare const ACTOR_TYPES: readonly ActorType[];
|
|
23
|
-
declare function isActorType(value: string): value is ActorType;
|
|
24
|
-
declare function assertActorType(value: string): asserts value is ActorType;
|
|
25
|
-
type ActionStatus = "pending" | "running" | "completed" | "failed" | "blocked_by_policy" | "waiting_for_approval" | "reconciliation_required" | "validation_failed";
|
|
26
|
-
interface FabricRuntimeServices {
|
|
27
|
-
|
|
21
|
+
export type ActorType = "natural_person" | "agent" | "system" | "service_account" | "external_system" | "integration";
|
|
22
|
+
export declare const ACTOR_TYPES: readonly ActorType[];
|
|
23
|
+
export declare function isActorType(value: string): value is ActorType;
|
|
24
|
+
export declare function assertActorType(value: string): asserts value is ActorType;
|
|
25
|
+
export type ActionStatus = "pending" | "running" | "completed" | "failed" | "blocked_by_policy" | "waiting_for_approval" | "reconciliation_required" | "validation_failed";
|
|
26
|
+
export interface FabricRuntimeServices {
|
|
27
|
+
readonly [serviceName: string]: unknown;
|
|
28
28
|
}
|
|
29
|
-
interface ActionContext<TDb = unknown> {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
export interface ActionContext<TDb = unknown> {
|
|
30
|
+
actionInvocationId: string;
|
|
31
|
+
tenantId: string;
|
|
32
|
+
spaceId: string;
|
|
33
|
+
actorId: string;
|
|
34
|
+
actorType: ActorType;
|
|
35
|
+
correlationId: string;
|
|
36
|
+
causationId?: string;
|
|
37
|
+
provenance?: {
|
|
38
|
+
source: string;
|
|
39
|
+
auditAttributes?: Record<string, string>;
|
|
40
|
+
};
|
|
41
|
+
db: TDb;
|
|
42
|
+
services?: FabricRuntimeServices;
|
|
43
|
+
/**
|
|
44
|
+
* When the host admitted this invocation's submission through the
|
|
45
|
+
* action's `admitSubmission` check, read from the durable invocation
|
|
46
|
+
* record. Absent when the action declares no check, or when the runtime
|
|
47
|
+
* that built this context does not run declared admission checks (a host
|
|
48
|
+
* older than the one that introduced them). A handler whose action
|
|
49
|
+
* declares `admitSubmission` can refuse to run without it.
|
|
50
|
+
*/
|
|
51
|
+
admittedAt?: Date;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Trusted facts a host gives an action's `admitSubmission` check. Scope and
|
|
55
55
|
* actor come from the host's authenticated submission, never from the
|
|
56
56
|
* parameters.
|
|
57
57
|
*/
|
|
58
|
-
interface ActionAdmissionInput {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
export interface ActionAdmissionInput {
|
|
59
|
+
readonly actionId: ActionId;
|
|
60
|
+
readonly tenantId: string;
|
|
61
|
+
readonly spaceId: string;
|
|
62
|
+
readonly actorId: string;
|
|
63
|
+
readonly actorType: ActorType;
|
|
64
|
+
/**
|
|
65
|
+
* The submitted parameters, unvalidated, as a copy made for this check.
|
|
66
|
+
* `@fabricorg/platform-host` records its own copy of the same value, taken
|
|
67
|
+
* before the check ran, and only if the check admits it; changing this
|
|
68
|
+
* copy changes nothing the host records.
|
|
69
|
+
*/
|
|
70
|
+
readonly parameters: Readonly<Record<string, unknown>>;
|
|
71
|
+
/**
|
|
72
|
+
* Aborted when the host's admission deadline passes. Hosts pass an
|
|
73
|
+
* `AbortSignal`. `@fabricorg/platform-host` refuses an answer that settles
|
|
74
|
+
* at or after the deadline, even one that settles before the abort.
|
|
75
|
+
*/
|
|
76
|
+
readonly signal: ActionAdmissionSignal;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* The part of an `AbortSignal` an admission check can rely on. Declared
|
|
80
80
|
* structurally so this module compiles without DOM or Node type libraries; a
|
|
81
81
|
* host passes a real `AbortSignal`, which satisfies it.
|
|
82
82
|
*/
|
|
83
|
-
interface ActionAdmissionSignal {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
export interface ActionAdmissionSignal {
|
|
84
|
+
readonly aborted: boolean;
|
|
85
|
+
addEventListener(type: "abort", listener: () => void, options?: {
|
|
86
|
+
once?: boolean;
|
|
87
|
+
}): void;
|
|
88
|
+
removeEventListener(type: "abort", listener: () => void): void;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* An admission check's answer. Only `{ admitted: true }` admits. A refusal's
|
|
@@ -93,11 +93,11 @@ interface ActionAdmissionSignal {
|
|
|
93
93
|
* then letters, digits, `_`, `.`, `:` or `-`, at most 128 characters), never
|
|
94
94
|
* a submitted value: the host puts it in the error it throws.
|
|
95
95
|
*/
|
|
96
|
-
type ActionAdmissionDecision = {
|
|
97
|
-
|
|
96
|
+
export type ActionAdmissionDecision = {
|
|
97
|
+
readonly admitted: true;
|
|
98
98
|
} | {
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
readonly admitted: false;
|
|
100
|
+
readonly code: string;
|
|
101
101
|
};
|
|
102
102
|
/**
|
|
103
103
|
* Decides whether a submission may be recorded at all. A host that supports
|
|
@@ -105,165 +105,164 @@ type ActionAdmissionDecision = {
|
|
|
105
105
|
* anything durable for the submission; a refusal, a throw, a timeout or any
|
|
106
106
|
* answer other than `{ admitted: true }` refuses the submission.
|
|
107
107
|
*/
|
|
108
|
-
type ActionAdmission = (input: ActionAdmissionInput) => Promise<ActionAdmissionDecision>;
|
|
109
|
-
interface ActionResult {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
export type ActionAdmission = (input: ActionAdmissionInput) => Promise<ActionAdmissionDecision>;
|
|
109
|
+
export interface ActionResult {
|
|
110
|
+
success: boolean;
|
|
111
|
+
data?: Record<string, unknown>;
|
|
112
|
+
error?: string;
|
|
113
113
|
}
|
|
114
|
-
type ActionHandler<TDb = unknown> = (ctx: ActionContext<TDb>, params: unknown) => Promise<ActionResult>;
|
|
115
|
-
interface AdapterStepRetryPolicy {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
export type ActionHandler<TDb = unknown> = (ctx: ActionContext<TDb>, params: unknown) => Promise<ActionResult>;
|
|
115
|
+
export interface AdapterStepRetryPolicy {
|
|
116
|
+
idempotent: boolean;
|
|
117
|
+
maxAttempts?: number;
|
|
118
|
+
initialDelayMs?: number;
|
|
119
|
+
backoffMultiplier?: number;
|
|
120
|
+
maxDelayMs?: number;
|
|
121
121
|
}
|
|
122
|
-
interface AdapterStep {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
export interface AdapterStep {
|
|
123
|
+
adapterType: string;
|
|
124
|
+
operation: string;
|
|
125
|
+
retryPolicy?: AdapterStepRetryPolicy;
|
|
126
|
+
getInput: (params: unknown, handlerResult: Record<string, unknown>) => Record<string, unknown> | undefined;
|
|
127
127
|
}
|
|
128
|
-
interface ActionStateMachineBinding {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
export interface ActionStateMachineBinding {
|
|
129
|
+
entityType: string;
|
|
130
|
+
targetState: string | ((params: unknown) => string);
|
|
131
|
+
getEntityId: (params: unknown) => string | undefined;
|
|
132
132
|
}
|
|
133
|
-
interface ActionDefinition<TDb = unknown> extends SurfaceDeclaration {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
133
|
+
export interface ActionDefinition<TDb = unknown> extends SurfaceDeclaration {
|
|
134
|
+
actionId: ActionId;
|
|
135
|
+
namespace: string;
|
|
136
|
+
version: number;
|
|
137
|
+
schema: SchemaValidator;
|
|
138
|
+
/**
|
|
139
|
+
* Optional check a host runs on every submission before it records
|
|
140
|
+
* anything durable for it (invocation, idempotency key, events, errors).
|
|
141
|
+
* Use it when parameters must be validated against trusted context, for
|
|
142
|
+
* example a secret reference the tenant's secret store must hold, before
|
|
143
|
+
* they may be persisted. `@fabricorg/platform-host` runs it from the
|
|
144
|
+
* release that introduced it; an older host ignores it, so a handler that
|
|
145
|
+
* relies on it should require `ActionContext.admittedAt`.
|
|
146
|
+
*/
|
|
147
|
+
admitSubmission?: ActionAdmission;
|
|
148
|
+
/** Optional validation contract for the public handler result data. */
|
|
149
|
+
resultSchema?: SchemaValidator;
|
|
150
|
+
handler?: ActionHandler<TDb>;
|
|
151
|
+
requiredRoles?: string[];
|
|
152
|
+
requiredPermissions?: string[];
|
|
153
|
+
policies?: `${string}.v${number}`[];
|
|
154
|
+
emitsEvents: string[];
|
|
155
|
+
idempotent: boolean;
|
|
156
|
+
mutatesDomain: boolean;
|
|
157
|
+
/** Portable execution semantics used by hosts, gateways, and generated capability contracts. */
|
|
158
|
+
execution?: ActionExecutionContract;
|
|
159
|
+
stateMachine?: ActionStateMachineBinding;
|
|
160
|
+
adapterSteps?: AdapterStep[];
|
|
161
|
+
/** Completion actions can attest only after all external adapter work succeeds. */
|
|
162
|
+
eventPhase?: "before_adapters" | "after_adapters";
|
|
163
|
+
/**
|
|
164
|
+
* If "saga", the action is a multi-step orchestration. The worker dispatches
|
|
165
|
+
* to a registered saga implementation instead of running `handler` directly.
|
|
166
|
+
*/
|
|
167
|
+
kind?: "atomic" | "saga";
|
|
168
168
|
}
|
|
169
|
-
type ActionConnectivity = "online-required" | "offline-capturable";
|
|
170
|
-
type AuthorityMoment = "capture" | "execution" | "both";
|
|
171
|
-
type ActionIdempotencyStance = "required" | "supported" | "prohibited";
|
|
172
|
-
type ActionCompletionMode = "immediate" | "accepted" | "long-running";
|
|
173
|
-
type ActionConsistency = "authoritative-now" | "provisional-until-reconciled";
|
|
174
|
-
type ActionDataSensitivity = "public" | "internal" | "confidential" | "restricted";
|
|
175
|
-
interface ActionExecutionContract {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
169
|
+
export type ActionConnectivity = "online-required" | "offline-capturable";
|
|
170
|
+
export type AuthorityMoment = "capture" | "execution" | "both";
|
|
171
|
+
export type ActionIdempotencyStance = "required" | "supported" | "prohibited";
|
|
172
|
+
export type ActionCompletionMode = "immediate" | "accepted" | "long-running";
|
|
173
|
+
export type ActionConsistency = "authoritative-now" | "provisional-until-reconciled";
|
|
174
|
+
export type ActionDataSensitivity = "public" | "internal" | "confidential" | "restricted";
|
|
175
|
+
export interface ActionExecutionContract {
|
|
176
|
+
connectivity: ActionConnectivity;
|
|
177
|
+
authorityMoment: AuthorityMoment;
|
|
178
|
+
idempotency: ActionIdempotencyStance;
|
|
179
|
+
/**
|
|
180
|
+
* `immediate`: the invocation settles within the host's execution.
|
|
181
|
+
* `accepted` and `long-running`: an adapter may hand the work to an
|
|
182
|
+
* external system and the invocation stays running until that system
|
|
183
|
+
* completes it by reference through the host's completion ingress.
|
|
184
|
+
* Declare `completionDeadlineMs` on a `long-running` action so a callback
|
|
185
|
+
* that never comes is noticed rather than waited on forever.
|
|
186
|
+
*/
|
|
187
|
+
completion: ActionCompletionMode;
|
|
188
|
+
/**
|
|
189
|
+
* How long an accepted handoff may wait for its completion before the host
|
|
190
|
+
* moves the invocation to reconciliation. Without it, nothing sweeps the
|
|
191
|
+
* handoff. Refused on `immediate`, since nothing external completes it.
|
|
192
|
+
*/
|
|
193
|
+
completionDeadlineMs?: number;
|
|
194
|
+
consistency: ActionConsistency;
|
|
195
|
+
sensitivity?: ActionDataSensitivity;
|
|
196
196
|
}
|
|
197
|
-
interface SagaContext {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
197
|
+
export interface SagaContext {
|
|
198
|
+
actionInvocationId: string;
|
|
199
|
+
tenantId: string;
|
|
200
|
+
spaceId: string;
|
|
201
|
+
parameters: unknown;
|
|
202
|
+
sleep?: (delayMs: number) => Promise<void>;
|
|
203
|
+
query?: <T = unknown>(model: string, operation: string, args: unknown) => Promise<T>;
|
|
204
|
+
/**
|
|
205
|
+
* Wait for a named external signal carrying a payload of `T`, with a timeout.
|
|
206
|
+
*
|
|
207
|
+
* Resolves with the payload of the first signal received, or `null` if the timeout
|
|
208
|
+
* fires first. Subsequent distinct signals with the same name received before
|
|
209
|
+
* another `awaitSignal` call are buffered in FIFO order so none is lost.
|
|
210
|
+
*
|
|
211
|
+
* A signal may carry a stable signal ID that the sender keeps the same on each redelivery
|
|
212
|
+
* (for example a webhook delivery ID or an approval decision ID). A runtime drops
|
|
213
|
+
* a signal whose ID it has already received for this saga, so a sender retrying
|
|
214
|
+
* after a timeout does not wake the saga twice. Signals without an ID are not
|
|
215
|
+
* deduplicated. `@fabricorg/platform-temporal` provides `createSagaSignalInbox()`
|
|
216
|
+
* for Temporal runtimes.
|
|
217
|
+
*
|
|
218
|
+
* Intended for agent-driven and webhook-driven coordination: replace polling loops
|
|
219
|
+
* with push-based wakeups while preserving the saga's deterministic replay
|
|
220
|
+
* semantics (the runtime is responsible for capturing signals into workflow history).
|
|
221
|
+
*
|
|
222
|
+
* Optional. Runtimes that cannot implement push-based signaling (e.g. an in-memory
|
|
223
|
+
* test harness) may omit this; sagas should treat absence as a fallback condition
|
|
224
|
+
* and use `sleep` + `query` polling instead.
|
|
225
|
+
*
|
|
226
|
+
* Signal *senders* are runtime-specific (e.g. a Temporal `WorkflowClient.signal()`
|
|
227
|
+
* call from an action handler). Apps that need to send signals from action
|
|
228
|
+
* handlers should expose a coordination service via `ActionContext.services`
|
|
229
|
+
* — the platform does not prescribe the sender API.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* const payload = await ctx.awaitSignal?.<{ result: Record<string, unknown> }>(
|
|
233
|
+
* "userInputProcessed",
|
|
234
|
+
* 5 * 60 * 1000,
|
|
235
|
+
* );
|
|
236
|
+
* if (payload) { /* handle pushed result *\/ }
|
|
237
|
+
* else { /* timeout — fall back to deterministic path *\/ }
|
|
238
|
+
*/
|
|
239
|
+
awaitSignal?: <T = unknown>(signalName: string, timeoutMs: number) => Promise<T | null>;
|
|
240
240
|
}
|
|
241
|
-
interface SagaChildActionInput {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
241
|
+
export interface SagaChildActionInput {
|
|
242
|
+
suffix: string;
|
|
243
|
+
actionId: string;
|
|
244
|
+
parameters: Record<string, unknown>;
|
|
245
245
|
}
|
|
246
|
-
type SagaRunChild = (input: SagaChildActionInput) => Promise<Record<string, unknown>>;
|
|
247
|
-
interface SagaCompletionEvent {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
246
|
+
export type SagaRunChild = (input: SagaChildActionInput) => Promise<Record<string, unknown>>;
|
|
247
|
+
export interface SagaCompletionEvent {
|
|
248
|
+
eventType: string;
|
|
249
|
+
subjectType: string;
|
|
250
|
+
subjectId: string;
|
|
251
|
+
payload: unknown;
|
|
252
|
+
eventSchemaVersion?: number;
|
|
253
253
|
}
|
|
254
|
-
interface SagaCompletion {
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
export interface SagaCompletion {
|
|
255
|
+
resultData: Record<string, unknown>;
|
|
256
|
+
event?: SagaCompletionEvent;
|
|
257
257
|
}
|
|
258
|
-
type SagaImplementation = (ctx: SagaContext, runChild: SagaRunChild) => Promise<SagaCompletion>;
|
|
259
|
-
declare function assertActionId(actionId: string): asserts actionId is ActionId;
|
|
260
|
-
interface ActionRegistry<TDb = unknown> {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
258
|
+
export type SagaImplementation = (ctx: SagaContext, runChild: SagaRunChild) => Promise<SagaCompletion>;
|
|
259
|
+
export declare function assertActionId(actionId: string): asserts actionId is ActionId;
|
|
260
|
+
export interface ActionRegistry<TDb = unknown> {
|
|
261
|
+
register(definition: ActionDefinition<TDb>): void;
|
|
262
|
+
registerIfMissing(definition: ActionDefinition<TDb>): void;
|
|
263
|
+
resolve(actionId: ActionId): ActionDefinition<TDb> | undefined;
|
|
264
|
+
has(actionId: string): actionId is ActionId;
|
|
265
|
+
ids(): ActionId[];
|
|
266
266
|
}
|
|
267
|
-
declare function createActionRegistry<TDb = unknown>(definitions?: readonly ActionDefinition<TDb>[]): ActionRegistry<TDb>;
|
|
268
|
-
|
|
269
|
-
export { ACTOR_TYPES, type ActionAdmission, type ActionAdmissionDecision, type ActionAdmissionInput, type ActionAdmissionSignal, type ActionCompletionMode, type ActionConnectivity, type ActionConsistency, type ActionContext, type ActionDataSensitivity, type ActionDefinition, type ActionExecutionContract, type ActionHandler, type ActionId, type ActionIdempotencyStance, type ActionRegistry, type ActionResult, type ActionStateMachineBinding, type ActionStatus, type ActorType, type AdapterStep, type AdapterStepRetryPolicy, type AuthorityMoment, type FabricRuntimeServices, type SagaChildActionInput, type SagaCompletion, type SagaCompletionEvent, type SagaContext, type SagaImplementation, type SagaRunChild, type SchemaParseIssue, type SchemaParseResult, type SchemaValidator, assertActionId, assertActorType, createActionRegistry, isActorType };
|
|
267
|
+
export declare function createActionRegistry<TDb = unknown>(definitions?: readonly ActionDefinition<TDb>[]): ActionRegistry<TDb>;
|
|
268
|
+
//#endregion
|