@velastack/patterns 0.0.3 → 0.0.5
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-Hdx-NhPn.js → collections-DVLGhVXc.js} +3 -3
- package/dist/chunks/{collections-Hdx-NhPn.js.map → collections-DVLGhVXc.js.map} +1 -1
- package/dist/chunks/{env.runtime-B18zkdjb.js → env.runtime-BzRhpNR3.js} +2 -2
- package/dist/chunks/{env.runtime-B18zkdjb.js.map → env.runtime-BzRhpNR3.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B5XT4Q2Z.js → generate.runtime-BCboVR38.js} +3 -3
- package/dist/chunks/{generate.runtime-B5XT4Q2Z.js.map → generate.runtime-BCboVR38.js.map} +1 -1
- package/dist/chunks/{index-Crknwby3.js → index-DBV0rNRK.js} +363 -356
- package/dist/chunks/index-DBV0rNRK.js.map +1 -0
- package/dist/chunks/{pocketbase-BBMFXc3L.js → pocketbase-PTRPGp8W.js} +2 -2
- package/dist/chunks/{pocketbase-BBMFXc3L.js.map → pocketbase-PTRPGp8W.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +23 -4
- package/dist/chunks/index-Crknwby3.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
function
|
|
1
|
+
import re from "prettier";
|
|
2
|
+
import ae from "prettier-plugin-svelte";
|
|
3
|
+
function oe(t) {
|
|
4
4
|
return t.language === "ts" || t.language === "svelte" || t.path.endsWith(".json");
|
|
5
5
|
}
|
|
6
|
-
async function
|
|
7
|
-
if (!
|
|
6
|
+
async function se(t) {
|
|
7
|
+
if (!oe(t))
|
|
8
8
|
return t;
|
|
9
9
|
try {
|
|
10
|
-
const e = await
|
|
10
|
+
const e = await re.format(t.content, {
|
|
11
11
|
filepath: t.path,
|
|
12
|
-
plugins: [
|
|
12
|
+
plugins: [ae]
|
|
13
13
|
});
|
|
14
14
|
return {
|
|
15
15
|
...t,
|
|
@@ -20,7 +20,7 @@ async function le(t) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
async function ct(t) {
|
|
23
|
-
return Promise.all(t.map((e) =>
|
|
23
|
+
return Promise.all(t.map((e) => se(e)));
|
|
24
24
|
}
|
|
25
25
|
async function k(t) {
|
|
26
26
|
const [e, n] = await Promise.all([
|
|
@@ -47,21 +47,21 @@ function ut(t) {
|
|
|
47
47
|
for (var e = 1; e < arguments.length; e++) {
|
|
48
48
|
var n = arguments[e] != null ? arguments[e] : {};
|
|
49
49
|
e % 2 ? mt(Object(n), !0).forEach(function(r) {
|
|
50
|
-
|
|
50
|
+
ie(t, r, n[r]);
|
|
51
51
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : mt(Object(n)).forEach(function(r) {
|
|
52
52
|
Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
return t;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
return e =
|
|
57
|
+
function ie(t, e, n) {
|
|
58
|
+
return e = le(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
var e =
|
|
60
|
+
function le(t) {
|
|
61
|
+
var e = ce(t, "string");
|
|
62
62
|
return typeof e == "symbol" ? e : String(e);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function ce(t, e) {
|
|
65
65
|
if (typeof t != "object" || t === null) return t;
|
|
66
66
|
var n = t[Symbol.toPrimitive];
|
|
67
67
|
if (n !== void 0) {
|
|
@@ -84,7 +84,7 @@ function zt(t) {
|
|
|
84
84
|
for (let f = 0; f < a.length; f++) {
|
|
85
85
|
let g = a[f];
|
|
86
86
|
if (i && (g = g.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), c += g, f < r.length) {
|
|
87
|
-
const x = s ?
|
|
87
|
+
const x = s ? me(r[f], c) : r[f];
|
|
88
88
|
c += x;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -115,7 +115,7 @@ function zt(t) {
|
|
|
115
115
|
)), c;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function me(t, e) {
|
|
119
119
|
if (typeof t != "string" || !t.includes(`
|
|
120
120
|
`))
|
|
121
121
|
return t;
|
|
@@ -147,7 +147,7 @@ function pt(t) {
|
|
|
147
147
|
}
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
|
-
const
|
|
150
|
+
const ue = {
|
|
151
151
|
text: ["form", "input"],
|
|
152
152
|
number: ["form", "input"],
|
|
153
153
|
email: ["form", "input"],
|
|
@@ -162,7 +162,7 @@ const de = {
|
|
|
162
162
|
url: ["form", "input"],
|
|
163
163
|
editor: ["form", "textarea"],
|
|
164
164
|
autodate: ["form", "input"]
|
|
165
|
-
},
|
|
165
|
+
}, pe = {
|
|
166
166
|
form: ['import * as Form from "$lib/components/ui/form";'],
|
|
167
167
|
"file-form": ['import * as FileForm from "$lib/components/ui/file-form";'],
|
|
168
168
|
multiselect: [
|
|
@@ -204,7 +204,7 @@ function z(t, e) {
|
|
|
204
204
|
</Form.Field>
|
|
205
205
|
`;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function de(t) {
|
|
208
208
|
const e = t.required ? " required" : "";
|
|
209
209
|
return p`
|
|
210
210
|
<Form.Field {form} name="${t.name}" class="col-span-2">
|
|
@@ -218,7 +218,7 @@ function he(t) {
|
|
|
218
218
|
</Form.Field>
|
|
219
219
|
`;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function fe(t) {
|
|
222
222
|
const e = t.required ? " required" : "";
|
|
223
223
|
return p`
|
|
224
224
|
<Form.Field {form} name="${t.name}" class="col-span-1 flex items-start space-x-2">
|
|
@@ -232,7 +232,7 @@ function ge(t) {
|
|
|
232
232
|
</Form.Field>
|
|
233
233
|
`;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function he(t) {
|
|
236
236
|
return p`
|
|
237
237
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
238
238
|
<Form.Control>
|
|
@@ -245,7 +245,7 @@ function be(t) {
|
|
|
245
245
|
</Form.Field>
|
|
246
246
|
`;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function ge(t) {
|
|
249
249
|
const e = t.required ? " required" : "", n = t.maxSelect > 1 ? "Multiple" : "Single";
|
|
250
250
|
return p`
|
|
251
251
|
<FileForm.Field {form} name="${t.name}" class="col-span-1">
|
|
@@ -272,7 +272,7 @@ function ve(t) {
|
|
|
272
272
|
</FileForm.Field>
|
|
273
273
|
`;
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function be(t) {
|
|
276
276
|
const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", r = t.maxSelect > 1 ? "Select options" : "Select an option", a = t.options.map(
|
|
277
277
|
(s) => `<MultiSelect.Item value=${JSON.stringify(s.value)} label={${t.name}Labels[${JSON.stringify(s.value)}].label} />`
|
|
278
278
|
).join(`
|
|
@@ -310,7 +310,7 @@ function we(t) {
|
|
|
310
310
|
</MultiSelect.Field>
|
|
311
311
|
`;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function ve(t) {
|
|
314
314
|
const e = t.maxSelect > 1 ? "multiple" : "single", n = t.maxSelect > 1 ? `Select ${t.relatedModel.pluralDisplayName.toLowerCase()}` : `Select ${t.relatedModel.displayName.toLowerCase()}`, r = `Search ${t.relatedModel.pluralDisplayName.toLowerCase()}...`, a = `No ${t.relatedModel.pluralDisplayName.toLowerCase()} found`, s = t.relatedModel.name, i = t.relatedModel.pluralName;
|
|
315
315
|
return p`
|
|
316
316
|
<MultiSelect.Field {form} type="${e}" name="${t.name}" class="col-span-1">
|
|
@@ -348,7 +348,7 @@ function ye(t) {
|
|
|
348
348
|
</MultiSelect.Field>
|
|
349
349
|
`;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function we(t) {
|
|
352
352
|
return p`
|
|
353
353
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
354
354
|
<Form.Control>
|
|
@@ -376,20 +376,20 @@ function et(t) {
|
|
|
376
376
|
case "url":
|
|
377
377
|
return z(t, "url");
|
|
378
378
|
case "autodate":
|
|
379
|
-
return
|
|
379
|
+
return we(t);
|
|
380
380
|
case "editor":
|
|
381
381
|
case "json":
|
|
382
|
-
return
|
|
382
|
+
return de(t);
|
|
383
383
|
case "bool":
|
|
384
|
-
return
|
|
384
|
+
return fe(t);
|
|
385
385
|
case "geoPoint":
|
|
386
|
-
return
|
|
386
|
+
return he(t);
|
|
387
387
|
case "file":
|
|
388
|
-
return
|
|
388
|
+
return ge(t);
|
|
389
389
|
case "select":
|
|
390
|
-
return
|
|
390
|
+
return be(t);
|
|
391
391
|
case "relation":
|
|
392
|
-
return
|
|
392
|
+
return ve(t);
|
|
393
393
|
default:
|
|
394
394
|
return t;
|
|
395
395
|
}
|
|
@@ -411,11 +411,11 @@ function At(t) {
|
|
|
411
411
|
`;
|
|
412
412
|
}
|
|
413
413
|
function O(t) {
|
|
414
|
-
const e = t.flatMap((n) =>
|
|
414
|
+
const e = t.flatMap((n) => ue[n.type]);
|
|
415
415
|
return [...new Set(e)];
|
|
416
416
|
}
|
|
417
417
|
function nt(t) {
|
|
418
|
-
return [...new Set(t.flatMap((e) =>
|
|
418
|
+
return [...new Set(t.flatMap((e) => pe[e]))];
|
|
419
419
|
}
|
|
420
420
|
function M(t, e) {
|
|
421
421
|
return `data.${t.name}.${e.name}`;
|
|
@@ -428,7 +428,7 @@ function J(t, e, n) {
|
|
|
428
428
|
</div>
|
|
429
429
|
`;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function ye(t, e) {
|
|
432
432
|
const n = M(t, e), r = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, a = e.required ? r : p`
|
|
433
433
|
{#if ${n}}
|
|
434
434
|
${r}
|
|
@@ -441,7 +441,7 @@ function $e(t, e) {
|
|
|
441
441
|
</div>
|
|
442
442
|
`;
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function xe(t, e) {
|
|
445
445
|
const n = M(t, e), r = p`
|
|
446
446
|
<a href={${n}} target="_blank" rel="noopener noreferrer">
|
|
447
447
|
{${n}}
|
|
@@ -460,7 +460,7 @@ function Fe(t, e) {
|
|
|
460
460
|
</div>
|
|
461
461
|
`;
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function $e(t, e) {
|
|
464
464
|
const n = M(t, e);
|
|
465
465
|
if (e.maxSelect > 1)
|
|
466
466
|
return p`
|
|
@@ -483,7 +483,7 @@ function Ce(t, e) {
|
|
|
483
483
|
</div>
|
|
484
484
|
`;
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Fe(t, e) {
|
|
487
487
|
const n = M(t, e);
|
|
488
488
|
return e.maxSelect > 1 ? p`
|
|
489
489
|
<div class="space-y-2">
|
|
@@ -529,11 +529,11 @@ function _e(t, e) {
|
|
|
529
529
|
</div>
|
|
530
530
|
`;
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function Ce(t) {
|
|
533
533
|
return `/${t.relatedModel.routeSegment}`;
|
|
534
534
|
}
|
|
535
|
-
function
|
|
536
|
-
const n = `data.${t.name}.expand?.${e.name}`, r =
|
|
535
|
+
function _e(t, e) {
|
|
536
|
+
const n = `data.${t.name}.expand?.${e.name}`, r = Ce(e);
|
|
537
537
|
return e.maxSelect > 1 ? p`
|
|
538
538
|
<div class="space-y-2">
|
|
539
539
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
@@ -560,7 +560,7 @@ function ke(t, e) {
|
|
|
560
560
|
</div>
|
|
561
561
|
`;
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Se(t, e) {
|
|
564
564
|
const n = M(t, e), r = p`
|
|
565
565
|
{#await import("$lib/components/ui/leaflet/leaflet.svelte")}
|
|
566
566
|
<div class="h-56.25 w-full bg-input rounded-md"></div>
|
|
@@ -582,7 +582,7 @@ function Me(t, e) {
|
|
|
582
582
|
</div>
|
|
583
583
|
`;
|
|
584
584
|
}
|
|
585
|
-
function
|
|
585
|
+
function ke(t, e) {
|
|
586
586
|
switch (e.type) {
|
|
587
587
|
case "text":
|
|
588
588
|
case "number":
|
|
@@ -606,27 +606,27 @@ function Re(t, e) {
|
|
|
606
606
|
);
|
|
607
607
|
case "date":
|
|
608
608
|
case "autodate":
|
|
609
|
-
return
|
|
609
|
+
return ye(t, e);
|
|
610
610
|
case "url":
|
|
611
|
-
return
|
|
611
|
+
return xe(t, e);
|
|
612
612
|
case "select":
|
|
613
|
-
return
|
|
613
|
+
return $e(t, e);
|
|
614
614
|
case "file":
|
|
615
|
-
return
|
|
615
|
+
return Fe(t, e);
|
|
616
616
|
case "json":
|
|
617
617
|
return J(t, e, `{JSON.stringify(${M(t, e)})}`);
|
|
618
618
|
case "geoPoint":
|
|
619
|
-
return
|
|
619
|
+
return Se(t, e);
|
|
620
620
|
case "relation":
|
|
621
|
-
return
|
|
621
|
+
return _e(t, e);
|
|
622
622
|
default:
|
|
623
623
|
return e;
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
const
|
|
626
|
+
const Me = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), Re = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), Pe = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), Ee = /[^\p{L}\d]+/giu, dt = "$1\0$2", ft = "";
|
|
627
627
|
function Nt(t) {
|
|
628
628
|
let e = t.trim();
|
|
629
|
-
e = e.replace(
|
|
629
|
+
e = e.replace(Me, dt).replace(Re, dt), e = e.replace(Ee, "\0");
|
|
630
630
|
let n = 0, r = e.length;
|
|
631
631
|
for (; e.charAt(n) === "\0"; )
|
|
632
632
|
n++;
|
|
@@ -636,10 +636,10 @@ function Nt(t) {
|
|
|
636
636
|
r--;
|
|
637
637
|
return e.slice(n, r).split(/\0/g);
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function Ie(t) {
|
|
640
640
|
const e = Nt(t);
|
|
641
641
|
for (let n = 0; n < e.length; n++) {
|
|
642
|
-
const r = e[n], a =
|
|
642
|
+
const r = e[n], a = Pe.exec(r);
|
|
643
643
|
if (a) {
|
|
644
644
|
const s = a.index + (a[1] ?? a[2]).length;
|
|
645
645
|
e.splice(n, 1, r.slice(0, s), r.slice(s));
|
|
@@ -655,18 +655,18 @@ function N(t, e) {
|
|
|
655
655
|
const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), o = jt(s, i);
|
|
656
656
|
return n + r.map((c, m) => m === 0 ? s(c) : o(c, m)).join("") + a;
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function Te(t, e) {
|
|
659
659
|
const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), o = jt(s, i);
|
|
660
660
|
return n + r.map(o).join("") + a;
|
|
661
661
|
}
|
|
662
662
|
function rt(t, e) {
|
|
663
663
|
const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale);
|
|
664
|
-
return n + r.map(
|
|
664
|
+
return n + r.map(Ae(s, i)).join(" ") + a;
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function ze(t, e) {
|
|
667
667
|
return Bt(t, { delimiter: "-", ...e });
|
|
668
668
|
}
|
|
669
|
-
function
|
|
669
|
+
function De(t, e) {
|
|
670
670
|
return Bt(t, { delimiter: "_", ...e });
|
|
671
671
|
}
|
|
672
672
|
function H(t) {
|
|
@@ -675,7 +675,7 @@ function H(t) {
|
|
|
675
675
|
function at(t) {
|
|
676
676
|
return (e) => e.toLocaleUpperCase(t);
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function Ae(t, e) {
|
|
679
679
|
return (n) => `${e(n[0])}${t(n.slice(1))}`;
|
|
680
680
|
}
|
|
681
681
|
function jt(t, e) {
|
|
@@ -685,7 +685,7 @@ function jt(t, e) {
|
|
|
685
685
|
};
|
|
686
686
|
}
|
|
687
687
|
function G(t, e = {}) {
|
|
688
|
-
const n = e.split ?? (e.separateNumbers ?
|
|
688
|
+
const n = e.split ?? (e.separateNumbers ? Ie : Nt), r = e.prefixCharacters ?? ft, a = e.suffixCharacters ?? ft;
|
|
689
689
|
let s = 0, i = t.length;
|
|
690
690
|
for (; s < t.length; ) {
|
|
691
691
|
const o = t.charAt(s);
|
|
@@ -705,18 +705,18 @@ function G(t, e = {}) {
|
|
|
705
705
|
t.slice(i)
|
|
706
706
|
];
|
|
707
707
|
}
|
|
708
|
-
function
|
|
708
|
+
function Ne(t) {
|
|
709
709
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function Be(t) {
|
|
712
712
|
throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
713
713
|
}
|
|
714
|
-
var V = { exports: {} },
|
|
715
|
-
function
|
|
714
|
+
var V = { exports: {} }, je = V.exports, ht;
|
|
715
|
+
function Le() {
|
|
716
716
|
return ht || (ht = 1, (function(t, e) {
|
|
717
717
|
(function(n, r) {
|
|
718
|
-
typeof
|
|
719
|
-
})(
|
|
718
|
+
typeof Be == "function" ? t.exports = r() : n.pluralize = r();
|
|
719
|
+
})(je, function() {
|
|
720
720
|
var n = [], r = [], a = {}, s = {}, i = {};
|
|
721
721
|
function o(l) {
|
|
722
722
|
return typeof l == "string" ? new RegExp("^" + l + "$", "i") : l;
|
|
@@ -1011,8 +1011,8 @@ function qe() {
|
|
|
1011
1011
|
});
|
|
1012
1012
|
})(V)), V.exports;
|
|
1013
1013
|
}
|
|
1014
|
-
var
|
|
1015
|
-
const S = /* @__PURE__ */
|
|
1014
|
+
var Oe = Le();
|
|
1015
|
+
const S = /* @__PURE__ */ Ne(Oe), Pa = "data", Ea = "migrations", qe = "(app)", Ue = /* @__PURE__ */ new Set([
|
|
1016
1016
|
"break",
|
|
1017
1017
|
"case",
|
|
1018
1018
|
"catch",
|
|
@@ -1064,7 +1064,7 @@ const S = /* @__PURE__ */ je(Ue), Ra = "data", Pa = "migrations", Ve = "(app)",
|
|
|
1064
1064
|
"async",
|
|
1065
1065
|
"arguments",
|
|
1066
1066
|
"constructor"
|
|
1067
|
-
]),
|
|
1067
|
+
]), Ve = {
|
|
1068
1068
|
function: "fn",
|
|
1069
1069
|
interface: "iface",
|
|
1070
1070
|
type: "type_",
|
|
@@ -1114,7 +1114,7 @@ const S = /* @__PURE__ */ je(Ue), Ra = "data", Pa = "migrations", Ve = "(app)",
|
|
|
1114
1114
|
constructor: "ctor"
|
|
1115
1115
|
};
|
|
1116
1116
|
function Z(t) {
|
|
1117
|
-
return
|
|
1117
|
+
return Ue.has(t) ? Ve[t] ?? `${t}_` : t;
|
|
1118
1118
|
}
|
|
1119
1119
|
function K(t) {
|
|
1120
1120
|
if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(t))
|
|
@@ -1122,24 +1122,24 @@ function K(t) {
|
|
|
1122
1122
|
"Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore"
|
|
1123
1123
|
);
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1126
|
-
return t.features.auth ? `src/routes/${
|
|
1125
|
+
function He(t) {
|
|
1126
|
+
return t.features.auth ? `src/routes/${qe}` : "src/routes";
|
|
1127
1127
|
}
|
|
1128
1128
|
function E(t, e) {
|
|
1129
|
-
const n = t.split("/"), r = n[n.length - 1], a = n.slice(0, -1), s = S.singular(rt(r)), i = S.plural(s), o = N(s), c =
|
|
1129
|
+
const n = t.split("/"), r = n[n.length - 1], a = n.slice(0, -1), s = S.singular(rt(r)), i = S.plural(s), o = N(s), c = ze(i), m = [...a, c].join("/");
|
|
1130
1130
|
return {
|
|
1131
1131
|
name: Z(o),
|
|
1132
1132
|
pluralName: Z(N(i)),
|
|
1133
|
-
typeName:
|
|
1134
|
-
tableName:
|
|
1133
|
+
typeName: Te(s),
|
|
1134
|
+
tableName: De(i),
|
|
1135
1135
|
displayName: s,
|
|
1136
1136
|
pluralDisplayName: i,
|
|
1137
1137
|
schemaName: `${Z(o)}Schema`,
|
|
1138
1138
|
routeSegment: m,
|
|
1139
|
-
routesDir:
|
|
1139
|
+
routesDir: He(e)
|
|
1140
1140
|
};
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function Ge(t) {
|
|
1143
1143
|
const e = `${t.routesDir}/${t.routeSegment}`;
|
|
1144
1144
|
return {
|
|
1145
1145
|
list: e,
|
|
@@ -1148,7 +1148,7 @@ function Lt(t) {
|
|
|
1148
1148
|
edit: `${e}/[id]/edit`
|
|
1149
1149
|
};
|
|
1150
1150
|
}
|
|
1151
|
-
function
|
|
1151
|
+
function Ke(t) {
|
|
1152
1152
|
const e = `/${t.routeSegment}`;
|
|
1153
1153
|
return {
|
|
1154
1154
|
list: e,
|
|
@@ -1203,7 +1203,7 @@ function Ye(t) {
|
|
|
1203
1203
|
function Je(t) {
|
|
1204
1204
|
return Object.fromEntries(t.map((e) => [e.name, e.id]));
|
|
1205
1205
|
}
|
|
1206
|
-
function
|
|
1206
|
+
function Lt(t) {
|
|
1207
1207
|
return Object.fromEntries(
|
|
1208
1208
|
t.map((e) => [e.name, Xe(e.fields)])
|
|
1209
1209
|
);
|
|
@@ -1274,8 +1274,8 @@ function Qe(t, e, n = {}) {
|
|
|
1274
1274
|
return h(b[b.length - 1].to);
|
|
1275
1275
|
}
|
|
1276
1276
|
function g(b) {
|
|
1277
|
-
const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, T = b.reduce((Y,
|
|
1278
|
-
return 100 * b.length + 50 * C - 40 *
|
|
1277
|
+
const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, T = b.reduce((Y, ne) => Y + ne.hintScore, 0), ee = D(v.fieldName) === "user" ? 1 : 0;
|
|
1278
|
+
return 100 * b.length + 50 * C - 40 * ee - 15 * y - T;
|
|
1279
1279
|
}
|
|
1280
1280
|
function x(b) {
|
|
1281
1281
|
return b.map((v) => `${v.from}.${v.fieldName}->${v.to}`).join("|");
|
|
@@ -1297,9 +1297,9 @@ function Qe(t, e, n = {}) {
|
|
|
1297
1297
|
const C = g(b) - g(v);
|
|
1298
1298
|
return C !== 0 ? C : x(b).localeCompare(x(v));
|
|
1299
1299
|
});
|
|
1300
|
-
const w = u[0], $ = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)], lt = w[w.length - 1].isMulti ? "?=" : "=",
|
|
1300
|
+
const w = u[0], $ = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)], lt = w[w.length - 1].isMulti ? "?=" : "=", Qt = $.join("."), te = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
|
|
1301
1301
|
return {
|
|
1302
|
-
rule: `@request.auth.id ${lt} ${
|
|
1302
|
+
rule: `@request.auth.id ${lt} ${te}${Qt}.id`,
|
|
1303
1303
|
ownershipChainCollections: F,
|
|
1304
1304
|
ownershipChainFields: $,
|
|
1305
1305
|
operator: lt
|
|
@@ -1447,7 +1447,7 @@ function q(t, e, n, r, a, s) {
|
|
|
1447
1447
|
};
|
|
1448
1448
|
}
|
|
1449
1449
|
function rn(t, e, n, r, a) {
|
|
1450
|
-
const s = rt(t), { type: i, required: o, selectOptions: c } = e, m = Ye(r), h = Je(r), f =
|
|
1450
|
+
const s = rt(t), { type: i, required: o, selectOptions: c } = e, m = Ye(r), h = Je(r), f = Lt(r), g = m.map((u) => S.singular(u));
|
|
1451
1451
|
if (a.features.auth && i === "current_user" && h.users) {
|
|
1452
1452
|
const u = q(
|
|
1453
1453
|
t,
|
|
@@ -1637,7 +1637,7 @@ function an(t, e, n, r) {
|
|
|
1637
1637
|
async function W(t, e, n) {
|
|
1638
1638
|
let r;
|
|
1639
1639
|
if (n.env === "runtime") {
|
|
1640
|
-
const { getCollections: a } = await import("./env.runtime-
|
|
1640
|
+
const { getCollections: a } = await import("./env.runtime-BzRhpNR3.js");
|
|
1641
1641
|
r = await a();
|
|
1642
1642
|
} else {
|
|
1643
1643
|
const { getPreviewCollections: a } = await import("./env.preview-HlXZOEL4.js");
|
|
@@ -1698,7 +1698,7 @@ function sn(t) {
|
|
|
1698
1698
|
function A(t, e) {
|
|
1699
1699
|
return t.replace("[id]", `\${${e}}`);
|
|
1700
1700
|
}
|
|
1701
|
-
function
|
|
1701
|
+
function Ot(t, e, n) {
|
|
1702
1702
|
var r, a, s;
|
|
1703
1703
|
switch (t.type) {
|
|
1704
1704
|
case "text":
|
|
@@ -1746,7 +1746,7 @@ function xt(t, e, n) {
|
|
|
1746
1746
|
n.forForm || (r[a.name] = new B("context.user.id"));
|
|
1747
1747
|
continue;
|
|
1748
1748
|
}
|
|
1749
|
-
const s =
|
|
1749
|
+
const s = Ot(a, e, n);
|
|
1750
1750
|
s !== void 0 && (r[a.name] = s);
|
|
1751
1751
|
}
|
|
1752
1752
|
return r;
|
|
@@ -1769,7 +1769,7 @@ function ln(t, e, n) {
|
|
|
1769
1769
|
const c = ((a = s.values) == null ? void 0 : a[0]) ?? "default";
|
|
1770
1770
|
o = (s.maxSelect ?? 1) > 1 ? [c] : c;
|
|
1771
1771
|
} else
|
|
1772
|
-
o =
|
|
1772
|
+
o = Ot(
|
|
1773
1773
|
{ name: s.name, type: i },
|
|
1774
1774
|
e,
|
|
1775
1775
|
{ forForm: !1, authEnabled: n.features.auth }
|
|
@@ -1832,7 +1832,7 @@ function pn(t, e) {
|
|
|
1832
1832
|
} : { name: n.name, type: n.type })
|
|
1833
1833
|
};
|
|
1834
1834
|
}
|
|
1835
|
-
function
|
|
1835
|
+
function qt(t, e, n, r) {
|
|
1836
1836
|
const a = r.find((l) => l.name === t.tableName) ?? pn(t, e), s = mn(a, r).filter(
|
|
1837
1837
|
(l) => !(n.features.auth && l.name === "users")
|
|
1838
1838
|
), i = {}, o = [], c = /* @__PURE__ */ new Set();
|
|
@@ -1886,7 +1886,7 @@ function Vt(t, e, n, r) {
|
|
|
1886
1886
|
};
|
|
1887
1887
|
}
|
|
1888
1888
|
function dn(t, e, n, r, a) {
|
|
1889
|
-
const { declarations: s, setupSection: i, requestAgent: o, modelDbData: c, modelFormData: m } =
|
|
1889
|
+
const { declarations: s, setupSection: i, requestAgent: o, modelDbData: c, modelFormData: m } = qt(t, n, r, a);
|
|
1890
1890
|
return p`
|
|
1891
1891
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
1892
1892
|
|
|
@@ -1964,7 +1964,7 @@ function dn(t, e, n, r, a) {
|
|
|
1964
1964
|
`;
|
|
1965
1965
|
}
|
|
1966
1966
|
function fn(t, e, n, r, a) {
|
|
1967
|
-
const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } =
|
|
1967
|
+
const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } = qt(t, n, r, a);
|
|
1968
1968
|
return p`
|
|
1969
1969
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
1970
1970
|
|
|
@@ -1989,7 +1989,14 @@ function fn(t, e, n, r, a) {
|
|
|
1989
1989
|
}
|
|
1990
1990
|
var $t = Object.freeze, hn = Object.defineProperty, gn = (t, e) => $t(hn(t, "raw", { value: $t(t.slice()) })), Ft;
|
|
1991
1991
|
const Ct = 2, bn = 3;
|
|
1992
|
-
function vn(t) {
|
|
1992
|
+
function vn(t, e) {
|
|
1993
|
+
const n = t.replace(/^\/+|\/+$/g, ""), r = `${e}/${n}`, a = `/${n}`;
|
|
1994
|
+
return {
|
|
1995
|
+
pagePath: `${r}/new`,
|
|
1996
|
+
pageUrl: `${a}/new`
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
function wn(t) {
|
|
1993
2000
|
if (t.length <= Ct)
|
|
1994
2001
|
throw new Error(
|
|
1995
2002
|
"Invalid command arguments. Expected: generate form <model> <fields...>"
|
|
@@ -2004,10 +2011,10 @@ function vn(t) {
|
|
|
2004
2011
|
throw new Error("At least one field definition is required.");
|
|
2005
2012
|
return { modelPath: r, fields: a };
|
|
2006
2013
|
}
|
|
2007
|
-
function
|
|
2014
|
+
function Ut(t) {
|
|
2008
2015
|
return t.some((e) => e.type === "file");
|
|
2009
2016
|
}
|
|
2010
|
-
function
|
|
2017
|
+
function yn(t) {
|
|
2011
2018
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
|
|
2012
2019
|
}
|
|
2013
2020
|
function _t(t) {
|
|
@@ -2066,7 +2073,7 @@ function _t(t) {
|
|
|
2066
2073
|
}
|
|
2067
2074
|
return ["text"].includes(t.type) ? t.required ? `${n}.nonempty()` : `${n}.optional()` : t.required || t.type === "geoPoint" ? n : t.type === "file" && t.maxSelect <= 1 ? `${n}.optional().default("")` : `${n}.optional()`;
|
|
2068
2075
|
}
|
|
2069
|
-
function
|
|
2076
|
+
function xn(t) {
|
|
2070
2077
|
const e = [];
|
|
2071
2078
|
for (const n of t) {
|
|
2072
2079
|
if (n.type === "file" && n.maxSelect > 1) {
|
|
@@ -2086,8 +2093,8 @@ function yn(t) {
|
|
|
2086
2093
|
}
|
|
2087
2094
|
return e;
|
|
2088
2095
|
}
|
|
2089
|
-
function
|
|
2090
|
-
const n =
|
|
2096
|
+
function $n(t, e) {
|
|
2097
|
+
const n = xn(e).map((r) => `${yn(r.name)}: ${r.schema}`).join(`,
|
|
2091
2098
|
`);
|
|
2092
2099
|
return p`
|
|
2093
2100
|
import { z } from "zod/v3";
|
|
@@ -2097,7 +2104,7 @@ function xn(t, e) {
|
|
|
2097
2104
|
});
|
|
2098
2105
|
`;
|
|
2099
2106
|
}
|
|
2100
|
-
function
|
|
2107
|
+
function Fn(t, e) {
|
|
2101
2108
|
const n = O(e), r = [
|
|
2102
2109
|
'import { untrack } from "svelte";',
|
|
2103
2110
|
'import { superForm } from "sveltekit-superforms";',
|
|
@@ -2107,7 +2114,7 @@ function $n(t, e) {
|
|
|
2107
2114
|
];
|
|
2108
2115
|
return [...new Set(r)];
|
|
2109
2116
|
}
|
|
2110
|
-
function
|
|
2117
|
+
function Cn(t, e) {
|
|
2111
2118
|
const r = e.filter(
|
|
2112
2119
|
(a) => a.type === "select"
|
|
2113
2120
|
).map((a) => At(a)).join(`
|
|
@@ -2123,10 +2130,10 @@ function Fn(t, e) {
|
|
|
2123
2130
|
const { form: formData } = form;
|
|
2124
2131
|
`;
|
|
2125
2132
|
}
|
|
2126
|
-
function
|
|
2127
|
-
const n =
|
|
2128
|
-
`), r =
|
|
2129
|
-
`), s =
|
|
2133
|
+
function _n(t, e) {
|
|
2134
|
+
const n = Fn(t, e).join(`
|
|
2135
|
+
`), r = Cn(t, e), a = e.map((i) => et(i)).join(`
|
|
2136
|
+
`), s = Ut(e) ? ' enctype="multipart/form-data"' : "";
|
|
2130
2137
|
return p(Ft || (Ft = gn([`
|
|
2131
2138
|
<script lang="ts">
|
|
2132
2139
|
`, `
|
|
@@ -2152,8 +2159,8 @@ function Cn(t, e) {
|
|
|
2152
2159
|
</section>
|
|
2153
2160
|
`])), n, r, t.displayName, s, a);
|
|
2154
2161
|
}
|
|
2155
|
-
function
|
|
2156
|
-
const n =
|
|
2162
|
+
function Sn(t, e) {
|
|
2163
|
+
const n = Ut(e), r = p`
|
|
2157
2164
|
import { fail, superValidate${n ? ", withFiles" : ""} } from "sveltekit-superforms";
|
|
2158
2165
|
import { zod } from "sveltekit-superforms/adapters";
|
|
2159
2166
|
import { ${t.schemaName} } from "$lib/schemas/${t.name}";
|
|
@@ -2189,17 +2196,17 @@ function U(t, e) {
|
|
|
2189
2196
|
content: e
|
|
2190
2197
|
};
|
|
2191
2198
|
}
|
|
2192
|
-
async function
|
|
2193
|
-
const { modelPath: e, fields: n } =
|
|
2199
|
+
async function kn(t) {
|
|
2200
|
+
const { modelPath: e, fields: n } = wn(t.argv);
|
|
2194
2201
|
K(e);
|
|
2195
|
-
const r = E(e, t), s = (await W(n, r, t)).fields,
|
|
2196
|
-
U(`${i
|
|
2197
|
-
U(`${i
|
|
2202
|
+
const r = E(e, t), s = (await W(n, r, t)).fields, { pagePath: i, pageUrl: o } = vn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-BzRhpNR3.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), m = [
|
|
2203
|
+
U(`${i}/+page.svelte`, _n(r, s)),
|
|
2204
|
+
U(`${i}/+page.server.ts`, Sn(r, s)),
|
|
2198
2205
|
U(
|
|
2199
|
-
`${i
|
|
2200
|
-
fn(r, o
|
|
2206
|
+
`${i}/server.test.ts`,
|
|
2207
|
+
fn(r, o, s, t, c)
|
|
2201
2208
|
),
|
|
2202
|
-
U(`src/lib/schemas/${r.name}.ts`,
|
|
2209
|
+
U(`src/lib/schemas/${r.name}.ts`, $n(r, s))
|
|
2203
2210
|
], h = O(s);
|
|
2204
2211
|
return {
|
|
2205
2212
|
creates: m,
|
|
@@ -2210,16 +2217,16 @@ async function Sn(t) {
|
|
|
2210
2217
|
collections: []
|
|
2211
2218
|
};
|
|
2212
2219
|
}
|
|
2213
|
-
const
|
|
2214
|
-
async function
|
|
2215
|
-
const e = await
|
|
2220
|
+
const Mn = "generate-form";
|
|
2221
|
+
async function Rn(t) {
|
|
2222
|
+
const e = await kn(t);
|
|
2216
2223
|
if (t.env !== "runtime")
|
|
2217
2224
|
return k(e);
|
|
2218
2225
|
const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
|
|
2219
2226
|
return n(await k(e), t);
|
|
2220
2227
|
}
|
|
2221
|
-
const
|
|
2222
|
-
slug:
|
|
2228
|
+
const Pn = {
|
|
2229
|
+
slug: Mn,
|
|
2223
2230
|
title: "Generate a form",
|
|
2224
2231
|
summary: "Generates a form.",
|
|
2225
2232
|
categories: ["forms"],
|
|
@@ -2236,8 +2243,8 @@ const Rn = {
|
|
|
2236
2243
|
]
|
|
2237
2244
|
},
|
|
2238
2245
|
baseline: "velastack",
|
|
2239
|
-
generate:
|
|
2240
|
-
},
|
|
2246
|
+
generate: Rn
|
|
2247
|
+
}, En = ["text"], In = {
|
|
2241
2248
|
string: "text",
|
|
2242
2249
|
boolean: "bool",
|
|
2243
2250
|
geopoint: "geoPoint",
|
|
@@ -2264,10 +2271,10 @@ const Rn = {
|
|
|
2264
2271
|
geoPoint: "geoPoint",
|
|
2265
2272
|
relation: "relation"
|
|
2266
2273
|
};
|
|
2267
|
-
function
|
|
2274
|
+
function Tn(t) {
|
|
2268
2275
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
|
|
2269
2276
|
}
|
|
2270
|
-
function
|
|
2277
|
+
function zn(t, e) {
|
|
2271
2278
|
const n = t.type === "select" ? `[${(t.options ?? []).map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
|
|
2272
2279
|
let r;
|
|
2273
2280
|
switch (t.type) {
|
|
@@ -2326,7 +2333,7 @@ function Tn(t, e) {
|
|
|
2326
2333
|
default:
|
|
2327
2334
|
return t.type;
|
|
2328
2335
|
}
|
|
2329
|
-
return
|
|
2336
|
+
return En.includes(t.type) ? t.required ? `${r}.nonempty()` : `${r}.optional()` : t.required || t.type === "geoPoint" ? r : t.type === "file" && (t.maxSelect ?? 1) <= 1 ? `${r}.optional().default("")` : `${r}.optional()`;
|
|
2330
2337
|
}
|
|
2331
2338
|
function ot(t, e, n) {
|
|
2332
2339
|
const r = [];
|
|
@@ -2338,7 +2345,7 @@ function ot(t, e, n) {
|
|
|
2338
2345
|
}
|
|
2339
2346
|
r.push(o);
|
|
2340
2347
|
}
|
|
2341
|
-
const a = r.map((o) => `${
|
|
2348
|
+
const a = r.map((o) => `${Tn(o.name)}: ${zn(o, n)}`).join(`,
|
|
2342
2349
|
`), s = n.includeModelFields ? `
|
|
2343
2350
|
import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
|
|
2344
2351
|
return p`
|
|
@@ -2349,8 +2356,8 @@ import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelField
|
|
|
2349
2356
|
})${i};
|
|
2350
2357
|
`;
|
|
2351
2358
|
}
|
|
2352
|
-
function
|
|
2353
|
-
const e =
|
|
2359
|
+
function Dn(t) {
|
|
2360
|
+
const e = In[t];
|
|
2354
2361
|
if (!e)
|
|
2355
2362
|
throw new Error(`Unsupported collection field type "${t}" when generating from collection`);
|
|
2356
2363
|
return e;
|
|
@@ -2359,11 +2366,11 @@ function st(t, e, n) {
|
|
|
2359
2366
|
const r = e.find((o) => o.name === t.tableName);
|
|
2360
2367
|
if (!r)
|
|
2361
2368
|
throw new Error(`Collection "${t.tableName}" not found`);
|
|
2362
|
-
const a =
|
|
2369
|
+
const a = Lt(e), s = new Map(e.map((o) => [o.id, o])), i = [];
|
|
2363
2370
|
for (const o of r.fields) {
|
|
2364
2371
|
if (o.name === "id" || o.system)
|
|
2365
2372
|
continue;
|
|
2366
|
-
const c =
|
|
2373
|
+
const c = Dn(o.type), m = !!o.required, h = rt(o.name);
|
|
2367
2374
|
if (c === "relation") {
|
|
2368
2375
|
const f = o.collectionId ? s.get(o.collectionId) : void 0;
|
|
2369
2376
|
if (!f)
|
|
@@ -2429,17 +2436,17 @@ function st(t, e, n) {
|
|
|
2429
2436
|
}
|
|
2430
2437
|
return i.filter((o) => o.name !== "id");
|
|
2431
2438
|
}
|
|
2432
|
-
function
|
|
2439
|
+
function Vt(t) {
|
|
2433
2440
|
const e = t.filter((n) => n.type === "relation").map((n) => n.name);
|
|
2434
2441
|
return e.length > 0 ? e.join(",") : void 0;
|
|
2435
2442
|
}
|
|
2436
|
-
function
|
|
2443
|
+
function Ht(t) {
|
|
2437
2444
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
2438
2445
|
for (const r of t)
|
|
2439
2446
|
r.type === "relation" && (e.has(r.relatedModel.tableName) || (e.add(r.relatedModel.tableName), n.push(r.relatedModel)));
|
|
2440
2447
|
return n;
|
|
2441
2448
|
}
|
|
2442
|
-
function
|
|
2449
|
+
function An(t) {
|
|
2443
2450
|
const e = {
|
|
2444
2451
|
name: t.name,
|
|
2445
2452
|
type: t.type,
|
|
@@ -2462,7 +2469,7 @@ function Dn(t) {
|
|
|
2462
2469
|
onUpdate: t.onUpdate
|
|
2463
2470
|
} : e;
|
|
2464
2471
|
}
|
|
2465
|
-
function
|
|
2472
|
+
function Gt(t, e, n) {
|
|
2466
2473
|
const r = n ? {
|
|
2467
2474
|
listRule: n.rule,
|
|
2468
2475
|
viewRule: n.rule,
|
|
@@ -2474,11 +2481,11 @@ function Wt(t, e, n) {
|
|
|
2474
2481
|
name: t.tableName,
|
|
2475
2482
|
type: "base",
|
|
2476
2483
|
...r,
|
|
2477
|
-
fields: e.map(
|
|
2484
|
+
fields: e.map(An)
|
|
2478
2485
|
};
|
|
2479
2486
|
}
|
|
2480
|
-
const St = 2,
|
|
2481
|
-
function
|
|
2487
|
+
const St = 2, Nn = 3;
|
|
2488
|
+
function Bn(t) {
|
|
2482
2489
|
if (t.length <= St)
|
|
2483
2490
|
throw new Error(
|
|
2484
2491
|
"Invalid command arguments. Expected: generate resource <model> [fields...]"
|
|
@@ -2488,28 +2495,28 @@ function Nn(t) {
|
|
|
2488
2495
|
throw new Error(
|
|
2489
2496
|
`Invalid command "${t.join(" ")}". Expected to start with "generate resource".`
|
|
2490
2497
|
);
|
|
2491
|
-
const r = t[St], a = t.slice(
|
|
2498
|
+
const r = t[St], a = t.slice(Nn);
|
|
2492
2499
|
return { modelPath: r, fields: a };
|
|
2493
2500
|
}
|
|
2494
|
-
function
|
|
2501
|
+
function jn(t, e) {
|
|
2495
2502
|
return {
|
|
2496
2503
|
path: t,
|
|
2497
2504
|
language: j(t),
|
|
2498
2505
|
content: e
|
|
2499
2506
|
};
|
|
2500
2507
|
}
|
|
2501
|
-
async function
|
|
2508
|
+
async function Ln(t, e, n) {
|
|
2502
2509
|
K(e);
|
|
2503
2510
|
const r = E(e, t);
|
|
2504
2511
|
if (n.length > 0) {
|
|
2505
2512
|
const i = await W(n, r, t);
|
|
2506
2513
|
return { model: r, fields: i.fields, auth: i.auth, shouldCreateCollection: !0 };
|
|
2507
2514
|
}
|
|
2508
|
-
const a = t.env === "runtime" ? await (await import("./env.runtime-
|
|
2515
|
+
const a = t.env === "runtime" ? await (await import("./env.runtime-BzRhpNR3.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, a, t);
|
|
2509
2516
|
return { model: r, fields: s, auth: void 0, shouldCreateCollection: !1 };
|
|
2510
2517
|
}
|
|
2511
|
-
async function
|
|
2512
|
-
const { modelPath: e, fields: n } =
|
|
2518
|
+
async function On(t) {
|
|
2519
|
+
const { modelPath: e, fields: n } = Bn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i } = await Ln(
|
|
2513
2520
|
t,
|
|
2514
2521
|
e,
|
|
2515
2522
|
n
|
|
@@ -2518,27 +2525,27 @@ async function Ln(t) {
|
|
|
2518
2525
|
forForm: !0
|
|
2519
2526
|
});
|
|
2520
2527
|
return {
|
|
2521
|
-
creates: [
|
|
2528
|
+
creates: [jn(o, c)],
|
|
2522
2529
|
modifies: [],
|
|
2523
2530
|
deletes: [],
|
|
2524
2531
|
components: [],
|
|
2525
2532
|
packages: [],
|
|
2526
|
-
collections: i ? [
|
|
2533
|
+
collections: i ? [Gt(r, a, s)] : []
|
|
2527
2534
|
};
|
|
2528
2535
|
}
|
|
2529
|
-
const
|
|
2530
|
-
async function
|
|
2531
|
-
const e = await
|
|
2536
|
+
const qn = "generate-resource";
|
|
2537
|
+
async function Un(t) {
|
|
2538
|
+
const e = await On(t);
|
|
2532
2539
|
if (t.env !== "runtime")
|
|
2533
2540
|
return k(e);
|
|
2534
|
-
const { createCollections: n } = await import("./collections-
|
|
2541
|
+
const { createCollections: n } = await import("./collections-DVLGhVXc.js"), r = await n(e.collections, t), a = {
|
|
2535
2542
|
...e,
|
|
2536
2543
|
creates: [...e.creates, ...r]
|
|
2537
2544
|
}, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
|
|
2538
2545
|
return s(await k(a), t);
|
|
2539
2546
|
}
|
|
2540
|
-
const
|
|
2541
|
-
slug:
|
|
2547
|
+
const Vn = {
|
|
2548
|
+
slug: qn,
|
|
2542
2549
|
title: "Generate a resource",
|
|
2543
2550
|
summary: "Generates model schema resources.",
|
|
2544
2551
|
categories: ["data"],
|
|
@@ -2548,11 +2555,11 @@ const Un = {
|
|
|
2548
2555
|
argv: ["generate", "resource", "contact", "name:text", "email:email"]
|
|
2549
2556
|
},
|
|
2550
2557
|
baseline: "velastack",
|
|
2551
|
-
generate:
|
|
2558
|
+
generate: Un
|
|
2552
2559
|
};
|
|
2553
|
-
var kt = Object.freeze,
|
|
2554
|
-
const It = 2,
|
|
2555
|
-
function
|
|
2560
|
+
var kt = Object.freeze, Hn = Object.defineProperty, X = (t, e) => kt(Hn(t, "raw", { value: kt(e || t.slice()) })), Mt, Rt, Pt, Et;
|
|
2561
|
+
const It = 2, Gn = 3;
|
|
2562
|
+
function Kn(t) {
|
|
2556
2563
|
if (t.length <= It)
|
|
2557
2564
|
throw new Error(
|
|
2558
2565
|
"Invalid command arguments. Expected: generate scaffold <model> [fields...]"
|
|
@@ -2562,7 +2569,7 @@ function Gn(t) {
|
|
|
2562
2569
|
throw new Error(
|
|
2563
2570
|
`Invalid command "${t.join(" ")}". Expected to start with "generate scaffold".`
|
|
2564
2571
|
);
|
|
2565
|
-
const r = t[It], a = t.slice(
|
|
2572
|
+
const r = t[It], a = t.slice(Gn);
|
|
2566
2573
|
return { modelPath: r, fields: a };
|
|
2567
2574
|
}
|
|
2568
2575
|
function _(t, e) {
|
|
@@ -2572,10 +2579,10 @@ function _(t, e) {
|
|
|
2572
2579
|
content: e
|
|
2573
2580
|
};
|
|
2574
2581
|
}
|
|
2575
|
-
function
|
|
2582
|
+
function Kt(t) {
|
|
2576
2583
|
return t.some((e) => e.type === "file");
|
|
2577
2584
|
}
|
|
2578
|
-
function
|
|
2585
|
+
function Wt(t) {
|
|
2579
2586
|
return [...new Set(t.filter(Boolean))];
|
|
2580
2587
|
}
|
|
2581
2588
|
function it(t) {
|
|
@@ -2585,19 +2592,19 @@ function it(t) {
|
|
|
2585
2592
|
|
|
2586
2593
|
`);
|
|
2587
2594
|
}
|
|
2588
|
-
function
|
|
2589
|
-
return
|
|
2595
|
+
function Xt(t, e) {
|
|
2596
|
+
return Ht(t).map(
|
|
2590
2597
|
(n) => `const ${n.pluralName} = await ${e}.collection("${n.tableName}").getFullList();`
|
|
2591
2598
|
).join(`
|
|
2592
2599
|
`);
|
|
2593
2600
|
}
|
|
2594
|
-
function
|
|
2595
|
-
return
|
|
2601
|
+
function Yt(t) {
|
|
2602
|
+
return Ht(t).map((e) => e.pluralName).join(", ");
|
|
2596
2603
|
}
|
|
2597
|
-
function
|
|
2604
|
+
function Wn(t) {
|
|
2598
2605
|
return t.features.auth ? "locals.pb" : "locals.admin";
|
|
2599
2606
|
}
|
|
2600
|
-
function
|
|
2607
|
+
function Jt(t, e, n = !1) {
|
|
2601
2608
|
const r = it(e);
|
|
2602
2609
|
return p`
|
|
2603
2610
|
${r}
|
|
@@ -2610,8 +2617,8 @@ function Qt(t, e, n = !1) {
|
|
|
2610
2617
|
const { form: formData } = form;
|
|
2611
2618
|
`;
|
|
2612
2619
|
}
|
|
2613
|
-
function
|
|
2614
|
-
const r = n.some((o) => o.type === "select"), a =
|
|
2620
|
+
function Xn(t, e, n) {
|
|
2621
|
+
const r = n.some((o) => o.type === "select"), a = Wt([
|
|
2615
2622
|
'import { untrack } from "svelte";',
|
|
2616
2623
|
'import { superForm } from "sveltekit-superforms";',
|
|
2617
2624
|
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
@@ -2623,7 +2630,7 @@ function Wn(t, e, n) {
|
|
|
2623
2630
|
r ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2624
2631
|
]).join(`
|
|
2625
2632
|
`), s = n.map((o) => et(o)).join(`
|
|
2626
|
-
`), i =
|
|
2633
|
+
`), i = Kt(n) ? ' enctype="multipart/form-data"' : "";
|
|
2627
2634
|
return p(Mt || (Mt = X([`
|
|
2628
2635
|
<script lang="ts">
|
|
2629
2636
|
`, `
|
|
@@ -2651,10 +2658,10 @@ function Wn(t, e, n) {
|
|
|
2651
2658
|
</form>
|
|
2652
2659
|
</div>
|
|
2653
2660
|
</section>
|
|
2654
|
-
`])), a,
|
|
2661
|
+
`])), a, Jt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2655
2662
|
}
|
|
2656
|
-
function
|
|
2657
|
-
const r = n.some((o) => o.type === "select"), a =
|
|
2663
|
+
function Yn(t, e, n) {
|
|
2664
|
+
const r = n.some((o) => o.type === "select"), a = Wt([
|
|
2658
2665
|
'import { untrack } from "svelte";',
|
|
2659
2666
|
'import { superForm } from "sveltekit-superforms";',
|
|
2660
2667
|
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
@@ -2666,7 +2673,7 @@ function Xn(t, e, n) {
|
|
|
2666
2673
|
r ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2667
2674
|
]).join(`
|
|
2668
2675
|
`), s = n.map((o) => et(o)).join(`
|
|
2669
|
-
`), i =
|
|
2676
|
+
`), i = Kt(n) ? ' enctype="multipart/form-data"' : "";
|
|
2670
2677
|
return p(Rt || (Rt = X([`
|
|
2671
2678
|
<script lang="ts">
|
|
2672
2679
|
`, `
|
|
@@ -2721,9 +2728,9 @@ function Xn(t, e, n) {
|
|
|
2721
2728
|
</form>
|
|
2722
2729
|
</div>
|
|
2723
2730
|
</section>
|
|
2724
|
-
`])), a,
|
|
2731
|
+
`])), a, Jt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2725
2732
|
}
|
|
2726
|
-
function
|
|
2733
|
+
function Jn(t, e, n) {
|
|
2727
2734
|
const r = n.some((o) => o.type === "select"), a = r ? `${it(n)}` : "", s = n.map((o) => {
|
|
2728
2735
|
let c = "{ getValue }", m = "{ value: getValue() }";
|
|
2729
2736
|
return o.type === "relation" && (c = "{ getValue, row }", m = `{ value: getValue(), expanded: row.original.expand?.${o.name}, displayField: "${o.displayField}" }`), o.type === "select" && (m = `{ value: getValue(), options: ${o.name}Labels }`), o.type === "file" && (c = "{ getValue, row }", m = "{ value: getValue(), collectionId: row.original.collectionId, id: row.original.id }"), p`
|
|
@@ -3113,8 +3120,8 @@ function Yn(t, e, n) {
|
|
|
3113
3120
|
</section>
|
|
3114
3121
|
`])), r ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "", a, t.tableName, s, n.length > 0 ? "," : "", e.list, e.list, e.list, t.pluralName, t.pluralDisplayName, e.new, t.displayName.toLowerCase(), t.pluralDisplayName.toLowerCase(), i, e.new, t.displayName.toLowerCase());
|
|
3115
3122
|
}
|
|
3116
|
-
function
|
|
3117
|
-
const r =
|
|
3123
|
+
function Zn(t, e, n) {
|
|
3124
|
+
const r = Vt(e), a = r ? `{ expand: "${r}" }` : "";
|
|
3118
3125
|
return p`
|
|
3119
3126
|
export const load = async ({ locals }) => {
|
|
3120
3127
|
const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${a});
|
|
@@ -3122,8 +3129,8 @@ function Jn(t, e, n) {
|
|
|
3122
3129
|
};
|
|
3123
3130
|
`;
|
|
3124
3131
|
}
|
|
3125
|
-
function
|
|
3126
|
-
const s =
|
|
3132
|
+
function Qn(t, e, n, r, a) {
|
|
3133
|
+
const s = Xt(n, r), i = Yt(n), o = i ? `, ${i}` : "", c = n.find(
|
|
3127
3134
|
(h) => h.type === "relation" && h.isCurrentUser
|
|
3128
3135
|
), m = a && c ? p`
|
|
3129
3136
|
{
|
|
@@ -3164,8 +3171,8 @@ function Zn(t, e, n, r, a) {
|
|
|
3164
3171
|
};
|
|
3165
3172
|
`;
|
|
3166
3173
|
}
|
|
3167
|
-
function
|
|
3168
|
-
const a =
|
|
3174
|
+
function tr(t, e, n, r) {
|
|
3175
|
+
const a = Vt(n), s = a ? `, { expand: "${a}" }` : "";
|
|
3169
3176
|
return p`
|
|
3170
3177
|
import { error, redirect } from "@sveltejs/kit";
|
|
3171
3178
|
|
|
@@ -3186,7 +3193,7 @@ function Qn(t, e, n, r) {
|
|
|
3186
3193
|
};
|
|
3187
3194
|
`;
|
|
3188
3195
|
}
|
|
3189
|
-
function
|
|
3196
|
+
function er(t, e, n) {
|
|
3190
3197
|
const r = n.some((m) => m.type === "select"), a = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
|
|
3191
3198
|
'import { Button } from "$lib/components/ui/button";',
|
|
3192
3199
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
@@ -3194,7 +3201,7 @@ function tr(t, e, n) {
|
|
|
3194
3201
|
a ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
|
|
3195
3202
|
s ? 'import FileIcon from "@lucide/svelte/icons/file";' : ""
|
|
3196
3203
|
].filter(Boolean).join(`
|
|
3197
|
-
`), o = it(n), c = n.map((m) =>
|
|
3204
|
+
`), o = it(n), c = n.map((m) => ke(t, m)).join(`
|
|
3198
3205
|
`);
|
|
3199
3206
|
return p(Et || (Et = X([`
|
|
3200
3207
|
<script lang="ts">
|
|
@@ -3230,8 +3237,8 @@ function tr(t, e, n) {
|
|
|
3230
3237
|
</section>
|
|
3231
3238
|
`])), i, o, t.displayName, e.list, c, e.list, t.name);
|
|
3232
3239
|
}
|
|
3233
|
-
function
|
|
3234
|
-
const a =
|
|
3240
|
+
function nr(t, e, n, r) {
|
|
3241
|
+
const a = Xt(n, r), s = Yt(n), i = s ? `, ${s}` : "";
|
|
3235
3242
|
return p`
|
|
3236
3243
|
import { error, fail, redirect } from "@sveltejs/kit";
|
|
3237
3244
|
import { setPocketbaseErrors, setDefaultData } from "@velastack/pocketbase";
|
|
@@ -3272,9 +3279,9 @@ function er(t, e, n, r) {
|
|
|
3272
3279
|
};
|
|
3273
3280
|
`;
|
|
3274
3281
|
}
|
|
3275
|
-
async function
|
|
3282
|
+
async function rr(t, e, n) {
|
|
3276
3283
|
K(e);
|
|
3277
|
-
const r = E(e, t), a = t.env === "runtime" ? await (await import("./env.runtime-
|
|
3284
|
+
const r = E(e, t), a = t.env === "runtime" ? await (await import("./env.runtime-BzRhpNR3.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t);
|
|
3278
3285
|
if (n.length > 0) {
|
|
3279
3286
|
const i = await W(n, r, t);
|
|
3280
3287
|
return {
|
|
@@ -3294,8 +3301,8 @@ async function nr(t, e, n) {
|
|
|
3294
3301
|
collections: a
|
|
3295
3302
|
};
|
|
3296
3303
|
}
|
|
3297
|
-
async function
|
|
3298
|
-
const { modelPath: e, fields: n } =
|
|
3304
|
+
async function ar(t) {
|
|
3305
|
+
const { modelPath: e, fields: n } = Kn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i, collections: o } = await rr(t, e, n), c = Ge(r), m = Ke(r), h = Wn(t), f = a.filter(
|
|
3299
3306
|
(u) => !(u.type === "relation" && u.isCurrentUser)
|
|
3300
3307
|
), g = [
|
|
3301
3308
|
_(
|
|
@@ -3307,32 +3314,32 @@ async function rr(t) {
|
|
|
3307
3314
|
),
|
|
3308
3315
|
_(
|
|
3309
3316
|
`${c.list}/+page.server.ts`,
|
|
3310
|
-
|
|
3317
|
+
Zn(r, f, h)
|
|
3311
3318
|
),
|
|
3312
3319
|
_(
|
|
3313
3320
|
`${c.list}/+page.svelte`,
|
|
3314
|
-
|
|
3321
|
+
Jn(r, m, f)
|
|
3315
3322
|
),
|
|
3316
3323
|
_(
|
|
3317
3324
|
`${c.new}/+page.server.ts`,
|
|
3318
|
-
|
|
3325
|
+
Qn(r, m, f, h, t.features.auth)
|
|
3319
3326
|
),
|
|
3320
|
-
_(`${c.new}/+page.svelte`,
|
|
3327
|
+
_(`${c.new}/+page.svelte`, Xn(r, m, f)),
|
|
3321
3328
|
_(
|
|
3322
3329
|
`${c.show}/+page.server.ts`,
|
|
3323
|
-
|
|
3330
|
+
tr(r, m, f, h)
|
|
3324
3331
|
),
|
|
3325
3332
|
_(
|
|
3326
3333
|
`${c.show}/+page.svelte`,
|
|
3327
|
-
|
|
3334
|
+
er(r, m, f)
|
|
3328
3335
|
),
|
|
3329
3336
|
_(
|
|
3330
3337
|
`${c.edit}/+page.server.ts`,
|
|
3331
|
-
|
|
3338
|
+
nr(r, m, f, h)
|
|
3332
3339
|
),
|
|
3333
3340
|
_(
|
|
3334
3341
|
`${c.edit}/+page.svelte`,
|
|
3335
|
-
|
|
3342
|
+
Yn(r, m, f)
|
|
3336
3343
|
),
|
|
3337
3344
|
_(
|
|
3338
3345
|
`${c.list}/server.test.ts`,
|
|
@@ -3362,22 +3369,22 @@ async function rr(t) {
|
|
|
3362
3369
|
deletes: [],
|
|
3363
3370
|
components: [...new Set(x)],
|
|
3364
3371
|
packages: [],
|
|
3365
|
-
collections: i ? [
|
|
3372
|
+
collections: i ? [Gt(r, a, s)] : []
|
|
3366
3373
|
};
|
|
3367
3374
|
}
|
|
3368
|
-
const
|
|
3369
|
-
async function
|
|
3370
|
-
const e = await
|
|
3375
|
+
const or = "generate-scaffold";
|
|
3376
|
+
async function sr(t) {
|
|
3377
|
+
const e = await ar(t);
|
|
3371
3378
|
if (t.env !== "runtime")
|
|
3372
3379
|
return k(e);
|
|
3373
|
-
const { createCollections: n } = await import("./collections-
|
|
3380
|
+
const { createCollections: n } = await import("./collections-DVLGhVXc.js"), r = await n(e.collections, t), a = {
|
|
3374
3381
|
...e,
|
|
3375
3382
|
creates: [...e.creates, ...r]
|
|
3376
3383
|
}, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
|
|
3377
3384
|
return s(await k(a), t);
|
|
3378
3385
|
}
|
|
3379
|
-
const
|
|
3380
|
-
slug:
|
|
3386
|
+
const ir = {
|
|
3387
|
+
slug: or,
|
|
3381
3388
|
title: "Generate a scaffold",
|
|
3382
3389
|
summary: "Generates CRUD routes and schema.",
|
|
3383
3390
|
categories: ["data", "forms"],
|
|
@@ -3387,9 +3394,9 @@ const sr = {
|
|
|
3387
3394
|
argv: ["generate", "scaffold", "contact", "name:text", "email:email"]
|
|
3388
3395
|
},
|
|
3389
3396
|
baseline: "velastack",
|
|
3390
|
-
generate:
|
|
3391
|
-
}, Tt = 2,
|
|
3392
|
-
function
|
|
3397
|
+
generate: sr
|
|
3398
|
+
}, Tt = 2, lr = 3;
|
|
3399
|
+
function cr(t) {
|
|
3393
3400
|
if (t.length <= Tt)
|
|
3394
3401
|
throw new Error(
|
|
3395
3402
|
"Invalid command arguments. Expected: generate schema <model> [fields...]"
|
|
@@ -3399,28 +3406,28 @@ function lr(t) {
|
|
|
3399
3406
|
throw new Error(
|
|
3400
3407
|
`Invalid command "${t.join(" ")}". Expected to start with "generate schema".`
|
|
3401
3408
|
);
|
|
3402
|
-
const r = t[Tt], a = t.slice(
|
|
3409
|
+
const r = t[Tt], a = t.slice(lr);
|
|
3403
3410
|
return { modelPath: r, fields: a };
|
|
3404
3411
|
}
|
|
3405
|
-
function
|
|
3412
|
+
function mr(t, e) {
|
|
3406
3413
|
return {
|
|
3407
3414
|
path: t,
|
|
3408
3415
|
language: j(t),
|
|
3409
3416
|
content: e
|
|
3410
3417
|
};
|
|
3411
3418
|
}
|
|
3412
|
-
async function
|
|
3419
|
+
async function ur(t, e, n) {
|
|
3413
3420
|
K(e);
|
|
3414
3421
|
const r = E(e, t);
|
|
3415
3422
|
if (n.length > 0) {
|
|
3416
3423
|
const i = await W(n, r, t);
|
|
3417
3424
|
return { model: r, fields: i.fields, includeModelFields: !1 };
|
|
3418
3425
|
}
|
|
3419
|
-
const a = t.env === "runtime" ? await (await import("./env.runtime-
|
|
3426
|
+
const a = t.env === "runtime" ? await (await import("./env.runtime-BzRhpNR3.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, a, t);
|
|
3420
3427
|
return { model: r, fields: s, includeModelFields: !0 };
|
|
3421
3428
|
}
|
|
3422
|
-
async function
|
|
3423
|
-
const { modelPath: e, fields: n } =
|
|
3429
|
+
async function pr(t) {
|
|
3430
|
+
const { modelPath: e, fields: n } = cr(t.argv), { model: r, fields: a, includeModelFields: s } = await ur(
|
|
3424
3431
|
t,
|
|
3425
3432
|
e,
|
|
3426
3433
|
n
|
|
@@ -3429,7 +3436,7 @@ async function ur(t) {
|
|
|
3429
3436
|
forForm: !0
|
|
3430
3437
|
});
|
|
3431
3438
|
return {
|
|
3432
|
-
creates: [
|
|
3439
|
+
creates: [mr(i, o)],
|
|
3433
3440
|
modifies: [],
|
|
3434
3441
|
deletes: [],
|
|
3435
3442
|
components: [],
|
|
@@ -3437,16 +3444,16 @@ async function ur(t) {
|
|
|
3437
3444
|
collections: []
|
|
3438
3445
|
};
|
|
3439
3446
|
}
|
|
3440
|
-
const
|
|
3441
|
-
async function
|
|
3442
|
-
const e = await
|
|
3447
|
+
const dr = "generate-schema";
|
|
3448
|
+
async function fr(t) {
|
|
3449
|
+
const e = await pr(t);
|
|
3443
3450
|
if (t.env !== "runtime")
|
|
3444
3451
|
return k(e);
|
|
3445
3452
|
const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
|
|
3446
3453
|
return n(await k(e), t);
|
|
3447
3454
|
}
|
|
3448
|
-
const
|
|
3449
|
-
slug:
|
|
3455
|
+
const hr = {
|
|
3456
|
+
slug: dr,
|
|
3450
3457
|
title: "Generate a schema",
|
|
3451
3458
|
summary: "Generates a zod schema.",
|
|
3452
3459
|
categories: ["data"],
|
|
@@ -3456,8 +3463,8 @@ const fr = {
|
|
|
3456
3463
|
argv: ["generate", "schema", "contact", "name:text", "email:email"]
|
|
3457
3464
|
},
|
|
3458
3465
|
baseline: "velastack",
|
|
3459
|
-
generate:
|
|
3460
|
-
},
|
|
3466
|
+
generate: fr
|
|
3467
|
+
}, gr = `<script lang="ts" module>
|
|
3461
3468
|
import HomeIcon from '@lucide/svelte/icons/home';
|
|
3462
3469
|
|
|
3463
3470
|
let data = {
|
|
@@ -3513,7 +3520,7 @@ const fr = {
|
|
|
3513
3520
|
<NavUser {user} />
|
|
3514
3521
|
</Sidebar.Footer>
|
|
3515
3522
|
</Sidebar.Root>
|
|
3516
|
-
`,
|
|
3523
|
+
`, br = `<script lang="ts">
|
|
3517
3524
|
import type { Component } from 'svelte';
|
|
3518
3525
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3519
3526
|
import { page } from '$app/state';
|
|
@@ -3553,7 +3560,7 @@ const fr = {
|
|
|
3553
3560
|
{/each}
|
|
3554
3561
|
</Sidebar.Menu>
|
|
3555
3562
|
</Sidebar.Group>
|
|
3556
|
-
`,
|
|
3563
|
+
`, vr = `<script lang="ts" module>
|
|
3557
3564
|
import Settings2Icon from '@lucide/svelte/icons/settings-2';
|
|
3558
3565
|
|
|
3559
3566
|
let data = {
|
|
@@ -3672,7 +3679,7 @@ const fr = {
|
|
|
3672
3679
|
</DropdownMenu.Root>
|
|
3673
3680
|
</Sidebar.MenuItem>
|
|
3674
3681
|
</Sidebar.Menu>
|
|
3675
|
-
`,
|
|
3682
|
+
`, wr = `<script lang="ts">
|
|
3676
3683
|
import { cn } from '$lib/utils';
|
|
3677
3684
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3678
3685
|
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
|
|
@@ -3700,7 +3707,7 @@ const fr = {
|
|
|
3700
3707
|
{@render children?.()}
|
|
3701
3708
|
</div>
|
|
3702
3709
|
{/if}
|
|
3703
|
-
`,
|
|
3710
|
+
`, yr = `<script lang="ts">
|
|
3704
3711
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3705
3712
|
import { getContext } from 'svelte';
|
|
3706
3713
|
import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
|
|
@@ -3716,7 +3723,7 @@ const fr = {
|
|
|
3716
3723
|
{:else}
|
|
3717
3724
|
{@render children?.()}
|
|
3718
3725
|
{/if}
|
|
3719
|
-
`,
|
|
3726
|
+
`, xr = `<script lang="ts">
|
|
3720
3727
|
import { goto } from '$app/navigation';
|
|
3721
3728
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
|
|
3722
3729
|
import { Button } from '$lib/components/ui/button';
|
|
@@ -3752,7 +3759,7 @@ const fr = {
|
|
|
3752
3759
|
{@render children?.()}
|
|
3753
3760
|
</Button>
|
|
3754
3761
|
{/if}
|
|
3755
|
-
`,
|
|
3762
|
+
`, $r = `<script lang="ts">
|
|
3756
3763
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3757
3764
|
import { getContext } from 'svelte';
|
|
3758
3765
|
import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
|
|
@@ -3766,7 +3773,7 @@ const fr = {
|
|
|
3766
3773
|
{@render children?.()}
|
|
3767
3774
|
</DropdownMenu.Label>
|
|
3768
3775
|
{/if}
|
|
3769
|
-
`,
|
|
3776
|
+
`, Fr = `<script lang="ts">
|
|
3770
3777
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3771
3778
|
import { getContext } from 'svelte';
|
|
3772
3779
|
import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
|
|
@@ -3778,7 +3785,7 @@ const fr = {
|
|
|
3778
3785
|
{#if isDesktop}
|
|
3779
3786
|
<DropdownMenu.Separator {...restProps} />
|
|
3780
3787
|
{/if}
|
|
3781
|
-
`,
|
|
3788
|
+
`, Cr = `<script lang="ts">
|
|
3782
3789
|
import { cn } from '$lib/utils';
|
|
3783
3790
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3784
3791
|
import { getContext } from 'svelte';
|
|
@@ -3792,7 +3799,7 @@ const fr = {
|
|
|
3792
3799
|
{#if isDesktop}
|
|
3793
3800
|
<DropdownMenu.Trigger class={cn('inline-flex', className)} {...restProps} />
|
|
3794
3801
|
{/if}
|
|
3795
|
-
`,
|
|
3802
|
+
`, _r = `<script lang="ts">
|
|
3796
3803
|
import { page } from '$app/state';
|
|
3797
3804
|
import { browser } from '$app/environment';
|
|
3798
3805
|
import { onMount, setContext } from 'svelte';
|
|
@@ -3838,12 +3845,12 @@ const fr = {
|
|
|
3838
3845
|
{:else}
|
|
3839
3846
|
{@render guest?.()}
|
|
3840
3847
|
{/if}
|
|
3841
|
-
`,
|
|
3848
|
+
`, Sr = `export type AuthMenuContext = {
|
|
3842
3849
|
isDesktop: boolean;
|
|
3843
3850
|
};
|
|
3844
3851
|
|
|
3845
3852
|
export const AUTH_MENU_CONTEXT_KEY = Symbol('auth-menu-context');
|
|
3846
|
-
`,
|
|
3853
|
+
`, kr = `import Root from './auth-menu.svelte';
|
|
3847
3854
|
import Content from './auth-menu-content.svelte';
|
|
3848
3855
|
import Trigger from './auth-menu-trigger.svelte';
|
|
3849
3856
|
import Group from './auth-menu-group.svelte';
|
|
@@ -3852,12 +3859,12 @@ import Separator from './auth-menu-separator.svelte';
|
|
|
3852
3859
|
import Item from './auth-menu-item.svelte';
|
|
3853
3860
|
|
|
3854
3861
|
export { Root, Content, Trigger, Group, Label, Separator, Item };
|
|
3855
|
-
`,
|
|
3862
|
+
`, Mr = `import { z } from 'zod/v3';
|
|
3856
3863
|
|
|
3857
3864
|
export const changeEmailSchema = z.object({
|
|
3858
3865
|
email: z.string().email()
|
|
3859
3866
|
});
|
|
3860
|
-
`,
|
|
3867
|
+
`, Rr = `import { z } from 'zod/v3';
|
|
3861
3868
|
|
|
3862
3869
|
export const changePasswordSchema = z
|
|
3863
3870
|
.object({
|
|
@@ -3868,16 +3875,16 @@ export const changePasswordSchema = z
|
|
|
3868
3875
|
message: "Passwords don't match",
|
|
3869
3876
|
path: ['passwordConfirm']
|
|
3870
3877
|
});
|
|
3871
|
-
`,
|
|
3878
|
+
`, Pr = `import { z } from 'zod/v3';
|
|
3872
3879
|
export const confirmEmailChangeSchema = z.object({
|
|
3873
3880
|
password: z.string()
|
|
3874
3881
|
});
|
|
3875
|
-
`,
|
|
3882
|
+
`, Er = `import { z } from 'zod/v3';
|
|
3876
3883
|
export const confirmResetSchema = z.object({
|
|
3877
3884
|
password: z.string(),
|
|
3878
3885
|
passwordConfirm: z.string()
|
|
3879
3886
|
});
|
|
3880
|
-
`,
|
|
3887
|
+
`, Ir = `import { z } from 'zod/v3';
|
|
3881
3888
|
|
|
3882
3889
|
const otpSchema = z.object({
|
|
3883
3890
|
type: z.literal('otp'),
|
|
@@ -3896,35 +3903,35 @@ const oAuth2Schema = z.object({
|
|
|
3896
3903
|
});
|
|
3897
3904
|
|
|
3898
3905
|
export const loginSchema = z.discriminatedUnion('type', [otpSchema, passwordSchema, oAuth2Schema]);
|
|
3899
|
-
`,
|
|
3906
|
+
`, Tr = `import { z } from 'zod/v3';
|
|
3900
3907
|
export const otpSchema = z.object({
|
|
3901
3908
|
otp: z.string()
|
|
3902
3909
|
});
|
|
3903
|
-
`,
|
|
3910
|
+
`, zr = `import { z } from 'zod/v3';
|
|
3904
3911
|
|
|
3905
3912
|
export const profileSchema = z.object({
|
|
3906
3913
|
name: z.string().optional(),
|
|
3907
3914
|
avatar: z.union([z.instanceof(File), z.string()]).optional(),
|
|
3908
3915
|
emailVisibility: z.boolean().optional()
|
|
3909
3916
|
});
|
|
3910
|
-
`,
|
|
3917
|
+
`, Dr = `import { z } from 'zod/v3';
|
|
3911
3918
|
export const resetSchema = z.object({
|
|
3912
3919
|
email: z.string().email()
|
|
3913
3920
|
});
|
|
3914
|
-
`,
|
|
3921
|
+
`, Ar = `import { z } from 'zod/v3';
|
|
3915
3922
|
|
|
3916
3923
|
export const signupSchema = z.object({
|
|
3917
3924
|
email: z.string().email(),
|
|
3918
3925
|
password: z.string(),
|
|
3919
3926
|
passwordConfirm: z.string()
|
|
3920
3927
|
});
|
|
3921
|
-
`,
|
|
3928
|
+
`, Nr = `export const load = ({ locals }) => {
|
|
3922
3929
|
const user = locals.pb.authStore.record!;
|
|
3923
3930
|
const breadcrumbs = [{ title: 'Home', url: '/dashboard' }];
|
|
3924
3931
|
|
|
3925
3932
|
return { user, breadcrumbs };
|
|
3926
3933
|
};
|
|
3927
|
-
`,
|
|
3934
|
+
`, Br = `<script lang="ts">
|
|
3928
3935
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3929
3936
|
import { Separator } from '$lib/components/ui/separator';
|
|
3930
3937
|
import AppSidebar from '$lib/components/app-sidebar.svelte';
|
|
@@ -3974,7 +3981,7 @@ export const signupSchema = z.object({
|
|
|
3974
3981
|
background-color: var(--color-sidebar);
|
|
3975
3982
|
}
|
|
3976
3983
|
</style>
|
|
3977
|
-
`,
|
|
3984
|
+
`, jr = "", Lr = `import { describe, it, expect } from 'vitest';
|
|
3978
3985
|
import type { Match } from '@velastack/pocketbase';
|
|
3979
3986
|
import type { RouteId } from './$types';
|
|
3980
3987
|
|
|
@@ -3991,14 +3998,14 @@ describe('dashboard', () => {
|
|
|
3991
3998
|
expect(response.status).toBe(200);
|
|
3992
3999
|
});
|
|
3993
4000
|
});
|
|
3994
|
-
`,
|
|
4001
|
+
`, Or = `export const load = async ({ parent }) => {
|
|
3995
4002
|
const { breadcrumbs } = await parent();
|
|
3996
4003
|
|
|
3997
4004
|
return {
|
|
3998
4005
|
breadcrumbs: [...breadcrumbs, { title: 'Settings', url: '/settings' }]
|
|
3999
4006
|
};
|
|
4000
4007
|
};
|
|
4001
|
-
`,
|
|
4008
|
+
`, qr = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
|
|
4002
4009
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4003
4010
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
4004
4011
|
import { profileSchema } from '$lib/schemas/profile';
|
|
@@ -4067,7 +4074,7 @@ export const actions = {
|
|
|
4067
4074
|
return {};
|
|
4068
4075
|
}
|
|
4069
4076
|
};
|
|
4070
|
-
`,
|
|
4077
|
+
`, Ur = `<script lang="ts">
|
|
4071
4078
|
import { untrack } from 'svelte';
|
|
4072
4079
|
import { superForm } from 'sveltekit-superforms';
|
|
4073
4080
|
import { zodClient } from 'sveltekit-superforms/adapters';
|
|
@@ -4345,7 +4352,7 @@ export const actions = {
|
|
|
4345
4352
|
</form>
|
|
4346
4353
|
</div>
|
|
4347
4354
|
</div>
|
|
4348
|
-
`,
|
|
4355
|
+
`, Vr = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
4349
4356
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4350
4357
|
import { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';
|
|
4351
4358
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4372,7 +4379,7 @@ export const actions = {
|
|
|
4372
4379
|
return redirect(303, '/login');
|
|
4373
4380
|
}
|
|
4374
4381
|
};
|
|
4375
|
-
`,
|
|
4382
|
+
`, Hr = `<script lang="ts">
|
|
4376
4383
|
import { untrack } from 'svelte';
|
|
4377
4384
|
import { Button } from '$lib/components/ui/button';
|
|
4378
4385
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4440,7 +4447,7 @@ export const actions = {
|
|
|
4440
4447
|
</div>
|
|
4441
4448
|
</div>
|
|
4442
4449
|
</div>
|
|
4443
|
-
`,
|
|
4450
|
+
`, Gr = `import { describe, it, expect } from 'vitest';
|
|
4444
4451
|
import type { Match } from '@velastack/pocketbase';
|
|
4445
4452
|
import type { RouteId } from './$types';
|
|
4446
4453
|
|
|
@@ -4452,7 +4459,7 @@ describe('GET /confirm-email-change/[token]', () => {
|
|
|
4452
4459
|
expect(response.status).toBe(200);
|
|
4453
4460
|
});
|
|
4454
4461
|
});
|
|
4455
|
-
`,
|
|
4462
|
+
`, Kr = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
4456
4463
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4457
4464
|
import { confirmResetSchema } from '$lib/schemas/confirmReset';
|
|
4458
4465
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4481,7 +4488,7 @@ export const actions = {
|
|
|
4481
4488
|
return redirect(303, '/login');
|
|
4482
4489
|
}
|
|
4483
4490
|
};
|
|
4484
|
-
`,
|
|
4491
|
+
`, Wr = `<script lang="ts">
|
|
4485
4492
|
import { untrack } from 'svelte';
|
|
4486
4493
|
import { Button } from '$lib/components/ui/button';
|
|
4487
4494
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4565,7 +4572,7 @@ export const actions = {
|
|
|
4565
4572
|
</div>
|
|
4566
4573
|
</div>
|
|
4567
4574
|
</div>
|
|
4568
|
-
`,
|
|
4575
|
+
`, Xr = `import { describe, it, expect } from 'vitest';
|
|
4569
4576
|
import type { Match } from '@velastack/pocketbase';
|
|
4570
4577
|
import type { RouteId } from './$types';
|
|
4571
4578
|
|
|
@@ -4575,7 +4582,7 @@ describe('GET /confirm-reset/[token]', () => {
|
|
|
4575
4582
|
expect(response.status).toBe(200);
|
|
4576
4583
|
});
|
|
4577
4584
|
});
|
|
4578
|
-
`,
|
|
4585
|
+
`, Yr = `import { redirect } from '@sveltejs/kit';
|
|
4579
4586
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
4580
4587
|
|
|
4581
4588
|
export const GET = async ({ params, locals, cookies }) => {
|
|
@@ -4594,7 +4601,7 @@ export const GET = async ({ params, locals, cookies }) => {
|
|
|
4594
4601
|
setFlash({ type: 'toast', message }, cookies);
|
|
4595
4602
|
redirect(303, redirectPath);
|
|
4596
4603
|
};
|
|
4597
|
-
`,
|
|
4604
|
+
`, Jr = `import { describe, it, expect } from 'vitest';
|
|
4598
4605
|
import type { Match } from '@velastack/pocketbase';
|
|
4599
4606
|
import type { RouteId } from './$types';
|
|
4600
4607
|
|
|
@@ -4607,7 +4614,7 @@ describe('GET /confirm-verification/[token]', () => {
|
|
|
4607
4614
|
expect(response.headers['location']).toBe('/login');
|
|
4608
4615
|
});
|
|
4609
4616
|
});
|
|
4610
|
-
`,
|
|
4617
|
+
`, Zr = `import { fail, superValidate, message } from 'sveltekit-superforms';
|
|
4611
4618
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4612
4619
|
import { loginSchema } from '$lib/schemas/login';
|
|
4613
4620
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4668,7 +4675,7 @@ export const actions = {
|
|
|
4668
4675
|
redirect(303, redirectUrl);
|
|
4669
4676
|
}
|
|
4670
4677
|
};
|
|
4671
|
-
`,
|
|
4678
|
+
`, Qr = `<script lang="ts">
|
|
4672
4679
|
import { untrack } from 'svelte';
|
|
4673
4680
|
import { Button } from '$lib/components/ui/button';
|
|
4674
4681
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4851,7 +4858,7 @@ export const actions = {
|
|
|
4851
4858
|
</div>
|
|
4852
4859
|
</div>
|
|
4853
4860
|
</div>
|
|
4854
|
-
`,
|
|
4861
|
+
`, ta = `import { describe, it, expect } from 'vitest';
|
|
4855
4862
|
import * as devalue from 'devalue';
|
|
4856
4863
|
import type { Match } from '@velastack/pocketbase';
|
|
4857
4864
|
import type { RouteId } from './$types';
|
|
@@ -4898,14 +4905,14 @@ describe('POST /login', () => {
|
|
|
4898
4905
|
expect(data.form.message.text).toBe('Failed to authenticate.');
|
|
4899
4906
|
});
|
|
4900
4907
|
});
|
|
4901
|
-
`,
|
|
4908
|
+
`, ea = `import { redirect } from '@sveltejs/kit';
|
|
4902
4909
|
|
|
4903
4910
|
export const POST = ({ cookies, locals }) => {
|
|
4904
4911
|
locals.pb.authStore.clear();
|
|
4905
4912
|
locals.pb.authStore.clearCookie(cookies);
|
|
4906
4913
|
throw redirect(303, '/');
|
|
4907
4914
|
};
|
|
4908
|
-
`,
|
|
4915
|
+
`, na = `import { describe, it, expect } from 'vitest';
|
|
4909
4916
|
import type { Match } from '@velastack/pocketbase';
|
|
4910
4917
|
import type { RouteId } from './$types';
|
|
4911
4918
|
|
|
@@ -4917,7 +4924,7 @@ describe('POST /logout', () => {
|
|
|
4917
4924
|
expect(response.headers.location).toBe('/');
|
|
4918
4925
|
});
|
|
4919
4926
|
});
|
|
4920
|
-
`,
|
|
4927
|
+
`, ra = `import { fail, message, superValidate } from 'sveltekit-superforms';
|
|
4921
4928
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4922
4929
|
import { otpSchema } from '$lib/schemas/otp';
|
|
4923
4930
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4958,7 +4965,7 @@ export const actions = {
|
|
|
4958
4965
|
redirect(303, redirectUrl);
|
|
4959
4966
|
}
|
|
4960
4967
|
};
|
|
4961
|
-
`,
|
|
4968
|
+
`, aa = `<script lang="ts">
|
|
4962
4969
|
import { untrack } from 'svelte';
|
|
4963
4970
|
import { Button } from '$lib/components/ui/button';
|
|
4964
4971
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -5024,7 +5031,7 @@ export const actions = {
|
|
|
5024
5031
|
</div>
|
|
5025
5032
|
</div>
|
|
5026
5033
|
</div>
|
|
5027
|
-
`,
|
|
5034
|
+
`, oa = `import { describe, it, expect } from 'vitest';
|
|
5028
5035
|
import type { Match } from '@velastack/pocketbase';
|
|
5029
5036
|
import type { RouteId } from './$types';
|
|
5030
5037
|
|
|
@@ -5044,7 +5051,7 @@ describe('POST /otp/[token]', () => {
|
|
|
5044
5051
|
expect(response.body.status).toBe(400);
|
|
5045
5052
|
});
|
|
5046
5053
|
});
|
|
5047
|
-
`,
|
|
5054
|
+
`, sa = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
5048
5055
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
5049
5056
|
import { resetSchema } from '$lib/schemas/reset';
|
|
5050
5057
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -5072,7 +5079,7 @@ export const actions = {
|
|
|
5072
5079
|
return { form };
|
|
5073
5080
|
}
|
|
5074
5081
|
};
|
|
5075
|
-
`,
|
|
5082
|
+
`, ia = `<script lang="ts">
|
|
5076
5083
|
import { untrack } from 'svelte';
|
|
5077
5084
|
import { Button } from '$lib/components/ui/button';
|
|
5078
5085
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -5139,7 +5146,7 @@ export const actions = {
|
|
|
5139
5146
|
</div>
|
|
5140
5147
|
</div>
|
|
5141
5148
|
</div>
|
|
5142
|
-
`,
|
|
5149
|
+
`, la = `import { describe, it, expect } from 'vitest';
|
|
5143
5150
|
import type { Match } from '@velastack/pocketbase';
|
|
5144
5151
|
import type { RouteId } from './$types';
|
|
5145
5152
|
|
|
@@ -5159,7 +5166,7 @@ describe('POST /reset', () => {
|
|
|
5159
5166
|
expect(response.body.status).toBe(200);
|
|
5160
5167
|
});
|
|
5161
5168
|
});
|
|
5162
|
-
`,
|
|
5169
|
+
`, ca = `import { redirect } from '@sveltejs/kit';
|
|
5163
5170
|
import { fail, superValidate } from 'sveltekit-superforms';
|
|
5164
5171
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
5165
5172
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
@@ -5215,7 +5222,7 @@ export const actions = {
|
|
|
5215
5222
|
return redirect(303, redirectUrl);
|
|
5216
5223
|
}
|
|
5217
5224
|
};
|
|
5218
|
-
`,
|
|
5225
|
+
`, ma = `<script lang="ts">
|
|
5219
5226
|
import { untrack } from 'svelte';
|
|
5220
5227
|
import { Button } from '$lib/components/ui/button';
|
|
5221
5228
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -5382,7 +5389,7 @@ export const actions = {
|
|
|
5382
5389
|
</div>
|
|
5383
5390
|
</div>
|
|
5384
5391
|
</div>
|
|
5385
|
-
`,
|
|
5392
|
+
`, ua = `import { describe, it, expect } from 'vitest';
|
|
5386
5393
|
import type { Match } from '@velastack/pocketbase';
|
|
5387
5394
|
import * as devalue from 'devalue';
|
|
5388
5395
|
import type { RouteId } from './$types';
|
|
@@ -5438,61 +5445,61 @@ describe('POST /signup', () => {
|
|
|
5438
5445
|
expect(data.form.errors.email[0]).toBe('Value must be unique.');
|
|
5439
5446
|
});
|
|
5440
5447
|
});
|
|
5441
|
-
`,
|
|
5442
|
-
"./creates/src/lib/components/app-sidebar.svelte":
|
|
5443
|
-
"./creates/src/lib/components/nav-main.svelte":
|
|
5444
|
-
"./creates/src/lib/components/nav-user.svelte":
|
|
5445
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte":
|
|
5446
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte":
|
|
5447
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte":
|
|
5448
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte":
|
|
5449
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte":
|
|
5450
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte":
|
|
5451
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu.svelte":
|
|
5452
|
-
"./creates/src/lib/components/ui/auth-menu/context.ts":
|
|
5453
|
-
"./creates/src/lib/components/ui/auth-menu/index.ts":
|
|
5454
|
-
"./creates/src/lib/schemas/changeEmail.ts":
|
|
5455
|
-
"./creates/src/lib/schemas/changePassword.ts":
|
|
5456
|
-
"./creates/src/lib/schemas/confirmEmailChange.ts":
|
|
5457
|
-
"./creates/src/lib/schemas/confirmReset.ts":
|
|
5458
|
-
"./creates/src/lib/schemas/login.ts":
|
|
5459
|
-
"./creates/src/lib/schemas/otp.ts":
|
|
5460
|
-
"./creates/src/lib/schemas/profile.ts":
|
|
5461
|
-
"./creates/src/lib/schemas/reset.ts":
|
|
5462
|
-
"./creates/src/lib/schemas/signup.ts":
|
|
5463
|
-
"./creates/src/routes/(app)/+layout.server.ts":
|
|
5464
|
-
"./creates/src/routes/(app)/+layout.svelte":
|
|
5465
|
-
"./creates/src/routes/(app)/dashboard/+page.svelte":
|
|
5466
|
-
"./creates/src/routes/(app)/dashboard/server.test.ts":
|
|
5467
|
-
"./creates/src/routes/(app)/settings/+layout.server.ts":
|
|
5468
|
-
"./creates/src/routes/(app)/settings/+page.server.ts":
|
|
5469
|
-
"./creates/src/routes/(app)/settings/+page.svelte":
|
|
5470
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts":
|
|
5471
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte":
|
|
5472
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts":
|
|
5473
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts":
|
|
5474
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte":
|
|
5475
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts":
|
|
5476
|
-
"./creates/src/routes/(public)/confirm-verification/[token]/+server.ts":
|
|
5477
|
-
"./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts":
|
|
5478
|
-
"./creates/src/routes/(public)/login/+page.server.ts":
|
|
5479
|
-
"./creates/src/routes/(public)/login/+page.svelte":
|
|
5480
|
-
"./creates/src/routes/(public)/login/server.test.ts":
|
|
5481
|
-
"./creates/src/routes/(public)/logout/+server.ts":
|
|
5482
|
-
"./creates/src/routes/(public)/logout/server.test.ts":
|
|
5483
|
-
"./creates/src/routes/(public)/otp/[token]/+page.server.ts":
|
|
5484
|
-
"./creates/src/routes/(public)/otp/[token]/+page.svelte":
|
|
5485
|
-
"./creates/src/routes/(public)/otp/[token]/server.test.ts":
|
|
5486
|
-
"./creates/src/routes/(public)/reset/+page.server.ts":
|
|
5487
|
-
"./creates/src/routes/(public)/reset/+page.svelte":
|
|
5488
|
-
"./creates/src/routes/(public)/reset/server.test.ts":
|
|
5489
|
-
"./creates/src/routes/(public)/signup/+page.server.ts":
|
|
5490
|
-
"./creates/src/routes/(public)/signup/+page.svelte":
|
|
5491
|
-
"./creates/src/routes/(public)/signup/server.test.ts":
|
|
5492
|
-
}),
|
|
5493
|
-
async function
|
|
5494
|
-
const e = Object.entries(
|
|
5495
|
-
const i = Dt(a,
|
|
5448
|
+
`, pa = /* @__PURE__ */ Object.assign({
|
|
5449
|
+
"./creates/src/lib/components/app-sidebar.svelte": gr,
|
|
5450
|
+
"./creates/src/lib/components/nav-main.svelte": br,
|
|
5451
|
+
"./creates/src/lib/components/nav-user.svelte": vr,
|
|
5452
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte": wr,
|
|
5453
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte": yr,
|
|
5454
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte": xr,
|
|
5455
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte": $r,
|
|
5456
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte": Fr,
|
|
5457
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte": Cr,
|
|
5458
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu.svelte": _r,
|
|
5459
|
+
"./creates/src/lib/components/ui/auth-menu/context.ts": Sr,
|
|
5460
|
+
"./creates/src/lib/components/ui/auth-menu/index.ts": kr,
|
|
5461
|
+
"./creates/src/lib/schemas/changeEmail.ts": Mr,
|
|
5462
|
+
"./creates/src/lib/schemas/changePassword.ts": Rr,
|
|
5463
|
+
"./creates/src/lib/schemas/confirmEmailChange.ts": Pr,
|
|
5464
|
+
"./creates/src/lib/schemas/confirmReset.ts": Er,
|
|
5465
|
+
"./creates/src/lib/schemas/login.ts": Ir,
|
|
5466
|
+
"./creates/src/lib/schemas/otp.ts": Tr,
|
|
5467
|
+
"./creates/src/lib/schemas/profile.ts": zr,
|
|
5468
|
+
"./creates/src/lib/schemas/reset.ts": Dr,
|
|
5469
|
+
"./creates/src/lib/schemas/signup.ts": Ar,
|
|
5470
|
+
"./creates/src/routes/(app)/+layout.server.ts": Nr,
|
|
5471
|
+
"./creates/src/routes/(app)/+layout.svelte": Br,
|
|
5472
|
+
"./creates/src/routes/(app)/dashboard/+page.svelte": jr,
|
|
5473
|
+
"./creates/src/routes/(app)/dashboard/server.test.ts": Lr,
|
|
5474
|
+
"./creates/src/routes/(app)/settings/+layout.server.ts": Or,
|
|
5475
|
+
"./creates/src/routes/(app)/settings/+page.server.ts": qr,
|
|
5476
|
+
"./creates/src/routes/(app)/settings/+page.svelte": Ur,
|
|
5477
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Vr,
|
|
5478
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Hr,
|
|
5479
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Gr,
|
|
5480
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": Kr,
|
|
5481
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Wr,
|
|
5482
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Xr,
|
|
5483
|
+
"./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": Yr,
|
|
5484
|
+
"./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Jr,
|
|
5485
|
+
"./creates/src/routes/(public)/login/+page.server.ts": Zr,
|
|
5486
|
+
"./creates/src/routes/(public)/login/+page.svelte": Qr,
|
|
5487
|
+
"./creates/src/routes/(public)/login/server.test.ts": ta,
|
|
5488
|
+
"./creates/src/routes/(public)/logout/+server.ts": ea,
|
|
5489
|
+
"./creates/src/routes/(public)/logout/server.test.ts": na,
|
|
5490
|
+
"./creates/src/routes/(public)/otp/[token]/+page.server.ts": ra,
|
|
5491
|
+
"./creates/src/routes/(public)/otp/[token]/+page.svelte": aa,
|
|
5492
|
+
"./creates/src/routes/(public)/otp/[token]/server.test.ts": oa,
|
|
5493
|
+
"./creates/src/routes/(public)/reset/+page.server.ts": sa,
|
|
5494
|
+
"./creates/src/routes/(public)/reset/+page.svelte": ia,
|
|
5495
|
+
"./creates/src/routes/(public)/reset/server.test.ts": la,
|
|
5496
|
+
"./creates/src/routes/(public)/signup/+page.server.ts": ca,
|
|
5497
|
+
"./creates/src/routes/(public)/signup/+page.svelte": ma,
|
|
5498
|
+
"./creates/src/routes/(public)/signup/server.test.ts": ua
|
|
5499
|
+
}), da = "./creates/";
|
|
5500
|
+
async function fa(t) {
|
|
5501
|
+
const e = Object.entries(pa).map(([a, s]) => {
|
|
5502
|
+
const i = Dt(a, da);
|
|
5496
5503
|
return {
|
|
5497
5504
|
path: i,
|
|
5498
5505
|
language: j(i),
|
|
@@ -5583,7 +5590,7 @@ async function da(t) {
|
|
|
5583
5590
|
]
|
|
5584
5591
|
};
|
|
5585
5592
|
}
|
|
5586
|
-
const
|
|
5593
|
+
const ha = `/// <reference path="../pb_data/types.d.ts" />
|
|
5587
5594
|
migrate(
|
|
5588
5595
|
(app) => {
|
|
5589
5596
|
const collection = new Collection({
|
|
@@ -5769,7 +5776,7 @@ migrate(
|
|
|
5769
5776
|
return app.delete(collection);
|
|
5770
5777
|
}
|
|
5771
5778
|
);
|
|
5772
|
-
`,
|
|
5779
|
+
`, ga = `/// <reference path="../pb_data/types.d.ts" />
|
|
5773
5780
|
migrate(
|
|
5774
5781
|
(app) => {
|
|
5775
5782
|
const collection = app.findCollectionByNameOrId('_pb_users_auth_');
|
|
@@ -5824,7 +5831,7 @@ migrate(
|
|
|
5824
5831
|
return app.save(collection);
|
|
5825
5832
|
}
|
|
5826
5833
|
);
|
|
5827
|
-
`,
|
|
5834
|
+
`, ba = `import {
|
|
5828
5835
|
POCKETBASE_URL,
|
|
5829
5836
|
POCKETBASE_SUPERUSER_EMAIL,
|
|
5830
5837
|
POCKETBASE_SUPERUSER_PASSWORD
|
|
@@ -5837,7 +5844,7 @@ export const handle = handlePocketbase({
|
|
|
5837
5844
|
superuserPassword: POCKETBASE_SUPERUSER_PASSWORD,
|
|
5838
5845
|
auth: { protectedRoutes: ['/(app)'] }
|
|
5839
5846
|
});
|
|
5840
|
-
`,
|
|
5847
|
+
`, va = `<script lang="ts">
|
|
5841
5848
|
import { toggleMode } from 'mode-watcher';
|
|
5842
5849
|
import * as Navbar from '$lib/components/ui/navbar';
|
|
5843
5850
|
import { Button } from '$lib/components/ui/button';
|
|
@@ -5939,23 +5946,23 @@ export const handle = handlePocketbase({
|
|
|
5939
5946
|
@apply container mx-auto max-w-7xl px-4 py-8 w-full;
|
|
5940
5947
|
}
|
|
5941
5948
|
</style>
|
|
5942
|
-
`,
|
|
5949
|
+
`, wa = `import { loadFlash } from "sveltekit-flash-message/server";
|
|
5943
5950
|
|
|
5944
5951
|
export const load = loadFlash(async ({ locals }) => {
|
|
5945
5952
|
return {
|
|
5946
5953
|
user: locals.pb.authStore.record,
|
|
5947
5954
|
};
|
|
5948
5955
|
});
|
|
5949
|
-
`,
|
|
5950
|
-
"./preview-modifies/migrations/1776099881_created_oauth_accounts.js":
|
|
5951
|
-
"./preview-modifies/migrations/1776099881_updated_users.js":
|
|
5952
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
5953
|
-
"./preview-modifies/src/routes/(public)/root-layout.svelte":
|
|
5954
|
-
"./preview-modifies/src/routes/+layout.server.ts":
|
|
5955
|
-
}),
|
|
5956
|
-
async function
|
|
5957
|
-
const e = Object.entries(
|
|
5958
|
-
const a = Dt(n,
|
|
5956
|
+
`, ya = /* @__PURE__ */ Object.assign({
|
|
5957
|
+
"./preview-modifies/migrations/1776099881_created_oauth_accounts.js": ha,
|
|
5958
|
+
"./preview-modifies/migrations/1776099881_updated_users.js": ga,
|
|
5959
|
+
"./preview-modifies/src/hooks.server.ts": ba,
|
|
5960
|
+
"./preview-modifies/src/routes/(public)/root-layout.svelte": va,
|
|
5961
|
+
"./preview-modifies/src/routes/+layout.server.ts": wa
|
|
5962
|
+
}), xa = "./preview-modifies/";
|
|
5963
|
+
async function $a(t) {
|
|
5964
|
+
const e = Object.entries(ya).map(([n, r]) => {
|
|
5965
|
+
const a = Dt(n, xa);
|
|
5959
5966
|
return {
|
|
5960
5967
|
path: a,
|
|
5961
5968
|
language: j(a),
|
|
@@ -5971,18 +5978,18 @@ async function xa(t) {
|
|
|
5971
5978
|
collections: []
|
|
5972
5979
|
};
|
|
5973
5980
|
}
|
|
5974
|
-
const
|
|
5975
|
-
async function
|
|
5976
|
-
const e = await
|
|
5981
|
+
const Fa = "enable-auth";
|
|
5982
|
+
async function Ca(t) {
|
|
5983
|
+
const e = await fa(t);
|
|
5977
5984
|
if (t.env === "preview") {
|
|
5978
|
-
const s = await
|
|
5985
|
+
const s = await $a();
|
|
5979
5986
|
return k(pt([e, s]));
|
|
5980
5987
|
}
|
|
5981
|
-
const { generate: n } = await import("./generate.runtime-
|
|
5988
|
+
const { generate: n } = await import("./generate.runtime-BCboVR38.js"), r = await n(t), { writeResult: a } = await import("./write-result-DG5OAbe1.js");
|
|
5982
5989
|
return a(await k(pt([e, r])), t);
|
|
5983
5990
|
}
|
|
5984
|
-
const
|
|
5985
|
-
slug:
|
|
5991
|
+
const _a = {
|
|
5992
|
+
slug: Fa,
|
|
5986
5993
|
title: "Enable authentication",
|
|
5987
5994
|
summary: "Enables authentication.",
|
|
5988
5995
|
categories: ["authentication"],
|
|
@@ -5999,26 +6006,26 @@ const Ca = {
|
|
|
5999
6006
|
argv: ["enable", "auth"]
|
|
6000
6007
|
},
|
|
6001
6008
|
baseline: "velastack",
|
|
6002
|
-
generate:
|
|
6003
|
-
},
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
],
|
|
6009
|
+
generate: Ca
|
|
6010
|
+
}, Zt = [
|
|
6011
|
+
Pn,
|
|
6012
|
+
hr,
|
|
6013
|
+
Vn,
|
|
6014
|
+
ir,
|
|
6015
|
+
_a
|
|
6016
|
+
], Sa = Zt.reduce(
|
|
6010
6017
|
(t, e) => (t[e.slug] = e, t),
|
|
6011
6018
|
{}
|
|
6012
|
-
),
|
|
6019
|
+
), Ia = {
|
|
6013
6020
|
version: "0.1.0",
|
|
6014
|
-
patterns:
|
|
6015
|
-
bySlug:
|
|
6021
|
+
patterns: Zt,
|
|
6022
|
+
bySlug: Sa
|
|
6016
6023
|
};
|
|
6017
6024
|
export {
|
|
6018
|
-
|
|
6019
|
-
|
|
6025
|
+
Pa as D,
|
|
6026
|
+
Ea as M,
|
|
6020
6027
|
p as d,
|
|
6021
|
-
|
|
6028
|
+
Ia as i,
|
|
6022
6029
|
j as l
|
|
6023
6030
|
};
|
|
6024
|
-
//# sourceMappingURL=index-
|
|
6031
|
+
//# sourceMappingURL=index-DBV0rNRK.js.map
|