@fabricorg/platform 0.10.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +8 -1
  3. package/dist/actions/index.cjs +11 -11
  4. package/dist/actions/index.d.cts +2 -0
  5. package/dist/actions/index.d.ts +2 -0
  6. package/dist/actions/index.js +1 -1
  7. package/dist/chunk-3JQI3OFC.js +347 -0
  8. package/dist/chunk-3JQI3OFC.js.map +1 -0
  9. package/dist/chunk-3S6UTP4X.js +110 -0
  10. package/dist/chunk-3S6UTP4X.js.map +1 -0
  11. package/dist/{chunk-Q3WYIWCN.cjs → chunk-7WASIL46.js} +58 -5
  12. package/dist/chunk-7WASIL46.js.map +1 -0
  13. package/dist/{chunk-BWNPGRRV.cjs → chunk-HLRIXNVG.cjs} +2 -2
  14. package/dist/chunk-HLRIXNVG.cjs.map +1 -0
  15. package/dist/{chunk-4SMPJPJ6.js → chunk-JM55UQWK.js} +2 -2
  16. package/dist/chunk-JM55UQWK.js.map +1 -0
  17. package/dist/{chunk-N72WJ4AU.js → chunk-NFP5DJBT.js} +65 -6
  18. package/dist/chunk-NFP5DJBT.js.map +1 -0
  19. package/dist/{chunk-JSTGOT6P.js → chunk-O7IHZ53Y.cjs} +66 -3
  20. package/dist/chunk-O7IHZ53Y.cjs.map +1 -0
  21. package/dist/chunk-ODP3DO6P.cjs +355 -0
  22. package/dist/chunk-ODP3DO6P.cjs.map +1 -0
  23. package/dist/{chunk-54EQTOH6.cjs → chunk-RYCHDNHZ.cjs} +69 -8
  24. package/dist/chunk-RYCHDNHZ.cjs.map +1 -0
  25. package/dist/chunk-XCL2HBMB.cjs +116 -0
  26. package/dist/chunk-XCL2HBMB.cjs.map +1 -0
  27. package/dist/index.cjs +67 -31
  28. package/dist/index.d.cts +4 -4
  29. package/dist/index.d.ts +4 -4
  30. package/dist/index.js +5 -5
  31. package/dist/manifest/index.cjs +17 -8
  32. package/dist/manifest/index.d.cts +39 -3
  33. package/dist/manifest/index.d.ts +39 -3
  34. package/dist/manifest/index.js +5 -4
  35. package/dist/modules/index.cjs +11 -10
  36. package/dist/modules/index.d.cts +49 -1
  37. package/dist/modules/index.d.ts +49 -1
  38. package/dist/modules/index.js +4 -3
  39. package/dist/objects/index.cjs +9 -5
  40. package/dist/objects/index.d.cts +45 -1
  41. package/dist/objects/index.d.ts +45 -1
  42. package/dist/objects/index.js +1 -1
  43. package/dist/projections/index.cjs +26 -2
  44. package/dist/projections/index.d.cts +38 -2
  45. package/dist/projections/index.d.ts +38 -2
  46. package/dist/projections/index.js +1 -1
  47. package/package.json +1 -1
  48. package/dist/chunk-35DD3H55.js +0 -187
  49. package/dist/chunk-35DD3H55.js.map +0 -1
  50. package/dist/chunk-4SMPJPJ6.js.map +0 -1
  51. package/dist/chunk-54EQTOH6.cjs.map +0 -1
  52. package/dist/chunk-BWNPGRRV.cjs.map +0 -1
  53. package/dist/chunk-I35B576X.js +0 -30
  54. package/dist/chunk-I35B576X.js.map +0 -1
  55. package/dist/chunk-JSTGOT6P.js.map +0 -1
  56. package/dist/chunk-N72WJ4AU.js.map +0 -1
  57. package/dist/chunk-Q3WYIWCN.cjs.map +0 -1
  58. package/dist/chunk-QETQGAXJ.cjs +0 -35
  59. package/dist/chunk-QETQGAXJ.cjs.map +0 -1
  60. package/dist/chunk-SSYKDXR4.cjs +0 -195
  61. package/dist/chunk-SSYKDXR4.cjs.map +0 -1
@@ -1,18 +1,24 @@
1
1
  import { SchemaValidator, AdapterStepRetryPolicy } from '../actions/index.js';
2
- import { ModuleDependency, FabricModule } from '../modules/index.js';
2
+ import { CapabilityMetadata, ModuleDependency, ObjectRelationDefinition, DeclarativeInvariant, FabricModule } from '../modules/index.js';
3
+ import { PortableJsonSchema, JsonValue } from '../objects/index.js';
3
4
  import { PolicyKind, DataPolicyDefinition, PolicyFallbackDefinition } from '../policies/index.js';
4
5
  import { StateDefinition } from '../state-machines/index.js';
5
6
  import '../displays/index.js';
7
+ import '../projections/index.js';
6
8
 
7
9
  /**
8
10
  * Version of the module manifest contract. Bump when the serialized shape
9
11
  * changes in a way consumers must detect.
10
12
  */
