@fluidgrids/workflows 0.0.0-stage → 2026.1027.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/LICENSE +9 -0
- package/README.md +208 -2
- package/dist/assemble-CrpUyd_3.d.ts +587 -0
- package/dist/assemble-DEf3znGD.d.cts +587 -0
- package/dist/chunk-3M34AUIY.cjs +27 -0
- package/dist/chunk-5AW745OG.js +25 -0
- package/dist/chunk-5LUIDMF4.js +42 -0
- package/dist/chunk-6AIAC2FP.cjs +185 -0
- package/dist/chunk-6BEW4QD6.js +95 -0
- package/dist/chunk-6U446SKY.js +263 -0
- package/dist/chunk-7YR7DI7B.cjs +274 -0
- package/dist/chunk-CSYBNN3V.cjs +252 -0
- package/dist/chunk-E3APHA6O.cjs +199 -0
- package/dist/chunk-EEAIM35V.js +748 -0
- package/dist/chunk-G4UEPUGO.cjs +46 -0
- package/dist/chunk-IHKXLG6I.js +246 -0
- package/dist/chunk-MBBKGD7K.js +440 -0
- package/dist/chunk-OSPTJCDI.cjs +102 -0
- package/dist/chunk-TQF7MYEN.cjs +771 -0
- package/dist/chunk-TWOYB4Y7.cjs +76 -0
- package/dist/chunk-UB2BHU2M.js +174 -0
- package/dist/chunk-UJNHTS6D.js +181 -0
- package/dist/chunk-UWQWD7BP.cjs +931 -0
- package/dist/chunk-W32BSO3M.js +74 -0
- package/dist/chunk-XBIID5DY.js +893 -0
- package/dist/chunk-Y7NWR3WH.cjs +450 -0
- package/dist/codegen/index.cjs +18 -0
- package/dist/codegen/index.d.cts +15 -0
- package/dist/codegen/index.d.ts +15 -0
- package/dist/codegen/index.js +5 -0
- package/dist/expressions-DhHaqyar.d.cts +62 -0
- package/dist/expressions-DhHaqyar.d.ts +62 -0
- package/dist/hash-CZkTXPCX.d.cts +15 -0
- package/dist/hash-CZkTXPCX.d.ts +15 -0
- package/dist/index.cjs +117 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +4 -0
- package/dist/ir/index.cjs +1246 -0
- package/dist/ir/index.d.cts +838 -0
- package/dist/ir/index.d.ts +838 -0
- package/dist/ir/index.js +1122 -0
- package/dist/lower-CXggJTIo.d.ts +67 -0
- package/dist/lower-DAzvsJCo.d.cts +67 -0
- package/dist/manifest-Bp9ZJlav.d.ts +60 -0
- package/dist/manifest-Duf-gHdO.d.cts +60 -0
- package/dist/node-evaluator-CH3XCJND.cjs +17 -0
- package/dist/node-evaluator-TULXA3WE.js +8 -0
- package/dist/quickjs/index.cjs +46 -0
- package/dist/quickjs/index.d.cts +18 -0
- package/dist/quickjs/index.d.ts +18 -0
- package/dist/quickjs/index.js +44 -0
- package/dist/roundtrip/index.cjs +1448 -0
- package/dist/roundtrip/index.d.cts +290 -0
- package/dist/roundtrip/index.d.ts +290 -0
- package/dist/roundtrip/index.js +1397 -0
- package/dist/types-Dr2Fn1Ax.d.cts +225 -0
- package/dist/types-Dr2Fn1Ax.d.ts +225 -0
- package/package.json +143 -4
- package/schema/ir-v2.schema.json +655 -0
|
@@ -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,246 @@
|
|
|
1
|
+
import { setOwn } from './chunk-UJNHTS6D.js';
|
|
2
|
+
|
|
3
|
+
// src/ir/canonical-json.ts
|
|
4
|
+
var CanonicalJsonError = class extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "CanonicalJsonError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
function isPlainObject(value) {
|
|
11
|
+
const proto = Object.getPrototypeOf(value);
|
|
12
|
+
return proto === Object.prototype || proto === null;
|
|
13
|
+
}
|
|
14
|
+
function serialize(value, path, out) {
|
|
15
|
+
if (value === null) {
|
|
16
|
+
out.push("null");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
switch (typeof value) {
|
|
20
|
+
case "boolean":
|
|
21
|
+
out.push(value ? "true" : "false");
|
|
22
|
+
return;
|
|
23
|
+
case "number":
|
|
24
|
+
if (!Number.isFinite(value)) {
|
|
25
|
+
throw new CanonicalJsonError(`${path} is not a finite number`);
|
|
26
|
+
}
|
|
27
|
+
out.push(JSON.stringify(value));
|
|
28
|
+
return;
|
|
29
|
+
case "string":
|
|
30
|
+
out.push(JSON.stringify(value));
|
|
31
|
+
return;
|
|
32
|
+
case "object":
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
throw new CanonicalJsonError(`${path} is a ${typeof value}, which JSON cannot represent`);
|
|
36
|
+
}
|
|
37
|
+
if (Array.isArray(value)) {
|
|
38
|
+
out.push("[");
|
|
39
|
+
value.forEach((item, index) => {
|
|
40
|
+
if (item === void 0) {
|
|
41
|
+
throw new CanonicalJsonError(`${path}[${index}] is undefined`);
|
|
42
|
+
}
|
|
43
|
+
if (index > 0) out.push(",");
|
|
44
|
+
serialize(item, `${path}[${index}]`, out);
|
|
45
|
+
});
|
|
46
|
+
out.push("]");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!isPlainObject(value)) {
|
|
50
|
+
throw new CanonicalJsonError(`${path} is not a plain JSON object`);
|
|
51
|
+
}
|
|
52
|
+
const record = value;
|
|
53
|
+
const keys = Object.keys(record).filter((key) => record[key] !== void 0).sort();
|
|
54
|
+
out.push("{");
|
|
55
|
+
keys.forEach((key, index) => {
|
|
56
|
+
if (index > 0) out.push(",");
|
|
57
|
+
out.push(JSON.stringify(key), ":");
|
|
58
|
+
serialize(record[key], `${path}.${key}`, out);
|
|
59
|
+
});
|
|
60
|
+
out.push("}");
|
|
61
|
+
}
|
|
62
|
+
function canonicalJson(value) {
|
|
63
|
+
const out = [];
|
|
64
|
+
serialize(value, "$", out);
|
|
65
|
+
return out.join("");
|
|
66
|
+
}
|
|
67
|
+
function sortKeysDeep(value) {
|
|
68
|
+
if (Array.isArray(value)) return value.map(sortKeysDeep);
|
|
69
|
+
if (value !== null && typeof value === "object") {
|
|
70
|
+
const record = value;
|
|
71
|
+
const sorted = {};
|
|
72
|
+
for (const key of Object.keys(record).sort()) {
|
|
73
|
+
if (record[key] !== void 0) setOwn(sorted, key, sortKeysDeep(record[key]));
|
|
74
|
+
}
|
|
75
|
+
return sorted;
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
function stableStringify(value) {
|
|
80
|
+
canonicalJson(value);
|
|
81
|
+
return `${JSON.stringify(sortKeysDeep(value), null, 2)}
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/ir/sha256.ts
|
|
86
|
+
var K = new Uint32Array([
|
|
87
|
+
1116352408,
|
|
88
|
+
1899447441,
|
|
89
|
+
3049323471,
|
|
90
|
+
3921009573,
|
|
91
|
+
961987163,
|
|
92
|
+
1508970993,
|
|
93
|
+
2453635748,
|
|
94
|
+
2870763221,
|
|
95
|
+
3624381080,
|
|
96
|
+
310598401,
|
|
97
|
+
607225278,
|
|
98
|
+
1426881987,
|
|
99
|
+
1925078388,
|
|
100
|
+
2162078206,
|
|
101
|
+
2614888103,
|
|
102
|
+
3248222580,
|
|
103
|
+
3835390401,
|
|
104
|
+
4022224774,
|
|
105
|
+
264347078,
|
|
106
|
+
604807628,
|
|
107
|
+
770255983,
|
|
108
|
+
1249150122,
|
|
109
|
+
1555081692,
|
|
110
|
+
1996064986,
|
|
111
|
+
2554220882,
|
|
112
|
+
2821834349,
|
|
113
|
+
2952996808,
|
|
114
|
+
3210313671,
|
|
115
|
+
3336571891,
|
|
116
|
+
3584528711,
|
|
117
|
+
113926993,
|
|
118
|
+
338241895,
|
|
119
|
+
666307205,
|
|
120
|
+
773529912,
|
|
121
|
+
1294757372,
|
|
122
|
+
1396182291,
|
|
123
|
+
1695183700,
|
|
124
|
+
1986661051,
|
|
125
|
+
2177026350,
|
|
126
|
+
2456956037,
|
|
127
|
+
2730485921,
|
|
128
|
+
2820302411,
|
|
129
|
+
3259730800,
|
|
130
|
+
3345764771,
|
|
131
|
+
3516065817,
|
|
132
|
+
3600352804,
|
|
133
|
+
4094571909,
|
|
134
|
+
275423344,
|
|
135
|
+
430227734,
|
|
136
|
+
506948616,
|
|
137
|
+
659060556,
|
|
138
|
+
883997877,
|
|
139
|
+
958139571,
|
|
140
|
+
1322822218,
|
|
141
|
+
1537002063,
|
|
142
|
+
1747873779,
|
|
143
|
+
1955562222,
|
|
144
|
+
2024104815,
|
|
145
|
+
2227730452,
|
|
146
|
+
2361852424,
|
|
147
|
+
2428436474,
|
|
148
|
+
2756734187,
|
|
149
|
+
3204031479,
|
|
150
|
+
3329325298
|
|
151
|
+
]);
|
|
152
|
+
function rotr(value, bits) {
|
|
153
|
+
return value >>> bits | value << 32 - bits;
|
|
154
|
+
}
|
|
155
|
+
function utf8(text) {
|
|
156
|
+
const bytes = [];
|
|
157
|
+
for (const char of text) {
|
|
158
|
+
let code = char.codePointAt(0) ?? 0;
|
|
159
|
+
if (code >= 55296 && code <= 57343) code = 65533;
|
|
160
|
+
if (code < 128) {
|
|
161
|
+
bytes.push(code);
|
|
162
|
+
} else if (code < 2048) {
|
|
163
|
+
bytes.push(192 | code >> 6, 128 | code & 63);
|
|
164
|
+
} else if (code < 65536) {
|
|
165
|
+
bytes.push(224 | code >> 12, 128 | code >> 6 & 63, 128 | code & 63);
|
|
166
|
+
} else {
|
|
167
|
+
bytes.push(
|
|
168
|
+
240 | code >> 18,
|
|
169
|
+
128 | code >> 12 & 63,
|
|
170
|
+
128 | code >> 6 & 63,
|
|
171
|
+
128 | code & 63
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return Uint8Array.from(bytes);
|
|
176
|
+
}
|
|
177
|
+
function sha256Hex(text) {
|
|
178
|
+
const message = utf8(text);
|
|
179
|
+
const bitLength = message.length * 8;
|
|
180
|
+
const paddedLength = Math.ceil((message.length + 9) / 64) * 64;
|
|
181
|
+
const padded = new Uint8Array(paddedLength);
|
|
182
|
+
padded.set(message);
|
|
183
|
+
padded[message.length] = 128;
|
|
184
|
+
const view = new DataView(padded.buffer);
|
|
185
|
+
view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
|
|
186
|
+
view.setUint32(paddedLength - 4, bitLength >>> 0);
|
|
187
|
+
const hash = new Uint32Array([
|
|
188
|
+
1779033703,
|
|
189
|
+
3144134277,
|
|
190
|
+
1013904242,
|
|
191
|
+
2773480762,
|
|
192
|
+
1359893119,
|
|
193
|
+
2600822924,
|
|
194
|
+
528734635,
|
|
195
|
+
1541459225
|
|
196
|
+
]);
|
|
197
|
+
const w = new Uint32Array(64);
|
|
198
|
+
for (let offset = 0; offset < paddedLength; offset += 64) {
|
|
199
|
+
for (let i = 0; i < 16; i++) w[i] = view.getUint32(offset + i * 4);
|
|
200
|
+
for (let i = 16; i < 64; i++) {
|
|
201
|
+
const w15 = w[i - 15] ?? 0;
|
|
202
|
+
const w2 = w[i - 2] ?? 0;
|
|
203
|
+
const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ w15 >>> 3;
|
|
204
|
+
const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ w2 >>> 10;
|
|
205
|
+
w[i] = (w[i - 16] ?? 0) + s0 + (w[i - 7] ?? 0) + s1 >>> 0;
|
|
206
|
+
}
|
|
207
|
+
let a = hash[0] ?? 0;
|
|
208
|
+
let b = hash[1] ?? 0;
|
|
209
|
+
let c = hash[2] ?? 0;
|
|
210
|
+
let d = hash[3] ?? 0;
|
|
211
|
+
let e = hash[4] ?? 0;
|
|
212
|
+
let f = hash[5] ?? 0;
|
|
213
|
+
let g = hash[6] ?? 0;
|
|
214
|
+
let h = hash[7] ?? 0;
|
|
215
|
+
for (let i = 0; i < 64; i++) {
|
|
216
|
+
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
217
|
+
const ch = e & f ^ ~e & g;
|
|
218
|
+
const t1 = h + s1 + ch + (K[i] ?? 0) + (w[i] ?? 0) >>> 0;
|
|
219
|
+
const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
220
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
221
|
+
const t2 = s0 + maj >>> 0;
|
|
222
|
+
h = g;
|
|
223
|
+
g = f;
|
|
224
|
+
f = e;
|
|
225
|
+
e = d + t1 >>> 0;
|
|
226
|
+
d = c;
|
|
227
|
+
c = b;
|
|
228
|
+
b = a;
|
|
229
|
+
a = t1 + t2 >>> 0;
|
|
230
|
+
}
|
|
231
|
+
hash[0] = (hash[0] ?? 0) + a >>> 0;
|
|
232
|
+
hash[1] = (hash[1] ?? 0) + b >>> 0;
|
|
233
|
+
hash[2] = (hash[2] ?? 0) + c >>> 0;
|
|
234
|
+
hash[3] = (hash[3] ?? 0) + d >>> 0;
|
|
235
|
+
hash[4] = (hash[4] ?? 0) + e >>> 0;
|
|
236
|
+
hash[5] = (hash[5] ?? 0) + f >>> 0;
|
|
237
|
+
hash[6] = (hash[6] ?? 0) + g >>> 0;
|
|
238
|
+
hash[7] = (hash[7] ?? 0) + h >>> 0;
|
|
239
|
+
}
|
|
240
|
+
return Array.from(hash, (word) => word.toString(16).padStart(8, "0")).join("");
|
|
241
|
+
}
|
|
242
|
+
function sha256Tagged(text) {
|
|
243
|
+
return `sha256:${sha256Hex(text)}`;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export { CanonicalJsonError, canonicalJson, sha256Hex, sha256Tagged, stableStringify };
|