@velastack/patterns 0.0.21 → 0.0.23
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/dist/chunks/collections-Bzyt18yv.js +52 -0
- package/dist/chunks/collections-Bzyt18yv.js.map +1 -0
- package/dist/chunks/constants-B5Ub2oFy.js +6 -0
- package/dist/chunks/constants-B5Ub2oFy.js.map +1 -0
- package/dist/chunks/dedent-BFNYR8cb.js +87 -0
- package/dist/chunks/dedent-BFNYR8cb.js.map +1 -0
- package/dist/chunks/env.preview-Cpr4Im0G.js +19 -0
- package/dist/chunks/env.preview-Cpr4Im0G.js.map +1 -0
- package/dist/chunks/env.runtime-iw-bWvXM.js +32 -0
- package/dist/chunks/env.runtime-iw-bWvXM.js.map +1 -0
- package/dist/chunks/generate.runtime-BEuc5hDN.js +225 -0
- package/dist/chunks/generate.runtime-BEuc5hDN.js.map +1 -0
- package/dist/chunks/generate.runtime-CHmm4bBZ.js +154 -0
- package/dist/chunks/generate.runtime-CHmm4bBZ.js.map +1 -0
- package/dist/chunks/generate.runtime-DXkJgkP4.js +232 -0
- package/dist/chunks/generate.runtime-DXkJgkP4.js.map +1 -0
- package/dist/chunks/generate.runtime-egq8I3EA.js +61 -0
- package/dist/chunks/generate.runtime-egq8I3EA.js.map +1 -0
- package/dist/chunks/generate.runtime-uPCB71Ki.js +522 -0
- package/dist/chunks/generate.runtime-uPCB71Ki.js.map +1 -0
- package/dist/chunks/pocketbase-CPRrN7Qs.js +106 -0
- package/dist/chunks/pocketbase-CPRrN7Qs.js.map +1 -0
- package/dist/chunks/pocketbase-CSl9ydRr.js +47 -0
- package/dist/chunks/pocketbase-CSl9ydRr.js.map +1 -0
- package/dist/chunks/ts-morph-helpers-BiOU9sUx.js +150 -0
- package/dist/chunks/ts-morph-helpers-BiOU9sUx.js.map +1 -0
- package/dist/chunks/util-k-qPjL06.js +21 -0
- package/dist/chunks/util-k-qPjL06.js.map +1 -0
- package/dist/chunks/write-result-CSxmq40z.js +216 -0
- package/dist/chunks/write-result-CSxmq40z.js.map +1 -0
- package/dist/index.js +3532 -8
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/dist/chunks/collections-OI0LQoJt.js +0 -67
- package/dist/chunks/collections-OI0LQoJt.js.map +0 -1
- package/dist/chunks/env.preview-HlXZOEL4.js +0 -17
- package/dist/chunks/env.preview-HlXZOEL4.js.map +0 -1
- package/dist/chunks/env.runtime-CSAfqDu4.js +0 -36
- package/dist/chunks/env.runtime-CSAfqDu4.js.map +0 -1
- package/dist/chunks/generate.runtime-BQFcrwn8.js +0 -334
- package/dist/chunks/generate.runtime-BQFcrwn8.js.map +0 -1
- package/dist/chunks/generate.runtime-BQg5E0LV.js +0 -172
- package/dist/chunks/generate.runtime-BQg5E0LV.js.map +0 -1
- package/dist/chunks/generate.runtime-C7g-zL0o.js +0 -55
- package/dist/chunks/generate.runtime-C7g-zL0o.js.map +0 -1
- package/dist/chunks/generate.runtime-CEFyA2-Y.js +0 -610
- package/dist/chunks/generate.runtime-CEFyA2-Y.js.map +0 -1
- package/dist/chunks/generate.runtime-ZXBZUjeH.js +0 -259
- package/dist/chunks/generate.runtime-ZXBZUjeH.js.map +0 -1
- package/dist/chunks/index-9TLCLhJv.js +0 -9647
- package/dist/chunks/index-9TLCLhJv.js.map +0 -1
- package/dist/chunks/pocketbase-Vk0YzqnQ.js +0 -140
- package/dist/chunks/pocketbase-Vk0YzqnQ.js.map +0 -1
- package/dist/chunks/ts-morph-helpers-BNCluWTs.js +0 -166
- package/dist/chunks/ts-morph-helpers-BNCluWTs.js.map +0 -1
- package/dist/chunks/write-result-DmD7kWlV.js +0 -1742
- package/dist/chunks/write-result-DmD7kWlV.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velastack/patterns",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"prettier-plugin-svelte": "^3.5.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@velastack/pocketbase": "^0.0.
|
|
28
|
+
"@velastack/pocketbase": "^0.0.45",
|
|
29
29
|
"cross-spawn": "^7.0.6",
|
|
30
|
-
"magic-string": "^0.30.
|
|
30
|
+
"magic-string": "^0.30.21",
|
|
31
31
|
"package-manager-detector": "^1.6.0",
|
|
32
32
|
"pocketbase": "^0.26.8",
|
|
33
|
-
"svelte": "^5.
|
|
33
|
+
"svelte": "^5.55.4",
|
|
34
34
|
"ts-morph": "^28.0.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@types/cross-spawn": "^6.0.6",
|
|
61
61
|
"@types/node": "^22.0.0",
|
|
62
62
|
"@types/pluralize": "^0.0.33",
|
|
63
|
-
"@velastack/pocketbase": "^0.0.
|
|
63
|
+
"@velastack/pocketbase": "^0.0.45",
|
|
64
64
|
"change-case": "^5.4.4",
|
|
65
65
|
"cross-spawn": "^7.0.6",
|
|
66
66
|
"dedent": "^1.7.2",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"svelte": "^5.55.4",
|
|
72
72
|
"ts-morph": "^28.0.0",
|
|
73
73
|
"typescript": "^5.0.0",
|
|
74
|
-
"vite": "^
|
|
74
|
+
"vite": "^8.0.8",
|
|
75
75
|
"vite-node": "^6.0.0",
|
|
76
|
-
"vite-plugin-dts": "^4.4
|
|
76
|
+
"vite-plugin-dts": "^4.5.4",
|
|
77
77
|
"vitest": "^4.1.4"
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { readFileSync as s } from "node:fs";
|
|
2
|
-
import { l as u } from "./index-9TLCLhJv.js";
|
|
3
|
-
import { w as f, m as c, g as d } from "./pocketbase-Vk0YzqnQ.js";
|
|
4
|
-
function m(e) {
|
|
5
|
-
var a, n, i, o;
|
|
6
|
-
if (((i = (n = (a = e.response) == null ? void 0 : a.data) == null ? void 0 : n.name) == null ? void 0 : i.code) === "validation_not_unique")
|
|
7
|
-
return !0;
|
|
8
|
-
const t = ((o = e.message) == null ? void 0 : o.toLowerCase()) ?? "";
|
|
9
|
-
return t.includes("already exists") || t.includes("must be unique");
|
|
10
|
-
}
|
|
11
|
-
function g(e) {
|
|
12
|
-
const t = {};
|
|
13
|
-
return e.listRule !== void 0 && (t.listRule = e.listRule), e.viewRule !== void 0 && (t.viewRule = e.viewRule), e.createRule !== void 0 && (t.createRule = e.createRule), e.updateRule !== void 0 && (t.updateRule = e.updateRule), e.deleteRule !== void 0 && (t.deleteRule = e.deleteRule), t;
|
|
14
|
-
}
|
|
15
|
-
async function v(e, t, a) {
|
|
16
|
-
const n = [];
|
|
17
|
-
for (const i of t) {
|
|
18
|
-
const o = i.collectionName.replace(/'/g, "''"), l = await e.collections.getFirstListItem(`name='${o}'`);
|
|
19
|
-
if (await e.collections.update(l.id, g(i)), await c(), a) {
|
|
20
|
-
const r = d(
|
|
21
|
-
i.collectionName,
|
|
22
|
-
"updated",
|
|
23
|
-
a
|
|
24
|
-
);
|
|
25
|
-
r && n.push({
|
|
26
|
-
path: r,
|
|
27
|
-
language: u(r),
|
|
28
|
-
content: s(r, "utf8")
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return n;
|
|
33
|
-
}
|
|
34
|
-
async function p(e, t) {
|
|
35
|
-
if (e.length === 0)
|
|
36
|
-
return [];
|
|
37
|
-
const a = [];
|
|
38
|
-
return await f(t.root, async (n) => {
|
|
39
|
-
for (const i of e) {
|
|
40
|
-
try {
|
|
41
|
-
await n.collections.create(i);
|
|
42
|
-
} catch (l) {
|
|
43
|
-
throw m(
|
|
44
|
-
l
|
|
45
|
-
) ? new Error(
|
|
46
|
-
`Collection "${i.name}" already exists. Choose a different model name or remove the existing collection first.`
|
|
47
|
-
) : l;
|
|
48
|
-
}
|
|
49
|
-
await c();
|
|
50
|
-
const o = d(
|
|
51
|
-
i.name,
|
|
52
|
-
"created",
|
|
53
|
-
t
|
|
54
|
-
);
|
|
55
|
-
o && a.push({
|
|
56
|
-
path: o,
|
|
57
|
-
language: u(o),
|
|
58
|
-
content: s(o, "utf8")
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}), a;
|
|
62
|
-
}
|
|
63
|
-
export {
|
|
64
|
-
v as applyCollectionRulePatches,
|
|
65
|
-
p as createCollections
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=collections-OI0LQoJt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collections-OI0LQoJt.js","sources":["../../src/runtime/collections.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport type {\n CollectionRulesPatch,\n CollectionSpec,\n File,\n Options,\n} from \"../core/types\";\nimport { languageFromPath } from \"../core/util\";\nimport { getMigrationFile, migrationDelay, withPocketbase } from \"./pocketbase\";\n\ninterface PocketBaseCollectionCreateError {\n response?: {\n data?: {\n name?: {\n code?: string;\n };\n };\n };\n message?: string;\n}\n\nfunction isCollectionAlreadyExistsError(\n error: PocketBaseCollectionCreateError,\n): boolean {\n if (error.response?.data?.name?.code === \"validation_not_unique\") {\n return true;\n }\n\n const message = error.message?.toLowerCase() ?? \"\";\n return (\n message.includes(\"already exists\") || message.includes(\"must be unique\")\n );\n}\n\nfunction rulePayloadFromPatch(\n patch: CollectionRulesPatch,\n): Record<string, unknown> {\n const payload: Record<string, unknown> = {};\n if (patch.listRule !== undefined) payload.listRule = patch.listRule;\n if (patch.viewRule !== undefined) payload.viewRule = patch.viewRule;\n if (patch.createRule !== undefined) payload.createRule = patch.createRule;\n if (patch.updateRule !== undefined) payload.updateRule = patch.updateRule;\n if (patch.deleteRule !== undefined) payload.deleteRule = patch.deleteRule;\n return payload;\n}\n\n/**\n * Applies API rule updates in array order. Call after all referenced collections exist.\n * Collects migration files produced by each update when `options` is provided.\n */\nexport async function applyCollectionRulePatches(\n pb: {\n collections: {\n getFirstListItem: (filter: string) => Promise<{ id: string }>;\n update: (id: string, body: Record<string, unknown>) => Promise<unknown>;\n };\n },\n patches: CollectionRulesPatch[],\n options?: Options,\n): Promise<File[]> {\n const migrations: File[] = [];\n\n for (const patch of patches) {\n const escaped = patch.collectionName.replace(/'/g, \"''\");\n const col = await pb.collections.getFirstListItem(`name='${escaped}'`);\n await pb.collections.update(col.id, rulePayloadFromPatch(patch));\n await migrationDelay();\n\n if (options) {\n const migrationFile = getMigrationFile(\n patch.collectionName,\n \"updated\",\n options,\n );\n if (migrationFile) {\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n });\n }\n }\n }\n\n return migrations;\n}\n\nexport async function createCollections(\n collections: CollectionSpec[],\n options: Options,\n): Promise<File[]> {\n if (collections.length === 0) {\n return [];\n }\n\n const migrations: File[] = [];\n\n await withPocketbase(options.root, async (pb) => {\n for (const collection of collections) {\n try {\n await pb.collections.create(collection);\n } catch (error) {\n if (\n isCollectionAlreadyExistsError(\n error as PocketBaseCollectionCreateError,\n )\n ) {\n throw new Error(\n `Collection \"${collection.name}\" already exists. Choose a different model name or remove the existing collection first.`,\n );\n }\n throw error;\n }\n await migrationDelay();\n\n const migrationFile = getMigrationFile(\n collection.name,\n \"created\",\n options,\n );\n if (!migrationFile) {\n continue;\n }\n\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n });\n }\n });\n\n return migrations;\n}\n"],"names":["isCollectionAlreadyExistsError","error","_c","_b","_a","message","_d","rulePayloadFromPatch","patch","payload","applyCollectionRulePatches","pb","patches","options","migrations","escaped","col","migrationDelay","migrationFile","getMigrationFile","languageFromPath","readFileSync","createCollections","collections","withPocketbase","collection"],"mappings":";;;AAqBA,SAASA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AMT,IAAqB,CAAA;AAE3B,eAAMU,EAAeX,EAAQ,MAAM,OAAOF,MAAO;AAC/C,eAAWc,KAAcF,GAAa;AACpC,UAAI;AACF,cAAMZ,EAAG,YAAY,OAAOc,CAAU;AAAA,MACxC,SAASxB,GAAO;AACd,cACED;AAAA,UACEC;AAAA,QAAA,IAGI,IAAI;AAAA,UACR,eAAewB,EAAW,IAAI;AAAA,QAAA,IAG5BxB;AAAA,MACR;AACA,YAAMgB,EAAA;AAEN,YAAMC,IAAgBC;AAAA,QACpBM,EAAW;AAAA,QACX;AAAA,QACAZ;AAAA,MAAA;AAEF,MAAKK,KAILJ,EAAW,KAAK;AAAA,QACd,MAAMI;AAAA,QACN,UAAUE,EAAiBF,CAAa;AAAA,QACxC,SAASG,EAAaH,GAAe,MAAM;AAAA,MAAA,CAC5C;AAAA,IACH;AAAA,EACF,CAAC,GAEMJ;AACT;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function t(e) {
|
|
2
|
-
return e.features.auth ? [
|
|
3
|
-
{
|
|
4
|
-
id: "users_preview",
|
|
5
|
-
name: "users",
|
|
6
|
-
type: "auth",
|
|
7
|
-
fields: [
|
|
8
|
-
{ name: "email", type: "email" },
|
|
9
|
-
{ name: "name", type: "text" }
|
|
10
|
-
]
|
|
11
|
-
}
|
|
12
|
-
] : [];
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
t as getPreviewCollections
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=env.preview-HlXZOEL4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.preview-HlXZOEL4.js","sources":["../../src/parse/env.preview.ts"],"sourcesContent":["import type { Options } from \"../core/types\";\nimport type { Collection } from \"./types\";\n\nexport function getPreviewCollections(\n options: Pick<Options, \"features\">,\n): Collection[] {\n if (options.features.auth) {\n return [\n {\n id: \"users_preview\",\n name: \"users\",\n type: \"auth\",\n fields: [\n { name: \"email\", type: \"email\" },\n { name: \"name\", type: \"text\" },\n ],\n },\n ];\n }\n return [];\n}\n"],"names":["getPreviewCollections","options"],"mappings":"AAGO,SAASA,EACdC,GACc;AACd,SAAIA,EAAQ,SAAS,OACZ;AAAA,IACL;AAAA,MACE,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,QACN,EAAE,MAAM,SAAS,MAAM,QAAA;AAAA,QACvB,EAAE,MAAM,QAAQ,MAAM,OAAA;AAAA,MAAO;AAAA,IAC/B;AAAA,EACF,IAGG,CAAA;AACT;"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { getCollections as i } from "@velastack/pocketbase/internal";
|
|
2
|
-
import s from "node:fs";
|
|
3
|
-
import r from "node:path";
|
|
4
|
-
import t from "node:process";
|
|
5
|
-
import { D as c } from "./index-9TLCLhJv.js";
|
|
6
|
-
function a(o) {
|
|
7
|
-
return s.existsSync(r.join(o, "package.json")) && s.existsSync(r.join(o, c));
|
|
8
|
-
}
|
|
9
|
-
function p(o = t.cwd()) {
|
|
10
|
-
let e = r.resolve(o);
|
|
11
|
-
for (; ; ) {
|
|
12
|
-
if (a(e))
|
|
13
|
-
return e;
|
|
14
|
-
const n = r.dirname(e);
|
|
15
|
-
if (n === e)
|
|
16
|
-
break;
|
|
17
|
-
e = n;
|
|
18
|
-
}
|
|
19
|
-
throw new Error(
|
|
20
|
-
`Could not resolve project root from "${o}". Expected package.json, and ${c}.`
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
async function S() {
|
|
24
|
-
const o = p();
|
|
25
|
-
return i({
|
|
26
|
-
pocketbaseUrl: "",
|
|
27
|
-
superuserEmail: t.env.POCKETBASE_SUPERUSER_EMAIL,
|
|
28
|
-
superuserPassword: t.env.POCKETBASE_SUPERUSER_PASSWORD,
|
|
29
|
-
root: o
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
S as getCollections,
|
|
34
|
-
p as resolveProjectRoot
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=env.runtime-CSAfqDu4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.runtime-CSAfqDu4.js","sources":["../../src/parse/env.runtime.ts"],"sourcesContent":["import { getCollections as getCollectionsFromPB } from \"@velastack/pocketbase/internal\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport { DATA_DIR } from \"../core/constants\";\nimport type { Collection } from \"./types\";\n\nfunction hasProjectMarkers(dir: string): boolean {\n return (\n fs.existsSync(path.join(dir, \"package.json\")) &&\n fs.existsSync(path.join(dir, DATA_DIR))\n );\n}\n\nexport function resolveProjectRoot(startDir = process.cwd()): string {\n let current = path.resolve(startDir);\n\n while (true) {\n if (hasProjectMarkers(current)) {\n return current;\n }\n\n const parent = path.dirname(current);\n if (parent === current) {\n break;\n }\n current = parent;\n }\n\n throw new Error(\n `Could not resolve project root from \"${startDir}\". Expected package.json, and ${DATA_DIR}.`,\n );\n}\n\nexport async function getCollections(): Promise<Collection[]> {\n const root = resolveProjectRoot();\n\n return getCollectionsFromPB({\n pocketbaseUrl: \"\",\n superuserEmail: process.env.POCKETBASE_SUPERUSER_EMAIL!,\n superuserPassword: process.env.POCKETBASE_SUPERUSER_PASSWORD!,\n root,\n }) as Promise<Collection[]>;\n}\n"],"names":["hasProjectMarkers","dir","fs","path","DATA_DIR","resolveProjectRoot","startDir","process","current","parent","getCollections","root","getCollectionsFromPB"],"mappings":";;;;;AAOA,SAASA,EAAkBC,GAAsB;AAC/C,SACEC,EAAG,WAAWC,EAAK,KAAKF,GAAK,cAAc,CAAC,KAC5CC,EAAG,WAAWC,EAAK,KAAKF,GAAKG,CAAQ,CAAC;AAE1C;AAEO,SAASC,EAAmBC,IAAWC,EAAQ,OAAe;AACnE,MAAIC,IAAUL,EAAK,QAAQG,CAAQ;AAEnC,aAAa;AACX,QAAIN,EAAkBQ,CAAO;AAC3B,aAAOA;AAGT,UAAMC,IAASN,EAAK,QAAQK,CAAO;AACnC,QAAIC,MAAWD;AACb;AAEF,IAAAA,IAAUC;AAAA,EACZ;AAEA,QAAM,IAAI;AAAA,IACR,wCAAwCH,CAAQ,iCAAiCF,CAAQ;AAAA,EAAA;AAE7F;AAEA,eAAsBM,IAAwC;AAC5D,QAAMC,IAAON,EAAA;AAEb,SAAOO,EAAqB;AAAA,IAC1B,eAAe;AAAA,IACf,gBAAgBL,EAAQ,IAAI;AAAA,IAC5B,mBAAmBA,EAAQ,IAAI;AAAA,IAC/B,MAAAI;AAAA,EAAA,CACD;AACH;"}
|
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
import y from "node:path";
|
|
2
|
-
import p from "node:fs";
|
|
3
|
-
import { w as S, m as A, g as v } from "./pocketbase-Vk0YzqnQ.js";
|
|
4
|
-
import { d as P } from "./index-9TLCLhJv.js";
|
|
5
|
-
import { Project as x, SyntaxKind as r } from "ts-morph";
|
|
6
|
-
import { S as w, w as K, e as T } from "./ts-morph-helpers-BNCluWTs.js";
|
|
7
|
-
function F(a) {
|
|
8
|
-
if (!p.existsSync(a)) {
|
|
9
|
-
const e = P`
|
|
10
|
-
export const load = async ({ locals }) => {
|
|
11
|
-
return { user: locals.pb.authStore.record };
|
|
12
|
-
};
|
|
13
|
-
`;
|
|
14
|
-
p.writeFileSync(a, e);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const n = new x().addSourceFileAtPath(a), o = (e) => {
|
|
18
|
-
!!e.getProperty("user") || e.addPropertyAssignment({
|
|
19
|
-
name: "user",
|
|
20
|
-
initializer: "locals.pb.authStore.record"
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
let l, s;
|
|
24
|
-
const d = n.getVariableDeclaration("load");
|
|
25
|
-
if (d) {
|
|
26
|
-
const e = d.getFirstAncestorByKind(r.VariableStatement);
|
|
27
|
-
if (!!(e != null && e.hasExportKeyword())) {
|
|
28
|
-
const c = d.getInitializerIfKind(
|
|
29
|
-
r.ArrowFunction
|
|
30
|
-
);
|
|
31
|
-
if (c)
|
|
32
|
-
l = c;
|
|
33
|
-
else {
|
|
34
|
-
const t = d.getInitializer();
|
|
35
|
-
if (t) {
|
|
36
|
-
const g = t.getFirstDescendantByKind(
|
|
37
|
-
r.ArrowFunction
|
|
38
|
-
);
|
|
39
|
-
if (g)
|
|
40
|
-
l = g;
|
|
41
|
-
else {
|
|
42
|
-
const h = t.getFirstDescendantByKind(
|
|
43
|
-
r.FunctionExpression
|
|
44
|
-
);
|
|
45
|
-
h && (s = h);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (!l) {
|
|
52
|
-
const e = n.getFunction("load");
|
|
53
|
-
e && e.isExported() && (s = e);
|
|
54
|
-
}
|
|
55
|
-
if (!l && !s) {
|
|
56
|
-
n.addFunction({
|
|
57
|
-
isExported: !0,
|
|
58
|
-
isAsync: !0,
|
|
59
|
-
name: "load",
|
|
60
|
-
parameters: [{ name: "{ locals }" }],
|
|
61
|
-
statements: "return { user: locals.pb.authStore.record };"
|
|
62
|
-
}), n.formatText(), n.saveSync();
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const m = l ?? s, u = m.getParameters();
|
|
66
|
-
if (u.length === 0)
|
|
67
|
-
m.insertParameter(0, { name: "{ locals }" });
|
|
68
|
-
else {
|
|
69
|
-
const e = u[0], i = e.getStructure(), c = e.getNameNode();
|
|
70
|
-
if (c.getKind() === r.ObjectBindingPattern) {
|
|
71
|
-
const t = c;
|
|
72
|
-
if (!t.getElements().some((h) => h.getName() === "locals")) {
|
|
73
|
-
const h = t.getElements().map((b) => b.getText()).filter(Boolean), E = h.length > 0 ? ", " + h.join(", ") : "";
|
|
74
|
-
e.set({
|
|
75
|
-
name: `{ locals${E} }`,
|
|
76
|
-
type: i.type,
|
|
77
|
-
initializer: i.initializer
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
const t = e.getName();
|
|
82
|
-
t !== "locals" && e.set({
|
|
83
|
-
name: `{ locals, ...${t} }`,
|
|
84
|
-
type: i.type,
|
|
85
|
-
initializer: i.initializer
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (l) {
|
|
90
|
-
const e = l.getBody();
|
|
91
|
-
if (e.getKind() === r.Block)
|
|
92
|
-
e.getDescendantsOfKind(r.ReturnStatement).forEach((c) => {
|
|
93
|
-
const t = c.getExpression();
|
|
94
|
-
if (t) {
|
|
95
|
-
if (t.getKind() === r.ObjectLiteralExpression)
|
|
96
|
-
o(t);
|
|
97
|
-
else if (t.getKind() === r.ParenthesizedExpression) {
|
|
98
|
-
const g = t.getExpression();
|
|
99
|
-
g.getKind() === r.ObjectLiteralExpression && o(g);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
else {
|
|
104
|
-
const i = e;
|
|
105
|
-
if (i.getKind() === r.ParenthesizedExpression) {
|
|
106
|
-
const c = i.getExpression();
|
|
107
|
-
c.getKind() === r.ObjectLiteralExpression && o(c);
|
|
108
|
-
} else i.getKind() === r.ObjectLiteralExpression && o(i);
|
|
109
|
-
}
|
|
110
|
-
} else if (s) {
|
|
111
|
-
const e = s.getBody();
|
|
112
|
-
e && e.getDescendantsOfKind(r.ReturnStatement).forEach((c) => {
|
|
113
|
-
const t = c.getExpression();
|
|
114
|
-
if (t) {
|
|
115
|
-
if (t.getKind() === r.ObjectLiteralExpression)
|
|
116
|
-
o(t);
|
|
117
|
-
else if (t.getKind() === r.ParenthesizedExpression) {
|
|
118
|
-
const g = t.getExpression();
|
|
119
|
-
g.getKind() === r.ObjectLiteralExpression && o(g);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
n.formatText(), n.saveSync();
|
|
125
|
-
}
|
|
126
|
-
const j = `
|
|
127
|
-
<Navbar.Item
|
|
128
|
-
class="flex flex-col md:flex-row items-center space-y-2 md:space-y-0 md:space-x-4"
|
|
129
|
-
>
|
|
130
|
-
<AuthMenu.Root>
|
|
131
|
-
{#snippet user()}
|
|
132
|
-
<AuthMenu.Trigger>
|
|
133
|
-
<Avatar.Root>
|
|
134
|
-
{#if data.user?.avatar}
|
|
135
|
-
<Avatar.Image
|
|
136
|
-
src="/api/files/users/{data.user?.id}/{data.user?.avatar}"
|
|
137
|
-
alt={data.user?.email}
|
|
138
|
-
/>
|
|
139
|
-
{/if}
|
|
140
|
-
<Avatar.Fallback>
|
|
141
|
-
{data.user?.email?.charAt(0).toUpperCase()}
|
|
142
|
-
</Avatar.Fallback>
|
|
143
|
-
</Avatar.Root>
|
|
144
|
-
</AuthMenu.Trigger>
|
|
145
|
-
|
|
146
|
-
<AuthMenu.Content align="end">
|
|
147
|
-
<AuthMenu.Item href="/dashboard">Dashboard</AuthMenu.Item>
|
|
148
|
-
<AuthMenu.Group>
|
|
149
|
-
<AuthMenu.Item href="/settings">Settings</AuthMenu.Item>
|
|
150
|
-
<AuthMenu.Item>
|
|
151
|
-
<form action="/logout" method="post">
|
|
152
|
-
<button type="submit" class="contents">Logout</button>
|
|
153
|
-
</form>
|
|
154
|
-
</AuthMenu.Item>
|
|
155
|
-
</AuthMenu.Group>
|
|
156
|
-
</AuthMenu.Content>
|
|
157
|
-
{/snippet}
|
|
158
|
-
|
|
159
|
-
{#snippet guest()}
|
|
160
|
-
<Button
|
|
161
|
-
class="w-full justify-start md:justify-center md:w-auto"
|
|
162
|
-
variant="ghost"
|
|
163
|
-
href="/login">Login</Button
|
|
164
|
-
>
|
|
165
|
-
<Button
|
|
166
|
-
class="w-full justify-start md:justify-center md:w-auto"
|
|
167
|
-
variant="outline"
|
|
168
|
-
href="/signup">Sign up</Button
|
|
169
|
-
>
|
|
170
|
-
{/snippet}
|
|
171
|
-
</AuthMenu.Root>
|
|
172
|
-
</Navbar.Item>
|
|
173
|
-
`;
|
|
174
|
-
function L(a) {
|
|
175
|
-
if (!p.existsSync(a)) return !1;
|
|
176
|
-
const f = w.fromPath(a);
|
|
177
|
-
return !f.hasElement("Navbar.List") || f.hasElement("AuthMenu.Root") ? !1 : (f.modifyScript((n) => {
|
|
178
|
-
const { source: o } = K(n, (l) => {
|
|
179
|
-
T(l, [
|
|
180
|
-
{
|
|
181
|
-
namespaceImport: "AuthMenu",
|
|
182
|
-
moduleSpecifier: "$lib/components/ui/auth-menu"
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
namespaceImport: "Avatar",
|
|
186
|
-
moduleSpecifier: "$lib/components/ui/avatar"
|
|
187
|
-
}
|
|
188
|
-
]);
|
|
189
|
-
});
|
|
190
|
-
return o;
|
|
191
|
-
}), f.insertBeforeClosingTag("Navbar.List", j), f.writeTo(a), f.hasChanged());
|
|
192
|
-
}
|
|
193
|
-
function R(a) {
|
|
194
|
-
const n = new x().addSourceFileAtPath(a), o = n.getDescendantsOfKind(r.CallExpression).find((u) => u.getExpression().getText() === "handlePocketbase");
|
|
195
|
-
if (!o) {
|
|
196
|
-
n.saveSync();
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const l = o.getArguments();
|
|
200
|
-
if (l.length === 0) {
|
|
201
|
-
o.addArgument("{ auth: { protectedRoutes: ['/(app)'] } }"), n.formatText(), n.saveSync();
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
const s = l[0];
|
|
205
|
-
if (s.getKind() !== r.ObjectLiteralExpression) {
|
|
206
|
-
o.insertArgument(0, "{ auth: { protectedRoutes: ['/(app)'] } }"), n.formatText(), n.saveSync();
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
const d = s.asKindOrThrow(r.ObjectLiteralExpression), m = d.getProperty("auth");
|
|
210
|
-
if (!m) {
|
|
211
|
-
d.addPropertyAssignment({
|
|
212
|
-
name: "auth",
|
|
213
|
-
initializer: "{ protectedRoutes: ['/(app)'] }"
|
|
214
|
-
}), n.formatText(), n.saveSync();
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
if (m.getKind() === r.PropertyAssignment) {
|
|
218
|
-
const u = m.getInitializer();
|
|
219
|
-
if (u && u.getKind() === r.ObjectLiteralExpression) {
|
|
220
|
-
const e = u, i = e.getProperty("protectedRoutes");
|
|
221
|
-
if (!i)
|
|
222
|
-
e.addPropertyAssignment({
|
|
223
|
-
name: "protectedRoutes",
|
|
224
|
-
initializer: "['/(app)']"
|
|
225
|
-
});
|
|
226
|
-
else if (i.getKind() === r.PropertyAssignment) {
|
|
227
|
-
const c = i.getInitializer();
|
|
228
|
-
if (c && c.getKind() === r.ArrayLiteralExpression) {
|
|
229
|
-
const t = c;
|
|
230
|
-
t.getElements().some((h) => h.getText().replace(/['"`]/g, "") === "/(app)") || t.addElement("'/(app)'");
|
|
231
|
-
} else
|
|
232
|
-
i.setInitializer(
|
|
233
|
-
"['/(app)']"
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
n.formatText(), n.saveSync();
|
|
239
|
-
}
|
|
240
|
-
async function U(a) {
|
|
241
|
-
const { input: f } = a;
|
|
242
|
-
let n = [];
|
|
243
|
-
await S(a.root, async (m) => {
|
|
244
|
-
await m.settings.update({
|
|
245
|
-
meta: {
|
|
246
|
-
senderName: f.senderName,
|
|
247
|
-
senderAddress: f.senderAddress
|
|
248
|
-
}
|
|
249
|
-
}), await A();
|
|
250
|
-
const u = await m.collections.getOne("users");
|
|
251
|
-
if (!u)
|
|
252
|
-
throw new Error("Users collection not found");
|
|
253
|
-
const e = u.verificationTemplate.body.replace(
|
|
254
|
-
"{APP_URL}/_/#/auth/confirm-verification/{TOKEN}",
|
|
255
|
-
"{APP_URL}/confirm-verification/{TOKEN}"
|
|
256
|
-
), i = u.resetPasswordTemplate.body.replace(
|
|
257
|
-
"{APP_URL}/_/#/auth/confirm-reset/{TOKEN}",
|
|
258
|
-
"{APP_URL}/confirm-reset/{TOKEN}"
|
|
259
|
-
), c = u.confirmEmailChangeTemplate.body.replace(
|
|
260
|
-
"{APP_URL}/_/#/auth/confirm-email-change/{TOKEN}",
|
|
261
|
-
"{APP_URL}/confirm-email-change/{TOKEN}"
|
|
262
|
-
);
|
|
263
|
-
await m.collections.update("users", {
|
|
264
|
-
listRule: "@request.auth.id = id",
|
|
265
|
-
viewRule: "@request.auth.id = id",
|
|
266
|
-
createRule: "@request.auth.id = id",
|
|
267
|
-
updateRule: "@request.auth.id = id",
|
|
268
|
-
deleteRule: "@request.auth.id = id",
|
|
269
|
-
// Update email templates to VelaStack auth urls
|
|
270
|
-
verificationTemplate: {
|
|
271
|
-
body: e
|
|
272
|
-
},
|
|
273
|
-
resetPasswordTemplate: {
|
|
274
|
-
body: i
|
|
275
|
-
},
|
|
276
|
-
confirmEmailChangeTemplate: {
|
|
277
|
-
body: c
|
|
278
|
-
}
|
|
279
|
-
}), await A();
|
|
280
|
-
const t = v("users", "updated", a);
|
|
281
|
-
t && n.push({
|
|
282
|
-
path: t,
|
|
283
|
-
language: "ts",
|
|
284
|
-
content: p.readFileSync(t, "utf8")
|
|
285
|
-
});
|
|
286
|
-
});
|
|
287
|
-
let o = [];
|
|
288
|
-
const l = y.join(
|
|
289
|
-
a.root,
|
|
290
|
-
"src",
|
|
291
|
-
"routes",
|
|
292
|
-
"+layout.server.ts"
|
|
293
|
-
);
|
|
294
|
-
await F(l), o.push({
|
|
295
|
-
path: l,
|
|
296
|
-
language: "ts",
|
|
297
|
-
content: p.readFileSync(l, "utf8")
|
|
298
|
-
});
|
|
299
|
-
let s = y.join(
|
|
300
|
-
a.root,
|
|
301
|
-
"src",
|
|
302
|
-
"routes",
|
|
303
|
-
"(public)",
|
|
304
|
-
"root-layout.svelte"
|
|
305
|
-
);
|
|
306
|
-
p.existsSync(s) || (s = y.join(a.root, "src", "routes", "root-layout.svelte")), p.existsSync(s) || (s = y.join(
|
|
307
|
-
a.root,
|
|
308
|
-
"src",
|
|
309
|
-
"routes",
|
|
310
|
-
"(public)",
|
|
311
|
-
"+layout.svelte"
|
|
312
|
-
)), p.existsSync(s) || (s = y.join(a.root, "src", "routes", "+layout.svelte")), p.existsSync(s) && (L(s), o.push({
|
|
313
|
-
path: s,
|
|
314
|
-
language: "svelte",
|
|
315
|
-
content: p.readFileSync(s, "utf8")
|
|
316
|
-
}));
|
|
317
|
-
const d = y.join(a.root, "src", "hooks.server.ts");
|
|
318
|
-
return p.existsSync(d) && (R(d), o.push({
|
|
319
|
-
path: d,
|
|
320
|
-
language: "ts",
|
|
321
|
-
content: p.readFileSync(d, "utf8")
|
|
322
|
-
})), {
|
|
323
|
-
creates: [],
|
|
324
|
-
modifies: o,
|
|
325
|
-
deletes: [],
|
|
326
|
-
components: [],
|
|
327
|
-
packages: [],
|
|
328
|
-
collections: []
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
export {
|
|
332
|
-
U as generate
|
|
333
|
-
};
|
|
334
|
-
//# sourceMappingURL=generate.runtime-BQFcrwn8.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-BQFcrwn8.js","sources":["../../src/patterns/enable/auth/modifies/+layout.server.ts","../../src/patterns/enable/auth/modifies/root-layout.svelte.ts","../../src/patterns/enable/auth/modifies/hooks.server.ts","../../src/patterns/enable/auth/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, SyntaxKind } from \"ts-morph\";\n\nexport function modifyLayoutServer(layoutPath: string) {\n if (!fs.existsSync(layoutPath)) {\n // write file directly\n\n const snippet = dedent`\n\t\t\texport const load = async ({ locals }) => {\n\t\t\t\treturn { user: locals.pb.authStore.record };\n\t\t\t};\n\t\t`;\n\n fs.writeFileSync(layoutPath, snippet);\n return;\n }\n\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(layoutPath);\n\n // helper to add user property to an object literal if missing\n const addUserProp = (obj: import(\"ts-morph\").ObjectLiteralExpression) => {\n const hasUser = !!obj.getProperty(\"user\");\n if (!hasUser) {\n obj.addPropertyAssignment({\n name: \"user\",\n initializer: \"locals.pb.authStore.record\",\n });\n }\n };\n\n // find existing exported load (function or const with arrow)\n let loadArrow: import(\"ts-morph\").ArrowFunction | undefined;\n let loadFn:\n | import(\"ts-morph\").FunctionDeclaration\n | import(\"ts-morph\").FunctionExpression\n | undefined;\n\n const varDecl = sourceFile.getVariableDeclaration(\"load\");\n if (varDecl) {\n const vs = varDecl.getFirstAncestorByKind(SyntaxKind.VariableStatement);\n const isExported = !!vs?.hasExportKeyword();\n if (isExported) {\n const directArrow = varDecl.getInitializerIfKind(\n SyntaxKind.ArrowFunction,\n );\n if (directArrow) {\n loadArrow = directArrow;\n } else {\n const init = varDecl.getInitializer();\n if (init) {\n const innerArrow = init.getFirstDescendantByKind(\n SyntaxKind.ArrowFunction,\n );\n if (innerArrow) {\n loadArrow = innerArrow;\n } else {\n const innerFnExpr = init.getFirstDescendantByKind(\n SyntaxKind.FunctionExpression,\n );\n if (innerFnExpr) {\n loadFn = innerFnExpr;\n }\n }\n }\n }\n }\n }\n\n if (!loadArrow) {\n const maybeFn = sourceFile.getFunction(\"load\");\n if (maybeFn && maybeFn.isExported()) {\n loadFn = maybeFn;\n }\n }\n\n // if no load found, create one\n if (!loadArrow && !loadFn) {\n sourceFile.addFunction({\n isExported: true,\n isAsync: true,\n name: \"load\",\n parameters: [{ name: \"{ locals }\" }],\n statements: `return { user: locals.pb.authStore.record };`,\n });\n sourceFile.formatText();\n sourceFile.saveSync();\n return;\n }\n\n // normalize function-like to a single handle\n const fnLike:\n | import(\"ts-morph\").ArrowFunction\n | import(\"ts-morph\").FunctionDeclaration\n | import(\"ts-morph\").FunctionExpression = (loadArrow ?? loadFn!) as any;\n\n // ensure first parameter destructures locals, preserving existing information\n const params = fnLike.getParameters();\n if (params.length === 0) {\n fnLike.insertParameter(0, { name: \"{ locals }\" });\n } else {\n const first = params[0];\n const original = first.getStructure();\n const nameNode = first.getNameNode();\n if (nameNode.getKind() === SyntaxKind.ObjectBindingPattern) {\n const obp = nameNode as import(\"ts-morph\").ObjectBindingPattern;\n const hasLocals = obp\n .getElements()\n .some((el) => el.getName() === \"locals\");\n if (!hasLocals) {\n const parts = obp\n .getElements()\n .map((el) => el.getText())\n .filter(Boolean);\n const tail = parts.length > 0 ? \", \" + parts.join(\", \") : \"\";\n first.set({\n name: `{ locals${tail} }`,\n type: original.type,\n initializer: (original as any).initializer,\n });\n }\n } else {\n const currentName = first.getName();\n if (currentName !== \"locals\") {\n first.set({\n name: `{ locals, ...${currentName} }`,\n type: original.type,\n initializer: (original as any).initializer,\n });\n }\n }\n }\n\n // add user to returned object literals without altering other properties\n if (loadArrow) {\n const body = loadArrow.getBody();\n if (body.getKind() === SyntaxKind.Block) {\n const returns = body.getDescendantsOfKind(SyntaxKind.ReturnStatement);\n returns.forEach((ret) => {\n const expr = ret.getExpression();\n if (!expr) return;\n if (expr.getKind() === SyntaxKind.ObjectLiteralExpression) {\n addUserProp(expr as import(\"ts-morph\").ObjectLiteralExpression);\n } else if (expr.getKind() === SyntaxKind.ParenthesizedExpression) {\n const inner = (\n expr as import(\"ts-morph\").ParenthesizedExpression\n ).getExpression();\n if (inner.getKind() === SyntaxKind.ObjectLiteralExpression) {\n addUserProp(inner as import(\"ts-morph\").ObjectLiteralExpression);\n }\n }\n });\n } else {\n // concise body\n const bodyExpr = body as import(\"ts-morph\").Expression;\n if (bodyExpr.getKind() === SyntaxKind.ParenthesizedExpression) {\n const inner = (\n bodyExpr as import(\"ts-morph\").ParenthesizedExpression\n ).getExpression();\n if (inner.getKind() === SyntaxKind.ObjectLiteralExpression) {\n addUserProp(inner as import(\"ts-morph\").ObjectLiteralExpression);\n }\n } else if (bodyExpr.getKind() === SyntaxKind.ObjectLiteralExpression) {\n addUserProp(bodyExpr as import(\"ts-morph\").ObjectLiteralExpression);\n }\n }\n } else if (loadFn) {\n const body = loadFn.getBody();\n if (body) {\n const returns = body.getDescendantsOfKind(SyntaxKind.ReturnStatement);\n returns.forEach((ret) => {\n const expr = ret.getExpression();\n if (!expr) return;\n if (expr.getKind() === SyntaxKind.ObjectLiteralExpression) {\n addUserProp(expr as import(\"ts-morph\").ObjectLiteralExpression);\n } else if (expr.getKind() === SyntaxKind.ParenthesizedExpression) {\n const inner = (\n expr as import(\"ts-morph\").ParenthesizedExpression\n ).getExpression();\n if (inner.getKind() === SyntaxKind.ObjectLiteralExpression) {\n addUserProp(inner as import(\"ts-morph\").ObjectLiteralExpression);\n }\n }\n });\n }\n }\n\n sourceFile.formatText();\n sourceFile.saveSync();\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureImports,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nconst AUTH_MENU_NAVBAR_ITEM = `\n\t\t<Navbar.Item\n\t\t\tclass=\"flex flex-col md:flex-row items-center space-y-2 md:space-y-0 md:space-x-4\"\n\t\t>\n\t\t\t<AuthMenu.Root>\n\t\t\t\t{#snippet user()}\n\t\t\t\t\t<AuthMenu.Trigger>\n\t\t\t\t\t\t<Avatar.Root>\n\t\t\t\t\t\t\t{#if data.user?.avatar}\n\t\t\t\t\t\t\t\t<Avatar.Image\n\t\t\t\t\t\t\t\t\tsrc=\"/api/files/users/{data.user?.id}/{data.user?.avatar}\"\n\t\t\t\t\t\t\t\t\talt={data.user?.email}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{/if}\n\t\t\t\t\t\t\t<Avatar.Fallback>\n\t\t\t\t\t\t\t\t{data.user?.email?.charAt(0).toUpperCase()}\n\t\t\t\t\t\t\t</Avatar.Fallback>\n\t\t\t\t\t\t</Avatar.Root>\n\t\t\t\t\t</AuthMenu.Trigger>\n\n\t\t\t\t\t<AuthMenu.Content align=\"end\">\n\t\t\t\t\t\t<AuthMenu.Item href=\"/dashboard\">Dashboard</AuthMenu.Item>\n\t\t\t\t\t\t<AuthMenu.Group>\n\t\t\t\t\t\t\t<AuthMenu.Item href=\"/settings\">Settings</AuthMenu.Item>\n\t\t\t\t\t\t\t<AuthMenu.Item>\n\t\t\t\t\t\t\t\t<form action=\"/logout\" method=\"post\">\n\t\t\t\t\t\t\t\t\t<button type=\"submit\" class=\"contents\">Logout</button>\n\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t</AuthMenu.Item>\n\t\t\t\t\t\t</AuthMenu.Group>\n\t\t\t\t\t</AuthMenu.Content>\n\t\t\t\t{/snippet}\n\n\t\t\t\t{#snippet guest()}\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclass=\"w-full justify-start md:justify-center md:w-auto\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\thref=\"/login\">Login</Button\n\t\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclass=\"w-full justify-start md:justify-center md:w-auto\"\n\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\thref=\"/signup\">Sign up</Button\n\t\t\t\t\t>\n\t\t\t\t{/snippet}\n\t\t\t</AuthMenu.Root>\n\t\t</Navbar.Item>\n\t`;\n\nexport function modifyRootLayoutSvelte(layoutPath: string): boolean {\n if (!fs.existsSync(layoutPath)) return false;\n\n const file = SvelteFile.fromPath(layoutPath);\n if (!file.hasElement(\"Navbar.List\")) return false;\n if (file.hasElement(\"AuthMenu.Root\")) return false;\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n {\n namespaceImport: \"AuthMenu\",\n moduleSpecifier: \"$lib/components/ui/auth-menu\",\n },\n {\n namespaceImport: \"Avatar\",\n moduleSpecifier: \"$lib/components/ui/avatar\",\n },\n ]);\n });\n return out;\n });\n\n file.insertBeforeClosingTag(\"Navbar.List\", AUTH_MENU_NAVBAR_ITEM);\n file.writeTo(layoutPath);\n return file.hasChanged();\n}\n","import { Project, SyntaxKind } from \"ts-morph\";\n\nexport function modifyHooksServer(hooksServerPath: string) {\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n // Find the handlePocketbase(...) call\n const callExpr = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((ce) => ce.getExpression().getText() === \"handlePocketbase\");\n\n if (!callExpr) {\n sourceFile.saveSync();\n return;\n }\n\n const args = callExpr.getArguments();\n if (args.length === 0) {\n // Create an options object if missing\n callExpr.addArgument(`{ auth: { protectedRoutes: ['/(app)'] } }`);\n sourceFile.formatText();\n sourceFile.saveSync();\n return;\n }\n\n const firstArg = args[0];\n if (firstArg.getKind() !== SyntaxKind.ObjectLiteralExpression) {\n // Replace non-object first arg with an object including auth\n callExpr.insertArgument(0, `{ auth: { protectedRoutes: ['/(app)'] } }`);\n sourceFile.formatText();\n sourceFile.saveSync();\n return;\n }\n\n const optionsObj = firstArg.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);\n\n // Ensure auth property exists\n const authProp = optionsObj.getProperty(\"auth\");\n if (!authProp) {\n optionsObj.addPropertyAssignment({\n name: \"auth\",\n initializer: `{ protectedRoutes: ['/(app)'] }`,\n });\n sourceFile.formatText();\n sourceFile.saveSync();\n return;\n }\n\n // If auth exists, ensure protectedRoutes includes '/(app)'\n if (authProp.getKind() === SyntaxKind.PropertyAssignment) {\n const authInit = (\n authProp as import(\"ts-morph\").PropertyAssignment\n ).getInitializer();\n if (authInit && authInit.getKind() === SyntaxKind.ObjectLiteralExpression) {\n const authObj = authInit as import(\"ts-morph\").ObjectLiteralExpression;\n const prProp = authObj.getProperty(\"protectedRoutes\");\n if (!prProp) {\n authObj.addPropertyAssignment({\n name: \"protectedRoutes\",\n initializer: `['/(app)']`,\n });\n } else if (prProp.getKind() === SyntaxKind.PropertyAssignment) {\n const prInit = (\n prProp as import(\"ts-morph\").PropertyAssignment\n ).getInitializer();\n if (prInit && prInit.getKind() === SyntaxKind.ArrayLiteralExpression) {\n const arr = prInit as import(\"ts-morph\").ArrayLiteralExpression;\n const hasApp = arr\n .getElements()\n .some((el) => el.getText().replace(/['\"`]/g, \"\") === \"/(app)\");\n if (!hasApp) {\n arr.addElement(`'/(app)'`);\n }\n } else {\n // Replace non-array with desired value\n (prProp as import(\"ts-morph\").PropertyAssignment).setInitializer(\n `['/(app)']`,\n );\n }\n }\n }\n }\n\n sourceFile.formatText();\n sourceFile.saveSync();\n}\n","import path from \"node:path\";\nimport fs from \"node:fs\";\nimport { Options, Result, File } from \"../../../core/types\";\nimport {\n getMigrationFile,\n migrationDelay,\n withPocketbase,\n} from \"../../../runtime/pocketbase\";\n\nimport { modifyLayoutServer } from \"./modifies/+layout.server\";\nimport { modifyRootLayoutSvelte } from \"./modifies/root-layout.svelte\";\nimport { modifyHooksServer } from \"./modifies/hooks.server\";\n\nexport async function generate(options: Options) {\n const { input } = options;\n\n let creates: File[] = [];\n\n // Update PocketBase\n await withPocketbase(options.root, async (pb) => {\n await pb.settings.update({\n meta: {\n senderName: input.senderName,\n senderAddress: input.senderAddress,\n },\n });\n await migrationDelay();\n\n const userCollection = await pb.collections.getOne(\"users\");\n\n if (!userCollection) {\n throw new Error(\"Users collection not found\");\n }\n\n const verificationTemplate =\n userCollection.verificationTemplate.body.replace(\n \"{APP_URL}/_/#/auth/confirm-verification/{TOKEN}\",\n \"{APP_URL}/confirm-verification/{TOKEN}\",\n );\n const resetPasswordTemplate =\n userCollection.resetPasswordTemplate.body.replace(\n \"{APP_URL}/_/#/auth/confirm-reset/{TOKEN}\",\n \"{APP_URL}/confirm-reset/{TOKEN}\",\n );\n const confirmEmailChangeTemplate =\n userCollection.confirmEmailChangeTemplate.body.replace(\n \"{APP_URL}/_/#/auth/confirm-email-change/{TOKEN}\",\n \"{APP_URL}/confirm-email-change/{TOKEN}\",\n );\n\n // Update user auth rules to lock down access to the user's own account\n await pb.collections.update(\"users\", {\n listRule: \"@request.auth.id = id\",\n viewRule: \"@request.auth.id = id\",\n createRule: \"@request.auth.id = id\",\n updateRule: \"@request.auth.id = id\",\n deleteRule: \"@request.auth.id = id\",\n\n // Update email templates to VelaStack auth urls\n verificationTemplate: {\n body: verificationTemplate,\n },\n resetPasswordTemplate: {\n body: resetPasswordTemplate,\n },\n confirmEmailChangeTemplate: {\n body: confirmEmailChangeTemplate,\n },\n });\n await migrationDelay();\n\n const migrationFile = getMigrationFile(\"users\", \"updated\", options);\n if (migrationFile) {\n creates.push({\n path: migrationFile,\n language: \"ts\",\n content: fs.readFileSync(migrationFile, \"utf8\"),\n });\n }\n });\n\n // Modify files\n let modifies: File[] = [];\n\n const layoutServerFile = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n\n await modifyLayoutServer(layoutServerFile);\n modifies.push({\n path: layoutServerFile,\n language: \"ts\",\n content: fs.readFileSync(layoutServerFile, \"utf8\"),\n });\n\n // TODO: make this more robust by searching for Navbar.Root > Navbar.List\n // src/routes/(public)/root-layout.svelte is what vela creates by default\n let layoutFile = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"root-layout.svelte\",\n );\n\n if (!fs.existsSync(layoutFile)) {\n layoutFile = path.join(options.root, \"src\", \"routes\", \"root-layout.svelte\");\n }\n\n if (!fs.existsSync(layoutFile)) {\n layoutFile = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"+layout.svelte\",\n );\n }\n\n if (!fs.existsSync(layoutFile)) {\n layoutFile = path.join(options.root, \"src\", \"routes\", \"+layout.svelte\");\n }\n\n if (fs.existsSync(layoutFile)) {\n modifyRootLayoutSvelte(layoutFile);\n modifies.push({\n path: layoutFile,\n language: \"svelte\",\n content: fs.readFileSync(layoutFile, \"utf8\"),\n });\n }\n\n const hooksServerFile = path.join(options.root, \"src\", \"hooks.server.ts\");\n\n if (fs.existsSync(hooksServerFile)) {\n modifyHooksServer(hooksServerFile);\n modifies.push({\n path: hooksServerFile,\n language: \"ts\",\n content: fs.readFileSync(hooksServerFile, \"utf8\"),\n });\n }\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n } satisfies Result;\n}\n"],"names":["modifyLayoutServer","layoutPath","fs","snippet","dedent","sourceFile","Project","addUserProp","obj","loadArrow","loadFn","varDecl","vs","SyntaxKind","directArrow","init","innerArrow","innerFnExpr","maybeFn","fnLike","params","first","original","nameNode","obp","el","parts","tail","currentName","body","ret","expr","inner","bodyExpr","AUTH_MENU_NAVBAR_ITEM","modifyRootLayoutSvelte","file","SvelteFile","source","out","withInMemoryScript","sf","ensureImports","modifyHooksServer","hooksServerPath","callExpr","ce","args","firstArg","optionsObj","authProp","authInit","authObj","prProp","prInit","arr","generate","options","input","creates","withPocketbase","pb","migrationDelay","userCollection","verificationTemplate","resetPasswordTemplate","confirmEmailChangeTemplate","migrationFile","getMigrationFile","modifies","layoutServerFile","path","layoutFile","hooksServerFile"],"mappings":";;;;;;AAIO,SAASA,EAAmBC,GAAoB;AACrD,MAAI,CAACC,EAAG,WAAWD,CAAU,GAAG;AAG9B,UAAME,IAAUC;AAAA;AAAA;AAAA;AAAA;AAMhB,IAAAF,EAAG,cAAcD,GAAYE,CAAO;AACpC;AAAA,EACF;AAGA,QAAME,IADU,IAAIC,EAAA,EACO,oBAAoBL,CAAU,GAGnDM,IAAc,CAACC,MAAoD;AAEvE,IADgB,CAAC,CAACA,EAAI,YAAY,MAAM,KAEtCA,EAAI,sBAAsB;AAAA,MACxB,MAAM;AAAA,MACN,aAAa;AAAA,IAAA,CACd;AAAA,EAEL;AAGA,MAAIC,GACAC;AAKJ,QAAMC,IAAUN,EAAW,uBAAuB,MAAM;AACxD,MAAIM,GAAS;AACX,UAAMC,IAAKD,EAAQ,uBAAuBE,EAAW,iBAAiB;AAEtE,QADmB,CAAC,EAACD,KAAA,QAAAA,EAAI,qBACT;AACd,YAAME,IAAcH,EAAQ;AAAA,QAC1BE,EAAW;AAAA,MAAA;AAEb,UAAIC;AACF,QAAAL,IAAYK;AAAA,WACP;AACL,cAAMC,IAAOJ,EAAQ,eAAA;AACrB,YAAII,GAAM;AACR,gBAAMC,IAAaD,EAAK;AAAA,YACtBF,EAAW;AAAA,UAAA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