11
- declare const MODULE_MANIFEST_VERSION: 1;
13
+ declare const MODULE_MANIFEST_VERSION: 2;
12
14
  interface ModuleManifestObjectType {
13
15
  type: string;
14
16
  displayName?: string;
15
17
  idPrefix?: string;
18
+ schema?: PortableJsonSchema;
19
+ semantics?: Record<string, JsonValue>;
20
+ relations?: ObjectRelationDefinition[];
21
+ invariants?: DeclarativeInvariant[];
16
22
  }
17
23
  interface ModuleManifestIdPrefix {
18
24
  prefix: string;
@@ -50,6 +56,8 @@ interface ModuleManifestAction {
50
56
  */
51
57
  parameterSchema?: unknown;
52
58
  parameterSchemaFormat?: "json-schema";
59
+ resultSchema?: unknown;
60
+ resultSchemaFormat?: "json-schema";
53
61
  stateMachine?: ModuleManifestActionStateMachine;
54
62
  adapterSteps?: ModuleManifestAdapterStep[];
55
63
  }
@@ -82,6 +90,18 @@ interface ModuleManifestStateMachine {
82
90
  states: StateDefinition[];
83
91
  transitions: ModuleManifestStateMachineTransition[];
84
92
  }
93
+ interface ModuleManifestView {
94
+ name: string;
95
+ version: string;
96
+ shape: PortableJsonSchema;
97
+ consumes: Array<{
98
+ eventType: string;
99
+ schemaVersions: number[];
100
+ }>;
101
+ scope: "tenant-space";
102
+ snapshotVersion: number;
103
+ compatibleSnapshotVersions?: number[];
104
+ }
85
105
  /**
86
106
  * Stable, JSON-serializable description of a {@link FabricModule}'s ontology:
87
107
  * object types, subject types, id prefixes, event types, actions, policies,
@@ -98,6 +118,7 @@ interface ModuleManifest {
98
118
  version?: string;
99
119
  displayName?: string;
100
120
  description?: string;
121
+ capability?: CapabilityMetadata;
101
122
  dependencies: ModuleDependency[];
102
123
  objectTypes: ModuleManifestObjectType[];
103
124
  subjectTypes: string[];
@@ -106,12 +127,27 @@ interface ModuleManifest {
106
127
  actions: ModuleManifestAction[];
107
128
  policies: ModuleManifestPolicy[];
108
129
  stateMachines: ModuleManifestStateMachine[];
130
+ views: ModuleManifestView[];
109
131
  }
110
132
  interface ModuleManifestBundle {
111
133
  manifestVersion: typeof MODULE_MANIFEST_VERSION;
112
134
  /** Manifests in the input module order. */
113
135
  modules: ModuleManifest[];
114
136
  }
137
+ /** Manifest v1 remains accepted by v2 readers; missing v2 fields normalize to absence. */
138
+ type ModuleManifestObjectTypeV1 = Omit<ModuleManifestObjectType, "schema" | "semantics" | "relations" | "invariants">;
139
+ type ModuleManifestActionV1 = Omit<ModuleManifestAction, "resultSchema" | "resultSchemaFormat">;
140
+ type ModuleManifestV1 = Omit<ModuleManifest, "manifestVersion" | "objectTypes" | "actions" | "views"> & {
141
+ manifestVersion: 1;
142
+ objectTypes: ModuleManifestObjectTypeV1[];
143
+ actions: ModuleManifestActionV1[];
144
+ };
145
+ type ModuleManifestBundleV1 = Omit<ModuleManifestBundle, "manifestVersion" | "modules"> & {
146
+ manifestVersion: 1;
147
+ modules: ModuleManifestV1[];
148
+ };
149
+ declare function normalizeModuleManifest(manifest: ModuleManifest | ModuleManifestV1): ModuleManifest;
150
+ declare function normalizeModuleManifestBundle(bundle: ModuleManifestBundle | ModuleManifestBundleV1): ModuleManifestBundle;
115
151
  /**
116
152
  * A {@link SchemaValidator} that can also export its parameter schema as JSON
117
153
  * Schema (for example a Zod 4 schema via `z.toJSONSchema`). Keeps the platform
@@ -142,4 +178,4 @@ declare function exportModuleManifest(module: FabricModule<unknown>): ModuleMani
142
178
  */
143
179
  declare function exportModuleManifestBundle(modules: FabricModule<unknown>[]): ModuleManifestBundle;
144
180
 
