sim 2.2.3 → 2.2.4-preview.186.1
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/index.js +14 -14
- package/dist/runtime.js +14 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8107,6 +8107,12 @@ function resolveProfile(overrides = {}) {
|
|
|
8107
8107
|
}
|
|
8108
8108
|
};
|
|
8109
8109
|
}
|
|
8110
|
+
// ../utils/src/string.ts
|
|
8111
|
+
function truncate(str, sliceLength, suffix = "...") {
|
|
8112
|
+
return str.length > sliceLength ? str.slice(0, sliceLength) + suffix : str;
|
|
8113
|
+
}
|
|
8114
|
+
var MARKDOWN_ESCAPABLE = new Set("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
|
|
8115
|
+
|
|
8110
8116
|
// src/output/io.ts
|
|
8111
8117
|
import { format } from "node:util";
|
|
8112
8118
|
function printLine(...args) {
|
|
@@ -8410,7 +8416,7 @@ function toNonJsonError(url, status, contentType, raw) {
|
|
|
8410
8416
|
const kind = isMarkup ? "HTML" : type && type !== "application/json" ? type : "a non-JSON response";
|
|
8411
8417
|
const text = raw.trim();
|
|
8412
8418
|
const keepSnippet = !isMarkup && text.length > 0 && text.length <= 200;
|
|
8413
|
-
return new SimApiError(`${url} returned ${kind}, not JSON (HTTP ${status}) — check your endpoint.${keepSnippet ? ` Response: ${truncate(text, 200)}` : ""}`, status);
|
|
8419
|
+
return new SimApiError(`${url} returned ${kind}, not JSON (HTTP ${status}) — check your endpoint.${keepSnippet ? ` Response: ${truncate(text, 200, "…")}` : ""}`, status);
|
|
8414
8420
|
}
|
|
8415
8421
|
function toApiError(url, status, contentType, raw) {
|
|
8416
8422
|
let parsed;
|
|
@@ -8432,9 +8438,6 @@ function toApiError(url, status, contentType, raw) {
|
|
|
8432
8438
|
return new SimApiError(body.message, status);
|
|
8433
8439
|
return new SimApiError(`Request failed with status ${status}`, status);
|
|
8434
8440
|
}
|
|
8435
|
-
function truncate(value, max) {
|
|
8436
|
-
return value.length <= max ? value : `${value.slice(0, max)}…`;
|
|
8437
|
-
}
|
|
8438
8441
|
function transportErrorMessage(error) {
|
|
8439
8442
|
const messages = [];
|
|
8440
8443
|
const seen = new Set;
|
|
@@ -8442,7 +8445,7 @@ function transportErrorMessage(error) {
|
|
|
8442
8445
|
while (current && typeof current === "object" && messages.length < 4 && !seen.has(current)) {
|
|
8443
8446
|
seen.add(current);
|
|
8444
8447
|
const candidate = current;
|
|
8445
|
-
const message = typeof candidate.message === "string" ? truncate(candidate.message.replace(/\s+/g, " ").trim(), 300) : "";
|
|
8448
|
+
const message = typeof candidate.message === "string" ? truncate(candidate.message.replace(/\s+/g, " ").trim(), 300, "…") : "";
|
|
8446
8449
|
const code = typeof candidate.code === "string" ? candidate.code : "";
|
|
8447
8450
|
const detail = `${message}${code && !message.includes(code) ? ` (${code})` : ""}`;
|
|
8448
8451
|
if (detail && messages.at(-1) !== detail)
|
|
@@ -8564,7 +8567,7 @@ function formatApiErrorDetails(details) {
|
|
|
8564
8567
|
};
|
|
8565
8568
|
visit(details);
|
|
8566
8569
|
if (issues.length === 0)
|
|
8567
|
-
return [` details: ${truncate(JSON.stringify(details), 1000)}`];
|
|
8570
|
+
return [` details: ${truncate(JSON.stringify(details), 1000, "…")}`];
|
|
8568
8571
|
const kept = dropUnionBranchNoise(issues);
|
|
8569
8572
|
const visible = kept.slice(0, 8);
|
|
8570
8573
|
const lines = [
|
|
@@ -22551,19 +22554,16 @@ var SELECT_OUTPUT_FLAG = "select-output";
|
|
|
22551
22554
|
function normalizeBlockName(name) {
|
|
22552
22555
|
return name.toLowerCase().replace(/\s+/g, "").replace(/\./g, "");
|
|
22553
22556
|
}
|
|
22554
|
-
function isRecord(value) {
|
|
22555
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22556
|
-
}
|
|
22557
22557
|
async function loadWorkflowBlocks(client, workflowId) {
|
|
22558
22558
|
const operation = V2_OPERATIONS.getWorkflowState;
|
|
22559
22559
|
const raw = await client.request(resolvePath(operation.path, { workflowId }), {
|
|
22560
22560
|
method: operation.method
|
|
22561
22561
|
});
|
|
22562
|
-
const state =
|
|
22563
|
-
const blocks =
|
|
22562
|
+
const state = isRecordLike(raw) && isRecordLike(raw.data) ? raw.data : raw;
|
|
22563
|
+
const blocks = isRecordLike(state) && isRecordLike(state.blocks) ? Object.entries(state.blocks) : [];
|
|
22564
22564
|
return blocks.map(([key, block]) => ({
|
|
22565
|
-
id:
|
|
22566
|
-
name:
|
|
22565
|
+
id: isRecordLike(block) && typeof block.id === "string" ? block.id : key,
|
|
22566
|
+
name: isRecordLike(block) && typeof block.name === "string" ? block.name : ""
|
|
22567
22567
|
}));
|
|
22568
22568
|
}
|
|
22569
22569
|
function splitSelector(selector) {
|
|
@@ -22604,7 +22604,7 @@ function resolveSelection(typed, blocks, workflowId) {
|
|
|
22604
22604
|
return { resolved, typedBy };
|
|
22605
22605
|
}
|
|
22606
22606
|
function keyByTyped(payload, typedBy) {
|
|
22607
|
-
if (!
|
|
22607
|
+
if (!isRecordLike(payload) || !isRecordLike(payload.blockOutputs))
|
|
22608
22608
|
return payload;
|
|
22609
22609
|
const blockOutputs = {};
|
|
22610
22610
|
for (const [key, value] of Object.entries(payload.blockOutputs)) {
|
package/dist/runtime.js
CHANGED
|
@@ -4006,6 +4006,12 @@ class EmbeddedOutput {
|
|
|
4006
4006
|
}
|
|
4007
4007
|
}
|
|
4008
4008
|
|
|
4009
|
+
// ../utils/src/string.ts
|
|
4010
|
+
function truncate(str, sliceLength, suffix = "...") {
|
|
4011
|
+
return str.length > sliceLength ? str.slice(0, sliceLength) + suffix : str;
|
|
4012
|
+
}
|
|
4013
|
+
var MARKDOWN_ESCAPABLE = new Set("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");
|
|
4014
|
+
|
|
4009
4015
|
// src/output/io.ts
|
|
4010
4016
|
import { format } from "node:util";
|
|
4011
4017
|
function printLine(...args) {
|
|
@@ -4936,7 +4942,7 @@ function toNonJsonError(url, status, contentType, raw) {
|
|
|
4936
4942
|
const kind = isMarkup ? "HTML" : type && type !== "application/json" ? type : "a non-JSON response";
|
|
4937
4943
|
const text = raw.trim();
|
|
4938
4944
|
const keepSnippet = !isMarkup && text.length > 0 && text.length <= 200;
|
|
4939
|
-
return new SimApiError(`${url} returned ${kind}, not JSON (HTTP ${status}) — check your endpoint.${keepSnippet ? ` Response: ${truncate(text, 200)}` : ""}`, status);
|
|
4945
|
+
return new SimApiError(`${url} returned ${kind}, not JSON (HTTP ${status}) — check your endpoint.${keepSnippet ? ` Response: ${truncate(text, 200, "…")}` : ""}`, status);
|
|
4940
4946
|
}
|
|
4941
4947
|
function toApiError(url, status, contentType, raw) {
|
|
4942
4948
|
let parsed;
|
|
@@ -4958,9 +4964,6 @@ function toApiError(url, status, contentType, raw) {
|
|
|
4958
4964
|
return new SimApiError(body.message, status);
|
|
4959
4965
|
return new SimApiError(`Request failed with status ${status}`, status);
|
|
4960
4966
|
}
|
|
4961
|
-
function truncate(value, max) {
|
|
4962
|
-
return value.length <= max ? value : `${value.slice(0, max)}…`;
|
|
4963
|
-
}
|
|
4964
4967
|
function transportErrorMessage(error) {
|
|
4965
4968
|
const messages = [];
|
|
4966
4969
|
const seen = new Set;
|
|
@@ -4968,7 +4971,7 @@ function transportErrorMessage(error) {
|
|
|
4968
4971
|
while (current && typeof current === "object" && messages.length < 4 && !seen.has(current)) {
|
|
4969
4972
|
seen.add(current);
|
|
4970
4973
|
const candidate = current;
|
|
4971
|
-
const message = typeof candidate.message === "string" ? truncate(candidate.message.replace(/\s+/g, " ").trim(), 300) : "";
|
|
4974
|
+
const message = typeof candidate.message === "string" ? truncate(candidate.message.replace(/\s+/g, " ").trim(), 300, "…") : "";
|
|
4972
4975
|
const code = typeof candidate.code === "string" ? candidate.code : "";
|
|
4973
4976
|
const detail = `${message}${code && !message.includes(code) ? ` (${code})` : ""}`;
|
|
4974
4977
|
if (detail && messages.at(-1) !== detail)
|
|
@@ -5090,7 +5093,7 @@ function formatApiErrorDetails(details) {
|
|
|
5090
5093
|
};
|
|
5091
5094
|
visit(details);
|
|
5092
5095
|
if (issues.length === 0)
|
|
5093
|
-
return [` details: ${truncate(JSON.stringify(details), 1000)}`];
|
|
5096
|
+
return [` details: ${truncate(JSON.stringify(details), 1000, "…")}`];
|
|
5094
5097
|
const kept = dropUnionBranchNoise(issues);
|
|
5095
5098
|
const visible = kept.slice(0, 8);
|
|
5096
5099
|
const lines = [
|
|
@@ -22600,19 +22603,16 @@ var SELECT_OUTPUT_FLAG = "select-output";
|
|
|
22600
22603
|
function normalizeBlockName(name) {
|
|
22601
22604
|
return name.toLowerCase().replace(/\s+/g, "").replace(/\./g, "");
|
|
22602
22605
|
}
|
|
22603
|
-
function isRecord(value) {
|
|
22604
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22605
|
-
}
|
|
22606
22606
|
async function loadWorkflowBlocks(client, workflowId) {
|
|
22607
22607
|
const operation = V2_OPERATIONS.getWorkflowState;
|
|
22608
22608
|
const raw = await client.request(resolvePath(operation.path, { workflowId }), {
|
|
22609
22609
|
method: operation.method
|
|
22610
22610
|
});
|
|
22611
|
-
const state =
|
|
22612
|
-
const blocks =
|
|
22611
|
+
const state = isRecordLike(raw) && isRecordLike(raw.data) ? raw.data : raw;
|
|
22612
|
+
const blocks = isRecordLike(state) && isRecordLike(state.blocks) ? Object.entries(state.blocks) : [];
|
|
22613
22613
|
return blocks.map(([key, block]) => ({
|
|
22614
|
-
id:
|
|
22615
|
-
name:
|
|
22614
|
+
id: isRecordLike(block) && typeof block.id === "string" ? block.id : key,
|
|
22615
|
+
name: isRecordLike(block) && typeof block.name === "string" ? block.name : ""
|
|
22616
22616
|
}));
|
|
22617
22617
|
}
|
|
22618
22618
|
function splitSelector(selector) {
|
|
@@ -22653,7 +22653,7 @@ function resolveSelection(typed, blocks, workflowId) {
|
|
|
22653
22653
|
return { resolved, typedBy };
|
|
22654
22654
|
}
|
|
22655
22655
|
function keyByTyped(payload, typedBy) {
|
|
22656
|
-
if (!
|
|
22656
|
+
if (!isRecordLike(payload) || !isRecordLike(payload.blockOutputs))
|
|
22657
22657
|
return payload;
|
|
22658
22658
|
const blockOutputs = {};
|
|
22659
22659
|
for (const [key, value] of Object.entries(payload.blockOutputs)) {
|