@fabricorg/platform 0.1.1 → 0.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/dist/actions/index.cjs +48 -0
- package/dist/actions/index.cjs.map +1 -0
- package/dist/actions/index.d.cts +116 -0
- package/dist/actions/index.js +1 -57
- package/dist/actions/index.js.map +1 -1
- package/dist/adapters/index.cjs +28 -0
- package/dist/adapters/index.cjs.map +1 -0
- package/dist/adapters/index.d.cts +83 -0
- package/dist/adapters/index.js +1 -99
- package/dist/adapters/index.js.map +1 -1
- package/dist/chunk-3A6FU3KV.js +67 -0
- package/dist/chunk-3A6FU3KV.js.map +1 -0
- package/dist/chunk-3F6FKQZA.js +89 -0
- package/dist/chunk-3F6FKQZA.js.map +1 -0
- package/dist/chunk-3ZW5USXF.js +101 -0
- package/dist/chunk-3ZW5USXF.js.map +1 -0
- package/dist/chunk-4YQOGV7H.js +55 -0
- package/dist/chunk-4YQOGV7H.js.map +1 -0
- package/dist/chunk-6FMW4NF6.js +59 -0
- package/dist/chunk-6FMW4NF6.js.map +1 -0
- package/dist/chunk-7KJHGAZY.cjs +99 -0
- package/dist/chunk-7KJHGAZY.cjs.map +1 -0
- package/dist/chunk-GB2PSZ33.cjs +74 -0
- package/dist/chunk-GB2PSZ33.cjs.map +1 -0
- package/dist/chunk-I35B576X.js +30 -0
- package/dist/chunk-I35B576X.js.map +1 -0
- package/dist/chunk-IFMZPLM4.js +27 -0
- package/dist/chunk-IFMZPLM4.js.map +1 -0
- package/dist/chunk-JAXDEK5Z.cjs +63 -0
- package/dist/chunk-JAXDEK5Z.cjs.map +1 -0
- package/dist/chunk-JSTGOT6P.js +181 -0
- package/dist/chunk-JSTGOT6P.js.map +1 -0
- package/dist/chunk-KOC4A7A4.js +544 -0
- package/dist/chunk-KOC4A7A4.js.map +1 -0
- package/dist/chunk-KQEBNUZI.cjs +70 -0
- package/dist/chunk-KQEBNUZI.cjs.map +1 -0
- package/dist/chunk-LHCSVEFT.cjs +8 -0
- package/dist/chunk-LHCSVEFT.cjs.map +1 -0
- package/dist/chunk-LYX73U3P.cjs +195 -0
- package/dist/chunk-LYX73U3P.cjs.map +1 -0
- package/dist/chunk-LZSE6QGQ.cjs +60 -0
- package/dist/chunk-LZSE6QGQ.cjs.map +1 -0
- package/dist/chunk-N24NLCZ6.js +6 -0
- package/dist/chunk-N24NLCZ6.js.map +1 -0
- package/dist/chunk-NPVIFZQV.cjs +107 -0
- package/dist/chunk-NPVIFZQV.cjs.map +1 -0
- package/dist/chunk-OZLZHISS.js +3 -0
- package/dist/chunk-OZLZHISS.js.map +1 -0
- package/dist/chunk-PG5LYTUX.cjs +4 -0
- package/dist/chunk-PG5LYTUX.cjs.map +1 -0
- package/dist/chunk-PXMKCAQI.js +187 -0
- package/dist/chunk-PXMKCAQI.js.map +1 -0
- package/dist/chunk-Q3WYIWCN.cjs +183 -0
- package/dist/chunk-Q3WYIWCN.cjs.map +1 -0
- package/dist/chunk-QETQGAXJ.cjs +35 -0
- package/dist/chunk-QETQGAXJ.cjs.map +1 -0
- package/dist/chunk-RALMUSOX.js +55 -0
- package/dist/chunk-RALMUSOX.js.map +1 -0
- package/dist/chunk-SDXDHVTV.cjs +555 -0
- package/dist/chunk-SDXDHVTV.cjs.map +1 -0
- package/dist/chunk-YZKUEC2J.cjs +31 -0
- package/dist/chunk-YZKUEC2J.cjs.map +1 -0
- package/dist/displays/index.cjs +24 -0
- package/dist/displays/index.cjs.map +1 -0
- package/dist/displays/index.d.cts +34 -0
- package/dist/displays/index.js +1 -87
- package/dist/displays/index.js.map +1 -1
- package/dist/events/index.cjs +36 -0
- package/dist/events/index.cjs.map +1 -0
- package/dist/events/index.d.cts +35 -0
- package/dist/events/index.js +1 -53
- package/dist/events/index.js.map +1 -1
- package/dist/evidence/index.cjs +6 -0
- package/dist/evidence/index.cjs.map +1 -0
- package/dist/evidence/index.d.cts +43 -0
- package/dist/evidence/index.js +1 -1
- package/dist/ids/index.cjs +24 -0
- package/dist/ids/index.cjs.map +1 -0
- package/dist/ids/index.d.cts +19 -0
- package/dist/ids/index.js +1 -53
- package/dist/ids/index.js.map +1 -1
- package/dist/index.cjs +268 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.js +13 -1355
- package/dist/index.js.map +1 -1
- package/dist/modules/index.cjs +42 -0
- package/dist/modules/index.cjs.map +1 -0
- package/dist/modules/index.d.cts +73 -0
- package/dist/modules/index.js +7 -373
- package/dist/modules/index.js.map +1 -1
- package/dist/objects/index.cjs +24 -0
- package/dist/objects/index.cjs.map +1 -0
- package/dist/objects/index.d.cts +7 -0
- package/dist/objects/index.js +1 -28
- package/dist/objects/index.js.map +1 -1
- package/dist/policies/index.cjs +48 -0
- package/dist/policies/index.cjs.map +1 -0
- package/dist/policies/index.d.cts +143 -0
- package/dist/policies/index.js +1 -542
- package/dist/policies/index.js.map +1 -1
- package/dist/privacy/index.cjs +12 -0
- package/dist/privacy/index.cjs.map +1 -0
- package/dist/privacy/index.d.cts +77 -0
- package/dist/privacy/index.js +1 -4
- package/dist/privacy/index.js.map +1 -1
- package/dist/projections/index.cjs +12 -0
- package/dist/projections/index.cjs.map +1 -0
- package/dist/projections/index.d.cts +52 -0
- package/dist/projections/index.js +1 -179
- package/dist/projections/index.js.map +1 -1
- package/dist/state-machines/index.cjs +32 -0
- package/dist/state-machines/index.cjs.map +1 -0
- package/dist/state-machines/index.d.cts +60 -0
- package/dist/state-machines/index.js +1 -65
- package/dist/state-machines/index.js.map +1 -1
- package/dist/testing/index.cjs +21 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +19 -0
- package/dist/testing/index.js +2 -56
- package/dist/testing/index.js.map +1 -1
- package/package.json +196 -111
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkSDXDHVTV_cjs = require('../chunk-SDXDHVTV.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "aggregatePolicyOutcomes", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkSDXDHVTV_cjs.aggregatePolicyOutcomes; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "assertPolicyId", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkSDXDHVTV_cjs.assertPolicyId; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "evaluatePolicyDefinition", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkSDXDHVTV_cjs.evaluatePolicyDefinition; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "evaluatePolicyDefinitions", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkSDXDHVTV_cjs.evaluatePolicyDefinitions; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "evaluateRegisteredPolicies", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkSDXDHVTV_cjs.evaluateRegisteredPolicies; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "getRegisteredPolicyIds", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkSDXDHVTV_cjs.getRegisteredPolicyIds; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "registerPolicy", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkSDXDHVTV_cjs.registerPolicy; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "registerPolicyIfMissing", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkSDXDHVTV_cjs.registerPolicyIfMissing; }
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "resolvePolicy", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return chunkSDXDHVTV_cjs.resolvePolicy; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "validateDataPolicyDefinition", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunkSDXDHVTV_cjs.validateDataPolicyDefinition; }
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=index.cjs.map
|
|
48
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
type PolicyEvaluationResult = "pass" | "warn" | "block";
|
|
2
|
+
type PolicyKind = "code" | "data" | "hybrid";
|
|
3
|
+
type PolicyId = `${string}.v${number}`;
|
|
4
|
+
type PolicyEvaluationMode = "preview" | "execute";
|
|
5
|
+
declare function assertPolicyId(policyId: string): asserts policyId is PolicyId;
|
|
6
|
+
interface PolicyContext<TDb = unknown> {
|
|
7
|
+
tenantId: string;
|
|
8
|
+
spaceId: string;
|
|
9
|
+
actionInvocationId: string;
|
|
10
|
+
actionId: string;
|
|
11
|
+
parameters: unknown;
|
|
12
|
+
db: TDb;
|
|
13
|
+
now?: Date;
|
|
14
|
+
mode?: PolicyEvaluationMode;
|
|
15
|
+
}
|
|
16
|
+
interface PolicyOutcome {
|
|
17
|
+
policyId: PolicyId;
|
|
18
|
+
policyVersion: number;
|
|
19
|
+
policyKind?: PolicyKind;
|
|
20
|
+
result: PolicyEvaluationResult;
|
|
21
|
+
reason?: string;
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
dispatchEvidence?: PolicyDispatchEvidence;
|
|
24
|
+
}
|
|
25
|
+
interface PolicyEvaluator<TDb = unknown> {
|
|
26
|
+
policyId: PolicyId;
|
|
27
|
+
version: number;
|
|
28
|
+
kind?: Extract<PolicyKind, "code">;
|
|
29
|
+
previewSafe?: boolean;
|
|
30
|
+
evaluate: (ctx: PolicyContext<TDb>) => Promise<PolicyOutcome>;
|
|
31
|
+
}
|
|
32
|
+
type DataPolicySource = "parameters" | "context";
|
|
33
|
+
type DataPolicyLiteral = string | number | boolean | null;
|
|
34
|
+
type DataPolicyComparisonOperator = "exists" | "equals" | "notEquals" | "gt" | "gte" | "lt" | "lte";
|
|
35
|
+
interface DataPolicySourceReference {
|
|
36
|
+
source: DataPolicySource;
|
|
37
|
+
path: string;
|
|
38
|
+
}
|
|
39
|
+
type DataPolicyCondition = {
|
|
40
|
+
conditionId: string;
|
|
41
|
+
type: "always";
|
|
42
|
+
result: PolicyEvaluationResult;
|
|
43
|
+
reason?: string;
|
|
44
|
+
} | {
|
|
45
|
+
conditionId: string;
|
|
46
|
+
type: "parameter";
|
|
47
|
+
path: string;
|
|
48
|
+
operator: DataPolicyComparisonOperator;
|
|
49
|
+
value?: DataPolicyLiteral;
|
|
50
|
+
onPass?: PolicyEvaluationResult;
|
|
51
|
+
onFail?: PolicyEvaluationResult;
|
|
52
|
+
reason?: string;
|
|
53
|
+
} | {
|
|
54
|
+
conditionId: string;
|
|
55
|
+
type: "comparison";
|
|
56
|
+
left: DataPolicySourceReference;
|
|
57
|
+
operator: DataPolicyComparisonOperator;
|
|
58
|
+
value?: DataPolicyLiteral;
|
|
59
|
+
onPass?: PolicyEvaluationResult;
|
|
60
|
+
onFail?: PolicyEvaluationResult;
|
|
61
|
+
reason?: string;
|
|
62
|
+
} | {
|
|
63
|
+
conditionId: string;
|
|
64
|
+
type: "all" | "any";
|
|
65
|
+
conditions: DataPolicyCondition[];
|
|
66
|
+
onPass?: PolicyEvaluationResult;
|
|
67
|
+
onFail?: PolicyEvaluationResult;
|
|
68
|
+
reason?: string;
|
|
69
|
+
} | {
|
|
70
|
+
conditionId: string;
|
|
71
|
+
type: "not";
|
|
72
|
+
condition: DataPolicyCondition;
|
|
73
|
+
onPass?: PolicyEvaluationResult;
|
|
74
|
+
onFail?: PolicyEvaluationResult;
|
|
75
|
+
reason?: string;
|
|
76
|
+
};
|
|
77
|
+
interface DataPolicyDefinition {
|
|
78
|
+
conditions: DataPolicyCondition[];
|
|
79
|
+
defaultResult?: PolicyEvaluationResult;
|
|
80
|
+
reason?: string;
|
|
81
|
+
}
|
|
82
|
+
interface DataPolicyValidationResult {
|
|
83
|
+
valid: boolean;
|
|
84
|
+
errors: string[];
|
|
85
|
+
}
|
|
86
|
+
interface PolicyFallbackDefinition {
|
|
87
|
+
codeEvaluatorPolicyId: PolicyId;
|
|
88
|
+
onResults?: PolicyEvaluationResult[];
|
|
89
|
+
triggers?: PolicyFallbackTrigger[];
|
|
90
|
+
reason?: string;
|
|
91
|
+
}
|
|
92
|
+
type PolicyFallbackTrigger = "data_result" | "missing_data_definition" | "invalid_data_definition";
|
|
93
|
+
interface DataPolicyConditionResult {
|
|
94
|
+
conditionId: string;
|
|
95
|
+
passed: boolean;
|
|
96
|
+
result: PolicyEvaluationResult;
|
|
97
|
+
reason?: string;
|
|
98
|
+
}
|
|
99
|
+
interface RuntimePolicyDefinition {
|
|
100
|
+
policyId: PolicyId;
|
|
101
|
+
policyVersion: number;
|
|
102
|
+
kind: PolicyKind;
|
|
103
|
+
dataDefinition?: DataPolicyDefinition;
|
|
104
|
+
codeEvaluatorPolicyId?: PolicyId;
|
|
105
|
+
fallback?: PolicyFallbackDefinition;
|
|
106
|
+
}
|
|
107
|
+
interface PolicyDispatchEvidence {
|
|
108
|
+
policyKind: PolicyKind;
|
|
109
|
+
policyId?: PolicyId;
|
|
110
|
+
policyVersion?: number;
|
|
111
|
+
dispatchPath: Array<"data" | "code" | "fallback">;
|
|
112
|
+
data?: {
|
|
113
|
+
definitionVersion: number;
|
|
114
|
+
definitionStatus: "evaluated" | "missing" | "invalid";
|
|
115
|
+
conditionResults: DataPolicyConditionResult[];
|
|
116
|
+
validationErrors?: string[];
|
|
117
|
+
};
|
|
118
|
+
code?: {
|
|
119
|
+
requestedPolicyId?: PolicyId;
|
|
120
|
+
policyId: PolicyId;
|
|
121
|
+
version?: number;
|
|
122
|
+
registered: boolean;
|
|
123
|
+
};
|
|
124
|
+
fallback?: {
|
|
125
|
+
used: boolean;
|
|
126
|
+
trigger: PolicyFallbackTrigger | "not_triggered";
|
|
127
|
+
reason: string;
|
|
128
|
+
fromResult?: PolicyEvaluationResult;
|
|
129
|
+
definitionVersion: number;
|
|
130
|
+
codeEvaluatorPolicyId: PolicyId;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
declare function registerPolicy(evaluator: PolicyEvaluator): void;
|
|
134
|
+
declare function registerPolicyIfMissing(evaluator: PolicyEvaluator): void;
|
|
135
|
+
declare function resolvePolicy(policyId: PolicyId): PolicyEvaluator | undefined;
|
|
136
|
+
declare function getRegisteredPolicyIds(): PolicyId[];
|
|
137
|
+
declare function evaluateRegisteredPolicies(policyIds: PolicyId[], ctx: PolicyContext): Promise<PolicyOutcome[]>;
|
|
138
|
+
declare function evaluatePolicyDefinitions(policies: RuntimePolicyDefinition[], ctx: PolicyContext): Promise<PolicyOutcome[]>;
|
|
139
|
+
declare function evaluatePolicyDefinition(policy: RuntimePolicyDefinition, ctx: PolicyContext): Promise<PolicyOutcome>;
|
|
140
|
+
declare function validateDataPolicyDefinition(definition: DataPolicyDefinition): DataPolicyValidationResult;
|
|
141
|
+
declare function aggregatePolicyOutcomes(outcomes: PolicyOutcome[]): PolicyOutcome | undefined;
|
|
142
|
+
|
|
143
|
+
export { type DataPolicyComparisonOperator, type DataPolicyCondition, type DataPolicyConditionResult, type DataPolicyDefinition, type DataPolicyLiteral, type DataPolicySource, type DataPolicySourceReference, type DataPolicyValidationResult, type PolicyContext, type PolicyDispatchEvidence, type PolicyEvaluationMode, type PolicyEvaluationResult, type PolicyEvaluator, type PolicyFallbackDefinition, type PolicyFallbackTrigger, type PolicyId, type PolicyKind, type PolicyOutcome, type RuntimePolicyDefinition, aggregatePolicyOutcomes, assertPolicyId, evaluatePolicyDefinition, evaluatePolicyDefinitions, evaluateRegisteredPolicies, getRegisteredPolicyIds, registerPolicy, registerPolicyIfMissing, resolvePolicy, validateDataPolicyDefinition };
|