@fluidgrids/workflows 2026.1028.2 → 2026.1030.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.
Files changed (154) hide show
  1. package/README.md +181 -11
  2. package/dist/{activation-BBh1p82z.d.cts → activation-DqUfpHzk.d.cts} +1 -1
  3. package/dist/{activation-DnhG7SmF.d.ts → activation-xpx1oWuo.d.ts} +1 -1
  4. package/dist/{chunk-VRHHBPT6.js → chunk-2D3MYIIF.js} +1212 -128
  5. package/dist/chunk-3U2NU7YC.cjs +124 -0
  6. package/dist/{chunk-NEIUQASE.cjs → chunk-4QKB4ARC.cjs} +3 -3
  7. package/dist/{chunk-GBQ33SIZ.cjs → chunk-54FLQNUM.cjs} +12 -1
  8. package/dist/chunk-5HIVIV53.js +330 -0
  9. package/dist/chunk-5MFVJM76.js +1222 -0
  10. package/dist/{chunk-JD2VQIDZ.cjs → chunk-672KMMBK.cjs} +2 -2
  11. package/dist/{chunk-C5OLWZ42.js → chunk-6A2FGSUS.js} +22 -14
  12. package/dist/{chunk-XKJA7KX3.js → chunk-6OLN6BMB.js} +52 -3
  13. package/dist/{chunk-6FSHT5IL.js → chunk-7EZIANC7.js} +1 -1
  14. package/dist/{chunk-2J6TF7YI.cjs → chunk-A5SXCA62.cjs} +10 -3
  15. package/dist/{chunk-BO6OVILK.js → chunk-AC6ZEXVR.js} +10 -4
  16. package/dist/{chunk-ABFZWYHT.js → chunk-AE5Q6ZAJ.js} +315 -50
  17. package/dist/chunk-C4F5KJTI.js +293 -0
  18. package/dist/{chunk-IISBRUWJ.js → chunk-G5H32GIG.js} +1 -1
  19. package/dist/chunk-GEQDGUGB.cjs +2719 -0
  20. package/dist/{chunk-XHXIDVEC.js → chunk-HCM7ZC7Q.js} +1 -1
  21. package/dist/chunk-HMZUGSMU.cjs +1554 -0
  22. package/dist/{chunk-SAOBPYYJ.cjs → chunk-IQPXHQQQ.cjs} +8 -4
  23. package/dist/{chunk-P6TA5EZT.cjs → chunk-ISOIA7NV.cjs} +335 -58
  24. package/dist/chunk-JSC75O5C.cjs +167 -0
  25. package/dist/chunk-M272AHEX.js +25 -0
  26. package/dist/{chunk-BD7ZPG53.js → chunk-NWQ5WRLE.js} +10 -2
  27. package/dist/chunk-ODZ2IAR2.cjs +1247 -0
  28. package/dist/chunk-Q4MWQNJK.cjs +28 -0
  29. package/dist/{chunk-HWJZVOG7.js → chunk-SR7TR5KX.js} +6 -2
  30. package/dist/{chunk-FEW3JBYA.cjs → chunk-TCTE7DX5.cjs} +3 -3
  31. package/dist/{chunk-623FVQSN.cjs → chunk-TYF56RGB.cjs} +123 -0
  32. package/dist/chunk-VA4OFR72.cjs +324 -0
  33. package/dist/chunk-VU5S5A7V.js +150 -0
  34. package/dist/chunk-YEHR4NNE.js +1522 -0
  35. package/dist/{chunk-FMSW2HDF.cjs → chunk-ZCGKGDCL.cjs} +23 -15
  36. package/dist/codegen/index.d.cts +2 -2
  37. package/dist/codegen/index.d.ts +2 -2
  38. package/dist/collect-6NIEufHd.d.ts +103 -0
  39. package/dist/collect-CcTCKqx6.d.cts +103 -0
  40. package/dist/{file-BOoHZgoQ.d.cts → file-BxYpwjRQ.d.cts} +1007 -21
  41. package/dist/{file-yuPCFU5b.d.ts → file-CFdPQJI9.d.ts} +1007 -21
  42. package/dist/history/index.cjs +375 -86
  43. package/dist/history/index.d.cts +590 -12
  44. package/dist/history/index.d.ts +590 -12
  45. package/dist/history/index.js +50 -4
  46. package/dist/index.cjs +156 -50
  47. package/dist/index.d.cts +38 -58
  48. package/dist/index.d.ts +38 -58
  49. package/dist/index.js +6 -4
  50. package/dist/interceptors-CNcr2dlk.d.ts +159 -0
  51. package/dist/interceptors-CqkNZVfI.d.cts +159 -0
  52. package/dist/ir/index.cjs +362 -38
  53. package/dist/ir/index.d.cts +282 -7
  54. package/dist/ir/index.d.ts +282 -7
  55. package/dist/ir/index.js +329 -23
  56. package/dist/{lower-BzmUz0sq.d.cts → lower-BtRfIW2A.d.cts} +56 -8
  57. package/dist/{lower-_-iT4HYs.d.ts → lower-CpsMFOFX.d.ts} +56 -8
  58. package/dist/{manifest-C8N6HDYl.d.ts → manifest-D-I_twys.d.ts} +1 -1
  59. package/dist/{manifest-0OLw0i7k.d.cts → manifest-DahBQVM8.d.cts} +1 -1
  60. package/dist/node-evaluator-DGQDPSPI.cjs +24 -0
  61. package/dist/node-evaluator-LEEVD7H7.js +14 -0
  62. package/dist/payload-fields-BVRQn2yH.d.cts +122 -0
  63. package/dist/payload-fields-oOBWxDiG.d.ts +122 -0
  64. package/dist/quickjs/index.cjs +28 -27
  65. package/dist/quickjs/index.d.cts +6 -6
  66. package/dist/quickjs/index.d.ts +6 -6
  67. package/dist/quickjs/index.js +10 -9
  68. package/dist/roundtrip/index.cjs +259 -51
  69. package/dist/roundtrip/index.d.cts +100 -9
  70. package/dist/roundtrip/index.d.ts +100 -9
  71. package/dist/roundtrip/index.js +177 -11
  72. package/dist/runtime/index.cjs +21 -20
  73. package/dist/runtime/index.d.cts +184 -15
  74. package/dist/runtime/index.d.ts +184 -15
  75. package/dist/runtime/index.js +8 -7
  76. package/dist/testing/index.cjs +1122 -115
  77. package/dist/testing/index.d.cts +294 -13
  78. package/dist/testing/index.d.ts +294 -13
  79. package/dist/testing/index.js +1086 -84
  80. package/dist/{types-DV-HX_Gt.d.ts → types-Bv2i4cBX.d.cts} +244 -33
  81. package/dist/{types-CpBBjaGX.d.cts → types-DGx-b9eq.d.ts} +244 -33
  82. package/dist/{types-BGoPzgcl.d.ts → types-V7jEEUaL.d.cts} +20 -1
  83. package/dist/{types-BGoPzgcl.d.cts → types-V7jEEUaL.d.ts} +20 -1
  84. package/dist/{workflow-Bpr3vnA_.d.ts → workflow-B18OeF7g.d.ts} +2 -2
  85. package/dist/workflow-BGnv8SS6.d.ts +803 -0
  86. package/dist/{workflow-FXUkpIBc.d.cts → workflow-BJPFv3cp.d.cts} +2 -2
  87. package/dist/workflow-DS32Gtws.d.cts +803 -0
  88. package/fixtures/histories/activity-options-updated.history.json +159 -0
  89. package/fixtures/histories/activity-paused-unpaused.history.json +160 -0
  90. package/fixtures/histories/auto-upgrade-patched.history.json +276 -0
  91. package/fixtures/histories/benign-failure.history.json +146 -0
  92. package/fixtures/histories/cancel-activity-try-cancel.history.json +150 -0
  93. package/fixtures/histories/child-cancel-wait-requested.history.json +217 -0
  94. package/fixtures/histories/child-options-roundtrip.history.json +192 -0
  95. package/fixtures/histories/codec-opaque.history.json +229 -0
  96. package/fixtures/histories/continue-as-new-last-result.history.json +86 -0
  97. package/fixtures/histories/continue-as-new-options.history.json +99 -0
  98. package/fixtures/histories/continue-as-new-r1-long-task-queue.history.json +78 -0
  99. package/fixtures/histories/continue-as-new-r1-retry-options.history.json +83 -0
  100. package/fixtures/histories/dynamic-workflow.history.json +150 -0
  101. package/fixtures/histories/execution-timeout-chain.history.json +98 -0
  102. package/fixtures/histories/external-cancel-resolved.history.json +123 -0
  103. package/fixtures/histories/external-cancel-unknown-target.history.json +127 -0
  104. package/fixtures/histories/failure-error-types-fails-run.history.json +144 -0
  105. package/fixtures/histories/handler-drain-warn.history.json +222 -0
  106. package/fixtures/histories/heartbeat-details-on-retry.history.json +145 -0
  107. package/fixtures/histories/interceptor-headers.history.json +339 -0
  108. package/fixtures/histories/local-activity-abandoned-at-completion.history.json +73 -0
  109. package/fixtures/histories/local-activity-cancelled-in-scope.history.json +118 -0
  110. package/fixtures/histories/local-activity-completed.history.json +157 -0
  111. package/fixtures/histories/local-activity-failed.history.json +93 -0
  112. package/fixtures/histories/local-activity-retry-in-task.history.json +88 -0
  113. package/fixtures/histories/query-custom.history.json +213 -0
  114. package/fixtures/histories/query-default-handler.history.json +120 -0
  115. package/fixtures/histories/reset-forked-reapplied-signals.history.json +239 -0
  116. package/fixtures/histories/reset-reapplied-update-admitted.history.json +228 -0
  117. package/fixtures/histories/run-retry-last-failure.history.json +90 -0
  118. package/fixtures/histories/run-timeout.history.json +159 -0
  119. package/fixtures/histories/schedule-to-start-timeout.history.json +132 -0
  120. package/fixtures/histories/search-attributes-upserted.history.json +177 -0
  121. package/fixtures/histories/start-delay-signal-ends-delay.history.json +155 -0
  122. package/fixtures/histories/typeerror-task-retry-100.history.json +137 -0
  123. package/fixtures/histories/update-accepted-completed.history.json +45 -30
  124. package/fixtures/histories/update-default-handler.history.json +246 -0
  125. package/fixtures/histories/update-handler-awaits-activity.history.json +196 -0
  126. package/fixtures/histories/update-not-handled.history.json +138 -0
  127. package/fixtures/histories/update-rejected-no-event.history.json +190 -0
  128. package/fixtures/histories/update-with-start-admitted.history.json +150 -0
  129. package/fixtures/histories/user-activity-cancel.history.json +149 -0
  130. package/fixtures/histories/user-activity-retry.history.json +143 -0
  131. package/fixtures/histories/user-activity.history.json +149 -0
  132. package/package.json +1 -1
  133. package/schema/bridge-v2.schema.json +1062 -0
  134. package/schema/history-file.schema.json +538 -83
  135. package/schema/ir-v2.schema.json +290 -0
  136. package/schema/payload-fields.json +162 -0
  137. package/schema/run-event.schema.json +503 -82
  138. package/schema/workflow-command.schema.json +372 -69
  139. package/schema/workflow-task.schema.json +924 -171
  140. package/dist/assemble-BLqQ8lSu.d.cts +0 -39
  141. package/dist/assemble-DWgaXHd-.d.ts +0 -39
  142. package/dist/chunk-DHTLALBL.cjs +0 -80
  143. package/dist/chunk-DJYMDLV5.js +0 -227
  144. package/dist/chunk-I5LR3D2K.js +0 -869
  145. package/dist/chunk-M4BBAERY.cjs +0 -1635
  146. package/dist/chunk-N23SKIG4.js +0 -73
  147. package/dist/chunk-PZCVF76Q.cjs +0 -868
  148. package/dist/chunk-QQ6ULXHI.cjs +0 -885
  149. package/dist/chunk-UK3WM7YZ.cjs +0 -75
  150. package/dist/chunk-VOKMAAJP.js +0 -848
  151. package/dist/node-evaluator-4MSDKWOG.cjs +0 -22
  152. package/dist/node-evaluator-SX4LEYQC.js +0 -12
  153. package/dist/workflow-C2a05WUJ.d.ts +0 -444
  154. package/dist/workflow-J-yYixny.d.cts +0 -444
