@somewhere-cloud/cli 0.38.57 → 0.38.60
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/CHANGELOG.md +77 -80
- package/README.md +52 -27
- package/dist/commands/ai.js +1 -1
- package/dist/commands/ai.js.map +1 -1
- package/dist/commands/api.d.ts +1 -1
- package/dist/commands/api.js +2 -2
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/auth.d.ts +3 -3
- package/dist/commands/auth.js +4 -4
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/browser.d.ts +1 -1
- package/dist/commands/browser.js +9 -9
- package/dist/commands/browser.js.map +1 -1
- package/dist/commands/call.d.ts +2 -2
- package/dist/commands/call.js +2 -2
- package/dist/commands/call.js.map +1 -1
- package/dist/commands/check.js +2 -2
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/claim.d.ts +1 -1
- package/dist/commands/claim.js +1 -1
- package/dist/commands/claim.js.map +1 -1
- package/dist/commands/cron.d.ts +1 -1
- package/dist/commands/cron.js +2 -2
- package/dist/commands/cron.js.map +1 -1
- package/dist/commands/db.js +1 -1
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts +9 -9
- package/dist/commands/deploy.js +38 -38
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +2 -2
- package/dist/commands/dev.js +2 -2
- package/dist/commands/docs.d.ts +2 -2
- package/dist/commands/docs.js +8 -8
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/env.js +1 -1
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/init.js +2 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/logs.js +2 -2
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/promote.js +2 -2
- package/dist/commands/promote.js.map +1 -1
- package/dist/commands/rollback.d.ts +1 -1
- package/dist/commands/rollback.js +1 -1
- package/dist/commands/rollback.js.map +1 -1
- package/dist/commands/status.js +2 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/test.js +10 -8
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/typecheck.js +1 -1
- package/dist/commands/typecheck.js.map +1 -1
- package/dist/commands/update.js +1 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/verify.js +5 -5
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/auth.js +1 -1
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/base-files.d.ts +1 -1
- package/dist/lib/browser-actions.js +1 -1
- package/dist/lib/browser-actions.js.map +1 -1
- package/dist/lib/browser-run.d.ts +1 -1
- package/dist/lib/browser-run.js +3 -3
- package/dist/lib/browser-run.js.map +1 -1
- package/dist/lib/build-errors.js +1 -1
- package/dist/lib/claim-handoff.js +1 -1
- package/dist/lib/claim-handoff.js.map +1 -1
- package/dist/lib/client.d.ts +5 -5
- package/dist/lib/client.js +10 -10
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/config.d.ts +5 -5
- package/dist/lib/config.js +5 -5
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/declared-data.js +1 -1
- package/dist/lib/declared-data.js.map +1 -1
- package/dist/lib/deploy-check.d.ts +1 -1
- package/dist/lib/deploy-check.js +2 -2
- package/dist/lib/deploy-check.js.map +1 -1
- package/dist/lib/files.d.ts +4 -4
- package/dist/lib/files.js +5 -5
- package/dist/lib/files.js.map +1 -1
- package/dist/lib/http.d.ts +1 -1
- package/dist/lib/http.js +1 -1
- package/dist/lib/init-agent-guide.d.ts +2 -2
- package/dist/lib/init-agent-guide.js +2 -2
- package/dist/lib/init-feature-template.js +1 -1
- package/dist/lib/init-feature-template.js.map +1 -1
- package/dist/lib/last-run.d.ts +2 -2
- package/dist/lib/last-run.js +1 -1
- package/dist/lib/link-hint.d.ts +1 -1
- package/dist/lib/link-hint.js +1 -1
- package/dist/lib/notify/providers/update.d.ts +1 -1
- package/dist/lib/notify/providers/update.js +1 -1
- package/dist/lib/notify/providers/update.js.map +1 -1
- package/dist/lib/output.d.ts +2 -2
- package/dist/lib/output.js +2 -2
- package/dist/lib/platform-contract.js +1 -1
- package/dist/lib/platform-tools.d.ts +1 -1
- package/dist/lib/platform-tools.js +2 -2
- package/dist/lib/platform-tools.js.map +1 -1
- package/dist/lib/playwright-fixtures.js +10 -11
- package/dist/lib/playwright-fixtures.js.map +1 -1
- package/dist/lib/post-live-render.d.ts +1 -1
- package/dist/lib/post-live-render.js +1 -1
- package/dist/lib/project-pin.d.ts +1 -1
- package/dist/lib/project-pin.js +1 -1
- package/dist/lib/promote-outcome.d.ts +2 -2
- package/dist/lib/promote-outcome.js +2 -2
- package/dist/lib/publish-surface.js +1 -1
- package/dist/lib/repro-packet.d.ts +1 -1
- package/dist/lib/repro-packet.js +2 -2
- package/dist/lib/scaffold.d.ts +1 -1
- package/dist/lib/scaffold.js +1 -1
- package/dist/lib/source-lint.d.ts +1 -1
- package/dist/lib/surface-counts.d.ts +1 -1
- package/dist/lib/temp-auth.d.ts +2 -2
- package/dist/lib/temp-auth.js +2 -2
- package/dist/lib/terminal-text.d.ts +1 -1
- package/dist/lib/terminal-text.js +2 -2
- package/dist/lib/test-connectivity.js +0 -2
- package/dist/lib/test-connectivity.js.map +1 -1
- package/dist/lib/test-diagnostics.js +2 -0
- package/dist/lib/test-diagnostics.js.map +1 -1
- package/dist/lib/test-reporter.js +1 -1
- package/dist/lib/test-reporter.js.map +1 -1
- package/dist/lib/test-target.d.ts +10 -0
- package/dist/lib/test-target.js +18 -0
- package/dist/lib/test-target.js.map +1 -0
- package/dist/lib/typecheck.d.ts +3 -3
- package/dist/lib/typecheck.js +2 -2
- package/dist/lib/vendor/deploy-paths.d.ts +0 -11
- package/dist/lib/vendor/deploy-paths.js +0 -27
- package/dist/lib/vendor/deploy-paths.js.map +1 -1
- package/dist/lib/vendor/repro-guidance.d.ts +0 -31
- package/dist/lib/vendor/repro-guidance.js +0 -37
- package/dist/lib/vendor/repro-guidance.js.map +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/lib/version.js.map +1 -1
- package/dist/types.d.ts +4 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/runtime/DECLARED-DATA-VENDOR.json +8 -7
- package/runtime/PLATFORM-SOURCE.json +1 -2
- package/runtime/SOURCE-LINT-VENDOR.json +9 -8
- package/runtime/VENDOR.json +1 -2
- package/runtime/browser-probes.mjs +1 -1
- package/runtime/declared-data.cjs +163 -143
- package/runtime/source-lint.cjs +542 -500
package/runtime/source-lint.cjs
CHANGED
|
@@ -25,16 +25,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
25
|
return to;
|
|
26
26
|
};
|
|
27
27
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
32
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
33
33
|
mod
|
|
34
34
|
));
|
|
35
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
var require_function_route = __commonJS({
|
|
39
39
|
"worker/containers/compile/function-route.cjs"(exports, module2) {
|
|
40
40
|
"use strict";
|
|
@@ -78,43 +78,58 @@ var require_function_route = __commonJS({
|
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
|
|
82
|
+
function createConsoleDiagnostics() {
|
|
83
|
+
function sanitizeMessage(input) {
|
|
84
|
+
return input.slice(0, 8192).replace(/https?:\/\/[^\s<>"')]+/gi, (url) => url.replace(/(https?:\/\/)[^/@\s]+@/gi, "$1<redacted>@").split(/[?#]/, 1)[0]).replace(/(["']?(?:password|code|token|key|secret|signature|access_token|refresh_token|authorization|cookie)["']?\s*:\s*)(?:"[^"]*"|'[^']*'|[^\s,}]+)/gi, "$1<redacted>").replace(/\b(?:Cookie|Set-Cookie)\s*[:=]\s*[^\r\n]+/gi, "Cookie: <redacted>").replace(/\bBearer\s+[^\s,;'"<>]+/gi, "Bearer <redacted>").replace(/\b(?:token|code|key|secret|password|signature|access_token|refresh_token|session|sid|sessionid)\s*=\s*(?:"[^"]*"|'[^']*'|[^\s&;,]+)/gi, (match) => match.slice(0, match.indexOf("=") + 1) + "<redacted>").replace(/[A-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "<email>").replace(/\b[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g, "<redacted>").replace(/\b(?:smt_|(?:sk|pk)[_-])[A-Za-z0-9_-]+/g, "<redacted>").replace(/[A-Za-z0-9+/_-]{32,}={0,2}/g, "<redacted>").slice(0, 300);
|
|
85
|
+
}
|
|
86
|
+
function safeError(value) {
|
|
87
|
+
try {
|
|
88
|
+
const record = Object.create(null);
|
|
89
|
+
if (value && typeof value === "object") {
|
|
90
|
+
let current2 = value;
|
|
91
|
+
for (let depth = 0; current2 && depth < 6; depth++, current2 = Object.getPrototypeOf(current2)) {
|
|
92
|
+
for (const key of ["name", "message", "status", "code", "stack"]) {
|
|
93
|
+
if (Object.hasOwn(record, key)) continue;
|
|
94
|
+
const descriptor = Object.getOwnPropertyDescriptor(current2, key);
|
|
95
|
+
if (descriptor) record[key] = "value" in descriptor ? descriptor.value : "[Getter]";
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const name = typeof record.name === "string" ? sanitizeMessage(record.name).slice(0, 80) : "Error";
|
|
100
|
+
const message = typeof record.message === "string" ? record.message : typeof value === "string" ? value : "Unknown error";
|
|
101
|
+
const status = typeof record.status === "number" && Number.isInteger(record.status) && record.status >= 100 && record.status <= 599 ? record.status : 0;
|
|
102
|
+
const failure = /Network connection lost/i.test(message) ? "connection_lost" : /DEADLINE|timed? ?out/i.test(message) ? "deadline_exceeded" : /object.*reset|reset.*object/i.test(message) ? "object_reset" : /no such column/i.test(message) ? "missing_column" : /no such table/i.test(message) ? "missing_table" : /SQLITE_CONSTRAINT|constraint failed/i.test(message) ? "constraint" : /overload|too many requests/i.test(message) ? "overloaded" : "unclassified";
|
|
103
|
+
const code = typeof record.code === "string" && /^[A-Z][A-Z0-9_]{0,63}$/.test(record.code) ? sanitizeMessage(record.code) : void 0;
|
|
104
|
+
const frames = typeof record.stack === "string" ? record.stack.split("\n").slice(1).flatMap((line) => {
|
|
105
|
+
const match = line.match(/([^\s()]+?):(\d+)(?::\d+)?\)?$/);
|
|
106
|
+
if (!match) return [];
|
|
107
|
+
const file = match[1].split(/[\\/]/).pop() ?? "";
|
|
108
|
+
return [sanitizeMessage(file) + ":" + match[2]];
|
|
109
|
+
}).slice(0, 2) : [];
|
|
110
|
+
return name + " message=" + JSON.stringify(sanitizeMessage(message)) + " status=" + status + (code ? " code=" + code : "") + " class=" + failure + (frames.length ? " frames=" + frames.join(",") : "");
|
|
111
|
+
} catch {
|
|
112
|
+
return "Error class=uninspectable";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return { sanitizeMessage, safeError };
|
|
116
|
+
}
|
|
117
|
+
var diagnostics, sanitizeConsoleMessage, safeConsoleError;
|
|
118
|
+
var init_console_privacy = __esm({
|
|
119
|
+
"worker/src/utils/console-privacy.ts"() {
|
|
85
120
|
"use strict";
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// OAuth callbacks carry one-use credentials even when validation refuses them.
|
|
90
|
-
"code",
|
|
91
|
-
"state",
|
|
92
|
-
// A creator or link secret belongs only in a request body; a stray query copy is never kept.
|
|
93
|
-
"creator_secret",
|
|
94
|
-
"secret",
|
|
95
|
-
"signature",
|
|
96
|
-
"api_key",
|
|
97
|
-
"apikey",
|
|
98
|
-
"token",
|
|
99
|
-
"key",
|
|
100
|
-
"sig",
|
|
101
|
-
// A DSN carries its own password, and percent-encoding hides it from the
|
|
102
|
-
// Postgres URI rule below. `password` covers the other connection-string
|
|
103
|
-
// form, `postgres://reader@host/db?password=…`, which has no userinfo
|
|
104
|
-
// password for that rule to match.
|
|
105
|
-
"dsn",
|
|
106
|
-
"password"
|
|
107
|
-
];
|
|
108
|
-
SENSITIVE_PARAM_NAMES = new Set(SENSITIVE_PARAMS);
|
|
121
|
+
diagnostics = createConsoleDiagnostics();
|
|
122
|
+
sanitizeConsoleMessage = diagnostics.sanitizeMessage;
|
|
123
|
+
safeConsoleError = diagnostics.safeError;
|
|
109
124
|
}
|
|
110
125
|
});
|
|
111
126
|
|
|
112
|
-
|
|
127
|
+
|
|
113
128
|
var require_declared_data_contract = __commonJS({
|
|
114
129
|
"worker/containers/compile/declared-data-contract.cjs"(exports, module2) {
|
|
115
130
|
"use strict";
|
|
116
131
|
var identifier = /^[a-z_][a-z0-9_]*$/;
|
|
117
|
-
var types2 =
|
|
132
|
+
var types2 = new Set(["integer", "bigint", "number", "text", "boolean", "timestamp", "json", "blob"]);
|
|
118
133
|
function canonicalBigintText(value) {
|
|
119
134
|
if (typeof value !== "string" || !/^(0|-?[1-9][0-9]*)$/.test(value)) return false;
|
|
120
135
|
const digits = value.startsWith("-") ? value.slice(1) : value;
|
|
@@ -189,8 +204,8 @@ var require_declared_data_contract = __commonJS({
|
|
|
189
204
|
}
|
|
190
205
|
function hiddenByBranch(table) {
|
|
191
206
|
const reads = table.policy && table.policy.k === "a" ? table.policy.reads : void 0;
|
|
192
|
-
if (!reads) return
|
|
193
|
-
const hidden =
|
|
207
|
+
if (!reads) return new Set();
|
|
208
|
+
const hidden = new Set();
|
|
194
209
|
for (const list of reads) if (list) {
|
|
195
210
|
for (const column of table.columns) if (!list.includes(column.n)) hidden.add(column.n);
|
|
196
211
|
}
|
|
@@ -227,7 +242,7 @@ var require_declared_data_contract = __commonJS({
|
|
|
227
242
|
record(scopes, "scopes");
|
|
228
243
|
const tables = [];
|
|
229
244
|
const membershipTables = new Set(Object.values(schema).filter((table) => table && table.member).map((table) => table.member.m));
|
|
230
|
-
const grantTables =
|
|
245
|
+
const grantTables = new Set();
|
|
231
246
|
for (const table of Object.values(schema)) if (table?.policy) policyMembershipTables(table.policy, membershipTables, grantTables);
|
|
232
247
|
for (const name of grantTables) {
|
|
233
248
|
const grant = schema[name];
|
|
@@ -248,7 +263,7 @@ var require_declared_data_contract = __commonJS({
|
|
|
248
263
|
if (!identifier.test(name) || name.startsWith("_") || name.startsWith("sqlite_")) fail(`table ${name}`);
|
|
249
264
|
record(table.client, `${name}.client`);
|
|
250
265
|
if (!Array.isArray(table.columns) || !table.columns.length) fail(`${name}.columns`);
|
|
251
|
-
const seen =
|
|
266
|
+
const seen = new Set();
|
|
252
267
|
const columns = table.columns.map((column) => {
|
|
253
268
|
record(column, `${name}.column`);
|
|
254
269
|
if (typeof column.n !== "string" || !identifier.test(column.n) || seen.has(column.n) || !types2.has(column.t)) fail(`${name}.column`);
|
|
@@ -395,7 +410,7 @@ var require_declared_data_contract = __commonJS({
|
|
|
395
410
|
if (declared === void 0) continue;
|
|
396
411
|
if (!Array.isArray(declared)) fail(`${table.name}.relations`);
|
|
397
412
|
const relations = [];
|
|
398
|
-
const names =
|
|
413
|
+
const names = new Set();
|
|
399
414
|
for (const relation of declared) {
|
|
400
415
|
record(relation, `${table.name}.relation`);
|
|
401
416
|
if (Object.keys(relation).some((key) => !["name", "kind", "table", "fk", "parentKey"].includes(key))) fail(`${table.name}.relation`);
|
|
@@ -433,7 +448,7 @@ var require_declared_data_contract = __commonJS({
|
|
|
433
448
|
const type = { integer: "number", bigint: "string", number: "number", text: "string", timestamp: "string", boolean: "boolean", json: "Json", blob: "number[]" }[column.t];
|
|
434
449
|
return column.nul ? `${type} | null` : type;
|
|
435
450
|
}
|
|
436
|
-
function shape(columns, names, mode, required =
|
|
451
|
+
function shape(columns, names, mode, required = new Set(), hidden = new Set()) {
|
|
437
452
|
const values = names.map((name) => {
|
|
438
453
|
const column = columns.find((candidate) => candidate.n === name);
|
|
439
454
|
const optional = mode === "update" || mode === "create" && !required.has(name) && (column.d || column.nul) || mode === "read" && hidden.has(name);
|
|
@@ -627,8 +642,8 @@ async function intake(table, reference, values, extra) {
|
|
|
627
642
|
for (const table of tables) {
|
|
628
643
|
const { name, columns, client, primaryKey } = table;
|
|
629
644
|
const readable = client.read === true ? columns.filter((column) => column.n !== table.author).map((column) => column.n) : client.read || [];
|
|
630
|
-
const hidden = generation >= 5 ? hiddenByBranch(table) :
|
|
631
|
-
const row = shape(columns, readable, "read",
|
|
645
|
+
const hidden = generation >= 5 ? hiddenByBranch(table) : new Set();
|
|
646
|
+
const row = shape(columns, readable, "read", new Set(), hidden);
|
|
632
647
|
const id = columnType(columns.find((column) => column.n === primaryKey));
|
|
633
648
|
const operations = [];
|
|
634
649
|
const methods = [];
|
|
@@ -663,7 +678,7 @@ async function intake(table, reference, values, extra) {
|
|
|
663
678
|
}
|
|
664
679
|
const mutation = client.read === false ? "{ count: number; changes: number }" : `{ data: ${row} | null; count: number; changes: number }`;
|
|
665
680
|
if (client.create !== null) {
|
|
666
|
-
const required = table.policy?.k === "p" ?
|
|
681
|
+
const required = table.policy?.k === "p" ? new Set([table.policy.v]) : new Set();
|
|
667
682
|
const eligible = columns.some((column) => column.n === primaryKey && column.t === "integer") && !columns.some((column) => column.t === "blob");
|
|
668
683
|
if (receiptCapable && eligible) receiptTables.push(name);
|
|
669
684
|
operations.push(`create(values: ${shape(columns, client.create, "create", required)}): Promise<${receiptCapable && eligible ? `InsertResult<${mutation}>` : mutation}>`);
|
|
@@ -693,7 +708,7 @@ async function intake(table, reference, values, extra) {
|
|
|
693
708
|
childRelations.push(`${JSON.stringify(relationName)}: { list<const L extends number = number>(parentId: ${id}, options?: { limit?: L & (number extends L ? unknown : [L] extends [PageSize] ? unknown : never); after?: ${childId} }): Promise<{ data: ${childRow}[]; next: ${childId} | null; has_more: boolean }> }`);
|
|
694
709
|
const childUpdate = child.client.update ? child.client.update.filter((field) => field !== relation.fk) : [];
|
|
695
710
|
const childOps = [];
|
|
696
|
-
if (child.client.create !== null) childOps.push(`create(values: ${shape(child.columns, child.client.create, "create",
|
|
711
|
+
if (child.client.create !== null) childOps.push(`create(values: ${shape(child.columns, child.client.create, "create", new Set([relation.fk]))}): Promise<{ data: ${childRow} | null; count: number; changes: number }>`);
|
|
697
712
|
if (childUpdate.length) childOps.push(`update(id: ${childId}, values: ${shape(child.columns, childUpdate, "update")}): Promise<{ data: ${childRow} | null; count: number; changes: number }>`);
|
|
698
713
|
if (childOps.length) creatorDeclarations.push(`${JSON.stringify(child.name)}: { ${childOps.join("; ")} }`);
|
|
699
714
|
childSpecs.push([relationName, child.name, child.client.create !== null, childUpdate.length > 0]);
|
|
@@ -753,7 +768,7 @@ async function intake(table, reference, values, extra) {
|
|
|
753
768
|
const canCreate = links.edit.length > 0 && child.client.create !== null;
|
|
754
769
|
const childUpdate = child.client.update ? child.client.update.filter((field) => field !== relation.fk) : [];
|
|
755
770
|
const canUpdate = links.edit.length > 0 && childUpdate.length > 0;
|
|
756
|
-
if (canCreate) childOps.push(`create(values: ${shape(child.columns, child.client.create, "create",
|
|
771
|
+
if (canCreate) childOps.push(`create(values: ${shape(child.columns, child.client.create, "create", new Set([relation.fk]))}): Promise<{ data: ${childRow} | null; count: number; changes: number }>`);
|
|
757
772
|
if (canUpdate) childOps.push(`update(id: ${childId}, values: ${shape(child.columns, childUpdate, "update")}): Promise<{ data: ${childRow} | null; count: number; changes: number }>`);
|
|
758
773
|
if (childOps.length) linkedDeclarations.push(`${JSON.stringify(child.name)}: { ${childOps.join("; ")} }`);
|
|
759
774
|
childSpecs.push([relationName, child.name, canCreate, canUpdate]);
|
|
@@ -796,7 +811,7 @@ export{data,DataError};
|
|
|
796
811
|
}
|
|
797
812
|
});
|
|
798
813
|
|
|
799
|
-
|
|
814
|
+
|
|
800
815
|
var source_lint_exports = {};
|
|
801
816
|
__export(source_lint_exports, {
|
|
802
817
|
SOURCE_LINT_VERSION: () => SOURCE_LINT_VERSION,
|
|
@@ -805,7 +820,7 @@ __export(source_lint_exports, {
|
|
|
805
820
|
});
|
|
806
821
|
module.exports = __toCommonJS(source_lint_exports);
|
|
807
822
|
|
|
808
|
-
|
|
823
|
+
|
|
809
824
|
var PLACEHOLDER = /[xX]{8,}|0{8,}|\*{8,}|example|your|replace|placeholder|changeme|dummy|redacted/i;
|
|
810
825
|
var isPlaceholder = (material) => PLACEHOLDER.test(material);
|
|
811
826
|
function anonJwt(material) {
|
|
@@ -826,19 +841,19 @@ var SECRET_PATTERNS = [
|
|
|
826
841
|
{ kind: "platform-developer-key", label: "platform developer key", envName: "SOMEWHERE_API_KEY", pattern: /\bsmt_[A-Za-z0-9]{20,}\b/g, ignore: isPlaceholder },
|
|
827
842
|
{ kind: "stripe-secret-key", label: "Stripe secret or restricted key", envName: "STRIPE_SECRET_KEY", pattern: /\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{20,}\b/g, ignore: isPlaceholder },
|
|
828
843
|
{ kind: "stripe-webhook-secret", label: "Stripe webhook signing secret", envName: "STRIPE_WEBHOOK_SECRET", pattern: /\bwhsec_[A-Za-z0-9+/=]{20,}/g, ignore: isPlaceholder },
|
|
829
|
-
|
|
830
|
-
|
|
844
|
+
|
|
845
|
+
|
|
831
846
|
{ kind: "aws-access-key-id", label: "AWS access key id", envName: "AWS_ACCESS_KEY_ID", pattern: /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g, ignore: isPlaceholder },
|
|
832
847
|
{ kind: "github-token", label: "GitHub access token", envName: "GITHUB_TOKEN", pattern: /\b(?:ghp_|gho_|ghu_|ghs_|ghr_|github_pat_)[A-Za-z0-9_]{20,}\b/g, ignore: isPlaceholder },
|
|
833
848
|
{ kind: "anthropic-api-key", label: "Anthropic API key", envName: "ANTHROPIC_API_KEY", pattern: /\bsk-ant-[A-Za-z0-9_-]{30,}\b/g, ignore: isPlaceholder },
|
|
834
849
|
{ kind: "openai-api-key", label: "OpenAI API key", envName: "OPENAI_API_KEY", pattern: /\bsk-(?:proj-)?[A-Za-z0-9_-]{30,}\b/g, ignore: isPlaceholder },
|
|
835
850
|
{ kind: "slack-token", label: "Slack access token", envName: "SLACK_TOKEN", pattern: /\bxox[baprs]-[A-Za-z0-9-]{20,}\b/g, ignore: isPlaceholder },
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
839
854
|
{ kind: "mailgun-api-key", label: "Mailgun API key", envName: "MAILGUN_API_KEY", pattern: /\bkey-(?=[a-z]*[0-9])(?=[0-9]*[a-z])[a-z0-9]{32}(?![A-Za-z0-9_-])/g, ignore: isPlaceholder },
|
|
840
855
|
{ kind: "sendgrid-api-key", label: "SendGrid API key", envName: "SENDGRID_API_KEY", pattern: /\bSG\.[A-Za-z0-9_-]{16,}\.[A-Za-z0-9_-]{16,}/g, ignore: isPlaceholder },
|
|
841
|
-
|
|
856
|
+
|
|
842
857
|
{
|
|
843
858
|
kind: "signed-token",
|
|
844
859
|
label: "signed access token (JWT)",
|
|
@@ -846,14 +861,14 @@ var SECRET_PATTERNS = [
|
|
|
846
861
|
pattern: /(?<![A-Za-z0-9_.-])eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]{10,}/g,
|
|
847
862
|
ignore: anonJwt
|
|
848
863
|
},
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
857
872
|
{
|
|
858
873
|
kind: "postgres-connection-string",
|
|
859
874
|
label: "Postgres connection string with a password",
|
|
@@ -861,8 +876,8 @@ var SECRET_PATTERNS = [
|
|
|
861
876
|
pattern: /\bpostgres(?:ql)?:\/\/[^\s:/?#@'"`]+:[^\s@'"`]+@[^\s/?#'"`]+/g,
|
|
862
877
|
ignore: placeholderPassword
|
|
863
878
|
},
|
|
864
|
-
|
|
865
|
-
|
|
879
|
+
|
|
880
|
+
|
|
866
881
|
{
|
|
867
882
|
kind: "connection-string",
|
|
868
883
|
label: "database connection string with a password",
|
|
@@ -1077,7 +1092,7 @@ function unwrapWithPreservedLines(literal2, replacedSource) {
|
|
|
1077
1092
|
return literal2 + "\n".repeat(Math.max(0, removedNewlines));
|
|
1078
1093
|
}
|
|
1079
1094
|
function deriveReversibleStrings(source) {
|
|
1080
|
-
const integerArrays =
|
|
1095
|
+
const integerArrays = new Map();
|
|
1081
1096
|
STATIC_INTEGER_ARRAY_BINDING.lastIndex = 0;
|
|
1082
1097
|
let arrayBinding;
|
|
1083
1098
|
while ((arrayBinding = STATIC_INTEGER_ARRAY_BINDING.exec(source)) !== null) {
|
|
@@ -1105,7 +1120,7 @@ function deriveReversibleStrings(source) {
|
|
|
1105
1120
|
return decoded === null ? raw : withPreservedLines(decoded, raw);
|
|
1106
1121
|
}
|
|
1107
1122
|
);
|
|
1108
|
-
const stringArrays =
|
|
1123
|
+
const stringArrays = new Map();
|
|
1109
1124
|
STATIC_STRING_ARRAY_BINDING.lastIndex = 0;
|
|
1110
1125
|
while ((arrayBinding = STATIC_STRING_ARRAY_BINDING.exec(source)) !== null) {
|
|
1111
1126
|
const joined = decodeStringList(arrayBinding[2]);
|
|
@@ -1141,8 +1156,8 @@ function deriveReversibleStrings(source) {
|
|
|
1141
1156
|
return derived;
|
|
1142
1157
|
}
|
|
1143
1158
|
function importSpecifiers(source) {
|
|
1144
|
-
const specifiers =
|
|
1145
|
-
const bindings2 =
|
|
1159
|
+
const specifiers = new Set();
|
|
1160
|
+
const bindings2 = new Map();
|
|
1146
1161
|
STATIC_STRING_BINDING.lastIndex = 0;
|
|
1147
1162
|
IMPORT_SPECIFIER.lastIndex = 0;
|
|
1148
1163
|
let match;
|
|
@@ -1191,7 +1206,7 @@ function resolveImport(fromPath, specifier, files) {
|
|
|
1191
1206
|
return candidates.find((candidate) => typeof files[candidate] === "string") ?? null;
|
|
1192
1207
|
}
|
|
1193
1208
|
function browserReachableFiles(files) {
|
|
1194
|
-
const reachable =
|
|
1209
|
+
const reachable = new Set();
|
|
1195
1210
|
const queue = [];
|
|
1196
1211
|
const htmlPaths = Object.keys(files).filter((path) => HTML_PATH.test(path));
|
|
1197
1212
|
for (const path of htmlPaths) {
|
|
@@ -1245,8 +1260,8 @@ ${body}
|
|
|
1245
1260
|
${endMarker}`;
|
|
1246
1261
|
}
|
|
1247
1262
|
function scanFileForSecrets(file, source, findings) {
|
|
1248
|
-
const findingKeys =
|
|
1249
|
-
const located =
|
|
1263
|
+
const findingKeys = new Set();
|
|
1264
|
+
const located = new Set();
|
|
1250
1265
|
const addFindings = (text, lineSource, originIndex) => {
|
|
1251
1266
|
for (const secret of SECRET_PATTERNS) {
|
|
1252
1267
|
secret.pattern.lastIndex = 0;
|
|
@@ -1303,19 +1318,24 @@ function scanSourceForSecrets(files, functions) {
|
|
|
1303
1318
|
return findings;
|
|
1304
1319
|
}
|
|
1305
1320
|
|
|
1306
|
-
|
|
1321
|
+
|
|
1307
1322
|
var import_function_route = __toESM(require_function_route());
|
|
1308
1323
|
|
|
1309
|
-
|
|
1324
|
+
|
|
1310
1325
|
var VERIFY_SIGNUP_FETCH_PROLOGUE = " const verifySignup = await __sw_captureVerifySignup(request); request = verifySignup.request;";
|
|
1311
1326
|
|
|
1312
|
-
|
|
1327
|
+
|
|
1328
|
+
init_console_privacy();
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
init_console_privacy();
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
init_console_privacy();
|
|
1335
|
+
init_console_privacy();
|
|
1313
1336
|
var COMPILE_UNAVAILABLE_REALERT_MS = 60 * 60 * 1e3;
|
|
1314
1337
|
|
|
1315
|
-
// worker/src/utils/authority.ts
|
|
1316
|
-
init_log_sanitize();
|
|
1317
1338
|
|
|
1318
|
-
// worker/src/utils/function-bundle-transport.ts
|
|
1319
1339
|
var NATIVE_RUNTIME_SERVICE_BINDING = "RUNTIME_PLATFORM_API";
|
|
1320
1340
|
var MANAGED_RUNTIME_SERVICE_BINDING = "RUNTIME_MANAGED_DATA";
|
|
1321
1341
|
var OUTBOUND_BRIDGE_HANDLER_PREFIX = "async fetch(request, env, ctx) {\n" + VERIFY_SIGNUP_FETCH_PROLOGUE + "\n // Establish artifact-owned data authority before any environment read.\n __sw_assertBridgeRuntime(env);\n env = __sw_declaredDataEnv(env);";
|
|
@@ -1342,12 +1362,12 @@ var BINDING_META_BEFORE_CAPTURE = ` // Reserved candidate proof: checked agai
|
|
|
1342
1362
|
}
|
|
1343
1363
|
`;
|
|
1344
1364
|
|
|
1345
|
-
|
|
1365
|
+
|
|
1346
1366
|
var RETAINED_PREFIX = "_sw_retained__";
|
|
1347
1367
|
var RETENTION_DAYS = 30;
|
|
1348
1368
|
var RETENTION_MS = RETENTION_DAYS * 24 * 3600 * 1e3;
|
|
1349
1369
|
|
|
1350
|
-
|
|
1370
|
+
|
|
1351
1371
|
var RETIRED_TABLE_JS = ` // A read of a table retired with removedTable() (pfb_cdfc184b9e7c): name
|
|
1352
1372
|
// the table, its retention date, and how to restore it. Mirrors
|
|
1353
1373
|
// utils/db-schema-deploy/retired-table.ts.
|
|
@@ -1392,11 +1412,11 @@ var RETIRED_TABLE_JS = ` // A read of a table retired with removedTable() (
|
|
|
1392
1412
|
}
|
|
1393
1413
|
`;
|
|
1394
1414
|
|
|
1395
|
-
|
|
1415
|
+
|
|
1396
1416
|
var DATABASE_FULL_PATTERN = /SQLITE_FULL|database or disk is full|database is full|at maximum size|exceeds the maximum database size|database size limit (?:has been )?(?:reached|exceeded)/i;
|
|
1397
1417
|
var DATABASE_FULL_MESSAGE = "The database could not complete this write because its storage is full. Database storage and the account allowance are shown under Usage in the dashboard.";
|
|
1398
1418
|
|
|
1399
|
-
|
|
1419
|
+
|
|
1400
1420
|
var DB_TYPED_ERRORS_JS = ` // The REST bridge's refusal as the caller sees it. A typed envelope
|
|
1401
1421
|
// { error, message } becomes that code and message; anything else keeps
|
|
1402
1422
|
// the fallback code and never pastes a JSON body into the message.
|
|
@@ -1634,7 +1654,7 @@ var DB_OUTCOME_ERROR_CODES = Object.freeze([
|
|
|
1634
1654
|
"IDEMPOTENCY_TRIGGER_WRITE",
|
|
1635
1655
|
"IDEMPOTENCY_UNAVAILABLE",
|
|
1636
1656
|
"IDEMPOTENCY_RECEIPT_INVALID",
|
|
1637
|
-
|
|
1657
|
+
|
|
1638
1658
|
"CREATOR_OUTCOME_UNKNOWN"
|
|
1639
1659
|
]);
|
|
1640
1660
|
var DB_OUTCOME_ERROR_JS = String.raw`
|
|
@@ -1664,17 +1684,39 @@ function __sw_runtimeErrorMetadata(error) {
|
|
|
1664
1684
|
}
|
|
1665
1685
|
`;
|
|
1666
1686
|
|
|
1667
|
-
|
|
1687
|
+
|
|
1668
1688
|
var LEGACY_DATABASE_LAYOUT = Object.freeze({ layout: "legacy" });
|
|
1669
1689
|
|
|
1670
|
-
|
|
1690
|
+
|
|
1691
|
+
init_console_privacy();
|
|
1671
1692
|
var RUNTIME_CONSOLE_MAX_ENTRIES = 200;
|
|
1672
1693
|
var RUNTIME_CONSOLE_MAX_BYTES = 64 * 1024;
|
|
1673
1694
|
var RUNTIME_CONSOLE_MAX_ENTRY_BYTES = 4 * 1024;
|
|
1674
|
-
var RUNTIME_NATIVE_CONSOLE_JS =
|
|
1695
|
+
var RUNTIME_NATIVE_CONSOLE_JS = `
|
|
1696
|
+
const __sw_consoleDiagnostics = (function () {
|
|
1697
|
+
// Name annotations inserted by the build tool have no runtime dependency.
|
|
1698
|
+
const __name = function (value) { return value; };
|
|
1699
|
+
return (${createConsoleDiagnostics.toString()})();
|
|
1700
|
+
})();
|
|
1675
1701
|
const __sw_nativeConsole = Object.freeze(Object.fromEntries(
|
|
1676
1702
|
['log', 'info', 'warn', 'error', 'debug'].map(function (level) {
|
|
1677
|
-
|
|
1703
|
+
const output = globalThis.console[level].bind(globalThis.console);
|
|
1704
|
+
return [level, function () {
|
|
1705
|
+
try {
|
|
1706
|
+
const values = Array.from(arguments).slice(0, 16).map(function (value) {
|
|
1707
|
+
if (value && (typeof value === 'object' || typeof value === 'function')) {
|
|
1708
|
+
try {
|
|
1709
|
+
const message = Object.getOwnPropertyDescriptor(value, 'message');
|
|
1710
|
+
const stack = Object.getOwnPropertyDescriptor(value, 'stack');
|
|
1711
|
+
if (message && stack) return __sw_consoleDiagnostics.safeError(value);
|
|
1712
|
+
} catch (_) { return '[Uninspectable]'; }
|
|
1713
|
+
return '[Structured log omitted]';
|
|
1714
|
+
}
|
|
1715
|
+
return typeof value === 'string' ? __sw_consoleDiagnostics.sanitizeMessage(value) : value;
|
|
1716
|
+
});
|
|
1717
|
+
return output.apply(null, values);
|
|
1718
|
+
} catch (_) { return undefined; }
|
|
1719
|
+
}];
|
|
1678
1720
|
})
|
|
1679
1721
|
));
|
|
1680
1722
|
`;
|
|
@@ -1807,7 +1849,7 @@ function __sw_createConsoleScope(env, request) {
|
|
|
1807
1849
|
}
|
|
1808
1850
|
`;
|
|
1809
1851
|
|
|
1810
|
-
|
|
1852
|
+
|
|
1811
1853
|
var RUNTIME_LOG_LIFECYCLE_JS = String.raw`
|
|
1812
1854
|
function drainPendingBackground(platformCtx, ctx) {
|
|
1813
1855
|
const pending = (platformCtx && platformCtx.__sw_pendingBackground) || [];
|
|
@@ -1826,7 +1868,7 @@ function drainPendingBackground(platformCtx, ctx) {
|
|
|
1826
1868
|
|
|
1827
1869
|
`;
|
|
1828
1870
|
|
|
1829
|
-
|
|
1871
|
+
|
|
1830
1872
|
var RUNTIME_HOT_CONFIG_PATH = "/v1/runtime/hot-config";
|
|
1831
1873
|
var RUNTIME_HOT_CONFIG_REPLY_MAX_BYTES = 64 * 1024;
|
|
1832
1874
|
var HOT_CONFIG_PULL_JS = `
|
|
@@ -1883,11 +1925,11 @@ async function __sw_hotConfigPull(env) {
|
|
|
1883
1925
|
}
|
|
1884
1926
|
`;
|
|
1885
1927
|
|
|
1886
|
-
|
|
1928
|
+
|
|
1887
1929
|
var APP_ACCESS_MAX_SECONDS = 60;
|
|
1888
1930
|
var APP_ACCESS_SELECTION_MARGIN_SECONDS = 5;
|
|
1889
1931
|
|
|
1890
|
-
|
|
1932
|
+
|
|
1891
1933
|
var ACCESS_TOKEN_JS = `const __sw_accessNow = Date.now.bind(Date);
|
|
1892
1934
|
const __sw_accessInteger = Number.isSafeInteger.bind(Number);
|
|
1893
1935
|
/** Portable access JWT: no network or isolate identity state. Public key only. */
|
|
@@ -1916,7 +1958,7 @@ async function __sw_verifyAccessToken(binding, token, audience) {
|
|
|
1916
1958
|
|
|
1917
1959
|
`;
|
|
1918
1960
|
|
|
1919
|
-
|
|
1961
|
+
|
|
1920
1962
|
var APP_MCP_CONTEXT_JS = `
|
|
1921
1963
|
const __sw_mcpRequest = __sw_signedDelivery && __sw_signedDelivery.source === 'mcp'
|
|
1922
1964
|
? new Request(request.clone(), { headers: { 'content-type': 'application/json' } }) : null;
|
|
@@ -1932,7 +1974,7 @@ var APP_MCP_CONTEXT_JS = `
|
|
|
1932
1974
|
}
|
|
1933
1975
|
`;
|
|
1934
1976
|
|
|
1935
|
-
|
|
1977
|
+
|
|
1936
1978
|
var CONTEXT_HEAD_JS = `// \u2500\u2500 Primordial freeze (tsk_327fe8a4, opinionated-not-greenfield) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1937
1979
|
// The structured-query guard, the cookie jars, and the identity path all rely
|
|
1938
1980
|
// on core JavaScript built-ins behaving as specified. Customer/npm code in the
|
|
@@ -3823,12 +3865,12 @@ function buildPlatformContext(env, request, runtimeFetch = fetch, outboundFetch
|
|
|
3823
3865
|
// login path verifies their existing bcrypt hashes. One verify
|
|
3824
3866
|
// is ~10-50ms CPU; don't loop it.`;
|
|
3825
3867
|
|
|
3826
|
-
|
|
3868
|
+
|
|
3827
3869
|
var FETCH_JS = ` /** @deprecated Use the wrapped global fetch directly. */
|
|
3828
3870
|
fetch: __sw_outboundFetch,
|
|
3829
3871
|
`;
|
|
3830
3872
|
|
|
3831
|
-
|
|
3873
|
+
|
|
3832
3874
|
var CRYPTO_JS = ` crypto: {
|
|
3833
3875
|
hmacSha256Hex: async function (message, secret) {
|
|
3834
3876
|
const enc = new TextEncoder();
|
|
@@ -3864,10 +3906,10 @@ var CRYPTO_JS = ` crypto: {
|
|
|
3864
3906
|
},
|
|
3865
3907
|
`;
|
|
3866
3908
|
|
|
3867
|
-
|
|
3909
|
+
|
|
3868
3910
|
var CODE_RUN_RELEASE_HEADER = "X-Sw-Code-Run-Release";
|
|
3869
3911
|
|
|
3870
|
-
|
|
3912
|
+
|
|
3871
3913
|
function managedIntentFromIR(ir, schema) {
|
|
3872
3914
|
if (ir.table.kind !== "project") throw new Error("Managed queries require a declared project table.");
|
|
3873
3915
|
const predicates = {
|
|
@@ -3921,16 +3963,16 @@ function managedIntentFromIR(ir, schema) {
|
|
|
3921
3963
|
}
|
|
3922
3964
|
var MANAGED_INTENT_WIRE_SOURCE = `(${managedIntentFromIR.toString()})`;
|
|
3923
3965
|
|
|
3924
|
-
|
|
3966
|
+
|
|
3925
3967
|
var SQL_TOKEN_PATTERN = /\s+|--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$)|[xX]'(?:[^']*)'|'(?:''|[^'])*'|"(?:""|[^"])*"|`(?:``|[^`])*`|\[[^\]]*\]|0[xX][0-9a-fA-F]+|(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?|[A-Za-z_\u0080-][A-Za-z0-9_$\u0080-]*|[\s\S]/g;
|
|
3926
3968
|
var SQL_BLOB_START = /^[xX]'/;
|
|
3927
3969
|
var SQL_WORD_START = /^[A-Za-z_\u0080-]/;
|
|
3928
3970
|
|
|
3929
|
-
|
|
3971
|
+
|
|
3930
3972
|
var READ_FIRST_KEYWORDS = ["SELECT", "WITH", "VALUES"];
|
|
3931
3973
|
var WRITE_KEYWORDS = ["INSERT", "UPDATE", "DELETE"];
|
|
3932
3974
|
|
|
3933
|
-
|
|
3975
|
+
|
|
3934
3976
|
var PLATFORM_DATA_DOOR_VERSION = 1;
|
|
3935
3977
|
var PLATFORM_DATA_DOOR_LIMITS = Object.freeze({ statements: 100, sqlBytes: 1e5, params: 100 });
|
|
3936
3978
|
var PLATFORM_DATA_RESPONSE_MAX_BYTES = 4 * 1024 * 1024;
|
|
@@ -4100,13 +4142,13 @@ function fnv1a(text) {
|
|
|
4100
4142
|
}
|
|
4101
4143
|
var PLATFORM_DATA_DOOR_REVISION = `door-${PLATFORM_DATA_DOOR_VERSION}-${fnv1a(PLATFORM_DATA_DOOR_SOURCE)}`;
|
|
4102
4144
|
|
|
4103
|
-
|
|
4145
|
+
|
|
4104
4146
|
function createBoundedReplyReader(maxBytes) {
|
|
4105
4147
|
const bounded = {
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4148
|
+
|
|
4149
|
+
|
|
4150
|
+
|
|
4151
|
+
|
|
4110
4152
|
async read(response, deadline) {
|
|
4111
4153
|
const declared = Number(response.headers.get("content-length"));
|
|
4112
4154
|
if (Number.isFinite(declared) && declared > maxBytes) {
|
|
@@ -4152,10 +4194,10 @@ function createBoundedReplyReader(maxBytes) {
|
|
|
4152
4194
|
return { ok: false, reason: "transport" };
|
|
4153
4195
|
}
|
|
4154
4196
|
},
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4197
|
+
|
|
4198
|
+
|
|
4199
|
+
|
|
4200
|
+
|
|
4159
4201
|
async fetch(send, timeoutMs) {
|
|
4160
4202
|
let timer;
|
|
4161
4203
|
const deadline = new Promise((resolve) => {
|
|
@@ -4187,7 +4229,7 @@ var readBoundedReply = defaultReader.read;
|
|
|
4187
4229
|
var fetchBoundedReply = defaultReader.fetch;
|
|
4188
4230
|
var BOUNDED_REPLY_READER_SOURCE = `(${createBoundedReplyReader.toString()})`;
|
|
4189
4231
|
|
|
4190
|
-
|
|
4232
|
+
|
|
4191
4233
|
var DB_ROW_LINKS_JS = `
|
|
4192
4234
|
let __sw_linkAuthority = null;
|
|
4193
4235
|
function __sw_linkUnavailable() {
|
|
@@ -4322,7 +4364,7 @@ var DB_ROW_LINKS_JS = `
|
|
|
4322
4364
|
});
|
|
4323
4365
|
`;
|
|
4324
4366
|
|
|
4325
|
-
|
|
4367
|
+
|
|
4326
4368
|
var DB_INTAKE_JS = `
|
|
4327
4369
|
async function __sw_clientIntakePost(payload, clientIp) {
|
|
4328
4370
|
if (!__sw_usesManagedEndpoint() || !env.SW_EXECUTION_ATTESTATION || env.SW_CODE_RUN_RELEASE || isDraftExecution) {
|
|
@@ -4374,7 +4416,7 @@ var DB_INTAKE_JS = `
|
|
|
4374
4416
|
});
|
|
4375
4417
|
`;
|
|
4376
4418
|
|
|
4377
|
-
|
|
4419
|
+
|
|
4378
4420
|
var DB_MANAGED_JS = `
|
|
4379
4421
|
const __sw_managedIntent = ${MANAGED_INTENT_WIRE_SOURCE};
|
|
4380
4422
|
const __sw_managedReply = ${BOUNDED_REPLY_READER_SOURCE}(${PLATFORM_DATA_RESPONSE_MAX_BYTES});
|
|
@@ -4562,7 +4604,7 @@ var DB_MANAGED_JS = `
|
|
|
4562
4604
|
}
|
|
4563
4605
|
` + DB_ROW_LINKS_JS + DB_INTAKE_JS;
|
|
4564
4606
|
|
|
4565
|
-
|
|
4607
|
+
|
|
4566
4608
|
var DB_STRUCTURED_EXECUTION_JS = ` async function __sw_structExec(label, ir, principalId, mutation, generatedRead) {
|
|
4567
4609
|
ensureBinding();
|
|
4568
4610
|
if (__sw_usesManagedEndpoint()) return __sw_managedCall([{ label: label, ir: ir, principalId: principalId, mutation: mutation }], false, undefined, undefined, generatedRead);
|
|
@@ -4666,7 +4708,7 @@ var DB_STRUCTURED_EXECUTION_JS = ` async function __sw_structExec(label, ir
|
|
|
4666
4708
|
}
|
|
4667
4709
|
`;
|
|
4668
4710
|
|
|
4669
|
-
|
|
4711
|
+
|
|
4670
4712
|
function createSchemaValidator(context) {
|
|
4671
4713
|
const isoTimestampRe = /^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
4672
4714
|
const wholeNumberRe = /^-?\d+$/;
|
|
@@ -4997,7 +5039,7 @@ function createSchemaValidator(context) {
|
|
|
4997
5039
|
}
|
|
4998
5040
|
var SCHEMA_VALIDATOR_JS = " const __sw_createSchemaValidator = (" + createSchemaValidator.toString() + ");\n";
|
|
4999
5041
|
|
|
5000
|
-
|
|
5042
|
+
|
|
5001
5043
|
function renderPolicySql(request) {
|
|
5002
5044
|
const r = request;
|
|
5003
5045
|
if (r.render === "ident") {
|
|
@@ -5507,7 +5549,7 @@ function policyWithoutGrants(policy) {
|
|
|
5507
5549
|
}
|
|
5508
5550
|
var POLICY_SQL_JS = " const __sw_renderPolicySql = (" + renderPolicySql.toString() + ");\n const __sw_policyOwnerColumn = (" + policyOwnerColumn.toString() + ");\n const __sw_policyWithoutGrants = (" + policyWithoutGrants.toString() + ");\n";
|
|
5509
5551
|
|
|
5510
|
-
|
|
5552
|
+
|
|
5511
5553
|
function renderQuerySql(ir, principalId, returning, context) {
|
|
5512
5554
|
if (!ir.table || ir.table.kind !== "project") {
|
|
5513
5555
|
const err = new Error('sw.db: table kind "' + (ir.table && ir.table.kind) + '" is not yet supported \u2014 the structured builder renders project tables only.');
|
|
@@ -5554,10 +5596,10 @@ function renderQuerySql(ir, principalId, returning, context) {
|
|
|
5554
5596
|
params.push(...guard.params);
|
|
5555
5597
|
return guard.sql;
|
|
5556
5598
|
},
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5599
|
+
|
|
5600
|
+
|
|
5601
|
+
|
|
5602
|
+
|
|
5561
5603
|
renderPredicate(p, qualifier) {
|
|
5562
5604
|
if (p.op === "or") {
|
|
5563
5605
|
const branches = [];
|
|
@@ -5589,21 +5631,21 @@ function renderQuerySql(ir, principalId, returning, context) {
|
|
|
5589
5631
|
params.push(p.value);
|
|
5590
5632
|
return col + " " + context.binaryOperators[p.op] + " ?";
|
|
5591
5633
|
},
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5634
|
+
|
|
5635
|
+
|
|
5636
|
+
|
|
5637
|
+
|
|
5638
|
+
|
|
5639
|
+
|
|
5640
|
+
|
|
5641
|
+
|
|
5642
|
+
|
|
5643
|
+
|
|
5644
|
+
|
|
5645
|
+
|
|
5646
|
+
|
|
5647
|
+
|
|
5648
|
+
|
|
5607
5649
|
relationExistsSql(rf) {
|
|
5608
5650
|
const childT = helpers.table(rf.table);
|
|
5609
5651
|
const childAliasName = "__sw_rel";
|
|
@@ -5626,13 +5668,13 @@ function renderQuerySql(ir, principalId, returning, context) {
|
|
|
5626
5668
|
frags.push(helpers.linkGuard(rf.scope.link, childAlias + "." + q(rf.scope.link.column), null));
|
|
5627
5669
|
return "EXISTS (SELECT 1 FROM " + childT + " AS " + childAlias + " WHERE " + frags.join(" AND ") + ")";
|
|
5628
5670
|
},
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5671
|
+
|
|
5672
|
+
|
|
5673
|
+
|
|
5674
|
+
|
|
5675
|
+
|
|
5676
|
+
|
|
5677
|
+
|
|
5636
5678
|
policySql(rendered) {
|
|
5637
5679
|
for (let i = 0; i < rendered.params.length; i++)
|
|
5638
5680
|
params.push(rendered.params[i]);
|
|
@@ -5649,9 +5691,9 @@ function renderQuerySql(ir, principalId, returning, context) {
|
|
|
5649
5691
|
policyInsertPredicate(policy, proposedValues) {
|
|
5650
5692
|
return helpers.policySql(context.renderPolicy({ render: "insert", principal: principalId, table: ir.table.name, physical: context.physicalMap(), policy, proposed: proposedValues }));
|
|
5651
5693
|
},
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5694
|
+
|
|
5695
|
+
|
|
5696
|
+
|
|
5655
5697
|
policyFixedKeys(policy) {
|
|
5656
5698
|
const keys = [];
|
|
5657
5699
|
if (policy.k === "m") {
|
|
@@ -5669,10 +5711,10 @@ function renderQuerySql(ir, principalId, returning, context) {
|
|
|
5669
5711
|
}
|
|
5670
5712
|
return keys;
|
|
5671
5713
|
},
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5714
|
+
|
|
5715
|
+
|
|
5716
|
+
|
|
5717
|
+
|
|
5676
5718
|
conflictUpdateSql(updatePredicate, fixed) {
|
|
5677
5719
|
const sets = context.map(ir.values, function(e) {
|
|
5678
5720
|
return q(e.column) + " = excluded." + q(e.column);
|
|
@@ -5687,13 +5729,13 @@ function renderQuerySql(ir, principalId, returning, context) {
|
|
|
5687
5729
|
}
|
|
5688
5730
|
return " ON CONFLICT DO UPDATE SET " + sets.join(", ") + " WHERE CASE WHEN " + held.join(" AND ") + " THEN 1 ELSE json_extract('{}', 'SW_POLICY_AUTHORITY_REQUIRED') END";
|
|
5689
5731
|
},
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5732
|
+
|
|
5733
|
+
|
|
5734
|
+
|
|
5735
|
+
|
|
5736
|
+
|
|
5737
|
+
|
|
5738
|
+
|
|
5697
5739
|
linkGuard(link, rowRef, rowValue) {
|
|
5698
5740
|
if (link && link.creator) return helpers.creatorGuard(link, rowRef, rowValue);
|
|
5699
5741
|
if (!link || typeof link.grant !== "string" || !/^lnk_[0-9a-f]{32}$/.test(link.grant) || typeof link.token !== "string" || !/^[0-9a-f]{64}$/.test(link.token) || typeof link.digest !== "string" || !/^[0-9a-f]{64}$/.test(link.digest) || typeof link.epoch !== "number" || !Number.isSafeInteger(link.epoch) || link.epoch < 1 || typeof link.root !== "string" || !/^[a-z_][a-z0-9_]{0,63}$/.test(link.root) || typeof link.write !== "boolean")
|
|
@@ -5728,11 +5770,11 @@ function renderQuerySql(ir, principalId, returning, context) {
|
|
|
5728
5770
|
}
|
|
5729
5771
|
return "EXISTS (SELECT 1 FROM " + q("_sw_row_link_sessions") + " AS " + ls + " JOIN " + q("_sw_row_links") + " AS " + lg + " ON " + lg + "." + q("id") + " = " + ls + "." + q("grant_id") + " JOIN " + q("_sw_row_link_epochs") + " AS " + le + " ON " + le + "." + q("table_name") + " = " + lg + "." + q("table_name") + " WHERE " + ls + "." + q("token_digest") + " = ? AND " + ls + "." + q("expires_at") + " > unixepoch() AND " + lg + "." + q("id") + " = ? AND " + lg + "." + q("table_name") + " = ? AND " + lg + "." + q("row_key") + " = " + key + " AND " + lg + "." + q("revoked_at") + " IS NULL AND (" + lg + "." + q("expires_at") + " IS NULL OR " + lg + "." + q("expires_at") + " > unixepoch()) AND " + lg + "." + q("access") + (link.write ? " = 'edit'" : " IN ('read', 'edit')") + " AND " + le + "." + q("digest") + " = ? AND " + le + "." + q("epoch") + " = ? AND " + lg + "." + q("minted_epoch") + " = " + le + "." + q("epoch") + team + ")";
|
|
5730
5772
|
},
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5773
|
+
|
|
5774
|
+
|
|
5775
|
+
|
|
5776
|
+
|
|
5777
|
+
|
|
5736
5778
|
creatorGuard(link, rowRef, rowValue) {
|
|
5737
5779
|
const creator = link.creator;
|
|
5738
5780
|
if (!creator || typeof link.grant !== "string" || !/^crt_[0-9a-f]{32}$/.test(link.grant) || typeof link.token !== "string" || !/^[0-9a-f]{64}$/.test(link.token) || typeof link.digest !== "string" || !/^[0-9a-f]{64}$/.test(link.digest) || typeof link.epoch !== "number" || !Number.isSafeInteger(link.epoch) || link.epoch < 1 || typeof link.root !== "string" || !/^[a-z_][a-z0-9_]{0,63}$/.test(link.root) || typeof link.write !== "boolean" || typeof creator.key !== "string" || !/^[a-z_][a-z0-9_]{0,63}$/.test(creator.key) || typeof creator.owner !== "string" || !/^[a-z_][a-z0-9_]{0,63}$/.test(creator.owner))
|
|
@@ -5824,10 +5866,10 @@ function renderQuerySql(ir, principalId, returning, context) {
|
|
|
5824
5866
|
}
|
|
5825
5867
|
return frags.length ? " WHERE " + frags.join(" AND ") : "";
|
|
5826
5868
|
},
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5869
|
+
|
|
5870
|
+
|
|
5871
|
+
|
|
5872
|
+
|
|
5831
5873
|
canHint(scope, operation) {
|
|
5832
5874
|
if (ir.kind !== "select" || !ir.scope || (ir.scope.mode === "public" ? !ir.scope.privateScope : ir.scope.mode === "server" || ir.scope.mode === "link" || ir.scope.mode === "intake"))
|
|
5833
5875
|
context.fail("sw.db.from: can hints need a signed-in caller on a private table; nothing ran.");
|
|
@@ -6094,7 +6136,7 @@ function renderQuerySql(ir, principalId, returning, context) {
|
|
|
6094
6136
|
}
|
|
6095
6137
|
var QUERY_SQL_JS = " const __sw_renderQuerySql = (" + renderQuerySql.toString() + ");\n";
|
|
6096
6138
|
|
|
6097
|
-
|
|
6139
|
+
|
|
6098
6140
|
var DB_RENDER_IR_JS = `${POLICY_SQL_JS}${QUERY_SQL_JS} // One write names each column once (tsk_2515cf9e). Column names are
|
|
6099
6141
|
// case-insensitive, an UPDATE applies the LAST of two assignments to the
|
|
6100
6142
|
// same column, and authorization reads the FIRST proposed value \u2014 so
|
|
@@ -6186,7 +6228,7 @@ var DB_RENDER_IR_JS = `${POLICY_SQL_JS}${QUERY_SQL_JS} // One write names e
|
|
|
6186
6228
|
}
|
|
6187
6229
|
`;
|
|
6188
6230
|
|
|
6189
|
-
|
|
6231
|
+
|
|
6190
6232
|
var DB_GENERATED_OWNER_READ_JS = ` function __sw_registerGeneratedOwnerRead(namespace) {
|
|
6191
6233
|
if (typeof __sw_generatedOwnerReadSet === 'undefined') return namespace;
|
|
6192
6234
|
__sw_generatedOwnerReadSet(namespace, function (table) {
|
|
@@ -6222,7 +6264,7 @@ var DB_GENERATED_OWNER_READ_JS = ` function __sw_registerGeneratedOwnerRead
|
|
|
6222
6264
|
}
|
|
6223
6265
|
`;
|
|
6224
6266
|
|
|
6225
|
-
|
|
6267
|
+
|
|
6226
6268
|
var DB_PUBLIC_READ_JS = DB_GENERATED_OWNER_READ_JS + ` function __sw_sharedAuthRequiredMessage(table, verb) {
|
|
6227
6269
|
return verb === 'from' || verb === 'count' || verb === 'aggregate'
|
|
6228
6270
|
? 'sw.db.' + verb + ' on "' + table + '": shared() is a signed-in shared view, and this request has no verified user. Send the request signed in (session cookie or Authorization: Bearer token). For intentionally public catalog data, declare an explicit client.read column allowlist plus client.publicRead in db/schema.ts, run \`somewhere deploy\`, then read through the generated \`somewhere:data\` client (docs({ topic: \\'declared-data\\' })). client.publicRead does not grant anonymous authority to ordinary sw.db.from calls in custom functions.'
|
|
@@ -6372,7 +6414,7 @@ var DB_PUBLIC_READ_JS = DB_GENERATED_OWNER_READ_JS + ` function __sw_shared
|
|
|
6372
6414
|
|
|
6373
6415
|
`;
|
|
6374
6416
|
|
|
6375
|
-
|
|
6417
|
+
|
|
6376
6418
|
var DB_AGGREGATE_JS = ` // The result key for one aggregate. Composed from the closed function name
|
|
6377
6419
|
// and the validated column, NEVER from caller-supplied text \u2014 so a caller
|
|
6378
6420
|
// cannot name a key, only ask for a function of a column.
|
|
@@ -6600,7 +6642,7 @@ var DB_AGGREGATE_JS = ` // The result key for one aggregate. Composed from
|
|
|
6600
6642
|
}
|
|
6601
6643
|
`;
|
|
6602
6644
|
|
|
6603
|
-
|
|
6645
|
+
|
|
6604
6646
|
var DB_RELATIONS_JS = ` // \u2500\u2500 Composed joins (tsk_1186c9a) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
6605
6647
|
// THE SCOPE-COMPOSITION INVARIANT: a relation key shapes the relationship;
|
|
6606
6648
|
// it is NEVER trusted for access. Every participating table independently
|
|
@@ -6775,7 +6817,7 @@ var DB_RELATIONS_JS = ` // \u2500\u2500 Composed joins (tsk_1186c9a) \u2500
|
|
|
6775
6817
|
}
|
|
6776
6818
|
`;
|
|
6777
6819
|
|
|
6778
|
-
|
|
6820
|
+
|
|
6779
6821
|
var ROLE_NAME_PATTERN = /^[a-z][a-z0-9_]{0,63}$/;
|
|
6780
6822
|
var EMAIL_DOMAIN_PATTERN = /^(?=.{4,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z][a-z0-9-]{0,61}[a-z0-9]$/;
|
|
6781
6823
|
var ROLE_DOMAIN_MAP_JS = `
|
|
@@ -6789,7 +6831,7 @@ var ROLE_DOMAIN_MAP_JS = `
|
|
|
6789
6831
|
return true;
|
|
6790
6832
|
}`;
|
|
6791
6833
|
|
|
6792
|
-
|
|
6834
|
+
|
|
6793
6835
|
var DB_POLICY_HELPERS_JS = `${ROLE_DOMAIN_MAP_JS}
|
|
6794
6836
|
function __sw_structPolicyIdent(value) { return typeof value === 'string' && value && __sw_reMatch(__SW_STRUCT_IDENT_RE, value); }
|
|
6795
6837
|
function __sw_structPolicyMember(value) {
|
|
@@ -7079,10 +7121,10 @@ var DB_POLICY_RESOLVE_SCOPE_JS = `
|
|
|
7079
7121
|
}
|
|
7080
7122
|
`;
|
|
7081
7123
|
|
|
7082
|
-
|
|
7124
|
+
|
|
7083
7125
|
var SHARED_AUTHOR_COLUMN = "_sw_author_id";
|
|
7084
7126
|
|
|
7085
|
-
|
|
7127
|
+
|
|
7086
7128
|
var DB_LIVE_INVALIDATION_JS = ` function __sw_liveInvalidation(table) {
|
|
7087
7129
|
const wanted = String(table || '').toLowerCase();
|
|
7088
7130
|
for (let i = 0; i < LIVE_MANIFEST.invalidation.length; i++) {
|
|
@@ -7357,7 +7399,7 @@ var DB_LIVE_INVALIDATION_JS = ` function __sw_liveInvalidation(table) {
|
|
|
7357
7399
|
|
|
7358
7400
|
`;
|
|
7359
7401
|
|
|
7360
|
-
|
|
7402
|
+
|
|
7361
7403
|
var DB_JS = ` db: (function () {
|
|
7362
7404
|
// Two execution paths for sw.db, picked once at function start.
|
|
7363
7405
|
// 1. Production prefers the native D1 binding (env.PROJECT_DB).
|
|
@@ -9471,7 +9513,7 @@ ${DB_AGGREGATE_JS}
|
|
|
9471
9513
|
__sw_liveDoor.set(__sw_dbNamespace, __sw_liveDeclare);
|
|
9472
9514
|
return __sw_registerGeneratedOwnerRead(__sw_dbNamespace);`;
|
|
9473
9515
|
|
|
9474
|
-
|
|
9516
|
+
|
|
9475
9517
|
var DB_RAW_JS = ` var __sw_rawReadDbInstance = null;
|
|
9476
9518
|
var __sw_splitRawDbInstance = null;
|
|
9477
9519
|
function __sw_splitRefusal(code, message, status) {
|
|
@@ -9670,7 +9712,7 @@ var DB_RAW_JS = ` var __sw_rawReadDbInstance = null;
|
|
|
9670
9712
|
}
|
|
9671
9713
|
`;
|
|
9672
9714
|
|
|
9673
|
-
|
|
9715
|
+
|
|
9674
9716
|
var DB_COMPOSED_WRITES_JS = ` // Per-column conditions are ANDed. A bounded $or group remains one
|
|
9675
9717
|
// predicate inside the independent platform ownership/member constraint.
|
|
9676
9718
|
function __sw_structCompileWhere(where, allowOr) {
|
|
@@ -10063,7 +10105,7 @@ var DB_COMPOSED_WRITES_JS = ` // Per-column conditions are ANDed. A bounded
|
|
|
10063
10105
|
}
|
|
10064
10106
|
`;
|
|
10065
10107
|
|
|
10066
|
-
|
|
10108
|
+
|
|
10067
10109
|
var DB_SESSION_RECOVERY_JS = ` // \u2500\u2500 Read replicas, at the one native-binding chokepoint \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
10068
10110
|
// A bookmark is valid only for the database that issued it. Its string
|
|
10069
10111
|
// carries no provenance, so shape validation is necessary but not
|
|
@@ -10257,7 +10299,7 @@ var DB_SESSION_RECOVERY_JS = ` // \u2500\u2500 Read replicas, at the one na
|
|
|
10257
10299
|
}
|
|
10258
10300
|
`;
|
|
10259
10301
|
|
|
10260
|
-
|
|
10302
|
+
|
|
10261
10303
|
var DB_COALESCE_JS = ` // STATE LIVES ON A HOISTED FUNCTION, deliberately. This fragment is
|
|
10262
10304
|
// concatenated into the sw.db namespace AFTER that namespace's own
|
|
10263
10305
|
// \`return\`, so only hoisted function declarations here ever execute \u2014 a
|
|
@@ -10395,7 +10437,7 @@ var DB_COALESCE_JS = ` // STATE LIVES ON A HOISTED FUNCTION, deliberately.
|
|
|
10395
10437
|
}
|
|
10396
10438
|
`;
|
|
10397
10439
|
|
|
10398
|
-
|
|
10440
|
+
|
|
10399
10441
|
function createDeclaredResultDecoder(context) {
|
|
10400
10442
|
const checks = {
|
|
10401
10443
|
value(column, value) {
|
|
@@ -10497,7 +10539,7 @@ function createDeclaredResultDecoder(context) {
|
|
|
10497
10539
|
}
|
|
10498
10540
|
var DECLARED_RESULT_FACTORY_SOURCE = "(" + createDeclaredResultDecoder.toString() + ")";
|
|
10499
10541
|
|
|
10500
|
-
|
|
10542
|
+
|
|
10501
10543
|
var DB_RESULT_FIDELITY_JS = ` var __sw_declaredResultChecks;
|
|
10502
10544
|
function __sw_declaredResults() {
|
|
10503
10545
|
if (__sw_declaredResultChecks) return __sw_declaredResultChecks;
|
|
@@ -10740,7 +10782,7 @@ var DB_RESULT_FIDELITY_JS = ` var __sw_declaredResultChecks;
|
|
|
10740
10782
|
}
|
|
10741
10783
|
})(),`;
|
|
10742
10784
|
|
|
10743
|
-
|
|
10785
|
+
|
|
10744
10786
|
var POSTGRES_JS = ` get postgres() {
|
|
10745
10787
|
const connectionString = env.PROJECT_POSTGRES_DSN;
|
|
10746
10788
|
if (typeof __sw_neon !== 'undefined' && connectionString) {
|
|
@@ -10839,7 +10881,7 @@ var POSTGRES_JS = ` get postgres() {
|
|
|
10839
10881
|
},
|
|
10840
10882
|
`;
|
|
10841
10883
|
|
|
10842
|
-
|
|
10884
|
+
|
|
10843
10885
|
var FS_JS = ` fs: (function () {
|
|
10844
10886
|
function __sw_fsDevOnly(op) {
|
|
10845
10887
|
const err = new Error('sw.fs.' + op + ' is a project-wide scanner, not a per-user operation, so it is not on the default user-facing sw.fs. It runs with project authority in run_code (sw.fs.dev.' + op + ') \u2014 a developer-authenticated context \u2014 not in a request, cron, queue, or job handler. Per-user ' + op + ' is not offered \u2014 model per-user data in sw.db, or filter results yourself.');
|
|
@@ -11367,7 +11409,7 @@ var FS_JS = ` fs: (function () {
|
|
|
11367
11409
|
})(),
|
|
11368
11410
|
`;
|
|
11369
11411
|
|
|
11370
|
-
|
|
11412
|
+
|
|
11371
11413
|
var STORAGE_JS = ` storage: (function () {
|
|
11372
11414
|
// sw.storage.* was removed when sw.fs replaced the legacy storage
|
|
11373
11415
|
// API \u2014 the old storage route now returns 410 GONE (see
|
|
@@ -11399,7 +11441,7 @@ var STORAGE_JS = ` storage: (function () {
|
|
|
11399
11441
|
})(),
|
|
11400
11442
|
`;
|
|
11401
11443
|
|
|
11402
|
-
|
|
11444
|
+
|
|
11403
11445
|
var EMAIL_JS = ` email: {
|
|
11404
11446
|
send(opts) {
|
|
11405
11447
|
return platformJSON('/v1/email/send', {
|
|
@@ -11463,7 +11505,7 @@ var EMAIL_JS = ` email: {
|
|
|
11463
11505
|
},
|
|
11464
11506
|
`;
|
|
11465
11507
|
|
|
11466
|
-
|
|
11508
|
+
|
|
11467
11509
|
var AI_USER_MEMORY_MERGE_SQL = `INSERT INTO _ai_user_memory (user_id, blob_json, updated_at)
|
|
11468
11510
|
VALUES (?, ?, ?)
|
|
11469
11511
|
ON CONFLICT(user_id) DO UPDATE SET blob_json = (
|
|
@@ -11479,7 +11521,7 @@ ON CONFLICT(user_id) DO UPDATE SET blob_json = (
|
|
|
11479
11521
|
WHERE json_type(_ai_user_memory.blob_json) = 'object'
|
|
11480
11522
|
RETURNING blob_json`;
|
|
11481
11523
|
|
|
11482
|
-
|
|
11524
|
+
|
|
11483
11525
|
var AI_JS = ` ai: (function () {
|
|
11484
11526
|
// Legacy memory uses the bound database; split memory uses private transport.
|
|
11485
11527
|
const DB = env.PROJECT_DB;
|
|
@@ -11982,10 +12024,10 @@ var AI_JS = ` ai: (function () {
|
|
|
11982
12024
|
})(),
|
|
11983
12025
|
`;
|
|
11984
12026
|
|
|
11985
|
-
|
|
12027
|
+
|
|
11986
12028
|
var AGENT_STEP_JS = "function assertAgentActive(signal) {\n if (signal?.aborted)\n throw Object.assign(new Error('Agent invocation cancelled.'), { code: 'AGENT_CANCELLED' });\n}\nasync function runAgentToolCalls(calls, execute, signal) {\n const results = [];\n for (let index = 0; index < calls.length; index++) {\n assertAgentActive(signal);\n const call = calls[index];\n try {\n results.push(await execute(call, index));\n }\n catch (error) {\n assertAgentActive(signal);\n results.push({\n tool_use_id: typeof call.id === 'string' ? call.id : '',\n content: error && typeof error === 'object' && 'message' in error && typeof error.message === 'string' ? error.message : String(error),\n is_error: true,\n });\n }\n }\n return results;\n}\nasync function executeModelToolStep(host) {\n assertAgentActive(host.signal);\n const startedAt = Date.now();\n const response = await host.callModel();\n const blocks = Array.isArray(response?.content) ? response.content : [];\n const toolUses = blocks.filter((block) => block && block.type === 'tool_use');\n const truncated = response?.stop_reason === 'max_tokens' || response?.stop_reason === 'length';\n const observation = { blocks, toolUses, truncated, startedAt, durationMs: Date.now() - startedAt };\n await host.afterResponse(response, observation);\n assertAgentActive(host.signal);\n const executes = !truncated && toolUses.length > 0 && (!host.requireToolUseStop || response.stop_reason === 'tool_use');\n const results = executes ? await host.executeTools(toolUses) : [];\n assertAgentActive(host.signal);\n return { response, ...observation, results, executes };\n}\n";
|
|
11987
12029
|
|
|
11988
|
-
|
|
12030
|
+
|
|
11989
12031
|
var AGENT_JS = ` agent: (function () {
|
|
11990
12032
|
${AGENT_STEP_JS}
|
|
11991
12033
|
let invocationBodyPromise = null;
|
|
@@ -12576,7 +12618,7 @@ var AGENT_JS = ` agent: (function () {
|
|
|
12576
12618
|
})(),
|
|
12577
12619
|
`;
|
|
12578
12620
|
|
|
12579
|
-
|
|
12621
|
+
|
|
12580
12622
|
var IMAGE_JS = ` image: (function () {
|
|
12581
12623
|
// Image transformations \u2014 URL builder. Returns a string URL that
|
|
12582
12624
|
// points at Cloudflare's image resizer on the project's domain.
|
|
@@ -12633,7 +12675,7 @@ var IMAGE_JS = ` image: (function () {
|
|
|
12633
12675
|
})(),
|
|
12634
12676
|
`;
|
|
12635
12677
|
|
|
12636
|
-
|
|
12678
|
+
|
|
12637
12679
|
var AUTH_MANAGED_VISITOR_JS = ` // Visitor identity is declared when the release has visitor-owned tables:
|
|
12638
12680
|
// legacy bundles carry the signing key; split bundles carry no key and no
|
|
12639
12681
|
// managed binding, so the declaration itself is the signal.
|
|
@@ -12735,7 +12777,7 @@ var AUTH_MANAGED_VISITOR_JS = ` // Visitor identity is declared when the re
|
|
|
12735
12777
|
__sw_visitorSessionToken = function () { return visitorIdentity && visitorIdentity.token ? visitorIdentity.token() : null; };
|
|
12736
12778
|
`;
|
|
12737
12779
|
|
|
12738
|
-
|
|
12780
|
+
|
|
12739
12781
|
var AUTH_SERVER_JS = ` server: (function () {
|
|
12740
12782
|
const reply = ${BOUNDED_REPLY_READER_SOURCE}(${PLATFORM_DATA_RESPONSE_MAX_BYTES});
|
|
12741
12783
|
function refuse(code, status, message) {
|
|
@@ -12774,7 +12816,7 @@ var AUTH_SERVER_JS = ` server: (function () {
|
|
|
12774
12816
|
})(),
|
|
12775
12817
|
`;
|
|
12776
12818
|
|
|
12777
|
-
|
|
12819
|
+
|
|
12778
12820
|
var AUTH_REFRESH_RESPONSE_JS = `(async function (refresh) {
|
|
12779
12821
|
const response = await platformFetch('/v1/auth/refresh', { method: 'POST', body: JSON.stringify({ project_id: projectId, refresh_token: refresh }) });
|
|
12780
12822
|
let result;
|
|
@@ -12794,7 +12836,7 @@ var AUTH_REFRESH_RESPONSE_JS = `(async function (refresh) {
|
|
|
12794
12836
|
return result.data;
|
|
12795
12837
|
})`;
|
|
12796
12838
|
|
|
12797
|
-
|
|
12839
|
+
|
|
12798
12840
|
var AUTH_JS = ` auth: (function () {
|
|
12799
12841
|
const DB = env.PROJECT_DB;
|
|
12800
12842
|
// Forward an end-user JWT (app_user) directly as the Authorization
|
|
@@ -14388,7 +14430,7 @@ ${AUTH_MANAGED_VISITOR_JS} function __sw_visitorController() {
|
|
|
14388
14430
|
})(),
|
|
14389
14431
|
`;
|
|
14390
14432
|
|
|
14391
|
-
|
|
14433
|
+
|
|
14392
14434
|
var JOBS_JS = ` jobs: {
|
|
14393
14435
|
async create(opts) {
|
|
14394
14436
|
// A row-bound job ({ row: { binding, id } }) acts for the signed-in
|
|
@@ -14457,7 +14499,7 @@ var JOBS_JS = ` jobs: {
|
|
|
14457
14499
|
},
|
|
14458
14500
|
`;
|
|
14459
14501
|
|
|
14460
|
-
|
|
14502
|
+
|
|
14461
14503
|
var QUEUE_JS = ` queue: {
|
|
14462
14504
|
push(opts) {
|
|
14463
14505
|
return platformJSON('/v1/queue', {
|
|
@@ -14471,7 +14513,7 @@ var QUEUE_JS = ` queue: {
|
|
|
14471
14513
|
},
|
|
14472
14514
|
`;
|
|
14473
14515
|
|
|
14474
|
-
|
|
14516
|
+
|
|
14475
14517
|
var LOGS_JS = ` logs: {
|
|
14476
14518
|
_send(level, message, data) {
|
|
14477
14519
|
const delivery = (async function () {
|
|
@@ -14571,7 +14613,7 @@ var LOGS_JS = ` logs: {
|
|
|
14571
14613
|
},
|
|
14572
14614
|
`;
|
|
14573
14615
|
|
|
14574
|
-
|
|
14616
|
+
|
|
14575
14617
|
var ANALYTICS_JS = ` analytics: {
|
|
14576
14618
|
async track(event, opts) {
|
|
14577
14619
|
opts = opts || {};
|
|
@@ -14615,7 +14657,7 @@ var ANALYTICS_JS = ` analytics: {
|
|
|
14615
14657
|
// storage, returns the raw fetch Response so callers can stream
|
|
14616
14658
|
// the binary out (e.g. to the browser).`;
|
|
14617
14659
|
|
|
14618
|
-
|
|
14660
|
+
|
|
14619
14661
|
var RENDER_JS = ` render: (function () {
|
|
14620
14662
|
// A storage call from a signed-in visitor carries the visitor's original
|
|
14621
14663
|
// credential, as sw.fs does, so the platform can verify who the file
|
|
@@ -14669,7 +14711,7 @@ var RENDER_JS = ` render: (function () {
|
|
|
14669
14711
|
})(),
|
|
14670
14712
|
`;
|
|
14671
14713
|
|
|
14672
|
-
|
|
14714
|
+
|
|
14673
14715
|
var SEARCH_JS = ` search: {
|
|
14674
14716
|
async add(path) {
|
|
14675
14717
|
const userId = await __sw_requireSubject('sw.search.add');
|
|
@@ -14769,7 +14811,7 @@ var SEARCH_JS = ` search: {
|
|
|
14769
14811
|
},
|
|
14770
14812
|
`;
|
|
14771
14813
|
|
|
14772
|
-
|
|
14814
|
+
|
|
14773
14815
|
var INBOX_JS = ` inbox: (function () {
|
|
14774
14816
|
const __sw_inboxIdentityKeys = new Set([
|
|
14775
14817
|
'as_user', 'asUser', 'user_id', 'userId', 'owner',
|
|
@@ -14948,7 +14990,7 @@ var INBOX_JS = ` inbox: (function () {
|
|
|
14948
14990
|
// sw.connect.* \u2014 read-side third-party connections (tsk_1b20).
|
|
14949
14991
|
// Opposite of sw.payments: read another account's data, don't accept money.`;
|
|
14950
14992
|
|
|
14951
|
-
|
|
14993
|
+
|
|
14952
14994
|
var CONNECT_JS = ` connect: {
|
|
14953
14995
|
stripe: {
|
|
14954
14996
|
// Returns { url } \u2014 send the creator's browser there to authorize
|
|
@@ -14989,7 +15031,7 @@ var CONNECT_JS = ` connect: {
|
|
|
14989
15031
|
},
|
|
14990
15032
|
`;
|
|
14991
15033
|
|
|
14992
|
-
|
|
15034
|
+
|
|
14993
15035
|
var PAYMENTS_JS = ` async quote(resource, range, opts) {
|
|
14994
15036
|
opts = opts || {};
|
|
14995
15037
|
const env = opts.env || projectEnv;
|
|
@@ -15189,7 +15231,7 @@ var PAYMENTS_JS = ` async quote(resource, range, opts) {
|
|
|
15189
15231
|
},
|
|
15190
15232
|
`;
|
|
15191
15233
|
|
|
15192
|
-
|
|
15234
|
+
|
|
15193
15235
|
var BILLING_JS = ` billing: {
|
|
15194
15236
|
definePlans(plans) {
|
|
15195
15237
|
if (!Array.isArray(plans)) {
|
|
@@ -15229,7 +15271,7 @@ var BILLING_JS = ` billing: {
|
|
|
15229
15271
|
},
|
|
15230
15272
|
`;
|
|
15231
15273
|
|
|
15232
|
-
|
|
15274
|
+
|
|
15233
15275
|
var GROUPS_JS = ` groups: (() => {
|
|
15234
15276
|
const reply = ${BOUNDED_REPLY_READER_SOURCE}(${PLATFORM_DATA_RESPONSE_MAX_BYTES});
|
|
15235
15277
|
function refuse(code, status, message) {
|
|
@@ -15326,7 +15368,7 @@ var GROUPS_JS = ` groups: (() => {
|
|
|
15326
15368
|
})(),
|
|
15327
15369
|
`;
|
|
15328
15370
|
|
|
15329
|
-
|
|
15371
|
+
|
|
15330
15372
|
var TASKS_JS = ` tasks: (() => {
|
|
15331
15373
|
function queryOptions(opts, keys) {
|
|
15332
15374
|
const q = new URLSearchParams({ project_id: projectId });
|
|
@@ -15413,7 +15455,7 @@ var TASKS_JS = ` tasks: (() => {
|
|
|
15413
15455
|
})(),
|
|
15414
15456
|
`;
|
|
15415
15457
|
|
|
15416
|
-
|
|
15458
|
+
|
|
15417
15459
|
var CRON_JS = ` cron: {
|
|
15418
15460
|
create(opts) {
|
|
15419
15461
|
return platformJSON('/v1/cron', {
|
|
@@ -15436,7 +15478,7 @@ var CRON_JS = ` cron: {
|
|
|
15436
15478
|
},
|
|
15437
15479
|
`;
|
|
15438
15480
|
|
|
15439
|
-
|
|
15481
|
+
|
|
15440
15482
|
var CALENDAR_JS = ` calendar: {
|
|
15441
15483
|
hold(resourceOrOpts, range, ttl) {
|
|
15442
15484
|
const body = (resourceOrOpts && typeof resourceOrOpts === 'object' && range === undefined)
|
|
@@ -15570,7 +15612,7 @@ var CALENDAR_JS = ` calendar: {
|
|
|
15570
15612
|
},
|
|
15571
15613
|
`;
|
|
15572
15614
|
|
|
15573
|
-
|
|
15615
|
+
|
|
15574
15616
|
var RATE_LIMIT_JS = ` rateLimit: {
|
|
15575
15617
|
// sw.rateLimit.check(key, max, windowSeconds) \u2192 { allowed, remaining, reset, ... }
|
|
15576
15618
|
// Fixed-window counter, scoped per (project, key). On allowed=false the
|
|
@@ -15627,7 +15669,7 @@ var RATE_LIMIT_JS = ` rateLimit: {
|
|
|
15627
15669
|
},
|
|
15628
15670
|
`;
|
|
15629
15671
|
|
|
15630
|
-
|
|
15672
|
+
|
|
15631
15673
|
var WEB_JS = ` web: {
|
|
15632
15674
|
// sw.web.scrape(url, opts?) \u2014 fetch a URL, return its content as
|
|
15633
15675
|
// markdown by default. opts: { formats?, only_main?, wait_for? }
|
|
@@ -15671,7 +15713,7 @@ var WEB_JS = ` web: {
|
|
|
15671
15713
|
// \u2014 write your own dedup if you need it; this layer is the
|
|
15672
15714
|
// primitive, not the policy.`;
|
|
15673
15715
|
|
|
15674
|
-
|
|
15716
|
+
|
|
15675
15717
|
var NOTIFICATIONS_JS = ` notifications: (function () {
|
|
15676
15718
|
// Direct DB binding for the bell store (tsk_5d490a39). Each IIFE binds
|
|
15677
15719
|
// its own copy \u2014 mirrors ai.ts / auth.ts \u2014 because fragments are
|
|
@@ -15873,7 +15915,7 @@ var NOTIFICATIONS_JS = ` notifications: (function () {
|
|
|
15873
15915
|
})(),
|
|
15874
15916
|
`;
|
|
15875
15917
|
|
|
15876
|
-
|
|
15918
|
+
|
|
15877
15919
|
var PUSH_JS = ` push: (function () {
|
|
15878
15920
|
// The signed-in user of THIS request owns the device. The platform
|
|
15879
15921
|
// re-verifies the carried session; no argument can name a user.
|
|
@@ -15958,7 +16000,7 @@ var PUSH_JS = ` push: (function () {
|
|
|
15958
16000
|
};
|
|
15959
16001
|
})(),`;
|
|
15960
16002
|
|
|
15961
|
-
|
|
16003
|
+
|
|
15962
16004
|
var ROOMS_JS = ` rooms: (function () {
|
|
15963
16005
|
function __sw_roomsError(code, message, status) {
|
|
15964
16006
|
const err = new Error(message);
|
|
@@ -16097,7 +16139,7 @@ var ROOMS_JS = ` rooms: (function () {
|
|
|
16097
16139
|
})(),
|
|
16098
16140
|
`;
|
|
16099
16141
|
|
|
16100
|
-
|
|
16142
|
+
|
|
16101
16143
|
var CONTEXT_TAIL_JS = ` };
|
|
16102
16144
|
// sw.realtime is RETIRED (tsk_e0cc5403). There is no namespace: the property
|
|
16103
16145
|
// is a non-enumerable accessor, so it never appears on Object.keys(sw), in a
|
|
@@ -16299,7 +16341,7 @@ var CONTEXT_TAIL_JS = ` };
|
|
|
16299
16341
|
return sw;
|
|
16300
16342
|
}`;
|
|
16301
16343
|
|
|
16302
|
-
|
|
16344
|
+
|
|
16303
16345
|
var PARTS = [
|
|
16304
16346
|
CONTEXT_HEAD_JS,
|
|
16305
16347
|
FETCH_JS,
|
|
@@ -16341,13 +16383,13 @@ var PARTS = [
|
|
|
16341
16383
|
];
|
|
16342
16384
|
var PLATFORM_CONTEXT_JS = PARTS.join("\n").trim();
|
|
16343
16385
|
|
|
16344
|
-
|
|
16386
|
+
|
|
16345
16387
|
var import_declared_data_contract = __toESM(require_declared_data_contract());
|
|
16346
16388
|
|
|
16347
|
-
|
|
16389
|
+
|
|
16348
16390
|
var PUBLIC_RESULT_MAX_AGE_SECONDS = 120;
|
|
16349
16391
|
|
|
16350
|
-
|
|
16392
|
+
|
|
16351
16393
|
function declaredBranchReads(shape) {
|
|
16352
16394
|
const policy = shape.policy;
|
|
16353
16395
|
if (!policy || policy.k !== "a" || !Array.isArray(policy.reads)) return null;
|
|
@@ -16365,9 +16407,9 @@ function declaredReadFields(shape) {
|
|
|
16365
16407
|
}
|
|
16366
16408
|
function declaredListGetPlan(operation, input, shape, fields, fail) {
|
|
16367
16409
|
const helpers = {
|
|
16368
|
-
|
|
16369
|
-
|
|
16370
|
-
|
|
16410
|
+
|
|
16411
|
+
|
|
16412
|
+
|
|
16371
16413
|
key(value, column) {
|
|
16372
16414
|
if (column && column.t === "integer") {
|
|
16373
16415
|
if (typeof value === "number" && Number.isSafeInteger(value)) return value;
|
|
@@ -16392,7 +16434,7 @@ function declaredListGetPlan(operation, input, shape, fields, fail) {
|
|
|
16392
16434
|
for (const column of shape.columns) if (list.indexOf(column.n) === -1 && branchHidden.indexOf(column.n) === -1) branchHidden.push(column.n);
|
|
16393
16435
|
}
|
|
16394
16436
|
}
|
|
16395
|
-
const where =
|
|
16437
|
+
const where = Object.create(null);
|
|
16396
16438
|
if (operation === "get") helpers.and(where, primaryKey, helpers.key(input.id, primaryColumn));
|
|
16397
16439
|
else {
|
|
16398
16440
|
if (input.where !== void 0) {
|
|
@@ -16423,7 +16465,7 @@ function declaredListGetPayload(operation, rows, fields, primaryKey, limit) {
|
|
|
16423
16465
|
const helpers = {
|
|
16424
16466
|
project(row) {
|
|
16425
16467
|
if (row === null || row === void 0) return null;
|
|
16426
|
-
const result =
|
|
16468
|
+
const result = Object.create(null);
|
|
16427
16469
|
for (const field of fields) if (Object.prototype.hasOwnProperty.call(row, field)) result[field] = row[field];
|
|
16428
16470
|
const can = row.can;
|
|
16429
16471
|
if (can && typeof can === "object") {
|
|
@@ -16447,7 +16489,7 @@ const __sw_dataReadFields = (${declaredReadFields.toString()});
|
|
|
16447
16489
|
const __sw_dataListGetPlan = (${declaredListGetPlan.toString()});
|
|
16448
16490
|
const __sw_dataListGetPayload = (${declaredListGetPayload.toString()});`;
|
|
16449
16491
|
|
|
16450
|
-
|
|
16492
|
+
|
|
16451
16493
|
var DECLARED_DATA_RUNTIME_JS = String.raw`
|
|
16452
16494
|
// The generated client's read-field grant and list/get translation, shared
|
|
16453
16495
|
// with the platform's direct managed browser read (declared-data-read-plan.ts).
|
|
@@ -17022,7 +17064,7 @@ async function __sw_handleDeclaredData(request, sw, env) {
|
|
|
17022
17064
|
}
|
|
17023
17065
|
`;
|
|
17024
17066
|
|
|
17025
|
-
|
|
17067
|
+
|
|
17026
17068
|
var DECLARED_FILES_RUNTIME_JS = String.raw`
|
|
17027
17069
|
async function __sw_handleDeclaredFiles(request, sw, env, fetcher) {
|
|
17028
17070
|
if (__sw_artifactExecution !== 'standard') {
|
|
@@ -17064,7 +17106,7 @@ async function __sw_handleDeclaredFiles(request, sw, env, fetcher) {
|
|
|
17064
17106
|
}
|
|
17065
17107
|
`;
|
|
17066
17108
|
|
|
17067
|
-
|
|
17109
|
+
|
|
17068
17110
|
var LINK_COOKIE_NAME = "__Host-sw_link";
|
|
17069
17111
|
var LINK_COOKIE_MAX_ENTRIES = 4;
|
|
17070
17112
|
var LINK_COOKIE_MAX_BYTES = 3500;
|
|
@@ -17375,7 +17417,7 @@ async function __sw_dataLinked(request, sw, input, table, shape) {
|
|
|
17375
17417
|
}
|
|
17376
17418
|
`;
|
|
17377
17419
|
|
|
17378
|
-
|
|
17420
|
+
|
|
17379
17421
|
var PUSH_CLIENT_MODULE_JS = `
|
|
17380
17422
|
const DOOR = '/__sw/push';
|
|
17381
17423
|
const WORKER_URL = '/__sw/push/sw.js';
|
|
@@ -17683,7 +17725,7 @@ async function __sw_handlePushDoor(request, sw, env) {
|
|
|
17683
17725
|
}
|
|
17684
17726
|
`;
|
|
17685
17727
|
|
|
17686
|
-
|
|
17728
|
+
|
|
17687
17729
|
var LIVE_CLIENT_MODULE_JS = `
|
|
17688
17730
|
const LIVE_PING_FRAME = '{"type":"sw_ping"}';
|
|
17689
17731
|
const LIVE_PING_MS = 25000;
|
|
@@ -17894,7 +17936,7 @@ export function watchLive(load, render, onError) {
|
|
|
17894
17936
|
}
|
|
17895
17937
|
`.trim();
|
|
17896
17938
|
|
|
17897
|
-
|
|
17939
|
+
|
|
17898
17940
|
var ROOMS_CLIENT_MODULE_JS = `
|
|
17899
17941
|
const TICKET_PATH = '/__sw/rooms/ticket';
|
|
17900
17942
|
const CONNECT_PATH = '/__sw/rooms/connect';
|
|
@@ -18336,7 +18378,7 @@ async function __sw_handleRoomsDoor(request, sw) {
|
|
|
18336
18378
|
}
|
|
18337
18379
|
`;
|
|
18338
18380
|
|
|
18339
|
-
|
|
18381
|
+
|
|
18340
18382
|
var FUNCTION_TRACE_SOURCE = String.raw`
|
|
18341
18383
|
/** The trace id for this invocation, or null when tracing did not initialize. */
|
|
18342
18384
|
function traceIdOf(platformCtx) {
|
|
@@ -18709,7 +18751,7 @@ async function reportFunctionError(env, request, code, err, responseStatus, requ
|
|
|
18709
18751
|
}
|
|
18710
18752
|
`;
|
|
18711
18753
|
|
|
18712
|
-
|
|
18754
|
+
|
|
18713
18755
|
function isHelperModulePath(path) {
|
|
18714
18756
|
return path.replace(/^\/+/, "").split("/").some((segment) => segment.startsWith("_"));
|
|
18715
18757
|
}
|
|
@@ -18718,13 +18760,13 @@ function isRoutedFunctionPath(path) {
|
|
|
18718
18760
|
return path.startsWith("api/") || !path.includes("/") && /\[/.test(path);
|
|
18719
18761
|
}
|
|
18720
18762
|
|
|
18721
|
-
|
|
18763
|
+
|
|
18722
18764
|
var ENDPOINT_AUTH_MODES = ["required", "optional", "none"];
|
|
18723
18765
|
var ENDPOINT_AUTH_MODE_INVALID = "ENDPOINT_AUTH_MODE_INVALID";
|
|
18724
18766
|
var ENDPOINT_AUTH_MODES_HINT = "Supported modes: 'required' (caller must be signed in), 'optional' (user when signed in, otherwise null), 'none' (public).";
|
|
18725
18767
|
var MODES = new Set(ENDPOINT_AUTH_MODES);
|
|
18726
18768
|
|
|
18727
|
-
|
|
18769
|
+
|
|
18728
18770
|
var ENDPOINT_RATE_LIMIT_INVALID = "ENDPOINT_RATE_LIMIT_INVALID";
|
|
18729
18771
|
var ENDPOINT_RATE_LIMIT_MAX_COUNT = 1e6;
|
|
18730
18772
|
var ENDPOINT_RATE_LIMIT_HINT = `rateLimit accepts '<count>/<unit>' with a whole count from 1 to ${ENDPOINT_RATE_LIMIT_MAX_COUNT} and a unit of second, minute, hour or day, for example '30/minute'; without rateLimit there is no limit.`;
|
|
@@ -18759,7 +18801,7 @@ function __sw_endpointRateLimit(spec) {
|
|
|
18759
18801
|
}
|
|
18760
18802
|
`;
|
|
18761
18803
|
|
|
18762
|
-
|
|
18804
|
+
|
|
18763
18805
|
function isCanonicalBigintText(value) {
|
|
18764
18806
|
if (!/^(0|-?[1-9][0-9]*)$/.test(value)) return false;
|
|
18765
18807
|
const negative = value.startsWith("-");
|
|
@@ -18768,7 +18810,7 @@ function isCanonicalBigintText(value) {
|
|
|
18768
18810
|
return digits.length < limit.length || digits.length === limit.length && digits <= limit;
|
|
18769
18811
|
}
|
|
18770
18812
|
|
|
18771
|
-
|
|
18813
|
+
|
|
18772
18814
|
function tableAllowsClientWrites(table) {
|
|
18773
18815
|
return Boolean(table.client && (table.client.create !== null || table.client.update !== null || table.client.delete || table.client.intake !== void 0));
|
|
18774
18816
|
}
|
|
@@ -19023,16 +19065,16 @@ function parseLinkPermissions(value, read, update, create, columns, scope) {
|
|
|
19023
19065
|
return { read: linkRead, edit, children, maxDays, ...input.anonymousCreate === true ? { anonymousCreate: true } : {} };
|
|
19024
19066
|
}
|
|
19025
19067
|
|
|
19026
|
-
|
|
19068
|
+
|
|
19027
19069
|
var STALE_JOB_WINDOW_MS = 45 * 60 * 1e3;
|
|
19028
19070
|
|
|
19029
|
-
|
|
19071
|
+
|
|
19030
19072
|
var BINDING_OPERATIONS = ["read", "create", "update", "delete"];
|
|
19031
19073
|
var ROW_OPERATIONS = ["read", "update", "delete"];
|
|
19032
19074
|
var MAX_JOB_BINDING_SECONDS = STALE_JOB_WINDOW_MS / 1e3;
|
|
19033
19075
|
var NAME = /^[a-z][a-z0-9_]{0,63}$/;
|
|
19034
19076
|
var BUILT_IN_GROUP_ROLES = ["admin", "member", "owner"];
|
|
19035
|
-
var lines =
|
|
19077
|
+
var lines = new WeakMap();
|
|
19036
19078
|
var byName = (list) => list.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
19037
19079
|
function readString(r, fail, ctx) {
|
|
19038
19080
|
const t = r.next();
|
|
@@ -19078,7 +19120,7 @@ function readNamed(r, fail, option, kind, keys, readField) {
|
|
|
19078
19120
|
r.expectPunct("{", `opening ${kind} "${key.name}"`);
|
|
19079
19121
|
const fields = {};
|
|
19080
19122
|
const fieldLines = { "": key.line };
|
|
19081
|
-
const seen =
|
|
19123
|
+
const seen = new Set();
|
|
19082
19124
|
while (!r.tryPunct("}")) {
|
|
19083
19125
|
const opt = r.readKey(`for an option of ${kind} "${key.name}"`);
|
|
19084
19126
|
if (!keys.includes(opt.name)) fail(opt.line, `${kind} "${key.name}" has an unknown option "${opt.name}". Allowed: ${keys.join(", ")}.`);
|
|
@@ -19228,14 +19270,14 @@ function validateBindings(input, tableInfo, errors) {
|
|
|
19228
19270
|
const writable = [...info.table.client?.create ?? [], ...info.table.client?.update ?? [], ...info.table.client?.intake?.fields ?? []];
|
|
19229
19271
|
if (writable.includes(name)) errors.push(`${at2(p, field)}payment binding "${p.name}": "${p.table}"."${name}" is browser-writable through client.create, client.update or client.intake, and a payment binding requires it not to be; the server sets prices and the payment sets the status.`);
|
|
19230
19272
|
}
|
|
19231
|
-
if ((
|
|
19273
|
+
if (( new Set([p.amount, p.currency, p.status.column])).size !== 3) errors.push(`${at2(p, "")}payment binding "${p.name}" must name three different columns for amount, currency and status.`);
|
|
19232
19274
|
const status = column(p.status.column);
|
|
19233
19275
|
if (status && !(status.hasDefault && typeof status.default === "string" && p.status.from.includes(status.default))) {
|
|
19234
19276
|
errors.push(`${at2(p, "onPaid")}payment binding "${p.name}": "${p.table}"."${p.status.column}" must declare a default that is one of its unpaid from states (${p.status.from.join(", ")}), so a new row starts unpaid.`);
|
|
19235
19277
|
}
|
|
19236
19278
|
}
|
|
19237
19279
|
for (const j of input.jobs ?? []) rowTable(j, "job binding");
|
|
19238
|
-
const taken =
|
|
19280
|
+
const taken = new Set([...BUILT_IN_GROUP_ROLES, ...input.groups?.roles ?? [], ...(input.appRoles ?? []).map((role) => role.name)]);
|
|
19239
19281
|
for (const s of input.serviceRoles ?? []) {
|
|
19240
19282
|
if (taken.has(s.name)) errors.push(`${at2(s, "")}service role "${s.name}" has the name of a group or app role. Service roles are a separate namespace for unattended work, so the name must differ.`);
|
|
19241
19283
|
const tableLines = lines.get(s.tables) ?? {};
|
|
@@ -19245,7 +19287,7 @@ function validateBindings(input, tableInfo, errors) {
|
|
|
19245
19287
|
}
|
|
19246
19288
|
}
|
|
19247
19289
|
|
|
19248
|
-
|
|
19290
|
+
|
|
19249
19291
|
function compileRoutePattern(file) {
|
|
19250
19292
|
const pattern = (0, import_function_route.functionRouteSegments)(file).map((s) => ({ type: s.type, value: s.value }));
|
|
19251
19293
|
return { pattern, displayPath: (0, import_function_route.displayRoute)(pattern), shape: (0, import_function_route.routeShape)(pattern) };
|
|
@@ -19589,10 +19631,10 @@ globalThis.sw.endpoint = function (config) {
|
|
|
19589
19631
|
};
|
|
19590
19632
|
`.trim();
|
|
19591
19633
|
|
|
19592
|
-
|
|
19634
|
+
|
|
19593
19635
|
function apiIndexRouteFindings(functions) {
|
|
19594
19636
|
const paths = Object.keys(functions ?? {}).sort();
|
|
19595
|
-
const pathsByShape =
|
|
19637
|
+
const pathsByShape = new Map();
|
|
19596
19638
|
for (const path of paths) {
|
|
19597
19639
|
if (!isRoutedFunctionPath(path)) continue;
|
|
19598
19640
|
let shape;
|
|
@@ -19623,7 +19665,7 @@ function isApiIndexHandlerPath(file) {
|
|
|
19623
19665
|
return /^api\/.+\/index\.(?:ts|tsx|mts|js|mjs|jsx)$/.test(file) || /^api\/index\.(?:ts|tsx|mts|js|mjs|jsx)$/.test(file);
|
|
19624
19666
|
}
|
|
19625
19667
|
|
|
19626
|
-
|
|
19668
|
+
|
|
19627
19669
|
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
19628
19670
|
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
|
|
19629
19671
|
var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65";
|
|
@@ -19737,7 +19779,7 @@ var types$1 = {
|
|
|
19737
19779
|
name: new TokenType("name", startsExpr),
|
|
19738
19780
|
privateId: new TokenType("privateId", startsExpr),
|
|
19739
19781
|
eof: new TokenType("eof"),
|
|
19740
|
-
|
|
19782
|
+
|
|
19741
19783
|
bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }),
|
|
19742
19784
|
bracketR: new TokenType("]"),
|
|
19743
19785
|
braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }),
|
|
@@ -19756,19 +19798,19 @@ var types$1 = {
|
|
|
19756
19798
|
ellipsis: new TokenType("...", beforeExpr),
|
|
19757
19799
|
backQuote: new TokenType("`", startsExpr),
|
|
19758
19800
|
dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }),
|
|
19759
|
-
|
|
19760
|
-
|
|
19761
|
-
|
|
19762
|
-
|
|
19763
|
-
|
|
19764
|
-
|
|
19765
|
-
|
|
19766
|
-
|
|
19767
|
-
|
|
19768
|
-
|
|
19769
|
-
|
|
19770
|
-
|
|
19771
|
-
|
|
19801
|
+
|
|
19802
|
+
|
|
19803
|
+
|
|
19804
|
+
|
|
19805
|
+
|
|
19806
|
+
|
|
19807
|
+
|
|
19808
|
+
|
|
19809
|
+
|
|
19810
|
+
|
|
19811
|
+
|
|
19812
|
+
|
|
19813
|
+
|
|
19772
19814
|
eq: new TokenType("=", { beforeExpr: true, isAssign: true }),
|
|
19773
19815
|
assign: new TokenType("_=", { beforeExpr: true, isAssign: true }),
|
|
19774
19816
|
incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }),
|
|
@@ -19787,7 +19829,7 @@ var types$1 = {
|
|
|
19787
19829
|
slash: binop("/", 10),
|
|
19788
19830
|
starstar: new TokenType("**", { beforeExpr: true }),
|
|
19789
19831
|
coalesce: binop("??", 1),
|
|
19790
|
-
|
|
19832
|
+
|
|
19791
19833
|
_break: kw("break"),
|
|
19792
19834
|
_case: kw("case", beforeExpr),
|
|
19793
19835
|
_catch: kw("catch"),
|
|
@@ -19850,7 +19892,7 @@ var hasOwn = Object.hasOwn || (function(obj, propName) {
|
|
|
19850
19892
|
var isArray = Array.isArray || (function(obj) {
|
|
19851
19893
|
return toString.call(obj) === "[object Array]";
|
|
19852
19894
|
});
|
|
19853
|
-
var regexpCache =
|
|
19895
|
+
var regexpCache = Object.create(null);
|
|
19854
19896
|
function wordsRegexp(words) {
|
|
19855
19897
|
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
|
|
19856
19898
|
}
|
|
@@ -19887,100 +19929,100 @@ function getLineInfo(input, offset2) {
|
|
|
19887
19929
|
}
|
|
19888
19930
|
}
|
|
19889
19931
|
var defaultOptions = {
|
|
19890
|
-
|
|
19891
|
-
|
|
19892
|
-
|
|
19893
|
-
|
|
19894
|
-
|
|
19895
|
-
|
|
19932
|
+
|
|
19933
|
+
|
|
19934
|
+
|
|
19935
|
+
|
|
19936
|
+
|
|
19937
|
+
|
|
19896
19938
|
ecmaVersion: null,
|
|
19897
|
-
|
|
19898
|
-
|
|
19899
|
-
|
|
19939
|
+
|
|
19940
|
+
|
|
19941
|
+
|
|
19900
19942
|
sourceType: "script",
|
|
19901
|
-
|
|
19902
|
-
|
|
19903
|
-
|
|
19904
|
-
|
|
19905
|
-
|
|
19943
|
+
|
|
19944
|
+
|
|
19945
|
+
|
|
19946
|
+
|
|
19947
|
+
|
|
19906
19948
|
onInsertedSemicolon: null,
|
|
19907
|
-
|
|
19908
|
-
|
|
19949
|
+
|
|
19950
|
+
|
|
19909
19951
|
onTrailingComma: null,
|
|
19910
|
-
|
|
19911
|
-
|
|
19912
|
-
|
|
19913
|
-
|
|
19952
|
+
|
|
19953
|
+
|
|
19954
|
+
|
|
19955
|
+
|
|
19914
19956
|
allowReserved: null,
|
|
19915
|
-
|
|
19916
|
-
|
|
19957
|
+
|
|
19958
|
+
|
|
19917
19959
|
allowReturnOutsideFunction: false,
|
|
19918
|
-
|
|
19919
|
-
|
|
19920
|
-
|
|
19960
|
+
|
|
19961
|
+
|
|
19962
|
+
|
|
19921
19963
|
allowImportExportEverywhere: false,
|
|
19922
|
-
|
|
19923
|
-
|
|
19924
|
-
|
|
19964
|
+
|
|
19965
|
+
|
|
19966
|
+
|
|
19925
19967
|
allowAwaitOutsideFunction: null,
|
|
19926
|
-
|
|
19927
|
-
|
|
19968
|
+
|
|
19969
|
+
|
|
19928
19970
|
allowSuperOutsideMethod: null,
|
|
19929
|
-
|
|
19930
|
-
|
|
19931
|
-
|
|
19971
|
+
|
|
19972
|
+
|
|
19973
|
+
|
|
19932
19974
|
allowHashBang: false,
|
|
19933
|
-
|
|
19934
|
-
|
|
19935
|
-
|
|
19975
|
+
|
|
19976
|
+
|
|
19977
|
+
|
|
19936
19978
|
checkPrivateFields: true,
|
|
19937
|
-
|
|
19938
|
-
|
|
19939
|
-
|
|
19940
|
-
|
|
19979
|
+
|
|
19980
|
+
|
|
19981
|
+
|
|
19982
|
+
|
|
19941
19983
|
locations: false,
|
|
19942
|
-
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
|
|
19946
|
-
|
|
19984
|
+
|
|
19985
|
+
|
|
19986
|
+
|
|
19987
|
+
|
|
19988
|
+
|
|
19947
19989
|
onToken: null,
|
|
19948
|
-
|
|
19949
|
-
|
|
19950
|
-
|
|
19951
|
-
|
|
19952
|
-
|
|
19953
|
-
|
|
19954
|
-
|
|
19955
|
-
|
|
19956
|
-
|
|
19957
|
-
|
|
19958
|
-
|
|
19959
|
-
|
|
19990
|
+
|
|
19991
|
+
|
|
19992
|
+
|
|
19993
|
+
|
|
19994
|
+
|
|
19995
|
+
|
|
19996
|
+
|
|
19997
|
+
|
|
19998
|
+
|
|
19999
|
+
|
|
20000
|
+
|
|
20001
|
+
|
|
19960
20002
|
onComment: null,
|
|
19961
|
-
|
|
19962
|
-
|
|
19963
|
-
|
|
19964
|
-
|
|
19965
|
-
|
|
19966
|
-
|
|
19967
|
-
|
|
19968
|
-
|
|
20003
|
+
|
|
20004
|
+
|
|
20005
|
+
|
|
20006
|
+
|
|
20007
|
+
|
|
20008
|
+
|
|
20009
|
+
|
|
20010
|
+
|
|
19969
20011
|
ranges: false,
|
|
19970
|
-
|
|
19971
|
-
|
|
19972
|
-
|
|
19973
|
-
|
|
19974
|
-
|
|
20012
|
+
|
|
20013
|
+
|
|
20014
|
+
|
|
20015
|
+
|
|
20016
|
+
|
|
19975
20017
|
program: null,
|
|
19976
|
-
|
|
19977
|
-
|
|
20018
|
+
|
|
20019
|
+
|
|
19978
20020
|
sourceFile: null,
|
|
19979
|
-
|
|
19980
|
-
|
|
20021
|
+
|
|
20022
|
+
|
|
19981
20023
|
directSourceFile: null,
|
|
19982
|
-
|
|
19983
|
-
|
|
20024
|
+
|
|
20025
|
+
|
|
19984
20026
|
preserveParens: false
|
|
19985
20027
|
};
|
|
19986
20028
|
var warnedAboutEcmaVersion = false;
|
|
@@ -20093,7 +20135,7 @@ var Parser = function Parser2(options, input, startPos) {
|
|
|
20093
20135
|
this.potentialArrowInForAwait = false;
|
|
20094
20136
|
this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
|
|
20095
20137
|
this.labels = [];
|
|
20096
|
-
this.undefinedExports =
|
|
20138
|
+
this.undefinedExports = Object.create(null);
|
|
20097
20139
|
if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") {
|
|
20098
20140
|
this.skipLineComment(2);
|
|
20099
20141
|
}
|
|
@@ -20305,7 +20347,7 @@ pp$9.isSimpleAssignTarget = function(expr) {
|
|
|
20305
20347
|
};
|
|
20306
20348
|
var pp$8 = Parser.prototype;
|
|
20307
20349
|
pp$8.parseTopLevel = function(node) {
|
|
20308
|
-
var exports =
|
|
20350
|
+
var exports = Object.create(null);
|
|
20309
20351
|
if (!node.body) {
|
|
20310
20352
|
node.body = [];
|
|
20311
20353
|
}
|
|
@@ -20474,11 +20516,11 @@ pp$8.parseStatement = function(context, topLevel, exports) {
|
|
|
20474
20516
|
}
|
|
20475
20517
|
}
|
|
20476
20518
|
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports);
|
|
20477
|
-
|
|
20478
|
-
|
|
20479
|
-
|
|
20480
|
-
|
|
20481
|
-
|
|
20519
|
+
|
|
20520
|
+
|
|
20521
|
+
|
|
20522
|
+
|
|
20523
|
+
|
|
20482
20524
|
default:
|
|
20483
20525
|
if (this.isAsyncFunction()) {
|
|
20484
20526
|
if (context) {
|
|
@@ -21102,7 +21144,7 @@ pp$8.parseClassSuper = function(node) {
|
|
|
21102
21144
|
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null;
|
|
21103
21145
|
};
|
|
21104
21146
|
pp$8.enterClassBody = function() {
|
|
21105
|
-
var element = { declared:
|
|
21147
|
+
var element = { declared: Object.create(null), used: [] };
|
|
21106
21148
|
this.privateNameStack.push(element);
|
|
21107
21149
|
return element.declared;
|
|
21108
21150
|
};
|
|
@@ -21436,7 +21478,7 @@ pp$8.adaptDirectivePrologue = function(statements) {
|
|
|
21436
21478
|
}
|
|
21437
21479
|
};
|
|
21438
21480
|
pp$8.isDirectiveCandidate = function(statement) {
|
|
21439
|
-
return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" &&
|
|
21481
|
+
return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" &&
|
|
21440
21482
|
(this.input[statement.start] === '"' || this.input[statement.start] === "'");
|
|
21441
21483
|
};
|
|
21442
21484
|
var pp$7 = Parser.prototype;
|
|
@@ -22736,7 +22778,7 @@ pp$5.isSimpleParamList = function(params) {
|
|
|
22736
22778
|
return true;
|
|
22737
22779
|
};
|
|
22738
22780
|
pp$5.checkParams = function(node, allowDuplicates) {
|
|
22739
|
-
var nameHash =
|
|
22781
|
+
var nameHash = Object.create(null);
|
|
22740
22782
|
for (var i = 0, list = node.params; i < list.length; i += 1) {
|
|
22741
22783
|
var param = list[i];
|
|
22742
22784
|
this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
|
|
@@ -23106,7 +23148,7 @@ var RegExpValidationState = function RegExpValidationState2(parser) {
|
|
|
23106
23148
|
this.lastAssertionIsQuantifiable = false;
|
|
23107
23149
|
this.numCapturingParens = 0;
|
|
23108
23150
|
this.maxBackReference = 0;
|
|
23109
|
-
this.groupNames =
|
|
23151
|
+
this.groupNames = Object.create(null);
|
|
23110
23152
|
this.backReferenceNames = [];
|
|
23111
23153
|
this.branchID = null;
|
|
23112
23154
|
};
|
|
@@ -23234,23 +23276,23 @@ pp$1.regexp_pattern = function(state) {
|
|
|
23234
23276
|
state.lastAssertionIsQuantifiable = false;
|
|
23235
23277
|
state.numCapturingParens = 0;
|
|
23236
23278
|
state.maxBackReference = 0;
|
|
23237
|
-
state.groupNames =
|
|
23279
|
+
state.groupNames = Object.create(null);
|
|
23238
23280
|
state.backReferenceNames.length = 0;
|
|
23239
23281
|
state.branchID = null;
|
|
23240
23282
|
this.regexp_disjunction(state);
|
|
23241
23283
|
if (state.pos !== state.source.length) {
|
|
23242
23284
|
if (state.eat(
|
|
23243
23285
|
41
|
|
23244
|
-
|
|
23286
|
+
|
|
23245
23287
|
)) {
|
|
23246
23288
|
state.raise("Unmatched ')'");
|
|
23247
23289
|
}
|
|
23248
23290
|
if (state.eat(
|
|
23249
23291
|
93
|
|
23250
|
-
|
|
23292
|
+
|
|
23251
23293
|
) || state.eat(
|
|
23252
23294
|
125
|
|
23253
|
-
|
|
23295
|
+
|
|
23254
23296
|
)) {
|
|
23255
23297
|
state.raise("Lone quantifier brackets");
|
|
23256
23298
|
}
|
|
@@ -23273,7 +23315,7 @@ pp$1.regexp_disjunction = function(state) {
|
|
|
23273
23315
|
this.regexp_alternative(state);
|
|
23274
23316
|
while (state.eat(
|
|
23275
23317
|
124
|
|
23276
|
-
|
|
23318
|
+
|
|
23277
23319
|
)) {
|
|
23278
23320
|
if (trackDisjunction) {
|
|
23279
23321
|
state.branchID = state.branchID.sibling();
|
|
@@ -23288,7 +23330,7 @@ pp$1.regexp_disjunction = function(state) {
|
|
|
23288
23330
|
}
|
|
23289
23331
|
if (state.eat(
|
|
23290
23332
|
123
|
|
23291
|
-
|
|
23333
|
+
|
|
23292
23334
|
)) {
|
|
23293
23335
|
state.raise("Lone quantifier brackets");
|
|
23294
23336
|
}
|
|
@@ -23317,23 +23359,23 @@ pp$1.regexp_eatAssertion = function(state) {
|
|
|
23317
23359
|
state.lastAssertionIsQuantifiable = false;
|
|
23318
23360
|
if (state.eat(
|
|
23319
23361
|
94
|
|
23320
|
-
|
|
23362
|
+
|
|
23321
23363
|
) || state.eat(
|
|
23322
23364
|
36
|
|
23323
|
-
|
|
23365
|
+
|
|
23324
23366
|
)) {
|
|
23325
23367
|
return true;
|
|
23326
23368
|
}
|
|
23327
23369
|
if (state.eat(
|
|
23328
23370
|
92
|
|
23329
|
-
|
|
23371
|
+
|
|
23330
23372
|
)) {
|
|
23331
23373
|
if (state.eat(
|
|
23332
23374
|
66
|
|
23333
|
-
|
|
23375
|
+
|
|
23334
23376
|
) || state.eat(
|
|
23335
23377
|
98
|
|
23336
|
-
|
|
23378
|
+
|
|
23337
23379
|
)) {
|
|
23338
23380
|
return true;
|
|
23339
23381
|
}
|
|
@@ -23341,29 +23383,29 @@ pp$1.regexp_eatAssertion = function(state) {
|
|
|
23341
23383
|
}
|
|
23342
23384
|
if (state.eat(
|
|
23343
23385
|
40
|
|
23344
|
-
|
|
23386
|
+
|
|
23345
23387
|
) && state.eat(
|
|
23346
23388
|
63
|
|
23347
|
-
|
|
23389
|
+
|
|
23348
23390
|
)) {
|
|
23349
23391
|
var lookbehind = false;
|
|
23350
23392
|
if (this.options.ecmaVersion >= 9) {
|
|
23351
23393
|
lookbehind = state.eat(
|
|
23352
23394
|
60
|
|
23353
|
-
|
|
23395
|
+
|
|
23354
23396
|
);
|
|
23355
23397
|
}
|
|
23356
23398
|
if (state.eat(
|
|
23357
23399
|
61
|
|
23358
|
-
|
|
23400
|
+
|
|
23359
23401
|
) || state.eat(
|
|
23360
23402
|
33
|
|
23361
|
-
|
|
23403
|
+
|
|
23362
23404
|
)) {
|
|
23363
23405
|
this.regexp_disjunction(state);
|
|
23364
23406
|
if (!state.eat(
|
|
23365
23407
|
41
|
|
23366
|
-
|
|
23408
|
+
|
|
23367
23409
|
)) {
|
|
23368
23410
|
state.raise("Unterminated group");
|
|
23369
23411
|
}
|
|
@@ -23379,7 +23421,7 @@ pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
|
23379
23421
|
if (this.regexp_eatQuantifierPrefix(state, noError)) {
|
|
23380
23422
|
state.eat(
|
|
23381
23423
|
63
|
|
23382
|
-
|
|
23424
|
+
|
|
23383
23425
|
);
|
|
23384
23426
|
return true;
|
|
23385
23427
|
}
|
|
@@ -23388,33 +23430,33 @@ pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
|
23388
23430
|
pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
23389
23431
|
return state.eat(
|
|
23390
23432
|
42
|
|
23391
|
-
|
|
23433
|
+
|
|
23392
23434
|
) || state.eat(
|
|
23393
23435
|
43
|
|
23394
|
-
|
|
23436
|
+
|
|
23395
23437
|
) || state.eat(
|
|
23396
23438
|
63
|
|
23397
|
-
|
|
23439
|
+
|
|
23398
23440
|
) || this.regexp_eatBracedQuantifier(state, noError);
|
|
23399
23441
|
};
|
|
23400
23442
|
pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
23401
23443
|
var start = state.pos;
|
|
23402
23444
|
if (state.eat(
|
|
23403
23445
|
123
|
|
23404
|
-
|
|
23446
|
+
|
|
23405
23447
|
)) {
|
|
23406
23448
|
var min = 0, max = -1;
|
|
23407
23449
|
if (this.regexp_eatDecimalDigits(state)) {
|
|
23408
23450
|
min = state.lastIntValue;
|
|
23409
23451
|
if (state.eat(
|
|
23410
23452
|
44
|
|
23411
|
-
|
|
23453
|
+
|
|
23412
23454
|
) && this.regexp_eatDecimalDigits(state)) {
|
|
23413
23455
|
max = state.lastIntValue;
|
|
23414
23456
|
}
|
|
23415
23457
|
if (state.eat(
|
|
23416
23458
|
125
|
|
23417
|
-
|
|
23459
|
+
|
|
23418
23460
|
)) {
|
|
23419
23461
|
if (max !== -1 && max < min && !noError) {
|
|
23420
23462
|
state.raise("numbers out of order in {} quantifier");
|
|
@@ -23432,14 +23474,14 @@ pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
|
23432
23474
|
pp$1.regexp_eatAtom = function(state) {
|
|
23433
23475
|
return this.regexp_eatPatternCharacters(state) || state.eat(
|
|
23434
23476
|
46
|
|
23435
|
-
|
|
23477
|
+
|
|
23436
23478
|
) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state);
|
|
23437
23479
|
};
|
|
23438
23480
|
pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
23439
23481
|
var start = state.pos;
|
|
23440
23482
|
if (state.eat(
|
|
23441
23483
|
92
|
|
23442
|
-
|
|
23484
|
+
|
|
23443
23485
|
)) {
|
|
23444
23486
|
if (this.regexp_eatAtomEscape(state)) {
|
|
23445
23487
|
return true;
|
|
@@ -23452,17 +23494,17 @@ pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
|
23452
23494
|
var start = state.pos;
|
|
23453
23495
|
if (state.eat(
|
|
23454
23496
|
40
|
|
23455
|
-
|
|
23497
|
+
|
|
23456
23498
|
)) {
|
|
23457
23499
|
if (state.eat(
|
|
23458
23500
|
63
|
|
23459
|
-
|
|
23501
|
+
|
|
23460
23502
|
)) {
|
|
23461
23503
|
if (this.options.ecmaVersion >= 16) {
|
|
23462
23504
|
var addModifiers = this.regexp_eatModifiers(state);
|
|
23463
23505
|
var hasHyphen = state.eat(
|
|
23464
23506
|
45
|
|
23465
|
-
|
|
23507
|
+
|
|
23466
23508
|
);
|
|
23467
23509
|
if (addModifiers || hasHyphen) {
|
|
23468
23510
|
for (var i = 0; i < addModifiers.length; i++) {
|
|
@@ -23487,12 +23529,12 @@ pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
|
23487
23529
|
}
|
|
23488
23530
|
if (state.eat(
|
|
23489
23531
|
58
|
|
23490
|
-
|
|
23532
|
+
|
|
23491
23533
|
)) {
|
|
23492
23534
|
this.regexp_disjunction(state);
|
|
23493
23535
|
if (state.eat(
|
|
23494
23536
|
41
|
|
23495
|
-
|
|
23537
|
+
|
|
23496
23538
|
)) {
|
|
23497
23539
|
return true;
|
|
23498
23540
|
}
|
|
@@ -23506,7 +23548,7 @@ pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
|
23506
23548
|
pp$1.regexp_eatCapturingGroup = function(state) {
|
|
23507
23549
|
if (state.eat(
|
|
23508
23550
|
40
|
|
23509
|
-
|
|
23551
|
+
|
|
23510
23552
|
)) {
|
|
23511
23553
|
if (this.options.ecmaVersion >= 9) {
|
|
23512
23554
|
this.regexp_groupSpecifier(state);
|
|
@@ -23516,7 +23558,7 @@ pp$1.regexp_eatCapturingGroup = function(state) {
|
|
|
23516
23558
|
this.regexp_disjunction(state);
|
|
23517
23559
|
if (state.eat(
|
|
23518
23560
|
41
|
|
23519
|
-
|
|
23561
|
+
|
|
23520
23562
|
)) {
|
|
23521
23563
|
state.numCapturingParens += 1;
|
|
23522
23564
|
return true;
|
|
@@ -23540,7 +23582,7 @@ function isRegularExpressionModifier(ch) {
|
|
|
23540
23582
|
pp$1.regexp_eatExtendedAtom = function(state) {
|
|
23541
23583
|
return state.eat(
|
|
23542
23584
|
46
|
|
23543
|
-
|
|
23585
|
+
|
|
23544
23586
|
) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state);
|
|
23545
23587
|
};
|
|
23546
23588
|
pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
@@ -23580,7 +23622,7 @@ pp$1.regexp_eatExtendedPatternCharacter = function(state) {
|
|
|
23580
23622
|
pp$1.regexp_groupSpecifier = function(state) {
|
|
23581
23623
|
if (state.eat(
|
|
23582
23624
|
63
|
|
23583
|
-
|
|
23625
|
+
|
|
23584
23626
|
)) {
|
|
23585
23627
|
if (!this.regexp_eatGroupName(state)) {
|
|
23586
23628
|
state.raise("Invalid group");
|
|
@@ -23610,11 +23652,11 @@ pp$1.regexp_eatGroupName = function(state) {
|
|
|
23610
23652
|
state.lastStringValue = "";
|
|
23611
23653
|
if (state.eat(
|
|
23612
23654
|
60
|
|
23613
|
-
|
|
23655
|
+
|
|
23614
23656
|
)) {
|
|
23615
23657
|
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(
|
|
23616
23658
|
62
|
|
23617
|
-
|
|
23659
|
+
|
|
23618
23660
|
)) {
|
|
23619
23661
|
return true;
|
|
23620
23662
|
}
|
|
@@ -23701,7 +23743,7 @@ pp$1.regexp_eatBackReference = function(state) {
|
|
|
23701
23743
|
pp$1.regexp_eatKGroupName = function(state) {
|
|
23702
23744
|
if (state.eat(
|
|
23703
23745
|
107
|
|
23704
|
-
|
|
23746
|
+
|
|
23705
23747
|
)) {
|
|
23706
23748
|
if (this.regexp_eatGroupName(state)) {
|
|
23707
23749
|
state.backReferenceNames.push(state.lastStringValue);
|
|
@@ -23718,7 +23760,7 @@ pp$1.regexp_eatCControlLetter = function(state) {
|
|
|
23718
23760
|
var start = state.pos;
|
|
23719
23761
|
if (state.eat(
|
|
23720
23762
|
99
|
|
23721
|
-
|
|
23763
|
+
|
|
23722
23764
|
)) {
|
|
23723
23765
|
if (this.regexp_eatControlLetter(state)) {
|
|
23724
23766
|
return true;
|
|
@@ -23782,7 +23824,7 @@ pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
|
23782
23824
|
var switchU = forceU || state.switchU;
|
|
23783
23825
|
if (state.eat(
|
|
23784
23826
|
117
|
|
23785
|
-
|
|
23827
|
+
|
|
23786
23828
|
)) {
|
|
23787
23829
|
if (this.regexp_eatFixedHexDigits(state, 4)) {
|
|
23788
23830
|
var lead = state.lastIntValue;
|
|
@@ -23790,10 +23832,10 @@ pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
|
23790
23832
|
var leadSurrogateEnd = state.pos;
|
|
23791
23833
|
if (state.eat(
|
|
23792
23834
|
92
|
|
23793
|
-
|
|
23835
|
+
|
|
23794
23836
|
) && state.eat(
|
|
23795
23837
|
117
|
|
23796
|
-
|
|
23838
|
+
|
|
23797
23839
|
) && this.regexp_eatFixedHexDigits(state, 4)) {
|
|
23798
23840
|
var trail = state.lastIntValue;
|
|
23799
23841
|
if (trail >= 56320 && trail <= 57343) {
|
|
@@ -23808,10 +23850,10 @@ pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
|
23808
23850
|
}
|
|
23809
23851
|
if (switchU && state.eat(
|
|
23810
23852
|
123
|
|
23811
|
-
|
|
23853
|
+
|
|
23812
23854
|
) && this.regexp_eatHexDigits(state) && state.eat(
|
|
23813
23855
|
125
|
|
23814
|
-
|
|
23856
|
+
|
|
23815
23857
|
) && isValidUnicode(state.lastIntValue)) {
|
|
23816
23858
|
return true;
|
|
23817
23859
|
}
|
|
@@ -23832,7 +23874,7 @@ pp$1.regexp_eatIdentityEscape = function(state) {
|
|
|
23832
23874
|
}
|
|
23833
23875
|
if (state.eat(
|
|
23834
23876
|
47
|
|
23835
|
-
|
|
23877
|
+
|
|
23836
23878
|
)) {
|
|
23837
23879
|
state.lastIntValue = 47;
|
|
23838
23880
|
return true;
|
|
@@ -23876,10 +23918,10 @@ pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
|
23876
23918
|
var result;
|
|
23877
23919
|
if (state.eat(
|
|
23878
23920
|
123
|
|
23879
|
-
|
|
23921
|
+
|
|
23880
23922
|
) && (result = this.regexp_eatUnicodePropertyValueExpression(state)) && state.eat(
|
|
23881
23923
|
125
|
|
23882
|
-
|
|
23924
|
+
|
|
23883
23925
|
)) {
|
|
23884
23926
|
if (negate && result === CharSetString) {
|
|
23885
23927
|
state.raise("Invalid property name");
|
|
@@ -23897,7 +23939,7 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
23897
23939
|
var start = state.pos;
|
|
23898
23940
|
if (this.regexp_eatUnicodePropertyName(state) && state.eat(
|
|
23899
23941
|
61
|
|
23900
|
-
|
|
23942
|
+
|
|
23901
23943
|
)) {
|
|
23902
23944
|
var name = state.lastStringValue;
|
|
23903
23945
|
if (this.regexp_eatUnicodePropertyValue(state)) {
|
|
@@ -23960,16 +24002,16 @@ pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
|
23960
24002
|
pp$1.regexp_eatCharacterClass = function(state) {
|
|
23961
24003
|
if (state.eat(
|
|
23962
24004
|
91
|
|
23963
|
-
|
|
24005
|
+
|
|
23964
24006
|
)) {
|
|
23965
24007
|
var negate = state.eat(
|
|
23966
24008
|
94
|
|
23967
|
-
|
|
24009
|
+
|
|
23968
24010
|
);
|
|
23969
24011
|
var result = this.regexp_classContents(state);
|
|
23970
24012
|
if (!state.eat(
|
|
23971
24013
|
93
|
|
23972
|
-
|
|
24014
|
+
|
|
23973
24015
|
)) {
|
|
23974
24016
|
state.raise("Unterminated character class");
|
|
23975
24017
|
}
|
|
@@ -23995,7 +24037,7 @@ pp$1.regexp_nonEmptyClassRanges = function(state) {
|
|
|
23995
24037
|
var left = state.lastIntValue;
|
|
23996
24038
|
if (state.eat(
|
|
23997
24039
|
45
|
|
23998
|
-
|
|
24040
|
+
|
|
23999
24041
|
) && this.regexp_eatClassAtom(state)) {
|
|
24000
24042
|
var right = state.lastIntValue;
|
|
24001
24043
|
if (state.switchU && (left === -1 || right === -1)) {
|
|
@@ -24011,7 +24053,7 @@ pp$1.regexp_eatClassAtom = function(state) {
|
|
|
24011
24053
|
var start = state.pos;
|
|
24012
24054
|
if (state.eat(
|
|
24013
24055
|
92
|
|
24014
|
-
|
|
24056
|
+
|
|
24015
24057
|
)) {
|
|
24016
24058
|
if (this.regexp_eatClassEscape(state)) {
|
|
24017
24059
|
return true;
|
|
@@ -24037,21 +24079,21 @@ pp$1.regexp_eatClassEscape = function(state) {
|
|
|
24037
24079
|
var start = state.pos;
|
|
24038
24080
|
if (state.eat(
|
|
24039
24081
|
98
|
|
24040
|
-
|
|
24082
|
+
|
|
24041
24083
|
)) {
|
|
24042
24084
|
state.lastIntValue = 8;
|
|
24043
24085
|
return true;
|
|
24044
24086
|
}
|
|
24045
24087
|
if (state.switchU && state.eat(
|
|
24046
24088
|
45
|
|
24047
|
-
|
|
24089
|
+
|
|
24048
24090
|
)) {
|
|
24049
24091
|
state.lastIntValue = 45;
|
|
24050
24092
|
return true;
|
|
24051
24093
|
}
|
|
24052
24094
|
if (!state.switchU && state.eat(
|
|
24053
24095
|
99
|
|
24054
|
-
|
|
24096
|
+
|
|
24055
24097
|
)) {
|
|
24056
24098
|
if (this.regexp_eatClassControlLetter(state)) {
|
|
24057
24099
|
return true;
|
|
@@ -24070,7 +24112,7 @@ pp$1.regexp_classSetExpression = function(state) {
|
|
|
24070
24112
|
var start = state.pos;
|
|
24071
24113
|
while (state.eatChars(
|
|
24072
24114
|
[38, 38]
|
|
24073
|
-
|
|
24115
|
+
|
|
24074
24116
|
)) {
|
|
24075
24117
|
if (state.current() !== 38 && (subResult = this.regexp_eatClassSetOperand(state))) {
|
|
24076
24118
|
if (subResult !== CharSetString) {
|
|
@@ -24085,7 +24127,7 @@ pp$1.regexp_classSetExpression = function(state) {
|
|
|
24085
24127
|
}
|
|
24086
24128
|
while (state.eatChars(
|
|
24087
24129
|
[45, 45]
|
|
24088
|
-
|
|
24130
|
+
|
|
24089
24131
|
)) {
|
|
24090
24132
|
if (this.regexp_eatClassSetOperand(state)) {
|
|
24091
24133
|
continue;
|
|
@@ -24117,7 +24159,7 @@ pp$1.regexp_eatClassSetRange = function(state) {
|
|
|
24117
24159
|
var left = state.lastIntValue;
|
|
24118
24160
|
if (state.eat(
|
|
24119
24161
|
45
|
|
24120
|
-
|
|
24162
|
+
|
|
24121
24163
|
) && this.regexp_eatClassSetCharacter(state)) {
|
|
24122
24164
|
var right = state.lastIntValue;
|
|
24123
24165
|
if (left !== -1 && right !== -1 && left > right) {
|
|
@@ -24139,16 +24181,16 @@ pp$1.regexp_eatNestedClass = function(state) {
|
|
|
24139
24181
|
var start = state.pos;
|
|
24140
24182
|
if (state.eat(
|
|
24141
24183
|
91
|
|
24142
|
-
|
|
24184
|
+
|
|
24143
24185
|
)) {
|
|
24144
24186
|
var negate = state.eat(
|
|
24145
24187
|
94
|
|
24146
|
-
|
|
24188
|
+
|
|
24147
24189
|
);
|
|
24148
24190
|
var result = this.regexp_classContents(state);
|
|
24149
24191
|
if (state.eat(
|
|
24150
24192
|
93
|
|
24151
|
-
|
|
24193
|
+
|
|
24152
24194
|
)) {
|
|
24153
24195
|
if (negate && result === CharSetString) {
|
|
24154
24196
|
state.raise("Negated character class may contain strings");
|
|
@@ -24159,7 +24201,7 @@ pp$1.regexp_eatNestedClass = function(state) {
|
|
|
24159
24201
|
}
|
|
24160
24202
|
if (state.eat(
|
|
24161
24203
|
92
|
|
24162
|
-
|
|
24204
|
+
|
|
24163
24205
|
)) {
|
|
24164
24206
|
var result$1 = this.regexp_eatCharacterClassEscape(state);
|
|
24165
24207
|
if (result$1) {
|
|
@@ -24173,16 +24215,16 @@ pp$1.regexp_eatClassStringDisjunction = function(state) {
|
|
|
24173
24215
|
var start = state.pos;
|
|
24174
24216
|
if (state.eatChars(
|
|
24175
24217
|
[92, 113]
|
|
24176
|
-
|
|
24218
|
+
|
|
24177
24219
|
)) {
|
|
24178
24220
|
if (state.eat(
|
|
24179
24221
|
123
|
|
24180
|
-
|
|
24222
|
+
|
|
24181
24223
|
)) {
|
|
24182
24224
|
var result = this.regexp_classStringDisjunctionContents(state);
|
|
24183
24225
|
if (state.eat(
|
|
24184
24226
|
125
|
|
24185
|
-
|
|
24227
|
+
|
|
24186
24228
|
)) {
|
|
24187
24229
|
return result;
|
|
24188
24230
|
}
|
|
@@ -24197,7 +24239,7 @@ pp$1.regexp_classStringDisjunctionContents = function(state) {
|
|
|
24197
24239
|
var result = this.regexp_classString(state);
|
|
24198
24240
|
while (state.eat(
|
|
24199
24241
|
124
|
|
24200
|
-
|
|
24242
|
+
|
|
24201
24243
|
)) {
|
|
24202
24244
|
if (this.regexp_classString(state) === CharSetString) {
|
|
24203
24245
|
result = CharSetString;
|
|
@@ -24216,14 +24258,14 @@ pp$1.regexp_eatClassSetCharacter = function(state) {
|
|
|
24216
24258
|
var start = state.pos;
|
|
24217
24259
|
if (state.eat(
|
|
24218
24260
|
92
|
|
24219
|
-
|
|
24261
|
+
|
|
24220
24262
|
)) {
|
|
24221
24263
|
if (this.regexp_eatCharacterEscape(state) || this.regexp_eatClassSetReservedPunctuator(state)) {
|
|
24222
24264
|
return true;
|
|
24223
24265
|
}
|
|
24224
24266
|
if (state.eat(
|
|
24225
24267
|
98
|
|
24226
|
-
|
|
24268
|
+
|
|
24227
24269
|
)) {
|
|
24228
24270
|
state.lastIntValue = 8;
|
|
24229
24271
|
return true;
|
|
@@ -24273,7 +24315,7 @@ pp$1.regexp_eatHexEscapeSequence = function(state) {
|
|
|
24273
24315
|
var start = state.pos;
|
|
24274
24316
|
if (state.eat(
|
|
24275
24317
|
120
|
|
24276
|
-
|
|
24318
|
+
|
|
24277
24319
|
)) {
|
|
24278
24320
|
if (this.regexp_eatFixedHexDigits(state, 2)) {
|
|
24279
24321
|
return true;
|
|
@@ -24678,11 +24720,11 @@ pp.readToken_numberSign = function() {
|
|
|
24678
24720
|
};
|
|
24679
24721
|
pp.getTokenFromCode = function(code) {
|
|
24680
24722
|
switch (code) {
|
|
24681
|
-
|
|
24682
|
-
|
|
24723
|
+
|
|
24724
|
+
|
|
24683
24725
|
case 46:
|
|
24684
24726
|
return this.readToken_dot();
|
|
24685
|
-
|
|
24727
|
+
|
|
24686
24728
|
case 40:
|
|
24687
24729
|
++this.pos;
|
|
24688
24730
|
return this.finishToken(types$1.parenL);
|
|
@@ -24729,8 +24771,8 @@ pp.getTokenFromCode = function(code) {
|
|
|
24729
24771
|
return this.readRadixNumber(2);
|
|
24730
24772
|
}
|
|
24731
24773
|
}
|
|
24732
|
-
|
|
24733
|
-
|
|
24774
|
+
|
|
24775
|
+
|
|
24734
24776
|
case 49:
|
|
24735
24777
|
case 50:
|
|
24736
24778
|
case 51:
|
|
@@ -24741,14 +24783,14 @@ pp.getTokenFromCode = function(code) {
|
|
|
24741
24783
|
case 56:
|
|
24742
24784
|
case 57:
|
|
24743
24785
|
return this.readNumber(false);
|
|
24744
|
-
|
|
24786
|
+
|
|
24745
24787
|
case 34:
|
|
24746
24788
|
case 39:
|
|
24747
24789
|
return this.readString(code);
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24790
|
+
|
|
24791
|
+
|
|
24792
|
+
|
|
24793
|
+
|
|
24752
24794
|
case 47:
|
|
24753
24795
|
return this.readToken_slash();
|
|
24754
24796
|
case 37:
|
|
@@ -25064,14 +25106,14 @@ pp.readInvalidTemplateToken = function() {
|
|
|
25064
25106
|
if (this.input[this.pos + 1] !== "{") {
|
|
25065
25107
|
break;
|
|
25066
25108
|
}
|
|
25067
|
-
|
|
25109
|
+
|
|
25068
25110
|
case "`":
|
|
25069
25111
|
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos));
|
|
25070
25112
|
case "\r":
|
|
25071
25113
|
if (this.input[this.pos + 1] === "\n") {
|
|
25072
25114
|
++this.pos;
|
|
25073
25115
|
}
|
|
25074
|
-
|
|
25116
|
+
|
|
25075
25117
|
case "\n":
|
|
25076
25118
|
case "\u2028":
|
|
25077
25119
|
case "\u2029":
|
|
@@ -25088,33 +25130,33 @@ pp.readEscapedChar = function(inTemplate) {
|
|
|
25088
25130
|
switch (ch) {
|
|
25089
25131
|
case 110:
|
|
25090
25132
|
return "\n";
|
|
25091
|
-
|
|
25133
|
+
|
|
25092
25134
|
case 114:
|
|
25093
25135
|
return "\r";
|
|
25094
|
-
|
|
25136
|
+
|
|
25095
25137
|
case 120:
|
|
25096
25138
|
return String.fromCharCode(this.readHexChar(2));
|
|
25097
|
-
|
|
25139
|
+
|
|
25098
25140
|
case 117:
|
|
25099
25141
|
return codePointToString(this.readCodePoint());
|
|
25100
|
-
|
|
25142
|
+
|
|
25101
25143
|
case 116:
|
|
25102
25144
|
return " ";
|
|
25103
|
-
|
|
25145
|
+
|
|
25104
25146
|
case 98:
|
|
25105
25147
|
return "\b";
|
|
25106
|
-
|
|
25148
|
+
|
|
25107
25149
|
case 118:
|
|
25108
25150
|
return "\v";
|
|
25109
|
-
|
|
25151
|
+
|
|
25110
25152
|
case 102:
|
|
25111
25153
|
return "\f";
|
|
25112
|
-
|
|
25154
|
+
|
|
25113
25155
|
case 13:
|
|
25114
25156
|
if (this.input.charCodeAt(this.pos) === 10) {
|
|
25115
25157
|
++this.pos;
|
|
25116
25158
|
}
|
|
25117
|
-
|
|
25159
|
+
|
|
25118
25160
|
case 10:
|
|
25119
25161
|
if (this.options.locations) {
|
|
25120
25162
|
this.lineStart = this.pos;
|
|
@@ -25235,14 +25277,14 @@ function tokenizer2(input, options) {
|
|
|
25235
25277
|
return Parser.tokenizer(input, options);
|
|
25236
25278
|
}
|
|
25237
25279
|
|
|
25238
|
-
|
|
25280
|
+
|
|
25239
25281
|
function readGrantScope(r, table, line, fail) {
|
|
25240
25282
|
r.expectPunct("(", "after grant");
|
|
25241
25283
|
r.expectPunct("{", "in grant options");
|
|
25242
25284
|
let membership, grantee, row;
|
|
25243
25285
|
let operations;
|
|
25244
25286
|
let read;
|
|
25245
|
-
const seen =
|
|
25287
|
+
const seen = new Set();
|
|
25246
25288
|
while (!r.tryPunct("}")) {
|
|
25247
25289
|
const key = r.readKey("in grant options");
|
|
25248
25290
|
if (seen.has(key.name)) fail(key.line, `Duplicate grant option "${key.name}".`);
|
|
@@ -25372,9 +25414,9 @@ function validateDeclaredMemberships(tables, tableByName, knownColumns, errors)
|
|
|
25372
25414
|
}
|
|
25373
25415
|
}
|
|
25374
25416
|
|
|
25375
|
-
|
|
25376
|
-
var LITERAL_WORDS =
|
|
25377
|
-
var STATEMENT_WORDS =
|
|
25417
|
+
|
|
25418
|
+
var LITERAL_WORDS = new Set(["true", "false", "null"]);
|
|
25419
|
+
var STATEMENT_WORDS = new Set([
|
|
25378
25420
|
"import",
|
|
25379
25421
|
"export",
|
|
25380
25422
|
"default",
|
|
@@ -25396,7 +25438,7 @@ var isIdent = (t, value) => !!t && t.kind === "ident" && t.value === value;
|
|
|
25396
25438
|
function resolveSchemaConstants(tokens, callable, maxTokens, fail) {
|
|
25397
25439
|
const out = [];
|
|
25398
25440
|
let i = 0;
|
|
25399
|
-
const imported =
|
|
25441
|
+
const imported = new Set();
|
|
25400
25442
|
while (isIdent(tokens[i], "import")) {
|
|
25401
25443
|
const start = i;
|
|
25402
25444
|
while (tokens[i].kind !== "eof" && !isIdent(tokens[i], "from")) {
|
|
@@ -25407,8 +25449,8 @@ function resolveSchemaConstants(tokens, callable, maxTokens, fail) {
|
|
|
25407
25449
|
if (isPunct(tokens[i], ";")) i++;
|
|
25408
25450
|
append(out, tokens.slice(start, i));
|
|
25409
25451
|
}
|
|
25410
|
-
const constants =
|
|
25411
|
-
const declaredLater =
|
|
25452
|
+
const constants = new Map();
|
|
25453
|
+
const declaredLater = new Map();
|
|
25412
25454
|
for (let k = i; k < tokens.length; k++) {
|
|
25413
25455
|
const t = tokens[k];
|
|
25414
25456
|
if ((isIdent(t, "const") || isIdent(t, "let") || isIdent(t, "var")) && tokens[k + 1]?.kind === "ident") {
|
|
@@ -25595,15 +25637,15 @@ function matchingClose(tokens, open) {
|
|
|
25595
25637
|
return -1;
|
|
25596
25638
|
}
|
|
25597
25639
|
|
|
25598
|
-
|
|
25640
|
+
|
|
25599
25641
|
var MAX_PARENT_EDGES = 4;
|
|
25600
|
-
var parentScopeLines =
|
|
25642
|
+
var parentScopeLines = new WeakMap();
|
|
25601
25643
|
function rememberParentLine(sentinel, line) {
|
|
25602
25644
|
parentScopeLines.set(sentinel, line);
|
|
25603
25645
|
}
|
|
25604
25646
|
function resolveParentChains(tables, tableByName, privatePolicy, errors) {
|
|
25605
|
-
const parentEdges =
|
|
25606
|
-
const resolvingParents =
|
|
25647
|
+
const parentEdges = new Map();
|
|
25648
|
+
const resolvingParents = new Set();
|
|
25607
25649
|
const resolveParent = (t) => {
|
|
25608
25650
|
if (t.scope.kind !== "policy" || t.scope.policy.kind !== "parent") return 0;
|
|
25609
25651
|
if (parentEdges.has(t.name)) return parentEdges.get(t.name);
|
|
@@ -25679,7 +25721,7 @@ function fileParentTarget(t) {
|
|
|
25679
25721
|
};
|
|
25680
25722
|
}
|
|
25681
25723
|
|
|
25682
|
-
|
|
25724
|
+
|
|
25683
25725
|
function validateDeclaredRelations(tables, tableByName, knownColumns, markedGone, errors) {
|
|
25684
25726
|
const columnByName = (t, col) => t.columns.find((c) => c.name === col);
|
|
25685
25727
|
for (const t of tables) {
|
|
@@ -25736,9 +25778,9 @@ function validateDeclaredRelations(tables, tableByName, knownColumns, markedGone
|
|
|
25736
25778
|
}
|
|
25737
25779
|
}
|
|
25738
25780
|
|
|
25739
|
-
|
|
25781
|
+
|
|
25740
25782
|
function validateRowLinks(tables, tableByName, errors) {
|
|
25741
|
-
const childOf =
|
|
25783
|
+
const childOf = new Map();
|
|
25742
25784
|
for (const t of tables) {
|
|
25743
25785
|
const links = t.client?.links;
|
|
25744
25786
|
if (!links) continue;
|
|
@@ -25773,7 +25815,7 @@ function validateRowLinks(tables, tableByName, errors) {
|
|
|
25773
25815
|
}
|
|
25774
25816
|
}
|
|
25775
25817
|
|
|
25776
|
-
|
|
25818
|
+
|
|
25777
25819
|
var REFERENCE_HELPERS = ["id", "text", "integer", "bigint"];
|
|
25778
25820
|
function validateIntake(tables, tableByName, errors) {
|
|
25779
25821
|
for (const t of tables) {
|
|
@@ -25823,7 +25865,7 @@ function validateIntake(tables, tableByName, errors) {
|
|
|
25823
25865
|
}
|
|
25824
25866
|
}
|
|
25825
25867
|
|
|
25826
|
-
|
|
25868
|
+
|
|
25827
25869
|
var FILE_OPERATIONS = ["read", "upload", "replace", "delete"];
|
|
25828
25870
|
var MAX_FILE_COLLECTIONS = 20;
|
|
25829
25871
|
var COLLECTION_NAME = /^[a-z][a-z0-9_]{0,63}$/;
|
|
@@ -25871,7 +25913,7 @@ function readStringList(r, fail, ctx) {
|
|
|
25871
25913
|
function readFileMember(r, fail, name, line) {
|
|
25872
25914
|
r.expectPunct("(", 'after "member"');
|
|
25873
25915
|
r.expectPunct("{", `in member() for file collection "${name}" \u2014 member() needs { group, membership, member_user, member_group }`);
|
|
25874
|
-
const seen =
|
|
25916
|
+
const seen = new Map();
|
|
25875
25917
|
let operations;
|
|
25876
25918
|
while (!r.tryPunct("}")) {
|
|
25877
25919
|
const key = r.readKey(`for a member() option of file collection "${name}"`);
|
|
@@ -25930,7 +25972,7 @@ function readFileOwner(r, fail, name) {
|
|
|
25930
25972
|
function readFileParent(r, fail, name, line) {
|
|
25931
25973
|
r.expectPunct("(", 'after "parent"');
|
|
25932
25974
|
r.expectPunct("{", `in parent() for file collection "${name}" \u2014 parent() needs { table, via }`);
|
|
25933
|
-
const seen =
|
|
25975
|
+
const seen = new Map();
|
|
25934
25976
|
while (!r.tryPunct("}")) {
|
|
25935
25977
|
const key = r.readKey(`for a parent() option of file collection "${name}"`);
|
|
25936
25978
|
r.expectPunct(":", `after "${key.name}" in parent() for file collection "${name}"`);
|
|
@@ -25993,7 +26035,7 @@ function readCollection(r, fail, name, errors) {
|
|
|
25993
26035
|
if (callee.value !== "files") fail(callee.line, `file collection "${name}" must be declared with files({ \u2026 }).`);
|
|
25994
26036
|
r.expectPunct("(", 'after "files"');
|
|
25995
26037
|
r.expectPunct("{", `opening files() options for "${name}"`);
|
|
25996
|
-
const seen =
|
|
26038
|
+
const seen = new Set();
|
|
25997
26039
|
let path;
|
|
25998
26040
|
let scope = null;
|
|
25999
26041
|
let isPublic = false;
|
|
@@ -26144,7 +26186,7 @@ function validateFileCollections(collections, table, errors) {
|
|
|
26144
26186
|
}
|
|
26145
26187
|
}
|
|
26146
26188
|
|
|
26147
|
-
|
|
26189
|
+
|
|
26148
26190
|
var BUILT_IN_GROUP_ROLES2 = ["owner", "admin", "member"];
|
|
26149
26191
|
var ROLE_NAME = /^[a-z][a-z0-9_]{0,63}$/;
|
|
26150
26192
|
function isPrototypeName(name) {
|
|
@@ -26153,7 +26195,7 @@ function isPrototypeName(name) {
|
|
|
26153
26195
|
function roleVocabularyErrors(policy) {
|
|
26154
26196
|
const errors = [];
|
|
26155
26197
|
const dupes = (list, what) => {
|
|
26156
|
-
const seen =
|
|
26198
|
+
const seen = new Set();
|
|
26157
26199
|
for (const name of list) {
|
|
26158
26200
|
if (seen.has(name)) errors.push(`${what} lists "${name}" twice.`);
|
|
26159
26201
|
seen.add(name);
|
|
@@ -26185,11 +26227,11 @@ function roleVocabularyErrors(policy) {
|
|
|
26185
26227
|
return errors;
|
|
26186
26228
|
}
|
|
26187
26229
|
|
|
26188
|
-
|
|
26230
|
+
|
|
26189
26231
|
var GROUP_OPERATIONS = ["read", "create", "update", "delete"];
|
|
26190
26232
|
var DEFAULT_GROUP_COLUMN = "group_id";
|
|
26191
26233
|
var IDENT = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
26192
|
-
var declaredGroupRoles =
|
|
26234
|
+
var declaredGroupRoles = new WeakMap();
|
|
26193
26235
|
function readRoleList(r, fail, ctx) {
|
|
26194
26236
|
const open = r.next();
|
|
26195
26237
|
if (open.kind !== "punct" || open.value !== "[") fail(open.line, `${ctx} must be a list of quoted role names, such as ['owner', 'admin'].`);
|
|
@@ -26213,7 +26255,7 @@ function readGroupScope(r, tableName, line, fail) {
|
|
|
26213
26255
|
const explicit = {};
|
|
26214
26256
|
if (!r.tryPunct(")")) {
|
|
26215
26257
|
r.expectPunct("{", `in group() options for table "${tableName}"`);
|
|
26216
|
-
const seen =
|
|
26258
|
+
const seen = new Set();
|
|
26217
26259
|
while (!r.tryPunct("}")) {
|
|
26218
26260
|
const key = r.readKey(`for a group() option of table "${tableName}"`);
|
|
26219
26261
|
if (seen.has(key.name)) fail(key.line, `group() on table "${tableName}" declares ${key.name} twice.`);
|
|
@@ -26348,9 +26390,9 @@ function resolveGroupsAndParents(tables, tableByName, privatePolicy, vocabulary,
|
|
|
26348
26390
|
resolveGroupReferences(tables, errors);
|
|
26349
26391
|
}
|
|
26350
26392
|
|
|
26351
|
-
|
|
26393
|
+
|
|
26352
26394
|
var APP_ROLE_OPERATIONS = ["read", "create", "update", "delete"];
|
|
26353
|
-
var declaredLines =
|
|
26395
|
+
var declaredLines = new WeakMap();
|
|
26354
26396
|
function readAppRoleScope(r, tableName, line, fail) {
|
|
26355
26397
|
const where = `appRole() on table "${tableName}"`;
|
|
26356
26398
|
r.expectPunct("(", 'after "appRole"');
|
|
@@ -26375,7 +26417,7 @@ function readAppRoleScope(r, tableName, line, fail) {
|
|
|
26375
26417
|
sawRoles = true;
|
|
26376
26418
|
r.expectPunct(":", `after "roles" in ${where}`);
|
|
26377
26419
|
r.expectPunct("{", `opening appRole({ roles }) on table "${tableName}"`);
|
|
26378
|
-
const seenOps =
|
|
26420
|
+
const seenOps = new Set();
|
|
26379
26421
|
while (!r.tryPunct("}")) {
|
|
26380
26422
|
const op = r.readKey(`for an operation in appRole({ roles }) on table "${tableName}"`);
|
|
26381
26423
|
if (!APP_ROLE_OPERATIONS.includes(op.name)) {
|
|
@@ -26453,7 +26495,7 @@ function resolveAppRoleScopes(tables, appRoles, errors) {
|
|
|
26453
26495
|
}
|
|
26454
26496
|
}
|
|
26455
26497
|
|
|
26456
|
-
|
|
26498
|
+
|
|
26457
26499
|
var EMAIL_DOMAIN = EMAIL_DOMAIN_PATTERN;
|
|
26458
26500
|
var GROUP_KEYS = ["roles", "adminGrantableRoles"];
|
|
26459
26501
|
var APP_ROLE_KEYS = ["grantableBy", "emailDomain"];
|
|
@@ -26475,7 +26517,7 @@ function readStringList2(r, fail, ctx) {
|
|
|
26475
26517
|
}
|
|
26476
26518
|
function readGroupRoles(r, fail) {
|
|
26477
26519
|
r.expectPunct("{", "opening schema option groups");
|
|
26478
|
-
const seen =
|
|
26520
|
+
const seen = new Set();
|
|
26479
26521
|
const out = { roles: [], adminGrantableRoles: [] };
|
|
26480
26522
|
while (!r.tryPunct("}")) {
|
|
26481
26523
|
const key = r.readKey("for a groups option");
|
|
@@ -26502,7 +26544,7 @@ function readAppRoles(r, fail) {
|
|
|
26502
26544
|
r.expectPunct(":", `after app role "${key.name}"`);
|
|
26503
26545
|
r.expectPunct("{", `opening app role "${key.name}", which takes { grantableBy: [...], emailDomain: '...' }`);
|
|
26504
26546
|
const role = { name: key.name, grantableBy: [] };
|
|
26505
|
-
const seen =
|
|
26547
|
+
const seen = new Set();
|
|
26506
26548
|
while (!r.tryPunct("}")) {
|
|
26507
26549
|
const opt = r.readKey(`for an option of app role "${key.name}"`);
|
|
26508
26550
|
if (!APP_ROLE_KEYS.includes(opt.name)) {
|
|
@@ -26535,7 +26577,7 @@ function readAppRoles(r, fail) {
|
|
|
26535
26577
|
return out.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
26536
26578
|
}
|
|
26537
26579
|
function validateDeclaredRoles(groups, appRoles) {
|
|
26538
|
-
const delegation =
|
|
26580
|
+
const delegation = Object.create(null);
|
|
26539
26581
|
for (const role of appRoles ?? []) delegation[role.name] = role.grantableBy;
|
|
26540
26582
|
return [...emailDomainRoleErrors(appRoles ?? []), ...roleVocabularyErrors({
|
|
26541
26583
|
groupRoles: groups?.roles ?? [],
|
|
@@ -26558,7 +26600,7 @@ function emailDomainRoleErrors(appRoles) {
|
|
|
26558
26600
|
return errors;
|
|
26559
26601
|
}
|
|
26560
26602
|
|
|
26561
|
-
|
|
26603
|
+
|
|
26562
26604
|
function readSchemaOptions(reader, fail, fileErrors) {
|
|
26563
26605
|
const o = {};
|
|
26564
26606
|
if (!reader.tryPunct(",") || reader.peek().kind === "punct" && reader.peek().value === ")") return o;
|
|
@@ -26603,7 +26645,7 @@ function readSchemaOptions(reader, fail, fileErrors) {
|
|
|
26603
26645
|
return o;
|
|
26604
26646
|
}
|
|
26605
26647
|
|
|
26606
|
-
|
|
26648
|
+
|
|
26607
26649
|
function policyOwner(policy) {
|
|
26608
26650
|
if (policy.kind === "owner") return policy;
|
|
26609
26651
|
if (policy.kind === "any_of") return policy.policies.map(policyOwner).find((value) => value !== null) ?? null;
|
|
@@ -26676,7 +26718,7 @@ function validateRoomsOption(input, rawName, nameLine, columns, scope, client, r
|
|
|
26676
26718
|
void nameLine;
|
|
26677
26719
|
return out;
|
|
26678
26720
|
}
|
|
26679
|
-
var COLUMN_HELPERS =
|
|
26721
|
+
var COLUMN_HELPERS = new Set([
|
|
26680
26722
|
"id",
|
|
26681
26723
|
"text",
|
|
26682
26724
|
"number",
|
|
@@ -26687,9 +26729,9 @@ var COLUMN_HELPERS = /* @__PURE__ */ new Set([
|
|
|
26687
26729
|
"json",
|
|
26688
26730
|
"blob"
|
|
26689
26731
|
]);
|
|
26690
|
-
var SCOPE_HELPERS =
|
|
26691
|
-
var TABLE_MARKER_HELPERS =
|
|
26692
|
-
var SCHEMA_CALLABLE =
|
|
26732
|
+
var SCOPE_HELPERS = new Set(["owner", "shared", "serverOnly", "member", "anyOf", "allOf", "parent", "group", "appRole"]);
|
|
26733
|
+
var TABLE_MARKER_HELPERS = new Set(["removedTable", "exported"]);
|
|
26734
|
+
var SCHEMA_CALLABLE = new Set([
|
|
26693
26735
|
...COLUMN_HELPERS,
|
|
26694
26736
|
...SCOPE_HELPERS,
|
|
26695
26737
|
...TABLE_MARKER_HELPERS,
|
|
@@ -26814,7 +26856,7 @@ var Reader = class {
|
|
|
26814
26856
|
this.bareIdIsText = (table) => !options.legacyIntegerIdDefault && !options.integerKeyTables?.has(table.toLowerCase());
|
|
26815
26857
|
}
|
|
26816
26858
|
pos = 0;
|
|
26817
|
-
|
|
26859
|
+
|
|
26818
26860
|
bareIdIsText;
|
|
26819
26861
|
peek() {
|
|
26820
26862
|
return this.tokens[this.pos];
|
|
@@ -26846,7 +26888,7 @@ var Reader = class {
|
|
|
26846
26888
|
}
|
|
26847
26889
|
return t;
|
|
26848
26890
|
}
|
|
26849
|
-
|
|
26891
|
+
|
|
26850
26892
|
readKey(context) {
|
|
26851
26893
|
const t = this.next();
|
|
26852
26894
|
if (t.kind === "ident" || t.kind === "string") return { name: t.value, line: t.line };
|
|
@@ -26863,10 +26905,10 @@ var Reader = class {
|
|
|
26863
26905
|
`line ${t.line}: expected a literal value (string, number, true/false, or null) ${context}, found ${describeToken(t)}. Computed values are not allowed \u2014 the declaration must be readable without running it.`
|
|
26864
26906
|
);
|
|
26865
26907
|
}
|
|
26866
|
-
|
|
26908
|
+
|
|
26867
26909
|
readLiteralObject(context) {
|
|
26868
26910
|
this.expectPunct("{", context);
|
|
26869
|
-
const out =
|
|
26911
|
+
const out = new Map();
|
|
26870
26912
|
while (!this.tryPunct("}")) {
|
|
26871
26913
|
const key = this.readKey(`for an option key ${context}`);
|
|
26872
26914
|
this.expectPunct(":", `after "${key.name}" ${context}`);
|
|
@@ -26891,7 +26933,7 @@ function describeToken(t) {
|
|
|
26891
26933
|
}
|
|
26892
26934
|
function readClientPermissions(r) {
|
|
26893
26935
|
r.expectPunct("{", "opening client permissions");
|
|
26894
|
-
const out =
|
|
26936
|
+
const out = Object.create(null);
|
|
26895
26937
|
while (!r.tryPunct("}")) {
|
|
26896
26938
|
const key = r.readKey("for a client permission");
|
|
26897
26939
|
if (Object.prototype.hasOwnProperty.call(out, key.name)) r.fail(`client declares "${key.name}" twice.`);
|
|
@@ -26975,7 +27017,7 @@ function readColumn(r, tableName, rawName, line) {
|
|
|
26975
27017
|
);
|
|
26976
27018
|
}
|
|
26977
27019
|
r.expectPunct("(", `after "${helper}"`);
|
|
26978
|
-
let opts =
|
|
27020
|
+
let opts = new Map();
|
|
26979
27021
|
if (!r.tryPunct(")")) {
|
|
26980
27022
|
opts = r.readLiteralObject(`in ${helper}() options for "${tableName}"."${rawName}"`);
|
|
26981
27023
|
r.tryPunct(",");
|
|
@@ -26995,7 +27037,7 @@ function readColumn(r, tableName, rawName, line) {
|
|
|
26995
27037
|
onDelete: "restrict",
|
|
26996
27038
|
renamedFrom: null
|
|
26997
27039
|
};
|
|
26998
|
-
const allowed = helper === "id" ?
|
|
27040
|
+
const allowed = helper === "id" ? new Set(["uuid"]) : new Set(["nullable", "default", "unique", "references", "onDelete", "renamedFrom"]);
|
|
26999
27041
|
for (const [key, { value, line: optLine }] of opts) {
|
|
27000
27042
|
if (!allowed.has(key)) {
|
|
27001
27043
|
throw new SchemaTsError(
|
|
@@ -27105,7 +27147,7 @@ function readSingleColumn(r, ctx) {
|
|
|
27105
27147
|
return t.value.toLowerCase();
|
|
27106
27148
|
}
|
|
27107
27149
|
function validateMemberColumns(names, optionLabel, tableName, line) {
|
|
27108
|
-
const seen =
|
|
27150
|
+
const seen = new Set();
|
|
27109
27151
|
for (const name of names) {
|
|
27110
27152
|
if (!SAFE_IDENT.test(name) || name.length > MAX_NAME_LENGTH) {
|
|
27111
27153
|
throw new SchemaTsError(`line ${line}: member(${optionLabel}) on table "${tableName}" names an invalid column "${name}".`);
|
|
@@ -27118,7 +27160,7 @@ function validateMemberColumns(names, optionLabel, tableName, line) {
|
|
|
27118
27160
|
}
|
|
27119
27161
|
function readMemberOperations(r, tableName) {
|
|
27120
27162
|
r.expectPunct("[", `for member({ operations }) on table "${tableName}"`);
|
|
27121
|
-
const seen =
|
|
27163
|
+
const seen = new Set();
|
|
27122
27164
|
while (!r.tryPunct("]")) {
|
|
27123
27165
|
const token = r.next();
|
|
27124
27166
|
if (token.kind !== "string" || !MEMBER_OPERATIONS.includes(token.value)) {
|
|
@@ -27198,14 +27240,14 @@ function readMemberScope(r, tableName, scopeLine) {
|
|
|
27198
27240
|
if (operationsSeen) explicitMemberOperations.add(node);
|
|
27199
27241
|
return node;
|
|
27200
27242
|
}
|
|
27201
|
-
var explicitMemberOperations =
|
|
27243
|
+
var explicitMemberOperations = new WeakSet();
|
|
27202
27244
|
function readPolicyOwner(r, tableName, line) {
|
|
27203
27245
|
r.expectPunct("(", 'after "owner"');
|
|
27204
27246
|
let column = DEFAULT_OWNER_COLUMN;
|
|
27205
27247
|
let read;
|
|
27206
27248
|
if (!r.tryPunct(")")) {
|
|
27207
27249
|
r.expectPunct("{", `in owner() inside anyOf() for table "${tableName}"`);
|
|
27208
|
-
const seen =
|
|
27250
|
+
const seen = new Set();
|
|
27209
27251
|
while (!r.tryPunct("}")) {
|
|
27210
27252
|
const key = r.readKey(`for an owner() option inside anyOf() for table "${tableName}"`);
|
|
27211
27253
|
if (seen.has(key.name)) throw new SchemaTsError(`line ${key.line}: option "${key.name}" appears twice in owner() inside anyOf() for table "${tableName}".`);
|
|
@@ -27356,7 +27398,7 @@ function readParentScope(r, tableName, line) {
|
|
|
27356
27398
|
function readRelations(r, tableName) {
|
|
27357
27399
|
r.expectPunct("{", `for "relations" of table "${tableName}"`);
|
|
27358
27400
|
const out = [];
|
|
27359
|
-
const seen =
|
|
27401
|
+
const seen = new Set();
|
|
27360
27402
|
while (!r.tryPunct("}")) {
|
|
27361
27403
|
const key = r.readKey(`for a relation name of table "${tableName}"`);
|
|
27362
27404
|
if (!SAFE_IDENT.test(key.name) || key.name.length > MAX_NAME_LENGTH) {
|
|
@@ -27424,7 +27466,7 @@ function readScope(r, tableName) {
|
|
|
27424
27466
|
return scope;
|
|
27425
27467
|
}
|
|
27426
27468
|
r.expectPunct("(", `after "${tok.value}"`);
|
|
27427
|
-
let opts =
|
|
27469
|
+
let opts = new Map();
|
|
27428
27470
|
if (!r.tryPunct(")")) {
|
|
27429
27471
|
opts = r.readLiteralObject(`in ${tok.value}() options for table "${tableName}"`);
|
|
27430
27472
|
r.tryPunct(",");
|
|
@@ -27519,7 +27561,7 @@ function readTable(r, rawName, nameLine) {
|
|
|
27519
27561
|
r.expectPunct("{", `opening the columns of table "${rawName}"`);
|
|
27520
27562
|
const columns = [];
|
|
27521
27563
|
const removedColumns = [];
|
|
27522
|
-
const seen =
|
|
27564
|
+
const seen = new Set();
|
|
27523
27565
|
while (!r.tryPunct("}")) {
|
|
27524
27566
|
const key = r.readKey(`for a column of table "${rawName}"`);
|
|
27525
27567
|
r.expectPunct(":", `after column "${key.name}"`);
|
|
@@ -27612,7 +27654,7 @@ function readTable(r, rawName, nameLine) {
|
|
|
27612
27654
|
}
|
|
27613
27655
|
}
|
|
27614
27656
|
const declaredNow = new Set(columns.map((c) => c.name));
|
|
27615
|
-
const renameSources =
|
|
27657
|
+
const renameSources = new Set();
|
|
27616
27658
|
for (const c of columns) {
|
|
27617
27659
|
if (!c.renamedFrom) continue;
|
|
27618
27660
|
if (declaredNow.has(c.renamedFrom)) {
|
|
@@ -27741,7 +27783,7 @@ function extractSchemaTs(source, options = {}) {
|
|
|
27741
27783
|
const tables = [];
|
|
27742
27784
|
const removedTables = [];
|
|
27743
27785
|
const exportedTables = [];
|
|
27744
|
-
const seen =
|
|
27786
|
+
const seen = new Set();
|
|
27745
27787
|
const reader = r;
|
|
27746
27788
|
while (!reader.tryPunct("}")) {
|
|
27747
27789
|
const key = reader.readKey("for a table name");
|
|
@@ -27855,7 +27897,7 @@ function extractSchemaTs(source, options = {}) {
|
|
|
27855
27897
|
}
|
|
27856
27898
|
}
|
|
27857
27899
|
|
|
27858
|
-
|
|
27900
|
+
|
|
27859
27901
|
var MAX_FILE_BYTES = 256 * 1024;
|
|
27860
27902
|
var MAX_PAYLOAD_CHARS = 8 * 1024;
|
|
27861
27903
|
var COMPARE_WINDOW = 96;
|
|
@@ -27866,7 +27908,7 @@ var WRITE = /\.(insert|update)\(\s*(['"`])([A-Za-z_]\w{0,63})\2\s*,\s*/g;
|
|
|
27866
27908
|
var TX = /\.tx\(/g;
|
|
27867
27909
|
var STEP = /\{(?=\s*['"]?(?:op|table)['"]?\s*:)/g;
|
|
27868
27910
|
var VERIFIED = /\b(?:verifyInvocation|verifyWebhook|constructEvent|verifySignature)\s*\(/;
|
|
27869
|
-
var VERIFIER_NAMES =
|
|
27911
|
+
var VERIFIER_NAMES = new Set(["verifyInvocation", "verifyWebhook", "constructEvent", "verifySignature"]);
|
|
27870
27912
|
function hasVerifierCall(source) {
|
|
27871
27913
|
const tokens = tokenizer2(source, { ecmaVersion: "latest", sourceType: "module" });
|
|
27872
27914
|
let previous = "";
|
|
@@ -27908,7 +27950,7 @@ function stripComments(source) {
|
|
|
27908
27950
|
return out;
|
|
27909
27951
|
}
|
|
27910
27952
|
function bindings(source) {
|
|
27911
|
-
const b = { objects:
|
|
27953
|
+
const b = { objects: new Set(), paths: new Set(), forms: new Set(), values: new Set(), callers: new Set() };
|
|
27912
27954
|
const input = String.raw`\(?\s*(?:await\s+)?[\w$.]{1,64}\.(json|formData)\(\)`;
|
|
27913
27955
|
for (const m of source.matchAll(new RegExp(String.raw`\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*(?::[^=;\n]{0,200})?=\s*${input}`, "g"))) {
|
|
27914
27956
|
(m[2] === "formData" ? b.forms : b.objects).add(m[1]);
|
|
@@ -28089,8 +28131,8 @@ function requestOwnershipFindings(functions, schema) {
|
|
|
28089
28131
|
const lower = source.toLowerCase();
|
|
28090
28132
|
const receivers = serverReceivers(source);
|
|
28091
28133
|
const starts = lineIndex(source);
|
|
28092
|
-
const columnsByTable =
|
|
28093
|
-
const seen =
|
|
28134
|
+
const columnsByTable = new Map();
|
|
28135
|
+
const seen = new Set();
|
|
28094
28136
|
let fileCount = 0;
|
|
28095
28137
|
let fileFull = false;
|
|
28096
28138
|
const report = (table, columns, offset2) => {
|
|
@@ -28186,7 +28228,7 @@ function requestOwnershipFindings(functions, schema) {
|
|
|
28186
28228
|
return { findings, skippedFiles, truncated };
|
|
28187
28229
|
}
|
|
28188
28230
|
|
|
28189
|
-
|
|
28231
|
+
|
|
28190
28232
|
var MAX_FILE_BYTES2 = 256 * 1024;
|
|
28191
28233
|
var MAX_FINDINGS_PER_FILE2 = 20;
|
|
28192
28234
|
var MAX_FINDINGS2 = 100;
|
|
@@ -28195,7 +28237,7 @@ var LOOP_HEADER = /(?:^|[^\w$.])(?:for|while)\s*(?:await\s*)?$/;
|
|
|
28195
28237
|
var BLOCK_HEADER = /(?:^|[^\w$.])(?:if|switch|catch|with)\s*$/;
|
|
28196
28238
|
function scanFile(source) {
|
|
28197
28239
|
const offsets = [];
|
|
28198
|
-
const seenLoops =
|
|
28240
|
+
const seenLoops = new Set();
|
|
28199
28241
|
const stack = [];
|
|
28200
28242
|
let lastParen = null;
|
|
28201
28243
|
let quote = null;
|
|
@@ -28344,7 +28386,7 @@ function sequentialEmailFindings(functions) {
|
|
|
28344
28386
|
return { findings, skippedFiles, truncated };
|
|
28345
28387
|
}
|
|
28346
28388
|
|
|
28347
|
-
|
|
28389
|
+
|
|
28348
28390
|
var MAX_FILE_BYTES3 = 256 * 1024;
|
|
28349
28391
|
var MAX_FINDINGS_PER_FILE3 = 20;
|
|
28350
28392
|
var MAX_FINDINGS3 = 100;
|
|
@@ -28451,7 +28493,7 @@ function userEmailScanFindings(functions) {
|
|
|
28451
28493
|
return { findings, skippedFiles, truncated };
|
|
28452
28494
|
}
|
|
28453
28495
|
|
|
28454
|
-
|
|
28496
|
+
|
|
28455
28497
|
var SOURCE_LINT_VERSION = "6";
|
|
28456
28498
|
async function lintSourceSnapshot(files, functions = {}) {
|
|
28457
28499
|
const entries2 = (map) => Object.keys(map).sort().map((key) => [key, map[key]]);
|