@fabricorg/platform 0.9.0 → 0.11.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 +48 -2
- package/README.md +21 -0
- package/dist/actions/index.cjs +11 -11
- package/dist/actions/index.d.cts +2 -0
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.js +1 -1
- package/dist/chunk-3JQI3OFC.js +347 -0
- package/dist/chunk-3JQI3OFC.js.map +1 -0
- package/dist/chunk-3S6UTP4X.js +110 -0
- package/dist/chunk-3S6UTP4X.js.map +1 -0
- package/dist/{chunk-JSTGOT6P.js → chunk-7WASIL46.js} +58 -3
- package/dist/chunk-7WASIL46.js.map +1 -0
- package/dist/{chunk-BWNPGRRV.cjs → chunk-HLRIXNVG.cjs} +2 -2
- package/dist/chunk-HLRIXNVG.cjs.map +1 -0
- package/dist/{chunk-4SMPJPJ6.js → chunk-JM55UQWK.js} +2 -2
- package/dist/chunk-JM55UQWK.js.map +1 -0
- package/dist/chunk-NFP5DJBT.js +219 -0
- package/dist/chunk-NFP5DJBT.js.map +1 -0
- package/dist/{chunk-Q3WYIWCN.cjs → chunk-O7IHZ53Y.cjs} +63 -2
- package/dist/chunk-O7IHZ53Y.cjs.map +1 -0
- package/dist/chunk-ODP3DO6P.cjs +355 -0
- package/dist/chunk-ODP3DO6P.cjs.map +1 -0
- package/dist/chunk-RYCHDNHZ.cjs +226 -0
- package/dist/chunk-RYCHDNHZ.cjs.map +1 -0
- package/dist/chunk-XCL2HBMB.cjs +116 -0
- package/dist/chunk-XCL2HBMB.cjs.map +1 -0
- package/dist/index.cjs +92 -39
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +6 -5
- package/dist/manifest/index.cjs +40 -0
- package/dist/manifest/index.cjs.map +1 -0
- package/dist/manifest/index.d.cts +181 -0
- package/dist/manifest/index.d.ts +181 -0
- package/dist/manifest/index.js +11 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/modules/index.cjs +11 -10
- package/dist/modules/index.d.cts +49 -1
- package/dist/modules/index.d.ts +49 -1
- package/dist/modules/index.js +4 -3
- package/dist/objects/index.cjs +9 -5
- package/dist/objects/index.d.cts +45 -1
- package/dist/objects/index.d.ts +45 -1
- package/dist/objects/index.js +1 -1
- package/dist/projections/index.cjs +26 -2
- package/dist/projections/index.d.cts +38 -2
- package/dist/projections/index.d.ts +38 -2
- package/dist/projections/index.js +1 -1
- package/package.json +11 -1
- package/dist/chunk-35DD3H55.js +0 -187
- package/dist/chunk-35DD3H55.js.map +0 -1
- package/dist/chunk-4SMPJPJ6.js.map +0 -1
- package/dist/chunk-BWNPGRRV.cjs.map +0 -1
- package/dist/chunk-I35B576X.js +0 -30
- package/dist/chunk-I35B576X.js.map +0 -1
- package/dist/chunk-JSTGOT6P.js.map +0 -1
- package/dist/chunk-Q3WYIWCN.cjs.map +0 -1
- package/dist/chunk-QETQGAXJ.cjs +0 -35
- package/dist/chunk-QETQGAXJ.cjs.map +0 -1
- package/dist/chunk-SSYKDXR4.cjs +0 -195
- package/dist/chunk-SSYKDXR4.cjs.map +0 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkODP3DO6P_cjs = require('./chunk-ODP3DO6P.cjs');
|
|
4
|
+
|
|
5
|
+
// manifest/index.ts
|
|
6
|
+
var MODULE_MANIFEST_VERSION = 2;
|
|
7
|
+
function normalizeModuleManifest(manifest) {
|
|
8
|
+
const version = manifest.manifestVersion;
|
|
9
|
+
if (version !== 1 && version !== MODULE_MANIFEST_VERSION) {
|
|
10
|
+
throw new Error(`Unsupported module manifest version: ${String(version)}`);
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
...manifest,
|
|
14
|
+
manifestVersion: MODULE_MANIFEST_VERSION,
|
|
15
|
+
views: "views" in manifest && Array.isArray(manifest.views) ? manifest.views : []
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function normalizeModuleManifestBundle(bundle) {
|
|
19
|
+
const version = bundle.manifestVersion;
|
|
20
|
+
if (version !== 1 && version !== MODULE_MANIFEST_VERSION) {
|
|
21
|
+
throw new Error(`Unsupported module manifest bundle version: ${String(version)}`);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
manifestVersion: MODULE_MANIFEST_VERSION,
|
|
25
|
+
modules: bundle.modules.map((manifest) => normalizeModuleManifest(manifest))
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function isJsonSchemaExportableValidator(schema) {
|
|
29
|
+
return typeof schema.toJSONSchema === "function";
|
|
30
|
+
}
|
|
31
|
+
function isRecord(value) {
|
|
32
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
33
|
+
}
|
|
34
|
+
function exportDependency(dependency) {
|
|
35
|
+
const namespace = chunkODP3DO6P_cjs.getModuleDependencyNamespace(dependency);
|
|
36
|
+
if (typeof dependency === "string") {
|
|
37
|
+
return { namespace };
|
|
38
|
+
}
|
|
39
|
+
const normalized = { namespace };
|
|
40
|
+
if (dependency.version !== void 0) normalized.version = dependency.version;
|
|
41
|
+
if (dependency.optional !== void 0) normalized.optional = dependency.optional;
|
|
42
|
+
return normalized;
|
|
43
|
+
}
|
|
44
|
+
function exportObjectType(objectType) {
|
|
45
|
+
if (typeof objectType === "string") {
|
|
46
|
+
return { type: objectType };
|
|
47
|
+
}
|
|
48
|
+
const normalized = { type: chunkODP3DO6P_cjs.getObjectTypeName(objectType) };
|
|
49
|
+
if (objectType.displayName !== void 0) normalized.displayName = objectType.displayName;
|
|
50
|
+
if (objectType.idPrefix !== void 0) normalized.idPrefix = objectType.idPrefix;
|
|
51
|
+
if (objectType.schema !== void 0) normalized.schema = cloneJson(objectType.schema);
|
|
52
|
+
if (objectType.semantics !== void 0) normalized.semantics = cloneJson(objectType.semantics);
|
|
53
|
+
if (objectType.relations !== void 0) {
|
|
54
|
+
normalized.relations = objectType.relations.map((relation) => ({ ...relation }));
|
|
55
|
+
}
|
|
56
|
+
if (objectType.invariants !== void 0) {
|
|
57
|
+
normalized.invariants = objectType.invariants.map((invariant) => ({ ...invariant }));
|
|
58
|
+
}
|
|
59
|
+
return normalized;
|
|
60
|
+
}
|
|
61
|
+
function cloneJson(value) {
|
|
62
|
+
if (Array.isArray(value)) return value.map((item) => cloneJson(item));
|
|
63
|
+
if (value !== null && typeof value === "object") {
|
|
64
|
+
return Object.fromEntries(
|
|
65
|
+
Object.entries(value).map(([key, child]) => [key, cloneJson(child)])
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
function exportEventType(eventType) {
|
|
71
|
+
if (typeof eventType === "string") {
|
|
72
|
+
return { eventType, schemaVersion: 1 };
|
|
73
|
+
}
|
|
74
|
+
const normalized = {
|
|
75
|
+
eventType: chunkODP3DO6P_cjs.getEventTypeName(eventType),
|
|
76
|
+
schemaVersion: eventType.schemaVersion
|
|
77
|
+
};
|
|
78
|
+
if (eventType.description !== void 0) normalized.description = eventType.description;
|
|
79
|
+
return normalized;
|
|
80
|
+
}
|
|
81
|
+
function exportAction(action) {
|
|
82
|
+
const manifest = {
|
|
83
|
+
actionId: action.actionId,
|
|
84
|
+
version: action.version,
|
|
85
|
+
kind: action.kind ?? "atomic",
|
|
86
|
+
idempotent: action.idempotent,
|
|
87
|
+
mutatesDomain: action.mutatesDomain,
|
|
88
|
+
emitsEvents: [...action.emitsEvents]
|
|
89
|
+
};
|
|
90
|
+
if (action.policies !== void 0) manifest.policies = [...action.policies];
|
|
91
|
+
if (action.requiredRoles !== void 0) manifest.requiredRoles = [...action.requiredRoles];
|
|
92
|
+
if (action.requiredPermissions !== void 0) {
|
|
93
|
+
manifest.requiredPermissions = [...action.requiredPermissions];
|
|
94
|
+
}
|
|
95
|
+
if (action.eventPhase !== void 0) manifest.eventPhase = action.eventPhase;
|
|
96
|
+
if (isJsonSchemaExportableValidator(action.schema)) {
|
|
97
|
+
manifest.parameterSchema = action.schema.toJSONSchema();
|
|
98
|
+
manifest.parameterSchemaFormat = "json-schema";
|
|
99
|
+
}
|
|
100
|
+
if (action.resultSchema && isJsonSchemaExportableValidator(action.resultSchema)) {
|
|
101
|
+
manifest.resultSchema = action.resultSchema.toJSONSchema();
|
|
102
|
+
manifest.resultSchemaFormat = "json-schema";
|
|
103
|
+
}
|
|
104
|
+
if (action.stateMachine !== void 0) {
|
|
105
|
+
const binding = {
|
|
106
|
+
entityType: action.stateMachine.entityType
|
|
107
|
+
};
|
|
108
|
+
if (typeof action.stateMachine.targetState === "string") {
|
|
109
|
+
binding.targetState = action.stateMachine.targetState;
|
|
110
|
+
}
|
|
111
|
+
manifest.stateMachine = binding;
|
|
112
|
+
}
|
|
113
|
+
if (action.adapterSteps !== void 0) {
|
|
114
|
+
manifest.adapterSteps = action.adapterSteps.map((step) => {
|
|
115
|
+
const exported = {
|
|
116
|
+
adapterType: step.adapterType,
|
|
117
|
+
operation: step.operation
|
|
118
|
+
};
|
|
119
|
+
if (step.retryPolicy !== void 0) exported.retryPolicy = { ...step.retryPolicy };
|
|
120
|
+
return exported;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return manifest;
|
|
124
|
+
}
|
|
125
|
+
function exportPolicy(policy) {
|
|
126
|
+
if (!isRecord(policy) || typeof policy.policyId !== "string") {
|
|
127
|
+
return void 0;
|
|
128
|
+
}
|
|
129
|
+
if (typeof policy.evaluate === "function") {
|
|
130
|
+
const exported = {
|
|
131
|
+
type: "code",
|
|
132
|
+
policyId: policy.policyId,
|
|
133
|
+
version: typeof policy.version === "number" ? policy.version : 1
|
|
134
|
+
};
|
|
135
|
+
if (typeof policy.previewSafe === "boolean") exported.previewSafe = policy.previewSafe;
|
|
136
|
+
return exported;
|
|
137
|
+
}
|
|
138
|
+
if (typeof policy.kind === "string" && typeof policy.policyVersion === "number") {
|
|
139
|
+
const exported = {
|
|
140
|
+
type: "data",
|
|
141
|
+
policyId: policy.policyId,
|
|
142
|
+
policyVersion: policy.policyVersion,
|
|
143
|
+
kind: policy.kind
|
|
144
|
+
};
|
|
145
|
+
if (isRecord(policy.dataDefinition)) {
|
|
146
|
+
exported.dataDefinition = policy.dataDefinition;
|
|
147
|
+
}
|
|
148
|
+
if (typeof policy.codeEvaluatorPolicyId === "string") {
|
|
149
|
+
exported.codeEvaluatorPolicyId = policy.codeEvaluatorPolicyId;
|
|
150
|
+
}
|
|
151
|
+
if (isRecord(policy.fallback)) {
|
|
152
|
+
exported.fallback = policy.fallback;
|
|
153
|
+
}
|
|
154
|
+
return exported;
|
|
155
|
+
}
|
|
156
|
+
return void 0;
|
|
157
|
+
}
|
|
158
|
+
function exportStateMachine(machine) {
|
|
159
|
+
if (!isRecord(machine) || typeof machine.entityType !== "string" || !isRecord(machine.states) || !Array.isArray(machine.transitions)) {
|
|
160
|
+
return void 0;
|
|
161
|
+
}
|
|
162
|
+
const definition = machine;
|
|
163
|
+
return {
|
|
164
|
+
entityType: definition.entityType,
|
|
165
|
+
states: Object.values(definition.states),
|
|
166
|
+
transitions: definition.transitions.map((transition) => ({
|
|
167
|
+
from: transition.from,
|
|
168
|
+
to: transition.to,
|
|
169
|
+
causedByAction: transition.causedByAction,
|
|
170
|
+
hasGuard: typeof transition.guard === "function"
|
|
171
|
+
}))
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function exportView(view) {
|
|
175
|
+
const output = {
|
|
176
|
+
name: view.name,
|
|
177
|
+
version: view.version,
|
|
178
|
+
shape: cloneJson(view.shape),
|
|
179
|
+
consumes: view.consumes.map((consumption) => ({
|
|
180
|
+
eventType: consumption.eventType,
|
|
181
|
+
schemaVersions: [...consumption.schemaVersions]
|
|
182
|
+
})),
|
|
183
|
+
scope: view.scope,
|
|
184
|
+
snapshotVersion: view.snapshotVersion
|
|
185
|
+
};
|
|
186
|
+
if (view.compatibleSnapshotVersions) output.compatibleSnapshotVersions = [...view.compatibleSnapshotVersions];
|
|
187
|
+
return output;
|
|
188
|
+
}
|
|
189
|
+
function exportModuleManifest(module) {
|
|
190
|
+
const manifest = {
|
|
191
|
+
manifestVersion: MODULE_MANIFEST_VERSION,
|
|
192
|
+
namespace: module.namespace,
|
|
193
|
+
dependencies: (module.dependencies ?? []).map(exportDependency),
|
|
194
|
+
objectTypes: (module.objectTypes ?? []).map(exportObjectType),
|
|
195
|
+
subjectTypes: [...module.subjectTypes ?? []],
|
|
196
|
+
idPrefixes: (module.idPrefixes ?? []).map((registration) => ({
|
|
197
|
+
prefix: registration.prefix,
|
|
198
|
+
name: registration.name
|
|
199
|
+
})),
|
|
200
|
+
eventTypes: (module.eventTypes ?? []).map(exportEventType),
|
|
201
|
+
actions: (module.actions ?? []).map(exportAction),
|
|
202
|
+
policies: (module.policies ?? []).map(exportPolicy).filter((policy) => policy !== void 0),
|
|
203
|
+
stateMachines: (module.stateMachines ?? []).map(exportStateMachine).filter((machine) => machine !== void 0),
|
|
204
|
+
views: (module.views ?? []).map(exportView)
|
|
205
|
+
};
|
|
206
|
+
if (module.version !== void 0) manifest.version = module.version;
|
|
207
|
+
if (module.displayName !== void 0) manifest.displayName = module.displayName;
|
|
208
|
+
if (module.description !== void 0) manifest.description = module.description;
|
|
209
|
+
if (module.capability !== void 0) manifest.capability = cloneJson(module.capability);
|
|
210
|
+
return manifest;
|
|
211
|
+
}
|
|
212
|
+
function exportModuleManifestBundle(modules) {
|
|
213
|
+
return {
|
|
214
|
+
manifestVersion: MODULE_MANIFEST_VERSION,
|
|
215
|
+
modules: modules.map(exportModuleManifest)
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
exports.MODULE_MANIFEST_VERSION = MODULE_MANIFEST_VERSION;
|
|
220
|
+
exports.exportModuleManifest = exportModuleManifest;
|
|
221
|
+
exports.exportModuleManifestBundle = exportModuleManifestBundle;
|
|
222
|
+
exports.isJsonSchemaExportableValidator = isJsonSchemaExportableValidator;
|
|
223
|
+
exports.normalizeModuleManifest = normalizeModuleManifest;
|
|
224
|
+
exports.normalizeModuleManifestBundle = normalizeModuleManifestBundle;
|
|
225
|
+
//# sourceMappingURL=chunk-RYCHDNHZ.cjs.map
|
|
226
|
+
//# sourceMappingURL=chunk-RYCHDNHZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../manifest/index.ts"],"names":["getModuleDependencyNamespace","getObjectTypeName","getEventTypeName"],"mappings":";;;;;AA6BO,IAAM,uBAAA,GAA0B;AA8JhC,SAAS,wBACf,QAAA,EACiB;AACjB,EAAA,MAAM,UAAkB,QAAA,CAAS,eAAA;AACjC,EAAA,IAAI,OAAA,KAAY,CAAA,IAAK,OAAA,KAAY,uBAAA,EAAyB;AACzD,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qCAAA,EAAwC,MAAA,CAAO,OAAO,CAAC,CAAA,CAAE,CAAA;AAAA,EAC1E;AACA,EAAA,OAAO;AAAA,IACN,GAAG,QAAA;AAAA,IACH,eAAA,EAAiB,uBAAA;AAAA,IACjB,KAAA,EAAO,OAAA,IAAW,QAAA,IAAY,KAAA,CAAM,OAAA,CAAQ,SAAS,KAAK,CAAA,GAAI,QAAA,CAAS,KAAA,GAAQ;AAAC,GACjF;AACD;AAEO,SAAS,8BACf,MAAA,EACuB;AACvB,EAAA,MAAM,UAAkB,MAAA,CAAO,eAAA;AAC/B,EAAA,IAAI,OAAA,KAAY,CAAA,IAAK,OAAA,KAAY,uBAAA,EAAyB;AACzD,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,4CAAA,EAA+C,MAAA,CAAO,OAAO,CAAC,CAAA,CAAE,CAAA;AAAA,EACjF;AACA,EAAA,OAAO;AAAA,IACN,eAAA,EAAiB,uBAAA;AAAA,IACjB,OAAA,EAAS,OAAO,OAAA,CAAQ,GAAA,CAAI,CAAC,QAAA,KAAa,uBAAA,CAAwB,QAAQ,CAAC;AAAA,GAC5E;AACD;AAWO,SAAS,gCACf,MAAA,EAC0C;AAC1C,EAAA,OACC,OAAQ,OAA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TypeName,\n\tgetModuleDependencyNamespace,\n\tgetObjectTypeName,\n\ttype FabricModule,\n\ttype CapabilityMetadata,\n\ttype DeclarativeInvariant,\n\ttype ModuleDependency,\n\ttype ModuleDependencyInput,\n\ttype ObjectRelationDefinition,\n} from \"../modules\";\nimport type { JsonValue, PortableJsonSchema } from \"../objects\";\nimport type {\n\tDataPolicyDefinition,\n\tPolicyFallbackDefinition,\n\tPolicyKind,\n} from \"../policies\";\nimport type { StateDefinition, StateMachineDefinition } from \"../state-machines\";\nimport type { ViewContract } from \"../projections\";\n\n/**\n * Version of the module manifest contract. Bump when the serialized shape\n * changes in a way consumers must detect.\n */\nexport const MODULE_MANIFEST_VERSION = 2 as const;\n\nexport interface ModuleManifestObjectType {\n\ttype: string;\n\tdisplayName?: string;\n\tidPrefix?: string;\n\tschema?: PortableJsonSchema;\n\tsemantics?: Record<string, JsonValue>;\n\trelations?: ObjectRelationDefinition[];\n\tinvariants?: DeclarativeInvariant[];\n}\n\nexport interface ModuleManifestIdPrefix {\n\tprefix: string;\n\tname: string;\n}\n\nexport interface ModuleManifestEventType {\n\teventType: string;\n\tschemaVersion: number;\n\tdescription?: string;\n}\n\nexport interface ModuleManifestActionStateMachine {\n\tentityType: string;\n\t/** Present only when the binding declares a static target state. */\n\ttargetState?: string;\n}\n\nexport interface ModuleManifestAdapterStep {\n\tadapterType: string;\n\toperation: string;\n\tretryPolicy?: AdapterStepRetryPolicy;\n}\n\nexport interface ModuleManifestAction {\n\tactionId: string;\n\tversion: number;\n\tkind: \"atomic\" | \"saga\";\n\tidempotent: boolean;\n\tmutatesDomain: boolean;\n\temitsEvents: string[];\n\tpolicies?: string[];\n\trequiredRoles?: string[];\n\trequiredPermissions?: string[];\n\teventPhase?: \"before_adapters\" | \"after_adapters\";\n\t/**\n\t * JSON Schema for the action parameters, present only when the action's\n\t * `schema` validator implements {@link JsonSchemaExportableValidator}.\n\t */\n\tparameterSchema?: unknown;\n\tparameterSchemaFormat?: \"json-schema\";\n\tresultSchema?: unknown;\n\tresultSchemaFormat?: \"json-schema\";\n\tstateMachine?: ModuleManifestActionStateMachine;\n\tadapterSteps?: ModuleManifestAdapterStep[];\n}\n\nexport interface ModuleManifestCodePolicy {\n\ttype: \"code\";\n\tpolicyId: string;\n\tversion: number;\n\tpreviewSafe?: boolean;\n}\n\nexport interface ModuleManifestDataPolicy {\n\ttype: \"data\";\n\tpolicyId: string;\n\tpolicyVersion: number;\n\tkind: PolicyKind;\n\tdataDefinition?: DataPolicyDefinition;\n\tcodeEvaluatorPolicyId?: string;\n\tfallback?: PolicyFallbackDefinition;\n}\n\nexport type ModuleManifestPolicy = ModuleManifestCodePolicy | ModuleManifestDataPolicy;\n\nexport interface ModuleManifestStateMachineTransition {\n\tfrom: string;\n\tto: string;\n\tcausedByAction: string;\n\t/** `true` when the transition declares a guard function. The guard itself is never serialized. */\n\thasGuard: boolean;\n}\n\nexport interface ModuleManifestStateMachine {\n\tentityType: string;\n\t/** States in declaration order (`Object.values` order of the definition record). */\n\tstates: StateDefinition[];\n\ttransitions: ModuleManifestStateMachineTransition[];\n}\n\nexport interface ModuleManifestView {\n\tname: string;\n\tversion: string;\n\tshape: PortableJsonSchema;\n\tconsumes: Array<{ eventType: string; schemaVersions: number[] }>;\n\tscope: \"tenant-space\";\n\tsnapshotVersion: number;\n\tcompatibleSnapshotVersions?: number[];\n}\n\n/**\n * Stable, JSON-serializable description of a {@link FabricModule}'s ontology:\n * object types, subject types, id prefixes, event types, actions, policies,\n * and state machines. Intended for downstream tooling (semantics exporters,\n * docs generators, tool generators) that cannot consume live module code.\n *\n * The manifest contains definitions only — never raw parameter values,\n * secrets, or runtime data. Function fields (`handler`, `evaluate`, `guard`,\n * dynamic `targetState`, adapter `getInput`) are never serialized.\n */\nexport interface ModuleManifest {\n\tmanifestVersion: typeof MODULE_MANIFEST_VERSION;\n\tnamespace: string;\n\tversion?: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\tcapability?: CapabilityMetadata;\n\tdependencies: ModuleDependency[];\n\tobjectTypes: ModuleManifestObjectType[];\n\tsubjectTypes: string[];\n\tidPrefixes: ModuleManifestIdPrefix[];\n\teventTypes: ModuleManifestEventType[];\n\tactions: ModuleManifestAction[];\n\tpolicies: ModuleManifestPolicy[];\n\tstateMachines: ModuleManifestStateMachine[];\n\tviews: ModuleManifestView[];\n}\n\nexport interface ModuleManifestBundle {\n\tmanifestVersion: typeof MODULE_MANIFEST_VERSION;\n\t/** Manifests in the input module order. */\n\tmodules: ModuleManifest[];\n}\n\n/** Manifest v1 remains accepted by v2 readers; missing v2 fields normalize to absence. */\nexport type ModuleManifestObjectTypeV1 = Omit<\n\tModuleManifestObjectType,\n\t\"schema\" | \"semantics\" | \"relations\" | \"invariants\"\n>;\nexport type ModuleManifestActionV1 = Omit<\n\tModuleManifestAction,\n\t\"resultSchema\" | \"resultSchemaFormat\"\n>;\nexport type ModuleManifestV1 = Omit<\n\tModuleManifest,\n\t\"manifestVersion\" | \"objectTypes\" | \"actions\" | \"views\"\n> & {\n\tmanifestVersion: 1;\n\tobjectTypes: ModuleManifestObjectTypeV1[];\n\tactions: ModuleManifestActionV1[];\n};\nexport type ModuleManifestBundleV1 = Omit<ModuleManifestBundle, \"manifestVersion\" | \"modules\"> & {\n\tmanifestVersion: 1;\n\tmodules: ModuleManifestV1[];\n};\n\nexport function normalizeModuleManifest(\n\tmanifest: ModuleManifest | ModuleManifestV1,\n): ModuleManifest {\n\tconst version: number = manifest.manifestVersion;\n\tif (version !== 1 && version !== MODULE_MANIFEST_VERSION) {\n\t\tthrow new Error(`Unsupported module manifest version: ${String(version)}`);\n\t}\n\treturn {\n\t\t...manifest,\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tviews: \"views\" in manifest && Array.isArray(manifest.views) ? manifest.views : [],\n\t};\n}\n\nexport function normalizeModuleManifestBundle(\n\tbundle: ModuleManifestBundle | ModuleManifestBundleV1,\n): ModuleManifestBundle {\n\tconst version: number = bundle.manifestVersion;\n\tif (version !== 1 && version !== MODULE_MANIFEST_VERSION) {\n\t\tthrow new Error(`Unsupported module manifest bundle version: ${String(version)}`);\n\t}\n\treturn {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tmodules: bundle.modules.map((manifest) => normalizeModuleManifest(manifest)),\n\t};\n}\n\n/**\n * A {@link SchemaValidator} that can also export its parameter schema as JSON\n * Schema (for example a Zod 4 schema via `z.toJSONSchema`). Keeps the platform\n * zero-dependency while letting schema-bearing actions flow into manifests.\n */\nexport interface JsonSchemaExportableValidator extends SchemaValidator {\n\ttoJSONSchema(): Record<string, unknown>;\n}\n\nexport function isJsonSchemaExportableValidator(\n\tschema: SchemaValidator,\n): schema is JsonSchemaExportableValidator {\n\treturn (\n\t\ttypeof (schema as Partial<JsonSchemaExportableValidator>).toJSONSchema === \"function\"\n\t);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction exportDependency(dependency: ModuleDependencyInput): ModuleDependency {\n\tconst namespace = getModuleDependencyNamespace(dependency);\n\tif (typeof dependency === \"string\") {\n\t\treturn { namespace };\n\t}\n\tconst normalized: ModuleDependency = { namespace };\n\tif (dependency.version !== undefined) normalized.version = dependency.version;\n\tif (dependency.optional !== undefined) normalized.optional = dependency.optional;\n\treturn normalized;\n}\n\nfunction exportObjectType(\n\tobjectType: NonNullable<FabricModule[\"objectTypes\"]>[number],\n): ModuleManifestObjectType {\n\tif (typeof objectType === \"string\") {\n\t\treturn { type: objectType };\n\t}\n\tconst normalized: ModuleManifestObjectType = { type: getObjectTypeName(objectType) };\n\tif (objectType.displayName !== undefined) normalized.displayName = objectType.displayName;\n\tif (objectType.idPrefix !== undefined) normalized.idPrefix = objectType.idPrefix;\n\tif (objectType.schema !== undefined) normalized.schema = cloneJson(objectType.schema);\n\tif (objectType.semantics !== undefined) normalized.semantics = cloneJson(objectType.semantics);\n\tif (objectType.relations !== undefined) {\n\t\tnormalized.relations = objectType.relations.map((relation) => ({ ...relation }));\n\t}\n\tif (objectType.invariants !== undefined) {\n\t\tnormalized.invariants = objectType.invariants.map((invariant) => ({ ...invariant }));\n\t}\n\treturn normalized;\n}\n\nfunction cloneJson<T>(value: T): T {\n\tif (Array.isArray(value)) return value.map((item) => cloneJson(item)) as T;\n\tif (value !== null && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value as Record<string, unknown>).map(([key, child]) => [key, cloneJson(child)]),\n\t\t) as T;\n\t}\n\treturn value;\n}\n\nfunction exportEventType(\n\teventType: NonNullable<FabricModule[\"eventTypes\"]>[number],\n): ModuleManifestEventType {\n\tif (typeof eventType === \"string\") {\n\t\t// String registrations carry no explicit schema version; the events\n\t\t// registry treats the bare name as the initial version of the type.\n\t\treturn { eventType, schemaVersion: 1 };\n\t}\n\tconst normalized: ModuleManifestEventType = {\n\t\teventType: getEventTypeName(eventType),\n\t\tschemaVersion: eventType.schemaVersion,\n\t};\n\tif (eventType.description !== undefined) normalized.description = eventType.description;\n\treturn normalized;\n}\n\nfunction exportAction(action: ActionDefinition): ModuleManifestAction {\n\tconst manifest: ModuleManifestAction = {\n\t\tactionId: action.actionId,\n\t\tversion: action.version,\n\t\tkind: action.kind ?? \"atomic\",\n\t\tidempotent: action.idempotent,\n\t\tmutatesDomain: action.mutatesDomain,\n\t\temitsEvents: [...action.emitsEvents],\n\t};\n\n\tif (action.policies !== undefined) manifest.policies = [...action.policies];\n\tif (action.requiredRoles !== undefined) manifest.requiredRoles = [...action.requiredRoles];\n\tif (action.requiredPermissions !== undefined) {\n\t\tmanifest.requiredPermissions = [...action.requiredPermissions];\n\t}\n\tif (action.eventPhase !== undefined) manifest.eventPhase = action.eventPhase;\n\n\tif (isJsonSchemaExportableValidator(action.schema)) {\n\t\tmanifest.parameterSchema = action.schema.toJSONSchema();\n\t\tmanifest.parameterSchemaFormat = \"json-schema\";\n\t}\n\tif (action.resultSchema && isJsonSchemaExportableValidator(action.resultSchema)) {\n\t\tmanifest.resultSchema = action.resultSchema.toJSONSchema();\n\t\tmanifest.resultSchemaFormat = \"json-schema\";\n\t}\n\n\tif (action.stateMachine !== undefined) {\n\t\tconst binding: ModuleManifestActionStateMachine = {\n\t\t\tentityType: action.stateMachine.entityType,\n\t\t};\n\t\tif (typeof action.stateMachine.targetState === \"string\") {\n\t\t\tbinding.targetState = action.stateMachine.targetState;\n\t\t}\n\t\tmanifest.stateMachine = binding;\n\t}\n\n\tif (action.adapterSteps !== undefined) {\n\t\tmanifest.adapterSteps = action.adapterSteps.map((step) => {\n\t\t\tconst exported: ModuleManifestAdapterStep = {\n\t\t\t\tadapterType: step.adapterType,\n\t\t\t\toperation: step.operation,\n\t\t\t};\n\t\t\tif (step.retryPolicy !== undefined) exported.retryPolicy = { ...step.retryPolicy };\n\t\t\treturn exported;\n\t\t});\n\t}\n\n\treturn manifest;\n}\n\nfunction exportPolicy(policy: unknown): ModuleManifestPolicy | undefined {\n\tif (!isRecord(policy) || typeof policy.policyId !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\t// Code evaluator: identified by its `evaluate` function (never serialized).\n\tif (typeof policy.evaluate === \"function\") {\n\t\tconst exported: ModuleManifestCodePolicy = {\n\t\t\ttype: \"code\",\n\t\t\tpolicyId: policy.policyId,\n\t\t\tversion: typeof policy.version === \"number\" ? policy.version : 1,\n\t\t};\n\t\tif (typeof policy.previewSafe === \"boolean\") exported.previewSafe = policy.previewSafe;\n\t\treturn exported;\n\t}\n\n\t// Declarative runtime policy definition: pure data, serialized as-is.\n\tif (typeof policy.kind === \"string\" && typeof policy.policyVersion === \"number\") {\n\t\tconst exported: ModuleManifestDataPolicy = {\n\t\t\ttype: \"data\",\n\t\t\tpolicyId: policy.policyId,\n\t\t\tpolicyVersion: policy.policyVersion,\n\t\t\tkind: policy.kind as PolicyKind,\n\t\t};\n\t\tif (isRecord(policy.dataDefinition)) {\n\t\t\texported.dataDefinition = policy.dataDefinition as unknown as DataPolicyDefinition;\n\t\t}\n\t\tif (typeof policy.codeEvaluatorPolicyId === \"string\") {\n\t\t\texported.codeEvaluatorPolicyId = policy.codeEvaluatorPolicyId;\n\t\t}\n\t\tif (isRecord(policy.fallback)) {\n\t\t\texported.fallback = policy.fallback as unknown as PolicyFallbackDefinition;\n\t\t}\n\t\treturn exported;\n\t}\n\n\t// Unknown policy shape: omit rather than guess.\n\treturn undefined;\n}\n\nfunction exportStateMachine(machine: unknown): ModuleManifestStateMachine | undefined {\n\tif (\n\t\t!isRecord(machine) ||\n\t\ttypeof machine.entityType !== \"string\" ||\n\t\t!isRecord(machine.states) ||\n\t\t!Array.isArray(machine.transitions)\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst definition = machine as unknown as StateMachineDefinition;\n\treturn {\n\t\tentityType: definition.entityType,\n\t\tstates: Object.values(definition.states),\n\t\ttransitions: definition.transitions.map((transition) => ({\n\t\t\tfrom: transition.from,\n\t\t\tto: transition.to,\n\t\t\tcausedByAction: transition.causedByAction,\n\t\t\thasGuard: typeof transition.guard === \"function\",\n\t\t})),\n\t};\n}\n\nfunction exportView(view: ViewContract): ModuleManifestView {\n\tconst output: ModuleManifestView = {\n\t\tname: view.name,\n\t\tversion: view.version,\n\t\tshape: cloneJson(view.shape),\n\t\tconsumes: view.consumes.map((consumption) => ({\n\t\t\teventType: consumption.eventType,\n\t\t\tschemaVersions: [...consumption.schemaVersions],\n\t\t})),\n\t\tscope: view.scope,\n\t\tsnapshotVersion: view.snapshotVersion,\n\t};\n\tif (view.compatibleSnapshotVersions) output.compatibleSnapshotVersions = [...view.compatibleSnapshotVersions];\n\treturn output;\n}\n\n/**\n * Export a stable, JSON-serializable manifest of a module's ontology.\n *\n * This is a pure function of the module object: it does not read or mutate the\n * global module/action/policy/state-machine registries, and the module does\n * not need to be registered first. Declaration order is preserved everywhere\n * (nothing is sorted), so the same module object always produces a\n * byte-identical `JSON.stringify` result.\n *\n * The manifest contains definitions only — never raw parameter values,\n * secrets, or runtime data. Function fields are elided (`handler`,\n * policy `evaluate`, transition `guard` → `hasGuard`, dynamic `targetState`,\n * adapter `getInput`).\n */\nexport function exportModuleManifest(module: FabricModule<unknown>): ModuleManifest {\n\tconst manifest: ModuleManifest = {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tnamespace: module.namespace,\n\t\tdependencies: (module.dependencies ?? []).map(exportDependency),\n\t\tobjectTypes: (module.objectTypes ?? []).map(exportObjectType),\n\t\tsubjectTypes: [...(module.subjectTypes ?? [])],\n\t\tidPrefixes: (module.idPrefixes ?? []).map((registration) => ({\n\t\t\tprefix: registration.prefix,\n\t\t\tname: registration.name,\n\t\t})),\n\t\teventTypes: (module.eventTypes ?? []).map(exportEventType),\n\t\tactions: (module.actions ?? []).map(exportAction),\n\t\tpolicies: (module.policies ?? [])\n\t\t\t.map(exportPolicy)\n\t\t\t.filter((policy): policy is ModuleManifestPolicy => policy !== undefined),\n\t\tstateMachines: (module.stateMachines ?? [])\n\t\t\t.map(exportStateMachine)\n\t\t\t.filter((machine): machine is ModuleManifestStateMachine => machine !== undefined),\n\t\tviews: (module.views ?? []).map(exportView),\n\t};\n\n\tif (module.version !== undefined) manifest.version = module.version;\n\tif (module.displayName !== undefined) manifest.displayName = module.displayName;\n\tif (module.description !== undefined) manifest.description = module.description;\n\tif (module.capability !== undefined) manifest.capability = cloneJson(module.capability);\n\n\treturn manifest;\n}\n\n/**\n * Export manifests for a set of modules, preserving the input order.\n * Like {@link exportModuleManifest}, this is pure and registry-free.\n */\nexport function exportModuleManifestBundle(\n\tmodules: FabricModule<unknown>[],\n): ModuleManifestBundle {\n\treturn {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tmodules: modules.map(exportModuleManifest),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// objects/index.ts
|
|
4
|
+
var objectTypeRegistry = /* @__PURE__ */ new Set([
|
|
5
|
+
"AssetEvent",
|
|
6
|
+
"ActionInvocation",
|
|
7
|
+
"PolicyEvaluation",
|
|
8
|
+
"ApprovalRequest",
|
|
9
|
+
"ConsentRecord",
|
|
10
|
+
"AgentRun"
|
|
11
|
+
]);
|
|
12
|
+
var supportedSchemaKeywords = /* @__PURE__ */ new Set([
|
|
13
|
+
"$schema",
|
|
14
|
+
"$id",
|
|
15
|
+
"$ref",
|
|
16
|
+
"$defs",
|
|
17
|
+
"title",
|
|
18
|
+
"description",
|
|
19
|
+
"type",
|
|
20
|
+
"enum",
|
|
21
|
+
"const",
|
|
22
|
+
"properties",
|
|
23
|
+
"required",
|
|
24
|
+
"additionalProperties",
|
|
25
|
+
"items",
|
|
26
|
+
"allOf",
|
|
27
|
+
"anyOf",
|
|
28
|
+
"oneOf",
|
|
29
|
+
"not",
|
|
30
|
+
"minimum",
|
|
31
|
+
"maximum",
|
|
32
|
+
"exclusiveMinimum",
|
|
33
|
+
"exclusiveMaximum",
|
|
34
|
+
"minLength",
|
|
35
|
+
"maxLength",
|
|
36
|
+
"pattern",
|
|
37
|
+
"format",
|
|
38
|
+
"minItems",
|
|
39
|
+
"maxItems",
|
|
40
|
+
"uniqueItems",
|
|
41
|
+
"default",
|
|
42
|
+
"readOnly",
|
|
43
|
+
"writeOnly"
|
|
44
|
+
]);
|
|
45
|
+
function assertPortableJsonSchema(schema, path = "schema") {
|
|
46
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
|
|
47
|
+
throw new Error(`${path} must be a JSON Schema object.`);
|
|
48
|
+
}
|
|
49
|
+
const value = schema;
|
|
50
|
+
for (const keyword of Object.keys(value)) {
|
|
51
|
+
if (!supportedSchemaKeywords.has(keyword) && !keyword.startsWith("x-")) {
|
|
52
|
+
throw new Error(`${path} uses unsupported JSON Schema keyword "${keyword}".`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (value.properties !== void 0) {
|
|
56
|
+
if (!value.properties || typeof value.properties !== "object" || Array.isArray(value.properties)) {
|
|
57
|
+
throw new Error(`${path}.properties must be an object.`);
|
|
58
|
+
}
|
|
59
|
+
for (const [name, child] of Object.entries(value.properties)) {
|
|
60
|
+
assertPortableJsonSchema(child, `${path}.properties.${name}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (value.$defs !== void 0) {
|
|
64
|
+
if (!value.$defs || typeof value.$defs !== "object" || Array.isArray(value.$defs)) {
|
|
65
|
+
throw new Error(`${path}.$defs must be an object.`);
|
|
66
|
+
}
|
|
67
|
+
for (const [name, child] of Object.entries(value.$defs)) {
|
|
68
|
+
assertPortableJsonSchema(child, `${path}.$defs.${name}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for (const keyword of ["allOf", "anyOf", "oneOf"]) {
|
|
72
|
+
if (value[keyword] !== void 0) {
|
|
73
|
+
if (!Array.isArray(value[keyword])) throw new Error(`${path}.${keyword} must be an array.`);
|
|
74
|
+
value[keyword].forEach((child, index) => assertPortableJsonSchema(child, `${path}.${keyword}[${index}]`));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (value.not !== void 0) assertPortableJsonSchema(value.not, `${path}.not`);
|
|
78
|
+
if (value.additionalProperties !== void 0 && typeof value.additionalProperties !== "boolean") {
|
|
79
|
+
assertPortableJsonSchema(value.additionalProperties, `${path}.additionalProperties`);
|
|
80
|
+
}
|
|
81
|
+
if (value.items !== void 0) {
|
|
82
|
+
if (Array.isArray(value.items)) {
|
|
83
|
+
value.items.forEach((child, index) => assertPortableJsonSchema(child, `${path}.items[${index}]`));
|
|
84
|
+
} else {
|
|
85
|
+
assertPortableJsonSchema(value.items, `${path}.items`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (value.required !== void 0 && (!Array.isArray(value.required) || value.required.some((item) => typeof item !== "string"))) {
|
|
89
|
+
throw new Error(`${path}.required must be an array of property names.`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function assertObjectType(type) {
|
|
93
|
+
if (!/^[A-Z][a-zA-Z0-9]*$/.test(type)) {
|
|
94
|
+
throw new Error(
|
|
95
|
+
`Invalid object type: "${type}". Object types must be PascalCase alphanumeric.`
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function registerObjectType(type) {
|
|
100
|
+
assertObjectType(type);
|
|
101
|
+
objectTypeRegistry.add(type);
|
|
102
|
+
}
|
|
103
|
+
function isValidObjectType(type) {
|
|
104
|
+
return objectTypeRegistry.has(type);
|
|
105
|
+
}
|
|
106
|
+
function getRegisteredObjectTypes() {
|
|
107
|
+
return Array.from(objectTypeRegistry);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
exports.assertObjectType = assertObjectType;
|
|
111
|
+
exports.assertPortableJsonSchema = assertPortableJsonSchema;
|
|
112
|
+
exports.getRegisteredObjectTypes = getRegisteredObjectTypes;
|
|
113
|
+
exports.isValidObjectType = isValidObjectType;
|
|
114
|
+
exports.registerObjectType = registerObjectType;
|
|
115
|
+
//# sourceMappingURL=chunk-XCL2HBMB.cjs.map
|
|
116
|
+
//# sourceMappingURL=chunk-XCL2HBMB.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../objects/index.ts"],"names":[],"mappings":";;;AAAA,IAAM,kBAAA,uBAAyB,GAAA,CAAY;AAAA,EAC1C,YAAA;AAAA,EACA,kBAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA,EACA;AACD,CAAC,CAAA;AA+CD,IAAM,uBAAA,uBAA8B,GAAA,CAAI;AAAA,EACvC,SAAA;AAAA,EAAW,KAAA;AAAA,EAAO,MAAA;AAAA,EAAQ,OAAA;AAAA,EAAS,OAAA;AAAA,EAAS,aAAA;AAAA,EAAe,MAAA;AAAA,EAAQ,MAAA;AAAA,EAAQ,OAAA;AAAA,EAC3E,YAAA;AAAA,EAAc,UAAA;AAAA,EAAY,sBAAA;AAAA,EAAwB,OAAA;AAAA,EAAS,OAAA;AAAA,EAAS,OA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;AAAA,EACD;AACD;AAEO,SAAS,mBAAmB,IAAA,EAAoB;AACtD,EAAA,gBAAA,CAAiB,IAAI,CAAA;AACrB,EAAA,kBAAA,CAAmB,IAAI,IAAI,CAAA;AAC5B;AAEO,SAAS,kBAAkB,IAAA,EAAuB;AACxD,EAAA,OAAO,kBAAA,CAAmB,IAAI,IAAI,CAAA;AACnC;AAEO,SAAS,wBAAA,GAAqC;AACpD,EAAA,OAAO,KAAA,CAAM,KAAK,kBAAkB,CAAA;AACrC","file":"chunk-XCL2HBMB.cjs","sourcesContent":["const objectTypeRegistry = new Set<string>([\n\t\"AssetEvent\",\n\t\"ActionInvocation\",\n\t\"PolicyEvaluation\",\n\t\"ApprovalRequest\",\n\t\"ConsentRecord\",\n\t\"AgentRun\",\n]);\n\nexport type FabricObjectType = string;\n\nexport type JsonPrimitive = string | number | boolean | null;\nexport type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\n/**\n * Dependency-free JSON Schema profile accepted in portable module manifests.\n * Unknown extension keywords must use an `x-` prefix. Runtime validators may\n * support more vocabulary, but exported entity contracts stay in this profile.\n */\nexport interface PortableJsonSchema {\n\t$schema?: string;\n\t$id?: string;\n\t$ref?: string;\n\t$defs?: Record<string, PortableJsonSchema>;\n\ttitle?: string;\n\tdescription?: string;\n\ttype?: \"null\" | \"boolean\" | \"object\" | \"array\" | \"number\" | \"integer\" | \"string\" | Array<\"null\" | \"boolean\" | \"object\" | \"array\" | \"number\" | \"integer\" | \"string\">;\n\tenum?: JsonValue[];\n\tconst?: JsonValue;\n\tproperties?: Record<string, PortableJsonSchema>;\n\trequired?: string[];\n\tadditionalProperties?: boolean | PortableJsonSchema;\n\titems?: PortableJsonSchema | PortableJsonSchema[];\n\tallOf?: PortableJsonSchema[];\n\tanyOf?: PortableJsonSchema[];\n\toneOf?: PortableJsonSchema[];\n\tnot?: PortableJsonSchema;\n\tminimum?: number;\n\tmaximum?: number;\n\texclusiveMinimum?: number;\n\texclusiveMaximum?: number;\n\tminLength?: number;\n\tmaxLength?: number;\n\tpattern?: string;\n\tformat?: string;\n\tminItems?: number;\n\tmaxItems?: number;\n\tuniqueItems?: boolean;\n\tdefault?: JsonValue;\n\treadOnly?: boolean;\n\twriteOnly?: boolean;\n\t[key: `x-${string}`]: JsonValue | undefined;\n}\n\nconst supportedSchemaKeywords = new Set([\n\t\"$schema\", \"$id\", \"$ref\", \"$defs\", \"title\", \"description\", \"type\", \"enum\", \"const\",\n\t\"properties\", \"required\", \"additionalProperties\", \"items\", \"allOf\", \"anyOf\", \"oneOf\",\n\t\"not\", \"minimum\", \"maximum\", \"exclusiveMinimum\", \"exclusiveMaximum\", \"minLength\",\n\t\"maxLength\", \"pattern\", \"format\", \"minItems\", \"maxItems\", \"uniqueItems\", \"default\",\n\t\"readOnly\", \"writeOnly\",\n]);\n\nexport function assertPortableJsonSchema(\n\tschema: unknown,\n\tpath = \"schema\",\n): asserts schema is PortableJsonSchema {\n\tif (!schema || typeof schema !== \"object\" || Array.isArray(schema)) {\n\t\tthrow new Error(`${path} must be a JSON Schema object.`);\n\t}\n\tconst value = schema as Record<string, unknown>;\n\tfor (const keyword of Object.keys(value)) {\n\t\tif (!supportedSchemaKeywords.has(keyword) && !keyword.startsWith(\"x-\")) {\n\t\t\tthrow new Error(`${path} uses unsupported JSON Schema keyword \"${keyword}\".`);\n\t\t}\n\t}\n\tif (value.properties !== undefined) {\n\t\tif (!value.properties || typeof value.properties !== \"object\" || Array.isArray(value.properties)) {\n\t\t\tthrow new Error(`${path}.properties must be an object.`);\n\t\t}\n\t\tfor (const [name, child] of Object.entries(value.properties)) {\n\t\t\tassertPortableJsonSchema(child, `${path}.properties.${name}`);\n\t\t}\n\t}\n\tif (value.$defs !== undefined) {\n\t\tif (!value.$defs || typeof value.$defs !== \"object\" || Array.isArray(value.$defs)) {\n\t\t\tthrow new Error(`${path}.$defs must be an object.`);\n\t\t}\n\t\tfor (const [name, child] of Object.entries(value.$defs)) {\n\t\t\tassertPortableJsonSchema(child, `${path}.$defs.${name}`);\n\t\t}\n\t}\n\tfor (const keyword of [\"allOf\", \"anyOf\", \"oneOf\"] as const) {\n\t\tif (value[keyword] !== undefined) {\n\t\t\tif (!Array.isArray(value[keyword])) throw new Error(`${path}.${keyword} must be an array.`);\n\t\t\tvalue[keyword].forEach((child, index) => assertPortableJsonSchema(child, `${path}.${keyword}[${index}]`));\n\t\t}\n\t}\n\tif (value.not !== undefined) assertPortableJsonSchema(value.not, `${path}.not`);\n\tif (value.additionalProperties !== undefined && typeof value.additionalProperties !== \"boolean\") {\n\t\tassertPortableJsonSchema(value.additionalProperties, `${path}.additionalProperties`);\n\t}\n\tif (value.items !== undefined) {\n\t\tif (Array.isArray(value.items)) {\n\t\t\tvalue.items.forEach((child, index) => assertPortableJsonSchema(child, `${path}.items[${index}]`));\n\t\t} else {\n\t\t\tassertPortableJsonSchema(value.items, `${path}.items`);\n\t\t}\n\t}\n\tif (value.required !== undefined && (!Array.isArray(value.required) || value.required.some((item) => typeof item !== \"string\"))) {\n\t\tthrow new Error(`${path}.required must be an array of property names.`);\n\t}\n}\n\nexport function assertObjectType(type: string): asserts type is FabricObjectType {\n\tif (!/^[A-Z][a-zA-Z0-9]*$/.test(type)) {\n\t\tthrow new Error(\n\t\t\t`Invalid object type: \"${type}\". Object types must be PascalCase alphanumeric.`,\n\t\t);\n\t}\n}\n\nexport function registerObjectType(type: string): void {\n\tassertObjectType(type);\n\tobjectTypeRegistry.add(type);\n}\n\nexport function isValidObjectType(type: string): boolean {\n\treturn objectTypeRegistry.has(type);\n}\n\nexport function getRegisteredObjectTypes(): string[] {\n\treturn Array.from(objectTypeRegistry);\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkYZKUEC2J_cjs = require('./chunk-YZKUEC2J.cjs');
|
|
3
4
|
var chunkLZSE6QGQ_cjs = require('./chunk-LZSE6QGQ.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
5
|
+
var chunkRYCHDNHZ_cjs = require('./chunk-RYCHDNHZ.cjs');
|
|
6
|
+
var chunkODP3DO6P_cjs = require('./chunk-ODP3DO6P.cjs');
|
|
7
|
+
var chunkXCL2HBMB_cjs = require('./chunk-XCL2HBMB.cjs');
|
|
6
8
|
var chunkNJL3US7H_cjs = require('./chunk-NJL3US7H.cjs');
|
|
7
9
|
var chunkYQEXO3IQ_cjs = require('./chunk-YQEXO3IQ.cjs');
|
|
8
|
-
var
|
|
10
|
+
var chunkO7IHZ53Y_cjs = require('./chunk-O7IHZ53Y.cjs');
|
|
9
11
|
var chunkUV252FLT_cjs = require('./chunk-UV252FLT.cjs');
|
|
10
|
-
var
|
|
11
|
-
var chunkBWNPGRRV_cjs = require('./chunk-BWNPGRRV.cjs');
|
|
12
|
+
var chunkHLRIXNVG_cjs = require('./chunk-HLRIXNVG.cjs');
|
|
12
13
|
var chunkNPVIFZQV_cjs = require('./chunk-NPVIFZQV.cjs');
|
|
13
14
|
var chunkF3E5SXPN_cjs = require('./chunk-F3E5SXPN.cjs');
|
|
14
15
|
var chunkEO4VSB2O_cjs = require('./chunk-EO4VSB2O.cjs');
|
|
@@ -18,6 +19,18 @@ var chunkANPJYXBK_cjs = require('./chunk-ANPJYXBK.cjs');
|
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
|
|
22
|
+
Object.defineProperty(exports, "createDeterministicIdFactory", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return chunkYZKUEC2J_cjs.createDeterministicIdFactory; }
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "createFakeActionContext", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return chunkYZKUEC2J_cjs.createFakeActionContext; }
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "createInMemoryAdapterRegistry", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return chunkYZKUEC2J_cjs.createInMemoryAdapterRegistry; }
|
|
33
|
+
});
|
|
21
34
|
Object.defineProperty(exports, "FABRIC_ID_PREFIXES", {
|
|
22
35
|
enumerable: true,
|
|
23
36
|
get: function () { return chunkLZSE6QGQ_cjs.FABRIC_ID_PREFIXES; }
|
|
@@ -34,49 +47,77 @@ Object.defineProperty(exports, "parseFabricId", {
|
|
|
34
47
|
enumerable: true,
|
|
35
48
|
get: function () { return chunkLZSE6QGQ_cjs.parseFabricId; }
|
|
36
49
|
});
|
|
50
|
+
Object.defineProperty(exports, "MODULE_MANIFEST_VERSION", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () { return chunkRYCHDNHZ_cjs.MODULE_MANIFEST_VERSION; }
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "exportModuleManifest", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () { return chunkRYCHDNHZ_cjs.exportModuleManifest; }
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "exportModuleManifestBundle", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () { return chunkRYCHDNHZ_cjs.exportModuleManifestBundle; }
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, "isJsonSchemaExportableValidator", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () { return chunkRYCHDNHZ_cjs.isJsonSchemaExportableValidator; }
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "normalizeModuleManifest", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () { return chunkRYCHDNHZ_cjs.normalizeModuleManifest; }
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(exports, "normalizeModuleManifestBundle", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () { return chunkRYCHDNHZ_cjs.normalizeModuleManifestBundle; }
|
|
73
|
+
});
|
|
37
74
|
Object.defineProperty(exports, "createModuleRegistry", {
|
|
38
75
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunkODP3DO6P_cjs.createModuleRegistry; }
|
|
40
77
|
});
|
|
41
78
|
Object.defineProperty(exports, "getEventTypeName", {
|
|
42
79
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunkODP3DO6P_cjs.getEventTypeName; }
|
|
44
81
|
});
|
|
45
82
|
Object.defineProperty(exports, "getModuleDependencyNamespace", {
|
|
46
83
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunkODP3DO6P_cjs.getModuleDependencyNamespace; }
|
|
48
85
|
});
|
|
49
86
|
Object.defineProperty(exports, "getObjectTypeName", {
|
|
50
87
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
88
|
+
get: function () { return chunkODP3DO6P_cjs.getObjectTypeName; }
|
|
52
89
|
});
|
|
53
90
|
Object.defineProperty(exports, "registerFabricModule", {
|
|
54
91
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
92
|
+
get: function () { return chunkODP3DO6P_cjs.registerFabricModule; }
|
|
56
93
|
});
|
|
57
94
|
Object.defineProperty(exports, "registerFabricModules", {
|
|
58
95
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
96
|
+
get: function () { return chunkODP3DO6P_cjs.registerFabricModules; }
|
|
60
97
|
});
|
|
61
98
|
Object.defineProperty(exports, "validateModuleNamespace", {
|
|
62
99
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
100
|
+
get: function () { return chunkODP3DO6P_cjs.validateModuleNamespace; }
|
|
64
101
|
});
|
|
65
102
|
Object.defineProperty(exports, "assertObjectType", {
|
|
66
103
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
104
|
+
get: function () { return chunkXCL2HBMB_cjs.assertObjectType; }
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(exports, "assertPortableJsonSchema", {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
get: function () { return chunkXCL2HBMB_cjs.assertPortableJsonSchema; }
|
|
68
109
|
});
|
|
69
110
|
Object.defineProperty(exports, "getRegisteredObjectTypes", {
|
|
70
111
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
112
|
+
get: function () { return chunkXCL2HBMB_cjs.getRegisteredObjectTypes; }
|
|
72
113
|
});
|
|
73
114
|
Object.defineProperty(exports, "isValidObjectType", {
|
|
74
115
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
116
|
+
get: function () { return chunkXCL2HBMB_cjs.isValidObjectType; }
|
|
76
117
|
});
|
|
77
118
|
Object.defineProperty(exports, "registerObjectType", {
|
|
78
119
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
120
|
+
get: function () { return chunkXCL2HBMB_cjs.registerObjectType; }
|
|
80
121
|
});
|
|
81
122
|
Object.defineProperty(exports, "aggregatePolicyOutcomes", {
|
|
82
123
|
enumerable: true,
|
|
@@ -158,9 +199,33 @@ Object.defineProperty(exports, "stableChecksum", {
|
|
|
158
199
|
enumerable: true,
|
|
159
200
|
get: function () { return chunkYQEXO3IQ_cjs.stableChecksum; }
|
|
160
201
|
});
|
|
202
|
+
Object.defineProperty(exports, "getRegisteredViewContractKeys", {
|
|
203
|
+
enumerable: true,
|
|
204
|
+
get: function () { return chunkO7IHZ53Y_cjs.getRegisteredViewContractKeys; }
|
|
205
|
+
});
|
|
206
|
+
Object.defineProperty(exports, "registerViewContract", {
|
|
207
|
+
enumerable: true,
|
|
208
|
+
get: function () { return chunkO7IHZ53Y_cjs.registerViewContract; }
|
|
209
|
+
});
|
|
210
|
+
Object.defineProperty(exports, "registerViewContractIfMissing", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function () { return chunkO7IHZ53Y_cjs.registerViewContractIfMissing; }
|
|
213
|
+
});
|
|
161
214
|
Object.defineProperty(exports, "replayEvents", {
|
|
162
215
|
enumerable: true,
|
|
163
|
-
get: function () { return
|
|
216
|
+
get: function () { return chunkO7IHZ53Y_cjs.replayEvents; }
|
|
217
|
+
});
|
|
218
|
+
Object.defineProperty(exports, "replayView", {
|
|
219
|
+
enumerable: true,
|
|
220
|
+
get: function () { return chunkO7IHZ53Y_cjs.replayView; }
|
|
221
|
+
});
|
|
222
|
+
Object.defineProperty(exports, "resolveViewContract", {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
get: function () { return chunkO7IHZ53Y_cjs.resolveViewContract; }
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(exports, "viewContractKey", {
|
|
227
|
+
enumerable: true,
|
|
228
|
+
get: function () { return chunkO7IHZ53Y_cjs.viewContractKey; }
|
|
164
229
|
});
|
|
165
230
|
Object.defineProperty(exports, "getAllowedTransitions", {
|
|
166
231
|
enumerable: true,
|
|
@@ -186,57 +251,45 @@ Object.defineProperty(exports, "validateTransition", {
|
|
|
186
251
|
enumerable: true,
|
|
187
252
|
get: function () { return chunkUV252FLT_cjs.validateTransition; }
|
|
188
253
|
});
|
|
189
|
-
Object.defineProperty(exports, "createDeterministicIdFactory", {
|
|
190
|
-
enumerable: true,
|
|
191
|
-
get: function () { return chunkYZKUEC2J_cjs.createDeterministicIdFactory; }
|
|
192
|
-
});
|
|
193
|
-
Object.defineProperty(exports, "createFakeActionContext", {
|
|
194
|
-
enumerable: true,
|
|
195
|
-
get: function () { return chunkYZKUEC2J_cjs.createFakeActionContext; }
|
|
196
|
-
});
|
|
197
|
-
Object.defineProperty(exports, "createInMemoryAdapterRegistry", {
|
|
198
|
-
enumerable: true,
|
|
199
|
-
get: function () { return chunkYZKUEC2J_cjs.createInMemoryAdapterRegistry; }
|
|
200
|
-
});
|
|
201
254
|
Object.defineProperty(exports, "ACTOR_TYPES", {
|
|
202
255
|
enumerable: true,
|
|
203
|
-
get: function () { return
|
|
256
|
+
get: function () { return chunkHLRIXNVG_cjs.ACTOR_TYPES; }
|
|
204
257
|
});
|
|
205
258
|
Object.defineProperty(exports, "assertActionId", {
|
|
206
259
|
enumerable: true,
|
|
207
|
-
get: function () { return
|
|
260
|
+
get: function () { return chunkHLRIXNVG_cjs.assertActionId; }
|
|
208
261
|
});
|
|
209
262
|
Object.defineProperty(exports, "assertActorType", {
|
|
210
263
|
enumerable: true,
|
|
211
|
-
get: function () { return
|
|
264
|
+
get: function () { return chunkHLRIXNVG_cjs.assertActorType; }
|
|
212
265
|
});
|
|
213
266
|
Object.defineProperty(exports, "getRegisteredActionIds", {
|
|
214
267
|
enumerable: true,
|
|
215
|
-
get: function () { return
|
|
268
|
+
get: function () { return chunkHLRIXNVG_cjs.getRegisteredActionIds; }
|
|
216
269
|
});
|
|
217
270
|
Object.defineProperty(exports, "isActorType", {
|
|
218
271
|
enumerable: true,
|
|
219
|
-
get: function () { return
|
|
272
|
+
get: function () { return chunkHLRIXNVG_cjs.isActorType; }
|
|
220
273
|
});
|
|
221
274
|
Object.defineProperty(exports, "isRegisteredActionId", {
|
|
222
275
|
enumerable: true,
|
|
223
|
-
get: function () { return
|
|
276
|
+
get: function () { return chunkHLRIXNVG_cjs.isRegisteredActionId; }
|
|
224
277
|
});
|
|
225
278
|
Object.defineProperty(exports, "registerAction", {
|
|
226
279
|
enumerable: true,
|
|
227
|
-
get: function () { return
|
|
280
|
+
get: function () { return chunkHLRIXNVG_cjs.registerAction; }
|
|
228
281
|
});
|
|
229
282
|
Object.defineProperty(exports, "registerActionIfMissing", {
|
|
230
283
|
enumerable: true,
|
|
231
|
-
get: function () { return
|
|
284
|
+
get: function () { return chunkHLRIXNVG_cjs.registerActionIfMissing; }
|
|
232
285
|
});
|
|
233
286
|
Object.defineProperty(exports, "resolveAction", {
|
|
234
287
|
enumerable: true,
|
|
235
|
-
get: function () { return
|
|
288
|
+
get: function () { return chunkHLRIXNVG_cjs.resolveAction; }
|
|
236
289
|
});
|
|
237
290
|
Object.defineProperty(exports, "resolveRegisteredAction", {
|
|
238
291
|
enumerable: true,
|
|
239
|
-
get: function () { return
|
|
292
|
+
get: function () { return chunkHLRIXNVG_cjs.resolveRegisteredAction; }
|
|
240
293
|
});
|
|
241
294
|
Object.defineProperty(exports, "AdapterRegistry", {
|
|
242
295
|
enumerable: true,
|