145
- export { type JsonSchemaExportableValidator, MODULE_MANIFEST_VERSION, type ModuleManifest, type ModuleManifestAction, type ModuleManifestActionStateMachine, type ModuleManifestAdapterStep, type ModuleManifestBundle, type ModuleManifestCodePolicy, type ModuleManifestDataPolicy, type ModuleManifestEventType, type ModuleManifestIdPrefix, type ModuleManifestObjectType, type ModuleManifestPolicy, type ModuleManifestStateMachine, type ModuleManifestStateMachineTransition, exportModuleManifest, exportModuleManifestBundle, isJsonSchemaExportableValidator };
181
+ export { type JsonSchemaExportableValidator, MODULE_MANIFEST_VERSION, type ModuleManifest, type ModuleManifestAction, type ModuleManifestActionStateMachine, type ModuleManifestActionV1, type ModuleManifestAdapterStep, type ModuleManifestBundle, type ModuleManifestBundleV1, type ModuleManifestCodePolicy, type ModuleManifestDataPolicy, type ModuleManifestEventType, type ModuleManifestIdPrefix, type ModuleManifestObjectType, type ModuleManifestObjectTypeV1, type ModuleManifestPolicy, type ModuleManifestStateMachine, type ModuleManifestStateMachineTransition, type ModuleManifestV1, type ModuleManifestView, exportModuleManifest, exportModuleManifestBundle, isJsonSchemaExportableValidator, normalizeModuleManifest, normalizeModuleManifestBundle };
@@ -1,9 +1,10 @@
1
- export { MODULE_MANIFEST_VERSION, exportModuleManifest, exportModuleManifestBundle, isJsonSchemaExportableValidator } from '../chunk-N72WJ4AU.js';
2
- import '../chunk-35DD3H55.js';
3
- import '../chunk-I35B576X.js';
1
+ export { MODULE_MANIFEST_VERSION, exportModuleManifest, exportModuleManifestBundle, isJsonSchemaExportableValidator, normalizeModuleManifest, normalizeModuleManifestBundle } from '../chunk-NFP5DJBT.js';
2
+ import '../chunk-3JQI3OFC.js';
3
+ import '../chunk-3S6UTP4X.js';
4
4
  import '../chunk-6ER62UUN.js';
5
+ import '../chunk-7WASIL46.js';
5
6
  import '../chunk-T2JLSZN6.js';
6
- import '../chunk-4SMPJPJ6.js';
7
+ import '../chunk-JM55UQWK.js';
7
8
  import '../chunk-O5WVBQ7P.js';
8
9
  import '../chunk-4YQOGV7H.js';
9
10
  //# sourceMappingURL=index.js.map
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkSSYKDXR4_cjs = require('../chunk-SSYKDXR4.cjs');
4
- require('../chunk-QETQGAXJ.cjs');
3
+ var chunkODP3DO6P_cjs = require('../chunk-ODP3DO6P.cjs');
4
+ require('../chunk-XCL2HBMB.cjs');
5
5
  require('../chunk-NJL3US7H.cjs');
6
+ require('../chunk-O7IHZ53Y.cjs');
6
7
  require('../chunk-UV252FLT.cjs');
7
- require('../chunk-BWNPGRRV.cjs');
8
+ require('../chunk-HLRIXNVG.cjs');
8
9
  require('../chunk-EO4VSB2O.cjs');
9
10
  require('../chunk-JAXDEK5Z.cjs');
10
11
 
@@ -12,31 +13,31 @@ require('../chunk-JAXDEK5Z.cjs');
12
13
 
13
14
  Object.defineProperty(exports, "createModuleRegistry", {
14
15
  enumerable: true,
15
- get: function () { return chunkSSYKDXR4_cjs.createModuleRegistry; }
16
+ get: function () { return chunkODP3DO6P_cjs.createModuleRegistry; }
16
17
  });
17
18
  Object.defineProperty(exports, "getEventTypeName", {
18
19
  enumerable: true,
19
- get: function () { return chunkSSYKDXR4_cjs.getEventTypeName; }
20
+ get: function () { return chunkODP3DO6P_cjs.getEventTypeName; }
20
21
  });
21
22
  Object.defineProperty(exports, "getModuleDependencyNamespace", {
22
23
  enumerable: true,
23
- get: function () { return chunkSSYKDXR4_cjs.getModuleDependencyNamespace; }
24
+ get: function () { return chunkODP3DO6P_cjs.getModuleDependencyNamespace; }
24
25
  });
25
26
  Object.defineProperty(exports, "getObjectTypeName", {
26
27
  enumerable: true,
27
- get: function () { return chunkSSYKDXR4_cjs.getObjectTypeName; }
28
+ get: function () { return chunkODP3DO6P_cjs.getObjectTypeName; }
28
29
  });
29
30
  Object.defineProperty(exports, "registerFabricModule", {
30
31
  enumerable: true,
31
- get: function () { return chunkSSYKDXR4_cjs.registerFabricModule; }
32
+ get: function () { return chunkODP3DO6P_cjs.registerFabricModule; }
32
33
  });
33
34
  Object.defineProperty(exports, "registerFabricModules", {
34
35
  enumerable: true,
35
- get: function () { return chunkSSYKDXR4_cjs.registerFabricModules; }
36
+ get: function () { return chunkODP3DO6P_cjs.registerFabricModules; }
36
37
  });
37
38
  Object.defineProperty(exports, "validateModuleNamespace", {
38
39
  enumerable: true,
39
- get: function () { return chunkSSYKDXR4_cjs.validateModuleNamespace; }
40
+ get: function () { return chunkODP3DO6P_cjs.validateModuleNamespace; }
40
41
  });
41
42
  //# sourceMappingURL=index.cjs.map
