@principal-ai/principal-view-cli 0.1.23 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +18 -30
- package/dist/index.cjs +30 -32
- package/dist/index.cjs.map +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgjCpC,wBAAgB,qBAAqB,IAAI,OAAO,CAsH/C"}
|
|
@@ -182,7 +182,17 @@ function validateIconName(iconValue, path, issues) {
|
|
|
182
182
|
*/
|
|
183
183
|
const ALLOWED_CANVAS_FIELDS = {
|
|
184
184
|
root: ['nodes', 'edges', 'pv'],
|
|
185
|
-
pv: [
|
|
185
|
+
pv: [
|
|
186
|
+
'version',
|
|
187
|
+
'name',
|
|
188
|
+
'description',
|
|
189
|
+
'nodeTypes',
|
|
190
|
+
'edgeTypes',
|
|
191
|
+
'pathConfig',
|
|
192
|
+
'display',
|
|
193
|
+
'scope',
|
|
194
|
+
'audit',
|
|
195
|
+
],
|
|
186
196
|
pvPathConfig: [
|
|
187
197
|
'projectRoot',
|
|
188
198
|
'captureSource',
|
|
@@ -540,37 +550,15 @@ function validateCanvas(canvas, filePath, library) {
|
|
|
540
550
|
suggestion: 'Add a "url" field with a URL, or change the node type',
|
|
541
551
|
});
|
|
542
552
|
}
|
|
543
|
-
// Validate node type - must be standard
|
|
553
|
+
// Validate node type - must be a standard JSON Canvas type
|
|
544
554
|
const isStandardType = STANDARD_CANVAS_TYPES.includes(nodeType);
|
|
545
555
|
if (!isStandardType) {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
suggestion: `Use a standard type (${STANDARD_CANVAS_TYPES.join(', ')}) or add pv.nodeType and pv.shape`,
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
else {
|
|
556
|
-
const nodePv = n.pv;
|
|
557
|
-
if (typeof nodePv.nodeType !== 'string' || !nodePv.nodeType) {
|
|
558
|
-
issues.push({
|
|
559
|
-
type: 'error',
|
|
560
|
-
message: `Node "${n.id || index}" with custom type must have "pv.nodeType"`,
|
|
561
|
-
path: `nodes[${index}].pv.nodeType`,
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
if (typeof nodePv.shape !== 'string' ||
|
|
565
|
-
!VALID_NODE_SHAPES.includes(nodePv.shape)) {
|
|
566
|
-
issues.push({
|
|
567
|
-
type: 'error',
|
|
568
|
-
message: `Node "${n.id || index}" must have a valid "pv.shape"`,
|
|
569
|
-
path: `nodes[${index}].pv.shape`,
|
|
570
|
-
suggestion: `Valid shapes: ${VALID_NODE_SHAPES.join(', ')}`,
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
}
|
|
556
|
+
issues.push({
|
|
557
|
+
type: 'error',
|
|
558
|
+
message: `Node "${n.id || index}" uses invalid type "${nodeType}"`,
|
|
559
|
+
path: `nodes[${index}].type`,
|
|
560
|
+
suggestion: `Use a standard JSON Canvas type (${STANDARD_CANVAS_TYPES.join(', ')}). For custom shapes, use type: "text" with pv.shape: "${nodeType}"`,
|
|
561
|
+
});
|
|
574
562
|
}
|
|
575
563
|
// Validate node pv extension fields
|
|
576
564
|
if (n.pv && typeof n.pv === 'object') {
|
package/dist/index.cjs
CHANGED
|
@@ -13511,7 +13511,11 @@ function validateLibrary(library) {
|
|
|
13511
13511
|
issues
|
|
13512
13512
|
);
|
|
13513
13513
|
const state = stateDef;
|
|
13514
|
-
validateIconName(
|
|
13514
|
+
validateIconName(
|
|
13515
|
+
state.icon,
|
|
13516
|
+
`nodeComponents.${compId}.states.${stateId}.icon`,
|
|
13517
|
+
issues
|
|
13518
|
+
);
|
|
13515
13519
|
}
|
|
13516
13520
|
}
|
|
13517
13521
|
}
|
|
@@ -13605,7 +13609,6 @@ function validateLibrary(library) {
|
|
|
13605
13609
|
return issues;
|
|
13606
13610
|
}
|
|
13607
13611
|
var STANDARD_CANVAS_TYPES = ["text", "group", "file", "link"];
|
|
13608
|
-
var VALID_NODE_SHAPES = ["circle", "rectangle", "hexagon", "diamond", "custom"];
|
|
13609
13612
|
function kebabToPascalCase(str2) {
|
|
13610
13613
|
return str2.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join("");
|
|
13611
13614
|
}
|
|
@@ -13638,7 +13641,17 @@ function validateIconName(iconValue, path4, issues) {
|
|
|
13638
13641
|
}
|
|
13639
13642
|
var ALLOWED_CANVAS_FIELDS = {
|
|
13640
13643
|
root: ["nodes", "edges", "pv"],
|
|
13641
|
-
pv: [
|
|
13644
|
+
pv: [
|
|
13645
|
+
"version",
|
|
13646
|
+
"name",
|
|
13647
|
+
"description",
|
|
13648
|
+
"nodeTypes",
|
|
13649
|
+
"edgeTypes",
|
|
13650
|
+
"pathConfig",
|
|
13651
|
+
"display",
|
|
13652
|
+
"scope",
|
|
13653
|
+
"audit"
|
|
13654
|
+
],
|
|
13642
13655
|
pvPathConfig: [
|
|
13643
13656
|
"projectRoot",
|
|
13644
13657
|
"captureSource",
|
|
@@ -13990,33 +14003,14 @@ function validateCanvas(canvas, filePath, library) {
|
|
|
13990
14003
|
nodeType
|
|
13991
14004
|
);
|
|
13992
14005
|
if (!isStandardType) {
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
});
|
|
14002
|
-
} else {
|
|
14003
|
-
const nodePv = n.pv;
|
|
14004
|
-
if (typeof nodePv.nodeType !== "string" || !nodePv.nodeType) {
|
|
14005
|
-
issues.push({
|
|
14006
|
-
type: "error",
|
|
14007
|
-
message: `Node "${n.id || index}" with custom type must have "pv.nodeType"`,
|
|
14008
|
-
path: `nodes[${index}].pv.nodeType`
|
|
14009
|
-
});
|
|
14010
|
-
}
|
|
14011
|
-
if (typeof nodePv.shape !== "string" || !VALID_NODE_SHAPES.includes(nodePv.shape)) {
|
|
14012
|
-
issues.push({
|
|
14013
|
-
type: "error",
|
|
14014
|
-
message: `Node "${n.id || index}" must have a valid "pv.shape"`,
|
|
14015
|
-
path: `nodes[${index}].pv.shape`,
|
|
14016
|
-
suggestion: `Valid shapes: ${VALID_NODE_SHAPES.join(", ")}`
|
|
14017
|
-
});
|
|
14018
|
-
}
|
|
14019
|
-
}
|
|
14006
|
+
issues.push({
|
|
14007
|
+
type: "error",
|
|
14008
|
+
message: `Node "${n.id || index}" uses invalid type "${nodeType}"`,
|
|
14009
|
+
path: `nodes[${index}].type`,
|
|
14010
|
+
suggestion: `Use a standard JSON Canvas type (${STANDARD_CANVAS_TYPES.join(
|
|
14011
|
+
", "
|
|
14012
|
+
)}). For custom shapes, use type: "text" with pv.shape: "${nodeType}"`
|
|
14013
|
+
});
|
|
14020
14014
|
}
|
|
14021
14015
|
if (n.pv && typeof n.pv === "object") {
|
|
14022
14016
|
const nodePv = n.pv;
|
|
@@ -14164,7 +14158,9 @@ function validateCanvas(canvas, filePath, library) {
|
|
|
14164
14158
|
type: "error",
|
|
14165
14159
|
message: `Edge "${edgeLabel}" must have a "fromSide" field`,
|
|
14166
14160
|
path: `${edgePath}.fromSide`,
|
|
14167
|
-
suggestion: `Specify which side of the source node the edge starts from: ${VALID_SIDES.join(
|
|
14161
|
+
suggestion: `Specify which side of the source node the edge starts from: ${VALID_SIDES.join(
|
|
14162
|
+
", "
|
|
14163
|
+
)}`
|
|
14168
14164
|
});
|
|
14169
14165
|
} else if (!VALID_SIDES.includes(e.fromSide)) {
|
|
14170
14166
|
issues.push({
|
|
@@ -14179,7 +14175,9 @@ function validateCanvas(canvas, filePath, library) {
|
|
|
14179
14175
|
type: "error",
|
|
14180
14176
|
message: `Edge "${edgeLabel}" must have a "toSide" field`,
|
|
14181
14177
|
path: `${edgePath}.toSide`,
|
|
14182
|
-
suggestion: `Specify which side of the target node the edge connects to: ${VALID_SIDES.join(
|
|
14178
|
+
suggestion: `Specify which side of the target node the edge connects to: ${VALID_SIDES.join(
|
|
14179
|
+
", "
|
|
14180
|
+
)}`
|
|
14183
14181
|
});
|
|
14184
14182
|
} else if (!VALID_SIDES.includes(e.toSide)) {
|
|
14185
14183
|
issues.push({
|