@inf-monkeys-tech/monkeys 1.1.15 → 1.1.16
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/README.md +6 -0
- package/lib/contracts/declarative-control-http.d.ts +340 -0
- package/lib/contracts/declarative-control-http.d.ts.map +1 -1
- package/lib/contracts/declarative-control.d.ts +42 -0
- package/lib/contracts/declarative-control.d.ts.map +1 -1
- package/lib/contracts/declarative-control.js +46 -2
- package/lib/contracts/declarative-control.js.map +1 -1
- package/lib/contracts/declarative-document-import.d.ts +50 -0
- package/lib/contracts/declarative-document-import.d.ts.map +1 -1
- package/lib/contracts/declarative-publication-job.d.ts +80 -0
- package/lib/contracts/declarative-publication-job.d.ts.map +1 -1
- package/lib/esm/contracts/index.mjs +37 -0
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +39 -0
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +38 -0
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +36 -0
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/json-schema/page-runtime-bundle.schema.json +77 -0
- package/lib/json-schema/page.schema.json +77 -0
- package/lib/runtime/declarative-control-compiler.d.ts.map +1 -1
- package/lib/runtime/declarative-control-compiler.js +2 -0
- package/lib/runtime/declarative-control-compiler.js.map +1 -1
- package/lib/schemas/index.d.ts +20 -0
- package/lib/schemas/index.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/esm/index.mjs
CHANGED
|
@@ -12167,6 +12167,34 @@ var PageNodeSchema = z15.lazy(
|
|
|
12167
12167
|
children: z15.array(PageNodeSchema).optional()
|
|
12168
12168
|
}).strict()
|
|
12169
12169
|
);
|
|
12170
|
+
var PageSharedStateBindingSchema = z15.object({
|
|
12171
|
+
bindingId: ContractIdentifierSchema,
|
|
12172
|
+
provider: z15.object({ id: ContractIdentifierSchema, version: z15.number().int().positive() }).strict(),
|
|
12173
|
+
states: z15.record(ContractIdentifierSchema, ContractIdentifierSchema).refine((value) => Object.keys(value).length > 0 && Object.keys(value).length <= 32, "Map 1\u201332 state slots."),
|
|
12174
|
+
queries: z15.record(ContractIdentifierSchema, ContractIdentifierSchema).refine((value) => Object.keys(value).length <= 16, "Map at most 16 query slots."),
|
|
12175
|
+
writeInteractions: z15.array(ContractIdentifierSchema).max(32)
|
|
12176
|
+
}).strict();
|
|
12177
|
+
var validateSharedStateBindings = (bindings, states, queryIds, interactions, context) => {
|
|
12178
|
+
const ids = /* @__PURE__ */ new Set();
|
|
12179
|
+
const owned = /* @__PURE__ */ new Set();
|
|
12180
|
+
for (const [index, binding] of (bindings ?? []).entries()) {
|
|
12181
|
+
const issue = (message) => context.addIssue({ code: "custom", path: ["sharedStateBindings", index], message });
|
|
12182
|
+
if (ids.has(binding.bindingId)) issue("Shared state binding ids must be unique.");
|
|
12183
|
+
ids.add(binding.bindingId);
|
|
12184
|
+
const mapped = Object.values(binding.states);
|
|
12185
|
+
for (const id of mapped) {
|
|
12186
|
+
if (owned.has(id)) issue("Shared state mappings must have one owner and distinct slots.");
|
|
12187
|
+
owned.add(id);
|
|
12188
|
+
if (!states.some((state) => state.stateId === id && !state.scopeNodeId)) issue(`Shared state ${id} must reference a declared root state.`);
|
|
12189
|
+
}
|
|
12190
|
+
for (const id of Object.values(binding.queries)) if (!queryIds.has(id)) issue(`Unknown shared state query ${id}.`);
|
|
12191
|
+
if (new Set(binding.writeInteractions).size !== binding.writeInteractions.length) issue("Shared state write interactions must be unique.");
|
|
12192
|
+
for (const id of binding.writeInteractions) {
|
|
12193
|
+
const interaction = interactions.find((entry) => entry.bindingId === id);
|
|
12194
|
+
if (!interaction || !mapped.includes(interaction.targetStateId)) issue(`Shared state write ${id} must target a mapped state.`);
|
|
12195
|
+
}
|
|
12196
|
+
}
|
|
12197
|
+
};
|
|
12170
12198
|
var PageSchema = z15.object({
|
|
12171
12199
|
contract: z15.literal("Page"),
|
|
12172
12200
|
schemaVersion: z15.literal(DECLARATIVE_CONTROL_SCHEMA_VERSION),
|
|
@@ -12181,6 +12209,7 @@ var PageSchema = z15.object({
|
|
|
12181
12209
|
shell: ContractIdentifierSchema.optional(),
|
|
12182
12210
|
body: PageNodeSchema,
|
|
12183
12211
|
state: z15.array(PageStateSchema).optional(),
|
|
12212
|
+
sharedStateBindings: z15.array(PageSharedStateBindingSchema).max(16).optional(),
|
|
12184
12213
|
entryTransitions: z15.array(PageEntrySchema).optional(),
|
|
12185
12214
|
access: AccessPolicySchema,
|
|
12186
12215
|
managementAccess: ManagementAccessSchema,
|
|
@@ -12193,6 +12222,7 @@ var PageSchema = z15.object({
|
|
|
12193
12222
|
const dataIds = /* @__PURE__ */ new Set();
|
|
12194
12223
|
const actionIds = /* @__PURE__ */ new Set();
|
|
12195
12224
|
const interactionIds = /* @__PURE__ */ new Set();
|
|
12225
|
+
const sharedInteractions = [];
|
|
12196
12226
|
const visit = (node, path) => {
|
|
12197
12227
|
if (ids.has(node.id))
|
|
12198
12228
|
context.addIssue({
|
|
@@ -12215,11 +12245,13 @@ var PageSchema = z15.object({
|
|
|
12215
12245
|
});
|
|
12216
12246
|
target.add(value.bindingId);
|
|
12217
12247
|
}
|
|
12248
|
+
sharedInteractions.push(...node.on ?? []);
|
|
12218
12249
|
(node.children ?? []).forEach(
|
|
12219
12250
|
(child, index) => visit(child, [...path, "children", index])
|
|
12220
12251
|
);
|
|
12221
12252
|
};
|
|
12222
12253
|
visit(page.body, ["body"]);
|
|
12254
|
+
validateSharedStateBindings(page.sharedStateBindings, page.state ?? [], dataIds, sharedInteractions, context);
|
|
12223
12255
|
const stateIds = (page.state ?? []).map((entry) => entry.stateId);
|
|
12224
12256
|
if (new Set(stateIds).size !== stateIds.length)
|
|
12225
12257
|
context.addIssue({
|
|
@@ -12249,6 +12281,7 @@ var ResolvedPageSchema = z15.object({
|
|
|
12249
12281
|
renderTree: RenderTreeSchema,
|
|
12250
12282
|
capabilityInstances: z15.array(CapabilityInstanceSchema).min(1),
|
|
12251
12283
|
stateDefinitions: z15.array(PageStateDefinitionSchema).optional(),
|
|
12284
|
+
sharedStateBindings: z15.array(PageSharedStateBindingSchema).max(16).optional(),
|
|
12252
12285
|
entryTransitions: z15.array(PageEntryTransitionSchema).optional(),
|
|
12253
12286
|
interactionBindings: z15.array(InteractionBindingSchema).optional(),
|
|
12254
12287
|
ontologyBindings: z15.array(PersistedOntologyBindingSchema),
|
|
@@ -12291,6 +12324,7 @@ var ResolvedPageSchema = z15.object({
|
|
|
12291
12324
|
});
|
|
12292
12325
|
}
|
|
12293
12326
|
});
|
|
12327
|
+
validateSharedStateBindings(value.sharedStateBindings, value.stateDefinitions ?? [], new Set([...value.queryBindings ?? [], ...value.ontologyBindings].map((binding) => binding.bindingId)), value.interactionBindings ?? [], context);
|
|
12294
12328
|
const stateDefinitions = value.stateDefinitions ?? [];
|
|
12295
12329
|
const entryTransitions = value.entryTransitions ?? [];
|
|
12296
12330
|
const interactionBindings = value.interactionBindings ?? [];
|
|
@@ -14047,6 +14081,7 @@ var CompatiblePageRuntimeBundleSchema = z15.object({
|
|
|
14047
14081
|
deniedCapabilityInstanceIds: z15.array(ContractIdentifierSchema).default([]),
|
|
14048
14082
|
capabilityAccessEvaluated: z15.literal(true).optional(),
|
|
14049
14083
|
stateDefinitions: z15.array(PageStateDefinitionSchema).default([]),
|
|
14084
|
+
sharedStateBindings: z15.array(PageSharedStateBindingSchema).max(16).optional(),
|
|
14050
14085
|
entryTransitions: z15.array(ResolvedPageEntryTransitionSchema).default([]),
|
|
14051
14086
|
interactionBindings: z15.array(InteractionBindingSchema).default([]),
|
|
14052
14087
|
ontologyBindings: z15.array(PersistedOntologyBindingSchema),
|
|
@@ -14063,6 +14098,7 @@ var CompatiblePageRuntimeBundleSchema = z15.object({
|
|
|
14063
14098
|
"restricted"
|
|
14064
14099
|
])
|
|
14065
14100
|
}).strict().superRefine((value, context) => {
|
|
14101
|
+
validateSharedStateBindings(value.sharedStateBindings, value.stateDefinitions, new Set([...value.queryBindings, ...value.ontologyBindings].map((binding) => binding.bindingId)), value.interactionBindings, context);
|
|
14066
14102
|
const instanceIds = new Set(
|
|
14067
14103
|
value.capabilityInstances.map((instance) => instance.instanceId)
|
|
14068
14104
|
);
|
|
@@ -23494,6 +23530,7 @@ var resolvePage = (input) => {
|
|
|
23494
23530
|
},
|
|
23495
23531
|
capabilityInstances,
|
|
23496
23532
|
...stateDefinitions.length ? { stateDefinitions } : {},
|
|
23533
|
+
...page.sharedStateBindings ? { sharedStateBindings: page.sharedStateBindings } : {},
|
|
23497
23534
|
...page.entryTransitions ? {
|
|
23498
23535
|
entryTransitions: page.entryTransitions.map(
|
|
23499
23536
|
({ target, ...transition }, index) => {
|
|
@@ -24181,6 +24218,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
24181
24218
|
capabilityInstances: page.capabilityInstances,
|
|
24182
24219
|
deniedCapabilityInstanceIds: [],
|
|
24183
24220
|
stateDefinitions: page.stateDefinitions,
|
|
24221
|
+
...page.sharedStateBindings ? { sharedStateBindings: page.sharedStateBindings } : {},
|
|
24184
24222
|
entryTransitions,
|
|
24185
24223
|
interactionBindings: page.interactionBindings,
|
|
24186
24224
|
ontologyBindings: page.ontologyBindings,
|
|
@@ -27485,6 +27523,7 @@ export {
|
|
|
27485
27523
|
PageRuntimeDescriptorSchema,
|
|
27486
27524
|
PageRuntimeProjectionSchema,
|
|
27487
27525
|
PageSchema,
|
|
27526
|
+
PageSharedStateBindingSchema,
|
|
27488
27527
|
PageStateActivationSchema,
|
|
27489
27528
|
PageStateConditionSchema,
|
|
27490
27529
|
PageStateDefinitionSchema,
|