@bian-womp/spark-graph 0.3.65 → 0.3.66
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 +16 -2
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/core/type-utils.d.ts.map +1 -1
- package/lib/cjs/src/runtime/components/graph-utils.d.ts.map +1 -1
- package/lib/esm/index.js +16 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/core/type-utils.d.ts.map +1 -1
- package/lib/esm/src/runtime/components/graph-utils.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/cjs/index.cjs
CHANGED
|
@@ -76,6 +76,7 @@ function mergeInputHandleDescriptors(staticDesc, dynamicDesc) {
|
|
|
76
76
|
const merged = {
|
|
77
77
|
typeId: dynamicObj.typeId ?? staticObj.typeId,
|
|
78
78
|
private: dynamicObj.private ?? staticObj.private,
|
|
79
|
+
defaultPolicy: dynamicObj.defaultPolicy ?? staticObj.defaultPolicy,
|
|
79
80
|
};
|
|
80
81
|
// Merge metadata if either has it
|
|
81
82
|
if (staticObj.metadata || dynamicObj.metadata) {
|
|
@@ -2313,18 +2314,31 @@ function getEffectiveInputs(nodeId, graph, registry) {
|
|
|
2313
2314
|
// Build set of inbound handles (wired inputs)
|
|
2314
2315
|
const inboundEdges = graph.getInboundEdges(nodeId);
|
|
2315
2316
|
const inbound = new Set(inboundEdges.map((e) => e.target.handle));
|
|
2317
|
+
const getDefaultPolicy = (handle) => {
|
|
2318
|
+
const resolvedDesc = resolved?.inputs?.[handle];
|
|
2319
|
+
const staticDesc = desc.inputs?.[handle];
|
|
2320
|
+
const pick = (d) => d && typeof d === "object" && "typeId" in d ? d.defaultPolicy : undefined;
|
|
2321
|
+
return pick(resolvedDesc) ?? pick(staticDesc);
|
|
2322
|
+
};
|
|
2316
2323
|
// Apply defaults only for:
|
|
2317
2324
|
// 1. Unbound handles that have no explicit value
|
|
2318
2325
|
// 2. Static handles (not dynamically resolved)
|
|
2319
2326
|
for (const [handle, defaultValue] of Object.entries(mergedDefaults)) {
|
|
2320
2327
|
if (defaultValue === undefined)
|
|
2321
2328
|
continue;
|
|
2322
|
-
if (inbound.has(handle))
|
|
2323
|
-
continue; // Don't override wired inputs
|
|
2324
2329
|
if (effective[handle] !== undefined)
|
|
2325
2330
|
continue; // Already has value
|
|
2326
2331
|
if (dynamicHandles.has(handle))
|
|
2327
2332
|
continue; // Skip defaults for dynamic handles
|
|
2333
|
+
const policy = getDefaultPolicy(handle);
|
|
2334
|
+
if (policy === "bound") {
|
|
2335
|
+
if (!inbound.has(handle))
|
|
2336
|
+
continue;
|
|
2337
|
+
}
|
|
2338
|
+
else {
|
|
2339
|
+
if (inbound.has(handle))
|
|
2340
|
+
continue;
|
|
2341
|
+
}
|
|
2328
2342
|
// Clone to avoid shared references
|
|
2329
2343
|
effective[handle] = structuredClone(defaultValue);
|
|
2330
2344
|
}
|