42
43
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,7 @@
1
1
  import { ActionDefinition } from '../actions/index.cjs';
2
2
  import { DisplayRenderer } from '../displays/index.cjs';
3
+ import { PortableJsonSchema, JsonValue } from '../objects/index.cjs';
4
+ import { ViewContract } from '../projections/index.cjs';
3
5
 
4
6
  interface ModuleDependency {
5
7
  namespace: string;
@@ -23,6 +25,29 @@ interface ObjectTypeRegistration {
23
25
  displayName?: string;
24
26
  idPrefix?: string;
25
27
  isCoreModuleType?: boolean;
28
+ schema?: PortableJsonSchema;
29
+ semantics?: Record<string, JsonValue>;
30
+ relations?: ObjectRelationDefinition[];
31
+ invariants?: DeclarativeInvariant[];
32
+ }
33
+ type ObjectRelationCardinality = "one" | "many";
34
+ type ObjectRelationSemantics = "reference" | "owned";
35
+ type ObjectRelationDeleteBehavior = "restrict" | "cascade" | "set-null";
36
+ interface ObjectRelationDefinition {
37
+ name: string;
38
+ target: `${string}.${string}`;
39
+ cardinality: ObjectRelationCardinality;
40
+ required?: boolean;
41
+ semantics: ObjectRelationSemantics;
42
+ onTargetDelete: ObjectRelationDeleteBehavior;
43
+ }
44
+ type InvariantEnforcement = "json-schema" | "state-machine" | "policy" | "host-adapter" | "application";
45
+ interface DeclarativeInvariant {
46
+ id: string;
47
+ description: string;
48
+ required?: boolean;
49
+ enforcement: InvariantEnforcement;
50
+ enforcementRef?: string;
26
51
  }
27
52
  type ObjectTypeRegistrationInput = string | ObjectTypeRegistration;
28
53
  interface ModuleDisplayRendererRegistration {
@@ -38,11 +63,33 @@ interface StateMachineRegistration {
38
63
  entityType: string;
39
64
  states: string[];
40
65
  }
66
+ interface CapabilitySlotDefinition {
67
+ name: string;
68
+ description: string;
69
+ shape?: PortableJsonSchema;
70
+ }
71
+ interface CapabilityMetadata {
72
+ displayName: string;
73
+ description: string;
74
+ roles?: string[];
75
+ stability: "experimental" | "beta" | "stable" | "deprecated";
76
+ deprecated?: {
77
+ since: string;
78
+ replacement?: string;
79
+ message: string;
80
+ };
81
+ slots?: CapabilitySlotDefinition[];
82
+ certification?: {
83
+ profile: string;
84
+ required: boolean;
85
+ };
86
+ }
41
87
  interface FabricModule<TDb = unknown> {
42
88
  namespace: string;
43
89
  version?: string;
44
90
  displayName?: string;
45
91
  description?: string;
92
+ capability?: CapabilityMetadata;
46
93
  dependencies?: ModuleDependencyInput[];
47
94
  objectTypes?: ObjectTypeRegistrationInput[];
48
95
  subjectTypes?: string[];
@@ -59,6 +106,7 @@ interface FabricModule<TDb = unknown> {
59
106
  dataClassifications?: unknown[];
60
107
  retentionRules?: unknown[];
61
108
  evidenceRenderers?: unknown[];
109
+ views?: ViewContract[];
62
110
  }
63
111
  interface ModuleRegistry<TDb = unknown> {
64
112
  modules: ReadonlyMap<string, FabricModule<TDb>>;
@@ -71,4 +119,4 @@ declare function createModuleRegistry<TDb = unknown>(modules?: FabricModule<TDb>
71
119
  declare function registerFabricModule(module: FabricModule<unknown>): void;
72
120
  declare function registerFabricModules(modules: FabricModule<unknown>[]): FabricModule<unknown>[];
73
121
 
74
- export { type EventTypeRegistration, type EventTypeRegistrationInput, type FabricModule, type IdPrefixRegistration, type ModuleDependency, type ModuleDependencyInput, type ModuleDisplayRendererRegistration, type ModuleRegistry, type ObjectTypeRegistration, type ObjectTypeRegistrationInput, type PolicyRegistration, type StateMachineRegistration, createModuleRegistry, getEventTypeName, getModuleDependencyNamespace, getObjectTypeName, registerFabricModule, registerFabricModules, validateModuleNamespace };
122
+ export { type CapabilityMetadata, type CapabilitySlotDefinition, type DeclarativeInvariant, type EventTypeRegistration, type EventTypeRegistrationInput, type FabricModule, type IdPrefixRegistration, type InvariantEnforcement, type ModuleDependency, type ModuleDependencyInput, type ModuleDisplayRendererRegistration, type ModuleRegistry, type ObjectRelationCardinality, type ObjectRelationDefinition, type ObjectRelationDeleteBehavior, type ObjectRelationSemantics, type ObjectTypeRegistration, type ObjectTypeRegistrationInput, type PolicyRegistration, type StateMachineRegistration, createModuleRegistry, getEventTypeName, getModuleDependencyNamespace, getObjectTypeName, registerFabricModule, registerFabricModules, validateModuleNamespace };
@@ -1,5 +1,7 @@
1
1
  import { ActionDefinition } from '../actions/index.js';
2
2
  import { DisplayRenderer } from '../displays/index.js';
3
+ import { PortableJsonSchema, JsonValue } from '../objects/index.js';
4
+ import { ViewContract } from '../projections/index.js';
3
5
 
4
6
  interface ModuleDependency {
5
7
  namespace: string;
@@ -23,6 +25,29 @@ interface ObjectTypeRegistration {
23
25
  displayName?: string;
24
26
  idPrefix?: string;
25
27
  isCoreModuleType?: boolean;
28
+ schema?: PortableJsonSchema;
29
+ semantics?: Record<string, JsonValue>;
30
+ relations?: ObjectRelationDefinition[];
31
+ invariants?: DeclarativeInvariant[];
32
+ }
33
+ type ObjectRelationCardinality = "one" | "many";
34
+ type ObjectRelationSemantics = "reference" | "owned";
35
+ type ObjectRelationDeleteBehavior = "restrict" | "cascade" | "set-null";
36
+ interface ObjectRelationDefinition {
37
+ name: string;
38
+ target: `${string}.${string}`;
39
+ cardinality: ObjectRelationCardinality;
40
+ required?: boolean;
41
+ semantics: ObjectRelationSemantics;
42
+ onTargetDelete: ObjectRelationDeleteBehavior;
43
+ }
44
+ type InvariantEnforcement = "json-schema" | "state-machine" | "policy" | "host-adapter" | "application";
45
+ interface DeclarativeInvariant {
46
+ id: string;
47
+ description: string;
48
+ required?: boolean;
49
+ enforcement: InvariantEnforcement;
50
+ enforcementRef?: string;
26
51
  }
27
52
  type ObjectTypeRegistrationInput = string | ObjectTypeRegistration;
28
53
  interface ModuleDisplayRendererRegistration {
@@ -38,11 +63,33 @@ interface StateMachineRegistration {
38
63
  entityType: string;
39
64
  states: string[];
40
65
  }
66
+ interface CapabilitySlotDefinition {
67
+ name: string;
68
+ description: string;
69
+ shape?: PortableJsonSchema;
70
+ }
71
+ interface CapabilityMetadata {
72
+ displayName: string;
73
+ description: string;
74
+ roles?: string[];
75
+ stability: "experimental" | "beta" | "stable" | "deprecated";
76
+ deprecated?: {
77
+ since: string;
78
+ replacement?: string;
79
+ message: string;
80
+ };
81
+ slots?: CapabilitySlotDefinition[];
82
+ certification?: {
83
+ profile: string;
84
+ required: boolean;
85
+ };
86
+ }
41
87
  interface FabricModule<TDb = unknown> {
42
88
  namespace: string;
43
89
  version?: string;
44
90
  displayName?: string;
45
91
  description?: string;
92
+ capability?: CapabilityMetadata;
46
93
  dependencies?: ModuleDependencyInput[];
47
94
  objectTypes?: ObjectTypeRegistrationInput[];
48
95
  subjectTypes?: string[];
@@ -59,6 +106,7 @@ interface FabricModule<TDb = unknown> {
59
106
  dataClassifications?: unknown[];
60
107
  retentionRules?: unknown[];
61
108
  evidenceRenderers?: unknown[];
109
+ views?: ViewContract[];
62
110
  }
63
111
  interface ModuleRegistry<TDb = unknown> {
64
112
  modules: ReadonlyMap<string, FabricModule<TDb>>;
@@ -71,4 +119,4 @@ declare function createModuleRegistry<TDb = unknown>(modules?: FabricModule<TDb>
71
119
  declare function registerFabricModule(module: FabricModule<unknown>): void;
72
120
  declare function registerFabricModules(modules: FabricModule<unknown>[]): FabricModule<unknown>[];
73
121
 
74
- export { type EventTypeRegistration, type EventTypeRegistrationInput, type FabricModule, type IdPrefixRegistration, type ModuleDependency, type ModuleDependencyInput, type ModuleDisplayRendererRegistration, type ModuleRegistry, type ObjectTypeRegistration, type ObjectTypeRegistrationInput, type PolicyRegistration, type StateMachineRegistration, createModuleRegistry, getEventTypeName, getModuleDependencyNamespace, getObjectTypeName, registerFabricModule, registerFabricModules, validateModuleNamespace };
122
+ export { type CapabilityMetadata, type CapabilitySlotDefinition, type DeclarativeInvariant, type EventTypeRegistration, type EventTypeRegistrationInput, type FabricModule, type IdPrefixRegistration, type InvariantEnforcement, type ModuleDependency, type ModuleDependencyInput, type ModuleDisplayRendererRegistration, type ModuleRegistry, type ObjectRelationCardinality, type ObjectRelationDefinition, type ObjectRelationDeleteBehavior, type ObjectRelationSemantics, type ObjectTypeRegistration, type ObjectTypeRegistrationInput, type PolicyRegistration, type StateMachineRegistration, createModuleRegistry, getEventTypeName, getModuleDependencyNamespace, getObjectTypeName, registerFabricModule, registerFabricModules, validateModuleNamespace };
@@ -1,8 +1,9 @@
1
- export { createModuleRegistry, getEventTypeName, getModuleDependencyNamespace, getObjectTypeName, registerFabricModule, registerFabricModules, validateModuleNamespace } from '../chunk-35DD3H55.js';
2
- import '../chunk-I35B576X.js';
1
+ export { createModuleRegistry, getEventTypeName, getModuleDependencyNamespace, getObjectTypeName, registerFabricModule, registerFabricModules, validateModuleNamespace } from '../chunk-3JQI3OFC.js';
2
+ import '../chunk-3S6UTP4X.js';
3
3
  import '../chunk-6ER62UUN.js';
4
+ import '../chunk-7WASIL46.js';
4
5
  import '../chunk-T2JLSZN6.js';
5
- import '../chunk-4SMPJPJ6.js';
6
+ import '../chunk-JM55UQWK.js';
6
7
  import '../chunk-O5WVBQ7P.js';
7
8
  import '../chunk-4YQOGV7H.js';
8
9
  //# sourceMappingURL=index.js.map
@@ -1,24 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var chunkQETQGAXJ_cjs = require('../chunk-QETQGAXJ.cjs');
3
+ var chunkXCL2HBMB_cjs = require('../chunk-XCL2HBMB.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "assertObjectType", {
8
8
  enumerable: true,
9
- get: function () { return chunkQETQGAXJ_cjs.assertObjectType; }
9
+ get: function () { return chunkXCL2HBMB_cjs.assertObjectType; }
10
+ });
11
+ Object.defineProperty(exports, "assertPortableJsonSchema", {
12
+ enumerable: true,
13
+ get: function () { return chunkXCL2HBMB_cjs.assertPortableJsonSchema; }
10
14
  });
11
15
  Object.defineProperty(exports, "getRegisteredObjectTypes", {
12
16
  enumerable: true,
13
- get: function () { return chunkQETQGAXJ_cjs.getRegisteredObjectTypes; }
17
+ get: function () { return chunkXCL2HBMB_cjs.getRegisteredObjectTypes; }
14
18
  });
15
19
  Object.defineProperty(exports, "isValidObjectType", {
16
20
  enumerable: true,
17
- get: function () { return chunkQETQGAXJ_cjs.isValidObjectType; }
21
+ get: function () { return chunkXCL2HBMB_cjs.isValidObjectType; }
18
22
  });
19
23
  Object.defineProperty(exports, "registerObjectType", {
20
24
  enumerable: true,
21
- get: function () { return chunkQETQGAXJ_cjs.registerObjectType; }
25
+ get: function () { return chunkXCL2HBMB_cjs.registerObjectType; }
22
26
  });
23
27
  //# sourceMappingURL=index.cjs.map
24
28
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,51 @@
1
1
  type FabricObjectType = string;
2
+ type JsonPrimitive = string | number | boolean | null;
3
+ type JsonValue = JsonPrimitive | JsonValue[] | {
4
+ [key: string]: JsonValue;
5
+ };
6
+ /**
7
+ * Dependency-free JSON Schema profile accepted in portable module manifests.
8
+ * Unknown extension keywords must use an `x-` prefix. Runtime validators may
9
+ * support more vocabulary, but exported entity contracts stay in this profile.
10
+ */
11
+ interface PortableJsonSchema {
12
+ $schema?: string;
13
+ $id?: string;
14
+ $ref?: string;
15
+ $defs?: Record<string, PortableJsonSchema>;
16
+ title?: string;
17
+ description?: string;
18
+ type?: "null" | "boolean" | "object" | "array" | "number" | "integer" | "string" | Array<"null" | "boolean" | "object" | "array" | "number" | "integer" | "string">;
19
+ enum?: JsonValue[];
20
+ const?: JsonValue;
21
+ properties?: Record<string, PortableJsonSchema>;
22
+ required?: string[];
23
+ additionalProperties?: boolean | PortableJsonSchema;
24
+ items?: PortableJsonSchema | PortableJsonSchema[];
25
+ allOf?: PortableJsonSchema[];
26
+ anyOf?: PortableJsonSchema[];
27
+ oneOf?: PortableJsonSchema[];
28
+ not?: PortableJsonSchema;
29
+ minimum?: number;
30
+ maximum?: number;
31
+ exclusiveMinimum?: number;
32
+ exclusiveMaximum?: number;
33
+ minLength?: number;
34
+ maxLength?: number;
35
+ pattern?: string;
36
+ format?: string;
37
+ minItems?: number;
38
+ maxItems?: number;
39
+ uniqueItems?: boolean;
40
+ default?: JsonValue;
41
+ readOnly?: boolean;
42
+ writeOnly?: boolean;
43
+ [key: `x-${string}`]: JsonValue | undefined;
44
+ }
45
+ declare function assertPortableJsonSchema(schema: unknown, path?: string): asserts schema is PortableJsonSchema;
2
46
  declare function assertObjectType(type: string): asserts type is FabricObjectType;
3
47
  declare function registerObjectType(type: string): void;
4
48
  declare function isValidObjectType(type: string): boolean;
5
49
  declare function getRegisteredObjectTypes(): string[];
6
50
 
7
- export { type FabricObjectType, assertObjectType, getRegisteredObjectTypes, isValidObjectType, registerObjectType };
51
+ export { type FabricObjectType, type JsonPrimitive, type JsonValue, type PortableJsonSchema, assertObjectType, assertPortableJsonSchema, getRegisteredObjectTypes, isValidObjectType, registerObjectType };
@@ -1,7 +1,51 @@
1
1
  type FabricObjectType = string;
2
+ type JsonPrimitive = string | number | boolean | null;
3
+ type JsonValue = JsonPrimitive | JsonValue[] | {
4
+ [key: string]: JsonValue;
5
+ };
6
+ /**
7
+ * Dependency-free JSON Schema profile accepted in portable module manifests.
8
+ * Unknown extension keywords must use an `x-` prefix. Runtime validators may
9
+ * support more vocabulary, but exported entity contracts stay in this profile.
10
+ */
11
+ interface PortableJsonSchema {
12
+ $schema?: string;
13
+ $id?: string;
14
+ $ref?: string;
15
+ $defs?: Record<string, PortableJsonSchema>;
16
+ title?: string;
17
+ description?: string;
18
+ type?: "null" | "boolean" | "object" | "array" | "number" | "integer" | "string" | Array<"null" | "boolean" | "object" | "array" | "number" | "integer" | "string">;
19
+ enum?: JsonValue[];
20
+ const?: JsonValue;
21
+ properties?: Record<string, PortableJsonSchema>;
22
+ required?: string[];
23
+ additionalProperties?: boolean | PortableJsonSchema;
24
+ items?: PortableJsonSchema | PortableJsonSchema[];
25
+ allOf?: PortableJsonSchema[];
26
+ anyOf?: PortableJsonSchema[];
27
+ oneOf?: PortableJsonSchema[];
28
+ not?: PortableJsonSchema;
29
+ minimum?: number;
30
+ maximum?: number;
31
+ exclusiveMinimum?: number;
32
+ exclusiveMaximum?: number;
33
+ minLength?: number;
34
+ maxLength?: number;
35
+ pattern?: string;
36
+ format?: string;
37
+ minItems?: number;
38
+ maxItems?: number;
39
+ uniqueItems?: boolean;
40
+ default?: JsonValue;
41
+ readOnly?: boolean;
42
+ writeOnly?: boolean;
43
+ [key: `x-${string}`]: JsonValue | undefined;
44
+ }
45
+ declare function assertPortableJsonSchema(schema: unknown, path?: string): asserts schema is PortableJsonSchema;
2
46
  declare function assertObjectType(type: string): asserts type is FabricObjectType;
3
47
  declare function registerObjectType(type: string): void;
4
48
  declare function isValidObjectType(type: string): boolean;
5
49
  declare function getRegisteredObjectTypes(): string[];
6
50
 
7
- export { type FabricObjectType, assertObjectType, getRegisteredObjectTypes, isValidObjectType, registerObjectType };
51
+ export { type FabricObjectType, type JsonPrimitive, type JsonValue, type PortableJsonSchema, assertObjectType, assertPortableJsonSchema, getRegisteredObjectTypes, isValidObjectType, registerObjectType };
@@ -1,3 +1,3 @@
1
- export { assertObjectType, getRegisteredObjectTypes, isValidObjectType, registerObjectType } from '../chunk-I35B576X.js';
1
+ export { assertObjectType, assertPortableJsonSchema, getRegisteredObjectTypes, isValidObjectType, registerObjectType } from '../chunk-3S6UTP4X.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -1,12 +1,36 @@
1
1
  'use strict';
2
2
 
3
- var chunkQ3WYIWCN_cjs = require('../chunk-Q3WYIWCN.cjs');
3
+ var chunkO7IHZ53Y_cjs = require('../chunk-O7IHZ53Y.cjs');
4
4
 
5
5
 
6
6
 
7
+ Object.defineProperty(exports, "getRegisteredViewContractKeys", {
8
+ enumerable: true,
9
+ get: function () { return chunkO7IHZ53Y_cjs.getRegisteredViewContractKeys; }
10
+ });
11
+ Object.defineProperty(exports, "registerViewContract", {
12
+ enumerable: true,
13
+ get: function () { return chunkO7IHZ53Y_cjs.registerViewContract; }
14
+ });
15
+ Object.defineProperty(exports, "registerViewContractIfMissing", {
16
+ enumerable: true,
17
+ get: function () { return chunkO7IHZ53Y_cjs.registerViewContractIfMissing; }
18
+ });
7
19
  Object.defineProperty(exports, "replayEvents", {
8
20
  enumerable: true,
9
- get: function () { return chunkQ3WYIWCN_cjs.replayEvents; }
21
+ get: function () { return chunkO7IHZ53Y_cjs.replayEvents; }
22
+ });
23
+ Object.defineProperty(exports, "replayView", {
24
+ enumerable: true,
25
+ get: function () { return chunkO7IHZ53Y_cjs.replayView; }
26
+ });
27
+ Object.defineProperty(exports, "resolveViewContract", {
28
+ enumerable: true,
29
+ get: function () { return chunkO7IHZ53Y_cjs.resolveViewContract; }
30
+ });
31
+ Object.defineProperty(exports, "viewContractKey", {
32
+ enumerable: true,
33
+ get: function () { return chunkO7IHZ53Y_cjs.viewContractKey; }
10
34
  });
11
35
  //# sourceMappingURL=index.cjs.map
12
36
  //# sourceMappingURL=index.cjs.map
@@ -1,8 +1,11 @@
1
+ import { PortableJsonSchema } from '../objects/index.cjs';
2
+
1
3
  interface ReplayableAssetEvent<Payload = unknown> {
2
4
  id: string;
3
5
  tenantId: string;
4
6
  spaceId: string;
5
7
  eventType: string;
8
+ eventSchemaVersion?: number;
6
9
  subjectType: string;
7
10
  subjectId: string;
8
11
  payload: Payload;
@@ -12,6 +15,39 @@ interface ReplayableAssetEvent<Payload = unknown> {
12
15
  actionInvocationId: string;
13
16
  correlationId: string;
14
17
  }
18
+
19
+ interface ViewEventConsumption {
20
+ eventType: string;
21
+ schemaVersions: number[];
22
+ }
23
+ interface ViewContract<State = unknown, Event extends ReplayableAssetEvent = ReplayableAssetEvent> {
24
+ /** Stable module-qualified logical identity, for example `orders/summary`. */
25
+ name: `${string}/${string}`;
26
+ version: string;
27
+ shape: PortableJsonSchema;
28
+ consumes: ViewEventConsumption[];
29
+ scope: "tenant-space";
30
+ snapshotVersion: number;
31
+ compatibleSnapshotVersions?: number[];
32
+ /** Required to transform any older compatible snapshot into the current state shape. */
33
+ upgradeSnapshot?: (data: unknown, fromVersion: number) => State | Promise<State>;
34
+ initialState: State;
35
+ applyEvent: (state: State, event: Event) => State | Promise<State>;
36
+ }
37
+ declare function viewContractKey(view: Pick<ViewContract, "name" | "version">): string;
38
+ declare function registerViewContract(view: ViewContract): void;
39
+ declare function registerViewContractIfMissing(view: ViewContract): void;
40
+ declare function resolveViewContract(name: string, version: string): ViewContract | undefined;
41
+ declare function getRegisteredViewContractKeys(): string[];
42
+ interface ReplayViewOptions<State, Event extends ReplayableAssetEvent = ReplayableAssetEvent> {
43
+ view: ViewContract<State, Event>;
44
+ events: Iterable<Event> | AsyncIterable<Event>;
45
+ scope: ReplayScope;
46
+ snapshot?: (ReplaySnapshot<State> & {
47
+ snapshotVersion: number;
48
+ }) | null;
49
+ }
50
+ declare function replayView<State, Event extends ReplayableAssetEvent = ReplayableAssetEvent>({ view, events, scope, snapshot, }: ReplayViewOptions<State, Event>): Promise<ReplayEventsResult<State, Event>>;
15
51
  interface ReplayScope {
16
52
  tenantId: string;
17
53
  spaceId: string;
@@ -23,7 +59,7 @@ interface ReplaySnapshot<State = unknown> {
23
59
  eventCursor?: string | null;
24
60
  eventSequence?: number | null;
25
61
  }
26
- type ReplayWarningCode = "cursor_not_found" | "duplicate_event" | "missing_sequence" | "subject_scope_incomplete";
62
+ type ReplayWarningCode = "cursor_not_found" | "duplicate_event" | "missing_sequence" | "subject_scope_incomplete" | "unsupported_event_version";
27
63
  interface ReplayWarning {
28
64
  code: ReplayWarningCode;
29
65
  message: string;
@@ -49,4 +85,4 @@ interface ReplayEventsResult<State, Event extends ReplayableAssetEvent = Replaya
49
85
  }
50
86
  declare function replayEvents<State, Event extends ReplayableAssetEvent = ReplayableAssetEvent>({ events, scope, initialState, snapshot, applyEvent, }: ReplayEventsOptions<State, Event>): Promise<ReplayEventsResult<State, Event>>;
51
87
 
52
- export { type ReplayEventsOptions, type ReplayEventsResult, type ReplayScope, type ReplaySnapshot, type ReplayWarning, type ReplayWarningCode, type ReplayableAssetEvent, replayEvents };
88
+ export { type ReplayEventsOptions, type ReplayEventsResult, type ReplayScope, type ReplaySnapshot, type ReplayViewOptions, type ReplayWarning, type ReplayWarningCode, type ReplayableAssetEvent, type ViewContract, type ViewEventConsumption, getRegisteredViewContractKeys, registerViewContract, registerViewContractIfMissing, replayEvents, replayView, resolveViewContract, viewContractKey };