@ultrst-armada/kloks 1.10.1 → 1.10.3
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"packageName": "@ultrst-armada/kloks",
|
|
4
|
-
"version": "1.10.
|
|
5
|
-
"sourceCommit": "
|
|
4
|
+
"version": "1.10.3",
|
|
5
|
+
"sourceCommit": "2996ca27ffbccaf9a982b5423f63f8b67efda7e3",
|
|
6
6
|
"releaseWorkflow": "npm Release",
|
|
7
|
-
"workflowRunId": "
|
|
7
|
+
"workflowRunId": "40318694348"
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -628,6 +628,9 @@ interface UIAuthoringNode {
|
|
|
628
628
|
assetRef?: AssetRef;
|
|
629
629
|
parentId?: string;
|
|
630
630
|
props: Record<string, string | number | boolean>;
|
|
631
|
+
slots?: Record<string, string[]>;
|
|
632
|
+
states?: Record<string, Record<string, string | number | boolean>>;
|
|
633
|
+
events?: Record<string, string>;
|
|
631
634
|
}
|
|
632
635
|
interface UIAuthoringBinding {
|
|
633
636
|
componentId: string;
|
|
@@ -452,7 +452,9 @@ function getUIComponentPromotion(purpose) {
|
|
|
452
452
|
function buildUIComponentArtifact(session) {
|
|
453
453
|
const purpose = getUIComponentPurpose(session.context);
|
|
454
454
|
const origin = session.metadata.origin === "kult" || session.metadata.origin === "theta" || session.metadata.origin === "kelt" ? session.metadata.origin : "other";
|
|
455
|
-
const
|
|
455
|
+
const requestedRootId = session.metadata.rootComponentId;
|
|
456
|
+
const root = session.nodes.find((node) => node.kind === "component" && node.id === requestedRootId) || session.nodes.find((node) => node.kind === "component");
|
|
457
|
+
const rootAsset = root?.assetRef;
|
|
456
458
|
return {
|
|
457
459
|
artifactId: "kloks.ui-artifact." + session.sessionId,
|
|
458
460
|
schemaVersion: "1.0.0",
|
|
@@ -462,7 +464,7 @@ function buildUIComponentArtifact(session) {
|
|
|
462
464
|
context: session.context,
|
|
463
465
|
name: session.metadata.name || session.sessionId,
|
|
464
466
|
description: session.metadata.description || "",
|
|
465
|
-
rootAsset
|
|
467
|
+
rootAsset,
|
|
466
468
|
session
|
|
467
469
|
};
|
|
468
470
|
}
|
|
@@ -1879,13 +1879,44 @@ function validateSession(session) {
|
|
|
1879
1879
|
ids.add(node.id);
|
|
1880
1880
|
if (node.parentId && !session.nodes.some((parent) => parent.id === node.parentId)) errors.push(`Missing parent for node: ${node.id}`);
|
|
1881
1881
|
if (node.kind === "page" && node.parentId) errors.push(`Page cannot have a parent: ${node.id}`);
|
|
1882
|
+
if (node.kind === "section" && !node.parentId) errors.push(`Section requires a page parent: ${node.id}`);
|
|
1882
1883
|
if (node.kind === "section" && node.parentId && !session.nodes.some((parent) => parent.id === node.parentId && parent.kind === "page")) errors.push(`Section parent must be a page: ${node.id}`);
|
|
1884
|
+
if (node.kind === "component" && !node.parentId) errors.push(`Component requires a section parent: ${node.id}`);
|
|
1883
1885
|
if (node.kind === "component" && node.parentId && !session.nodes.some((parent) => parent.id === node.parentId && parent.kind === "section")) errors.push(`Component parent must be a section: ${node.id}`);
|
|
1884
1886
|
}
|
|
1885
1887
|
if (session.nodes.some((node) => node.kind === "component" && !node.assetRef)) errors.push("Every component node requires a FLOKS asset reference.");
|
|
1886
1888
|
if (session.context === "service" && !session.metadata.serviceId) errors.push("Service authoring requires metadata.serviceId.");
|
|
1889
|
+
for (const node of session.nodes) {
|
|
1890
|
+
for (const [slotId, childIds] of Object.entries(node.slots || {})) {
|
|
1891
|
+
if (!slotId.trim()) errors.push(`Slot id cannot be blank on node: ${node.id}`);
|
|
1892
|
+
for (const childId of childIds) {
|
|
1893
|
+
const child = session.nodes.find((candidate) => candidate.id === childId);
|
|
1894
|
+
if (!child) errors.push(`Slot ${slotId} references missing child: ${childId}`);
|
|
1895
|
+
else if (child.parentId !== node.id) errors.push(`Slot child ${childId} must be a direct child of node: ${node.id}`);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
for (const [eventName, operationId] of Object.entries(node.events || {})) {
|
|
1899
|
+
if (!eventName.trim()) errors.push(`Event name cannot be blank on node: ${node.id}`);
|
|
1900
|
+
if (!operationId.trim() || !session.operations.some((operation) => operation.operationId === operationId)) {
|
|
1901
|
+
errors.push(`Event ${eventName} references missing operation: ${operationId}`);
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1887
1905
|
for (const binding of session.bindings) {
|
|
1888
|
-
|
|
1906
|
+
const component = session.nodes.find((node) => node.id === binding.componentId);
|
|
1907
|
+
if (!component) errors.push(`Binding references missing component: ${binding.componentId}`);
|
|
1908
|
+
else if (component.kind !== "component") errors.push(`Binding target must be a component node: ${binding.componentId}`);
|
|
1909
|
+
const operation = session.operations.find((item) => item.operationId === binding.target.apiId);
|
|
1910
|
+
if (!operation) {
|
|
1911
|
+
errors.push(`Binding references missing operation: ${binding.target.apiId}`);
|
|
1912
|
+
continue;
|
|
1913
|
+
}
|
|
1914
|
+
const fields = binding.target.kind === "api-input" ? operation.inputFields : operation.outputFields;
|
|
1915
|
+
const field = fields?.find((item) => item.name === binding.target.field);
|
|
1916
|
+
if (!field) errors.push(`Binding references missing ${binding.target.kind === "api-input" ? "input" : "output"} field: ${binding.target.apiId}.${binding.target.field}`);
|
|
1917
|
+
else if (field.type.toLowerCase() !== binding.target.fieldType.toLowerCase()) {
|
|
1918
|
+
errors.push(`Binding field type mismatch for ${binding.target.apiId}.${binding.target.field}: expected ${field.type}, received ${binding.target.fieldType}`);
|
|
1919
|
+
}
|
|
1889
1920
|
}
|
|
1890
1921
|
if (!session.operations.length) warnings.push("No service operations have been attached to this authoring session.");
|
|
1891
1922
|
return { valid: errors.length === 0, errors, warnings };
|
|
@@ -7,6 +7,15 @@ import {
|
|
|
7
7
|
instantiateSubgraph
|
|
8
8
|
} from "./chunk-S22PMERU.js";
|
|
9
9
|
import "./chunk-RHRXPY2U.js";
|
|
10
|
+
import {
|
|
11
|
+
LifecycleCycleError,
|
|
12
|
+
LifecycleGraph,
|
|
13
|
+
SKIPO_STATE,
|
|
14
|
+
SkipoStateEngine,
|
|
15
|
+
useLifecycleScope,
|
|
16
|
+
useSkipoBind,
|
|
17
|
+
useSkipoState
|
|
18
|
+
} from "./chunk-EW4ACSZB.js";
|
|
10
19
|
import {
|
|
11
20
|
AttractionEngine,
|
|
12
21
|
GhostInferenceEngine,
|
|
@@ -22,15 +31,6 @@ import {
|
|
|
22
31
|
WireTypeRegistry,
|
|
23
32
|
initializeDefaultGraphRules
|
|
24
33
|
} from "./chunk-TZOL3RN7.js";
|
|
25
|
-
import {
|
|
26
|
-
LifecycleCycleError,
|
|
27
|
-
LifecycleGraph,
|
|
28
|
-
SKIPO_STATE,
|
|
29
|
-
SkipoStateEngine,
|
|
30
|
-
useLifecycleScope,
|
|
31
|
-
useSkipoBind,
|
|
32
|
-
useSkipoState
|
|
33
|
-
} from "./chunk-EW4ACSZB.js";
|
|
34
34
|
import {
|
|
35
35
|
CommandApi,
|
|
36
36
|
GhostStore,
|