@bian-womp/spark-workbench 0.3.38 → 0.3.40
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 +11 -11
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/core/InMemoryWorkbench.d.ts.map +1 -1
- package/lib/cjs/src/misc/WorkbenchStudio.d.ts.map +1 -1
- package/lib/esm/index.js +12 -12
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/core/InMemoryWorkbench.d.ts.map +1 -1
- package/lib/esm/src/misc/WorkbenchStudio.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/cjs/index.cjs
CHANGED
|
@@ -651,7 +651,7 @@ class InMemoryWorkbench extends AbstractWorkbench {
|
|
|
651
651
|
try {
|
|
652
652
|
if (!outputTypeId || outputValue === undefined)
|
|
653
653
|
return undefined;
|
|
654
|
-
const unwrap = (v) => sparkGraph.
|
|
654
|
+
const unwrap = (v) => (sparkGraph.isTyped(v) ? sparkGraph.unwrapValue(v) : v);
|
|
655
655
|
const coerceIfNeeded = async (fromType, toTypes, value) => {
|
|
656
656
|
if (!toTypes)
|
|
657
657
|
return value;
|
|
@@ -2188,10 +2188,10 @@ function formatDataUrlAsLabel(dataUrl) {
|
|
|
2188
2188
|
}
|
|
2189
2189
|
}
|
|
2190
2190
|
function resolveOutputDisplay(raw, declared) {
|
|
2191
|
-
if (sparkGraph.
|
|
2191
|
+
if (sparkGraph.isTyped(raw)) {
|
|
2192
2192
|
return {
|
|
2193
|
-
typeId: sparkGraph.
|
|
2194
|
-
value: sparkGraph.
|
|
2193
|
+
typeId: sparkGraph.unwrapTypeId(raw),
|
|
2194
|
+
value: sparkGraph.unwrapValue(raw),
|
|
2195
2195
|
};
|
|
2196
2196
|
}
|
|
2197
2197
|
let typeId = undefined;
|
|
@@ -2217,7 +2217,7 @@ function prettyHandle(id) {
|
|
|
2217
2217
|
try {
|
|
2218
2218
|
const parts = String(id).split(":");
|
|
2219
2219
|
// If there are exactly 3 colons (4 parts), display only the second part
|
|
2220
|
-
if (parts.length
|
|
2220
|
+
if (parts.length >= 3)
|
|
2221
2221
|
return parts[1] || id;
|
|
2222
2222
|
return id;
|
|
2223
2223
|
}
|
|
@@ -2230,8 +2230,8 @@ function preformatValueForDisplay(typeId, value, registry) {
|
|
|
2230
2230
|
if (value === undefined || value === null)
|
|
2231
2231
|
return "";
|
|
2232
2232
|
// Unwrap typed outputs
|
|
2233
|
-
if (sparkGraph.
|
|
2234
|
-
return preformatValueForDisplay(sparkGraph.
|
|
2233
|
+
if (sparkGraph.isTyped(value)) {
|
|
2234
|
+
return preformatValueForDisplay(sparkGraph.unwrapTypeId(value), sparkGraph.unwrapValue(value), registry);
|
|
2235
2235
|
}
|
|
2236
2236
|
// Enums
|
|
2237
2237
|
if (typeId && typeId.startsWith("enum:") && registry) {
|
|
@@ -2263,8 +2263,8 @@ function summarizeDeep(value) {
|
|
|
2263
2263
|
return value.length > 512 ? value.slice(0, 512) + "…" : value;
|
|
2264
2264
|
}
|
|
2265
2265
|
// Typed output wrapper
|
|
2266
|
-
if (sparkGraph.
|
|
2267
|
-
return summarizeDeep(sparkGraph.
|
|
2266
|
+
if (sparkGraph.isTyped(value)) {
|
|
2267
|
+
return summarizeDeep(sparkGraph.unwrapValue(value));
|
|
2268
2268
|
}
|
|
2269
2269
|
// Arrays
|
|
2270
2270
|
if (Array.isArray(value)) {
|
|
@@ -6921,8 +6921,8 @@ function WorkbenchStudioCanvas({ autoScroll, onAutoScrollChange, example, onExam
|
|
|
6921
6921
|
if (value === undefined || value === null)
|
|
6922
6922
|
return "";
|
|
6923
6923
|
// Normalize typed wrapper
|
|
6924
|
-
if (sparkGraph.
|
|
6925
|
-
return baseToString(sparkGraph.
|
|
6924
|
+
if (sparkGraph.isTyped(value)) {
|
|
6925
|
+
return baseToString(sparkGraph.unwrapTypeId(value), sparkGraph.unwrapValue(value));
|
|
6926
6926
|
}
|
|
6927
6927
|
const pre = preformatValueForDisplay(typeId, value, wb.registry);
|
|
6928
6928
|
if (pre !== undefined)
|