deepline 0.3.294 → 0.3.296

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 (138) hide show
  1. package/dist/bundling-sources/sdk/src/compat.ts +35 -7
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +108 -35
  4. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +25 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +14 -1
  6. package/dist/cli/auth-JCGIDVDF.mjs +31 -0
  7. package/dist/cli/auth-QDWV3TXX.js +31 -0
  8. package/dist/cli/billing-OQBSIXRG.mjs +1749 -0
  9. package/dist/cli/billing-YBK3J4WP.js +1749 -0
  10. package/dist/cli/chunk-2C3AVPTY.js +5688 -0
  11. package/dist/cli/chunk-2MZ5EQZE.mjs +499 -0
  12. package/dist/cli/chunk-3KC45UVF.js +150 -0
  13. package/dist/cli/chunk-3XX5TEA4.js +15 -0
  14. package/dist/cli/chunk-4MBOJQPL.mjs +0 -0
  15. package/dist/cli/chunk-4Y6CG4GE.js +2240 -0
  16. package/dist/cli/chunk-4ZB3CJRD.js +1269 -0
  17. package/dist/cli/chunk-5JLQPVNX.js +3056 -0
  18. package/dist/cli/chunk-6A3TJUWC.js +76 -0
  19. package/dist/cli/chunk-6HPEDBSJ.js +1995 -0
  20. package/dist/cli/chunk-7D6QG5KF.js +890 -0
  21. package/dist/cli/chunk-7P5AA3SN.js +344 -0
  22. package/dist/cli/chunk-7UAO5MWV.mjs +190 -0
  23. package/dist/cli/chunk-A7427JJH.js +190 -0
  24. package/dist/cli/chunk-AQRTLPHZ.js +735 -0
  25. package/dist/cli/chunk-AYHLUHE5.js +52 -0
  26. package/dist/cli/chunk-BZ77OTRF.mjs +923 -0
  27. package/dist/cli/chunk-CBVIJSHF.mjs +560 -0
  28. package/dist/cli/chunk-COGTRVWW.js +30 -0
  29. package/dist/cli/chunk-DLIRSHV6.mjs +28 -0
  30. package/dist/cli/chunk-DYWHXO7O.mjs +34 -0
  31. package/dist/cli/chunk-EDWJY6T4.mjs +3056 -0
  32. package/dist/cli/chunk-EXMLR72R.mjs +0 -0
  33. package/dist/cli/chunk-G46HHFNB.mjs +1269 -0
  34. package/dist/cli/chunk-GAMFK2ZP.mjs +148 -0
  35. package/dist/cli/chunk-GLKUGBTP.mjs +2240 -0
  36. package/dist/cli/chunk-GONRLVV3.js +3440 -0
  37. package/dist/cli/chunk-GVUJJJ5G.mjs +76 -0
  38. package/dist/cli/chunk-H7HIDGZ7.mjs +150 -0
  39. package/dist/cli/chunk-HUZXWOSK.mjs +503 -0
  40. package/dist/cli/chunk-I5YZLGMG.js +1 -0
  41. package/dist/cli/chunk-ITOFSXIU.mjs +15 -0
  42. package/dist/cli/chunk-J2D3VDOU.mjs +5688 -0
  43. package/dist/cli/chunk-J5NA2TTX.js +503 -0
  44. package/dist/cli/chunk-JCS5TPNY.mjs +3440 -0
  45. package/dist/cli/chunk-JNNOCMQY.js +47 -0
  46. package/dist/cli/chunk-KRD6H754.mjs +30 -0
  47. package/dist/cli/chunk-L4HBNHFW.js +34 -0
  48. package/dist/cli/chunk-LA46MMTL.js +560 -0
  49. package/dist/cli/chunk-LIKFCE7Z.js +190 -0
  50. package/dist/cli/chunk-MIMASXO4.mjs +389 -0
  51. package/dist/cli/chunk-NPPJX3BL.mjs +1995 -0
  52. package/dist/cli/chunk-NTEZFZLE.mjs +890 -0
  53. package/dist/cli/chunk-NXDRDJ4K.js +389 -0
  54. package/dist/cli/chunk-NXGCO4JB.mjs +344 -0
  55. package/dist/cli/chunk-OG64RBAC.js +6 -0
  56. package/dist/cli/chunk-OWJZUE3Y.mjs +103 -0
  57. package/dist/cli/chunk-QSIO4TX2.mjs +190 -0
  58. package/dist/cli/chunk-RCUE5C5C.mjs +735 -0
  59. package/dist/cli/chunk-SDK3ZA2C.js +103 -0
  60. package/dist/cli/chunk-SFLARO4Y.mjs +47 -0
  61. package/dist/cli/chunk-TAC3JIFE.mjs +354 -0
  62. package/dist/cli/chunk-UC6GHEL4.js +499 -0
  63. package/dist/cli/chunk-UFS752TU.mjs +52 -0
  64. package/dist/cli/chunk-UNEMDKXN.js +1 -0
  65. package/dist/cli/chunk-WB6Z2Q44.mjs +1622 -0
  66. package/dist/cli/chunk-WJYPBHTE.js +148 -0
  67. package/dist/cli/chunk-WOHBA5PV.js +354 -0
  68. package/dist/cli/chunk-WZYKRD7T.mjs +6 -0
  69. package/dist/cli/chunk-XNYIZMNQ.js +28 -0
  70. package/dist/cli/chunk-ZDO3TO3M.js +1622 -0
  71. package/dist/cli/chunk-ZDOC4HFL.js +923 -0
  72. package/dist/cli/client-CZDA4JKO.mjs +20 -0
  73. package/dist/cli/client-IZGIN2ZA.js +20 -0
  74. package/dist/cli/csv-6KOMZA2H.mjs +585 -0
  75. package/dist/cli/csv-UTEQY3NA.js +585 -0
  76. package/dist/cli/db-D5EP6TKO.mjs +486 -0
  77. package/dist/cli/db-SIBLPIKC.js +486 -0
  78. package/dist/cli/executions-2PHT57IO.js +28 -0
  79. package/dist/cli/executions-DFWM2YYY.mjs +28 -0
  80. package/dist/cli/feedback-GZW37JMI.mjs +107 -0
  81. package/dist/cli/feedback-IQVWIJZ4.js +107 -0
  82. package/dist/cli/getting-started.js +18 -76
  83. package/dist/cli/getting-started.mjs +10 -37
  84. package/dist/cli/git-563GYLMA.js +23 -0
  85. package/dist/cli/git-B72Y4FFQ.mjs +23 -0
  86. package/dist/cli/index.js +291 -54294
  87. package/dist/cli/index.mjs +209 -54352
  88. package/dist/cli/legacy-noops-37F5MX2P.mjs +157 -0
  89. package/dist/cli/legacy-noops-IFGVDCOM.js +157 -0
  90. package/dist/cli/monitors-42H6LOVT.mjs +3251 -0
  91. package/dist/cli/monitors-GQCHXBXZ.js +3251 -0
  92. package/dist/cli/org-4GCPBTGR.js +849 -0
  93. package/dist/cli/org-JYZA3ZRJ.mjs +849 -0
  94. package/dist/cli/play-46ZJ4FMI.js +18439 -0
  95. package/dist/cli/play-Q2XV3FZZ.mjs +18439 -0
  96. package/dist/cli/providers-CTKQP45X.mjs +95 -0
  97. package/dist/cli/providers-PCNF5E3K.js +95 -0
  98. package/dist/cli/proxy-env-EBANZHPV.js +161 -0
  99. package/dist/cli/proxy-env-M4ZHXHRL.mjs +161 -0
  100. package/dist/cli/quickstart-FTHWRVWN.js +69 -0
  101. package/dist/cli/quickstart-X7EVVWRG.mjs +69 -0
  102. package/dist/cli/search-73YPOFDO.mjs +18 -0
  103. package/dist/cli/search-XA5UVC3G.js +18 -0
  104. package/dist/cli/secrets-OUMPT4FX.mjs +400 -0
  105. package/dist/cli/secrets-UOEVR73Q.js +400 -0
  106. package/dist/cli/sessions-CMKXCN5Y.js +15 -0
  107. package/dist/cli/sessions-ZIFGDZE7.mjs +15 -0
  108. package/dist/cli/settings-OO5R3G52.mjs +846 -0
  109. package/dist/cli/settings-ULZT2NIC.js +846 -0
  110. package/dist/cli/setup-6GZH52OZ.mjs +1257 -0
  111. package/dist/cli/setup-DHGERXPZ.js +1257 -0
  112. package/dist/cli/skills-Q7NUCS2W.js +28 -0
  113. package/dist/cli/skills-T3EY2656.mjs +28 -0
  114. package/dist/cli/tools-BIMOAOTX.mjs +2955 -0
  115. package/dist/cli/tools-ODXVCKO7.js +2955 -0
  116. package/dist/cli/update-UMB3ULBR.js +28 -0
  117. package/dist/cli/update-X4HX7Z3M.mjs +28 -0
  118. package/dist/cli/workflow-EAUFVPIP.mjs +1936 -0
  119. package/dist/cli/workflow-IVLCPFTG.js +1936 -0
  120. package/dist/helpers.js +6 -32
  121. package/dist/helpers.mjs +2 -0
  122. package/dist/index.js +1972 -12825
  123. package/dist/index.mjs +1910 -12672
  124. package/dist/install-integrity.json +110 -0
  125. package/dist/monitor-fleet-contract.js +31 -730
  126. package/dist/monitor-fleet-contract.mjs +18 -667
  127. package/dist/monitor-input-contract.js +10 -390
  128. package/dist/monitor-input-contract.mjs +7 -348
  129. package/dist/plays/bundle-play-file.mjs +13 -5178
  130. package/dist/plays/csv-data-input.js +5 -3132
  131. package/dist/plays/csv-data-input.mjs +5 -3105
  132. package/dist/plays/run-request.js +56 -664
  133. package/dist/plays/run-request.mjs +30 -588
  134. package/dist/release.d.mts +1 -1
  135. package/dist/release.d.ts +1 -1
  136. package/dist/release.js +5 -212
  137. package/dist/release.mjs +5 -185
  138. package/package.json +1 -1