@@ -1,20 +1,23 @@
1
1
  'use strict';
2
2
 
3
- var chunkFEW3JBYA_cjs = require('../chunk-FEW3JBYA.cjs');
4
- var chunkNEIUQASE_cjs = require('../chunk-NEIUQASE.cjs');
3
+ var chunkTCTE7DX5_cjs = require('../chunk-TCTE7DX5.cjs');
4
+ var chunk4QKB4ARC_cjs = require('../chunk-4QKB4ARC.cjs');
5
5
  var chunkSX2PNKKT_cjs = require('../chunk-SX2PNKKT.cjs');
6
6
  var chunkCPDK3K5N_cjs = require('../chunk-CPDK3K5N.cjs');
7
- var chunkQQ6ULXHI_cjs = require('../chunk-QQ6ULXHI.cjs');
8
- require('../chunk-UK3WM7YZ.cjs');
9
- var chunkSAOBPYYJ_cjs = require('../chunk-SAOBPYYJ.cjs');
10
- var chunkGBQ33SIZ_cjs = require('../chunk-GBQ33SIZ.cjs');
7
+ var chunkODZ2IAR2_cjs = require('../chunk-ODZ2IAR2.cjs');
8
+ require('../chunk-3U2NU7YC.cjs');
9
+ var chunkIQPXHQQQ_cjs = require('../chunk-IQPXHQQQ.cjs');
10
+ var chunk54FLQNUM_cjs = require('../chunk-54FLQNUM.cjs');
11
11
  require('../chunk-G4UEPUGO.cjs');
