@fluidgrids/workflows 0.0.0-stage → 2026.1027.0

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 (60) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +187 -2
  3. package/dist/assemble-BJo9TECS.d.cts +569 -0
  4. package/dist/assemble-DMOuaxRI.d.ts +569 -0
  5. package/dist/chunk-265J2FCH.cjs +33 -0
  6. package/dist/chunk-27HASETB.cjs +250 -0
  7. package/dist/chunk-4DPEGDPW.js +74 -0
  8. package/dist/chunk-5LUIDMF4.js +42 -0
  9. package/dist/chunk-AU3YW7FZ.cjs +279 -0
  10. package/dist/chunk-BWSLWF2E.js +722 -0
  11. package/dist/chunk-BYJ7QTLY.cjs +76 -0
  12. package/dist/chunk-G4UEPUGO.cjs +46 -0
  13. package/dist/chunk-GO34UHSY.js +95 -0
  14. package/dist/chunk-IZQNUNSU.cjs +931 -0
  15. package/dist/chunk-KUTMY2IO.cjs +745 -0
  16. package/dist/chunk-LMX35GNQ.js +893 -0
  17. package/dist/chunk-LRM6JXJA.cjs +181 -0
  18. package/dist/chunk-LSKSBVL4.cjs +102 -0
  19. package/dist/chunk-LUXCXFOE.cjs +269 -0
  20. package/dist/chunk-PL73GJR4.js +174 -0
  21. package/dist/chunk-REV7ZOA4.js +170 -0
  22. package/dist/chunk-RRQ5HOBF.cjs +185 -0
  23. package/dist/chunk-S34NJE3A.js +262 -0
  24. package/dist/chunk-SRQRLWOS.js +31 -0
  25. package/dist/chunk-SS4LT2IP.js +268 -0
  26. package/dist/chunk-X4HKU3MX.js +244 -0
  27. package/dist/codegen/index.cjs +18 -0
  28. package/dist/codegen/index.d.cts +15 -0
  29. package/dist/codegen/index.d.ts +15 -0
  30. package/dist/codegen/index.js +5 -0
  31. package/dist/expressions-DhHaqyar.d.cts +62 -0
  32. package/dist/expressions-DhHaqyar.d.ts +62 -0
  33. package/dist/hash-CZkTXPCX.d.cts +15 -0
  34. package/dist/hash-CZkTXPCX.d.ts +15 -0
  35. package/dist/index.cjs +117 -0
  36. package/dist/index.d.cts +27 -0
  37. package/dist/index.d.ts +27 -0
  38. package/dist/index.js +4 -0
  39. package/dist/ir/index.cjs +1244 -0
  40. package/dist/ir/index.d.cts +828 -0
  41. package/dist/ir/index.d.ts +828 -0
  42. package/dist/ir/index.js +1120 -0
  43. package/dist/lower-DcOY8ux0.d.cts +49 -0
  44. package/dist/lower-Dw5grNrI.d.ts +49 -0
  45. package/dist/manifest-Bp9ZJlav.d.ts +60 -0
  46. package/dist/manifest-Duf-gHdO.d.cts +60 -0
  47. package/dist/node-evaluator-2GTUZVPK.cjs +17 -0
  48. package/dist/node-evaluator-RMYEWCXZ.js +8 -0
  49. package/dist/quickjs/index.cjs +92 -0
  50. package/dist/quickjs/index.d.cts +18 -0
  51. package/dist/quickjs/index.d.ts +18 -0
  52. package/dist/quickjs/index.js +90 -0
  53. package/dist/roundtrip/index.cjs +1375 -0
  54. package/dist/roundtrip/index.d.cts +287 -0
  55. package/dist/roundtrip/index.d.ts +287 -0
  56. package/dist/roundtrip/index.js +1328 -0
  57. package/dist/types-Dr2Fn1Ax.d.cts +225 -0
  58. package/dist/types-Dr2Fn1Ax.d.ts +225 -0
  59. package/package.json +117 -4
  60. package/schema/ir-v2.schema.json +655 -0
