@datarails-ai/dr-appspace-cli 0.12.86 → 0.12.88
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/README.md +5 -1
- package/dist/cli.js +1094 -205
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import { fileURLToPath as fileURLToPath6 } from "url";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "@datarails-ai/dr-appspace-cli",
|
|
16
|
-
version: "0.12.
|
|
16
|
+
version: "0.12.88",
|
|
17
17
|
description: "Datarails App Space CLI \u2014 build, try, push and publish App Space apps",
|
|
18
18
|
type: "module",
|
|
19
19
|
engines: {
|
|
@@ -57,7 +57,7 @@ var package_default = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
// src/buildInfo.ts
|
|
60
|
-
var BUILD_TIME = "2026-11-
|
|
60
|
+
var BUILD_TIME = "2026-11-15T13:05:59.646Z";
|
|
61
61
|
function formatBuildTime(iso) {
|
|
62
62
|
if (iso === "") return "";
|
|
63
63
|
const d = new Date(iso);
|
|
@@ -3563,7 +3563,7 @@ async function readDirIfPresent(path3) {
|
|
|
3563
3563
|
}
|
|
3564
3564
|
async function readUiTree(uiDir) {
|
|
3565
3565
|
const out = [];
|
|
3566
|
-
const
|
|
3566
|
+
const walk6 = async (dir, prefix) => {
|
|
3567
3567
|
for (const name of (await readDirIfPresent(dir)).sort()) {
|
|
3568
3568
|
const full = join4(dir, name);
|
|
3569
3569
|
let entry;
|
|
@@ -3573,14 +3573,14 @@ async function readUiTree(uiDir) {
|
|
|
3573
3573
|
continue;
|
|
3574
3574
|
}
|
|
3575
3575
|
if (entry.isDirectory()) {
|
|
3576
|
-
await
|
|
3576
|
+
await walk6(full, `${prefix}${name}/`);
|
|
3577
3577
|
continue;
|
|
3578
3578
|
}
|
|
3579
3579
|
if (!entry.isFile()) continue;
|
|
3580
3580
|
out.push({ path: `${prefix}${name}`, bytes: await readFile(full) });
|
|
3581
3581
|
}
|
|
3582
3582
|
};
|
|
3583
|
-
await
|
|
3583
|
+
await walk6(uiDir, "");
|
|
3584
3584
|
return out.sort((a, b) => a.path < b.path ? -1 : 1);
|
|
3585
3585
|
}
|
|
3586
3586
|
async function readManifest(dir) {
|
|
@@ -3833,7 +3833,7 @@ endobj
|
|
|
3833
3833
|
0 ${String(objects.length + 1)}
|
|
3834
3834
|
0000000000 65535 f
|
|
3835
3835
|
`;
|
|
3836
|
-
for (const
|
|
3836
|
+
for (const offset2 of offsets) out += `${String(offset2).padStart(10, "0")} 00000 n
|
|
3837
3837
|
`;
|
|
3838
3838
|
out += `trailer
|
|
3839
3839
|
<< /Size ${String(objects.length + 1)} /Root 1 0 R >>
|
|
@@ -4727,8 +4727,8 @@ function parseHtml(html) {
|
|
|
4727
4727
|
let match;
|
|
4728
4728
|
while ((match = TAG.exec(html)) !== null) {
|
|
4729
4729
|
if (match[0].startsWith("<!--")) continue;
|
|
4730
|
-
const [whole,
|
|
4731
|
-
if (
|
|
4730
|
+
const [whole, closing2, rawTag, rawAttrs] = match;
|
|
4731
|
+
if (closing2) continue;
|
|
4732
4732
|
const tag = rawTag.toLowerCase();
|
|
4733
4733
|
const attrs = parseAttrs(rawAttrs);
|
|
4734
4734
|
const line2 = lineAt(html, match.index);
|
|
@@ -4771,9 +4771,9 @@ function parseTree(html) {
|
|
|
4771
4771
|
let match;
|
|
4772
4772
|
while ((match = TAG.exec(html)) !== null) {
|
|
4773
4773
|
if (match[0].startsWith("<!--")) continue;
|
|
4774
|
-
const [whole,
|
|
4774
|
+
const [whole, closing2, rawTag, rawAttrs, selfClosed] = match;
|
|
4775
4775
|
const tag = rawTag.toLowerCase();
|
|
4776
|
-
if (
|
|
4776
|
+
if (closing2) {
|
|
4777
4777
|
const top = stack[stack.length - 1];
|
|
4778
4778
|
if (top === void 0 || nodes[top].tag !== tag) {
|
|
4779
4779
|
wellFormed = false;
|
|
@@ -7293,15 +7293,15 @@ function inputTypeOf(node) {
|
|
|
7293
7293
|
}
|
|
7294
7294
|
function optionsOf(node, text4, tree) {
|
|
7295
7295
|
const options = [];
|
|
7296
|
-
const
|
|
7296
|
+
const walk6 = (index) => {
|
|
7297
7297
|
for (const child of tree.nodes[index].children) {
|
|
7298
7298
|
const candidate = tree.nodes[child];
|
|
7299
7299
|
if (candidate.tag === "option") {
|
|
7300
7300
|
if (!("disabled" in candidate.attrs)) options.push(candidate.attrs.value ?? textOf(text4, candidate));
|
|
7301
|
-
} else
|
|
7301
|
+
} else walk6(child);
|
|
7302
7302
|
}
|
|
7303
7303
|
};
|
|
7304
|
-
|
|
7304
|
+
walk6(node.index);
|
|
7305
7305
|
return options;
|
|
7306
7306
|
}
|
|
7307
7307
|
function splitList(value) {
|
|
@@ -7320,14 +7320,14 @@ function textOf(text4, node) {
|
|
|
7320
7320
|
function slotsOf(node, tree) {
|
|
7321
7321
|
if (!(WIDGET_ATTR in node.attrs)) return {};
|
|
7322
7322
|
const slots = {};
|
|
7323
|
-
const
|
|
7323
|
+
const walk6 = (index) => {
|
|
7324
7324
|
for (const child of tree.nodes[index].children) {
|
|
7325
7325
|
const kind = classify(tree.nodes[child]);
|
|
7326
7326
|
if (kind?.type === "slot") slots[kind.role] = kind.role === "body" ? classesOf(tree.nodes[child])[0] ?? true : true;
|
|
7327
|
-
else
|
|
7327
|
+
else walk6(child);
|
|
7328
7328
|
}
|
|
7329
7329
|
};
|
|
7330
|
-
|
|
7330
|
+
walk6(node.index);
|
|
7331
7331
|
return slots;
|
|
7332
7332
|
}
|
|
7333
7333
|
function bindingOf(entry, node, spec) {
|
|
@@ -8068,15 +8068,15 @@ function hasCycle(tables) {
|
|
|
8068
8068
|
}
|
|
8069
8069
|
}
|
|
8070
8070
|
const state = /* @__PURE__ */ new Map();
|
|
8071
|
-
const
|
|
8071
|
+
const walk6 = (name) => {
|
|
8072
8072
|
if (state.get(name) === "done") return false;
|
|
8073
8073
|
if (state.get(name) === "open") return true;
|
|
8074
8074
|
state.set(name, "open");
|
|
8075
|
-
for (const next of graph.get(name) ?? []) if (
|
|
8075
|
+
for (const next of graph.get(name) ?? []) if (walk6(next)) return true;
|
|
8076
8076
|
state.set(name, "done");
|
|
8077
8077
|
return false;
|
|
8078
8078
|
};
|
|
8079
|
-
return [...graph.keys()].some((name) =>
|
|
8079
|
+
return [...graph.keys()].some((name) => walk6(name));
|
|
8080
8080
|
}
|
|
8081
8081
|
function byProblem(a, b) {
|
|
8082
8082
|
return natural3(a.code, b.code) || natural3(a.where ?? "", b.where ?? "") || natural3(a.message, b.message);
|
|
@@ -9613,16 +9613,16 @@ function payloadProducers(contract, { moduleSource = () => void 0, pageSource =
|
|
|
9613
9613
|
};
|
|
9614
9614
|
const fieldsUnder = (uid) => {
|
|
9615
9615
|
const fields = [];
|
|
9616
|
-
const
|
|
9616
|
+
const walk6 = (at) => {
|
|
9617
9617
|
for (const child of children.get(at) ?? []) {
|
|
9618
9618
|
const element = elements[child];
|
|
9619
9619
|
const field = fieldOf(element);
|
|
9620
9620
|
if (field !== null && !fields.includes(field)) fields.push(field);
|
|
9621
9621
|
if (element?.type === "form" || element?.type === "dialog") continue;
|
|
9622
|
-
|
|
9622
|
+
walk6(child);
|
|
9623
9623
|
}
|
|
9624
9624
|
};
|
|
9625
|
-
|
|
9625
|
+
walk6(uid);
|
|
9626
9626
|
return fields;
|
|
9627
9627
|
};
|
|
9628
9628
|
for (const uid of Object.keys(elements).sort()) {
|
|
@@ -10865,20 +10865,20 @@ function untitledCards(contract) {
|
|
|
10865
10865
|
if (page?.owned === true) continue;
|
|
10866
10866
|
const seen = /* @__PURE__ */ new Set();
|
|
10867
10867
|
const drawn2 = [];
|
|
10868
|
-
const
|
|
10868
|
+
const walk6 = (uids) => {
|
|
10869
10869
|
for (const uid of uids) {
|
|
10870
10870
|
const element = elements[uid];
|
|
10871
10871
|
if (element === void 0 || seen.has(uid)) continue;
|
|
10872
10872
|
seen.add(uid);
|
|
10873
10873
|
if (LAYOUT.has(element.type ?? "")) {
|
|
10874
10874
|
const children = element.children?.length ? element.children : Object.keys(elements).filter((other) => elements[other]?.parent === uid);
|
|
10875
|
-
|
|
10875
|
+
walk6(children);
|
|
10876
10876
|
} else {
|
|
10877
10877
|
drawn2.push(uid);
|
|
10878
10878
|
}
|
|
10879
10879
|
}
|
|
10880
10880
|
};
|
|
10881
|
-
|
|
10881
|
+
walk6(rootsOf(contract, page));
|
|
10882
10882
|
for (const uid of drawn2) {
|
|
10883
10883
|
const element = elements[uid];
|
|
10884
10884
|
const type = element.type ?? "";
|
|
@@ -11971,12 +11971,12 @@ function shelf(path3, kit, charts, contract, problems) {
|
|
|
11971
11971
|
};
|
|
11972
11972
|
}
|
|
11973
11973
|
function appbar(page, elements) {
|
|
11974
|
-
const
|
|
11975
|
-
const summary = typeof
|
|
11974
|
+
const header2 = isPlainObject7(page.header) ? page.header : { title: page.title ?? "", summary: null };
|
|
11975
|
+
const summary = typeof header2.summary === "string" && header2.summary !== "" ? `${text(header2.summary)} ` : "";
|
|
11976
11976
|
return [
|
|
11977
11977
|
`<header class="${classesOf2(elements, "region", "header", ["dr-appbar"])}" data-dr-kit="header">`,
|
|
11978
11978
|
' <div class="dr-appbar__text">',
|
|
11979
|
-
` <h1 class="dr-appbar__title">${text(
|
|
11979
|
+
` <h1 class="dr-appbar__title">${text(header2.title ?? "")}</h1>`,
|
|
11980
11980
|
// The "as of" slot is filled from the payload's own `fetched_at`, so chrome
|
|
11981
11981
|
// that states a time cannot go stale.
|
|
11982
11982
|
` <p class="dr-appbar__summary">`,
|
|
@@ -12301,11 +12301,11 @@ function restateDashboard(composed, pages, handlerName, handler, { refuse: refus
|
|
|
12301
12301
|
}
|
|
12302
12302
|
return uids[0];
|
|
12303
12303
|
};
|
|
12304
|
-
const
|
|
12304
|
+
const header2 = onlyOne(regions("header"), "header region") ?? fresh();
|
|
12305
12305
|
const chrome = HEADER_CHROME.map((role) => onlyOne(regions(role), `${role} region`) ?? fresh());
|
|
12306
|
-
elements[
|
|
12306
|
+
elements[header2] = region(header2, "header", "header", chrome);
|
|
12307
12307
|
chrome.forEach((uid, index) => {
|
|
12308
|
-
elements[uid] = region(uid, HEADER_CHROME[index], "section", [],
|
|
12308
|
+
elements[uid] = region(uid, HEADER_CHROME[index], "section", [], header2);
|
|
12309
12309
|
});
|
|
12310
12310
|
let nav = onlyOne(own2.filter((uid) => typed[uid].type === "nav"), "nav");
|
|
12311
12311
|
const bar = bars.get(path3);
|
|
@@ -12383,7 +12383,7 @@ function restateDashboard(composed, pages, handlerName, handler, { refuse: refus
|
|
|
12383
12383
|
const sections = sectionsOf(page);
|
|
12384
12384
|
const cards = own2.filter((uid) => typed[uid].type === "widget");
|
|
12385
12385
|
const dropped = new Set(own2.filter((uid) => DROPPED.has(typed[uid].type) || typed[uid].type === "region" && DROPPED_REGIONS.has(typed[uid].role ?? "header")));
|
|
12386
|
-
const handled = /* @__PURE__ */ new Set([
|
|
12386
|
+
const handled = /* @__PURE__ */ new Set([header2, ...chrome, filters, ...nav === void 0 ? [] : [nav, ...elements[nav].children], ...parts, ...cards]);
|
|
12387
12387
|
const kept = own2.filter((uid) => !handled.has(uid) && !dropped.has(uid) && !["region", "nav", "tab", "control", "widget"].includes(typed[uid].type));
|
|
12388
12388
|
for (const uid of kept) {
|
|
12389
12389
|
if (conflicts.has(uid)) refuse2(conflicts.get(uid).code, conflicts.get(uid).pointer, conflicts.get(uid).message);
|
|
@@ -12400,7 +12400,7 @@ function restateDashboard(composed, pages, handlerName, handler, { refuse: refus
|
|
|
12400
12400
|
const indexOfSection = (uid) => sections.findIndex((entry) => entry.id === elements[uid]?.section);
|
|
12401
12401
|
const ownRoots = [...parts, ...kept.filter((uid) => elements[uid].parent === null), ...otherRegions].sort((a, b) => rank(a) - rank(b) || natural3(a, b));
|
|
12402
12402
|
const rankedCards = cards.filter((uid) => elements[uid].parent === null).sort((a, b) => indexOfSection(a) - indexOfSection(b) || orderOf(typed[a]) - orderOf(typed[b]) || natural3(a, b));
|
|
12403
|
-
const tree = [
|
|
12403
|
+
const tree = [header2, ...nav === void 0 ? [] : [nav], filters, ...ownRoots, ...rankedCards];
|
|
12404
12404
|
for (const root of tree) inheritSection(root, elements);
|
|
12405
12405
|
const route = routeOf2(app, path3);
|
|
12406
12406
|
const authored = stated2.findIndex((one) => isPlainObject8(one) && one.path === path3);
|
|
@@ -12667,15 +12667,15 @@ function routeOf2(app, path3) {
|
|
|
12667
12667
|
return null;
|
|
12668
12668
|
}
|
|
12669
12669
|
function pageOf(page, tree, params, handlerName, app, sections, route) {
|
|
12670
|
-
const
|
|
12670
|
+
const header2 = isPlainObject8(page.header) ? page.header : {};
|
|
12671
12671
|
const mount = isPlainObject8(page.mount) ? page.mount : {};
|
|
12672
12672
|
const out = {
|
|
12673
12673
|
path: page.path,
|
|
12674
12674
|
route,
|
|
12675
12675
|
title: String(page.title ?? app.name ?? page.path),
|
|
12676
12676
|
header: {
|
|
12677
|
-
title: named5(
|
|
12678
|
-
summary: named5(
|
|
12677
|
+
title: named5(header2.title) ? header2.title : shortTitle(page, named5(app.name) ? app.name : ""),
|
|
12678
|
+
summary: named5(header2.summary) ? header2.summary : null
|
|
12679
12679
|
},
|
|
12680
12680
|
sections,
|
|
12681
12681
|
scripts: [],
|
|
@@ -13006,15 +13006,15 @@ function parseFormula(text4) {
|
|
|
13006
13006
|
}
|
|
13007
13007
|
function formulaNames(node) {
|
|
13008
13008
|
const out = /* @__PURE__ */ new Set();
|
|
13009
|
-
const
|
|
13009
|
+
const walk6 = (one) => {
|
|
13010
13010
|
if (one[0] === "name") out.add(one[1]);
|
|
13011
|
-
else if (one[0] === "neg")
|
|
13011
|
+
else if (one[0] === "neg") walk6(one[1]);
|
|
13012
13012
|
else if (one[0] === "bin" || one[0] === "cmp") {
|
|
13013
|
-
|
|
13014
|
-
|
|
13015
|
-
} else if (one[0] === "fn") one[2].forEach(
|
|
13013
|
+
walk6(one[2]);
|
|
13014
|
+
walk6(one[3]);
|
|
13015
|
+
} else if (one[0] === "fn") one[2].forEach(walk6);
|
|
13016
13016
|
};
|
|
13017
|
-
|
|
13017
|
+
walk6(node);
|
|
13018
13018
|
return out;
|
|
13019
13019
|
}
|
|
13020
13020
|
function takesAnOperand(node) {
|
|
@@ -13134,10 +13134,10 @@ function timeModifierProblem(mod) {
|
|
|
13134
13134
|
const shift = SHIFT_RE.exec(mod);
|
|
13135
13135
|
if (shift) {
|
|
13136
13136
|
const unit = shift[1].toLowerCase();
|
|
13137
|
-
const
|
|
13137
|
+
const offset2 = Number(shift[2]);
|
|
13138
13138
|
if (!SHIFT_UNITS.includes(unit)) return `has an invalid SHIFT unit "${shift[1]}" (valid: ${SHIFT_UNITS.join(", ")})`;
|
|
13139
|
-
if (
|
|
13140
|
-
if (Math.abs(
|
|
13139
|
+
if (offset2 > 0) return `has a future SHIFT offset ${shift[2]}; the offset must be negative or zero (e.g. SHIFT(${unit}, -1))`;
|
|
13140
|
+
if (Math.abs(offset2) > MAX_SHIFT_OFFSET_MAGNITUDE) {
|
|
13141
13141
|
return `has a SHIFT offset ${shift[2]} whose magnitude exceeds the server maximum of ${MAX_SHIFT_OFFSET_MAGNITUDE}; use a smaller offset`;
|
|
13142
13142
|
}
|
|
13143
13143
|
return null;
|
|
@@ -13263,8 +13263,8 @@ function scan(formula, declared, pinned = false) {
|
|
|
13263
13263
|
if (pinned && working.includes("|")) {
|
|
13264
13264
|
refuse(`pins a scenario other than ${CALCULATION_PIN}, or pins no operand; a calculation pins an operand to ${CALCULATION_PIN} only, written [@key] | ${CALCULATION_PIN} before its modifier ([@revenue] | ${CALCULATION_PIN}.SHIFT(year, -1))`);
|
|
13265
13265
|
}
|
|
13266
|
-
working = working.replace(SYSTEM_VARIABLE_RE, (token,
|
|
13267
|
-
if (/^\s*\.(?:SHIFT|AS_OF)\(/i.test(whole.slice(
|
|
13266
|
+
working = working.replace(SYSTEM_VARIABLE_RE, (token, offset2, whole) => {
|
|
13267
|
+
if (/^\s*\.(?:SHIFT|AS_OF)\(/i.test(whole.slice(offset2 + token.length))) refuse(modifierOnSystemVariable(token));
|
|
13268
13268
|
return put({ kind: "token", token });
|
|
13269
13269
|
});
|
|
13270
13270
|
if (working.includes("[") || working.includes("]")) refuse("has unbalanced bracket(s); each operand must be wrapped as [@key]");
|
|
@@ -13635,8 +13635,8 @@ function httpProblems(http) {
|
|
|
13635
13635
|
for (const key of ["header", "prefix"]) {
|
|
13636
13636
|
if (Object.hasOwn(entry, key) && secret === null) say(`${at}/${key}`, `${label}.${key} needs ${label}.secret`);
|
|
13637
13637
|
}
|
|
13638
|
-
const
|
|
13639
|
-
if (
|
|
13638
|
+
const header2 = entry.header ?? null;
|
|
13639
|
+
if (header2 !== null && (typeof header2 !== "string" || !HTTP_HEADER_NAME_RE.test(header2) || httpHeaderReserved(header2))) {
|
|
13640
13640
|
say(`${at}/header`, `${label}.header must be an HTTP header name that is not a transport, cookie or proxy header`);
|
|
13641
13641
|
}
|
|
13642
13642
|
const prefix = entry.prefix ?? null;
|
|
@@ -13928,9 +13928,9 @@ function readsMetric(read) {
|
|
|
13928
13928
|
function readTables(contract) {
|
|
13929
13929
|
const tables = [];
|
|
13930
13930
|
const aliased = [];
|
|
13931
|
-
const
|
|
13931
|
+
const walk6 = (node, pointer2) => {
|
|
13932
13932
|
if (Array.isArray(node)) {
|
|
13933
|
-
node.forEach((one, index) =>
|
|
13933
|
+
node.forEach((one, index) => walk6(one, `${pointer2}/${index}`));
|
|
13934
13934
|
return;
|
|
13935
13935
|
}
|
|
13936
13936
|
if (!isPlainObject9(node)) return;
|
|
@@ -13940,9 +13940,9 @@ function readTables(contract) {
|
|
|
13940
13940
|
if (id === null && named5(node.table_alias)) aliased.push(pointer2);
|
|
13941
13941
|
return;
|
|
13942
13942
|
}
|
|
13943
|
-
for (const key of Object.keys(node).sort(natural3))
|
|
13943
|
+
for (const key of Object.keys(node).sort(natural3)) walk6(node[key], `${pointer2}/${escapePointer3(key)}`);
|
|
13944
13944
|
};
|
|
13945
|
-
|
|
13945
|
+
walk6(contract?.data, "/data");
|
|
13946
13946
|
return { tables, aliased };
|
|
13947
13947
|
}
|
|
13948
13948
|
function tableIdOf(value) {
|
|
@@ -15122,7 +15122,7 @@ function tokenValueProblem(value) {
|
|
|
15122
15122
|
if (value.includes("\\")) return "holds a backslash, which escapes what follows it";
|
|
15123
15123
|
if (value.includes("<")) return "holds <, which no CSS value needs";
|
|
15124
15124
|
if (/url\s*\(/i.test(value)) return "holds url(, and a theme loads nothing";
|
|
15125
|
-
const
|
|
15125
|
+
const closing2 = { ")": "(", "]": "[" };
|
|
15126
15126
|
const open3 = [];
|
|
15127
15127
|
let quote = null;
|
|
15128
15128
|
for (const ch of value) {
|
|
@@ -15132,7 +15132,7 @@ function tokenValueProblem(value) {
|
|
|
15132
15132
|
}
|
|
15133
15133
|
if (ch === '"' || ch === "'") quote = ch;
|
|
15134
15134
|
else if (ch === "(" || ch === "[") open3.push(ch);
|
|
15135
|
-
else if (ch in
|
|
15135
|
+
else if (ch in closing2 && open3.pop() !== closing2[ch]) return "holds an unbalanced bracket";
|
|
15136
15136
|
}
|
|
15137
15137
|
if (quote !== null) return "holds an unbalanced quote";
|
|
15138
15138
|
if (open3.length > 0) return "holds an unbalanced bracket";
|
|
@@ -16011,19 +16011,19 @@ function hoistHeaderActions(pages, elements) {
|
|
|
16011
16011
|
let outPages = pages;
|
|
16012
16012
|
for (const [pageIndex, page] of pages.entries()) {
|
|
16013
16013
|
if (page?.owned === true || !Array.isArray(page?.header?.actions) || page.header.actions.length === 0) continue;
|
|
16014
|
-
const
|
|
16015
|
-
if (
|
|
16014
|
+
const header2 = Object.keys(elements).sort(natural3).find((uid) => elements[uid].page === page.path && elements[uid].type === "region" && (elements[uid].role ?? "header") === "header");
|
|
16015
|
+
if (header2 === void 0) continue;
|
|
16016
16016
|
const moved = [];
|
|
16017
16017
|
for (const id of page.header.actions) {
|
|
16018
16018
|
const uid = Object.keys(elements).sort(natural3).find((one) => elements[one].page === page.path && elements[one].type !== "region" && (named5(elements[one].props?.id) ? elements[one].props.id : elements[one].id) === id);
|
|
16019
16019
|
if (uid !== void 0 && !moved.includes(uid)) moved.push(uid);
|
|
16020
16020
|
}
|
|
16021
|
-
const region = out[
|
|
16022
|
-
const already = moved.every((uid) => out[uid].parent ===
|
|
16021
|
+
const region = out[header2];
|
|
16022
|
+
const already = moved.every((uid) => out[uid].parent === header2 && out[uid].section === "header") && JSON.stringify(region.children ?? []) === JSON.stringify(moved);
|
|
16023
16023
|
if (moved.length === 0 || already) continue;
|
|
16024
16024
|
if (out === elements) out = { ...elements };
|
|
16025
|
-
for (const uid of moved) out[uid] = { ...out[uid], parent:
|
|
16026
|
-
out[
|
|
16025
|
+
for (const uid of moved) out[uid] = { ...out[uid], parent: header2, section: "header" };
|
|
16026
|
+
out[header2] = { ...region, children: moved };
|
|
16027
16027
|
if (Array.isArray(page.tree) && page.tree.some((uid) => moved.includes(uid))) {
|
|
16028
16028
|
if (outPages === pages) outPages = [...pages];
|
|
16029
16029
|
outPages[pageIndex] = { ...page, tree: page.tree.filter((uid) => !moved.includes(uid)) };
|
|
@@ -16650,8 +16650,8 @@ function numberPinProblems(elements, pins) {
|
|
|
16650
16650
|
const pin = pins[module];
|
|
16651
16651
|
if (typeof pin !== "string" || drawsPlatformNumbers(pin)) continue;
|
|
16652
16652
|
const need = typeof PLATFORM_NUMBERS2[module] === "string" ? `${module}@${PLATFORM_NUMBERS2[module]}` : `a ${module} release that draws it`;
|
|
16653
|
-
const
|
|
16654
|
-
if (Array.isArray(node)) return node.forEach((child, i) =>
|
|
16653
|
+
const walk6 = (node, at) => {
|
|
16654
|
+
if (Array.isArray(node)) return node.forEach((child, i) => walk6(child, `${at}/${i}`));
|
|
16655
16655
|
if (!isPlainObject9(node)) return;
|
|
16656
16656
|
for (const [key, value] of Object.entries(node)) {
|
|
16657
16657
|
const pointer2 = `${at}/${escapePointer3(key)}`;
|
|
@@ -16662,10 +16662,10 @@ function numberPinProblems(elements, pins) {
|
|
|
16662
16662
|
});
|
|
16663
16663
|
if (key === "format" && isPlatformFormat(value)) say(`format ${JSON.stringify(value)}`);
|
|
16664
16664
|
else if (key === "negative" && value !== void 0 && value !== null) say(`negative ${JSON.stringify(value)}`);
|
|
16665
|
-
else
|
|
16665
|
+
else walk6(value, pointer2);
|
|
16666
16666
|
}
|
|
16667
16667
|
};
|
|
16668
|
-
|
|
16668
|
+
walk6(element.props ?? {}, `/elements/${escapePointer3(uid)}/props`);
|
|
16669
16669
|
}
|
|
16670
16670
|
return problems;
|
|
16671
16671
|
}
|
|
@@ -19499,11 +19499,11 @@ function nodeLines(uid, contract, page, elements, tree, model, depth) {
|
|
|
19499
19499
|
switch (element.type) {
|
|
19500
19500
|
case "region": {
|
|
19501
19501
|
if ((element.role ?? "header") !== "header") return [`${pad}<section data-dr-kit="${attr2(element.role ?? "")}"></section>`];
|
|
19502
|
-
const
|
|
19503
|
-
const heading = named5(
|
|
19504
|
-
const lede = named5(
|
|
19505
|
-
const actions = Array.isArray(
|
|
19506
|
-
const from = named5(
|
|
19502
|
+
const header2 = page.header ?? {};
|
|
19503
|
+
const heading = named5(header2.title) ? header2.title : shortTitle(page, contract.app?.name ?? "");
|
|
19504
|
+
const lede = named5(header2.summary) ? `<p>${text2(header2.summary)}</p>` : "";
|
|
19505
|
+
const actions = Array.isArray(header2.actions) && header2.actions.length > 0 ? ` data-dr-header-actions="${attr2(JSON.stringify(header2.actions))}"` : "";
|
|
19506
|
+
const from = named5(header2.title_from) ? ` data-dr-title-from="${attr2(header2.title_from)}"` : "";
|
|
19507
19507
|
const open3 = `${pad}<header data-dr-kit="header"${gridAttrs(element)}${actions}${from}><h1>${text2(heading)}</h1>${lede}`;
|
|
19508
19508
|
if (kids.length === 0) return [`${open3}</header>`];
|
|
19509
19509
|
return [open3, ...kids.flatMap((child) => nodeLines(child, contract, page, elements, tree, model, depth + 1)), `${pad}</header>`];
|
|
@@ -27305,9 +27305,9 @@ function rootTokens(css) {
|
|
|
27305
27305
|
const out = /* @__PURE__ */ new Map();
|
|
27306
27306
|
const text4 = css.replace(/\/\*[\s\S]*?\*\//g, (hit) => hit.replace(/[^\n]/g, " "));
|
|
27307
27307
|
for (const block of text4.matchAll(/:root\s*\{([^}]*)\}/g)) {
|
|
27308
|
-
const
|
|
27308
|
+
const offset2 = block.index + block[0].indexOf("{");
|
|
27309
27309
|
for (const hit of block[1].matchAll(/(--dr-[a-z0-9-]+)\s*:\s*([^;]+);/g)) {
|
|
27310
|
-
out.set(hit[1], { value: hit[2].trim(), line: lineOf(text4,
|
|
27310
|
+
out.set(hit[1], { value: hit[2].trim(), line: lineOf(text4, offset2 + hit.index) });
|
|
27311
27311
|
}
|
|
27312
27312
|
}
|
|
27313
27313
|
return out;
|
|
@@ -27598,8 +27598,8 @@ function parseHtml2(html) {
|
|
|
27598
27598
|
let match;
|
|
27599
27599
|
while ((match = TAG2.exec(html)) !== null) {
|
|
27600
27600
|
if (match[0].startsWith("<!--")) continue;
|
|
27601
|
-
const [whole,
|
|
27602
|
-
if (
|
|
27601
|
+
const [whole, closing2, rawTag, rawAttrs] = match;
|
|
27602
|
+
if (closing2) continue;
|
|
27603
27603
|
const tag = rawTag.toLowerCase();
|
|
27604
27604
|
const attrs = parseAttrs2(rawAttrs);
|
|
27605
27605
|
const line2 = lineAt2(html, match.index);
|
|
@@ -27642,9 +27642,9 @@ function parseTree2(html) {
|
|
|
27642
27642
|
let match;
|
|
27643
27643
|
while ((match = TAG2.exec(html)) !== null) {
|
|
27644
27644
|
if (match[0].startsWith("<!--")) continue;
|
|
27645
|
-
const [whole,
|
|
27645
|
+
const [whole, closing2, rawTag, rawAttrs, selfClosed] = match;
|
|
27646
27646
|
const tag = rawTag.toLowerCase();
|
|
27647
|
-
if (
|
|
27647
|
+
if (closing2) {
|
|
27648
27648
|
const top = stack[stack.length - 1];
|
|
27649
27649
|
if (top === void 0 || nodes[top].tag !== tag) {
|
|
27650
27650
|
wellFormed = false;
|
|
@@ -29222,15 +29222,15 @@ function inputTypeOf2(node) {
|
|
|
29222
29222
|
}
|
|
29223
29223
|
function optionsOf2(node, text4, tree) {
|
|
29224
29224
|
const options = [];
|
|
29225
|
-
const
|
|
29225
|
+
const walk6 = (index) => {
|
|
29226
29226
|
for (const child of tree.nodes[index].children) {
|
|
29227
29227
|
const candidate = tree.nodes[child];
|
|
29228
29228
|
if (candidate.tag === "option") {
|
|
29229
29229
|
if (!("disabled" in candidate.attrs)) options.push(candidate.attrs.value ?? textOf2(text4, candidate));
|
|
29230
|
-
} else
|
|
29230
|
+
} else walk6(child);
|
|
29231
29231
|
}
|
|
29232
29232
|
};
|
|
29233
|
-
|
|
29233
|
+
walk6(node.index);
|
|
29234
29234
|
return options;
|
|
29235
29235
|
}
|
|
29236
29236
|
function splitList2(value) {
|
|
@@ -29249,14 +29249,14 @@ function textOf2(text4, node) {
|
|
|
29249
29249
|
function slotsOf2(node, tree) {
|
|
29250
29250
|
if (!(WIDGET_ATTR2 in node.attrs)) return {};
|
|
29251
29251
|
const slots = {};
|
|
29252
|
-
const
|
|
29252
|
+
const walk6 = (index) => {
|
|
29253
29253
|
for (const child of tree.nodes[index].children) {
|
|
29254
29254
|
const kind = classify3(tree.nodes[child]);
|
|
29255
29255
|
if (kind?.type === "slot") slots[kind.role] = kind.role === "body" ? classesOf3(tree.nodes[child])[0] ?? true : true;
|
|
29256
|
-
else
|
|
29256
|
+
else walk6(child);
|
|
29257
29257
|
}
|
|
29258
29258
|
};
|
|
29259
|
-
|
|
29259
|
+
walk6(node.index);
|
|
29260
29260
|
return slots;
|
|
29261
29261
|
}
|
|
29262
29262
|
function bindingOf2(entry, node, spec) {
|
|
@@ -29986,15 +29986,15 @@ function hasCycle2(tables) {
|
|
|
29986
29986
|
}
|
|
29987
29987
|
}
|
|
29988
29988
|
const state = /* @__PURE__ */ new Map();
|
|
29989
|
-
const
|
|
29989
|
+
const walk6 = (name) => {
|
|
29990
29990
|
if (state.get(name) === "done") return false;
|
|
29991
29991
|
if (state.get(name) === "open") return true;
|
|
29992
29992
|
state.set(name, "open");
|
|
29993
|
-
for (const next of graph.get(name) ?? []) if (
|
|
29993
|
+
for (const next of graph.get(name) ?? []) if (walk6(next)) return true;
|
|
29994
29994
|
state.set(name, "done");
|
|
29995
29995
|
return false;
|
|
29996
29996
|
};
|
|
29997
|
-
return [...graph.keys()].some((name) =>
|
|
29997
|
+
return [...graph.keys()].some((name) => walk6(name));
|
|
29998
29998
|
}
|
|
29999
29999
|
function byProblem3(a, b) {
|
|
30000
30000
|
return natural5(a.code, b.code) || natural5(a.where ?? "", b.where ?? "") || natural5(a.message, b.message);
|
|
@@ -30554,16 +30554,16 @@ function payloadProducers2(contract, { moduleSource = () => void 0, pageSource =
|
|
|
30554
30554
|
};
|
|
30555
30555
|
const fieldsUnder = (uid) => {
|
|
30556
30556
|
const fields = [];
|
|
30557
|
-
const
|
|
30557
|
+
const walk6 = (at) => {
|
|
30558
30558
|
for (const child of children.get(at) ?? []) {
|
|
30559
30559
|
const element = elements[child];
|
|
30560
30560
|
const field = fieldOf2(element);
|
|
30561
30561
|
if (field !== null && !fields.includes(field)) fields.push(field);
|
|
30562
30562
|
if (element?.type === "form" || element?.type === "dialog") continue;
|
|
30563
|
-
|
|
30563
|
+
walk6(child);
|
|
30564
30564
|
}
|
|
30565
30565
|
};
|
|
30566
|
-
|
|
30566
|
+
walk6(uid);
|
|
30567
30567
|
return fields;
|
|
30568
30568
|
};
|
|
30569
30569
|
for (const uid of Object.keys(elements).sort()) {
|
|
@@ -31625,20 +31625,20 @@ function untitledCards2(contract) {
|
|
|
31625
31625
|
if (page?.owned === true) continue;
|
|
31626
31626
|
const seen = /* @__PURE__ */ new Set();
|
|
31627
31627
|
const drawn2 = [];
|
|
31628
|
-
const
|
|
31628
|
+
const walk6 = (uids) => {
|
|
31629
31629
|
for (const uid of uids) {
|
|
31630
31630
|
const element = elements[uid];
|
|
31631
31631
|
if (element === void 0 || seen.has(uid)) continue;
|
|
31632
31632
|
seen.add(uid);
|
|
31633
31633
|
if (LAYOUT2.has(element.type ?? "")) {
|
|
31634
31634
|
const children = element.children?.length ? element.children : Object.keys(elements).filter((other) => elements[other]?.parent === uid);
|
|
31635
|
-
|
|
31635
|
+
walk6(children);
|
|
31636
31636
|
} else {
|
|
31637
31637
|
drawn2.push(uid);
|
|
31638
31638
|
}
|
|
31639
31639
|
}
|
|
31640
31640
|
};
|
|
31641
|
-
|
|
31641
|
+
walk6(rootsOf3(contract, page));
|
|
31642
31642
|
for (const uid of drawn2) {
|
|
31643
31643
|
const element = elements[uid];
|
|
31644
31644
|
const type = element.type ?? "";
|
|
@@ -32226,9 +32226,9 @@ function rootTokens2(css) {
|
|
|
32226
32226
|
const out = /* @__PURE__ */ new Map();
|
|
32227
32227
|
const text4 = css.replace(/\/\*[\s\S]*?\*\//g, (hit) => hit.replace(/[^\n]/g, " "));
|
|
32228
32228
|
for (const block of text4.matchAll(/:root\s*\{([^}]*)\}/g)) {
|
|
32229
|
-
const
|
|
32229
|
+
const offset2 = block.index + block[0].indexOf("{");
|
|
32230
32230
|
for (const hit of block[1].matchAll(/(--dr-[a-z0-9-]+)\s*:\s*([^;]+);/g)) {
|
|
32231
|
-
out.set(hit[1], { value: hit[2].trim(), line: lineOf2(text4,
|
|
32231
|
+
out.set(hit[1], { value: hit[2].trim(), line: lineOf2(text4, offset2 + hit.index) });
|
|
32232
32232
|
}
|
|
32233
32233
|
}
|
|
32234
32234
|
return out;
|
|
@@ -32507,7 +32507,7 @@ function checkUx(app, contract, contractError) {
|
|
|
32507
32507
|
return out;
|
|
32508
32508
|
};
|
|
32509
32509
|
const nameOf5 = (uid) => said(elements[uid]?.props?.id) ?? said(elements[uid]?.id) ?? uid;
|
|
32510
|
-
const
|
|
32510
|
+
const tableOf5 = (el) => said(el?.props?.entity) ?? said(handlers[el?.props?.source]?.table);
|
|
32511
32511
|
const violations = [];
|
|
32512
32512
|
for (const uid of uids) {
|
|
32513
32513
|
const el = elements[uid];
|
|
@@ -32517,7 +32517,7 @@ function checkUx(app, contract, contractError) {
|
|
|
32517
32517
|
if (!table || handlers[el.props?.action]?.role === "save") continue;
|
|
32518
32518
|
const listing = uids.find((other) => {
|
|
32519
32519
|
const o = elements[other];
|
|
32520
|
-
return o?.page === el.page && ROWS.has(o.type) &&
|
|
32520
|
+
return o?.page === el.page && ROWS.has(o.type) && tableOf5(o) === table && !ancestors(other).some((up) => up.type === "detail");
|
|
32521
32521
|
});
|
|
32522
32522
|
if (!listing) continue;
|
|
32523
32523
|
const label = said(el.props?.label) ?? "New";
|
|
@@ -32534,7 +32534,7 @@ function checkUx(app, contract, contractError) {
|
|
|
32534
32534
|
const el = elements[uid];
|
|
32535
32535
|
if (!ROWS.has(el?.type)) continue;
|
|
32536
32536
|
if (ancestors(uid).some((up) => up.type === "detail")) continue;
|
|
32537
|
-
const table =
|
|
32537
|
+
const table = tableOf5(el);
|
|
32538
32538
|
if (!table || table.startsWith("_") || !isPlainObject17(tables[table]?.columns) || tables[table].singleton === true) continue;
|
|
32539
32539
|
const columns = tables[table].columns;
|
|
32540
32540
|
const pk = Object.keys(columns).find((c) => isPlainObject17(columns[c]) && columns[c].pk === true) ?? "id";
|
|
@@ -32575,7 +32575,7 @@ function checkUx(app, contract, contractError) {
|
|
|
32575
32575
|
for (const uid of uids) {
|
|
32576
32576
|
const el = elements[uid];
|
|
32577
32577
|
if (!ROWS.has(el?.type) || el.type === "data_grid") continue;
|
|
32578
|
-
const table =
|
|
32578
|
+
const table = tableOf5(el);
|
|
32579
32579
|
const columns = isPlainObject17(tables[table]?.columns) ? tables[table].columns : {};
|
|
32580
32580
|
const state = STATE_COLUMNS.find((c) => isPlainObject17(columns[c]) && Array.isArray(columns[c].enum));
|
|
32581
32581
|
const seen = /* @__PURE__ */ new Map();
|
|
@@ -34642,9 +34642,9 @@ function livenessLine(report) {
|
|
|
34642
34642
|
return `liveness: not checked \u2014 ${live.skipped.join("; ") || "no reason given"}
|
|
34643
34643
|
`;
|
|
34644
34644
|
}
|
|
34645
|
-
const
|
|
34646
|
-
const line2 =
|
|
34647
|
-
` : `liveness: ${String(
|
|
34645
|
+
const blank5 = live.problems.length;
|
|
34646
|
+
const line2 = blank5 === 0 ? `liveness: ${String(live.widgets)} of ${String(live.widgets)} widget(s) came back with a figure.
|
|
34647
|
+
` : `liveness: ${String(blank5)} of ${String(live.widgets)} widget(s) came back with NO figure.
|
|
34648
34648
|
`;
|
|
34649
34649
|
const others = live.others ?? [];
|
|
34650
34650
|
if (others.length === 0) return line2;
|
|
@@ -35510,6 +35510,910 @@ ${JSON.stringify(res.result, null, 2)}
|
|
|
35510
35510
|
});
|
|
35511
35511
|
}
|
|
35512
35512
|
|
|
35513
|
+
// src/commands/appspace/_writeScan.ts
|
|
35514
|
+
var REACHES_TABLES = /\.\s*(?:data|tables)\b|\.\s*table\b/;
|
|
35515
|
+
var TABLE_WRITE = /\.\s*(insert|update|delete|save|next_number|transaction|assign_author)\b/g;
|
|
35516
|
+
var REACHES_STATE = /\.\s*state\b/;
|
|
35517
|
+
var STATE_WRITE = /\.\s*(set|set_in|delete)\b/g;
|
|
35518
|
+
var REACHES_FILEBOXES = /\bfileboxes\b/;
|
|
35519
|
+
var UPLOAD = /\.\s*upload\b/;
|
|
35520
|
+
var AGENTS = /\.\s*agents\b/;
|
|
35521
|
+
var REACHES_HTTP = /\.\s*http\b/;
|
|
35522
|
+
var HTTP_WRITE = /\.\s*(post|put|patch|delete|request)\b/;
|
|
35523
|
+
var DYNAMIC = new RegExp(
|
|
35524
|
+
[
|
|
35525
|
+
String.raw`\b(?:getattr|setattr|eval|exec|__import__|methodcaller|attrgetter|partial|partialmethod)\b`,
|
|
35526
|
+
String.raw`__getattribute__|__dict__|\bimportlib\b|\bvars\s*\(`,
|
|
35527
|
+
String.raw`\bglobals\s*\(|\blocals\s*\(|\bglobal\b|_getframe|\bf_globals\b|__globals__|__builtins__`,
|
|
35528
|
+
String.raw`\bsys\s*\.\s*modules\b|\bgc\s*\.|\binspect\b`
|
|
35529
|
+
].join("|")
|
|
35530
|
+
);
|
|
35531
|
+
var STRING_PREFIX3 = /^(?:[rRuUfFbBtT]|[rR][bBfFtT]|[bBfFtT][rR])$/;
|
|
35532
|
+
function hasFields(prefix) {
|
|
35533
|
+
return STRING_PREFIX3.test(prefix) && /[fFtT]/.test(prefix);
|
|
35534
|
+
}
|
|
35535
|
+
function prefixAt(code, j) {
|
|
35536
|
+
return /[A-Za-z]*$/.exec(code.slice(Math.max(0, j - 3), j))[0];
|
|
35537
|
+
}
|
|
35538
|
+
function fieldAt(code, j, out) {
|
|
35539
|
+
const from = j;
|
|
35540
|
+
let brackets = 0;
|
|
35541
|
+
let spec = false;
|
|
35542
|
+
while (j < code.length) {
|
|
35543
|
+
const c = code[j];
|
|
35544
|
+
if (spec) {
|
|
35545
|
+
if (c === "}") return j;
|
|
35546
|
+
j = c === "{" ? fieldAt(code, j + 1, out) + 1 : j + 1;
|
|
35547
|
+
continue;
|
|
35548
|
+
}
|
|
35549
|
+
if (c === '"' || c === "'") {
|
|
35550
|
+
j = stringAt(code, j, hasFields(prefixAt(code, j))).end;
|
|
35551
|
+
continue;
|
|
35552
|
+
}
|
|
35553
|
+
if (c === "#") {
|
|
35554
|
+
const end = code.indexOf("\n", j);
|
|
35555
|
+
j = end < 0 ? code.length : end;
|
|
35556
|
+
continue;
|
|
35557
|
+
}
|
|
35558
|
+
if (c === "(" || c === "[" || c === "{") brackets += 1;
|
|
35559
|
+
else if ((c === ")" || c === "]") && brackets > 0) brackets -= 1;
|
|
35560
|
+
else if (c === "}" && brackets > 0) brackets -= 1;
|
|
35561
|
+
else if (c === "}" || c === ":" && brackets === 0) {
|
|
35562
|
+
out.push([from, j]);
|
|
35563
|
+
if (c === "}") return j;
|
|
35564
|
+
spec = true;
|
|
35565
|
+
}
|
|
35566
|
+
j += 1;
|
|
35567
|
+
}
|
|
35568
|
+
if (!spec) out.push([from, j]);
|
|
35569
|
+
return j;
|
|
35570
|
+
}
|
|
35571
|
+
function stringAt(code, i, fields = false) {
|
|
35572
|
+
const ch = code[i];
|
|
35573
|
+
const triple = code.startsWith(ch.repeat(3), i);
|
|
35574
|
+
const close = triple ? ch.repeat(3) : ch;
|
|
35575
|
+
let j = i + close.length;
|
|
35576
|
+
let closed = false;
|
|
35577
|
+
while (j < code.length) {
|
|
35578
|
+
const c = code[j];
|
|
35579
|
+
if (code.startsWith(close, j)) {
|
|
35580
|
+
closed = true;
|
|
35581
|
+
break;
|
|
35582
|
+
}
|
|
35583
|
+
if (c === "\\") j += 2;
|
|
35584
|
+
else if (!triple && c === "\n") break;
|
|
35585
|
+
else if (fields && c === "{") j = code[j + 1] === "{" ? j + 2 : fieldAt(code, j + 1, []) + 1;
|
|
35586
|
+
else j += 1;
|
|
35587
|
+
}
|
|
35588
|
+
const bodyEnd = Math.min(code.length, j);
|
|
35589
|
+
return { close, bodyEnd, end: closed ? j + close.length : bodyEnd };
|
|
35590
|
+
}
|
|
35591
|
+
function fStringFields(body) {
|
|
35592
|
+
const out = [];
|
|
35593
|
+
let i = 0;
|
|
35594
|
+
while (i < body.length) {
|
|
35595
|
+
if (body[i] !== "{") i += 1;
|
|
35596
|
+
else if (body[i + 1] === "{") i += 2;
|
|
35597
|
+
else i = fieldAt(body, i + 1, out) + 1;
|
|
35598
|
+
}
|
|
35599
|
+
return out.sort((a, b) => a[0] - b[0]);
|
|
35600
|
+
}
|
|
35601
|
+
function walk5(code, sink, comments = true) {
|
|
35602
|
+
let i = 0;
|
|
35603
|
+
while (i < code.length) {
|
|
35604
|
+
const ch = code[i];
|
|
35605
|
+
if (ch === "#" && comments) {
|
|
35606
|
+
const end = code.indexOf("\n", i);
|
|
35607
|
+
sink.comment(code.slice(i, end < 0 ? code.length : end));
|
|
35608
|
+
i = end < 0 ? code.length : end;
|
|
35609
|
+
continue;
|
|
35610
|
+
}
|
|
35611
|
+
if (ch === '"' || ch === "'") {
|
|
35612
|
+
const fString = hasFields(sink.prefix());
|
|
35613
|
+
const at = stringAt(code, i, fString);
|
|
35614
|
+
sink.string(at.close, code.slice(i + at.close.length, at.bodyEnd), at.end > at.bodyEnd, fString);
|
|
35615
|
+
i = at.end;
|
|
35616
|
+
continue;
|
|
35617
|
+
}
|
|
35618
|
+
sink.code(ch);
|
|
35619
|
+
i += 1;
|
|
35620
|
+
}
|
|
35621
|
+
}
|
|
35622
|
+
function fieldsOnly(body, inner) {
|
|
35623
|
+
return fStringFields(body).map(([s, e]) => `{${inner(body.slice(s, e))}}`).join("");
|
|
35624
|
+
}
|
|
35625
|
+
function codeOnly(code, comments = true) {
|
|
35626
|
+
let out = "";
|
|
35627
|
+
walk5(
|
|
35628
|
+
code.replace(/\r\n?/g, "\n"),
|
|
35629
|
+
{
|
|
35630
|
+
code: (ch) => {
|
|
35631
|
+
out += ch;
|
|
35632
|
+
},
|
|
35633
|
+
comment: () => void 0,
|
|
35634
|
+
// An unclosed string is closed here: the rest of its line stays code.
|
|
35635
|
+
string: (quote, body, _closed, fString) => {
|
|
35636
|
+
out += fString ? `${quote}${fieldsOnly(body, (field) => codeOnly(field, field.includes("\n")))}${quote}` : `${quote}${quote}`;
|
|
35637
|
+
},
|
|
35638
|
+
// The prefix letters just before the quote (r, b, u, f and their mixes).
|
|
35639
|
+
// `*` always matches, so the match is never null.
|
|
35640
|
+
prefix: () => /[A-Za-z]*$/.exec(out)[0]
|
|
35641
|
+
},
|
|
35642
|
+
comments
|
|
35643
|
+
);
|
|
35644
|
+
return out;
|
|
35645
|
+
}
|
|
35646
|
+
function blank4(text4) {
|
|
35647
|
+
return text4.replace(/[^\n]/g, " ");
|
|
35648
|
+
}
|
|
35649
|
+
function maskCode(code, comments = true) {
|
|
35650
|
+
let out = "";
|
|
35651
|
+
walk5(
|
|
35652
|
+
code,
|
|
35653
|
+
{
|
|
35654
|
+
code: (ch) => {
|
|
35655
|
+
out += ch;
|
|
35656
|
+
},
|
|
35657
|
+
comment: (text4) => {
|
|
35658
|
+
out += blank4(text4);
|
|
35659
|
+
},
|
|
35660
|
+
string: (quote, body, closed, fString) => {
|
|
35661
|
+
let inner = blank4(body);
|
|
35662
|
+
if (fString) {
|
|
35663
|
+
const chars = inner.split("");
|
|
35664
|
+
for (const [s, e] of fStringFields(body)) {
|
|
35665
|
+
const text4 = body.slice(s, e);
|
|
35666
|
+
const field = maskCode(text4, text4.includes("\n"));
|
|
35667
|
+
for (let k = 0; k < field.length; k += 1) chars[s + k] = field[k];
|
|
35668
|
+
}
|
|
35669
|
+
inner = chars.join("");
|
|
35670
|
+
}
|
|
35671
|
+
out += `${quote}${inner}${closed ? quote : ""}`;
|
|
35672
|
+
},
|
|
35673
|
+
prefix: () => /[A-Za-z]*$/.exec(out)[0]
|
|
35674
|
+
},
|
|
35675
|
+
comments
|
|
35676
|
+
);
|
|
35677
|
+
return out;
|
|
35678
|
+
}
|
|
35679
|
+
function writeReasons(code) {
|
|
35680
|
+
const bare = codeOnly(code);
|
|
35681
|
+
const text4 = bare.normalize("NFKC");
|
|
35682
|
+
const reasons = /* @__PURE__ */ new Set();
|
|
35683
|
+
if (REACHES_TABLES.test(text4)) {
|
|
35684
|
+
for (const match of text4.matchAll(TABLE_WRITE)) reasons.add(`a table write (.${match[1]})`);
|
|
35685
|
+
}
|
|
35686
|
+
if (REACHES_STATE.test(text4)) {
|
|
35687
|
+
for (const match of text4.matchAll(STATE_WRITE)) reasons.add(`a state write (.${match[1]})`);
|
|
35688
|
+
}
|
|
35689
|
+
if (REACHES_FILEBOXES.test(text4) && UPLOAD.test(text4)) reasons.add("a filebox upload (ctx.dr.fileboxes.upload)");
|
|
35690
|
+
if (AGENTS.test(text4)) reasons.add("an agent call (ctx.agents): it starts real work");
|
|
35691
|
+
if (REACHES_HTTP.test(text4) && HTTP_WRITE.test(text4))
|
|
35692
|
+
reasons.add("an outgoing HTTP call that is not a GET (ctx.http)");
|
|
35693
|
+
if (DYNAMIC.test(text4)) {
|
|
35694
|
+
reasons.add("dynamic access (getattr, eval, partial, methodcaller, an import by name): the call is not known");
|
|
35695
|
+
}
|
|
35696
|
+
if (/[^\x00-\x7f]/.test(bare)) reasons.add("a name that is not ASCII: the text may hide a call");
|
|
35697
|
+
return [...reasons].sort();
|
|
35698
|
+
}
|
|
35699
|
+
function handlerText(code, lib) {
|
|
35700
|
+
return [
|
|
35701
|
+
code,
|
|
35702
|
+
...Object.keys(lib).sort().map((name) => lib[name])
|
|
35703
|
+
].map((part) => codeOnly(part)).join("\n");
|
|
35704
|
+
}
|
|
35705
|
+
|
|
35706
|
+
// src/commands/appspace/_readActions.ts
|
|
35707
|
+
var STRING_START = /(?:[rRuUfFbBtT]|[rR][bBfFtT]|[bBfFtT][rR])?(['"])/y;
|
|
35708
|
+
var NAME = /[A-Za-z_][A-Za-z0-9_]*/y;
|
|
35709
|
+
var NUMBER2 = /[0-9][0-9A-Za-z_.]*/y;
|
|
35710
|
+
var OPS = [
|
|
35711
|
+
"**=",
|
|
35712
|
+
"//=",
|
|
35713
|
+
">>=",
|
|
35714
|
+
"<<=",
|
|
35715
|
+
"...",
|
|
35716
|
+
"==",
|
|
35717
|
+
"!=",
|
|
35718
|
+
"<=",
|
|
35719
|
+
">=",
|
|
35720
|
+
":=",
|
|
35721
|
+
"->",
|
|
35722
|
+
"+=",
|
|
35723
|
+
"-=",
|
|
35724
|
+
"*=",
|
|
35725
|
+
"/=",
|
|
35726
|
+
"%=",
|
|
35727
|
+
"&=",
|
|
35728
|
+
"|=",
|
|
35729
|
+
"^=",
|
|
35730
|
+
"@=",
|
|
35731
|
+
"**",
|
|
35732
|
+
"//",
|
|
35733
|
+
"<<",
|
|
35734
|
+
">>"
|
|
35735
|
+
];
|
|
35736
|
+
var ASSIGN = /* @__PURE__ */ new Set(["=", ":=", "+=", "-=", "*=", "/=", "//=", "%=", "**=", ">>=", "<<=", "&=", "|=", "^=", "@="]);
|
|
35737
|
+
var OPEN = /* @__PURE__ */ new Set(["(", "[", "{"]);
|
|
35738
|
+
var CLOSE = /* @__PURE__ */ new Set([")", "]", "}"]);
|
|
35739
|
+
function matchAt(re, text4, i) {
|
|
35740
|
+
re.lastIndex = i;
|
|
35741
|
+
return re.exec(text4);
|
|
35742
|
+
}
|
|
35743
|
+
function tokenize4(mask, raw, from = 0, to = mask.length) {
|
|
35744
|
+
const out = [];
|
|
35745
|
+
let i = from;
|
|
35746
|
+
while (i < to) {
|
|
35747
|
+
const ch = mask[i];
|
|
35748
|
+
if (/\s/.test(ch) || ch === "\\") {
|
|
35749
|
+
i += 1;
|
|
35750
|
+
continue;
|
|
35751
|
+
}
|
|
35752
|
+
const str = matchAt(STRING_START, mask, i);
|
|
35753
|
+
if (str !== null) {
|
|
35754
|
+
const q = i + str[0].length - 1;
|
|
35755
|
+
const prefix = str[0].slice(0, -1);
|
|
35756
|
+
const at = stringAt(raw, q, hasFields(prefix));
|
|
35757
|
+
const end = Math.min(at.end, to);
|
|
35758
|
+
const body = raw.slice(q + at.close.length, Math.min(at.bodyEnd, to));
|
|
35759
|
+
const plain = at.close.length === 1 && at.end > at.bodyEnd && prefix === "" && !body.includes("\\") ? { plain: body } : {};
|
|
35760
|
+
out.push({ kind: "str", v: raw.slice(i, end), s: i, e: end, ...plain });
|
|
35761
|
+
if (hasFields(prefix)) {
|
|
35762
|
+
for (const [fs3, fe] of fStringFields(body))
|
|
35763
|
+
out.push(...tokenize4(mask, raw, q + at.close.length + fs3, q + at.close.length + fe));
|
|
35764
|
+
}
|
|
35765
|
+
i = end;
|
|
35766
|
+
continue;
|
|
35767
|
+
}
|
|
35768
|
+
const word = matchAt(NAME, mask, i) ?? matchAt(NUMBER2, mask, i);
|
|
35769
|
+
if (word !== null) {
|
|
35770
|
+
out.push({
|
|
35771
|
+
kind: /^[0-9]/.test(word[0]) ? "num" : "name",
|
|
35772
|
+
v: word[0],
|
|
35773
|
+
s: i,
|
|
35774
|
+
e: i + word[0].length
|
|
35775
|
+
});
|
|
35776
|
+
i += word[0].length;
|
|
35777
|
+
continue;
|
|
35778
|
+
}
|
|
35779
|
+
const op = OPS.find((one) => mask.startsWith(one, i)) ?? ch;
|
|
35780
|
+
out.push({ kind: "op", v: op, s: i, e: i + op.length });
|
|
35781
|
+
i += op.length;
|
|
35782
|
+
}
|
|
35783
|
+
return out;
|
|
35784
|
+
}
|
|
35785
|
+
function closing(t, i) {
|
|
35786
|
+
let depth = 0;
|
|
35787
|
+
for (let k = i; k < t.length; k += 1) {
|
|
35788
|
+
const v = t[k].v;
|
|
35789
|
+
if (OPEN.has(v)) depth += 1;
|
|
35790
|
+
else if (CLOSE.has(v)) {
|
|
35791
|
+
depth -= 1;
|
|
35792
|
+
if (depth === 0) return k;
|
|
35793
|
+
}
|
|
35794
|
+
}
|
|
35795
|
+
return -1;
|
|
35796
|
+
}
|
|
35797
|
+
var GiveUp = class extends Error {
|
|
35798
|
+
};
|
|
35799
|
+
function parseModule(raw) {
|
|
35800
|
+
const mask = maskCode(raw);
|
|
35801
|
+
const lines = mask.split("\n");
|
|
35802
|
+
const lineStart = [];
|
|
35803
|
+
let at = 0;
|
|
35804
|
+
for (const line2 of lines) {
|
|
35805
|
+
lineStart.push(at);
|
|
35806
|
+
at += line2.length + 1;
|
|
35807
|
+
}
|
|
35808
|
+
const lineOf3 = (offset2) => {
|
|
35809
|
+
let lo = 0;
|
|
35810
|
+
let hi = lineStart.length - 1;
|
|
35811
|
+
while (lo < hi) {
|
|
35812
|
+
const mid = lo + hi + 1 >> 1;
|
|
35813
|
+
if (lineStart[mid] <= offset2) lo = mid;
|
|
35814
|
+
else hi = mid - 1;
|
|
35815
|
+
}
|
|
35816
|
+
return lo;
|
|
35817
|
+
};
|
|
35818
|
+
if (/[^\x00-\x7f]/.test(mask)) throw new GiveUp("the code has a name that is not ASCII");
|
|
35819
|
+
const toks = tokenize4(mask, raw);
|
|
35820
|
+
const cont = lines.map(() => false);
|
|
35821
|
+
let depth = 0;
|
|
35822
|
+
let k = 0;
|
|
35823
|
+
for (let line2 = 0; line2 < lines.length; line2 += 1) {
|
|
35824
|
+
if (depth > 0) cont[line2] = true;
|
|
35825
|
+
if (line2 > 0 && /\\\s*$/.test(lines[line2 - 1])) cont[line2] = true;
|
|
35826
|
+
const next = line2 + 1 < lines.length ? lineStart[line2 + 1] : Infinity;
|
|
35827
|
+
while (k < toks.length && toks[k].s < next) {
|
|
35828
|
+
const tok = toks[k];
|
|
35829
|
+
if (OPEN.has(tok.v)) depth += 1;
|
|
35830
|
+
else if (CLOSE.has(tok.v)) depth = Math.max(0, depth - 1);
|
|
35831
|
+
if (tok.kind === "str") for (let l = lineOf3(tok.s) + 1; l <= lineOf3(tok.e - 1); l += 1) cont[l] = true;
|
|
35832
|
+
k += 1;
|
|
35833
|
+
}
|
|
35834
|
+
}
|
|
35835
|
+
const starts = [];
|
|
35836
|
+
for (let line2 = 0; line2 < lines.length; line2 += 1) {
|
|
35837
|
+
const text4 = lines[line2];
|
|
35838
|
+
if (cont[line2] || text4.trim() === "") continue;
|
|
35839
|
+
const lead = /^[ \t\f]*/.exec(text4)[0];
|
|
35840
|
+
if (/[\t\f]/.test(lead)) throw new GiveUp("an indent holds a tab");
|
|
35841
|
+
starts.push({ line: line2, indent: lead.length });
|
|
35842
|
+
}
|
|
35843
|
+
const stmts = starts.map((one, i) => {
|
|
35844
|
+
let headEnd = one.line + 1;
|
|
35845
|
+
while (headEnd < lines.length && cont[headEnd]) headEnd += 1;
|
|
35846
|
+
let end = lines.length;
|
|
35847
|
+
for (let j = i + 1; j < starts.length; j += 1) {
|
|
35848
|
+
if (starts[j].indent <= one.indent) {
|
|
35849
|
+
end = starts[j].line;
|
|
35850
|
+
break;
|
|
35851
|
+
}
|
|
35852
|
+
}
|
|
35853
|
+
return { line: one.line, headEnd, end, indent: one.indent };
|
|
35854
|
+
});
|
|
35855
|
+
return { raw, toks, lineStart, stmts };
|
|
35856
|
+
}
|
|
35857
|
+
function offset(mod, line2) {
|
|
35858
|
+
return line2 < mod.lineStart.length ? mod.lineStart[line2] : mod.raw.length;
|
|
35859
|
+
}
|
|
35860
|
+
function toksIn(mod, s, e) {
|
|
35861
|
+
let lo = 0;
|
|
35862
|
+
let hi = mod.toks.length;
|
|
35863
|
+
while (lo < hi) {
|
|
35864
|
+
const mid = lo + hi >> 1;
|
|
35865
|
+
if (mod.toks[mid].s < s) lo = mid + 1;
|
|
35866
|
+
else hi = mid;
|
|
35867
|
+
}
|
|
35868
|
+
const out = [];
|
|
35869
|
+
for (let k = lo; k < mod.toks.length && mod.toks[k].s < e; k += 1) out.push(mod.toks[k]);
|
|
35870
|
+
return out;
|
|
35871
|
+
}
|
|
35872
|
+
function header(mod, st) {
|
|
35873
|
+
return toksIn(mod, offset(mod, st.line), offset(mod, st.headEnd));
|
|
35874
|
+
}
|
|
35875
|
+
function blockOf(mod, from, to) {
|
|
35876
|
+
const inside2 = mod.stmts.filter((st) => st.line >= from && st.line < to);
|
|
35877
|
+
if (inside2.length === 0) return [];
|
|
35878
|
+
const indent2 = Math.min(...inside2.map((st) => st.indent));
|
|
35879
|
+
return inside2.filter((st) => st.indent === indent2);
|
|
35880
|
+
}
|
|
35881
|
+
function colonAt(t) {
|
|
35882
|
+
let depth = 0;
|
|
35883
|
+
for (let i = 0; i < t.length; i += 1) {
|
|
35884
|
+
const v = t[i].v;
|
|
35885
|
+
if (OPEN.has(v)) depth += 1;
|
|
35886
|
+
else if (CLOSE.has(v)) depth -= 1;
|
|
35887
|
+
else if (v === ":" && depth === 0) return i;
|
|
35888
|
+
}
|
|
35889
|
+
return -1;
|
|
35890
|
+
}
|
|
35891
|
+
var isAction = (tok) => tok?.plain === "action";
|
|
35892
|
+
function payloadExpr(t, i, p) {
|
|
35893
|
+
if (t[i]?.v === p && t[i]?.kind === "name") return i + 1;
|
|
35894
|
+
if (t[i]?.v !== "(" || t[i + 1]?.v !== p || t[i + 2]?.v !== "or") return -1;
|
|
35895
|
+
if (t[i + 3]?.v === "{" && t[i + 4]?.v === "}" && t[i + 5]?.v === ")") return i + 6;
|
|
35896
|
+
if (t[i + 3]?.v === "dict" && t[i + 4]?.v === "(" && t[i + 5]?.v === ")" && t[i + 6]?.v === ")") return i + 7;
|
|
35897
|
+
return -1;
|
|
35898
|
+
}
|
|
35899
|
+
function actionRead(t, i, p) {
|
|
35900
|
+
const j = payloadExpr(t, i, p);
|
|
35901
|
+
if (j < 0) return -1;
|
|
35902
|
+
if (t[j]?.v === "." && t[j + 1]?.v === "get" && t[j + 2]?.v === "(" && isAction(t[j + 3])) {
|
|
35903
|
+
if (t[j + 4]?.v === ")") return j + 5;
|
|
35904
|
+
if (t[j + 4]?.v === "," && t[j + 5]?.plain !== void 0 && t[j + 6]?.v === ")") return j + 7;
|
|
35905
|
+
return -1;
|
|
35906
|
+
}
|
|
35907
|
+
if (t[j]?.v === "[" && isAction(t[j + 1]) && t[j + 2]?.v === "]") return j + 3;
|
|
35908
|
+
return -1;
|
|
35909
|
+
}
|
|
35910
|
+
function actionValue(t, i, p, aliases) {
|
|
35911
|
+
let end = actionRead(t, i, p);
|
|
35912
|
+
let viaAlias = false;
|
|
35913
|
+
if (end < 0 && t[i]?.kind === "name" && aliases.has(t[i].v)) {
|
|
35914
|
+
end = i + 1;
|
|
35915
|
+
viaAlias = true;
|
|
35916
|
+
}
|
|
35917
|
+
if (end < 0 && t[i]?.v === "(") {
|
|
35918
|
+
const inner = actionValue(t, i + 1, p, aliases);
|
|
35919
|
+
if (inner !== null && t[inner.end]?.v === ")") {
|
|
35920
|
+
end = inner.end + 1;
|
|
35921
|
+
viaAlias = inner.viaAlias;
|
|
35922
|
+
}
|
|
35923
|
+
}
|
|
35924
|
+
if (end < 0) return null;
|
|
35925
|
+
if (t[end]?.v === "or" && t[end + 1]?.plain !== void 0) end += 2;
|
|
35926
|
+
return { end, viaAlias };
|
|
35927
|
+
}
|
|
35928
|
+
function literalSet(t, i) {
|
|
35929
|
+
const open3 = t[i]?.v;
|
|
35930
|
+
if (open3 === void 0 || !OPEN.has(open3) || closing(t, i) !== t.length - 1) return null;
|
|
35931
|
+
const items = t.slice(i + 1, t.length - 1);
|
|
35932
|
+
const names = [];
|
|
35933
|
+
for (let k = 0; k < items.length; k += 2) {
|
|
35934
|
+
const item = items[k];
|
|
35935
|
+
if (item.plain === void 0) return null;
|
|
35936
|
+
names.push(item.plain);
|
|
35937
|
+
if (k + 1 < items.length && items[k + 1].v !== ",") return null;
|
|
35938
|
+
}
|
|
35939
|
+
if (names.length === 0 || open3 === "(" && !items.some((tok) => tok.v === ",")) return null;
|
|
35940
|
+
return names;
|
|
35941
|
+
}
|
|
35942
|
+
function actionTest(t, p, aliases) {
|
|
35943
|
+
const value = actionValue(t, 0, p, aliases);
|
|
35944
|
+
if (value !== null) {
|
|
35945
|
+
const op2 = t[value.end]?.v;
|
|
35946
|
+
const lit2 = t[value.end + 1];
|
|
35947
|
+
if ((op2 === "==" || op2 === "!=") && lit2?.plain !== void 0 && value.end + 2 === t.length) {
|
|
35948
|
+
return {
|
|
35949
|
+
names: [lit2.plain],
|
|
35950
|
+
negate: op2 === "!=",
|
|
35951
|
+
viaAlias: value.viaAlias
|
|
35952
|
+
};
|
|
35953
|
+
}
|
|
35954
|
+
const not = op2 === "not" && t[value.end + 1]?.v === "in";
|
|
35955
|
+
if (op2 === "in" || not) {
|
|
35956
|
+
const names = literalSet(t, value.end + (not ? 2 : 1));
|
|
35957
|
+
if (names !== null) return { names, negate: not, viaAlias: value.viaAlias };
|
|
35958
|
+
}
|
|
35959
|
+
return null;
|
|
35960
|
+
}
|
|
35961
|
+
const lit = t[0];
|
|
35962
|
+
const op = t[1]?.v;
|
|
35963
|
+
if (lit?.plain === void 0 || op !== "==" && op !== "!=") return null;
|
|
35964
|
+
const right = actionValue(t, 2, p, aliases);
|
|
35965
|
+
if (right === null || right.end !== t.length) return null;
|
|
35966
|
+
return { names: [lit.plain], negate: op === "!=", viaAlias: right.viaAlias };
|
|
35967
|
+
}
|
|
35968
|
+
var COMPOUND = /* @__PURE__ */ new Set([
|
|
35969
|
+
"if",
|
|
35970
|
+
"elif",
|
|
35971
|
+
"else",
|
|
35972
|
+
"while",
|
|
35973
|
+
"for",
|
|
35974
|
+
"with",
|
|
35975
|
+
"try",
|
|
35976
|
+
"except",
|
|
35977
|
+
"finally",
|
|
35978
|
+
"def",
|
|
35979
|
+
"class",
|
|
35980
|
+
"async",
|
|
35981
|
+
"match",
|
|
35982
|
+
"case"
|
|
35983
|
+
]);
|
|
35984
|
+
var BINDS_AFTER = /* @__PURE__ */ new Set(["as", "global", "nonlocal", "del", "import", "def", "class", "lambda", "case"]);
|
|
35985
|
+
function boundNames(t) {
|
|
35986
|
+
const out = [];
|
|
35987
|
+
const names = (from2, to) => {
|
|
35988
|
+
for (let k = from2; k < to; k += 1) if (t[k].kind === "name") out.push(t[k]);
|
|
35989
|
+
};
|
|
35990
|
+
let from = 0;
|
|
35991
|
+
if (COMPOUND.has(t[0]?.v ?? "")) {
|
|
35992
|
+
const colon = colonAt(t);
|
|
35993
|
+
from = colon < 0 ? t.length : colon + 1;
|
|
35994
|
+
}
|
|
35995
|
+
let lastAssign = -1;
|
|
35996
|
+
let depth = 0;
|
|
35997
|
+
for (let k = from; k < t.length; k += 1) {
|
|
35998
|
+
const v = t[k].v;
|
|
35999
|
+
if (OPEN.has(v)) depth += 1;
|
|
36000
|
+
else if (CLOSE.has(v)) depth -= 1;
|
|
36001
|
+
else if (v === "=" && depth === 0) lastAssign = k;
|
|
36002
|
+
}
|
|
36003
|
+
if (lastAssign >= 0) names(from, lastAssign);
|
|
36004
|
+
const upTo = (k, stops) => {
|
|
36005
|
+
let j = k + 1;
|
|
36006
|
+
while (j < t.length && !stops.includes(t[j].v)) j += 1;
|
|
36007
|
+
return j;
|
|
36008
|
+
};
|
|
36009
|
+
for (let k = 0; k < t.length; k += 1) {
|
|
36010
|
+
const v = t[k].v;
|
|
36011
|
+
if (ASSIGN.has(v) && v !== "=" && t[k - 1]?.kind === "name") out.push(t[k - 1]);
|
|
36012
|
+
if (v === "for") names(k + 1, upTo(k, ["in"]));
|
|
36013
|
+
if (BINDS_AFTER.has(v)) names(k + 1, upTo(k, [":", "="]));
|
|
36014
|
+
}
|
|
36015
|
+
return out;
|
|
36016
|
+
}
|
|
36017
|
+
function tableOf4(t, st) {
|
|
36018
|
+
if (t[0]?.kind !== "name" || t[1]?.v !== "=" || t[2]?.v !== "{" || closing(t, 2) !== t.length - 1) return null;
|
|
36019
|
+
const entries = /* @__PURE__ */ new Map();
|
|
36020
|
+
const body = t.slice(3, t.length - 1);
|
|
36021
|
+
for (let k = 0; k < body.length; k += 4) {
|
|
36022
|
+
const [key, colon, fn, comma] = [body[k], body[k + 1], body[k + 2], body[k + 3]];
|
|
36023
|
+
if (key?.plain === void 0 || colon?.v !== ":" || fn?.kind !== "name") return null;
|
|
36024
|
+
if (comma !== void 0 && comma.v !== ",") return null;
|
|
36025
|
+
entries.set(key.plain, fn.v);
|
|
36026
|
+
}
|
|
36027
|
+
return entries.size > 0 ? { name: t[0].v, stmt: st, entries } : null;
|
|
36028
|
+
}
|
|
36029
|
+
function readUnit(mod, aliases) {
|
|
36030
|
+
const top = blockOf(mod, 0, Infinity);
|
|
36031
|
+
if (top.length > 0 && top[0].indent !== 0) throw new GiveUp("a module starts with an indent");
|
|
36032
|
+
const unit = { mod, defs: /* @__PURE__ */ new Map(), seeds: [] };
|
|
36033
|
+
const tables = [];
|
|
36034
|
+
const handle = [];
|
|
36035
|
+
let decorated = false;
|
|
36036
|
+
for (const st of top) {
|
|
36037
|
+
const t = header(mod, st);
|
|
36038
|
+
const whole = {
|
|
36039
|
+
mod,
|
|
36040
|
+
s: offset(mod, st.line),
|
|
36041
|
+
e: offset(mod, st.end)
|
|
36042
|
+
};
|
|
36043
|
+
const first = t[0].v;
|
|
36044
|
+
const isDef = first === "def" || first === "async" && t[1]?.v === "def";
|
|
36045
|
+
if (first === "@" || first === "class" || isDef && decorated) {
|
|
36046
|
+
unit.seeds.push(whole);
|
|
36047
|
+
decorated = first === "@";
|
|
36048
|
+
continue;
|
|
36049
|
+
}
|
|
36050
|
+
decorated = false;
|
|
36051
|
+
if (isDef) {
|
|
36052
|
+
const name = t[first === "def" ? 1 : 2].v;
|
|
36053
|
+
if (/^__\w+__$/.test(name)) {
|
|
36054
|
+
unit.seeds.push(whole);
|
|
36055
|
+
continue;
|
|
36056
|
+
}
|
|
36057
|
+
if (name === "handle") handle.push(st);
|
|
36058
|
+
unit.defs.set(name, [...unit.defs.get(name) ?? [], [whole.s, whole.e]]);
|
|
36059
|
+
continue;
|
|
36060
|
+
}
|
|
36061
|
+
if (first === "import" || first === "from") {
|
|
36062
|
+
for (let k = 0; k + 2 < t.length; k += 1) {
|
|
36063
|
+
if (t[k + 1].v === "as" && t[k].kind === "name") {
|
|
36064
|
+
const alias = t[k + 2].v;
|
|
36065
|
+
aliases.set(alias, /* @__PURE__ */ new Set([...aliases.get(alias) ?? [], t[k].v]));
|
|
36066
|
+
}
|
|
36067
|
+
}
|
|
36068
|
+
unit.seeds.push({ ...whole, noMentions: true });
|
|
36069
|
+
continue;
|
|
36070
|
+
}
|
|
36071
|
+
const table = tableOf4(t, st);
|
|
36072
|
+
if (table !== null) tables.push(table);
|
|
36073
|
+
unit.seeds.push(whole);
|
|
36074
|
+
}
|
|
36075
|
+
return { unit, tables, handle };
|
|
36076
|
+
}
|
|
36077
|
+
function readDispatch(mod, handle, tables) {
|
|
36078
|
+
const head = header(mod, handle);
|
|
36079
|
+
if (head[head.length - 1].v !== ":") throw new GiveUp("`handle` has its body on the def line");
|
|
36080
|
+
const open3 = head.findIndex((tok) => tok.v === "(");
|
|
36081
|
+
const shut = closing(head, open3);
|
|
36082
|
+
const params = [];
|
|
36083
|
+
for (let k = open3 + 1, depth = 0, fresh = true; k < shut; k += 1) {
|
|
36084
|
+
const v = head[k].v;
|
|
36085
|
+
if (OPEN.has(v)) depth += 1;
|
|
36086
|
+
else if (CLOSE.has(v)) depth -= 1;
|
|
36087
|
+
else if (v === "," && depth === 0) fresh = true;
|
|
36088
|
+
else if (fresh && depth === 0) {
|
|
36089
|
+
params.push(head[k].kind === "name" ? v : "");
|
|
36090
|
+
fresh = false;
|
|
36091
|
+
}
|
|
36092
|
+
}
|
|
36093
|
+
const p = params[1];
|
|
36094
|
+
if (p === void 0 || p === "") throw new GiveUp("`handle` has no plain second parameter (the payload)");
|
|
36095
|
+
const bodyFrom = offset(mod, handle.headEnd);
|
|
36096
|
+
const bodyTo = offset(mod, handle.end);
|
|
36097
|
+
const body = blockOf(mod, handle.headEnd, handle.end);
|
|
36098
|
+
const inBody = mod.stmts.filter((st) => st.line >= handle.headEnd && st.line < handle.end);
|
|
36099
|
+
const lines = inBody.map((st) => ({ st, t: header(mod, st) }));
|
|
36100
|
+
const bodyToks = toksIn(mod, bodyFrom, bodyTo);
|
|
36101
|
+
const binds = /* @__PURE__ */ new Map();
|
|
36102
|
+
for (const { t } of lines) for (const tok of boundNames(t)) binds.set(tok.v, [...binds.get(tok.v) ?? [], tok]);
|
|
36103
|
+
const aliases = /* @__PURE__ */ new Set();
|
|
36104
|
+
const aliasAt = /* @__PURE__ */ new Map();
|
|
36105
|
+
for (const st of body) {
|
|
36106
|
+
const t = header(mod, st);
|
|
36107
|
+
if (t[0]?.kind === "name" && t[1]?.v === "=" && actionValue(t, 2, p, /* @__PURE__ */ new Set())?.end === t.length) {
|
|
36108
|
+
const name = t[0].v;
|
|
36109
|
+
if (binds.get(name).length === 1) {
|
|
36110
|
+
aliases.add(name);
|
|
36111
|
+
aliasAt.set(name, t[0].s);
|
|
36112
|
+
}
|
|
36113
|
+
}
|
|
36114
|
+
}
|
|
36115
|
+
const reset = /* @__PURE__ */ new Set();
|
|
36116
|
+
for (const st of body) {
|
|
36117
|
+
const t = header(mod, st);
|
|
36118
|
+
const rest = t.slice(2).map((tok) => tok.v).join(" ");
|
|
36119
|
+
if (t[0]?.v === p && t[1]?.v === "=" && (rest === `${p} or { }` || rest === `${p} or dict ( )`)) {
|
|
36120
|
+
reset.add(t[0].s);
|
|
36121
|
+
reset.add(t[2].s);
|
|
36122
|
+
}
|
|
36123
|
+
}
|
|
36124
|
+
if ((binds.get(p) ?? []).some((tok) => !reset.has(tok.s))) throw new GiveUp("`handle` binds the payload again");
|
|
36125
|
+
const decisions = [];
|
|
36126
|
+
const chains = /* @__PURE__ */ new Map();
|
|
36127
|
+
const actions = /* @__PURE__ */ new Set();
|
|
36128
|
+
for (let i = 0; i < body.length; i += 1) {
|
|
36129
|
+
const t = header(mod, body[i]);
|
|
36130
|
+
if (t[0]?.v !== "if") continue;
|
|
36131
|
+
const test = actionTest(t.slice(1, colonAt(t)), p, aliases);
|
|
36132
|
+
if (test === null) continue;
|
|
36133
|
+
const chain = [{ st: body[i], test, t }];
|
|
36134
|
+
for (let j = i + 1; j < body.length; j += 1) {
|
|
36135
|
+
const u = header(mod, body[j]);
|
|
36136
|
+
if (u[0]?.v === "elif")
|
|
36137
|
+
chain.push({
|
|
36138
|
+
st: body[j],
|
|
36139
|
+
test: actionTest(u.slice(1, colonAt(u)), p, aliases),
|
|
36140
|
+
t: u
|
|
36141
|
+
});
|
|
36142
|
+
else if (u[0]?.v === "else") chain.push({ st: body[j], test: null, t: u });
|
|
36143
|
+
else break;
|
|
36144
|
+
if (u[0]?.v === "else") break;
|
|
36145
|
+
}
|
|
36146
|
+
chains.set(body[i], chain);
|
|
36147
|
+
for (const one of chain) {
|
|
36148
|
+
if (one.test === null) continue;
|
|
36149
|
+
one.test.names.forEach((name) => actions.add(name));
|
|
36150
|
+
decisions.push({ at: one.t[0].s, viaAlias: one.test.viaAlias });
|
|
36151
|
+
}
|
|
36152
|
+
i += chain.length - 1;
|
|
36153
|
+
}
|
|
36154
|
+
const lookups = [];
|
|
36155
|
+
const named13 = new Map(tables.map((table) => [table.name, table]));
|
|
36156
|
+
const plainUse = /* @__PURE__ */ new Set();
|
|
36157
|
+
for (let k = 0; k < bodyToks.length; k += 1) {
|
|
36158
|
+
const tok = bodyToks[k];
|
|
36159
|
+
const table = named13.get(tok.v);
|
|
36160
|
+
if (tok.kind !== "name" || table === void 0) continue;
|
|
36161
|
+
let found = null;
|
|
36162
|
+
if (bodyToks[k - 1]?.v !== "." && bodyToks[k + 1]?.v === "." && bodyToks[k + 2]?.v === "get" && bodyToks[k + 3]?.v === "(") {
|
|
36163
|
+
const value = actionValue(bodyToks, k + 4, p, aliases);
|
|
36164
|
+
const shut2 = closing(bodyToks, k + 3);
|
|
36165
|
+
if (value !== null && shut2 > 0 && (bodyToks[value.end]?.v === ")" || bodyToks[value.end]?.v === ",")) {
|
|
36166
|
+
const fallback = bodyToks[value.end]?.v === "," && value.end + 1 < shut2 ? [bodyToks[value.end + 1].s, bodyToks[shut2 - 1].e] : null;
|
|
36167
|
+
if (bodyToks[value.end]?.v === ")" || fallback !== null) {
|
|
36168
|
+
found = {
|
|
36169
|
+
table,
|
|
36170
|
+
s: tok.s,
|
|
36171
|
+
e: bodyToks[shut2].e,
|
|
36172
|
+
fallback,
|
|
36173
|
+
at: tok.s,
|
|
36174
|
+
viaAlias: value.viaAlias
|
|
36175
|
+
};
|
|
36176
|
+
}
|
|
36177
|
+
}
|
|
36178
|
+
} else if (bodyToks[k - 1]?.v !== "." && bodyToks[k + 1]?.v === "[") {
|
|
36179
|
+
const value = actionValue(bodyToks, k + 2, p, aliases);
|
|
36180
|
+
if (value !== null && bodyToks[value.end]?.v === "]") {
|
|
36181
|
+
found = {
|
|
36182
|
+
table,
|
|
36183
|
+
s: tok.s,
|
|
36184
|
+
e: bodyToks[value.end].e,
|
|
36185
|
+
fallback: null,
|
|
36186
|
+
at: tok.s,
|
|
36187
|
+
viaAlias: value.viaAlias
|
|
36188
|
+
};
|
|
36189
|
+
}
|
|
36190
|
+
}
|
|
36191
|
+
if (found === null) plainUse.add(table.name);
|
|
36192
|
+
else lookups.push(found);
|
|
36193
|
+
}
|
|
36194
|
+
for (const table of tables) {
|
|
36195
|
+
const allowed = /* @__PURE__ */ new Set([
|
|
36196
|
+
mod.toks.find((tok) => tok.s >= offset(mod, table.stmt.line)).s,
|
|
36197
|
+
...lookups.filter((one) => one.table === table).map((one) => one.s)
|
|
36198
|
+
]);
|
|
36199
|
+
if (mod.toks.some((tok) => tok.kind === "name" && tok.v === table.name && !allowed.has(tok.s)))
|
|
36200
|
+
plainUse.add(table.name);
|
|
36201
|
+
}
|
|
36202
|
+
const used = lookups.filter((one) => !plainUse.has(one.table.name));
|
|
36203
|
+
for (const one of used) {
|
|
36204
|
+
one.table.entries.forEach((_fn, name) => actions.add(name));
|
|
36205
|
+
decisions.push({ at: one.at, viaAlias: one.viaAlias });
|
|
36206
|
+
}
|
|
36207
|
+
actions.delete("");
|
|
36208
|
+
if (actions.size === 0) throw new GiveUp('`handle` has no dispatch on payload["action"] that this check can read');
|
|
36209
|
+
for (const one of decisions) {
|
|
36210
|
+
const around = inBody.filter((st) => offset(mod, st.line) <= one.at && one.at < offset(mod, st.end));
|
|
36211
|
+
for (const st of around) {
|
|
36212
|
+
const t = header(mod, st);
|
|
36213
|
+
const first = t[0]?.v === "async" ? t[1]?.v : t[0]?.v;
|
|
36214
|
+
if (["for", "while", "def", "class"].includes(first)) {
|
|
36215
|
+
throw new GiveUp("`handle` reads the action in a loop or a nested function");
|
|
36216
|
+
}
|
|
36217
|
+
if (one.at < offset(mod, st.headEnd) && t.some((tok) => tok.v === "lambda" || tok.v === "for")) {
|
|
36218
|
+
throw new GiveUp("`handle` reads the action in a lambda or a comprehension");
|
|
36219
|
+
}
|
|
36220
|
+
}
|
|
36221
|
+
}
|
|
36222
|
+
const chainSpans = [...chains.values()].map((chain) => [
|
|
36223
|
+
offset(mod, chain[0].st.line),
|
|
36224
|
+
offset(mod, chain[chain.length - 1].st.end)
|
|
36225
|
+
]);
|
|
36226
|
+
const sameChain = (a, b) => chainSpans.some(([s, e]) => s <= a && a < e && s <= b && b < e);
|
|
36227
|
+
const reads = [
|
|
36228
|
+
...decisions.filter((one) => !one.viaAlias).map((one) => one.at),
|
|
36229
|
+
...decisions.some((one) => one.viaAlias) ? [...aliasAt.values()] : []
|
|
36230
|
+
];
|
|
36231
|
+
const lineStarts = new Set(lines.flatMap(({ t }) => t[0] === void 0 ? [] : [t[0].s]));
|
|
36232
|
+
for (let k = 0; k < bodyToks.length; k += 1) {
|
|
36233
|
+
const tok = bodyToks[k];
|
|
36234
|
+
if (tok.kind !== "name" || tok.v !== p || bodyToks[k - 1]?.v === "." || safeUse(bodyToks, k, reset, lineStarts))
|
|
36235
|
+
continue;
|
|
36236
|
+
if (reads.some((at) => tok.s < at && !sameChain(tok.s, at))) {
|
|
36237
|
+
throw new GiveUp("`handle` passes or changes the payload before it reads the action");
|
|
36238
|
+
}
|
|
36239
|
+
}
|
|
36240
|
+
const piecesFor = (action) => {
|
|
36241
|
+
const pieces = [{ mod, s: offset(mod, handle.line), e: offset(mod, handle.headEnd) }];
|
|
36242
|
+
const whole = (st) => ({
|
|
36243
|
+
mod,
|
|
36244
|
+
s: offset(mod, st.line),
|
|
36245
|
+
e: offset(mod, st.end)
|
|
36246
|
+
});
|
|
36247
|
+
const bodyOf = (st, t) => {
|
|
36248
|
+
const colon = colonAt(t);
|
|
36249
|
+
return {
|
|
36250
|
+
mod,
|
|
36251
|
+
s: colon === t.length - 1 ? offset(mod, st.headEnd) : t[colon].e,
|
|
36252
|
+
e: offset(mod, st.end)
|
|
36253
|
+
};
|
|
36254
|
+
};
|
|
36255
|
+
for (let i = 0; i < body.length; i += 1) {
|
|
36256
|
+
const chain = chains.get(body[i]);
|
|
36257
|
+
if (chain === void 0) {
|
|
36258
|
+
pieces.push(whole(body[i]));
|
|
36259
|
+
continue;
|
|
36260
|
+
}
|
|
36261
|
+
for (let c = 0; c < chain.length; c += 1) {
|
|
36262
|
+
const one = chain[c];
|
|
36263
|
+
if (one.test === null && one.t[0].v !== "else") {
|
|
36264
|
+
for (const rest of chain.slice(c)) pieces.push(whole(rest.st));
|
|
36265
|
+
break;
|
|
36266
|
+
}
|
|
36267
|
+
if (one.test === null || one.test.names.includes(action) !== one.test.negate) {
|
|
36268
|
+
pieces.push(bodyOf(one.st, one.t));
|
|
36269
|
+
break;
|
|
36270
|
+
}
|
|
36271
|
+
}
|
|
36272
|
+
i += chain.length - 1;
|
|
36273
|
+
}
|
|
36274
|
+
const mentions3 = [];
|
|
36275
|
+
const self = head.find((tok) => tok.v === "handle");
|
|
36276
|
+
const skip2 = [[self.s, self.e]];
|
|
36277
|
+
for (const one of used) {
|
|
36278
|
+
skip2.push([one.s, one.e]);
|
|
36279
|
+
const fn = one.table.entries.get(action);
|
|
36280
|
+
if (fn !== void 0) mentions3.push(fn);
|
|
36281
|
+
if (one.fallback !== null) {
|
|
36282
|
+
for (const tok of toksIn(mod, one.fallback[0], one.fallback[1])) if (tok.kind === "name") mentions3.push(tok.v);
|
|
36283
|
+
}
|
|
36284
|
+
}
|
|
36285
|
+
return { pieces, mentions: mentions3, skip: skip2 };
|
|
36286
|
+
};
|
|
36287
|
+
return {
|
|
36288
|
+
actions: [...actions].sort(),
|
|
36289
|
+
piecesFor,
|
|
36290
|
+
tables: new Set(used.map((one) => one.table))
|
|
36291
|
+
};
|
|
36292
|
+
}
|
|
36293
|
+
var COMPARE = /* @__PURE__ */ new Set(["==", "!=", "<", ">", "<=", ">="]);
|
|
36294
|
+
var OPERAND_START = /* @__PURE__ */ new Set([
|
|
36295
|
+
"",
|
|
36296
|
+
"(",
|
|
36297
|
+
"[",
|
|
36298
|
+
"{",
|
|
36299
|
+
",",
|
|
36300
|
+
"=",
|
|
36301
|
+
":",
|
|
36302
|
+
"return",
|
|
36303
|
+
"if",
|
|
36304
|
+
"elif",
|
|
36305
|
+
"while",
|
|
36306
|
+
"or",
|
|
36307
|
+
"and",
|
|
36308
|
+
"not",
|
|
36309
|
+
"else",
|
|
36310
|
+
"assert"
|
|
36311
|
+
]);
|
|
36312
|
+
var OPERAND_END = /* @__PURE__ */ new Set(["", ")", "]", "}", ",", ":", ";", "or", "and", "if", "else"]);
|
|
36313
|
+
var CHAIN_END = /* @__PURE__ */ new Set([...OPERAND_END, "is", "in", "not", ...COMPARE]);
|
|
36314
|
+
function constantEnd(t, i) {
|
|
36315
|
+
const tok = t[i];
|
|
36316
|
+
if (tok === void 0) return -1;
|
|
36317
|
+
if (tok.kind === "num" || tok.kind === "str" && !/^[A-Za-z]*[fFtT]/.test(tok.v)) return i + 1;
|
|
36318
|
+
if (["None", "True", "False"].includes(tok.v)) return i + 1;
|
|
36319
|
+
const pair = { "{": "}", "[": "]", "(": ")" };
|
|
36320
|
+
return pair[tok.v] !== void 0 && t[i + 1]?.v === pair[tok.v] ? i + 2 : -1;
|
|
36321
|
+
}
|
|
36322
|
+
function safeUse(t, k, reset, lineStarts) {
|
|
36323
|
+
let first = k;
|
|
36324
|
+
let last = k;
|
|
36325
|
+
if (t[k - 1]?.v === "(" && t[k + 1]?.v === "or") {
|
|
36326
|
+
if (t[k + 2]?.v === "{" && t[k + 3]?.v === "}" && t[k + 4]?.v === ")") [first, last] = [k - 1, k + 4];
|
|
36327
|
+
else if (t[k + 2]?.v === "dict" && t[k + 3]?.v === "(" && t[k + 4]?.v === ")" && t[k + 5]?.v === ")") {
|
|
36328
|
+
[first, last] = [k - 1, k + 5];
|
|
36329
|
+
}
|
|
36330
|
+
}
|
|
36331
|
+
const at = (i) => {
|
|
36332
|
+
const tok = t[i];
|
|
36333
|
+
return tok === void 0 || lineStarts.has(tok.s) ? "" : tok.v;
|
|
36334
|
+
};
|
|
36335
|
+
const next = at(last + 1);
|
|
36336
|
+
const prev = lineStarts.has(t[first].s) ? "" : t[first - 1].v;
|
|
36337
|
+
if (next === "." && t[last + 2]?.v === "get" && t[last + 3]?.v === "(") return true;
|
|
36338
|
+
if (next === "[") {
|
|
36339
|
+
const shut = closing(t, last + 1);
|
|
36340
|
+
return shut > 0 && !ASSIGN.has(t[shut + 1]?.v ?? "");
|
|
36341
|
+
}
|
|
36342
|
+
if (OPERAND_START.has(prev)) {
|
|
36343
|
+
if (next === "is") return true;
|
|
36344
|
+
const op = next === "not" && t[last + 2]?.v === "in" ? 2 : COMPARE.has(next) || next === "in" ? 1 : 0;
|
|
36345
|
+
if (op > 0) {
|
|
36346
|
+
const end = constantEnd(t, last + 1 + op);
|
|
36347
|
+
return end > 0 && CHAIN_END.has(at(end));
|
|
36348
|
+
}
|
|
36349
|
+
}
|
|
36350
|
+
if (!OPERAND_END.has(next)) return reset.has(t[k].s);
|
|
36351
|
+
if (prev === "is" || prev === "in" || prev === "not") return true;
|
|
36352
|
+
if (COMPARE.has(prev)) {
|
|
36353
|
+
const lit = first - 2;
|
|
36354
|
+
const start = t[lit]?.v === "}" || t[lit]?.v === "]" || t[lit]?.v === ")" ? lit - 1 : lit;
|
|
36355
|
+
return constantEnd(t, start) === first - 1 && OPERAND_START.has(lineStarts.has(t[start].s) ? "" : t[start - 1].v);
|
|
36356
|
+
}
|
|
36357
|
+
if (["if", "elif", "while"].includes(prev) && next === ":") return true;
|
|
36358
|
+
if (prev === "if" && next === "else") return true;
|
|
36359
|
+
return reset.has(t[k].s);
|
|
36360
|
+
}
|
|
36361
|
+
function scanActions(code, lib) {
|
|
36362
|
+
try {
|
|
36363
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
36364
|
+
const lines = (text4) => text4.replace(/\r\n?/g, "\n");
|
|
36365
|
+
const main2 = readUnit(parseModule(lines(code)), aliases);
|
|
36366
|
+
const units = [
|
|
36367
|
+
main2.unit,
|
|
36368
|
+
...Object.keys(lib).sort().map((name) => readUnit(parseModule(lines(lib[name])), aliases).unit)
|
|
36369
|
+
];
|
|
36370
|
+
if (main2.handle.length !== 1) throw new GiveUp("the handler has no single top-level `def handle`");
|
|
36371
|
+
const handle = main2.handle[0];
|
|
36372
|
+
const dispatch = readDispatch(main2.unit.mod, handle, main2.tables);
|
|
36373
|
+
const tableAt = new Set([...dispatch.tables].map((table) => offset(main2.unit.mod, table.stmt.line)));
|
|
36374
|
+
const seeds = units.flatMap((unit) => unit.seeds).filter((one) => !(one.mod === main2.unit.mod && tableAt.has(one.s)));
|
|
36375
|
+
const tablePieces = [...dispatch.tables].map((table) => ({
|
|
36376
|
+
mod: main2.unit.mod,
|
|
36377
|
+
s: offset(main2.unit.mod, table.stmt.line),
|
|
36378
|
+
e: offset(main2.unit.mod, table.stmt.end)
|
|
36379
|
+
}));
|
|
36380
|
+
const actions = dispatch.actions.map((action) => {
|
|
36381
|
+
const { pieces, mentions: mentions3, skip: skip2 } = dispatch.piecesFor(action);
|
|
36382
|
+
const text4 = [];
|
|
36383
|
+
const queue = [...mentions3];
|
|
36384
|
+
const take = (piece, holes = []) => {
|
|
36385
|
+
text4.push(piece.mod.raw.slice(piece.s, piece.e));
|
|
36386
|
+
if (piece.noMentions === true) return;
|
|
36387
|
+
for (const tok of toksIn(piece.mod, piece.s, piece.e)) {
|
|
36388
|
+
if (tok.kind === "name" && !holes.some(([s, e]) => tok.s >= s && tok.s < e)) queue.push(tok.v);
|
|
36389
|
+
}
|
|
36390
|
+
};
|
|
36391
|
+
seeds.forEach((piece) => take(piece));
|
|
36392
|
+
pieces.forEach((piece) => take(piece, skip2));
|
|
36393
|
+
const seen = /* @__PURE__ */ new Set();
|
|
36394
|
+
while (queue.length > 0) {
|
|
36395
|
+
const name = queue.pop();
|
|
36396
|
+
if (seen.has(name)) continue;
|
|
36397
|
+
seen.add(name);
|
|
36398
|
+
queue.push(...aliases.get(name) ?? []);
|
|
36399
|
+
for (const unit of units) {
|
|
36400
|
+
for (const [s, e] of unit.defs.get(name) ?? []) {
|
|
36401
|
+
take({ mod: unit.mod, s, e });
|
|
36402
|
+
if (unit === main2.unit && s === offset(unit.mod, handle.line)) tablePieces.forEach((piece) => take(piece));
|
|
36403
|
+
}
|
|
36404
|
+
}
|
|
36405
|
+
}
|
|
36406
|
+
return { action, reasons: writeReasons(text4.map((part) => codeOnly(part)).join("\n")) };
|
|
36407
|
+
});
|
|
36408
|
+
return { ok: true, actions };
|
|
36409
|
+
} catch (err) {
|
|
36410
|
+
return {
|
|
36411
|
+
ok: false,
|
|
36412
|
+
why: err instanceof GiveUp ? err.message : "the check could not read the code"
|
|
36413
|
+
};
|
|
36414
|
+
}
|
|
36415
|
+
}
|
|
36416
|
+
|
|
35513
36417
|
// src/commands/appspace/compare.ts
|
|
35514
36418
|
var READ_ONLY_ERROR = "ReadOnlyRefused";
|
|
35515
36419
|
var PLAIN_KEY = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -35597,7 +36501,7 @@ function diffJson(published, migrated, masks = []) {
|
|
|
35597
36501
|
const add = (path3, kind, sides) => {
|
|
35598
36502
|
differences.push({ path: formatPath(path3), steps: path3, kind, ...sides });
|
|
35599
36503
|
};
|
|
35600
|
-
const
|
|
36504
|
+
const walk6 = (a, b, path3) => {
|
|
35601
36505
|
if (hidden(path3)) return;
|
|
35602
36506
|
const ta = jsonType(a);
|
|
35603
36507
|
const tb = jsonType(b);
|
|
@@ -35614,7 +36518,7 @@ function diffJson(published, migrated, masks = []) {
|
|
|
35614
36518
|
if (!hidden(at)) add(at, "missing", { published: left[i] });
|
|
35615
36519
|
} else if (i >= left.length) {
|
|
35616
36520
|
if (!hidden(at)) add(at, "extra", { migrated: right[i] });
|
|
35617
|
-
} else
|
|
36521
|
+
} else walk6(left[i], right[i], at);
|
|
35618
36522
|
}
|
|
35619
36523
|
return;
|
|
35620
36524
|
}
|
|
@@ -35623,7 +36527,7 @@ function diffJson(published, migrated, masks = []) {
|
|
|
35623
36527
|
const right = b;
|
|
35624
36528
|
for (const key of Object.keys(left).sort()) {
|
|
35625
36529
|
const at = [...path3, { key }];
|
|
35626
|
-
if (Object.prototype.hasOwnProperty.call(right, key))
|
|
36530
|
+
if (Object.prototype.hasOwnProperty.call(right, key)) walk6(left[key], right[key], at);
|
|
35627
36531
|
else if (!hidden(at)) add(at, "missing", { published: left[key] });
|
|
35628
36532
|
}
|
|
35629
36533
|
for (const key of Object.keys(right).sort()) {
|
|
@@ -35635,7 +36539,7 @@ function diffJson(published, migrated, masks = []) {
|
|
|
35635
36539
|
}
|
|
35636
36540
|
if (a !== b) add(path3, "value", { published: a, migrated: b });
|
|
35637
36541
|
};
|
|
35638
|
-
|
|
36542
|
+
walk6(published, migrated, []);
|
|
35639
36543
|
return { differences, masked, perMask };
|
|
35640
36544
|
}
|
|
35641
36545
|
function isEmptyAnswer(value) {
|
|
@@ -35655,72 +36559,6 @@ function canonical5(value) {
|
|
|
35655
36559
|
function shortHash(value, salt) {
|
|
35656
36560
|
return createHash4("sha256").update(salt).update(canonical5(value)).digest("hex").slice(0, 8);
|
|
35657
36561
|
}
|
|
35658
|
-
var REACHES_TABLES = /\.\s*(?:data|tables)\b|\.\s*table\b/;
|
|
35659
|
-
var TABLE_WRITE = /\.\s*(insert|update|delete|save|next_number|transaction|assign_author)\b/g;
|
|
35660
|
-
var REACHES_STATE = /\.\s*state\b/;
|
|
35661
|
-
var STATE_WRITE = /\.\s*(set|set_in|delete)\b/g;
|
|
35662
|
-
var REACHES_FILEBOXES = /\bfileboxes\b/;
|
|
35663
|
-
var UPLOAD = /\.\s*upload\b/;
|
|
35664
|
-
var AGENTS = /\.\s*agents\b/;
|
|
35665
|
-
var REACHES_HTTP = /\.\s*http\b/;
|
|
35666
|
-
var HTTP_WRITE = /\.\s*(post|put|patch|delete|request)\b/;
|
|
35667
|
-
var DYNAMIC = /\b(?:getattr|setattr|eval|exec|__import__|methodcaller|attrgetter|partial|partialmethod)\b|__getattribute__|__dict__|\bimportlib\b|\bvars\s*\(/;
|
|
35668
|
-
function codeOnly(code) {
|
|
35669
|
-
let out = "";
|
|
35670
|
-
let i = 0;
|
|
35671
|
-
while (i < code.length) {
|
|
35672
|
-
const ch = code[i];
|
|
35673
|
-
if (ch === "#") {
|
|
35674
|
-
while (i < code.length && code[i] !== "\n") i += 1;
|
|
35675
|
-
continue;
|
|
35676
|
-
}
|
|
35677
|
-
if (ch === '"' || ch === "'") {
|
|
35678
|
-
const prefix = /[A-Za-z]*$/.exec(out)[0];
|
|
35679
|
-
const fString = /f/i.test(prefix);
|
|
35680
|
-
const triple = code.startsWith(ch.repeat(3), i);
|
|
35681
|
-
const close = triple ? ch.repeat(3) : ch;
|
|
35682
|
-
let j = i + close.length;
|
|
35683
|
-
let closed = false;
|
|
35684
|
-
while (j < code.length) {
|
|
35685
|
-
if (code.startsWith(close, j)) {
|
|
35686
|
-
closed = true;
|
|
35687
|
-
break;
|
|
35688
|
-
}
|
|
35689
|
-
if (code[j] === "\\") j += 1;
|
|
35690
|
-
else if (!triple && code[j] === "\n") break;
|
|
35691
|
-
j += 1;
|
|
35692
|
-
}
|
|
35693
|
-
const end = closed ? j + close.length : Math.min(code.length, j);
|
|
35694
|
-
out += fString ? code.slice(i, end) : `${close}${close}`;
|
|
35695
|
-
i = end;
|
|
35696
|
-
continue;
|
|
35697
|
-
}
|
|
35698
|
-
out += ch;
|
|
35699
|
-
i += 1;
|
|
35700
|
-
}
|
|
35701
|
-
return out;
|
|
35702
|
-
}
|
|
35703
|
-
function writeReasons(code) {
|
|
35704
|
-
const text4 = codeOnly(code).normalize("NFKC");
|
|
35705
|
-
const reasons = /* @__PURE__ */ new Set();
|
|
35706
|
-
if (REACHES_TABLES.test(text4)) {
|
|
35707
|
-
for (const match of text4.matchAll(TABLE_WRITE)) reasons.add(`a table write (.${match[1]})`);
|
|
35708
|
-
}
|
|
35709
|
-
if (REACHES_STATE.test(text4)) {
|
|
35710
|
-
for (const match of text4.matchAll(STATE_WRITE)) reasons.add(`a state write (.${match[1]})`);
|
|
35711
|
-
}
|
|
35712
|
-
if (REACHES_FILEBOXES.test(text4) && UPLOAD.test(text4)) reasons.add("a filebox upload (ctx.dr.fileboxes.upload)");
|
|
35713
|
-
if (AGENTS.test(text4)) reasons.add("an agent call (ctx.agents): it starts real work");
|
|
35714
|
-
if (REACHES_HTTP.test(text4) && HTTP_WRITE.test(text4)) reasons.add("an outgoing HTTP call that is not a GET (ctx.http)");
|
|
35715
|
-
if (DYNAMIC.test(text4)) {
|
|
35716
|
-
reasons.add("dynamic access (getattr, eval, partial, methodcaller, an import by name): the call is not known");
|
|
35717
|
-
}
|
|
35718
|
-
if (/[^\x00-\x7f]/.test(codeOnly(code))) reasons.add("a name that is not ASCII: the text may hide a call");
|
|
35719
|
-
return [...reasons].sort();
|
|
35720
|
-
}
|
|
35721
|
-
function handlerText(code, lib) {
|
|
35722
|
-
return [code, ...Object.keys(lib).sort().map((name) => lib[name])].join("\n");
|
|
35723
|
-
}
|
|
35724
36562
|
function missingGrants(disk, stored) {
|
|
35725
36563
|
const asObject = (raw) => typeof raw === "object" && raw !== null && !Array.isArray(raw) ? raw : {};
|
|
35726
36564
|
const have = asObject(stored);
|
|
@@ -35862,18 +36700,20 @@ function sameLib(a, b) {
|
|
|
35862
36700
|
async function compareOne(client, appId, handler, sides, ctx) {
|
|
35863
36701
|
const { published, migrated } = sides;
|
|
35864
36702
|
if (published === void 0) {
|
|
35865
|
-
return { handler, status: "skipped", label: "skipped (new: the published app has no such handler)" };
|
|
36703
|
+
return [{ handler, status: "skipped", label: "skipped (new: the published app has no such handler)" }];
|
|
35866
36704
|
}
|
|
35867
36705
|
if (migrated === void 0) {
|
|
35868
|
-
return
|
|
35869
|
-
|
|
35870
|
-
|
|
35871
|
-
|
|
35872
|
-
|
|
35873
|
-
|
|
36706
|
+
return [
|
|
36707
|
+
{
|
|
36708
|
+
handler,
|
|
36709
|
+
status: "error",
|
|
36710
|
+
label: "error",
|
|
36711
|
+
reasons: [`handlers/${handler}.py is not in the folder: the migrated app has lost this handler`]
|
|
36712
|
+
}
|
|
36713
|
+
];
|
|
35874
36714
|
}
|
|
35875
36715
|
if (published === migrated && sameLib(sides.publishedLib, sides.migratedLib)) {
|
|
35876
|
-
return { handler, status: "unchanged", label: "unchanged (same text, same lib)" };
|
|
36716
|
+
return [{ handler, status: "unchanged", label: "unchanged (same text, same lib)" }];
|
|
35877
36717
|
}
|
|
35878
36718
|
const writes = [
|
|
35879
36719
|
.../* @__PURE__ */ new Set([
|
|
@@ -35881,29 +36721,77 @@ async function compareOne(client, appId, handler, sides, ctx) {
|
|
|
35881
36721
|
...writeReasons(handlerText(migrated, sides.migratedLib))
|
|
35882
36722
|
])
|
|
35883
36723
|
].sort();
|
|
35884
|
-
if (writes.length
|
|
35885
|
-
|
|
36724
|
+
if (writes.length === 0) {
|
|
36725
|
+
const role2 = chooseRole(handler, ctx.view, ctx.asRole);
|
|
36726
|
+
if ("refused" in role2) return [{ handler, status: "skipped", label: "skipped (role)", reasons: [role2.refused] }];
|
|
36727
|
+
return [await runPair(client, appId, { handler, published, migrated, ...sides }, ctx, role2, ctx.payload)];
|
|
36728
|
+
}
|
|
36729
|
+
const pubScan = scanActions(published, sides.publishedLib);
|
|
36730
|
+
const migScan = scanActions(migrated, sides.migratedLib);
|
|
36731
|
+
if (!pubScan.ok || !migScan.ok) {
|
|
36732
|
+
const why = [
|
|
36733
|
+
...pubScan.ok ? [] : [`the published code: ${pubScan.why}`],
|
|
36734
|
+
...migScan.ok ? [] : [`the migrated code: ${migScan.why}`]
|
|
36735
|
+
];
|
|
36736
|
+
return [
|
|
36737
|
+
{
|
|
36738
|
+
handler,
|
|
36739
|
+
status: "skipped",
|
|
36740
|
+
label: "skipped (writes: check by hand)",
|
|
36741
|
+
reasons: [...writes, `no read-only action was found (${why.join("; ")})`]
|
|
36742
|
+
}
|
|
36743
|
+
];
|
|
35886
36744
|
}
|
|
35887
36745
|
const role = chooseRole(handler, ctx.view, ctx.asRole);
|
|
35888
|
-
if ("refused" in role) {
|
|
35889
|
-
|
|
36746
|
+
if ("refused" in role) return [{ handler, status: "skipped", label: "skipped (role)", reasons: [role.refused] }];
|
|
36747
|
+
const pubActions = new Map(pubScan.actions.map((one) => [one.action, one.reasons]));
|
|
36748
|
+
const migActions = new Map(migScan.actions.map((one) => [one.action, one.reasons]));
|
|
36749
|
+
const out = [];
|
|
36750
|
+
for (const action of [.../* @__PURE__ */ new Set([...pubActions.keys(), ...migActions.keys()])].sort()) {
|
|
36751
|
+
const pubReasons = pubActions.get(action);
|
|
36752
|
+
const migReasons = migActions.get(action);
|
|
36753
|
+
if (migReasons === void 0) {
|
|
36754
|
+
out.push({
|
|
36755
|
+
handler,
|
|
36756
|
+
action,
|
|
36757
|
+
status: "error",
|
|
36758
|
+
label: "error",
|
|
36759
|
+
reasons: ["the migrated code has lost this action: the published code dispatches it, the migrated code does not"]
|
|
36760
|
+
});
|
|
36761
|
+
} else if (pubReasons === void 0) {
|
|
36762
|
+
out.push({ handler, action, status: "skipped", label: "skipped (new: the published code has no such action)" });
|
|
36763
|
+
} else if (pubReasons.length > 0 || migReasons.length > 0) {
|
|
36764
|
+
const reasons = [.../* @__PURE__ */ new Set([...pubReasons, ...migReasons])].sort();
|
|
36765
|
+
out.push({ handler, action, status: "skipped", label: "skipped (writes: check by hand)", reasons });
|
|
36766
|
+
} else {
|
|
36767
|
+
const payload = { ...ctx.payload, action };
|
|
36768
|
+
out.push(await runPair(client, appId, { handler, published, migrated, ...sides }, ctx, role, payload, action));
|
|
36769
|
+
}
|
|
35890
36770
|
}
|
|
36771
|
+
return out;
|
|
36772
|
+
}
|
|
36773
|
+
async function runPair(client, appId, sides, ctx, role, payload, action) {
|
|
36774
|
+
const { handler, published, migrated } = sides;
|
|
35891
36775
|
const pub = await dryRunSafely(client, appId, {
|
|
35892
36776
|
code: published,
|
|
35893
|
-
payload
|
|
36777
|
+
payload,
|
|
35894
36778
|
lib: sides.publishedLib,
|
|
35895
36779
|
asRole: role.asRole
|
|
35896
36780
|
});
|
|
35897
36781
|
const mig = await dryRunSafely(client, appId, {
|
|
35898
36782
|
code: migrated,
|
|
35899
|
-
payload
|
|
36783
|
+
payload,
|
|
35900
36784
|
lib: sides.migratedLib,
|
|
35901
36785
|
asRole: role.asRole
|
|
35902
36786
|
});
|
|
35903
|
-
const base = { handler, role: role.role };
|
|
36787
|
+
const base = { handler, ...action === void 0 ? {} : { action }, role: role.role };
|
|
35904
36788
|
const pubWrites = triedToWrite(pub);
|
|
35905
36789
|
const migWrites = triedToWrite(mig);
|
|
36790
|
+
const missed = action !== void 0 && (pubWrites || migWrites) ? ["the static check found no write in this action, but the run tried one: the check missed it. Report this."] : [];
|
|
35906
36791
|
if (pubWrites && migWrites) {
|
|
36792
|
+
if (missed.length > 0) {
|
|
36793
|
+
return { ...base, status: "error", label: "error", reasons: ["both sides tried to write (stopped by the read-only run).", ...missed] };
|
|
36794
|
+
}
|
|
35907
36795
|
return {
|
|
35908
36796
|
...base,
|
|
35909
36797
|
status: "writes",
|
|
@@ -35916,7 +36804,7 @@ async function compareOne(client, appId, handler, sides, ctx) {
|
|
|
35916
36804
|
...pub.ok ? [] : [sideError("published", pub, ctx.showValues)],
|
|
35917
36805
|
...mig.ok ? [] : [sideError("migrated", mig, ctx.showValues)]
|
|
35918
36806
|
];
|
|
35919
|
-
const reasons = [];
|
|
36807
|
+
const reasons = [...missed];
|
|
35920
36808
|
if (pubWrites !== migWrites && (pubWrites ? mig.ok : pub.ok)) {
|
|
35921
36809
|
reasons.push(
|
|
35922
36810
|
`only the ${pubWrites ? "published" : "migrated"} code tried to write (stopped by the read-only run): the two versions do not do the same thing.`
|
|
@@ -36021,7 +36909,8 @@ function renderReport(report, showValues) {
|
|
|
36021
36909
|
for (const one of report.handlers) {
|
|
36022
36910
|
const role = one.role === void 0 || one.role === null ? "" : ` (as ${one.role})`;
|
|
36023
36911
|
const masked = one.masked === void 0 ? "" : ` masked: ${String(one.masked)}`;
|
|
36024
|
-
|
|
36912
|
+
const action = one.action === void 0 ? "" : ` action=${one.action}`;
|
|
36913
|
+
lines.push(` ${one.label.padEnd(width)} ${one.handler}${action}${role}${masked}`);
|
|
36025
36914
|
for (const reason of one.reasons ?? []) lines.push(` ${reason}`);
|
|
36026
36915
|
for (const err of one.errors ?? []) {
|
|
36027
36916
|
const where2 = err.line === void 0 ? "" : ` (line ${String(err.line)})`;
|
|
@@ -36172,7 +37061,7 @@ async function compareInner(dir, opts) {
|
|
|
36172
37061
|
for (const handler of handlerNames) {
|
|
36173
37062
|
if (only.length > 0 && !only.includes(handler)) continue;
|
|
36174
37063
|
results.push(
|
|
36175
|
-
await compareOne(
|
|
37064
|
+
...await compareOne(
|
|
36176
37065
|
client,
|
|
36177
37066
|
appId,
|
|
36178
37067
|
handler,
|
|
@@ -36789,12 +37678,12 @@ function applyDiff(diff, sent) {
|
|
|
36789
37678
|
n += 2;
|
|
36790
37679
|
continue;
|
|
36791
37680
|
}
|
|
36792
|
-
const
|
|
36793
|
-
if (
|
|
37681
|
+
const header2 = HUNK_RE.exec(line2);
|
|
37682
|
+
if (header2 === null || current === null) throw invalid();
|
|
36794
37683
|
const hunk = {
|
|
36795
|
-
oldStart: Number(
|
|
36796
|
-
oldCount:
|
|
36797
|
-
newCount:
|
|
37684
|
+
oldStart: Number(header2[1]),
|
|
37685
|
+
oldCount: header2[2] === void 0 ? 1 : Number(header2[2]),
|
|
37686
|
+
newCount: header2[4] === void 0 ? 1 : Number(header2[4]),
|
|
36798
37687
|
lines: []
|
|
36799
37688
|
};
|
|
36800
37689
|
current.push(hunk);
|
|
@@ -38218,19 +39107,19 @@ function figuresIn(text4) {
|
|
|
38218
39107
|
}
|
|
38219
39108
|
function seriesNumbers(data) {
|
|
38220
39109
|
const out = [];
|
|
38221
|
-
const
|
|
39110
|
+
const walk6 = (one) => {
|
|
38222
39111
|
if (Array.isArray(one)) {
|
|
38223
|
-
for (const item of one)
|
|
39112
|
+
for (const item of one) walk6(item);
|
|
38224
39113
|
return;
|
|
38225
39114
|
}
|
|
38226
39115
|
if (typeof one === "object" && one !== null) {
|
|
38227
|
-
|
|
39116
|
+
walk6(one.value);
|
|
38228
39117
|
return;
|
|
38229
39118
|
}
|
|
38230
39119
|
const n = numberOf(one);
|
|
38231
39120
|
if (n !== null) out.push(n);
|
|
38232
39121
|
};
|
|
38233
|
-
|
|
39122
|
+
walk6(data);
|
|
38234
39123
|
return out;
|
|
38235
39124
|
}
|
|
38236
39125
|
var INPUT_TAGS = /* @__PURE__ */ new Set(["input", "select", "textarea"]);
|
|
@@ -41159,7 +42048,7 @@ async function runScreenshots(opts) {
|
|
|
41159
42048
|
async function readLocalUi(dir) {
|
|
41160
42049
|
const root = join20(dir, "ui");
|
|
41161
42050
|
const out = {};
|
|
41162
|
-
const
|
|
42051
|
+
const walk6 = async (folder) => {
|
|
41163
42052
|
let names;
|
|
41164
42053
|
try {
|
|
41165
42054
|
names = await readdir4(folder, { withFileTypes: true });
|
|
@@ -41168,11 +42057,11 @@ async function readLocalUi(dir) {
|
|
|
41168
42057
|
}
|
|
41169
42058
|
for (const one of names) {
|
|
41170
42059
|
const full = join20(folder, one.name);
|
|
41171
|
-
if (one.isDirectory()) await
|
|
42060
|
+
if (one.isDirectory()) await walk6(full);
|
|
41172
42061
|
else if (one.isFile()) out[relative3(root, full).split(sep7).join("/")] = await readFile14(full);
|
|
41173
42062
|
}
|
|
41174
42063
|
};
|
|
41175
|
-
await
|
|
42064
|
+
await walk6(root);
|
|
41176
42065
|
return out;
|
|
41177
42066
|
}
|
|
41178
42067
|
function looksLikeShelf(root) {
|
|
@@ -42231,21 +43120,21 @@ function partFindings(runs) {
|
|
|
42231
43120
|
const fresh = (component.values ?? []).filter((value) => value.value === "").map((value) => value.field);
|
|
42232
43121
|
if (fresh.length > 0) {
|
|
42233
43122
|
const seen = unfilled.get(where2);
|
|
42234
|
-
const
|
|
43123
|
+
const blank5 = [.../* @__PURE__ */ new Set([...seen?.blank ?? [], ...fresh])];
|
|
42235
43124
|
const named13 = component.props.source;
|
|
42236
43125
|
const answerer = typeof named13 === "string" && named13 !== "" ? `"${named13}"` : "its source";
|
|
42237
43126
|
const finding = {
|
|
42238
43127
|
code: "callout-unfilled",
|
|
42239
43128
|
where: where2,
|
|
42240
|
-
message: `${partName(component)} drew its sentence with no value for ${
|
|
42241
|
-
fix: `make the source answer ${
|
|
43129
|
+
message: `${partName(component)} drew its sentence with no value for ${blank5.map((path3) => `{${path3}}`).join(", ")}: ${answerer} answered nothing at ${blank5.length === 1 ? "that path" : "those paths"}, so the sentence \u2014 and the rule that chose it \u2014 is not about the numbers.`,
|
|
43130
|
+
fix: `make the source answer ${blank5.join(", ")} (app-space try <source> shows the keys it answers), or write the paths it does answer into props.props.rules and the text.`,
|
|
42242
43131
|
see: SEE.parts
|
|
42243
43132
|
};
|
|
42244
43133
|
if (seen === void 0) {
|
|
42245
|
-
unfilled.set(where2, { at: out.length, blank:
|
|
43134
|
+
unfilled.set(where2, { at: out.length, blank: blank5 });
|
|
42246
43135
|
out.push(finding);
|
|
42247
43136
|
} else {
|
|
42248
|
-
seen.blank =
|
|
43137
|
+
seen.blank = blank5;
|
|
42249
43138
|
out[seen.at] = finding;
|
|
42250
43139
|
}
|
|
42251
43140
|
}
|