12
12
  var chunkGVTZMA5C_cjs = require('../chunk-GVTZMA5C.cjs');
13
13
  var chunkQKZL3ONM_cjs = require('../chunk-QKZL3ONM.cjs');
14
14
  var chunkTBDXTV22_cjs = require('../chunk-TBDXTV22.cjs');
15
15
  var chunkSAENRNBJ_cjs = require('../chunk-SAENRNBJ.cjs');
16
- require('../chunk-DHTLALBL.cjs');
17
- require('../chunk-2J6TF7YI.cjs');
16
+ var chunkQ4MWQNJK_cjs = require('../chunk-Q4MWQNJK.cjs');
17
+ require('../chunk-VA4OFR72.cjs');
18
+ require('../chunk-FR7KYWRO.cjs');
19
+ require('../chunk-A5SXCA62.cjs');
20
+ require('../chunk-TYF56RGB.cjs');
18
21
  require('../chunk-Z2Y65YOY.cjs');
19
22
  var fs = require('fs');
20
23
  var path = require('path');
@@ -61,7 +64,9 @@ var HELPER_METHODS = {
61
64
  "internal:noop": "noop"
62
65
  };
63
66
  var INTERNAL_DESCRIPTOR_NAMES = {
64
- "internal:code-workflow": "codeWorkflow"
67
+ "internal:code-workflow": "codeWorkflow",
68
+ "internal:signal-run": "signalRun",
69
+ "internal:set-search-attributes": "setSearchAttributes"
65
70
  };