@@ -0,0 +1,76 @@
1
+ 'use strict';
2
+
3
+ var chunkAU3YW7FZ_cjs = require('./chunk-AU3YW7FZ.cjs');
4
+ var chunkLRM6JXJA_cjs = require('./chunk-LRM6JXJA.cjs');
5
+
6
+ // src/ir/diff.ts
7
+ function keyPath(base, key) {
8
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? base ? `${base}.${key}` : key : `${base}[${JSON.stringify(key)}]`;
9
+ }
10
+ function diffValues(before, after, path, out) {
11
+ if (chunkLRM6JXJA_cjs.deepEqual(before, after)) return;
12
+ if (chunkLRM6JXJA_cjs.isRecord(before) && chunkLRM6JXJA_cjs.isRecord(after)) {
13
+ const keys = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])].sort();
14
+ for (const key of keys) {
15
+ const left = before[key];
16
+ const right = after[key];
17
+ if (left === void 0 && right !== void 0)
18
+ out.push({ kind: "added", path: keyPath(path, key), after: right });
19
+ else if (left !== void 0 && right === void 0)
20
+ out.push({ kind: "removed", path: keyPath(path, key), before: left });
21
+ else diffValues(left, right, keyPath(path, key), out);
22
+ }
23
+ return;
24
+ }
25
+ out.push({ kind: "changed", path, before, after });
26
+ }
27
+ function byId(items) {
28
+ const map = /* @__PURE__ */ new Map();
29
+ if (!Array.isArray(items)) return map;
30
+ items.forEach((item, index) => {
31
+ if (!chunkLRM6JXJA_cjs.isRecord(item)) return;
32
+ const id = typeof item["id"] === "string" ? item["id"] : `#${index}`;
33
+ if (!map.has(id)) map.set(id, item);
34
+ });
35
+ return map;
36
+ }
37
+ function diffCollection(before, after, path, out) {
38
+ const left = byId(before);
39
+ const right = byId(after);
40
+ for (const [id, item] of left) {
41
+ if (!right.has(id)) out.push({ kind: "removed", path: `${path}[${id}]`, before: item });
42
+ }
43
+ for (const [id, item] of right) {
44
+ const previous = left.get(id);
45
+ if (!previous) out.push({ kind: "added", path: `${path}[${id}]`, after: item });
46
+ else diffValues(previous, item, `${path}[${id}]`, out);
47
+ }
48
+ const common = (ids, other) => ids.filter((id) => other.has(id));
49
+ const leftOrder = common([...left.keys()], right);
50
+ const rightOrder = common([...right.keys()], left);
51
+ if (!chunkLRM6JXJA_cjs.deepEqual(leftOrder, rightOrder)) {
52
+ out.push({ kind: "reordered", path, before: leftOrder, after: rightOrder });
53
+ }
54
+ }
55
+ function diffDefinitions(before, after) {
56
+ const left = chunkAU3YW7FZ_cjs.hashedProjection(before);
57
+ const right = chunkAU3YW7FZ_cjs.hashedProjection(after);
58
+ const out = [];
59
+ if (!chunkLRM6JXJA_cjs.isRecord(left) || !chunkLRM6JXJA_cjs.isRecord(right)) {
60
+ diffValues(left, right, "", out);
61
+ return out;
62
+ }
63
+ const { data: leftData, ...leftRest } = left;
64
+ const { data: rightData, ...rightRest } = right;
65
+ diffValues(leftRest, rightRest, "", out);
66
+ const leftDataRecord = chunkLRM6JXJA_cjs.isRecord(leftData) ? leftData : {};
67
+ const rightDataRecord = chunkLRM6JXJA_cjs.isRecord(rightData) ? rightData : {};
68
+ const { nodes: leftNodes, edges: leftEdges, ...leftDataRest } = leftDataRecord;
69
+ const { nodes: rightNodes, edges: rightEdges, ...rightDataRest } = rightDataRecord;
70
+ diffCollection(leftNodes, rightNodes, "data.nodes", out);
71
+ diffCollection(leftEdges, rightEdges, "data.edges", out);
72
+ diffValues(leftDataRest, rightDataRest, "data", out);
73
+ return out;
74
+ }
75
+
76
+ exports.diffDefinitions = diffDefinitions;
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ // src/ir/layout.ts
4
+ var LAYOUT_COLUMN_WIDTH = 300;
5
+ var LAYOUT_ROW_HEIGHT = 170;
6
+ function autoLayout(nodeIds, edges) {
7
+ const depth = /* @__PURE__ */ new Map();
8
+ const roots = nodeIds.filter((id) => !edges.some((edge) => edge.target === id));
9
+ const queue = [...roots];
10
+ for (const id of queue) depth.set(id, 0);
11
+ const guardLimit = nodeIds.length * nodeIds.length + 1;
12
+ for (let guard = 0; queue.length > 0 && guard < guardLimit; guard++) {
13
+ const current = queue.shift();
14
+ if (current === void 0) break;
15
+ const currentDepth = depth.get(current) ?? 0;
16
+ for (const edge of edges) {
17
+ if (edge.source !== current) continue;
18
+ const next = currentDepth + 1;
19
+ if (next > (depth.get(edge.target) ?? -1) && next < nodeIds.length) {
20
+ depth.set(edge.target, next);
21
+ queue.push(edge.target);
22
+ }
23
+ }
24
+ }
25
+ const maxDepth = Math.max(0, ...depth.values());
26
+ const columns = /* @__PURE__ */ new Map();
27
+ for (const id of nodeIds) {
28
+ const column = depth.get(id) ?? maxDepth + 1;
29
+ columns.set(column, [...columns.get(column) ?? [], id]);
30
+ }
31
+ const positions = /* @__PURE__ */ new Map();
32
+ for (const [column, ids] of columns) {
33
+ ids.forEach((id, row) => {
34
+ positions.set(id, {
35
+ x: column * LAYOUT_COLUMN_WIDTH,
36
+ // `+ 0` turns the -0 Math.round can return into 0, so JSON never sees -0.
37
+ y: Math.round((row - (ids.length - 1) / 2) * LAYOUT_ROW_HEIGHT) + 0
38
+ });
39
+ });
40
+ }
41
+ return positions;
42
+ }
43
+
44
+ exports.LAYOUT_COLUMN_WIDTH = LAYOUT_COLUMN_WIDTH;
45
+ exports.LAYOUT_ROW_HEIGHT = LAYOUT_ROW_HEIGHT;
46
+ exports.autoLayout = autoLayout;
@@ -0,0 +1,95 @@
1
+ import { isRecord } from './chunk-REV7ZOA4.js';
2
+
3
+ // src/ir/manifest.ts
4
+ function operationsOf(manifest) {
5
+ const operations = Array.isArray(manifest.operations) ? manifest.operations : manifest.operations.operations;
6
+ return Array.isArray(operations) ? operations.filter((operation) => isRecord(operation) && typeof operation.name === "string") : [];
7
+ }
8
+ function isTriggerOperation(operation) {
9
+ if (typeof operation.role === "string") return operation.role.toLowerCase() === "trigger";
10
+ return operation.type === "trigger" || operation.type === "subscription";
11
+ }
12
+ function fieldOf(value) {
13
+ if (typeof value === "string") return { type: value };
14
+ return isRecord(value) ? value : {};
15
+ }
16
+ function fieldSchema(value) {
17
+ const field = fieldOf(value);
18
+ const description = typeof field.description === "string" ? { description: field.description } : {};
19
+ const choices = Array.isArray(field.enum) ? field.enum : Array.isArray(field.options) ? field.options : void 0;
20
+ if (choices && choices.every((choice) => typeof choice === "string")) {
21
+ return { enum: choices, ...description };
22
+ }
23
+ if (field.format === "binary") {
24
+ return {
25
+ type: "object",
26
+ description: field.description ?? "File reference",
27
+ properties: { fileId: { type: "string" } }
28
+ };
29
+ }
30
+ switch (field.type) {
31
+ case "string":
32
+ case "code":
33
+ case "workflow":
34
+ case "time":
35
+ return { type: "string", ...description };
36
+ case "date":
37
+ case "datetime":
38
+ return { type: "string", format: "date-time", ...description };
39
+ case "integer":
40
+ return { type: "integer", ...description };
41
+ case "number":
42
+ return { type: "number", ...description };
43
+ case "boolean":
44
+ return { type: "boolean", ...description };
45
+ case "array": {
46
+ const items = field.items !== void 0 ? { items: fieldSchema(field.items) } : {};
47
+ return { type: "array", ...items, ...description };
48
+ }
49
+ case "object": {
50
+ if (isRecord(field.properties)) {
51
+ const properties = {};
52
+ for (const [name, child] of Object.entries(field.properties))
53
+ properties[name] = fieldSchema(child);
54
+ return { type: "object", properties, ...description };
55
+ }
56
+ return { type: "object", ...description };
57
+ }
58
+ default:
59
+ return { ...description };
60
+ }
61
+ }
62
+ function fieldsSchema(fields) {
63
+ const properties = {};
64
+ const required = [];
65
+ for (const [name, field] of Object.entries(fields ?? {})) {
66
+ properties[name] = fieldSchema(field);
67
+ if (fieldOf(field).required === true) required.push(name);
68
+ }
69
+ return {
70
+ type: "object",
71
+ properties,
72
+ ...required.length > 0 ? { required } : {}
73
+ };
74
+ }
75
+ function findManifest(manifests, nodeType) {
76
+ const candidates = manifests.filter((manifest) => manifest.nodeType === nodeType);
77
+ return candidates.sort((a, b) => compareVersions(b.nodeVersion, a.nodeVersion))[0];
78
+ }
79
+ function compareVersions(left, right) {
80
+ const a = (left ?? "").split(".");
81
+ const b = (right ?? "").split(".");
82
+ for (let i = 0; i < Math.max(a.length, b.length); i++) {
83
+ const x = a[i] ?? "";
84
+ const y = b[i] ?? "";
85
+ const nx = Number(x);
86
+ const ny = Number(y);
87
+ if (x !== y) {
88
+ if (Number.isFinite(nx) && Number.isFinite(ny) && x !== "" && y !== "") return nx - ny;
89
+ return x < y ? -1 : 1;
90
+ }
91
+ }
92
+ return 0;
93
+ }
94
+
95
+ export { compareVersions, fieldSchema, fieldsSchema, findManifest, isTriggerOperation, operationsOf };