@bian-womp/spark-graph 0.1.18 → 0.1.19
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/lib/cjs/index.cjs +30 -4
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/builder/GraphBuilder.d.ts.map +1 -1
- package/lib/cjs/src/builder/Registry.d.ts +3 -3
- package/lib/cjs/src/builder/Registry.d.ts.map +1 -1
- package/lib/cjs/src/core/types.d.ts +7 -1
- package/lib/cjs/src/core/types.d.ts.map +1 -1
- package/lib/cjs/src/index.d.ts +1 -0
- package/lib/cjs/src/index.d.ts.map +1 -1
- package/lib/esm/index.js +29 -5
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/builder/GraphBuilder.d.ts.map +1 -1
- package/lib/esm/src/builder/Registry.d.ts +3 -3
- package/lib/esm/src/builder/Registry.d.ts.map +1 -1
- package/lib/esm/src/core/types.d.ts +7 -1
- package/lib/esm/src/core/types.d.ts.map +1 -1
- package/lib/esm/src/index.d.ts +1 -0
- package/lib/esm/src/index.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/cjs/index.cjs
CHANGED
|
@@ -380,6 +380,16 @@ function isTypedOutput(v) {
|
|
|
380
380
|
typeof v === "object" &&
|
|
381
381
|
Object.prototype.hasOwnProperty.call(v, "__spark_type"));
|
|
382
382
|
}
|
|
383
|
+
function getInputTypeId(inputs, handle) {
|
|
384
|
+
const v = inputs ? inputs[handle] : undefined;
|
|
385
|
+
if (!v)
|
|
386
|
+
return undefined;
|
|
387
|
+
return typeof v === "string" ? v : v.typeId;
|
|
388
|
+
}
|
|
389
|
+
function isInputPrivate(inputs, handle) {
|
|
390
|
+
const v = inputs ? inputs[handle] : undefined;
|
|
391
|
+
return !!(v && typeof v === "object" && v.private);
|
|
392
|
+
}
|
|
383
393
|
|
|
384
394
|
class GraphRuntime {
|
|
385
395
|
constructor() {
|
|
@@ -452,7 +462,7 @@ class GraphRuntime {
|
|
|
452
462
|
if (dstNode) {
|
|
453
463
|
const dstDesc = registry.nodes.get(dstNode.typeId);
|
|
454
464
|
if (dstDesc) {
|
|
455
|
-
dstDeclared = dstDesc.inputs
|
|
465
|
+
dstDeclared = getInputTypeId(dstDesc.inputs, e.target.handle);
|
|
456
466
|
}
|
|
457
467
|
}
|
|
458
468
|
// Attach dynamic convert/convertAsync aware of union sources and typed outputs
|
|
@@ -1105,7 +1115,7 @@ class GraphRuntime {
|
|
|
1105
1115
|
if (dstNode) {
|
|
1106
1116
|
const dstDesc = registry.nodes.get(dstNode.typeId);
|
|
1107
1117
|
if (dstDesc) {
|
|
1108
|
-
dstDeclared = dstDesc.inputs
|
|
1118
|
+
dstDeclared = getInputTypeId(dstDesc.inputs, e.target.handle);
|
|
1109
1119
|
}
|
|
1110
1120
|
}
|
|
1111
1121
|
const { convert, convertAsync } = GraphRuntime.buildEdgeConverters(srcDeclared, dstDeclared, registry);
|
|
@@ -1343,7 +1353,20 @@ class GraphBuilder {
|
|
|
1343
1353
|
});
|
|
1344
1354
|
}
|
|
1345
1355
|
if (dstType) {
|
|
1346
|
-
|
|
1356
|
+
// Private inputs should not accept edges
|
|
1357
|
+
if (isInputPrivate(dstType.inputs, e.target.handle)) {
|
|
1358
|
+
issues.push({
|
|
1359
|
+
level: "error",
|
|
1360
|
+
code: "INPUT_PRIVATE",
|
|
1361
|
+
message: `Edge ${e.id} targets private input ${dstNode.typeId}.${e.target.handle}`,
|
|
1362
|
+
data: {
|
|
1363
|
+
edgeId: e.id,
|
|
1364
|
+
nodeId: dstNode.nodeId,
|
|
1365
|
+
input: e.target.handle,
|
|
1366
|
+
},
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
const declaredIn = getInputTypeId(dstType.inputs, e.target.handle);
|
|
1347
1370
|
if (declaredIn && effectiveTypeId) {
|
|
1348
1371
|
// If source is a union, ensure each variant can reach declaredIn
|
|
1349
1372
|
if (srcNode) {
|
|
@@ -1421,7 +1444,8 @@ class GraphBuilder {
|
|
|
1421
1444
|
? this.registry.nodes.get(innerNode.typeId)
|
|
1422
1445
|
: undefined;
|
|
1423
1446
|
const typeId = innerDesc ? innerDesc.inputs[map.handle] : undefined;
|
|
1424
|
-
inputTypes[outerIn] =
|
|
1447
|
+
inputTypes[outerIn] =
|
|
1448
|
+
typeof typeId === "string" ? typeId : typeId?.typeId ?? "untyped";
|
|
1425
1449
|
}
|
|
1426
1450
|
for (const [outerOut, map] of Object.entries(exposure.outputs)) {
|
|
1427
1451
|
const innerNode = def.nodes.find((n) => n.nodeId === map.nodeId);
|
|
@@ -2411,6 +2435,8 @@ exports.createSimpleGraphDef = createSimpleGraphDef;
|
|
|
2411
2435
|
exports.createSimpleGraphRegistry = createSimpleGraphRegistry;
|
|
2412
2436
|
exports.createValidationGraphDef = createValidationGraphDef;
|
|
2413
2437
|
exports.createValidationGraphRegistry = createValidationGraphRegistry;
|
|
2438
|
+
exports.getInputTypeId = getInputTypeId;
|
|
2439
|
+
exports.isInputPrivate = isInputPrivate;
|
|
2414
2440
|
exports.isTypedOutput = isTypedOutput;
|
|
2415
2441
|
exports.registerDelayNode = registerDelayNode;
|
|
2416
2442
|
exports.registerProgressNodes = registerProgressNodes;
|