66
71
  var TRIGGER_NAMES = {
67
72
  "internal:api": "api",
@@ -253,7 +258,7 @@ function richEdge(edge2, info, items) {
253
258
  const options2 = [];
254
259
  const extra = [];
255
260
  if (edge2["id"] === void 0) options2.push(["id", { k: "literal", value: false }]);
256
- else if (edge2["id"] !== chunkSAOBPYYJ_cjs.defaultEdgeId(source, target, sourceHandle, targetHandle))
261
+ else if (edge2["id"] !== chunkIQPXHQQQ_cjs.defaultEdgeId(source, target, sourceHandle, targetHandle))
257
262
  options2.push(["id", literalOrStructure(edge2["id"])]);
258
263
  if (edge2["type"] === void 0) options2.push(["type", { k: "literal", value: false }]);
259
264
  else if (edge2["type"] !== "deletable") options2.push(["type", literalOrStructure(edge2["type"])]);
@@ -754,19 +759,19 @@ function connectionsByName(connectionNames, definition) {
754
759
  function descriptor(operation) {
755
760
  switch (operation.kind) {
756
761
  case "trigger": {
757
- const value2 = chunkSAOBPYYJ_cjs.triggers[operation.name];
762
+ const value2 = chunkIQPXHQQQ_cjs.triggers[operation.name];
758
763
  if (!value2) throw new LiftError(`Unknown trigger ${operation.name}`);
759
764
  return value2;
760
765
  }
761
766
  case "internal": {
762
- const value2 = chunkSAOBPYYJ_cjs.internalNodes[operation.name];
767
+ const value2 = chunkIQPXHQQQ_cjs.internalNodes[operation.name];
763
768
  if (!value2) throw new LiftError(`Unknown internal node ${operation.name}`);
764
769
  return value2;
765
770
  }
766
771
  case "client":
767
- return operation.role === "trigger" ? chunkSAOBPYYJ_cjs.trigger(operation.nodeType, operation.version, operation.operation) : chunkSAOBPYYJ_cjs.op(operation.nodeType, operation.version, operation.operation);
772
+ return operation.role === "trigger" ? chunkIQPXHQQQ_cjs.trigger(operation.nodeType, operation.version, operation.operation) : chunkIQPXHQQQ_cjs.op(operation.nodeType, operation.version, operation.operation);
768
773
  case "custom":
769
- return chunkSAOBPYYJ_cjs.nodes.custom(operation.nodeType, operation.operation, operation.version);
774
+ return chunkIQPXHQQQ_cjs.nodes.custom(operation.nodeType, operation.operation, operation.version);
770
775
  }
771
776
  }
772
777
  function refValue(ref, wf, runtime) {
@@ -824,7 +829,7 @@ function value(expression2, wf, runtime) {
824
829
  return (declared ?? wf.ref(expression2.nodeId)).handle(expression2.handle);
825
830
  }
826
831
  case "edge":
827
- return chunkSAOBPYYJ_cjs.edge(
832
+ return chunkIQPXHQQQ_cjs.edge(
828
833
  value(expression2.from, wf, runtime),
829
834
  value({ k: "object", entries: expression2.options }, wf, runtime)
830
835
  );
@@ -852,7 +857,7 @@ function interpretPlan(plan) {
852
857
  k: "object",
853
858
  entries: plan.workflowOptions
854
859
  });
855
- const workflow = chunkSAOBPYYJ_cjs.defineWorkflow(workflowOptions2, (wf) => {
860
+ const workflow = chunkIQPXHQQQ_cjs.defineWorkflow(workflowOptions2, (wf) => {
856
861
  const runtime = /* @__PURE__ */ new Map();
857
862
  for (const statement of plan.statements) {
858
863
  if (statement.kind === "node") {
@@ -1130,8 +1135,8 @@ function layoutOf(reference) {
1130
1135
  if (typeof x === "number" && typeof y === "number") chunkSAENRNBJ_cjs.setOwn(positions, node["id"], { x, y });
1131
1136
  }
1132
1137
  const sidecar = {
1133
- format: chunkSAOBPYYJ_cjs.LAYOUT_FORMAT,
1134
- formatVersion: chunkSAOBPYYJ_cjs.LAYOUT_FORMAT_VERSION,
1138
+ format: chunkIQPXHQQQ_cjs.LAYOUT_FORMAT,
1139
+ formatVersion: chunkIQPXHQQQ_cjs.LAYOUT_FORMAT_VERSION,
1135
1140
  positions
1136
1141
  };
1137
1142
  if (Array.isArray(data["stickyNotes"])) sidecar.stickyNotes = data["stickyNotes"];
@@ -1198,7 +1203,7 @@ function rejectedByBuilder(reference, run) {
1198
1203
  return { nodes: nodes2, edges };
1199
1204
  }
1200
1205
  function prepareLift(definition, options2 = {}) {
1201
- const normalized = chunkGBQ33SIZ_cjs.normalizeDefinition(definition);
1206
+ const normalized = chunk54FLQNUM_cjs.normalizeDefinition(definition);
1202
1207
  if (!chunkSAENRNBJ_cjs.isRecord(normalized) || !chunkSAENRNBJ_cjs.isRecord(normalized["data"]))
1203
1208
  throw new TypeError("A workflow definition must be an object with data");
1204
1209
  const reference = { ...normalized };
@@ -1229,12 +1234,12 @@ function prepareLift(definition, options2 = {}) {
1229
1234
  const run = (rawNodes, rawEdges) => {
1230
1235
  const build = buildPlan(reference, options2, rawNodes, rawEdges);
1231
1236
  const recording = interpretPlan(build.plan);
1232
- const candidate = chunkSAOBPYYJ_cjs.assembleRecording(recording, {
1237
+ const candidate = chunkIQPXHQQQ_cjs.assembleRecording(recording, {
1233
1238
  layout,
1234
1239
  ...connections ? { connections } : {},
1235
1240
  ...pinned ? { pinnedData: pinned } : {}
1236
1241
  });
1237
- return { build, candidate: chunkGBQ33SIZ_cjs.normalizeDefinition(candidate) };
1242
+ return { build, candidate: chunk54FLQNUM_cjs.normalizeDefinition(candidate) };
1238
1243
  };
1239
1244
  let rejected = { nodes: /* @__PURE__ */ new Set(), edges: /* @__PURE__ */ new Set() };
1240
1245
  let attempt = tryRun(() => run(rejected.nodes, rejected.edges));
@@ -1357,12 +1362,12 @@ function readJson(path) {
1357
1362
  try {
1358
1363
  parsed = JSON.parse(fs.readFileSync(path, "utf8"));
1359
1364
  } catch (error) {
1360
- throw new chunkQQ6ULXHI_cjs.LowerError(
1365
+ throw new chunkODZ2IAR2_cjs.LowerError(
1361
1366
  `Cannot read ${path}: ${error instanceof Error ? error.message : String(error)}`
1362
1367
  );
1363
1368
  }
1364
1369
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
1365
- throw new chunkQQ6ULXHI_cjs.LowerError(`${path} is not a JSON object`);
1370
+ throw new chunkODZ2IAR2_cjs.LowerError(`${path} is not a JSON object`);
1366
1371
  return parsed;
1367
1372
  }
1368
1373
  function namesOf(value2) {
@@ -1395,7 +1400,7 @@ function collectFiles(packageDir, dir, files, budget) {
1395
1400
  if (!KEPT_EXTENSIONS.some((ext) => entry.endsWith(ext))) continue;
1396
1401
  budget.left -= stats.size;
1397
1402
  if (budget.left < 0)
1398
- throw new chunkQQ6ULXHI_cjs.LowerError(
1403
+ throw new chunkODZ2IAR2_cjs.LowerError(
1399
1404
  `The vendored packages are larger than the limit (reached at "${budget.name}")`,
1400
1405
  "too-large"
1401
1406
  );
@@ -1415,7 +1420,7 @@ function vendorDependencies(projectDir, options2 = {}) {
1415
1420
  const packageDir = locate(next.name, next.fromDir);
1416
1421
  if (packageDir === void 0) {
1417
1422
  if (next.optional) continue;
1418
- throw new chunkQQ6ULXHI_cjs.LowerError(
1423
+ throw new chunkODZ2IAR2_cjs.LowerError(
1419
1424
  `"${next.name}" is a dependency but is not installed under ${rootDir}; run your package manager's install first`
1420
1425
  );
1421
1426
  }
@@ -1446,16 +1451,17 @@ function packSources(archive) {
1446
1451
  if (archive.lock !== void 0) value2["lock"] = archive.lock;
1447
1452
  if (archive.vendored !== void 0 && Object.keys(archive.vendored).length > 0)
1448
1453
  value2["vendored"] = archive.vendored;
1454
+ if (archive.map !== void 0) value2["map"] = archive.map;
1449
1455
  const text = chunkQKZL3ONM_cjs.canonicalJson(value2);
1450
1456
  const zipped = zlib.gzipSync(Buffer.from(text, "utf8"), { level: 9 });
1451
1457
  zipped[GZIP_OS_BYTE] = 255;
1452
1458
  return new Uint8Array(zipped.buffer, zipped.byteOffset, zipped.byteLength);
1453
1459
  }
1454
1460
  function stringMap(value2, what) {
1455
- if (!chunkSAENRNBJ_cjs.isRecord(value2)) throw new chunkQQ6ULXHI_cjs.LowerError(`${what} must be an object`);
1461
+ if (!chunkSAENRNBJ_cjs.isRecord(value2)) throw new chunkODZ2IAR2_cjs.LowerError(`${what} must be an object`);
1456
1462
  const out = {};
1457
1463
  for (const [key, entry] of Object.entries(value2)) {
1458
- if (typeof entry !== "string") throw new chunkQQ6ULXHI_cjs.LowerError(`${what}["${key}"] must be a string`);
1464
+ if (typeof entry !== "string") throw new chunkODZ2IAR2_cjs.LowerError(`${what}["${key}"] must be a string`);
1459
1465
  Object.defineProperty(out, key, {
1460
1466
  value: entry,
1461
1467
  enumerable: true,
@@ -1472,7 +1478,7 @@ function unpackSources(data, options2 = {}) {
1472
1478
  text = zlib.gunzipSync(data, { maxOutputLength: maxBytes }).toString("utf8");
1473
1479
  } catch (error) {
1474
1480
  const message = error instanceof Error ? error.message : String(error);
1475
- throw new chunkQQ6ULXHI_cjs.LowerError(
1481
+ throw new chunkODZ2IAR2_cjs.LowerError(
1476
1482
  /buffer|length|range/i.test(message) ? `The source archive is larger than ${maxBytes} bytes uncompressed` : `The source archive is not gzip: ${message}`,
1477
1483
  /buffer|length|range/i.test(message) ? "too-large" : void 0
1478
1484
  );
@@ -1481,20 +1487,24 @@ function unpackSources(data, options2 = {}) {
1481
1487
  try {
1482
1488
  parsed = JSON.parse(text);
1483
1489
  } catch {
1484
- throw new chunkQQ6ULXHI_cjs.LowerError("The source archive is not JSON");
1490
+ throw new chunkODZ2IAR2_cjs.LowerError("The source archive is not JSON");
1485
1491
  }
1486
- if (!chunkSAENRNBJ_cjs.isRecord(parsed)) throw new chunkQQ6ULXHI_cjs.LowerError("The source archive is not an object");
1492
+ if (!chunkSAENRNBJ_cjs.isRecord(parsed)) throw new chunkODZ2IAR2_cjs.LowerError("The source archive is not an object");
1487
1493
  const archive = { files: stringMap(parsed["files"], "files") };
1488
1494
  if (parsed["lock"] !== void 0) {
1489
- if (typeof parsed["lock"] !== "string") throw new chunkQQ6ULXHI_cjs.LowerError("lock must be a string");
1495
+ if (typeof parsed["lock"] !== "string") throw new chunkODZ2IAR2_cjs.LowerError("lock must be a string");
1490
1496
  archive.lock = parsed["lock"];
1491
1497
  }
1498
+ if (parsed["map"] !== void 0) {
1499
+ if (typeof parsed["map"] !== "string") throw new chunkODZ2IAR2_cjs.LowerError("map must be a string");
1500
+ archive.map = parsed["map"];
1501
+ }
1492
1502
  if (parsed["vendored"] !== void 0) {
1493
- if (!chunkSAENRNBJ_cjs.isRecord(parsed["vendored"])) throw new chunkQQ6ULXHI_cjs.LowerError("vendored must be an object");
1503
+ if (!chunkSAENRNBJ_cjs.isRecord(parsed["vendored"])) throw new chunkODZ2IAR2_cjs.LowerError("vendored must be an object");
1494
1504
  const vendored = {};
1495
1505
  for (const [name, pkg] of Object.entries(parsed["vendored"])) {
1496
1506
  if (!chunkSAENRNBJ_cjs.isRecord(pkg) || typeof pkg["version"] !== "string")
1497
- throw new chunkQQ6ULXHI_cjs.LowerError(`vendored["${name}"] needs a version`);
1507
+ throw new chunkODZ2IAR2_cjs.LowerError(`vendored["${name}"] needs a version`);
1498
1508
  Object.defineProperty(vendored, name, {
1499
1509
  value: {
1500
1510
  version: pkg["version"],
@@ -1513,6 +1523,162 @@ function archiveDeps(archive) {
1513
1523
  return archive.vendored ?? {};
1514
1524
  }
1515
1525
 
1526
+ // src/roundtrip/source-map.ts
1527
+ var BUNDLE_FILE_NAME = "workflow-bundle.mjs";
1528
+ var BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1529
+ var BASE64_VALUE = new Map([...BASE64].map((char, index) => [char, index]));
1530
+ function decodeVlq(segment) {
1531
+ const values = [];
1532
+ let value2 = 0;
1533
+ let shift = 0;
1534
+ for (const char of segment) {
1535
+ const digit = BASE64_VALUE.get(char);
1536
+ if (digit === void 0) throw new chunkODZ2IAR2_cjs.LowerError(`Invalid source map character "${char}"`);
1537
+ value2 += (digit & 31) * 2 ** shift;
1538
+ if (digit & 32) {
1539
+ shift += 5;
1540
+ continue;
1541
+ }
1542
+ values.push(value2 % 2 === 1 ? -Math.floor(value2 / 2) : Math.floor(value2 / 2));
1543
+ value2 = 0;
1544
+ shift = 0;
1545
+ }
1546
+ if (shift !== 0) throw new chunkODZ2IAR2_cjs.LowerError("A source map segment ends in the middle of a number");
1547
+ return values;
1548
+ }
1549
+ function createSourceMapper(mapText) {
1550
+ let parsed;
1551
+ try {
1552
+ parsed = JSON.parse(mapText);
1553
+ } catch {
1554
+ throw new chunkODZ2IAR2_cjs.LowerError("The source map is not JSON");
1555
+ }
1556
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
1557
+ throw new chunkODZ2IAR2_cjs.LowerError("The source map is not an object");
1558
+ const record = parsed;
1559
+ const sources = record["sources"];
1560
+ const names = Array.isArray(record["names"]) ? record["names"].map(String) : [];
1561
+ const mappings = record["mappings"];
1562
+ if (record["version"] !== 3 || !Array.isArray(sources) || typeof mappings !== "string")
1563
+ throw new chunkODZ2IAR2_cjs.LowerError("Only version 3 source maps with mappings are supported");
1564
+ const sourceNames = sources.map(String);
1565
+ const lines = [];
1566
+ let source = 0;
1567
+ let line = 0;
1568
+ let sourceColumn = 0;
1569
+ let name = 0;
1570
+ for (const lineText of mappings.split(";")) {
1571
+ const segments = [];
1572
+ let column = 0;
1573
+ for (const text of lineText.split(",")) {
1574
+ if (text === "") continue;
1575
+ const values = decodeVlq(text);
1576
+ column += values[0] ?? 0;
1577
+ if (values.length < 4) continue;
1578
+ source += values[1] ?? 0;
1579
+ line += values[2] ?? 0;
1580
+ sourceColumn += values[3] ?? 0;
1581
+ const segment = { column, source, line, sourceColumn };
1582
+ if (values.length >= 5) {
1583
+ name += values[4] ?? 0;
1584
+ segment.name = name;
1585
+ }
1586
+ segments.push(segment);
1587
+ }
1588
+ segments.sort((a, b) => a.column - b.column);
1589
+ lines.push(segments);
1590
+ }
1591
+ return {
1592
+ lookup(atLine, atColumn) {
1593
+ const segments = lines[atLine - 1];
1594
+ if (!segments || segments.length === 0) return void 0;
1595
+ let found = segments[0];
1596
+ if (atColumn !== void 0) {
1597
+ found = void 0;
1598
+ for (const segment of segments) {
1599
+ if (segment.column > atColumn) break;
1600
+ found = segment;
1601
+ }
1602
+ found ??= segments[0];
1603
+ }
1604
+ if (!found) return void 0;
1605
+ const sourceName = sourceNames[found.source];
1606
+ if (sourceName === void 0) return void 0;
1607
+ const position = {
1608
+ source: sourceName,
1609
+ line: found.line + 1,
1610
+ column: found.sourceColumn
1611
+ };
1612
+ const mappedName = found.name !== void 0 ? names[found.name] : void 0;
1613
+ if (mappedName !== void 0) position.name = mappedName;
1614
+ return position;
1615
+ }
1616
+ };
1617
+ }
1618
+ function isBundleFile(path, bundleFile) {
1619
+ return path !== void 0 && (path === bundleFile || path.endsWith(`/${bundleFile}`));
1620
+ }
1621
+ function mapStackTrace(stack, mapper, bundleFile = BUNDLE_FILE_NAME) {
1622
+ const frame = new RegExp(
1623
+ `${bundleFile.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}:(\\d+)(?::(\\d+))?`,
1624
+ "g"
1625
+ );
1626
+ return stack.split("\n").map(
1627
+ (line) => line.replace(frame, (whole, lineText, columnText) => {
1628
+ const position = mapper.lookup(
1629
+ Number(lineText),
1630
+ columnText !== void 0 ? Number(columnText) - 1 : void 0
1631
+ );
1632
+ return position ? `${position.source}:${position.line}:${position.column + 1}` : whole;
1633
+ })
1634
+ ).join("\n");
1635
+ }
1636
+ function mapEnhancedStackTrace(value2, mapper, bundleFile = BUNDLE_FILE_NAME) {
1637
+ if (typeof value2 !== "object" || value2 === null || Array.isArray(value2)) return value2;
1638
+ const stacks = value2["stacks"];
1639
+ if (!Array.isArray(stacks)) return value2;
1640
+ const mappedStacks = stacks.map((stack) => {
1641
+ if (typeof stack !== "object" || stack === null || Array.isArray(stack)) return stack;
1642
+ const locations = stack["locations"];
1643
+ if (!Array.isArray(locations)) return stack;
1644
+ return {
1645
+ ...stack,
1646
+ locations: locations.map((location) => {
1647
+ if (typeof location !== "object" || location === null || Array.isArray(location))
1648
+ return location;
1649
+ const filePath = typeof location["filePath"] === "string" ? location["filePath"] : void 0;
1650
+ const line = typeof location["line"] === "number" ? location["line"] : void 0;
1651
+ const column = typeof location["column"] === "number" ? location["column"] : void 0;
1652
+ if (!isBundleFile(filePath, bundleFile) || line === void 0) return location;
1653
+ const position = mapper.lookup(line, column !== void 0 ? column - 1 : void 0);
1654
+ if (!position) return location;
1655
+ const out = {
1656
+ ...location,
1657
+ filePath: position.source,
1658
+ line: position.line,
1659
+ column: position.column + 1,
1660
+ bundleLine: line
1661
+ };
1662
+ if (column !== void 0) out["bundleColumn"] = column;
1663
+ return out;
1664
+ })
1665
+ };
1666
+ });
1667
+ return { ...value2, stacks: mappedStacks };
1668
+ }
1669
+ function sourceLocations(stack, mapper, bundleFile = BUNDLE_FILE_NAME) {
1670
+ const out = [];
1671
+ for (const location of chunkQ4MWQNJK_cjs.parseStack(stack)) {
1672
+ if (!isBundleFile(location.filePath, bundleFile) || location.line === void 0) continue;
1673
+ const position = mapper.lookup(
1674
+ location.line,
1675
+ location.column !== void 0 ? location.column - 1 : void 0
1676
+ );
1677
+ if (position) out.push(position);
1678
+ }
1679
+ return out;
1680
+ }
1681
+
1516
1682
  // src/roundtrip/fidelity.ts
1517
1683
  var LOSSY_KINDS = /* @__PURE__ */ new Set([
1518
1684
  "layout-omitted",
@@ -1524,7 +1690,7 @@ async function checkFidelity(files, reference, items, options2 = {}) {
1524
1690
  const all = [...items];
1525
1691
  const connections = options2.connectionNames && chunkSAENRNBJ_cjs.isRecord(reference) ? connectionsByName(options2.connectionNames, reference) : void 0;
1526
1692
  try {
1527
- const result = await chunkQQ6ULXHI_cjs.lower(
1693
+ const result = await chunkODZ2IAR2_cjs.lower(
1528
1694
  files.map((file) => ({ path: file.path, content: file.content })),
1529
1695
  {
1530
1696
  ...options2.esbuild ? { esbuild: options2.esbuild } : {},
@@ -1538,8 +1704,8 @@ async function checkFidelity(files, reference, items, options2 = {}) {
1538
1704
  kind: "lowering-failed",
1539
1705
  detail: `Lowering produced ${result.workflows.length} workflows instead of one`
1540
1706
  });
1541
- } else if (chunkGBQ33SIZ_cjs.irHash(lowered) !== chunkGBQ33SIZ_cjs.irHash(reference)) {
1542
- for (const change of chunkNEIUQASE_cjs.diffDefinitions(reference, lowered)) {
1707
+ } else if (chunk54FLQNUM_cjs.irHash(lowered) !== chunk54FLQNUM_cjs.irHash(reference)) {
1708
+ for (const change of chunk4QKB4ARC_cjs.diffDefinitions(reference, lowered)) {
1543
1709
  all.push({
1544
1710
  path: change.path,
1545
1711
  kind: "roundtrip-mismatch",
@@ -1564,12 +1730,12 @@ async function exportWorkflowCode(definition, options2) {
1564
1730
  ...options2.connectionNames ? { connectionNames: options2.connectionNames } : {}
1565
1731
  });
1566
1732
  const files = options2.format === "PYTHON" ? (await liftToPython(definition, options2)).files : ts.files;
1567
- return { format: options2.format, files, fidelity, irHash: chunkGBQ33SIZ_cjs.irHash(definition) };
1733
+ return { format: options2.format, files, fidelity, irHash: chunk54FLQNUM_cjs.irHash(definition) };
1568
1734
  }
1569
1735
 
1570
1736
  Object.defineProperty(exports, "createNodeVmEvaluator", {
1571
1737
  enumerable: true,
1572
- get: function () { return chunkFEW3JBYA_cjs.createNodeVmEvaluator; }
1738
+ get: function () { return chunkTCTE7DX5_cjs.createNodeVmEvaluator; }
1573
1739
  });
1574
1740
  Object.defineProperty(exports, "PY_LINE_LENGTH", {
1575
1741
  enumerable: true,
@@ -1583,68 +1749,110 @@ Object.defineProperty(exports, "TS_NODES_IMPORT", {
1583
1749
  enumerable: true,
1584
1750
  get: function () { return chunkSX2PNKKT_cjs.TS_NODES_IMPORT; }
1585
1751
  });
1752
+ Object.defineProperty(exports, "DYNAMIC_EXPORT", {
1753
+ enumerable: true,
1754
+ get: function () { return chunkODZ2IAR2_cjs.DYNAMIC_EXPORT; }
1755
+ });
1586
1756
  Object.defineProperty(exports, "DeterminismViolationError", {
1587
1757
  enumerable: true,
1588
- get: function () { return chunkQQ6ULXHI_cjs.DeterminismViolationError; }
1758
+ get: function () { return chunkODZ2IAR2_cjs.DeterminismViolationError; }
1589
1759
  });
1590
1760
  Object.defineProperty(exports, "ESBUILD_VERSION", {
1591
1761
  enumerable: true,
1592
- get: function () { return chunkQQ6ULXHI_cjs.ESBUILD_VERSION; }
1762
+ get: function () { return chunkODZ2IAR2_cjs.ESBUILD_VERSION; }
1593
1763
  });
1594
1764
  Object.defineProperty(exports, "EVALUATION_GLOBAL", {
1595
1765
  enumerable: true,
1596
- get: function () { return chunkQQ6ULXHI_cjs.EVALUATION_GLOBAL; }
1766
+ get: function () { return chunkODZ2IAR2_cjs.EVALUATION_GLOBAL; }
1597
1767
  });
1598
1768
  Object.defineProperty(exports, "LowerError", {
1599
1769
  enumerable: true,
1600
- get: function () { return chunkQQ6ULXHI_cjs.LowerError; }
1770
+ get: function () { return chunkODZ2IAR2_cjs.LowerError; }
1601
1771
  });
1602
1772
  Object.defineProperty(exports, "NODE_BUILTINS", {
1603
1773
  enumerable: true,
1604
- get: function () { return chunkQQ6ULXHI_cjs.NODE_BUILTINS; }
1774
+ get: function () { return chunkODZ2IAR2_cjs.NODE_BUILTINS; }
1605
1775
  });
1606
1776
  Object.defineProperty(exports, "buildBundle", {
1607
1777
  enumerable: true,
1608
- get: function () { return chunkQQ6ULXHI_cjs.buildBundle; }
1778
+ get: function () { return chunkODZ2IAR2_cjs.buildBundle; }
1609
1779
  });
1610
1780
  Object.defineProperty(exports, "bundleProject", {
1611
1781
  enumerable: true,
1612
- get: function () { return chunkQQ6ULXHI_cjs.bundleProject; }
1782
+ get: function () { return chunkODZ2IAR2_cjs.bundleProject; }
1613
1783
  });
1614
1784
  Object.defineProperty(exports, "bundleSourceHash", {
1615
1785
  enumerable: true,
1616
- get: function () { return chunkQQ6ULXHI_cjs.bundleSourceHash; }
1786
+ get: function () { return chunkODZ2IAR2_cjs.bundleSourceHash; }
1787
+ });
1788
+ Object.defineProperty(exports, "callArguments", {
1789
+ enumerable: true,
1790
+ get: function () { return chunkODZ2IAR2_cjs.callArguments; }
1617
1791
  });
1618
1792
  Object.defineProperty(exports, "defaultEntries", {
1619
1793
  enumerable: true,
1620
- get: function () { return chunkQQ6ULXHI_cjs.defaultEntries; }
1794
+ get: function () { return chunkODZ2IAR2_cjs.defaultEntries; }
1795
+ });
1796
+ Object.defineProperty(exports, "durableFeatures", {
1797
+ enumerable: true,
1798
+ get: function () { return chunkODZ2IAR2_cjs.durableFeatures; }
1799
+ });
1800
+ Object.defineProperty(exports, "durableScanModules", {
1801
+ enumerable: true,
1802
+ get: function () { return chunkODZ2IAR2_cjs.durableScanModules; }
1803
+ });
1804
+ Object.defineProperty(exports, "literalDurationMs", {
1805
+ enumerable: true,
1806
+ get: function () { return chunkODZ2IAR2_cjs.literalDurationMs; }
1621
1807
  });
1622
1808
  Object.defineProperty(exports, "lower", {
1623
1809
  enumerable: true,
1624
- get: function () { return chunkQQ6ULXHI_cjs.lower; }
1810
+ get: function () { return chunkODZ2IAR2_cjs.lower; }
1811
+ });
1812
+ Object.defineProperty(exports, "objectEntries", {
1813
+ enumerable: true,
1814
+ get: function () { return chunkODZ2IAR2_cjs.objectEntries; }
1625
1815
  });
1626
1816
  Object.defineProperty(exports, "resolvePackageEntry", {
1627
1817
  enumerable: true,
1628
- get: function () { return chunkQQ6ULXHI_cjs.resolvePackageEntry; }
1818
+ get: function () { return chunkODZ2IAR2_cjs.resolvePackageEntry; }
1819
+ });
1820
+ Object.defineProperty(exports, "scanDurableSource", {
1821
+ enumerable: true,
1822
+ get: function () { return chunkODZ2IAR2_cjs.scanDurableSource; }
1629
1823
  });
1630
1824
  Object.defineProperty(exports, "scanDurableSources", {
1631
1825
  enumerable: true,
1632
- get: function () { return chunkQQ6ULXHI_cjs.scanDurableSources; }
1826
+ get: function () { return chunkODZ2IAR2_cjs.scanDurableSources; }
1633
1827
  });
1634
1828
  Object.defineProperty(exports, "splitSpecifier", {
1635
1829
  enumerable: true,
1636
- get: function () { return chunkQQ6ULXHI_cjs.splitSpecifier; }
1830
+ get: function () { return chunkODZ2IAR2_cjs.splitSpecifier; }
1831
+ });
1832
+ Object.defineProperty(exports, "splitTopLevel", {
1833
+ enumerable: true,
1834
+ get: function () { return chunkODZ2IAR2_cjs.splitTopLevel; }
1835
+ });
1836
+ Object.defineProperty(exports, "withoutAllComments", {
1837
+ enumerable: true,
1838
+ get: function () { return chunkODZ2IAR2_cjs.withoutAllComments; }
1637
1839
  });
1840
+ exports.BUNDLE_FILE_NAME = BUNDLE_FILE_NAME;
1638
1841
  exports.LiftError = LiftError;
1639
1842
  exports.PY_PROJECT_MODULE = PY_PROJECT_MODULE;
1640
1843
  exports.PY_SDK_MODULE = PY_SDK_MODULE;
1641
1844
  exports.SOURCE_ARCHIVE_MAX_BYTES = SOURCE_ARCHIVE_MAX_BYTES;
1642
1845
  exports.archiveDeps = archiveDeps;
1643
1846
  exports.checkFidelity = checkFidelity;
1847
+ exports.createSourceMapper = createSourceMapper;
1848
+ exports.decodeVlq = decodeVlq;
1644
1849
  exports.exportWorkflowCode = exportWorkflowCode;
1645
1850
  exports.liftToPython = liftToPython;
1646
1851
  exports.liftToTypeScript = liftToTypeScript;
1852
+ exports.mapEnhancedStackTrace = mapEnhancedStackTrace;
1853
+ exports.mapStackTrace = mapStackTrace;
1647
1854
  exports.packSources = packSources;
1648
1855
  exports.prepareLift = prepareLift;
1856
+ exports.sourceLocations = sourceLocations;
1649
1857
  exports.unpackSources = unpackSources;
1650
1858
  exports.vendorDependencies = vendorDependencies;