@@ -0,0 +1,389 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/tool-output.ts
2
+
3
+
4
+
5
+
6
+
7
+
8
+ var _fs = require('fs');
9
+ var _os = require('os');
10
+ var _path = require('path');
11
+ function isPlainObject(value) {
12
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
13
+ }
14
+ function getByDottedPath(root, dottedPath) {
15
+ let current = root;
16
+ for (const segment of String(dottedPath || "").split(".").filter(Boolean)) {
17
+ if (!isPlainObject(current) || !(segment in current)) {
18
+ return null;
19
+ }
20
+ current = current[segment];
21
+ }
22
+ return current;
23
+ }
24
+ function normalizeRows(value) {
25
+ if (!Array.isArray(value)) return null;
26
+ return value.map((entry) => {
27
+ if (isPlainObject(entry)) return entry;
28
+ return { value: entry };
29
+ });
30
+ }
31
+ function columnsForRows(rows) {
32
+ const seen = /* @__PURE__ */ new Set();
33
+ const columns = [];
34
+ for (const row of rows) {
35
+ for (const key of Object.keys(row)) {
36
+ if (!seen.has(key)) {
37
+ seen.add(key);
38
+ columns.push(key);
39
+ }
40
+ }
41
+ }
42
+ return columns;
43
+ }
44
+ function candidateRoots(payload) {
45
+ const roots = [
46
+ { path: null, value: payload }
47
+ ];
48
+ if (isPlainObject(payload) && isPlainObject(payload.toolResponse)) {
49
+ roots.push({ path: "toolResponse", value: payload.toolResponse });
50
+ if (Object.prototype.hasOwnProperty.call(payload.toolResponse, "raw")) {
51
+ roots.push({
52
+ path: "toolResponse.raw",
53
+ value: payload.toolResponse.raw
54
+ });
55
+ }
56
+ }
57
+ if (isPlainObject(payload) && isPlainObject(payload.output)) {
58
+ roots.push({ path: "output", value: payload.output });
59
+ if (Object.prototype.hasOwnProperty.call(payload.output, "body")) {
60
+ roots.push({ path: "output.body", value: payload.output.body });
61
+ }
62
+ }
63
+ if (isPlainObject(payload) && isPlainObject(payload.result)) {
64
+ roots.push({ path: "result", value: payload.result });
65
+ if (isPlainObject(payload.result.data)) {
66
+ roots.push({ path: "result.data", value: payload.result.data });
67
+ }
68
+ }
69
+ return roots;
70
+ }
71
+ function findBestArrayCandidate(value, pathPrefix = "", depth = 0) {
72
+ if (depth > 5) return null;
73
+ const directRows = normalizeRows(value);
74
+ const hasObjectRow = _nullishCoalesce(_optionalChain([directRows, 'optionalAccess', _ => _.some, 'call', _2 => _2(
75
+ (row) => Object.keys(row).some((key) => key !== "value")
76
+ )]), () => ( false));
77
+ let best = directRows && directRows.length > 0 && hasObjectRow ? { path: pathPrefix, rows: directRows } : null;
78
+ if (!isPlainObject(value)) {
79
+ return best;
80
+ }
81
+ for (const [key, child] of Object.entries(value)) {
82
+ const childPath = pathPrefix ? `${pathPrefix}.${key}` : key;
83
+ const candidate = findBestArrayCandidate(child, childPath, depth + 1);
84
+ if (!candidate) continue;
85
+ if (!best || candidate.rows.length > best.rows.length) {
86
+ best = candidate;
87
+ }
88
+ }
89
+ return best;
90
+ }
91
+ function tryConvertToList(payload, options) {
92
+ const listExtractorPaths = Array.isArray(_optionalChain([options, 'optionalAccess', _3 => _3.listExtractorPaths])) ? _optionalChain([options, 'optionalAccess', _4 => _4.listExtractorPaths, 'access', _5 => _5.filter, 'call', _6 => _6(
93
+ (entry) => typeof entry === "string" && entry.trim().length > 0
94
+ )]) : [];
95
+ if (listExtractorPaths.length > 0) {
96
+ let emptyMatch = null;
97
+ for (const root of candidateRoots(payload)) {
98
+ for (const extractorPath of listExtractorPaths) {
99
+ const resolved = getByDottedPath(root.value, extractorPath);
100
+ const rows = normalizeRows(resolved);
101
+ if (!rows) {
102
+ continue;
103
+ }
104
+ const sourcePath = root.path ? `${root.path}.${extractorPath}` : extractorPath;
105
+ if (rows.length > 0) {
106
+ return { rows, strategy: "configured_paths", sourcePath };
107
+ }
108
+ emptyMatch ??= { rows, strategy: "configured_paths", sourcePath };
109
+ }
110
+ }
111
+ if (emptyMatch) {
112
+ return emptyMatch;
113
+ }
114
+ }
115
+ for (const root of candidateRoots(payload)) {
116
+ const candidate = findBestArrayCandidate(root.value, _nullishCoalesce(root.path, () => ( "")));
117
+ if (!candidate || candidate.rows.length === 0) continue;
118
+ return {
119
+ rows: candidate.rows,
120
+ strategy: "auto_detected",
121
+ sourcePath: candidate.path || root.path
122
+ };
123
+ }
124
+ return null;
125
+ }
126
+ function projectRowOutput(conversion) {
127
+ return {
128
+ rows: conversion.rows,
129
+ rowCount: conversion.rows.length,
130
+ columns: columnsForRows(conversion.rows),
131
+ previewRows: conversion.rows.slice(0, 5),
132
+ strategy: conversion.strategy,
133
+ sourcePath: conversion.sourcePath
134
+ };
135
+ }
136
+ function ensureOutputDir() {
137
+ const outputDir = _path.join.call(void 0, _os.homedir.call(void 0, ), ".local", "share", "deepline", "data");
138
+ _fs.mkdirSync.call(void 0, outputDir, { recursive: true });
139
+ return outputDir;
140
+ }
141
+ function writeJsonOutputFile(payload, stem) {
142
+ const outputDir = ensureOutputDir();
143
+ const outputPath = _path.join.call(void 0, outputDir, `${stem}_${Date.now()}.json`);
144
+ _fs.writeFileSync.call(void 0, outputPath, JSON.stringify(payload, null, 2), "utf-8");
145
+ return outputPath;
146
+ }
147
+ function writeCsvOutputFile(rows, stem, options) {
148
+ const outputPath = _optionalChain([options, 'optionalAccess', _7 => _7.outPath]) ? options.outPath : _path.join.call(void 0, ensureOutputDir(), `${stem}_${Date.now()}.csv`);
149
+ _fs.mkdirSync.call(void 0, _path.dirname.call(void 0, outputPath), { recursive: true });
150
+ const columns = columnsForRows(rows);
151
+ const escapeCell = (value) => {
152
+ const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
153
+ if (/[",\n]/.test(normalized)) {
154
+ return `"${normalized.replace(/"/g, '""')}"`;
155
+ }
156
+ return normalized;
157
+ };
158
+ const fd = _fs.openSync.call(void 0, outputPath, "w");
159
+ try {
160
+ _fs.writeSync.call(void 0, fd, `${columns.map(escapeCell).join(",")}
161
+ `);
162
+ for (const row of rows) {
163
+ _fs.writeSync.call(void 0,
164
+ fd,
165
+ `${columns.map((column) => escapeCell(row[column])).join(",")}
166
+ `
167
+ );
168
+ }
169
+ } finally {
170
+ _fs.closeSync.call(void 0, fd);
171
+ }
172
+ const previewRows = rows.slice(0, 5);
173
+ const previewColumns = columns.slice(0, 5);
174
+ const preview = [
175
+ previewColumns.join(","),
176
+ ...previewRows.map(
177
+ (row) => previewColumns.map((column) => escapeCell(row[column])).join(",")
178
+ )
179
+ ].join("\n");
180
+ return {
181
+ path: outputPath,
182
+ rowCount: rows.length,
183
+ columns,
184
+ preview
185
+ };
186
+ }
187
+ function extractSummaryFields(payload) {
188
+ const candidates = candidateRoots(payload);
189
+ for (const candidate of candidates) {
190
+ if (!isPlainObject(candidate.value)) continue;
191
+ const summaryEntries = Object.entries(candidate.value).filter(
192
+ ([, value]) => {
193
+ return value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
194
+ }
195
+ );
196
+ if (summaryEntries.length === 0) continue;
197
+ return Object.fromEntries(summaryEntries);
198
+ }
199
+ return {};
200
+ }
201
+
202
+ // ../plays/row-identity.ts
203
+ var POSTGRES_IDENTIFIER_MAX_LENGTH = 63;
204
+ var MAP_KEY_NAMESPACE_MAX_LENGTH = POSTGRES_IDENTIFIER_MAX_LENGTH;
205
+ var SHA256_INITIAL_HASH = [
206
+ 1779033703,
207
+ 3144134277,
208
+ 1013904242,
209
+ 2773480762,
210
+ 1359893119,
211
+ 2600822924,
212
+ 528734635,
213
+ 1541459225
214
+ ];
215
+ var SHA256_ROUND_CONSTANTS = [
216
+ 1116352408,
217
+ 1899447441,
218
+ 3049323471,
219
+ 3921009573,
220
+ 961987163,
221
+ 1508970993,
222
+ 2453635748,
223
+ 2870763221,
224
+ 3624381080,
225
+ 310598401,
226
+ 607225278,
227
+ 1426881987,
228
+ 1925078388,
229
+ 2162078206,
230
+ 2614888103,
231
+ 3248222580,
232
+ 3835390401,
233
+ 4022224774,
234
+ 264347078,
235
+ 604807628,
236
+ 770255983,
237
+ 1249150122,
238
+ 1555081692,
239
+ 1996064986,
240
+ 2554220882,
241
+ 2821834349,
242
+ 2952996808,
243
+ 3210313671,
244
+ 3336571891,
245
+ 3584528711,
246
+ 113926993,
247
+ 338241895,
248
+ 666307205,
249
+ 773529912,
250
+ 1294757372,
251
+ 1396182291,
252
+ 1695183700,
253
+ 1986661051,
254
+ 2177026350,
255
+ 2456956037,
256
+ 2730485921,
257
+ 2820302411,
258
+ 3259730800,
259
+ 3345764771,
260
+ 3516065817,
261
+ 3600352804,
262
+ 4094571909,
263
+ 275423344,
264
+ 430227734,
265
+ 506948616,
266
+ 659060556,
267
+ 883997877,
268
+ 958139571,
269
+ 1322822218,
270
+ 1537002063,
271
+ 1747873779,
272
+ 1955562222,
273
+ 2024104815,
274
+ 2227730452,
275
+ 2361852424,
276
+ 2428436474,
277
+ 2756734187,
278
+ 3204031479,
279
+ 3329325298
280
+ ];
281
+ function stableValue(value) {
282
+ if (Array.isArray(value)) {
283
+ return value.map((entry) => stableValue(entry));
284
+ }
285
+ if (value && typeof value === "object") {
286
+ return Object.fromEntries(
287
+ Object.entries(value).filter(([, entry]) => entry !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => [key, stableValue(entry)])
288
+ );
289
+ }
290
+ return value;
291
+ }
292
+ function stableStringify(value) {
293
+ return JSON.stringify(stableValue(value));
294
+ }
295
+ function rightRotate32(value, bits) {
296
+ return value >>> bits | value << 32 - bits;
297
+ }
298
+ function sha256Hex(input) {
299
+ const bytes = Array.from(new TextEncoder().encode(input));
300
+ const bitLength = bytes.length * 8;
301
+ bytes.push(128);
302
+ while (bytes.length % 64 !== 56) {
303
+ bytes.push(0);
304
+ }
305
+ const highBits = Math.floor(bitLength / 4294967296);
306
+ const lowBits = bitLength >>> 0;
307
+ bytes.push(
308
+ highBits >>> 24 & 255,
309
+ highBits >>> 16 & 255,
310
+ highBits >>> 8 & 255,
311
+ highBits & 255,
312
+ lowBits >>> 24 & 255,
313
+ lowBits >>> 16 & 255,
314
+ lowBits >>> 8 & 255,
315
+ lowBits & 255
316
+ );
317
+ const hash = [...SHA256_INITIAL_HASH];
318
+ const words = new Array(64).fill(0);
319
+ for (let offset = 0; offset < bytes.length; offset += 64) {
320
+ for (let index = 0; index < 16; index += 1) {
321
+ const wordOffset = offset + index * 4;
322
+ words[index] = (_nullishCoalesce(bytes[wordOffset], () => ( 0))) << 24 | (_nullishCoalesce(bytes[wordOffset + 1], () => ( 0))) << 16 | (_nullishCoalesce(bytes[wordOffset + 2], () => ( 0))) << 8 | (_nullishCoalesce(bytes[wordOffset + 3], () => ( 0)));
323
+ }
324
+ for (let index = 16; index < 64; index += 1) {
325
+ const s0 = rightRotate32(words[index - 15], 7) ^ rightRotate32(words[index - 15], 18) ^ words[index - 15] >>> 3;
326
+ const s1 = rightRotate32(words[index - 2], 17) ^ rightRotate32(words[index - 2], 19) ^ words[index - 2] >>> 10;
327
+ words[index] = words[index - 16] + s0 + words[index - 7] + s1 >>> 0;
328
+ }
329
+ let [a, b, c, d, e, f, g, h] = hash;
330
+ for (let index = 0; index < 64; index += 1) {
331
+ const s1 = rightRotate32(e, 6) ^ rightRotate32(e, 11) ^ rightRotate32(e, 25);
332
+ const ch = e & f ^ ~e & g;
333
+ const temp1 = h + s1 + ch + SHA256_ROUND_CONSTANTS[index] + words[index] >>> 0;
334
+ const s0 = rightRotate32(a, 2) ^ rightRotate32(a, 13) ^ rightRotate32(a, 22);
335
+ const maj = a & b ^ a & c ^ b & c;
336
+ const temp2 = s0 + maj >>> 0;
337
+ h = g;
338
+ g = f;
339
+ f = e;
340
+ e = d + temp1 >>> 0;
341
+ d = c;
342
+ c = b;
343
+ b = a;
344
+ a = temp1 + temp2 >>> 0;
345
+ }
346
+ hash[0] = hash[0] + a >>> 0;
347
+ hash[1] = hash[1] + b >>> 0;
348
+ hash[2] = hash[2] + c >>> 0;
349
+ hash[3] = hash[3] + d >>> 0;
350
+ hash[4] = hash[4] + e >>> 0;
351
+ hash[5] = hash[5] + f >>> 0;
352
+ hash[6] = hash[6] + g >>> 0;
353
+ hash[7] = hash[7] + h >>> 0;
354
+ }
355
+ return hash.map((word) => word.toString(16).padStart(8, "0")).join("");
356
+ }
357
+ function sanitizeIdentifierPart(value) {
358
+ return value.trim().replace(/[^a-z0-9]+/gi, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toLowerCase();
359
+ }
360
+ function validateIdentifierPart(rawValue, label, maxLength) {
361
+ const sanitized = sanitizeIdentifierPart(rawValue);
362
+ if (!sanitized) {
363
+ throw new Error(`${label} must contain a letter or number.`);
364
+ }
365
+ if (sanitized.length > maxLength) {
366
+ throw new Error(
367
+ `${label} is too long after normalization (${sanitized.length}/${maxLength}): "${sanitized}".`
368
+ );
369
+ }
370
+ return sanitized;
371
+ }
372
+ function normalizeTableNamespace(value) {
373
+ return validateIdentifierPart(
374
+ value,
375
+ "ctx.dataset() key",
376
+ MAP_KEY_NAMESPACE_MAX_LENGTH
377
+ );
378
+ }
379
+
380
+
381
+
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+ exports.stableStringify = stableStringify; exports.sha256Hex = sha256Hex; exports.normalizeTableNamespace = normalizeTableNamespace; exports.tryConvertToList = tryConvertToList; exports.projectRowOutput = projectRowOutput; exports.writeJsonOutputFile = writeJsonOutputFile; exports.writeCsvOutputFile = writeCsvOutputFile; exports.extractSummaryFields = extractSummaryFields;