@selvajs/selva 4.20.1-beta.2 → 4.20.1-beta.3
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/build/adapter-node.js +1 -1
- package/build/client/_app/immutable/chunks/{D-SwRD80.js → D-uUm_OB.js} +43 -43
- package/build/client/_app/immutable/chunks/D-uUm_OB.js.br +0 -0
- package/build/client/_app/immutable/chunks/{D-SwRD80.js.gz → D-uUm_OB.js.gz} +0 -0
- package/build/client/_app/immutable/chunks/D84F7w9g.js +1 -0
- package/build/client/_app/immutable/chunks/D84F7w9g.js.br +1 -0
- package/build/client/_app/immutable/chunks/D84F7w9g.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.hg2qyLJU.js → app.BpT6WkO1.js} +2 -2
- package/build/client/_app/immutable/entry/app.BpT6WkO1.js.br +0 -0
- package/build/client/_app/immutable/entry/app.BpT6WkO1.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.BkNlRItr.js +1 -0
- package/build/client/_app/immutable/nodes/21.BkNlRItr.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.BkNlRItr.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/server/.vite/manifest.json +9 -2
- package/build/server/chunks/access.js +0 -3
- package/build/server/chunks/access.js.map +1 -1
- package/build/server/chunks/definitions.js +178 -1
- package/build/server/chunks/definitions.js.map +1 -1
- package/build/server/chunks/handlers.js +4 -5
- package/build/server/chunks/handlers.js.map +1 -1
- package/build/server/chunks/instance.js +3 -3
- package/build/server/chunks/internal.js +1 -1
- package/build/server/chunks/package.js +1 -1
- package/build/server/chunks/package.js.map +1 -1
- package/build/server/chunks/providers.server.js +89 -188
- package/build/server/chunks/providers.server.js.map +1 -1
- package/build/server/chunks/registry.js +3 -3
- package/build/server/chunks/registry.js.map +1 -1
- package/build/server/chunks/resolve.server.js +1 -1
- package/build/server/chunks/server-config-write.js +13 -1
- package/build/server/chunks/server-config-write.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/compute/_server.ts.js +30 -48
- package/build/server/entries/endpoints/api/admin/compute/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/compute/actions/_server.ts.js +3 -2
- package/build/server/entries/endpoints/api/admin/compute/actions/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/compute/status/_server.ts.js +3 -2
- package/build/server/entries/endpoints/api/admin/compute/status/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/projects/_id_/_server.ts.js +3 -2
- package/build/server/entries/endpoints/api/admin/projects/_id_/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/admin/users/_server.ts.js +6 -2
- package/build/server/entries/endpoints/api/admin/users/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js +8 -8
- package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/v1/compute/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +1 -1
- package/build/server/entries/endpoints/docs/api/openapi.yaml/_server.ts.js +1 -1
- package/build/server/entries/hooks.server.js +13 -1
- package/build/server/entries/hooks.server.js.map +1 -1
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js +16 -3
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js.map +1 -1
- package/build/server/entries/pages/library/_guid_/_page.svelte.js +132 -89
- package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
- package/build/server/manifest-full.js +1 -1
- package/build/server/manifest.js +1 -1
- package/build/server/nodes/21.js +1 -1
- package/build/server/server.js +1 -1
- package/package.json +11 -11
- package/build/client/_app/immutable/chunks/D-SwRD80.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dvq2vJj6.js +0 -1
- package/build/client/_app/immutable/chunks/Dvq2vJj6.js.br +0 -1
- package/build/client/_app/immutable/chunks/Dvq2vJj6.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.hg2qyLJU.js.br +0 -0
- package/build/client/_app/immutable/entry/app.hg2qyLJU.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.gGT7QEb1.js +0 -1
- package/build/client/_app/immutable/nodes/21.gGT7QEb1.js.br +0 -1
- package/build/client/_app/immutable/nodes/21.gGT7QEb1.js.gz +0 -0
|
@@ -213,7 +213,7 @@ function server_data_serializer(event, state) {
|
|
|
213
213
|
let promise_id = 1;
|
|
214
214
|
let max_nodes = -1;
|
|
215
215
|
const iterator = create_async_iterator();
|
|
216
|
-
const global = "
|
|
216
|
+
const global = "__sveltekit_8e03ud";
|
|
217
217
|
/** @param {number} index */
|
|
218
218
|
function get_replacer(index) {
|
|
219
219
|
/** @param {any} thing */
|
|
@@ -1443,7 +1443,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
|
|
|
1443
1443
|
"crossorigin"
|
|
1444
1444
|
]);
|
|
1445
1445
|
}
|
|
1446
|
-
const global = "
|
|
1446
|
+
const global = "__sveltekit_8e03ud";
|
|
1447
1447
|
const { data, chunks } = data_serializer.get_data(csp);
|
|
1448
1448
|
if (page_config.ssr && page_config.csr) body += `\n\t\t\t${fetched.map((item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!(state.prerendering || state.prerender_default === true))).join("\n ")}`;
|
|
1449
1449
|
if (page_config.csr && client) {
|
|
@@ -1467,7 +1467,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
|
|
|
1467
1467
|
}
|
|
1468
1468
|
}
|
|
1469
1469
|
const blocks = [];
|
|
1470
|
-
const properties = [`base: ${base_expression}`, `version: ${s("
|
|
1470
|
+
const properties = [`base: ${base_expression}`, `version: ${s("1794066792698")}`];
|
|
1471
1471
|
if (assets) properties.push(`assets: ${s(assets)}`);
|
|
1472
1472
|
if (client.uses_env_dynamic_public) properties.push(`env: ${load_env_eagerly ? "null" : uneval$1(rendered_env)}`);
|
|
1473
1473
|
if (chunks) {
|
|
@@ -2363,7 +2363,7 @@ function redirect_response(status, location) {
|
|
|
2363
2363
|
* @param {Response} response
|
|
2364
2364
|
*/
|
|
2365
2365
|
function with_version_header(response) {
|
|
2366
|
-
response.headers.set("x-sveltekit-version", "
|
|
2366
|
+
response.headers.set("x-sveltekit-version", "1794066792698");
|
|
2367
2367
|
return response;
|
|
2368
2368
|
}
|
|
2369
2369
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.20.1-beta.
|
|
1
|
+
{"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.20.1-beta.3\",\n\t\"description\": \"Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.\",\n\t\"license\": \"MIT\",\n\t\"author\": \"VektorNode\",\n\t\"homepage\": \"https://selva.dev\",\n\t\"bugs\": \"https://github.com/VektorNode/selva/issues\",\n\t\"keywords\": [\n\t\t\"grasshopper\",\n\t\t\"rhino\",\n\t\t\"rhino-compute\",\n\t\t\"parametric-design\",\n\t\t\"web-app\",\n\t\t\"sveltekit\"\n\t],\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/VektorNode/selva.git\",\n\t\t\"directory\": \"packages/selva\"\n\t},\n\t\"type\": \"module\",\n\t\"main\": \"./build/index.js\",\n\t\"files\": [\n\t\t\"build\",\n\t\t\"templates\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=24.0.0\"\n\t},\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"dev:lan\": \"vite dev --host\",\n\t\t\"build\": \"rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"start\": \"node build/index.js\",\n\t\t\"clean\": \"rimraf build templates\",\n\t\t\"prepare\": \"svelte-kit sync || echo ''\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"test\": \"vitest run\",\n\t\t\"test:watch\": \"vitest\",\n\t\t\"openapi:generate\": \"node scripts/generate-openapi.js\",\n\t\t\"test:e2e\": \"playwright test\",\n\t\t\"lint\": \"eslint .\",\n\t\t\"lint:types\": \"eslint . --config eslint.typed.config.js\",\n\t\t\"generate:cli-config\": \"node scripts/generate-cli-config.js\"\n\t},\n\t\"dependencies\": {\n\t\t\"@lucide/svelte\": \"catalog:\",\n\t\t\"@supabase/supabase-js\": \"catalog:\",\n\t\t\"@sveltejs/kit\": \"catalog:\",\n\t\t\"bits-ui\": \"catalog:\",\n\t\t\"clsx\": \"catalog:\",\n\t\t\"mode-watcher\": \"catalog:\",\n\t\t\"nodemailer\": \"catalog:\",\n\t\t\"pino\": \"^10.4.0\",\n\t\t\"rhino3dm\": \"catalog:\",\n\t\t\"sharp\": \"catalog:\",\n\t\t\"tailwind-merge\": \"catalog:\",\n\t\t\"tailwind-variants\": \"catalog:\",\n\t\t\"three\": \"catalog:\",\n\t\t\"zod\": \"catalog:\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"@sentry/node\": \"^11.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"catalog:\",\n\t\t\"@selvajs/compute\": \"workspace:*\",\n\t\t\"@selvajs/config\": \"workspace:*\",\n\t\t\"@selvajs/header-auth-provider\": \"workspace:*\",\n\t\t\"@selvajs/local-provider\": \"workspace:*\",\n\t\t\"@selvajs/mcp\": \"workspace:*\",\n\t\t\"@selvajs/notifications\": \"workspace:*\",\n\t\t\"@selvajs/platform\": \"workspace:*\",\n\t\t\"@selvajs/schemas\": \"workspace:*\",\n\t\t\"@selvajs/server\": \"workspace:*\",\n\t\t\"@selvajs/solve\": \"workspace:*\",\n\t\t\"@selvajs/supabase-provider\": \"workspace:*\",\n\t\t\"@selvajs/ui\": \"workspace:*\",\n\t\t\"@selvajs/visualization\": \"workspace:*\",\n\t\t\"@sveltejs/adapter-node\": \"catalog:\",\n\t\t\"@types/nodemailer\": \"catalog:\",\n\t\t\"@types/three\": \"catalog:\",\n\t\t\"rimraf\": \"catalog:\",\n\t\t\"tw-animate-css\": \"catalog:\",\n\t\t\"vitest\": \"catalog:\"\n\t},\n\t\"imports\": {\n\t\t\"#lib/*\": \"./src/lib/*\"\n\t}\n}\n"],"mappings":""}
|
|
@@ -7,7 +7,7 @@ import { i as DEFAULT_ORG_PERMISSIONS, t as ALL_ORG_ASSET_KINDS } from "./schema
|
|
|
7
7
|
import { t as ALL_PLATFORM_PERMISSIONS } from "./types3.js";
|
|
8
8
|
import { d as encodeOffsetCursor, l as clampPageLimit, u as decodeOffsetCursor } from "./visibility.js";
|
|
9
9
|
import { n as readBool } from "./limits.js";
|
|
10
|
-
import { n as renderThrown } from "./definitions.js";
|
|
10
|
+
import { a as createLogger, i as ConsoleLogger, n as renderThrown } from "./definitions.js";
|
|
11
11
|
import { c as ComputeError, i as TreeBuilder, l as ErrorCodes, m as isDefinitionRef, n as GrasshopperClient, p as enableDebugLogging, s as stableStringify } from "./grasshopper.js";
|
|
12
12
|
import { i as getInputItems, n as serverSourcedInputIds, t as raceAbort } from "./abort-Bfrdupaj.js";
|
|
13
13
|
import { createRequire } from "node:module";
|
|
@@ -685,178 +685,6 @@ function decryptWithKeys(envelope, keys, aad) {
|
|
|
685
685
|
}
|
|
686
686
|
throw lastError ?? /* @__PURE__ */ new Error("No key to decrypt with");
|
|
687
687
|
}
|
|
688
|
-
// ../server/src/logging/PinoLogger.ts
|
|
689
|
-
/**
|
|
690
|
-
* Field paths scrubbed before a record is written. A backstop for accidents,
|
|
691
|
-
* NOT a licence to log objects: call sites are required not to log secrets in
|
|
692
|
-
* the first place (see `LogFields`). This catches the case where a whole object
|
|
693
|
-
* is spread into fields and happens to carry a credential.
|
|
694
|
-
*
|
|
695
|
-
* It matches by FIELD NAME, and only at the top level or one level deep (the
|
|
696
|
-
* `*.` entries). It will not catch personal data — an email nested in a payload
|
|
697
|
-
* sails straight through, and a log line reaches a collector that erasure can
|
|
698
|
-
* never reach. The nested `*.` set doesn't cover every top-level name.
|
|
699
|
-
*/
|
|
700
|
-
var REDACTED_PATHS = [
|
|
701
|
-
"token",
|
|
702
|
-
"sessionToken",
|
|
703
|
-
"refreshToken",
|
|
704
|
-
"apiKey",
|
|
705
|
-
"api_key",
|
|
706
|
-
"password",
|
|
707
|
-
"authorization",
|
|
708
|
-
"Authorization",
|
|
709
|
-
"cookie",
|
|
710
|
-
"secret",
|
|
711
|
-
"*.secret",
|
|
712
|
-
"*.authorization",
|
|
713
|
-
"*.Authorization",
|
|
714
|
-
"*.token",
|
|
715
|
-
"*.sessionToken",
|
|
716
|
-
"*.refreshToken",
|
|
717
|
-
"*.apiKey",
|
|
718
|
-
"*.password"
|
|
719
|
-
];
|
|
720
|
-
/**
|
|
721
|
-
* Minimal `ILogger` over `console.*`, used when pino isn't installed. Renders
|
|
722
|
-
* as `LEVEL message {fields}` — greppable, and honest about not being
|
|
723
|
-
* machine-parseable. `child` fields merge eagerly so correlation still works.
|
|
724
|
-
*/
|
|
725
|
-
var ConsoleLogger = class ConsoleLogger {
|
|
726
|
-
bound;
|
|
727
|
-
minLevel;
|
|
728
|
-
constructor(bound = {}, minLevel = "info") {
|
|
729
|
-
this.bound = bound;
|
|
730
|
-
this.minLevel = minLevel;
|
|
731
|
-
}
|
|
732
|
-
static ORDER = {
|
|
733
|
-
debug: 10,
|
|
734
|
-
info: 20,
|
|
735
|
-
warn: 30,
|
|
736
|
-
error: 40
|
|
737
|
-
};
|
|
738
|
-
write(level, message, fields) {
|
|
739
|
-
if (ConsoleLogger.ORDER[level] < ConsoleLogger.ORDER[this.minLevel]) return;
|
|
740
|
-
const merged = {
|
|
741
|
-
...this.bound,
|
|
742
|
-
...fields
|
|
743
|
-
};
|
|
744
|
-
const suffix = Object.keys(merged).length > 0 ? ` ${safeStringify(merged)}` : "";
|
|
745
|
-
const line = `${level.toUpperCase()} ${message}${suffix}`;
|
|
746
|
-
if (level === "error") console.error(line);
|
|
747
|
-
else if (level === "warn") console.warn(line);
|
|
748
|
-
else console.info(line);
|
|
749
|
-
}
|
|
750
|
-
debug(message, fields) {
|
|
751
|
-
this.write("debug", message, fields);
|
|
752
|
-
}
|
|
753
|
-
info(message, fields) {
|
|
754
|
-
this.write("info", message, fields);
|
|
755
|
-
}
|
|
756
|
-
warn(message, fields) {
|
|
757
|
-
this.write("warn", message, fields);
|
|
758
|
-
}
|
|
759
|
-
error(message, fields) {
|
|
760
|
-
this.write("error", message, fields);
|
|
761
|
-
}
|
|
762
|
-
child(fields) {
|
|
763
|
-
return new ConsoleLogger({
|
|
764
|
-
...this.bound,
|
|
765
|
-
...fields
|
|
766
|
-
}, this.minLevel);
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
/** Fields can hold anything, including cycles. Never let rendering throw. */
|
|
770
|
-
function safeStringify(value) {
|
|
771
|
-
try {
|
|
772
|
-
return JSON.stringify(value) ?? String(value);
|
|
773
|
-
} catch {
|
|
774
|
-
return "[unserializable]";
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
var PinoLogger = class PinoLogger {
|
|
778
|
-
pino;
|
|
779
|
-
constructor(pino) {
|
|
780
|
-
this.pino = pino;
|
|
781
|
-
}
|
|
782
|
-
debug(message, fields) {
|
|
783
|
-
try {
|
|
784
|
-
this.pino.debug(fields ?? {}, message);
|
|
785
|
-
} catch {}
|
|
786
|
-
}
|
|
787
|
-
info(message, fields) {
|
|
788
|
-
try {
|
|
789
|
-
this.pino.info(fields ?? {}, message);
|
|
790
|
-
} catch {}
|
|
791
|
-
}
|
|
792
|
-
warn(message, fields) {
|
|
793
|
-
try {
|
|
794
|
-
this.pino.warn(fields ?? {}, message);
|
|
795
|
-
} catch {}
|
|
796
|
-
}
|
|
797
|
-
error(message, fields) {
|
|
798
|
-
try {
|
|
799
|
-
this.pino.error(fields ?? {}, message);
|
|
800
|
-
} catch {}
|
|
801
|
-
}
|
|
802
|
-
child(fields) {
|
|
803
|
-
try {
|
|
804
|
-
return new PinoLogger(this.pino.child(fields));
|
|
805
|
-
} catch {
|
|
806
|
-
return this;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
};
|
|
810
|
-
/** Build the app's root logger. Never throws, never returns `null`. */
|
|
811
|
-
async function createLogger(opts = {}) {
|
|
812
|
-
const level = opts.level ?? "info";
|
|
813
|
-
try {
|
|
814
|
-
const factory = await loadPinoFactory();
|
|
815
|
-
if (!factory) return new ConsoleLogger(opts.base ?? {}, level);
|
|
816
|
-
return new PinoLogger(factory({
|
|
817
|
-
level,
|
|
818
|
-
base: opts.base,
|
|
819
|
-
redact: {
|
|
820
|
-
paths: REDACTED_PATHS,
|
|
821
|
-
censor: "[redacted]"
|
|
822
|
-
},
|
|
823
|
-
transport: opts.pretty ? {
|
|
824
|
-
target: "pino-pretty",
|
|
825
|
-
options: {
|
|
826
|
-
colorize: true,
|
|
827
|
-
ignore: "pid,hostname"
|
|
828
|
-
}
|
|
829
|
-
} : void 0
|
|
830
|
-
}));
|
|
831
|
-
} catch (err) {
|
|
832
|
-
console.warn(`[Logger] pino was found but could not be initialized; falling back to console logging. ${String(err)}`);
|
|
833
|
-
return new ConsoleLogger(opts.base ?? {}, level);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* Load pino's factory, or `null` when it isn't installed.
|
|
838
|
-
*
|
|
839
|
-
* Don't inline the specifier. A literal `import('pino')` is statically
|
|
840
|
-
* analyzable, so Vite applied browser-field mapping to this server build and
|
|
841
|
-
* resolved it to pino's `server_false` browser shim — a stub whose factory
|
|
842
|
-
* throws, turning "use pino" into a silent fall back to the console. Computing
|
|
843
|
-
* the specifier defeats that and leaves the import to Node at runtime.
|
|
844
|
-
* `@vite-ignore` alone was NOT enough: it silenced the warning and the rewrite
|
|
845
|
-
* still happened.
|
|
846
|
-
*/
|
|
847
|
-
async function loadPinoFactory() {
|
|
848
|
-
const specifier = "pino";
|
|
849
|
-
try {
|
|
850
|
-
const mod = await import(
|
|
851
|
-
/* @vite-ignore */
|
|
852
|
-
specifier
|
|
853
|
-
);
|
|
854
|
-
const factory = mod.default ?? mod;
|
|
855
|
-
return typeof factory === "function" ? factory : null;
|
|
856
|
-
} catch {
|
|
857
|
-
return null;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
688
|
// ../server/src/definitions/definition-service.ts
|
|
861
689
|
/**
|
|
862
690
|
* Orchestrates writes spanning IDataProvider + IStorageProvider. Application
|
|
@@ -2881,9 +2709,9 @@ var LocalDefinitionStore = class LocalDefinitionStore {
|
|
|
2881
2709
|
// ../providers/local/src/data/LocalShareLinkStore.ts
|
|
2882
2710
|
var empty$2 = () => ({ links: {} });
|
|
2883
2711
|
/**
|
|
2884
|
-
* `tryIncrementSolveCount`
|
|
2885
|
-
*
|
|
2886
|
-
*
|
|
2712
|
+
* Writes queue on `withFileLock`, so `tryIncrementSolveCount` checks the cap and
|
|
2713
|
+
* counts as one step, but only within this process: two processes sharing
|
|
2714
|
+
* `share-links.json` can both admit the last solve under the cap.
|
|
2887
2715
|
*/
|
|
2888
2716
|
var LocalShareLinkStore = class LocalShareLinkStore {
|
|
2889
2717
|
definitionProvider;
|
|
@@ -3352,11 +3180,6 @@ var LocalDataProvider = class LocalDataProvider {
|
|
|
3352
3180
|
await this.userData.deleteUser(userId);
|
|
3353
3181
|
} catch {}
|
|
3354
3182
|
await this.apiTokens.eraseUser(ctx, userId);
|
|
3355
|
-
for (let i = 0; i < 100; i++) {
|
|
3356
|
-
const membership = await this.orgs.findUserMembership(ctx, userId);
|
|
3357
|
-
if (!membership) break;
|
|
3358
|
-
await this.orgs.removeOrgMember(ctx, membership.org.id, userId);
|
|
3359
|
-
}
|
|
3360
3183
|
await this.erasable.orgs.eraseUser(userId);
|
|
3361
3184
|
await this.erasable.definitions.eraseUser(userId);
|
|
3362
3185
|
await this.erasable.invites.eraseUser(userId, opts?.email);
|
|
@@ -3486,6 +3309,13 @@ var LocalStorageProvider = class LocalStorageProvider {
|
|
|
3486
3309
|
};
|
|
3487
3310
|
// ../providers/supabase/src/storage/SupabaseStorageProvider.ts
|
|
3488
3311
|
var LIST_PAGE_SIZE = 1e3;
|
|
3312
|
+
/**
|
|
3313
|
+
* Supabase Storage refuses to upload a `..` key but answers a read of one with
|
|
3314
|
+
* not-found. Refusing here gives every method the local store's 400.
|
|
3315
|
+
*/
|
|
3316
|
+
function assertNoClimb(storagePath) {
|
|
3317
|
+
if (storagePath.split("/").includes("..")) throw new ProviderError(`Path escapes the store: ${JSON.stringify(storagePath)}`, 400);
|
|
3318
|
+
}
|
|
3489
3319
|
var SupabaseStorageProvider = class SupabaseStorageProvider {
|
|
3490
3320
|
client;
|
|
3491
3321
|
publicBucket;
|
|
@@ -3526,6 +3356,7 @@ var SupabaseStorageProvider = class SupabaseStorageProvider {
|
|
|
3526
3356
|
return classifyAssetPath(storagePath)?.class.visibility === "public" ? this.publicBucket : this.privateBucket;
|
|
3527
3357
|
}
|
|
3528
3358
|
async get(storagePath) {
|
|
3359
|
+
assertNoClimb(storagePath);
|
|
3529
3360
|
const bucket = this.bucketFor(storagePath);
|
|
3530
3361
|
const { data, error } = await this.client.storage.from(bucket).download(storagePath);
|
|
3531
3362
|
if (error) {
|
|
@@ -3537,6 +3368,7 @@ var SupabaseStorageProvider = class SupabaseStorageProvider {
|
|
|
3537
3368
|
return new Uint8Array(buffer);
|
|
3538
3369
|
}
|
|
3539
3370
|
async put(storagePath, data, contentType) {
|
|
3371
|
+
assertNoClimb(storagePath);
|
|
3540
3372
|
const transcoded = await transcodeImageIfNeeded(data, contentType, storagePath);
|
|
3541
3373
|
const bucket = this.bucketFor(transcoded.path);
|
|
3542
3374
|
const { error } = await this.client.storage.from(bucket).upload(transcoded.path, transcoded.data, {
|
|
@@ -3548,11 +3380,13 @@ var SupabaseStorageProvider = class SupabaseStorageProvider {
|
|
|
3548
3380
|
return transcoded.path;
|
|
3549
3381
|
}
|
|
3550
3382
|
async delete(storagePath) {
|
|
3383
|
+
assertNoClimb(storagePath);
|
|
3551
3384
|
const bucket = this.bucketFor(storagePath);
|
|
3552
3385
|
const { error } = await this.client.storage.from(bucket).remove([storagePath]);
|
|
3553
3386
|
if (error) throw error;
|
|
3554
3387
|
}
|
|
3555
3388
|
async deletePrefix(prefix) {
|
|
3389
|
+
assertNoClimb(prefix);
|
|
3556
3390
|
if (trimTrailing(prefix, "/") === "") throw new ProviderError(`Refusing to delete the whole store: prefix ${JSON.stringify(prefix)}`, 400);
|
|
3557
3391
|
await Promise.all([this.deletePrefixInBucket(this.publicBucket, prefix), this.deletePrefixInBucket(this.privateBucket, prefix)]);
|
|
3558
3392
|
}
|
|
@@ -5850,7 +5684,7 @@ var SupabaseDataProvider = class SupabaseDataProvider {
|
|
|
5850
5684
|
*/
|
|
5851
5685
|
async onUserDeleted(_ctx, userId, opts) {
|
|
5852
5686
|
const client = this.clients.serviceClient;
|
|
5853
|
-
const email = opts?.email;
|
|
5687
|
+
const email = opts?.email?.trim().toLowerCase();
|
|
5854
5688
|
const deletedActions = await client.from("audit_events").delete().eq("actor_id", userId);
|
|
5855
5689
|
if (deletedActions.error) throw new ProviderError(`Failed to erase audit_events for user: ${deletedActions.error.message}`, 500);
|
|
5856
5690
|
const tombstoned = await client.from("solve_metrics").update({ actor_id: ERASED_ACTOR_ID }).eq("actor_id", userId);
|
|
@@ -6673,14 +6507,28 @@ function createAllowlistStore(filePath) {
|
|
|
6673
6507
|
if (dirty) await writeFile$1(filePath, file);
|
|
6674
6508
|
});
|
|
6675
6509
|
},
|
|
6510
|
+
claim(id, upn, opts) {
|
|
6511
|
+
return locked(async () => {
|
|
6512
|
+
const file = await readFile(filePath);
|
|
6513
|
+
const user = file.users.find((u) => u.id === id);
|
|
6514
|
+
if (!user) return null;
|
|
6515
|
+
const key = norm(upn);
|
|
6516
|
+
if (!user.claimedByUpn || opts?.replace && user.claimedByUpn !== key) {
|
|
6517
|
+
user.claimedByUpn = key;
|
|
6518
|
+
await writeFile$1(filePath, file);
|
|
6519
|
+
}
|
|
6520
|
+
return user.claimedByUpn;
|
|
6521
|
+
});
|
|
6522
|
+
},
|
|
6676
6523
|
rebindUpn(id, upn) {
|
|
6677
6524
|
return locked(async () => {
|
|
6678
6525
|
const file = await readFile(filePath);
|
|
6679
6526
|
const key = norm(upn);
|
|
6680
6527
|
const user = file.users.find((u) => u.id === id);
|
|
6681
|
-
if (!user || user.upn === key) return;
|
|
6528
|
+
if (!user || user.upn === key && user.claimedByUpn === key) return;
|
|
6682
6529
|
if (file.users.some((u) => u.id !== id && u.upn === key)) return;
|
|
6683
6530
|
user.upn = key;
|
|
6531
|
+
user.claimedByUpn = key;
|
|
6684
6532
|
await writeFile$1(filePath, file);
|
|
6685
6533
|
});
|
|
6686
6534
|
},
|
|
@@ -6744,6 +6592,8 @@ var HeaderProxyAuth = class {
|
|
|
6744
6592
|
bootstrapPolicy;
|
|
6745
6593
|
missingHeadersWarned = false;
|
|
6746
6594
|
duplicateUpnWarned = false;
|
|
6595
|
+
duplicateEmailWarned = false;
|
|
6596
|
+
claimWriteWarned = false;
|
|
6747
6597
|
constructor(users, headers, bootstrapPolicy, logger = new NoopLogger()) {
|
|
6748
6598
|
this.users = users;
|
|
6749
6599
|
this.headers = headers;
|
|
@@ -6769,6 +6619,43 @@ var HeaderProxyAuth = class {
|
|
|
6769
6619
|
hasNoIdentityHeaders(headers) {
|
|
6770
6620
|
return !headers.get(this.headers.upn) && !headers.get(this.headers.email) && !headers.get(this.headers.displayName);
|
|
6771
6621
|
}
|
|
6622
|
+
/**
|
|
6623
|
+
* The email header, or undefined when it carries more than one value. Email
|
|
6624
|
+
* can select a row through the fallback, so a joined value (a proxy appending
|
|
6625
|
+
* its copy to the client's) is the same spoofing signal as on the UPN.
|
|
6626
|
+
*/
|
|
6627
|
+
singleValuedEmail(headers) {
|
|
6628
|
+
const email = headers.get(this.headers.email)?.trim() || void 0;
|
|
6629
|
+
if (!email?.includes(",")) return email;
|
|
6630
|
+
if (!this.duplicateEmailWarned) {
|
|
6631
|
+
this.duplicateEmailWarned = true;
|
|
6632
|
+
this.logger.warn("Multiple values arrived in the email identity header on one request. The forward-auth proxy is not stripping client-supplied copies of the trusted headers. Ignoring the email header. Strip the configured headers at site scope, above forward_auth — see the @selvajs/header-auth-provider README.", {
|
|
6633
|
+
component: "HeaderAuth",
|
|
6634
|
+
header: this.headers.email
|
|
6635
|
+
});
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
/**
|
|
6639
|
+
* Claims the row, or returns null when the allowlist can't be written. A failed
|
|
6640
|
+
* claim must not fail the sign-in: that would lock every unclaimed user out of
|
|
6641
|
+
* a deployment whose allowlist is read-only or has the wrong owner. The row
|
|
6642
|
+
* then stays unclaimed, and the email fallback still admits any UPN to it.
|
|
6643
|
+
*/
|
|
6644
|
+
async tryClaim(id, upn, replace) {
|
|
6645
|
+
try {
|
|
6646
|
+
return await this.users.claim(id, upn, { replace });
|
|
6647
|
+
} catch (err) {
|
|
6648
|
+
if (!this.claimWriteWarned) {
|
|
6649
|
+
this.claimWriteWarned = true;
|
|
6650
|
+
this.logger.warn("Could not record which UPN signed in to an allowlisted user: the allowlist file is not writable. Sign-in continues, but until it is writable the email header can still select any user whose UPN is an address.", {
|
|
6651
|
+
component: "HeaderAuth",
|
|
6652
|
+
userId: id,
|
|
6653
|
+
code: err.code
|
|
6654
|
+
});
|
|
6655
|
+
}
|
|
6656
|
+
return null;
|
|
6657
|
+
}
|
|
6658
|
+
}
|
|
6772
6659
|
async identifyFromHeaders(headers) {
|
|
6773
6660
|
const upn = headers.get(this.headers.upn);
|
|
6774
6661
|
if (!upn || !upn.trim()) {
|
|
@@ -6795,9 +6682,10 @@ var HeaderProxyAuth = class {
|
|
|
6795
6682
|
}
|
|
6796
6683
|
return null;
|
|
6797
6684
|
}
|
|
6798
|
-
const email =
|
|
6685
|
+
const email = this.singleValuedEmail(headers);
|
|
6799
6686
|
const displayName = headers.get(this.headers.displayName)?.trim() || void 0;
|
|
6800
6687
|
let entry = await this.users.findByUpn(upn);
|
|
6688
|
+
let matchedByUpn = entry !== null;
|
|
6801
6689
|
if (!entry && email) {
|
|
6802
6690
|
const byEmail = await this.users.findByEmail(email);
|
|
6803
6691
|
if (byEmail) entry = byEmail;
|
|
@@ -6806,13 +6694,26 @@ var HeaderProxyAuth = class {
|
|
|
6806
6694
|
if (await this.bootstrapPolicy({
|
|
6807
6695
|
upn,
|
|
6808
6696
|
email
|
|
6809
|
-
}))
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6697
|
+
})) {
|
|
6698
|
+
try {
|
|
6699
|
+
entry = await this.users.createUser(upn);
|
|
6700
|
+
} catch {
|
|
6701
|
+
entry = await this.users.findByUpn(upn);
|
|
6702
|
+
}
|
|
6703
|
+
matchedByUpn = entry !== null;
|
|
6813
6704
|
}
|
|
6814
6705
|
}
|
|
6815
6706
|
if (!entry || entry.disabled) return null;
|
|
6707
|
+
const presented = upn.trim().toLowerCase();
|
|
6708
|
+
let claimant = entry.claimedByUpn;
|
|
6709
|
+
if (!claimant || matchedByUpn && claimant !== presented) claimant = await this.tryClaim(entry.id, upn, matchedByUpn) ?? void 0;
|
|
6710
|
+
if (claimant && claimant !== presented) {
|
|
6711
|
+
this.logger.warn("Refused a sign-in to an allowlisted user already claimed by a different UPN. If that user's UPN changed in the directory, set upn on their row in the allowlist file to the new one; their next sign-in claims it.", {
|
|
6712
|
+
component: "HeaderAuth",
|
|
6713
|
+
userId: entry.id
|
|
6714
|
+
});
|
|
6715
|
+
return null;
|
|
6716
|
+
}
|
|
6816
6717
|
if (email && entry.email !== email || displayName && entry.displayName !== displayName) {
|
|
6817
6718
|
await this.users.syncFromHeaders(entry.id, {
|
|
6818
6719
|
email,
|