@wvkit/skevdb 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -0
- package/bin/aldb.js +58 -0
- package/build/client/_app/immutable/assets/0.4921WYCN.css +2 -0
- package/build/client/_app/immutable/assets/0.4921WYCN.css.br +0 -0
- package/build/client/_app/immutable/assets/0.4921WYCN.css.gz +0 -0
- package/build/client/_app/immutable/assets/codicon.ngg6Pgfi.ttf +0 -0
- package/build/client/_app/immutable/assets/editor.DV6jjE6F.css +1 -0
- package/build/client/_app/immutable/assets/editor.DV6jjE6F.css.br +0 -0
- package/build/client/_app/immutable/assets/editor.DV6jjE6F.css.gz +0 -0
- package/build/client/_app/immutable/assets/geist-cyrillic-ext-wght-normal.DjL33-gN.woff2 +0 -0
- package/build/client/_app/immutable/assets/geist-cyrillic-wght-normal.BEAKL7Jp.woff2 +0 -0
- package/build/client/_app/immutable/assets/geist-latin-ext-wght-normal.DC-KSUi6.woff2 +0 -0
- package/build/client/_app/immutable/assets/geist-latin-wght-normal.BgDaEnEv.woff2 +0 -0
- package/build/client/_app/immutable/assets/geist-vietnamese-wght-normal.6IgcOCM7.woff2 +0 -0
- package/build/client/_app/immutable/assets/inter-cyrillic-ext-wght-normal.BOeWTOD4.woff2 +0 -0
- package/build/client/_app/immutable/assets/inter-cyrillic-wght-normal.DqGufNeO.woff2 +0 -0
- package/build/client/_app/immutable/assets/inter-greek-ext-wght-normal.DlzME5K_.woff2 +0 -0
- package/build/client/_app/immutable/assets/inter-greek-wght-normal.CkhJZR-_.woff2 +0 -0
- package/build/client/_app/immutable/assets/inter-latin-ext-wght-normal.DO1Apj_S.woff2 +0 -0
- package/build/client/_app/immutable/assets/inter-latin-wght-normal.Dx4kXJAl.woff2 +0 -0
- package/build/client/_app/immutable/assets/inter-vietnamese-wght-normal.CBcvBZtf.woff2 +0 -0
- package/build/client/_app/immutable/assets/noto-sans-cyrillic-ext-wght-normal.DSNfmdVt.woff2 +0 -0
- package/build/client/_app/immutable/assets/noto-sans-cyrillic-wght-normal.B2hlT84T.woff2 +0 -0
- package/build/client/_app/immutable/assets/noto-sans-devanagari-wght-normal.Cv-Vwajv.woff2 +0 -0
- package/build/client/_app/immutable/assets/noto-sans-greek-ext-wght-normal.12T8GTDR.woff2 +0 -0
- package/build/client/_app/immutable/assets/noto-sans-greek-wght-normal.Ymb6dZNd.woff2 +0 -0
- package/build/client/_app/immutable/assets/noto-sans-latin-ext-wght-normal.W1qJv59z.woff2 +0 -0
- package/build/client/_app/immutable/assets/noto-sans-latin-wght-normal.BYSzYMf3.woff2 +0 -0
- package/build/client/_app/immutable/assets/noto-sans-vietnamese-wght-normal.DLTJy58D.woff2 +0 -0
- package/build/client/_app/immutable/assets/sql.FmGBn3YN.css +1 -0
- package/build/client/_app/immutable/assets/sql.FmGBn3YN.css.br +0 -0
- package/build/client/_app/immutable/assets/sql.FmGBn3YN.css.gz +0 -0
- package/build/client/_app/immutable/chunks/-u0aF6D6.js +1 -0
- package/build/client/_app/immutable/chunks/-u0aF6D6.js.br +2 -0
- package/build/client/_app/immutable/chunks/-u0aF6D6.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BZYon8uW.js +1 -0
- package/build/client/_app/immutable/chunks/BZYon8uW.js.br +0 -0
- package/build/client/_app/immutable/chunks/BZYon8uW.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CT_ExraQ.js +820 -0
- package/build/client/_app/immutable/chunks/CT_ExraQ.js.br +0 -0
- package/build/client/_app/immutable/chunks/CT_ExraQ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CUXBnqxM.js +53 -0
- package/build/client/_app/immutable/chunks/CUXBnqxM.js.br +0 -0
- package/build/client/_app/immutable/chunks/CUXBnqxM.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CqQuHtWb.js +1 -0
- package/build/client/_app/immutable/chunks/CqQuHtWb.js.br +0 -0
- package/build/client/_app/immutable/chunks/CqQuHtWb.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DDJ7Hsqn.js +1 -0
- package/build/client/_app/immutable/chunks/DDJ7Hsqn.js.br +0 -0
- package/build/client/_app/immutable/chunks/DDJ7Hsqn.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D_beq-47.js +3 -0
- package/build/client/_app/immutable/chunks/D_beq-47.js.br +0 -0
- package/build/client/_app/immutable/chunks/D_beq-47.js.gz +0 -0
- package/build/client/_app/immutable/chunks/NEE52Syq.js +1 -0
- package/build/client/_app/immutable/chunks/NEE52Syq.js.br +0 -0
- package/build/client/_app/immutable/chunks/NEE52Syq.js.gz +0 -0
- package/build/client/_app/immutable/chunks/h8jGUf5s.js +1 -0
- package/build/client/_app/immutable/chunks/h8jGUf5s.js.br +0 -0
- package/build/client/_app/immutable/chunks/h8jGUf5s.js.gz +0 -0
- package/build/client/_app/immutable/chunks/kNaey6uv.js +1 -0
- package/build/client/_app/immutable/chunks/kNaey6uv.js.br +0 -0
- package/build/client/_app/immutable/chunks/kNaey6uv.js.gz +0 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.DmcKZPoo.js +2 -0
- package/build/client/_app/immutable/entry/app.DmcKZPoo.js.br +0 -0
- package/build/client/_app/immutable/entry/app.DmcKZPoo.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.AWD7U8zX.js +1 -0
- package/build/client/_app/immutable/entry/start.AWD7U8zX.js.br +1 -0
- package/build/client/_app/immutable/entry/start.AWD7U8zX.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.D42BAFic.js +46 -0
- package/build/client/_app/immutable/nodes/0.D42BAFic.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.D42BAFic.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.EnR_repC.js +1 -0
- package/build/client/_app/immutable/nodes/1.EnR_repC.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.EnR_repC.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.Daii4oR8.js +1 -0
- package/build/client/_app/immutable/nodes/2.Daii4oR8.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.Daii4oR8.js.gz +0 -0
- package/build/client/_app/immutable/workers/editor.worker-Cn2oRESe.js +26 -0
- package/build/client/_app/immutable/workers/editor.worker-Cn2oRESe.js.br +0 -0
- package/build/client/_app/immutable/workers/editor.worker-Cn2oRESe.js.gz +0 -0
- package/build/client/_app/version.json +1 -0
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/client/robots.txt +3 -0
- package/build/client/robots.txt.br +0 -0
- package/build/client/robots.txt.gz +0 -0
- package/build/env.js +94 -0
- package/build/handler.js +1494 -0
- package/build/index.js +345 -0
- package/build/server/chunks/0-2tF2h-sW.js +13 -0
- package/build/server/chunks/0-2tF2h-sW.js.map +1 -0
- package/build/server/chunks/1-uqT1he7Y.js +9 -0
- package/build/server/chunks/1-uqT1he7Y.js.map +1 -0
- package/build/server/chunks/2-WinpGkOi.js +9 -0
- package/build/server/chunks/2-WinpGkOi.js.map +1 -0
- package/build/server/chunks/_layout.svelte-BO0NOSiE.js +43521 -0
- package/build/server/chunks/_layout.svelte-BO0NOSiE.js.map +1 -0
- package/build/server/chunks/_page.svelte-BP2EdQl3.js +5 -0
- package/build/server/chunks/_page.svelte-BP2EdQl3.js.map +1 -0
- package/build/server/chunks/_server.ts-6mqhv5WM.js +30 -0
- package/build/server/chunks/_server.ts-6mqhv5WM.js.map +1 -0
- package/build/server/chunks/_server.ts-B7evxvHU.js +61 -0
- package/build/server/chunks/_server.ts-B7evxvHU.js.map +1 -0
- package/build/server/chunks/_server.ts-BN5QAzfI.js +89 -0
- package/build/server/chunks/_server.ts-BN5QAzfI.js.map +1 -0
- package/build/server/chunks/_server.ts-BWe0PPhA.js +26 -0
- package/build/server/chunks/_server.ts-BWe0PPhA.js.map +1 -0
- package/build/server/chunks/_server.ts-BgrwjIyE.js +84 -0
- package/build/server/chunks/_server.ts-BgrwjIyE.js.map +1 -0
- package/build/server/chunks/_server.ts-CFzBDuF1.js +52 -0
- package/build/server/chunks/_server.ts-CFzBDuF1.js.map +1 -0
- package/build/server/chunks/_server.ts-CHBba1cE.js +55 -0
- package/build/server/chunks/_server.ts-CHBba1cE.js.map +1 -0
- package/build/server/chunks/_server.ts-ChxeqJr9.js +23 -0
- package/build/server/chunks/_server.ts-ChxeqJr9.js.map +1 -0
- package/build/server/chunks/_server.ts-Cq27_8sR.js +40 -0
- package/build/server/chunks/_server.ts-Cq27_8sR.js.map +1 -0
- package/build/server/chunks/_server.ts-DGK-tW9e.js +26 -0
- package/build/server/chunks/_server.ts-DGK-tW9e.js.map +1 -0
- package/build/server/chunks/_server.ts-DNbiBQKI.js +107 -0
- package/build/server/chunks/_server.ts-DNbiBQKI.js.map +1 -0
- package/build/server/chunks/_server.ts-LPl3rTE2.js +42 -0
- package/build/server/chunks/_server.ts-LPl3rTE2.js.map +1 -0
- package/build/server/chunks/_server.ts-WS7E0dC9.js +20 -0
- package/build/server/chunks/_server.ts-WS7E0dC9.js.map +1 -0
- package/build/server/chunks/_server.ts-o5h153l6.js +22 -0
- package/build/server/chunks/_server.ts-o5h153l6.js.map +1 -0
- package/build/server/chunks/error.svelte-WWFmDYfs.js +77 -0
- package/build/server/chunks/error.svelte-WWFmDYfs.js.map +1 -0
- package/build/server/chunks/index-DBqjc0Yf.js +77 -0
- package/build/server/chunks/index-DBqjc0Yf.js.map +1 -0
- package/build/server/chunks/index-Dq7YP_jO.js +134 -0
- package/build/server/chunks/index-Dq7YP_jO.js.map +1 -0
- package/build/server/chunks/internal2-R0fapQ2T.js +1164 -0
- package/build/server/chunks/internal2-R0fapQ2T.js.map +1 -0
- package/build/server/chunks/legacy-client-DEBQKXfT.js +5174 -0
- package/build/server/chunks/legacy-client-DEBQKXfT.js.map +1 -0
- package/build/server/chunks/mysql-DX3ct8Wa.js +74 -0
- package/build/server/chunks/mysql-DX3ct8Wa.js.map +1 -0
- package/build/server/chunks/plantuml-BT_hcRqZ.js +32 -0
- package/build/server/chunks/plantuml-BT_hcRqZ.js.map +1 -0
- package/build/server/chunks/shared-server-DkccXZBX.js +22 -0
- package/build/server/chunks/shared-server-DkccXZBX.js.map +1 -0
- package/build/server/index.js +4421 -0
- package/build/server/index.js.map +1 -0
- package/build/server/manifest.js +144 -0
- package/build/server/manifest.js.map +1 -0
- package/build/shims.js +32 -0
- package/package.json +61 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { n as normalizeConfig } from './mysql-DX3ct8Wa.js';
|
|
2
|
+
import { j as json } from './index-Dq7YP_jO.js';
|
|
3
|
+
import { mkdir, writeFile, readFile } from 'node:fs/promises';
|
|
4
|
+
import { join, dirname } from 'node:path';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import 'mysql2/promise';
|
|
7
|
+
import './index-DBqjc0Yf.js';
|
|
8
|
+
|
|
9
|
+
//#region src/lib/server/connections.ts
|
|
10
|
+
var connectionsPath = join(homedir(), ".aldb", "connections.json");
|
|
11
|
+
function normalizeConnectionType(value) {
|
|
12
|
+
if (value === "postgresql" || value === "redis" || value === "mysql") return value;
|
|
13
|
+
return "mysql";
|
|
14
|
+
}
|
|
15
|
+
function createId(connection, type) {
|
|
16
|
+
return `${type}:${connection.user}@${connection.host}:${connection.port}`;
|
|
17
|
+
}
|
|
18
|
+
function createName(connection, type) {
|
|
19
|
+
return `${type} ${connection.user}@${connection.host}:${connection.port}`;
|
|
20
|
+
}
|
|
21
|
+
async function readConnections() {
|
|
22
|
+
try {
|
|
23
|
+
const raw = await readFile(connectionsPath, "utf8");
|
|
24
|
+
const parsed = JSON.parse(raw);
|
|
25
|
+
if (!Array.isArray(parsed.connections)) return [];
|
|
26
|
+
return parsed.connections.map((connection) => {
|
|
27
|
+
const config = normalizeConfig(connection);
|
|
28
|
+
const type = normalizeConnectionType(connection.type);
|
|
29
|
+
const id = String(connection.id || createId(config, type));
|
|
30
|
+
const name = String(connection.name || createName(config, type));
|
|
31
|
+
const updatedAt = String(connection.updatedAt || (/* @__PURE__ */ new Date()).toISOString());
|
|
32
|
+
return {
|
|
33
|
+
...config,
|
|
34
|
+
id,
|
|
35
|
+
name,
|
|
36
|
+
type,
|
|
37
|
+
updatedAt
|
|
38
|
+
};
|
|
39
|
+
}).sort((left, right) => right.updatedAt.localeCompare(left.updatedAt));
|
|
40
|
+
} catch (error) {
|
|
41
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") return [];
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function saveConnection(value) {
|
|
46
|
+
if (!value || typeof value !== "object") throw new Error("Faltan datos de conexion");
|
|
47
|
+
const source = value;
|
|
48
|
+
const config = normalizeConfig(source);
|
|
49
|
+
const type = normalizeConnectionType(source.type);
|
|
50
|
+
const existing = await readConnections();
|
|
51
|
+
const id = (typeof source.id === "string" ? source.id.trim() : "") || crypto.randomUUID();
|
|
52
|
+
const name = String(source.name || createName(config, type)).trim() || createName(config, type);
|
|
53
|
+
const next = [{
|
|
54
|
+
...config,
|
|
55
|
+
id,
|
|
56
|
+
name,
|
|
57
|
+
type,
|
|
58
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
59
|
+
}, ...existing.filter((connection) => connection.id !== id)];
|
|
60
|
+
await mkdir(dirname(connectionsPath), { recursive: true });
|
|
61
|
+
await writeFile(connectionsPath, `${JSON.stringify({ connections: next }, null, 2)}\n`, "utf8");
|
|
62
|
+
return next;
|
|
63
|
+
}
|
|
64
|
+
async function deleteConnection(id) {
|
|
65
|
+
const next = (await readConnections()).filter((connection) => connection.id !== id);
|
|
66
|
+
await mkdir(dirname(connectionsPath), { recursive: true });
|
|
67
|
+
await writeFile(connectionsPath, `${JSON.stringify({ connections: next }, null, 2)}\n`, "utf8");
|
|
68
|
+
return next;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/routes/api/connections/+server.ts
|
|
72
|
+
var GET = async () => {
|
|
73
|
+
try {
|
|
74
|
+
return json({
|
|
75
|
+
connections: await readConnections(),
|
|
76
|
+
path: connectionsPath
|
|
77
|
+
});
|
|
78
|
+
} catch (error) {
|
|
79
|
+
return json({ message: error instanceof Error ? error.message : "No se pudieron leer las conexiones" }, { status: 400 });
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var POST = async ({ request }) => {
|
|
83
|
+
try {
|
|
84
|
+
return json({
|
|
85
|
+
connections: await saveConnection((await request.json()).connection),
|
|
86
|
+
path: connectionsPath
|
|
87
|
+
});
|
|
88
|
+
} catch (error) {
|
|
89
|
+
return json({ message: error instanceof Error ? error.message : "No se pudo guardar la conexion" }, { status: 400 });
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
var DELETE = async ({ request }) => {
|
|
93
|
+
try {
|
|
94
|
+
const body = await request.json();
|
|
95
|
+
const id = String(body.id ?? "").trim();
|
|
96
|
+
if (!id) throw new Error("Selecciona una conexion");
|
|
97
|
+
return json({
|
|
98
|
+
connections: await deleteConnection(id),
|
|
99
|
+
path: connectionsPath
|
|
100
|
+
});
|
|
101
|
+
} catch (error) {
|
|
102
|
+
return json({ message: error instanceof Error ? error.message : "No se pudo eliminar la conexion" }, { status: 400 });
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export { DELETE, GET, POST };
|
|
107
|
+
//# sourceMappingURL=_server.ts-DNbiBQKI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_server.ts-DNbiBQKI.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/connections/_server.ts.js"],"sourcesContent":["import { r as normalizeConfig } from \"../../../../chunks/mysql.js\";\nimport { json } from \"@sveltejs/kit\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { homedir } from \"node:os\";\n//#region src/lib/server/connections.ts\nvar connectionsPath = join(homedir(), \".aldb\", \"connections.json\");\nfunction normalizeConnectionType(value) {\n\tif (value === \"postgresql\" || value === \"redis\" || value === \"mysql\") return value;\n\treturn \"mysql\";\n}\nfunction createId(connection, type) {\n\treturn `${type}:${connection.user}@${connection.host}:${connection.port}`;\n}\nfunction createName(connection, type) {\n\treturn `${type} ${connection.user}@${connection.host}:${connection.port}`;\n}\nasync function readConnections() {\n\ttry {\n\t\tconst raw = await readFile(connectionsPath, \"utf8\");\n\t\tconst parsed = JSON.parse(raw);\n\t\tif (!Array.isArray(parsed.connections)) return [];\n\t\treturn parsed.connections.map((connection) => {\n\t\t\tconst config = normalizeConfig(connection);\n\t\t\tconst type = normalizeConnectionType(connection.type);\n\t\t\tconst id = String(connection.id || createId(config, type));\n\t\t\tconst name = String(connection.name || createName(config, type));\n\t\t\tconst updatedAt = String(connection.updatedAt || (/* @__PURE__ */ new Date()).toISOString());\n\t\t\treturn {\n\t\t\t\t...config,\n\t\t\t\tid,\n\t\t\t\tname,\n\t\t\t\ttype,\n\t\t\t\tupdatedAt\n\t\t\t};\n\t\t}).sort((left, right) => right.updatedAt.localeCompare(left.updatedAt));\n\t} catch (error) {\n\t\tif (error && typeof error === \"object\" && \"code\" in error && error.code === \"ENOENT\") return [];\n\t\tthrow error;\n\t}\n}\nasync function saveConnection(value) {\n\tif (!value || typeof value !== \"object\") throw new Error(\"Faltan datos de conexion\");\n\tconst source = value;\n\tconst config = normalizeConfig(source);\n\tconst type = normalizeConnectionType(source.type);\n\tconst existing = await readConnections();\n\tconst id = (typeof source.id === \"string\" ? source.id.trim() : \"\") || crypto.randomUUID();\n\tconst name = String(source.name || createName(config, type)).trim() || createName(config, type);\n\tconst next = [{\n\t\t...config,\n\t\tid,\n\t\tname,\n\t\ttype,\n\t\tupdatedAt: (/* @__PURE__ */ new Date()).toISOString()\n\t}, ...existing.filter((connection) => connection.id !== id)];\n\tawait mkdir(dirname(connectionsPath), { recursive: true });\n\tawait writeFile(connectionsPath, `${JSON.stringify({ connections: next }, null, 2)}\\n`, \"utf8\");\n\treturn next;\n}\nasync function deleteConnection(id) {\n\tconst next = (await readConnections()).filter((connection) => connection.id !== id);\n\tawait mkdir(dirname(connectionsPath), { recursive: true });\n\tawait writeFile(connectionsPath, `${JSON.stringify({ connections: next }, null, 2)}\\n`, \"utf8\");\n\treturn next;\n}\n//#endregion\n//#region src/routes/api/connections/+server.ts\nvar GET = async () => {\n\ttry {\n\t\treturn json({\n\t\t\tconnections: await readConnections(),\n\t\t\tpath: connectionsPath\n\t\t});\n\t} catch (error) {\n\t\treturn json({ message: error instanceof Error ? error.message : \"No se pudieron leer las conexiones\" }, { status: 400 });\n\t}\n};\nvar POST = async ({ request }) => {\n\ttry {\n\t\treturn json({\n\t\t\tconnections: await saveConnection((await request.json()).connection),\n\t\t\tpath: connectionsPath\n\t\t});\n\t} catch (error) {\n\t\treturn json({ message: error instanceof Error ? error.message : \"No se pudo guardar la conexion\" }, { status: 400 });\n\t}\n};\nvar DELETE = async ({ request }) => {\n\ttry {\n\t\tconst body = await request.json();\n\t\tconst id = String(body.id ?? \"\").trim();\n\t\tif (!id) throw new Error(\"Selecciona una conexion\");\n\t\treturn json({\n\t\t\tconnections: await deleteConnection(id),\n\t\t\tpath: connectionsPath\n\t\t});\n\t} catch (error) {\n\t\treturn json({ message: error instanceof Error ? error.message : \"No se pudo eliminar la conexion\" }, { status: 400 });\n\t}\n};\n//#endregion\nexport { DELETE, GET, POST };\n"],"names":[],"mappings":";;;;;;;;AAKA;AACA,IAAI,eAAe,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,kBAAkB,CAAC;AAClE,SAAS,uBAAuB,CAAC,KAAK,EAAE;AACxC,CAAC,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,OAAO,EAAE,OAAO,KAAK;AACnF,CAAC,OAAO,OAAO;AACf;AACA,SAAS,QAA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eConfig, w as withConnection, q as quoteIdentifier } from './mysql-DX3ct8Wa.js';
|
|
2
|
+
import { j as json } from './index-Dq7YP_jO.js';
|
|
3
|
+
import 'mysql2/promise';
|
|
4
|
+
import './index-DBqjc0Yf.js';
|
|
5
|
+
|
|
6
|
+
//#region src/routes/api/mysql/tables/+server.ts
|
|
7
|
+
var POST = async ({ request }) => {
|
|
8
|
+
try {
|
|
9
|
+
const body = await request.json();
|
|
10
|
+
const config = normalizeConfig(body.config);
|
|
11
|
+
const database = String(body.database ?? "").trim();
|
|
12
|
+
if (!database) throw new Error("Selecciona una base de datos");
|
|
13
|
+
return json({ tables: await withConnection(config, database, async (connection) => {
|
|
14
|
+
const [rows] = await connection.query("SHOW FULL TABLES WHERE Table_type = \"BASE TABLE\"");
|
|
15
|
+
return rows.map((row) => Object.values(row)[0]).filter((name) => typeof name === "string");
|
|
16
|
+
}) });
|
|
17
|
+
} catch (error) {
|
|
18
|
+
return json({ message: error instanceof Error ? error.message : "No se pudieron cargar las tablas" }, { status: 400 });
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var PUT = async ({ request }) => {
|
|
22
|
+
try {
|
|
23
|
+
const body = await request.json();
|
|
24
|
+
const config = normalizeConfig(body.config);
|
|
25
|
+
const database = String(body.database ?? "").trim();
|
|
26
|
+
const table = String(body.table ?? "").trim();
|
|
27
|
+
const columnsSql = String(body.columnsSql ?? "`id` INT AUTO_INCREMENT PRIMARY KEY").trim();
|
|
28
|
+
if (!database) throw new Error("Selecciona una base de datos");
|
|
29
|
+
if (!table) throw new Error("El nombre de la tabla es obligatorio");
|
|
30
|
+
if (!columnsSql) throw new Error("Agrega al menos una columna");
|
|
31
|
+
if (columnsSql.includes(";")) throw new Error("La definicion de columnas no debe incluir punto y coma");
|
|
32
|
+
await withConnection(config, database, async (connection) => {
|
|
33
|
+
await connection.query(`CREATE TABLE ${quoteIdentifier(table)} (${columnsSql})`);
|
|
34
|
+
});
|
|
35
|
+
return json({ ok: true });
|
|
36
|
+
} catch (error) {
|
|
37
|
+
return json({ message: error instanceof Error ? error.message : "No se pudo crear la tabla" }, { status: 400 });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { POST, PUT };
|
|
42
|
+
//# sourceMappingURL=_server.ts-LPl3rTE2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_server.ts-LPl3rTE2.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/mysql/tables/_server.ts.js"],"sourcesContent":["import { a as quoteIdentifier, o as withConnection, r as normalizeConfig } from \"../../../../../chunks/mysql.js\";\nimport { json } from \"@sveltejs/kit\";\n//#region src/routes/api/mysql/tables/+server.ts\nvar POST = async ({ request }) => {\n\ttry {\n\t\tconst body = await request.json();\n\t\tconst config = normalizeConfig(body.config);\n\t\tconst database = String(body.database ?? \"\").trim();\n\t\tif (!database) throw new Error(\"Selecciona una base de datos\");\n\t\treturn json({ tables: await withConnection(config, database, async (connection) => {\n\t\t\tconst [rows] = await connection.query(\"SHOW FULL TABLES WHERE Table_type = \\\"BASE TABLE\\\"\");\n\t\t\treturn rows.map((row) => Object.values(row)[0]).filter((name) => typeof name === \"string\");\n\t\t}) });\n\t} catch (error) {\n\t\treturn json({ message: error instanceof Error ? error.message : \"No se pudieron cargar las tablas\" }, { status: 400 });\n\t}\n};\nvar PUT = async ({ request }) => {\n\ttry {\n\t\tconst body = await request.json();\n\t\tconst config = normalizeConfig(body.config);\n\t\tconst database = String(body.database ?? \"\").trim();\n\t\tconst table = String(body.table ?? \"\").trim();\n\t\tconst columnsSql = String(body.columnsSql ?? \"`id` INT AUTO_INCREMENT PRIMARY KEY\").trim();\n\t\tif (!database) throw new Error(\"Selecciona una base de datos\");\n\t\tif (!table) throw new Error(\"El nombre de la tabla es obligatorio\");\n\t\tif (!columnsSql) throw new Error(\"Agrega al menos una columna\");\n\t\tif (columnsSql.includes(\";\")) throw new Error(\"La definicion de columnas no debe incluir punto y coma\");\n\t\tawait withConnection(config, database, async (connection) => {\n\t\t\tawait connection.query(`CREATE TABLE ${quoteIdentifier(table)} (${columnsSql})`);\n\t\t});\n\t\treturn json({ ok: true });\n\t} catch (error) {\n\t\treturn json({ message: error instanceof Error ? error.message : \"No se pudo crear la tabla\" }, { status: 400 });\n\t}\n};\n//#endregion\nexport { POST, PUT };\n"],"names":[],"mappings":";;;;;AAEA;AACG,IAAC,IAAI,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK;AAClC,CAAC,IAAI;AACL,EAAE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE;AACnC,EAAE,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC;AAC7C,EAAE,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;AACrD,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC;AAChE,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,UAAU,KAAK;AACrF,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,oDAAoD,CAAC;AAC9F,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,QAAQ,CAAC;AAC7F,EAAE,CAAC,CAAC,EAAE,CAAC;AACP,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE;AACjB,EAAE,OAAO,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,kCAAkC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC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AAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,2BAA2B,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACjH,CAAC;AACD;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { r as renderPlantUmlSvg } from './plantuml-BT_hcRqZ.js';
|
|
2
|
+
import { j as json } from './index-Dq7YP_jO.js';
|
|
3
|
+
import './shared-server-DkccXZBX.js';
|
|
4
|
+
import 'node:zlib';
|
|
5
|
+
import './index-DBqjc0Yf.js';
|
|
6
|
+
|
|
7
|
+
//#region src/routes/api/plantuml/render/+server.ts
|
|
8
|
+
var POST = async ({ request }) => {
|
|
9
|
+
try {
|
|
10
|
+
const body = await request.json();
|
|
11
|
+
const source = String(body.source ?? "").trim();
|
|
12
|
+
if (!source) throw new Error("Escribe PlantUML para renderizar");
|
|
13
|
+
return json({ svg: await renderPlantUmlSvg(source) });
|
|
14
|
+
} catch (error) {
|
|
15
|
+
return json({ message: error instanceof Error ? error.message : "No se pudo renderizar PlantUML" }, { status: 400 });
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { POST };
|
|
20
|
+
//# sourceMappingURL=_server.ts-WS7E0dC9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_server.ts-WS7E0dC9.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/plantuml/render/_server.ts.js"],"sourcesContent":["import { t as renderPlantUmlSvg } from \"../../../../../chunks/plantuml.js\";\nimport { json } from \"@sveltejs/kit\";\n//#region src/routes/api/plantuml/render/+server.ts\nvar POST = async ({ request }) => {\n\ttry {\n\t\tconst body = await request.json();\n\t\tconst source = String(body.source ?? \"\").trim();\n\t\tif (!source) throw new Error(\"Escribe PlantUML para renderizar\");\n\t\treturn json({ svg: await renderPlantUmlSvg(source) });\n\t} catch (error) {\n\t\treturn json({ message: error instanceof Error ? error.message : \"No se pudo renderizar PlantUML\" }, { status: 400 });\n\t}\n};\n//#endregion\nexport { POST };\n"],"names":[],"mappings":";;;;;;AAEA;AACG,IAAC,IAAI,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK;AAClC,CAAC,IAAI;AACL,EAAE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE;AACnC,EAAE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;AACjD,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC;AAClE,EAAE,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;AACvD,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE;AACjB,EAAE,OAAO,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,gCAAgC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACtH,CAAC;AACD;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as normalizeConfig, g as getColumns } from './mysql-DX3ct8Wa.js';
|
|
2
|
+
import { j as json } from './index-Dq7YP_jO.js';
|
|
3
|
+
import 'mysql2/promise';
|
|
4
|
+
import './index-DBqjc0Yf.js';
|
|
5
|
+
|
|
6
|
+
//#region src/routes/api/mysql/columns/+server.ts
|
|
7
|
+
var POST = async ({ request }) => {
|
|
8
|
+
try {
|
|
9
|
+
const body = await request.json();
|
|
10
|
+
const config = normalizeConfig(body.config);
|
|
11
|
+
const database = String(body.database ?? "").trim();
|
|
12
|
+
const table = String(body.table ?? "").trim();
|
|
13
|
+
if (!database) throw new Error("Selecciona una base de datos");
|
|
14
|
+
if (!table) throw new Error("Selecciona una tabla");
|
|
15
|
+
return json({ columns: await getColumns(config, database, table) });
|
|
16
|
+
} catch (error) {
|
|
17
|
+
return json({ message: error instanceof Error ? error.message : "No se pudieron cargar los campos" }, { status: 400 });
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { POST };
|
|
22
|
+
//# sourceMappingURL=_server.ts-o5h153l6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_server.ts-o5h153l6.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/api/mysql/columns/_server.ts.js"],"sourcesContent":["import { r as normalizeConfig, t as getColumns } from \"../../../../../chunks/mysql.js\";\nimport { json } from \"@sveltejs/kit\";\n//#region src/routes/api/mysql/columns/+server.ts\nvar POST = async ({ request }) => {\n\ttry {\n\t\tconst body = await request.json();\n\t\tconst config = normalizeConfig(body.config);\n\t\tconst database = String(body.database ?? \"\").trim();\n\t\tconst table = String(body.table ?? \"\").trim();\n\t\tif (!database) throw new Error(\"Selecciona una base de datos\");\n\t\tif (!table) throw new Error(\"Selecciona una tabla\");\n\t\treturn json({ columns: await getColumns(config, database, table) });\n\t} catch (error) {\n\t\treturn json({ message: error instanceof Error ? error.message : \"No se pudieron cargar los campos\" }, { status: 400 });\n\t}\n};\n//#endregion\nexport { POST };\n"],"names":[],"mappings":";;;;;AAEA;AACG,IAAC,IAAI,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK;AAClC,CAAC,IAAI;AACL,EAAE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE;AACnC,EAAE,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC;AAC7C,EAAE,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;AACrD,EAAE,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;AAC/C,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC;AAChE,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;AACrD,EAAE,OAAO,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;AACrE,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE;AACjB,EAAE,OAAO,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,kCAAkC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACxH,CAAC;AACD;;;;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { e as escape_html, g as getContext, O as noop, Q as index_server_exports } from './legacy-client-DEBQKXfT.js';
|
|
2
|
+
import './internal2-R0fapQ2T.js';
|
|
3
|
+
import './index-DBqjc0Yf.js';
|
|
4
|
+
|
|
5
|
+
var is_legacy = noop.toString().includes("$$") || /function \w+\(\) \{\}/.test(noop.toString());
|
|
6
|
+
var placeholder_url = "a:";
|
|
7
|
+
if (is_legacy) {
|
|
8
|
+
new URL(placeholder_url);
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/client/client.js
|
|
12
|
+
/** @import { ServerNodesResponse, ServerRedirectNode } from 'types' */
|
|
13
|
+
/** @import { CacheEntry } from './remote-functions/cache.svelte.js' */
|
|
14
|
+
/** @import { Query } from './remote-functions/query/instance.svelte.js' */
|
|
15
|
+
/** @import { LiveQuery } from './remote-functions/query-live/instance.svelte.js' */
|
|
16
|
+
var { onMount, tick } = index_server_exports;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/app/state/server.js
|
|
19
|
+
function context() {
|
|
20
|
+
return getContext("__request__");
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/app/state/index.js
|
|
24
|
+
/**
|
|
25
|
+
* A read-only reactive object with information about the current page, serving several use cases:
|
|
26
|
+
* - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load))
|
|
27
|
+
* - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions))
|
|
28
|
+
* - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing))
|
|
29
|
+
* - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error
|
|
30
|
+
*
|
|
31
|
+
* ```svelte
|
|
32
|
+
* <!--- file: +layout.svelte --->
|
|
33
|
+
* <script>
|
|
34
|
+
* import { page } from '$app/state';
|
|
35
|
+
* <\/script>
|
|
36
|
+
*
|
|
37
|
+
* <p>Currently at {page.url.pathname}</p>
|
|
38
|
+
*
|
|
39
|
+
* {#if page.error}
|
|
40
|
+
* <span class="red">Problem detected</span>
|
|
41
|
+
* {:else}
|
|
42
|
+
* <span class="small">All systems operational</span>
|
|
43
|
+
* {/if}
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Changes to `page` are available exclusively with runes. (The legacy reactivity syntax will not reflect any changes)
|
|
47
|
+
*
|
|
48
|
+
* ```svelte
|
|
49
|
+
* <!--- file: +page.svelte --->
|
|
50
|
+
* <script>
|
|
51
|
+
* import { page } from '$app/state';
|
|
52
|
+
* const id = $derived(page.params.id); // This will correctly update id for usage on this page
|
|
53
|
+
* $: badId = page.params.id; // Do not use; will never update after initial load
|
|
54
|
+
* <\/script>
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* On the server, values can only be read during rendering (in other words _not_ in e.g. `load` functions). In the browser, the values can be read at any time.
|
|
58
|
+
*
|
|
59
|
+
* @type {import('@sveltejs/kit').Page}
|
|
60
|
+
*/
|
|
61
|
+
var page = {
|
|
62
|
+
get error() {
|
|
63
|
+
return context().page.error;
|
|
64
|
+
},
|
|
65
|
+
get status() {
|
|
66
|
+
return context().page.status;
|
|
67
|
+
}};
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte
|
|
70
|
+
function Error$1($$renderer, $$props) {
|
|
71
|
+
$$renderer.component(($$renderer) => {
|
|
72
|
+
$$renderer.push(`<h1>${escape_html(page.status)}</h1> <p>${escape_html(page.error?.message)}</p>`);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { Error$1 as default };
|
|
77
|
+
//# sourceMappingURL=error.svelte-WWFmDYfs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.svelte-WWFmDYfs.js","sources":["../../../.svelte-kit/adapter-node/entries/fallbacks/error.svelte.js"],"sourcesContent":["import { t as index_server_exports } from \"../../chunks/index-server.js\";\nimport { b as noop } from \"../../chunks/shared.js\";\nimport \"../../chunks/internal.js\";\nimport { B as writable, Tt as getContext, at as escape_html, yt as noop$1 } from \"../../chunks/dev.js\";\nimport \"../../chunks/exports.js\";\nimport \"../../chunks/index-server2.js\";\nimport \"../../chunks/internal2.js\";\nimport \"@sveltejs/kit/internal\";\nimport \"@sveltejs/kit/internal/server\";\nvar PRELOAD_PRIORITIES = {\n\ttap: 1,\n\thover: 2,\n\tviewport: 3,\n\teager: 4,\n\toff: -1,\n\tfalse: -1\n};\n({ ...PRELOAD_PRIORITIES }), PRELOAD_PRIORITIES.hover;\n/** @param {any} value */\nfunction notifiable_store(value) {\n\tconst store = writable(value);\n\tlet ready = true;\n\tfunction notify() {\n\t\tready = true;\n\t\tstore.update((val) => val);\n\t}\n\t/** @param {any} new_value */\n\tfunction set(new_value) {\n\t\tready = false;\n\t\tstore.set(new_value);\n\t}\n\t/** @param {(value: any) => void} run */\n\tfunction subscribe(run) {\n\t\t/** @type {any} */\n\t\tlet old_value;\n\t\treturn store.subscribe((new_value) => {\n\t\t\tif (old_value === void 0 || ready && new_value !== old_value) run(old_value = new_value);\n\t\t});\n\t}\n\treturn {\n\t\tnotify,\n\t\tset,\n\t\tsubscribe\n\t};\n}\nvar updated_listener = { v: noop };\nfunction create_updated_store() {\n\tconst { set, subscribe } = writable(false);\n\treturn {\n\t\tsubscribe,\n\t\tcheck: async () => false\n\t};\n}\nvar updated$1;\nvar is_legacy = noop$1.toString().includes(\"$$\") || /function \\w+\\(\\) \\{\\}/.test(noop$1.toString());\nvar placeholder_url = \"a:\";\nif (is_legacy) {\n\tnew URL(placeholder_url);\n\tupdated$1 = { current: false };\n} else {\n\tnew class Page {\n\t\tdata = {};\n\t\tform = null;\n\t\terror = null;\n\t\tparams = {};\n\t\troute = { id: null };\n\t\tstate = {};\n\t\tstatus = -1;\n\t\turl = new URL(placeholder_url);\n\t}();\n\tnew class Navigating {\n\t\tcurrent = null;\n\t}();\n\tupdated$1 = new class Updated {\n\t\tcurrent = false;\n\t}();\n\tupdated_listener.v = () => updated$1.current = true;\n}\n//#endregion\n//#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/client/client.js\n/** @import { ServerNodesResponse, ServerRedirectNode } from 'types' */\n/** @import { CacheEntry } from './remote-functions/cache.svelte.js' */\n/** @import { Query } from './remote-functions/query/instance.svelte.js' */\n/** @import { LiveQuery } from './remote-functions/query-live/instance.svelte.js' */\nvar { onMount, tick } = index_server_exports;\n({\n\turl: /* @__PURE__ */ notifiable_store({}),\n\tpage: /* @__PURE__ */ notifiable_store({}),\n\tnavigating: /* @__PURE__ */ writable(null),\n\tupdated: /* @__PURE__ */ create_updated_store()\n}).updated.check;\n//#endregion\n//#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/app/state/server.js\nfunction context() {\n\treturn getContext(\"__request__\");\n}\n//#endregion\n//#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/app/state/index.js\n/**\n* A read-only reactive object with information about the current page, serving several use cases:\n* - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load))\n* - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions))\n* - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing))\n* - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error\n*\n* ```svelte\n* <!--- file: +layout.svelte --->\n* <script>\n* \timport { page } from '$app/state';\n* <\\/script>\n*\n* <p>Currently at {page.url.pathname}</p>\n*\n* {#if page.error}\n* \t<span class=\"red\">Problem detected</span>\n* {:else}\n* \t<span class=\"small\">All systems operational</span>\n* {/if}\n* ```\n*\n* Changes to `page` are available exclusively with runes. (The legacy reactivity syntax will not reflect any changes)\n*\n* ```svelte\n* <!--- file: +page.svelte --->\n* <script>\n* \timport { page } from '$app/state';\n* \tconst id = $derived(page.params.id); // This will correctly update id for usage on this page\n* \t$: badId = page.params.id; // Do not use; will never update after initial load\n* <\\/script>\n* ```\n*\n* On the server, values can only be read during rendering (in other words _not_ in e.g. `load` functions). In the browser, the values can be read at any time.\n*\n* @type {import('@sveltejs/kit').Page}\n*/\nvar page = {\n\tget data() {\n\t\treturn context().page.data;\n\t},\n\tget error() {\n\t\treturn context().page.error;\n\t},\n\tget form() {\n\t\treturn context().page.form;\n\t},\n\tget params() {\n\t\treturn context().page.params;\n\t},\n\tget route() {\n\t\treturn context().page.route;\n\t},\n\tget state() {\n\t\treturn context().page.state;\n\t},\n\tget status() {\n\t\treturn context().page.status;\n\t},\n\tget url() {\n\t\treturn context().page.url;\n\t}\n};\n//#endregion\n//#region node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte\nfunction Error$1($$renderer, $$props) {\n\t$$renderer.component(($$renderer) => {\n\t\t$$renderer.push(`<h1>${escape_html(page.status)}</h1> <p>${escape_html(page.error?.message)}</p>`);\n\t});\n}\n//#endregion\nexport { Error$1 as default };\n"],"names":["noop$1"],"mappings":";;;;AAsDA,IAAI,SAAS,GAAGA,IAAM,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,uBAAuB,CAAC,IAAI,CAACA,IAAM,CAAC,QAAQ,EAAE,CAAC;AACnG,IAAI,eAAe,GAAG,IAAI;AAC1B,IAAI,SAAS,EAAE;AACf,CAAC,IAAI,GAAG,CAAC,eAAe,CAAC;AAEzB;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,oBAAoB;AAO5C;AACA;AACA,SAAS,OAAO,GAAG;AACnB,CAAC,OAAO,UAAU,CAAC,aAAa,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,GAAG;AACX,CAGC,IAAI,KAAK,GAAG;AACb,EAAE,OAAO,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK;AAC7B,CAAC,CAAC;AACF,CAYC,IAAI,MAAM,GAAG;AACd,EAAE,OAAO,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM;AAC9B,CAAC,CAID,CAAC;AACD;AACA;AACA,SAAS,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE;AACtC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,UAAU,KAAK;AACtC,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AACpG,CAAC,CAAC,CAAC;AACH;;;;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** @import { StandardSchemaV1 } from '@standard-schema/spec' */
|
|
2
|
+
|
|
3
|
+
class HttpError {
|
|
4
|
+
/**
|
|
5
|
+
* @param {number} status
|
|
6
|
+
* @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body
|
|
7
|
+
*/
|
|
8
|
+
constructor(status, body) {
|
|
9
|
+
this.status = status;
|
|
10
|
+
if (typeof body === 'string') {
|
|
11
|
+
this.body = { message: body };
|
|
12
|
+
} else if (body) {
|
|
13
|
+
this.body = body;
|
|
14
|
+
} else {
|
|
15
|
+
this.body = { message: `Error: ${status}` };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
toString() {
|
|
20
|
+
return JSON.stringify(this.body);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class Redirect {
|
|
25
|
+
/**
|
|
26
|
+
* @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status
|
|
27
|
+
* @param {string} location
|
|
28
|
+
*/
|
|
29
|
+
constructor(status, location) {
|
|
30
|
+
try {
|
|
31
|
+
new Headers({ location });
|
|
32
|
+
} catch {
|
|
33
|
+
throw new Error(
|
|
34
|
+
`Invalid redirect location ${JSON.stringify(location)}: ` +
|
|
35
|
+
'this string contains characters that cannot be used in HTTP headers'
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
this.status = status;
|
|
40
|
+
this.location = location;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* An error that was thrown from within the SvelteKit runtime that is not fatal and doesn't result in a 500, such as a 404.
|
|
46
|
+
* `SvelteKitError` goes through `handleError`.
|
|
47
|
+
* @extends Error
|
|
48
|
+
*/
|
|
49
|
+
class SvelteKitError extends Error {
|
|
50
|
+
/**
|
|
51
|
+
* @param {number} status
|
|
52
|
+
* @param {string} text
|
|
53
|
+
* @param {string} message
|
|
54
|
+
*/
|
|
55
|
+
constructor(status, text, message) {
|
|
56
|
+
super(message);
|
|
57
|
+
this.status = status;
|
|
58
|
+
this.text = text;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @template [T=undefined]
|
|
64
|
+
*/
|
|
65
|
+
class ActionFailure {
|
|
66
|
+
/**
|
|
67
|
+
* @param {number} status
|
|
68
|
+
* @param {T} data
|
|
69
|
+
*/
|
|
70
|
+
constructor(status, data) {
|
|
71
|
+
this.status = status;
|
|
72
|
+
this.data = data;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { ActionFailure as A, HttpError as H, Redirect as R, SvelteKitError as S };
|
|
77
|
+
//# sourceMappingURL=index-DBqjc0Yf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DBqjc0Yf.js","sources":["../../../node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/exports/internal/index.js"],"sourcesContent":["/** @import { StandardSchemaV1 } from '@standard-schema/spec' */\n\nexport class HttpError {\n\t/**\n\t * @param {number} status\n\t * @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body\n\t */\n\tconstructor(status, body) {\n\t\tthis.status = status;\n\t\tif (typeof body === 'string') {\n\t\t\tthis.body = { message: body };\n\t\t} else if (body) {\n\t\t\tthis.body = body;\n\t\t} else {\n\t\t\tthis.body = { message: `Error: ${status}` };\n\t\t}\n\t}\n\n\ttoString() {\n\t\treturn JSON.stringify(this.body);\n\t}\n}\n\nexport class Redirect {\n\t/**\n\t * @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status\n\t * @param {string} location\n\t */\n\tconstructor(status, location) {\n\t\ttry {\n\t\t\tnew Headers({ location });\n\t\t} catch {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid redirect location ${JSON.stringify(location)}: ` +\n\t\t\t\t\t'this string contains characters that cannot be used in HTTP headers'\n\t\t\t);\n\t\t}\n\n\t\tthis.status = status;\n\t\tthis.location = location;\n\t}\n}\n\n/**\n * An error that was thrown from within the SvelteKit runtime that is not fatal and doesn't result in a 500, such as a 404.\n * `SvelteKitError` goes through `handleError`.\n * @extends Error\n */\nexport class SvelteKitError extends Error {\n\t/**\n\t * @param {number} status\n\t * @param {string} text\n\t * @param {string} message\n\t */\n\tconstructor(status, text, message) {\n\t\tsuper(message);\n\t\tthis.status = status;\n\t\tthis.text = text;\n\t}\n}\n\n/**\n * @template [T=undefined]\n */\nexport class ActionFailure {\n\t/**\n\t * @param {number} status\n\t * @param {T} data\n\t */\n\tconstructor(status, data) {\n\t\tthis.status = status;\n\t\tthis.data = data;\n\t}\n}\n\n/**\n * Error thrown when form validation fails imperatively\n */\nexport class ValidationError extends Error {\n\t/**\n\t * @param {StandardSchemaV1.Issue[]} issues\n\t */\n\tconstructor(issues) {\n\t\tsuper('Validation failed');\n\t\tthis.name = 'ValidationError';\n\t\tthis.issues = issues;\n\t}\n}\n\nexport { init_remote_functions } from './remote-functions.js';\n"],"names":[],"mappings":"AAAA;;AAEO,MAAM,SAAS,CAAC;AACvB;AACA;AACA;AACA;AACA,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE;AAC3B,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM;AACtB,EAAE,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAChC,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;AAChC,EAAE,CAAC,MAAM,IAAI,IAAI,EAAE;AACnB,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI;AACnB,EAAE,CAAC,MAAM;AACT,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE;AAC9C,EAAE;AACF,CAAC;;AAED,CAAC,QAAQ,GAAG;AACZ,EAAE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;AAClC,CAAC;AACD;;AAEO,MAAM,QAAQ,CAAC;AACtB;AACA;AACA;AACA;AACA,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE;AAC/B,EAAE,IAAI;AACN,GAAG,IAAI,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;AAC5B,EAAE,CAAC,CAAC,MAAM;AACV,GAAG,MAAM,IAAI,KAAK;AAClB,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;AAC7D,KAAK;AACL,IAAI;AACJ,EAAE;;AAEF,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM;AACtB,EAAE,IAAI,CAAC,QAAQ,GAAG,QAAQ;AAC1B,CAAC;AACD;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,cAAc,SAAS,KAAK,CAAC;AAC1C;AACA;AACA;AACA;AACA;AACA,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;AACpC,EAAE,KAAK,CAAC,OAAO,CAAC;AAChB,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM;AACtB,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI;AAClB,CAAC;AACD;;AAEA;AACA;AACA;AACO,MAAM,aAAa,CAAC;AAC3B;AACA;AACA;AACA;AACA,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE;AAC3B,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM;AACtB,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI;AAClB,CAAC;AACD;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { R as Redirect, H as HttpError } from './index-DBqjc0Yf.js';
|
|
2
|
+
|
|
3
|
+
const text_encoder = new TextEncoder();
|
|
4
|
+
|
|
5
|
+
/** @import { StandardSchemaV1 } from '@standard-schema/spec' */
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// TODO 3.0: remove these types as they are not used anymore (we can't remove them yet because that would be a breaking change)
|
|
9
|
+
/**
|
|
10
|
+
* @template {number} TNumber
|
|
11
|
+
* @template {any[]} [TArray=[]]
|
|
12
|
+
* @typedef {TNumber extends TArray['length'] ? TArray[number] : LessThan<TNumber, [...TArray, TArray['length']]>} LessThan
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @template {number} TStart
|
|
17
|
+
* @template {number} TEnd
|
|
18
|
+
* @typedef {Exclude<TEnd | LessThan<TEnd>, LessThan<TStart>>} NumericRange
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
// Keep the status codes as `number` because restricting to certain numbers makes it unnecessarily hard to use compared to the benefits
|
|
22
|
+
// (we have runtime errors already to check for invalid codes). Also see https://github.com/sveltejs/kit/issues/11780
|
|
23
|
+
|
|
24
|
+
// we have to repeat the JSDoc because the display for function overloads is broken
|
|
25
|
+
// see https://github.com/microsoft/TypeScript/issues/55056
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Throws an error with a HTTP status code and an optional message.
|
|
29
|
+
* When called during request handling, this will cause SvelteKit to
|
|
30
|
+
* return an error response without invoking `handleError`.
|
|
31
|
+
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
32
|
+
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
33
|
+
* @param {App.Error} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
|
|
34
|
+
* @overload
|
|
35
|
+
* @param {number} status
|
|
36
|
+
* @param {App.Error} body
|
|
37
|
+
* @return {never}
|
|
38
|
+
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
39
|
+
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Throws an error with a HTTP status code and an optional message.
|
|
43
|
+
* When called during request handling, this will cause SvelteKit to
|
|
44
|
+
* return an error response without invoking `handleError`.
|
|
45
|
+
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
46
|
+
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
47
|
+
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body] An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
|
|
48
|
+
* @overload
|
|
49
|
+
* @param {number} status
|
|
50
|
+
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body]
|
|
51
|
+
* @return {never}
|
|
52
|
+
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
53
|
+
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Throws an error with a HTTP status code and an optional message.
|
|
57
|
+
* When called during request handling, this will cause SvelteKit to
|
|
58
|
+
* return an error response without invoking `handleError`.
|
|
59
|
+
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
60
|
+
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
61
|
+
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
|
|
62
|
+
* @return {never}
|
|
63
|
+
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
64
|
+
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
65
|
+
*/
|
|
66
|
+
function error(status, body) {
|
|
67
|
+
if ((isNaN(status) || status < 400 || status > 599)) {
|
|
68
|
+
throw new Error(`HTTP error status codes must be between 400 and 599 — ${status} is invalid`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
throw new HttpError(status, body);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Checks whether this is a redirect thrown by {@link redirect}.
|
|
76
|
+
* @param {unknown} e The object to check.
|
|
77
|
+
* @return {e is Redirect}
|
|
78
|
+
*/
|
|
79
|
+
function isRedirect(e) {
|
|
80
|
+
return e instanceof Redirect;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Create a JSON `Response` object from the supplied data.
|
|
85
|
+
* @param {any} data The value that will be serialized as JSON.
|
|
86
|
+
* @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. `Content-Type: application/json` and `Content-Length` headers will be added automatically.
|
|
87
|
+
*/
|
|
88
|
+
function json(data, init) {
|
|
89
|
+
// TODO deprecate this in favour of `Response.json` when it's
|
|
90
|
+
// more widely supported
|
|
91
|
+
const body = JSON.stringify(data);
|
|
92
|
+
|
|
93
|
+
// we can't just do `text(JSON.stringify(data), init)` because
|
|
94
|
+
// it will set a default `content-type` header. duplicated code
|
|
95
|
+
// means less duplicated work
|
|
96
|
+
const headers = new Headers(init?.headers);
|
|
97
|
+
if (!headers.has('content-length')) {
|
|
98
|
+
headers.set('content-length', text_encoder.encode(body).byteLength.toString());
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (!headers.has('content-type')) {
|
|
102
|
+
headers.set('content-type', 'application/json');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return new Response(body, {
|
|
106
|
+
...init,
|
|
107
|
+
headers
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Create a `Response` object from the supplied body.
|
|
113
|
+
* @param {string} body The value that will be used as-is.
|
|
114
|
+
* @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. A `Content-Length` header will be added automatically.
|
|
115
|
+
*/
|
|
116
|
+
function text(body, init) {
|
|
117
|
+
const headers = new Headers(init?.headers);
|
|
118
|
+
if (!headers.has('content-length')) {
|
|
119
|
+
const encoded = text_encoder.encode(body);
|
|
120
|
+
headers.set('content-length', encoded.byteLength.toString());
|
|
121
|
+
return new Response(encoded, {
|
|
122
|
+
...init,
|
|
123
|
+
headers
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return new Response(body, {
|
|
128
|
+
...init,
|
|
129
|
+
headers
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { error as e, isRedirect as i, json as j, text as t };
|
|
134
|
+
//# sourceMappingURL=index-Dq7YP_jO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Dq7YP_jO.js","sources":["../../../node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/runtime/utils.js","../../../node_modules/.pnpm/@sveltejs+kit@2.63.1_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.3_@typescript-eslin_917f0301ec0faab725ff93a8d7806479/node_modules/@sveltejs/kit/src/exports/index.js"],"sourcesContent":["import { BROWSER } from 'esm-env';\n\nexport const text_encoder = new TextEncoder();\n\n/**\n * Like node's path.relative, but without using node\n * @param {string} from\n * @param {string} to\n */\nexport function get_relative_path(from, to) {\n\tconst from_parts = from.split(/[/\\\\]/);\n\tconst to_parts = to.split(/[/\\\\]/);\n\tfrom_parts.pop(); // get dirname\n\n\twhile (from_parts[0] === to_parts[0]) {\n\t\tfrom_parts.shift();\n\t\tto_parts.shift();\n\t}\n\n\tlet i = from_parts.length;\n\twhile (i--) from_parts[i] = '..';\n\n\treturn from_parts.concat(to_parts).join('/');\n}\n\n/**\n * @param {Uint8Array} bytes\n * @returns {string}\n */\nexport function base64_encode(bytes) {\n\t// Using `Buffer` is faster than iterating\n\tif (!BROWSER && globalThis.Buffer) {\n\t\treturn globalThis.Buffer.from(bytes).toString('base64');\n\t}\n\n\tlet binary = '';\n\n\tfor (let i = 0; i < bytes.length; i++) {\n\t\tbinary += String.fromCharCode(bytes[i]);\n\t}\n\n\treturn btoa(binary);\n}\n\n/**\n * @param {string} encoded\n * @returns {Uint8Array}\n */\nexport function base64_decode(encoded) {\n\t// Using `Buffer` is faster than iterating\n\tif (!BROWSER && globalThis.Buffer) {\n\t\tconst buffer = globalThis.Buffer.from(encoded, 'base64');\n\t\treturn new Uint8Array(buffer);\n\t}\n\n\tconst binary = atob(encoded);\n\tconst bytes = new Uint8Array(binary.length);\n\n\tfor (let i = 0; i < binary.length; i++) {\n\t\tbytes[i] = binary.charCodeAt(i);\n\t}\n\n\treturn bytes;\n}\n","/** @import { StandardSchemaV1 } from '@standard-schema/spec' */\n\nimport { HttpError, Redirect, ActionFailure, ValidationError } from './internal/index.js';\nimport { BROWSER, DEV } from 'esm-env';\nimport {\n\tadd_data_suffix,\n\tadd_resolution_suffix,\n\thas_data_suffix,\n\thas_resolution_suffix,\n\tstrip_data_suffix,\n\tstrip_resolution_suffix\n} from '../runtime/pathname.js';\nimport { text_encoder } from '../runtime/utils.js';\n\nexport { VERSION } from '../version.js';\n\n// TODO 3.0: remove these types as they are not used anymore (we can't remove them yet because that would be a breaking change)\n/**\n * @template {number} TNumber\n * @template {any[]} [TArray=[]]\n * @typedef {TNumber extends TArray['length'] ? TArray[number] : LessThan<TNumber, [...TArray, TArray['length']]>} LessThan\n */\n\n/**\n * @template {number} TStart\n * @template {number} TEnd\n * @typedef {Exclude<TEnd | LessThan<TEnd>, LessThan<TStart>>} NumericRange\n */\n\n// Keep the status codes as `number` because restricting to certain numbers makes it unnecessarily hard to use compared to the benefits\n// (we have runtime errors already to check for invalid codes). Also see https://github.com/sveltejs/kit/issues/11780\n\n// we have to repeat the JSDoc because the display for function overloads is broken\n// see https://github.com/microsoft/TypeScript/issues/55056\n\n/**\n * Throws an error with a HTTP status code and an optional message.\n * When called during request handling, this will cause SvelteKit to\n * return an error response without invoking `handleError`.\n * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.\n * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.\n * @param {App.Error} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.\n * @overload\n * @param {number} status\n * @param {App.Error} body\n * @return {never}\n * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.\n * @throws {Error} If the provided status is invalid (not between 400 and 599).\n */\n/**\n * Throws an error with a HTTP status code and an optional message.\n * When called during request handling, this will cause SvelteKit to\n * return an error response without invoking `handleError`.\n * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.\n * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.\n * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body] An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.\n * @overload\n * @param {number} status\n * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body]\n * @return {never}\n * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.\n * @throws {Error} If the provided status is invalid (not between 400 and 599).\n */\n/**\n * Throws an error with a HTTP status code and an optional message.\n * When called during request handling, this will cause SvelteKit to\n * return an error response without invoking `handleError`.\n * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.\n * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.\n * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.\n * @return {never}\n * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.\n * @throws {Error} If the provided status is invalid (not between 400 and 599).\n */\nexport function error(status, body) {\n\tif ((!BROWSER || DEV) && (isNaN(status) || status < 400 || status > 599)) {\n\t\tthrow new Error(`HTTP error status codes must be between 400 and 599 — ${status} is invalid`);\n\t}\n\n\tthrow new HttpError(status, body);\n}\n\n/**\n * Checks whether this is an error thrown by {@link error}.\n * @template {number} T\n * @param {unknown} e\n * @param {T} [status] The status to filter for.\n * @return {e is (HttpError & { status: T extends undefined ? never : T })}\n */\nexport function isHttpError(e, status) {\n\tif (!(e instanceof HttpError)) return false;\n\treturn !status || e.status === status;\n}\n\n/**\n * Redirect a request. When called during request handling, SvelteKit will return a redirect response.\n * Make sure you're not catching the thrown redirect, which would prevent SvelteKit from handling it.\n *\n * Most common status codes:\n * * `303 See Other`: redirect as a GET request (often used after a form POST request)\n * * `307 Temporary Redirect`: redirect will keep the request method\n * * `308 Permanent Redirect`: redirect will keep the request method, SEO will be transferred to the new page\n *\n * [See all redirect status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages)\n *\n * @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | ({} & number)} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308.\n * @param {string | URL} location The location to redirect to.\n * @throws {Redirect} This error instructs SvelteKit to redirect to the specified location.\n * @throws {Error} If the provided status is invalid or the location cannot be used as a header value.\n * @return {never}\n */\nexport function redirect(status, location) {\n\tif ((!BROWSER || DEV) && (isNaN(status) || status < 300 || status > 308)) {\n\t\tthrow new Error('Invalid status code');\n\t}\n\n\tthrow new Redirect(\n\t\t// @ts-ignore\n\t\tstatus,\n\t\tlocation.toString()\n\t);\n}\n\n/**\n * Checks whether this is a redirect thrown by {@link redirect}.\n * @param {unknown} e The object to check.\n * @return {e is Redirect}\n */\nexport function isRedirect(e) {\n\treturn e instanceof Redirect;\n}\n\n/**\n * Create a JSON `Response` object from the supplied data.\n * @param {any} data The value that will be serialized as JSON.\n * @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. `Content-Type: application/json` and `Content-Length` headers will be added automatically.\n */\nexport function json(data, init) {\n\t// TODO deprecate this in favour of `Response.json` when it's\n\t// more widely supported\n\tconst body = JSON.stringify(data);\n\n\t// we can't just do `text(JSON.stringify(data), init)` because\n\t// it will set a default `content-type` header. duplicated code\n\t// means less duplicated work\n\tconst headers = new Headers(init?.headers);\n\tif (!headers.has('content-length')) {\n\t\theaders.set('content-length', text_encoder.encode(body).byteLength.toString());\n\t}\n\n\tif (!headers.has('content-type')) {\n\t\theaders.set('content-type', 'application/json');\n\t}\n\n\treturn new Response(body, {\n\t\t...init,\n\t\theaders\n\t});\n}\n\n/**\n * Create a `Response` object from the supplied body.\n * @param {string} body The value that will be used as-is.\n * @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. A `Content-Length` header will be added automatically.\n */\nexport function text(body, init) {\n\tconst headers = new Headers(init?.headers);\n\tif (!headers.has('content-length')) {\n\t\tconst encoded = text_encoder.encode(body);\n\t\theaders.set('content-length', encoded.byteLength.toString());\n\t\treturn new Response(encoded, {\n\t\t\t...init,\n\t\t\theaders\n\t\t});\n\t}\n\n\treturn new Response(body, {\n\t\t...init,\n\t\theaders\n\t});\n}\n\n/**\n * Create an `ActionFailure` object. Call when form submission fails.\n * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.\n * @overload\n * @param {number} status\n * @returns {import('./public.js').ActionFailure<undefined>}\n */\n/**\n * Create an `ActionFailure` object. Call when form submission fails.\n * @template [T=undefined]\n * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.\n * @param {T} data Data associated with the failure (e.g. validation errors)\n * @overload\n * @param {number} status\n * @param {T} data\n * @returns {import('./public.js').ActionFailure<T>}\n */\n/**\n * Create an `ActionFailure` object. Call when form submission fails.\n * @param {number} status\n * @param {any} [data]\n * @returns {import('./public.js').ActionFailure<any>}\n */\nexport function fail(status, data) {\n\t// @ts-expect-error unique symbol missing\n\treturn new ActionFailure(status, data);\n}\n\n/**\n * Checks whether this is an action failure thrown by {@link fail}.\n * @param {unknown} e The object to check.\n * @return {e is import('./public.js').ActionFailure}\n */\nexport function isActionFailure(e) {\n\treturn e instanceof ActionFailure;\n}\n\n/**\n * Use this to throw a validation error to imperatively fail form validation.\n * Can be used in combination with `issue` passed to form actions to create field-specific issues.\n *\n * @example\n * ```ts\n * import { invalid } from '@sveltejs/kit';\n * import { form } from '$app/server';\n * import { tryLogin } from '$lib/server/auth';\n * import * as v from 'valibot';\n *\n * export const login = form(\n * v.object({ name: v.string(), _password: v.string() }),\n * async ({ name, _password }) => {\n * const success = tryLogin(name, _password);\n * if (!success) {\n * invalid('Incorrect username or password');\n * }\n *\n * // ...\n * }\n * );\n * ```\n * @param {...(StandardSchemaV1.Issue | string)} issues\n * @returns {never}\n * @since 2.47.3\n */\nexport function invalid(...issues) {\n\tthrow new ValidationError(\n\t\tissues.map((issue) => (typeof issue === 'string' ? { message: issue } : issue))\n\t);\n}\n\n/**\n * Checks whether this is an validation error thrown by {@link invalid}.\n * @param {unknown} e The object to check.\n * @return {e is import('./public.js').ActionFailure}\n * @since 2.47.3\n */\nexport function isValidationError(e) {\n\treturn e instanceof ValidationError;\n}\n\n/**\n * Strips possible SvelteKit-internal suffixes and trailing slashes from the URL pathname.\n * Returns the normalized URL as well as a method for adding the potential suffix back\n * based on a new pathname (possibly including search) or URL.\n * ```js\n * import { normalizeUrl } from '@sveltejs/kit';\n *\n * const { url, denormalize } = normalizeUrl('/blog/post/__data.json');\n * console.log(url.pathname); // /blog/post\n * console.log(denormalize('/blog/post/a')); // /blog/post/a/__data.json\n * ```\n * @param {URL | string} url\n * @returns {{ url: URL, wasNormalized: boolean, denormalize: (url?: string | URL) => URL }}\n * @since 2.18.0\n */\nexport function normalizeUrl(url) {\n\turl = new URL(url, 'a://a');\n\n\tconst is_route_resolution = has_resolution_suffix(url.pathname);\n\tconst is_data_request = has_data_suffix(url.pathname);\n\tconst has_trailing_slash = url.pathname !== '/' && url.pathname.endsWith('/');\n\n\tif (is_route_resolution) {\n\t\turl.pathname = strip_resolution_suffix(url.pathname);\n\t} else if (is_data_request) {\n\t\turl.pathname = strip_data_suffix(url.pathname);\n\t} else if (has_trailing_slash) {\n\t\turl.pathname = url.pathname.slice(0, -1);\n\t}\n\n\treturn {\n\t\turl,\n\t\twasNormalized: is_data_request || is_route_resolution || has_trailing_slash,\n\t\tdenormalize: (new_url = url) => {\n\t\t\tnew_url = new URL(new_url, url);\n\t\t\tif (is_route_resolution) {\n\t\t\t\tnew_url.pathname = add_resolution_suffix(new_url.pathname);\n\t\t\t} else if (is_data_request) {\n\t\t\t\tnew_url.pathname = add_data_suffix(new_url.pathname);\n\t\t\t} else if (has_trailing_slash && !new_url.pathname.endsWith('/')) {\n\t\t\t\tnew_url.pathname += '/';\n\t\t\t}\n\t\t\treturn new_url;\n\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