@velastack/patterns 0.0.4 → 0.0.6
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-Q0--CN0k.js} +3 -3
- package/dist/chunks/{collections-Hdx-NhPn.js.map → collections-Q0--CN0k.js.map} +1 -1
- package/dist/chunks/{env.runtime-B18zkdjb.js → env.runtime-wPrXEoHB.js} +2 -2
- package/dist/chunks/{env.runtime-B18zkdjb.js.map → env.runtime-wPrXEoHB.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B5XT4Q2Z.js → generate.runtime-BT46R-FS.js} +3 -3
- package/dist/chunks/{generate.runtime-B5XT4Q2Z.js.map → generate.runtime-BT46R-FS.js.map} +1 -1
- package/dist/chunks/{index-Crknwby3.js → index-CbDX3h_c.js} +373 -368
- package/dist/chunks/index-CbDX3h_c.js.map +1 -0
- package/dist/chunks/{pocketbase-BBMFXc3L.js → pocketbase-Bg-FsyGQ.js} +2 -2
- package/dist/chunks/{pocketbase-BBMFXc3L.js.map → pocketbase-Bg-FsyGQ.js.map} +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- 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-wPrXEoHB.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-wPrXEoHB.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,34 +2217,28 @@ 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"],
|
|
2226
2233
|
tags: ["sveltekit", "superforms", "validation", "zod"],
|
|
2227
2234
|
command: {
|
|
2228
2235
|
raw: "vela generate form contact name:text email:email message:editor",
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
"form",
|
|
2232
|
-
"contact",
|
|
2233
|
-
"name:text",
|
|
2234
|
-
"email:email",
|
|
2235
|
-
"message:editor"
|
|
2236
|
-
]
|
|
2236
|
+
base: "vela generate form",
|
|
2237
|
+
argv: ["contact", "name:text", "email:email", "message:editor"]
|
|
2237
2238
|
},
|
|
2238
2239
|
baseline: "velastack",
|
|
2239
|
-
generate:
|
|
2240
|
-
},
|
|
2240
|
+
generate: Rn
|
|
2241
|
+
}, En = ["text"], In = {
|
|
2241
2242
|
string: "text",
|
|
2242
2243
|
boolean: "bool",
|
|
2243
2244
|
geopoint: "geoPoint",
|
|
@@ -2264,10 +2265,10 @@ const Rn = {
|
|
|
2264
2265
|
geoPoint: "geoPoint",
|
|
2265
2266
|
relation: "relation"
|
|
2266
2267
|
};
|
|
2267
|
-
function
|
|
2268
|
+
function Tn(t) {
|
|
2268
2269
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
|
|
2269
2270
|
}
|
|
2270
|
-
function
|
|
2271
|
+
function zn(t, e) {
|
|
2271
2272
|
const n = t.type === "select" ? `[${(t.options ?? []).map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
|
|
2272
2273
|
let r;
|
|
2273
2274
|
switch (t.type) {
|
|
@@ -2326,7 +2327,7 @@ function Tn(t, e) {
|
|
|
2326
2327
|
default:
|
|
2327
2328
|
return t.type;
|
|
2328
2329
|
}
|
|
2329
|
-
return
|
|
2330
|
+
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
2331
|
}
|
|
2331
2332
|
function ot(t, e, n) {
|
|
2332
2333
|
const r = [];
|
|
@@ -2338,7 +2339,7 @@ function ot(t, e, n) {
|
|
|
2338
2339
|
}
|
|
2339
2340
|
r.push(o);
|
|
2340
2341
|
}
|
|
2341
|
-
const a = r.map((o) => `${
|
|
2342
|
+
const a = r.map((o) => `${Tn(o.name)}: ${zn(o, n)}`).join(`,
|
|
2342
2343
|
`), s = n.includeModelFields ? `
|
|
2343
2344
|
import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
|
|
2344
2345
|
return p`
|
|
@@ -2349,8 +2350,8 @@ import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelField
|
|
|
2349
2350
|
})${i};
|
|
2350
2351
|
`;
|
|
2351
2352
|
}
|
|
2352
|
-
function
|
|
2353
|
-
const e =
|
|
2353
|
+
function Dn(t) {
|
|
2354
|
+
const e = In[t];
|
|
2354
2355
|
if (!e)
|
|
2355
2356
|
throw new Error(`Unsupported collection field type "${t}" when generating from collection`);
|
|
2356
2357
|
return e;
|
|
@@ -2359,11 +2360,11 @@ function st(t, e, n) {
|
|
|
2359
2360
|
const r = e.find((o) => o.name === t.tableName);
|
|
2360
2361
|
if (!r)
|
|
2361
2362
|
throw new Error(`Collection "${t.tableName}" not found`);
|
|
2362
|
-
const a =
|
|
2363
|
+
const a = Lt(e), s = new Map(e.map((o) => [o.id, o])), i = [];
|
|
2363
2364
|
for (const o of r.fields) {
|
|
2364
2365
|
if (o.name === "id" || o.system)
|
|
2365
2366
|
continue;
|
|
2366
|
-
const c =
|
|
2367
|
+
const c = Dn(o.type), m = !!o.required, h = rt(o.name);
|
|
2367
2368
|
if (c === "relation") {
|
|
2368
2369
|
const f = o.collectionId ? s.get(o.collectionId) : void 0;
|
|
2369
2370
|
if (!f)
|
|
@@ -2429,17 +2430,17 @@ function st(t, e, n) {
|
|
|
2429
2430
|
}
|
|
2430
2431
|
return i.filter((o) => o.name !== "id");
|
|
2431
2432
|
}
|
|
2432
|
-
function
|
|
2433
|
+
function Vt(t) {
|
|
2433
2434
|
const e = t.filter((n) => n.type === "relation").map((n) => n.name);
|
|
2434
2435
|
return e.length > 0 ? e.join(",") : void 0;
|
|
2435
2436
|
}
|
|
2436
|
-
function
|
|
2437
|
+
function Ht(t) {
|
|
2437
2438
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
2438
2439
|
for (const r of t)
|
|
2439
2440
|
r.type === "relation" && (e.has(r.relatedModel.tableName) || (e.add(r.relatedModel.tableName), n.push(r.relatedModel)));
|
|
2440
2441
|
return n;
|
|
2441
2442
|
}
|
|
2442
|
-
function
|
|
2443
|
+
function An(t) {
|
|
2443
2444
|
const e = {
|
|
2444
2445
|
name: t.name,
|
|
2445
2446
|
type: t.type,
|
|
@@ -2462,7 +2463,7 @@ function Dn(t) {
|
|
|
2462
2463
|
onUpdate: t.onUpdate
|
|
2463
2464
|
} : e;
|
|
2464
2465
|
}
|
|
2465
|
-
function
|
|
2466
|
+
function Gt(t, e, n) {
|
|
2466
2467
|
const r = n ? {
|
|
2467
2468
|
listRule: n.rule,
|
|
2468
2469
|
viewRule: n.rule,
|
|
@@ -2474,11 +2475,11 @@ function Wt(t, e, n) {
|
|
|
2474
2475
|
name: t.tableName,
|
|
2475
2476
|
type: "base",
|
|
2476
2477
|
...r,
|
|
2477
|
-
fields: e.map(
|
|
2478
|
+
fields: e.map(An)
|
|
2478
2479
|
};
|
|
2479
2480
|
}
|
|
2480
|
-
const St = 2,
|
|
2481
|
-
function
|
|
2481
|
+
const St = 2, Nn = 3;
|
|
2482
|
+
function Bn(t) {
|
|
2482
2483
|
if (t.length <= St)
|
|
2483
2484
|
throw new Error(
|
|
2484
2485
|
"Invalid command arguments. Expected: generate resource <model> [fields...]"
|
|
@@ -2488,28 +2489,28 @@ function Nn(t) {
|
|
|
2488
2489
|
throw new Error(
|
|
2489
2490
|
`Invalid command "${t.join(" ")}". Expected to start with "generate resource".`
|
|
2490
2491
|
);
|
|
2491
|
-
const r = t[St], a = t.slice(
|
|
2492
|
+
const r = t[St], a = t.slice(Nn);
|
|
2492
2493
|
return { modelPath: r, fields: a };
|
|
2493
2494
|
}
|
|
2494
|
-
function
|
|
2495
|
+
function jn(t, e) {
|
|
2495
2496
|
return {
|
|
2496
2497
|
path: t,
|
|
2497
2498
|
language: j(t),
|
|
2498
2499
|
content: e
|
|
2499
2500
|
};
|
|
2500
2501
|
}
|
|
2501
|
-
async function
|
|
2502
|
+
async function Ln(t, e, n) {
|
|
2502
2503
|
K(e);
|
|
2503
2504
|
const r = E(e, t);
|
|
2504
2505
|
if (n.length > 0) {
|
|
2505
2506
|
const i = await W(n, r, t);
|
|
2506
2507
|
return { model: r, fields: i.fields, auth: i.auth, shouldCreateCollection: !0 };
|
|
2507
2508
|
}
|
|
2508
|
-
const a = t.env === "runtime" ? await (await import("./env.runtime-
|
|
2509
|
+
const a = t.env === "runtime" ? await (await import("./env.runtime-wPrXEoHB.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, a, t);
|
|
2509
2510
|
return { model: r, fields: s, auth: void 0, shouldCreateCollection: !1 };
|
|
2510
2511
|
}
|
|
2511
|
-
async function
|
|
2512
|
-
const { modelPath: e, fields: n } =
|
|
2512
|
+
async function On(t) {
|
|
2513
|
+
const { modelPath: e, fields: n } = Bn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i } = await Ln(
|
|
2513
2514
|
t,
|
|
2514
2515
|
e,
|
|
2515
2516
|
n
|
|
@@ -2518,41 +2519,42 @@ async function Ln(t) {
|
|
|
2518
2519
|
forForm: !0
|
|
2519
2520
|
});
|
|
2520
2521
|
return {
|
|
2521
|
-
creates: [
|
|
2522
|
+
creates: [jn(o, c)],
|
|
2522
2523
|
modifies: [],
|
|
2523
2524
|
deletes: [],
|
|
2524
2525
|
components: [],
|
|
2525
2526
|
packages: [],
|
|
2526
|
-
collections: i ? [
|
|
2527
|
+
collections: i ? [Gt(r, a, s)] : []
|
|
2527
2528
|
};
|
|
2528
2529
|
}
|
|
2529
|
-
const
|
|
2530
|
-
async function
|
|
2531
|
-
const e = await
|
|
2530
|
+
const qn = "generate-resource";
|
|
2531
|
+
async function Un(t) {
|
|
2532
|
+
const e = await On(t);
|
|
2532
2533
|
if (t.env !== "runtime")
|
|
2533
2534
|
return k(e);
|
|
2534
|
-
const { createCollections: n } = await import("./collections-
|
|
2535
|
+
const { createCollections: n } = await import("./collections-Q0--CN0k.js"), r = await n(e.collections, t), a = {
|
|
2535
2536
|
...e,
|
|
2536
2537
|
creates: [...e.creates, ...r]
|
|
2537
2538
|
}, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
|
|
2538
2539
|
return s(await k(a), t);
|
|
2539
2540
|
}
|
|
2540
|
-
const
|
|
2541
|
-
slug:
|
|
2541
|
+
const Vn = {
|
|
2542
|
+
slug: qn,
|
|
2542
2543
|
title: "Generate a resource",
|
|
2543
2544
|
summary: "Generates model schema resources.",
|
|
2544
2545
|
categories: ["data"],
|
|
2545
2546
|
tags: ["pocketbase", "resource", "schema"],
|
|
2546
2547
|
command: {
|
|
2547
2548
|
raw: "vela generate resource contact name:text email:email",
|
|
2548
|
-
|
|
2549
|
+
base: "vela generate resource",
|
|
2550
|
+
argv: ["contact", "name:text", "email:email"]
|
|
2549
2551
|
},
|
|
2550
2552
|
baseline: "velastack",
|
|
2551
|
-
generate:
|
|
2553
|
+
generate: Un
|
|
2552
2554
|
};
|
|
2553
|
-
var kt = Object.freeze,
|
|
2554
|
-
const It = 2,
|
|
2555
|
-
function
|
|
2555
|
+
var kt = Object.freeze, Hn = Object.defineProperty, X = (t, e) => kt(Hn(t, "raw", { value: kt(e || t.slice()) })), Mt, Rt, Pt, Et;
|
|
2556
|
+
const It = 2, Gn = 3;
|
|
2557
|
+
function Kn(t) {
|
|
2556
2558
|
if (t.length <= It)
|
|
2557
2559
|
throw new Error(
|
|
2558
2560
|
"Invalid command arguments. Expected: generate scaffold <model> [fields...]"
|
|
@@ -2562,7 +2564,7 @@ function Gn(t) {
|
|
|
2562
2564
|
throw new Error(
|
|
2563
2565
|
`Invalid command "${t.join(" ")}". Expected to start with "generate scaffold".`
|
|
2564
2566
|
);
|
|
2565
|
-
const r = t[It], a = t.slice(
|
|
2567
|
+
const r = t[It], a = t.slice(Gn);
|
|
2566
2568
|
return { modelPath: r, fields: a };
|
|
2567
2569
|
}
|
|
2568
2570
|
function _(t, e) {
|
|
@@ -2572,10 +2574,10 @@ function _(t, e) {
|
|
|
2572
2574
|
content: e
|
|
2573
2575
|
};
|
|
2574
2576
|
}
|
|
2575
|
-
function
|
|
2577
|
+
function Kt(t) {
|
|
2576
2578
|
return t.some((e) => e.type === "file");
|
|
2577
2579
|
}
|
|
2578
|
-
function
|
|
2580
|
+
function Wt(t) {
|
|
2579
2581
|
return [...new Set(t.filter(Boolean))];
|
|
2580
2582
|
}
|
|
2581
2583
|
function it(t) {
|
|
@@ -2585,19 +2587,19 @@ function it(t) {
|
|
|
2585
2587
|
|
|
2586
2588
|
`);
|
|
2587
2589
|
}
|
|
2588
|
-
function
|
|
2589
|
-
return
|
|
2590
|
+
function Xt(t, e) {
|
|
2591
|
+
return Ht(t).map(
|
|
2590
2592
|
(n) => `const ${n.pluralName} = await ${e}.collection("${n.tableName}").getFullList();`
|
|
2591
2593
|
).join(`
|
|
2592
2594
|
`);
|
|
2593
2595
|
}
|
|
2594
|
-
function
|
|
2595
|
-
return
|
|
2596
|
+
function Yt(t) {
|
|
2597
|
+
return Ht(t).map((e) => e.pluralName).join(", ");
|
|
2596
2598
|
}
|
|
2597
|
-
function
|
|
2599
|
+
function Wn(t) {
|
|
2598
2600
|
return t.features.auth ? "locals.pb" : "locals.admin";
|
|
2599
2601
|
}
|
|
2600
|
-
function
|
|
2602
|
+
function Jt(t, e, n = !1) {
|
|
2601
2603
|
const r = it(e);
|
|
2602
2604
|
return p`
|
|
2603
2605
|
${r}
|
|
@@ -2610,8 +2612,8 @@ function Qt(t, e, n = !1) {
|
|
|
2610
2612
|
const { form: formData } = form;
|
|
2611
2613
|
`;
|
|
2612
2614
|
}
|
|
2613
|
-
function
|
|
2614
|
-
const r = n.some((o) => o.type === "select"), a =
|
|
2615
|
+
function Xn(t, e, n) {
|
|
2616
|
+
const r = n.some((o) => o.type === "select"), a = Wt([
|
|
2615
2617
|
'import { untrack } from "svelte";',
|
|
2616
2618
|
'import { superForm } from "sveltekit-superforms";',
|
|
2617
2619
|
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
@@ -2623,7 +2625,7 @@ function Wn(t, e, n) {
|
|
|
2623
2625
|
r ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2624
2626
|
]).join(`
|
|
2625
2627
|
`), s = n.map((o) => et(o)).join(`
|
|
2626
|
-
`), i =
|
|
2628
|
+
`), i = Kt(n) ? ' enctype="multipart/form-data"' : "";
|
|
2627
2629
|
return p(Mt || (Mt = X([`
|
|
2628
2630
|
<script lang="ts">
|
|
2629
2631
|
`, `
|
|
@@ -2651,10 +2653,10 @@ function Wn(t, e, n) {
|
|
|
2651
2653
|
</form>
|
|
2652
2654
|
</div>
|
|
2653
2655
|
</section>
|
|
2654
|
-
`])), a,
|
|
2656
|
+
`])), a, Jt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2655
2657
|
}
|
|
2656
|
-
function
|
|
2657
|
-
const r = n.some((o) => o.type === "select"), a =
|
|
2658
|
+
function Yn(t, e, n) {
|
|
2659
|
+
const r = n.some((o) => o.type === "select"), a = Wt([
|
|
2658
2660
|
'import { untrack } from "svelte";',
|
|
2659
2661
|
'import { superForm } from "sveltekit-superforms";',
|
|
2660
2662
|
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
@@ -2666,7 +2668,7 @@ function Xn(t, e, n) {
|
|
|
2666
2668
|
r ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2667
2669
|
]).join(`
|
|
2668
2670
|
`), s = n.map((o) => et(o)).join(`
|
|
2669
|
-
`), i =
|
|
2671
|
+
`), i = Kt(n) ? ' enctype="multipart/form-data"' : "";
|
|
2670
2672
|
return p(Rt || (Rt = X([`
|
|
2671
2673
|
<script lang="ts">
|
|
2672
2674
|
`, `
|
|
@@ -2721,9 +2723,9 @@ function Xn(t, e, n) {
|
|
|
2721
2723
|
</form>
|
|
2722
2724
|
</div>
|
|
2723
2725
|
</section>
|
|
2724
|
-
`])), a,
|
|
2726
|
+
`])), a, Jt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2725
2727
|
}
|
|
2726
|
-
function
|
|
2728
|
+
function Jn(t, e, n) {
|
|
2727
2729
|
const r = n.some((o) => o.type === "select"), a = r ? `${it(n)}` : "", s = n.map((o) => {
|
|
2728
2730
|
let c = "{ getValue }", m = "{ value: getValue() }";
|
|
2729
2731
|
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 +3115,8 @@ function Yn(t, e, n) {
|
|
|
3113
3115
|
</section>
|
|
3114
3116
|
`])), 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
3117
|
}
|
|
3116
|
-
function
|
|
3117
|
-
const r =
|
|
3118
|
+
function Zn(t, e, n) {
|
|
3119
|
+
const r = Vt(e), a = r ? `{ expand: "${r}" }` : "";
|
|
3118
3120
|
return p`
|
|
3119
3121
|
export const load = async ({ locals }) => {
|
|
3120
3122
|
const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${a});
|
|
@@ -3122,8 +3124,8 @@ function Jn(t, e, n) {
|
|
|
3122
3124
|
};
|
|
3123
3125
|
`;
|
|
3124
3126
|
}
|
|
3125
|
-
function
|
|
3126
|
-
const s =
|
|
3127
|
+
function Qn(t, e, n, r, a) {
|
|
3128
|
+
const s = Xt(n, r), i = Yt(n), o = i ? `, ${i}` : "", c = n.find(
|
|
3127
3129
|
(h) => h.type === "relation" && h.isCurrentUser
|
|
3128
3130
|
), m = a && c ? p`
|
|
3129
3131
|
{
|
|
@@ -3164,8 +3166,8 @@ function Zn(t, e, n, r, a) {
|
|
|
3164
3166
|
};
|
|
3165
3167
|
`;
|
|
3166
3168
|
}
|
|
3167
|
-
function
|
|
3168
|
-
const a =
|
|
3169
|
+
function tr(t, e, n, r) {
|
|
3170
|
+
const a = Vt(n), s = a ? `, { expand: "${a}" }` : "";
|
|
3169
3171
|
return p`
|
|
3170
3172
|
import { error, redirect } from "@sveltejs/kit";
|
|
3171
3173
|
|
|
@@ -3186,7 +3188,7 @@ function Qn(t, e, n, r) {
|
|
|
3186
3188
|
};
|
|
3187
3189
|
`;
|
|
3188
3190
|
}
|
|
3189
|
-
function
|
|
3191
|
+
function er(t, e, n) {
|
|
3190
3192
|
const r = n.some((m) => m.type === "select"), a = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
|
|
3191
3193
|
'import { Button } from "$lib/components/ui/button";',
|
|
3192
3194
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
@@ -3194,7 +3196,7 @@ function tr(t, e, n) {
|
|
|
3194
3196
|
a ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
|
|
3195
3197
|
s ? 'import FileIcon from "@lucide/svelte/icons/file";' : ""
|
|
3196
3198
|
].filter(Boolean).join(`
|
|
3197
|
-
`), o = it(n), c = n.map((m) =>
|
|
3199
|
+
`), o = it(n), c = n.map((m) => ke(t, m)).join(`
|
|
3198
3200
|
`);
|
|
3199
3201
|
return p(Et || (Et = X([`
|
|
3200
3202
|
<script lang="ts">
|
|
@@ -3230,8 +3232,8 @@ function tr(t, e, n) {
|
|
|
3230
3232
|
</section>
|
|
3231
3233
|
`])), i, o, t.displayName, e.list, c, e.list, t.name);
|
|
3232
3234
|
}
|
|
3233
|
-
function
|
|
3234
|
-
const a =
|
|
3235
|
+
function nr(t, e, n, r) {
|
|
3236
|
+
const a = Xt(n, r), s = Yt(n), i = s ? `, ${s}` : "";
|
|
3235
3237
|
return p`
|
|
3236
3238
|
import { error, fail, redirect } from "@sveltejs/kit";
|
|
3237
3239
|
import { setPocketbaseErrors, setDefaultData } from "@velastack/pocketbase";
|
|
@@ -3272,9 +3274,9 @@ function er(t, e, n, r) {
|
|
|
3272
3274
|
};
|
|
3273
3275
|
`;
|
|
3274
3276
|
}
|
|
3275
|
-
async function
|
|
3277
|
+
async function rr(t, e, n) {
|
|
3276
3278
|
K(e);
|
|
3277
|
-
const r = E(e, t), a = t.env === "runtime" ? await (await import("./env.runtime-
|
|
3279
|
+
const r = E(e, t), a = t.env === "runtime" ? await (await import("./env.runtime-wPrXEoHB.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t);
|
|
3278
3280
|
if (n.length > 0) {
|
|
3279
3281
|
const i = await W(n, r, t);
|
|
3280
3282
|
return {
|
|
@@ -3294,8 +3296,8 @@ async function nr(t, e, n) {
|
|
|
3294
3296
|
collections: a
|
|
3295
3297
|
};
|
|
3296
3298
|
}
|
|
3297
|
-
async function
|
|
3298
|
-
const { modelPath: e, fields: n } =
|
|
3299
|
+
async function ar(t) {
|
|
3300
|
+
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
3301
|
(u) => !(u.type === "relation" && u.isCurrentUser)
|
|
3300
3302
|
), g = [
|
|
3301
3303
|
_(
|
|
@@ -3307,32 +3309,32 @@ async function rr(t) {
|
|
|
3307
3309
|
),
|
|
3308
3310
|
_(
|
|
3309
3311
|
`${c.list}/+page.server.ts`,
|
|
3310
|
-
|
|
3312
|
+
Zn(r, f, h)
|
|
3311
3313
|
),
|
|
3312
3314
|
_(
|
|
3313
3315
|
`${c.list}/+page.svelte`,
|
|
3314
|
-
|
|
3316
|
+
Jn(r, m, f)
|
|
3315
3317
|
),
|
|
3316
3318
|
_(
|
|
3317
3319
|
`${c.new}/+page.server.ts`,
|
|
3318
|
-
|
|
3320
|
+
Qn(r, m, f, h, t.features.auth)
|
|
3319
3321
|
),
|
|
3320
|
-
_(`${c.new}/+page.svelte`,
|
|
3322
|
+
_(`${c.new}/+page.svelte`, Xn(r, m, f)),
|
|
3321
3323
|
_(
|
|
3322
3324
|
`${c.show}/+page.server.ts`,
|
|
3323
|
-
|
|
3325
|
+
tr(r, m, f, h)
|
|
3324
3326
|
),
|
|
3325
3327
|
_(
|
|
3326
3328
|
`${c.show}/+page.svelte`,
|
|
3327
|
-
|
|
3329
|
+
er(r, m, f)
|
|
3328
3330
|
),
|
|
3329
3331
|
_(
|
|
3330
3332
|
`${c.edit}/+page.server.ts`,
|
|
3331
|
-
|
|
3333
|
+
nr(r, m, f, h)
|
|
3332
3334
|
),
|
|
3333
3335
|
_(
|
|
3334
3336
|
`${c.edit}/+page.svelte`,
|
|
3335
|
-
|
|
3337
|
+
Yn(r, m, f)
|
|
3336
3338
|
),
|
|
3337
3339
|
_(
|
|
3338
3340
|
`${c.list}/server.test.ts`,
|
|
@@ -3362,34 +3364,35 @@ async function rr(t) {
|
|
|
3362
3364
|
deletes: [],
|
|
3363
3365
|
components: [...new Set(x)],
|
|
3364
3366
|
packages: [],
|
|
3365
|
-
collections: i ? [
|
|
3367
|
+
collections: i ? [Gt(r, a, s)] : []
|
|
3366
3368
|
};
|
|
3367
3369
|
}
|
|
3368
|
-
const
|
|
3369
|
-
async function
|
|
3370
|
-
const e = await
|
|
3370
|
+
const or = "generate-scaffold";
|
|
3371
|
+
async function sr(t) {
|
|
3372
|
+
const e = await ar(t);
|
|
3371
3373
|
if (t.env !== "runtime")
|
|
3372
3374
|
return k(e);
|
|
3373
|
-
const { createCollections: n } = await import("./collections-
|
|
3375
|
+
const { createCollections: n } = await import("./collections-Q0--CN0k.js"), r = await n(e.collections, t), a = {
|
|
3374
3376
|
...e,
|
|
3375
3377
|
creates: [...e.creates, ...r]
|
|
3376
3378
|
}, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
|
|
3377
3379
|
return s(await k(a), t);
|
|
3378
3380
|
}
|
|
3379
|
-
const
|
|
3380
|
-
slug:
|
|
3381
|
+
const ir = {
|
|
3382
|
+
slug: or,
|
|
3381
3383
|
title: "Generate a scaffold",
|
|
3382
3384
|
summary: "Generates CRUD routes and schema.",
|
|
3383
3385
|
categories: ["data", "forms"],
|
|
3384
3386
|
tags: ["crud", "scaffold", "pocketbase", "sveltekit"],
|
|
3385
3387
|
command: {
|
|
3386
3388
|
raw: "vela generate scaffold contact name:text email:email",
|
|
3387
|
-
|
|
3389
|
+
base: "vela generate scaffold",
|
|
3390
|
+
argv: ["contact", "name:text", "email:email"]
|
|
3388
3391
|
},
|
|
3389
3392
|
baseline: "velastack",
|
|
3390
|
-
generate:
|
|
3391
|
-
}, Tt = 2,
|
|
3392
|
-
function
|
|
3393
|
+
generate: sr
|
|
3394
|
+
}, Tt = 2, lr = 3;
|
|
3395
|
+
function cr(t) {
|
|
3393
3396
|
if (t.length <= Tt)
|
|
3394
3397
|
throw new Error(
|
|
3395
3398
|
"Invalid command arguments. Expected: generate schema <model> [fields...]"
|
|
@@ -3399,28 +3402,28 @@ function lr(t) {
|
|
|
3399
3402
|
throw new Error(
|
|
3400
3403
|
`Invalid command "${t.join(" ")}". Expected to start with "generate schema".`
|
|
3401
3404
|
);
|
|
3402
|
-
const r = t[Tt], a = t.slice(
|
|
3405
|
+
const r = t[Tt], a = t.slice(lr);
|
|
3403
3406
|
return { modelPath: r, fields: a };
|
|
3404
3407
|
}
|
|
3405
|
-
function
|
|
3408
|
+
function mr(t, e) {
|
|
3406
3409
|
return {
|
|
3407
3410
|
path: t,
|
|
3408
3411
|
language: j(t),
|
|
3409
3412
|
content: e
|
|
3410
3413
|
};
|
|
3411
3414
|
}
|
|
3412
|
-
async function
|
|
3415
|
+
async function ur(t, e, n) {
|
|
3413
3416
|
K(e);
|
|
3414
3417
|
const r = E(e, t);
|
|
3415
3418
|
if (n.length > 0) {
|
|
3416
3419
|
const i = await W(n, r, t);
|
|
3417
3420
|
return { model: r, fields: i.fields, includeModelFields: !1 };
|
|
3418
3421
|
}
|
|
3419
|
-
const a = t.env === "runtime" ? await (await import("./env.runtime-
|
|
3422
|
+
const a = t.env === "runtime" ? await (await import("./env.runtime-wPrXEoHB.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, a, t);
|
|
3420
3423
|
return { model: r, fields: s, includeModelFields: !0 };
|
|
3421
3424
|
}
|
|
3422
|
-
async function
|
|
3423
|
-
const { modelPath: e, fields: n } =
|
|
3425
|
+
async function pr(t) {
|
|
3426
|
+
const { modelPath: e, fields: n } = cr(t.argv), { model: r, fields: a, includeModelFields: s } = await ur(
|
|
3424
3427
|
t,
|
|
3425
3428
|
e,
|
|
3426
3429
|
n
|
|
@@ -3429,7 +3432,7 @@ async function ur(t) {
|
|
|
3429
3432
|
forForm: !0
|
|
3430
3433
|
});
|
|
3431
3434
|
return {
|
|
3432
|
-
creates: [
|
|
3435
|
+
creates: [mr(i, o)],
|
|
3433
3436
|
modifies: [],
|
|
3434
3437
|
deletes: [],
|
|
3435
3438
|
components: [],
|
|
@@ -3437,27 +3440,28 @@ async function ur(t) {
|
|
|
3437
3440
|
collections: []
|
|
3438
3441
|
};
|
|
3439
3442
|
}
|
|
3440
|
-
const
|
|
3441
|
-
async function
|
|
3442
|
-
const e = await
|
|
3443
|
+
const dr = "generate-schema";
|
|
3444
|
+
async function fr(t) {
|
|
3445
|
+
const e = await pr(t);
|
|
3443
3446
|
if (t.env !== "runtime")
|
|
3444
3447
|
return k(e);
|
|
3445
3448
|
const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
|
|
3446
3449
|
return n(await k(e), t);
|
|
3447
3450
|
}
|
|
3448
|
-
const
|
|
3449
|
-
slug:
|
|
3451
|
+
const hr = {
|
|
3452
|
+
slug: dr,
|
|
3450
3453
|
title: "Generate a schema",
|
|
3451
3454
|
summary: "Generates a zod schema.",
|
|
3452
3455
|
categories: ["data"],
|
|
3453
3456
|
tags: ["zod", "schema", "pocketbase"],
|
|
3454
3457
|
command: {
|
|
3455
3458
|
raw: "vela generate schema contact name:text email:email",
|
|
3456
|
-
|
|
3459
|
+
base: "vela generate schema",
|
|
3460
|
+
argv: ["contact", "name:text", "email:email"]
|
|
3457
3461
|
},
|
|
3458
3462
|
baseline: "velastack",
|
|
3459
|
-
generate:
|
|
3460
|
-
},
|
|
3463
|
+
generate: fr
|
|
3464
|
+
}, gr = `<script lang="ts" module>
|
|
3461
3465
|
import HomeIcon from '@lucide/svelte/icons/home';
|
|
3462
3466
|
|
|
3463
3467
|
let data = {
|
|
@@ -3513,7 +3517,7 @@ const fr = {
|
|
|
3513
3517
|
<NavUser {user} />
|
|
3514
3518
|
</Sidebar.Footer>
|
|
3515
3519
|
</Sidebar.Root>
|
|
3516
|
-
`,
|
|
3520
|
+
`, br = `<script lang="ts">
|
|
3517
3521
|
import type { Component } from 'svelte';
|
|
3518
3522
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3519
3523
|
import { page } from '$app/state';
|
|
@@ -3553,7 +3557,7 @@ const fr = {
|
|
|
3553
3557
|
{/each}
|
|
3554
3558
|
</Sidebar.Menu>
|
|
3555
3559
|
</Sidebar.Group>
|
|
3556
|
-
`,
|
|
3560
|
+
`, vr = `<script lang="ts" module>
|
|
3557
3561
|
import Settings2Icon from '@lucide/svelte/icons/settings-2';
|
|
3558
3562
|
|
|
3559
3563
|
let data = {
|
|
@@ -3672,7 +3676,7 @@ const fr = {
|
|
|
3672
3676
|
</DropdownMenu.Root>
|
|
3673
3677
|
</Sidebar.MenuItem>
|
|
3674
3678
|
</Sidebar.Menu>
|
|
3675
|
-
`,
|
|
3679
|
+
`, wr = `<script lang="ts">
|
|
3676
3680
|
import { cn } from '$lib/utils';
|
|
3677
3681
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3678
3682
|
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
|
|
@@ -3700,7 +3704,7 @@ const fr = {
|
|
|
3700
3704
|
{@render children?.()}
|
|
3701
3705
|
</div>
|
|
3702
3706
|
{/if}
|
|
3703
|
-
`,
|
|
3707
|
+
`, yr = `<script lang="ts">
|
|
3704
3708
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3705
3709
|
import { getContext } from 'svelte';
|
|
3706
3710
|
import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
|
|
@@ -3716,7 +3720,7 @@ const fr = {
|
|
|
3716
3720
|
{:else}
|
|
3717
3721
|
{@render children?.()}
|
|
3718
3722
|
{/if}
|
|
3719
|
-
`,
|
|
3723
|
+
`, xr = `<script lang="ts">
|
|
3720
3724
|
import { goto } from '$app/navigation';
|
|
3721
3725
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
|
|
3722
3726
|
import { Button } from '$lib/components/ui/button';
|
|
@@ -3752,7 +3756,7 @@ const fr = {
|
|
|
3752
3756
|
{@render children?.()}
|
|
3753
3757
|
</Button>
|
|
3754
3758
|
{/if}
|
|
3755
|
-
`,
|
|
3759
|
+
`, $r = `<script lang="ts">
|
|
3756
3760
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3757
3761
|
import { getContext } from 'svelte';
|
|
3758
3762
|
import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
|
|
@@ -3766,7 +3770,7 @@ const fr = {
|
|
|
3766
3770
|
{@render children?.()}
|
|
3767
3771
|
</DropdownMenu.Label>
|
|
3768
3772
|
{/if}
|
|
3769
|
-
`,
|
|
3773
|
+
`, Fr = `<script lang="ts">
|
|
3770
3774
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3771
3775
|
import { getContext } from 'svelte';
|
|
3772
3776
|
import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
|
|
@@ -3778,7 +3782,7 @@ const fr = {
|
|
|
3778
3782
|
{#if isDesktop}
|
|
3779
3783
|
<DropdownMenu.Separator {...restProps} />
|
|
3780
3784
|
{/if}
|
|
3781
|
-
`,
|
|
3785
|
+
`, Cr = `<script lang="ts">
|
|
3782
3786
|
import { cn } from '$lib/utils';
|
|
3783
3787
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3784
3788
|
import { getContext } from 'svelte';
|
|
@@ -3792,7 +3796,7 @@ const fr = {
|
|
|
3792
3796
|
{#if isDesktop}
|
|
3793
3797
|
<DropdownMenu.Trigger class={cn('inline-flex', className)} {...restProps} />
|
|
3794
3798
|
{/if}
|
|
3795
|
-
`,
|
|
3799
|
+
`, _r = `<script lang="ts">
|
|
3796
3800
|
import { page } from '$app/state';
|
|
3797
3801
|
import { browser } from '$app/environment';
|
|
3798
3802
|
import { onMount, setContext } from 'svelte';
|
|
@@ -3838,12 +3842,12 @@ const fr = {
|
|
|
3838
3842
|
{:else}
|
|
3839
3843
|
{@render guest?.()}
|
|
3840
3844
|
{/if}
|
|
3841
|
-
`,
|
|
3845
|
+
`, Sr = `export type AuthMenuContext = {
|
|
3842
3846
|
isDesktop: boolean;
|
|
3843
3847
|
};
|
|
3844
3848
|
|
|
3845
3849
|
export const AUTH_MENU_CONTEXT_KEY = Symbol('auth-menu-context');
|
|
3846
|
-
`,
|
|
3850
|
+
`, kr = `import Root from './auth-menu.svelte';
|
|
3847
3851
|
import Content from './auth-menu-content.svelte';
|
|
3848
3852
|
import Trigger from './auth-menu-trigger.svelte';
|
|
3849
3853
|
import Group from './auth-menu-group.svelte';
|
|
@@ -3852,12 +3856,12 @@ import Separator from './auth-menu-separator.svelte';
|
|
|
3852
3856
|
import Item from './auth-menu-item.svelte';
|
|
3853
3857
|
|
|
3854
3858
|
export { Root, Content, Trigger, Group, Label, Separator, Item };
|
|
3855
|
-
`,
|
|
3859
|
+
`, Mr = `import { z } from 'zod/v3';
|
|
3856
3860
|
|
|
3857
3861
|
export const changeEmailSchema = z.object({
|
|
3858
3862
|
email: z.string().email()
|
|
3859
3863
|
});
|
|
3860
|
-
`,
|
|
3864
|
+
`, Rr = `import { z } from 'zod/v3';
|
|
3861
3865
|
|
|
3862
3866
|
export const changePasswordSchema = z
|
|
3863
3867
|
.object({
|
|
@@ -3868,16 +3872,16 @@ export const changePasswordSchema = z
|
|
|
3868
3872
|
message: "Passwords don't match",
|
|
3869
3873
|
path: ['passwordConfirm']
|
|
3870
3874
|
});
|
|
3871
|
-
`,
|
|
3875
|
+
`, Pr = `import { z } from 'zod/v3';
|
|
3872
3876
|
export const confirmEmailChangeSchema = z.object({
|
|
3873
3877
|
password: z.string()
|
|
3874
3878
|
});
|
|
3875
|
-
`,
|
|
3879
|
+
`, Er = `import { z } from 'zod/v3';
|
|
3876
3880
|
export const confirmResetSchema = z.object({
|
|
3877
3881
|
password: z.string(),
|
|
3878
3882
|
passwordConfirm: z.string()
|
|
3879
3883
|
});
|
|
3880
|
-
`,
|
|
3884
|
+
`, Ir = `import { z } from 'zod/v3';
|
|
3881
3885
|
|
|
3882
3886
|
const otpSchema = z.object({
|
|
3883
3887
|
type: z.literal('otp'),
|
|
@@ -3896,35 +3900,35 @@ const oAuth2Schema = z.object({
|
|
|
3896
3900
|
});
|
|
3897
3901
|
|
|
3898
3902
|
export const loginSchema = z.discriminatedUnion('type', [otpSchema, passwordSchema, oAuth2Schema]);
|
|
3899
|
-
`,
|
|
3903
|
+
`, Tr = `import { z } from 'zod/v3';
|
|
3900
3904
|
export const otpSchema = z.object({
|
|
3901
3905
|
otp: z.string()
|
|
3902
3906
|
});
|
|
3903
|
-
`,
|
|
3907
|
+
`, zr = `import { z } from 'zod/v3';
|
|
3904
3908
|
|
|
3905
3909
|
export const profileSchema = z.object({
|
|
3906
3910
|
name: z.string().optional(),
|
|
3907
3911
|
avatar: z.union([z.instanceof(File), z.string()]).optional(),
|
|
3908
3912
|
emailVisibility: z.boolean().optional()
|
|
3909
3913
|
});
|
|
3910
|
-
`,
|
|
3914
|
+
`, Dr = `import { z } from 'zod/v3';
|
|
3911
3915
|
export const resetSchema = z.object({
|
|
3912
3916
|
email: z.string().email()
|
|
3913
3917
|
});
|
|
3914
|
-
`,
|
|
3918
|
+
`, Ar = `import { z } from 'zod/v3';
|
|
3915
3919
|
|
|
3916
3920
|
export const signupSchema = z.object({
|
|
3917
3921
|
email: z.string().email(),
|
|
3918
3922
|
password: z.string(),
|
|
3919
3923
|
passwordConfirm: z.string()
|
|
3920
3924
|
});
|
|
3921
|
-
`,
|
|
3925
|
+
`, Nr = `export const load = ({ locals }) => {
|
|
3922
3926
|
const user = locals.pb.authStore.record!;
|
|
3923
3927
|
const breadcrumbs = [{ title: 'Home', url: '/dashboard' }];
|
|
3924
3928
|
|
|
3925
3929
|
return { user, breadcrumbs };
|
|
3926
3930
|
};
|
|
3927
|
-
`,
|
|
3931
|
+
`, Br = `<script lang="ts">
|
|
3928
3932
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3929
3933
|
import { Separator } from '$lib/components/ui/separator';
|
|
3930
3934
|
import AppSidebar from '$lib/components/app-sidebar.svelte';
|
|
@@ -3974,7 +3978,7 @@ export const signupSchema = z.object({
|
|
|
3974
3978
|
background-color: var(--color-sidebar);
|
|
3975
3979
|
}
|
|
3976
3980
|
</style>
|
|
3977
|
-
`,
|
|
3981
|
+
`, jr = "", Lr = `import { describe, it, expect } from 'vitest';
|
|
3978
3982
|
import type { Match } from '@velastack/pocketbase';
|
|
3979
3983
|
import type { RouteId } from './$types';
|
|
3980
3984
|
|
|
@@ -3991,14 +3995,14 @@ describe('dashboard', () => {
|
|
|
3991
3995
|
expect(response.status).toBe(200);
|
|
3992
3996
|
});
|
|
3993
3997
|
});
|
|
3994
|
-
`,
|
|
3998
|
+
`, Or = `export const load = async ({ parent }) => {
|
|
3995
3999
|
const { breadcrumbs } = await parent();
|
|
3996
4000
|
|
|
3997
4001
|
return {
|
|
3998
4002
|
breadcrumbs: [...breadcrumbs, { title: 'Settings', url: '/settings' }]
|
|
3999
4003
|
};
|
|
4000
4004
|
};
|
|
4001
|
-
`,
|
|
4005
|
+
`, qr = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
|
|
4002
4006
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4003
4007
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
4004
4008
|
import { profileSchema } from '$lib/schemas/profile';
|
|
@@ -4067,7 +4071,7 @@ export const actions = {
|
|
|
4067
4071
|
return {};
|
|
4068
4072
|
}
|
|
4069
4073
|
};
|
|
4070
|
-
`,
|
|
4074
|
+
`, Ur = `<script lang="ts">
|
|
4071
4075
|
import { untrack } from 'svelte';
|
|
4072
4076
|
import { superForm } from 'sveltekit-superforms';
|
|
4073
4077
|
import { zodClient } from 'sveltekit-superforms/adapters';
|
|
@@ -4345,7 +4349,7 @@ export const actions = {
|
|
|
4345
4349
|
</form>
|
|
4346
4350
|
</div>
|
|
4347
4351
|
</div>
|
|
4348
|
-
`,
|
|
4352
|
+
`, Vr = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
4349
4353
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4350
4354
|
import { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';
|
|
4351
4355
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4372,7 +4376,7 @@ export const actions = {
|
|
|
4372
4376
|
return redirect(303, '/login');
|
|
4373
4377
|
}
|
|
4374
4378
|
};
|
|
4375
|
-
`,
|
|
4379
|
+
`, Hr = `<script lang="ts">
|
|
4376
4380
|
import { untrack } from 'svelte';
|
|
4377
4381
|
import { Button } from '$lib/components/ui/button';
|
|
4378
4382
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4440,7 +4444,7 @@ export const actions = {
|
|
|
4440
4444
|
</div>
|
|
4441
4445
|
</div>
|
|
4442
4446
|
</div>
|
|
4443
|
-
`,
|
|
4447
|
+
`, Gr = `import { describe, it, expect } from 'vitest';
|
|
4444
4448
|
import type { Match } from '@velastack/pocketbase';
|
|
4445
4449
|
import type { RouteId } from './$types';
|
|
4446
4450
|
|
|
@@ -4452,7 +4456,7 @@ describe('GET /confirm-email-change/[token]', () => {
|
|
|
4452
4456
|
expect(response.status).toBe(200);
|
|
4453
4457
|
});
|
|
4454
4458
|
});
|
|
4455
|
-
`,
|
|
4459
|
+
`, Kr = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
4456
4460
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4457
4461
|
import { confirmResetSchema } from '$lib/schemas/confirmReset';
|
|
4458
4462
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4481,7 +4485,7 @@ export const actions = {
|
|
|
4481
4485
|
return redirect(303, '/login');
|
|
4482
4486
|
}
|
|
4483
4487
|
};
|
|
4484
|
-
`,
|
|
4488
|
+
`, Wr = `<script lang="ts">
|
|
4485
4489
|
import { untrack } from 'svelte';
|
|
4486
4490
|
import { Button } from '$lib/components/ui/button';
|
|
4487
4491
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4565,7 +4569,7 @@ export const actions = {
|
|
|
4565
4569
|
</div>
|
|
4566
4570
|
</div>
|
|
4567
4571
|
</div>
|
|
4568
|
-
`,
|
|
4572
|
+
`, Xr = `import { describe, it, expect } from 'vitest';
|
|
4569
4573
|
import type { Match } from '@velastack/pocketbase';
|
|
4570
4574
|
import type { RouteId } from './$types';
|
|
4571
4575
|
|
|
@@ -4575,7 +4579,7 @@ describe('GET /confirm-reset/[token]', () => {
|
|
|
4575
4579
|
expect(response.status).toBe(200);
|
|
4576
4580
|
});
|
|
4577
4581
|
});
|
|
4578
|
-
`,
|
|
4582
|
+
`, Yr = `import { redirect } from '@sveltejs/kit';
|
|
4579
4583
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
4580
4584
|
|
|
4581
4585
|
export const GET = async ({ params, locals, cookies }) => {
|
|
@@ -4594,7 +4598,7 @@ export const GET = async ({ params, locals, cookies }) => {
|
|
|
4594
4598
|
setFlash({ type: 'toast', message }, cookies);
|
|
4595
4599
|
redirect(303, redirectPath);
|
|
4596
4600
|
};
|
|
4597
|
-
`,
|
|
4601
|
+
`, Jr = `import { describe, it, expect } from 'vitest';
|
|
4598
4602
|
import type { Match } from '@velastack/pocketbase';
|
|
4599
4603
|
import type { RouteId } from './$types';
|
|
4600
4604
|
|
|
@@ -4607,7 +4611,7 @@ describe('GET /confirm-verification/[token]', () => {
|
|
|
4607
4611
|
expect(response.headers['location']).toBe('/login');
|
|
4608
4612
|
});
|
|
4609
4613
|
});
|
|
4610
|
-
`,
|
|
4614
|
+
`, Zr = `import { fail, superValidate, message } from 'sveltekit-superforms';
|
|
4611
4615
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4612
4616
|
import { loginSchema } from '$lib/schemas/login';
|
|
4613
4617
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4668,7 +4672,7 @@ export const actions = {
|
|
|
4668
4672
|
redirect(303, redirectUrl);
|
|
4669
4673
|
}
|
|
4670
4674
|
};
|
|
4671
|
-
`,
|
|
4675
|
+
`, Qr = `<script lang="ts">
|
|
4672
4676
|
import { untrack } from 'svelte';
|
|
4673
4677
|
import { Button } from '$lib/components/ui/button';
|
|
4674
4678
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4851,7 +4855,7 @@ export const actions = {
|
|
|
4851
4855
|
</div>
|
|
4852
4856
|
</div>
|
|
4853
4857
|
</div>
|
|
4854
|
-
`,
|
|
4858
|
+
`, ta = `import { describe, it, expect } from 'vitest';
|
|
4855
4859
|
import * as devalue from 'devalue';
|
|
4856
4860
|
import type { Match } from '@velastack/pocketbase';
|
|
4857
4861
|
import type { RouteId } from './$types';
|
|
@@ -4898,14 +4902,14 @@ describe('POST /login', () => {
|
|
|
4898
4902
|
expect(data.form.message.text).toBe('Failed to authenticate.');
|
|
4899
4903
|
});
|
|
4900
4904
|
});
|
|
4901
|
-
`,
|
|
4905
|
+
`, ea = `import { redirect } from '@sveltejs/kit';
|
|
4902
4906
|
|
|
4903
4907
|
export const POST = ({ cookies, locals }) => {
|
|
4904
4908
|
locals.pb.authStore.clear();
|
|
4905
4909
|
locals.pb.authStore.clearCookie(cookies);
|
|
4906
4910
|
throw redirect(303, '/');
|
|
4907
4911
|
};
|
|
4908
|
-
`,
|
|
4912
|
+
`, na = `import { describe, it, expect } from 'vitest';
|
|
4909
4913
|
import type { Match } from '@velastack/pocketbase';
|
|
4910
4914
|
import type { RouteId } from './$types';
|
|
4911
4915
|
|
|
@@ -4917,7 +4921,7 @@ describe('POST /logout', () => {
|
|
|
4917
4921
|
expect(response.headers.location).toBe('/');
|
|
4918
4922
|
});
|
|
4919
4923
|
});
|
|
4920
|
-
`,
|
|
4924
|
+
`, ra = `import { fail, message, superValidate } from 'sveltekit-superforms';
|
|
4921
4925
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4922
4926
|
import { otpSchema } from '$lib/schemas/otp';
|
|
4923
4927
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4958,7 +4962,7 @@ export const actions = {
|
|
|
4958
4962
|
redirect(303, redirectUrl);
|
|
4959
4963
|
}
|
|
4960
4964
|
};
|
|
4961
|
-
`,
|
|
4965
|
+
`, aa = `<script lang="ts">
|
|
4962
4966
|
import { untrack } from 'svelte';
|
|
4963
4967
|
import { Button } from '$lib/components/ui/button';
|
|
4964
4968
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -5024,7 +5028,7 @@ export const actions = {
|
|
|
5024
5028
|
</div>
|
|
5025
5029
|
</div>
|
|
5026
5030
|
</div>
|
|
5027
|
-
`,
|
|
5031
|
+
`, oa = `import { describe, it, expect } from 'vitest';
|
|
5028
5032
|
import type { Match } from '@velastack/pocketbase';
|
|
5029
5033
|
import type { RouteId } from './$types';
|
|
5030
5034
|
|
|
@@ -5044,7 +5048,7 @@ describe('POST /otp/[token]', () => {
|
|
|
5044
5048
|
expect(response.body.status).toBe(400);
|
|
5045
5049
|
});
|
|
5046
5050
|
});
|
|
5047
|
-
`,
|
|
5051
|
+
`, sa = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
5048
5052
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
5049
5053
|
import { resetSchema } from '$lib/schemas/reset';
|
|
5050
5054
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -5072,7 +5076,7 @@ export const actions = {
|
|
|
5072
5076
|
return { form };
|
|
5073
5077
|
}
|
|
5074
5078
|
};
|
|
5075
|
-
`,
|
|
5079
|
+
`, ia = `<script lang="ts">
|
|
5076
5080
|
import { untrack } from 'svelte';
|
|
5077
5081
|
import { Button } from '$lib/components/ui/button';
|
|
5078
5082
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -5139,7 +5143,7 @@ export const actions = {
|
|
|
5139
5143
|
</div>
|
|
5140
5144
|
</div>
|
|
5141
5145
|
</div>
|
|
5142
|
-
`,
|
|
5146
|
+
`, la = `import { describe, it, expect } from 'vitest';
|
|
5143
5147
|
import type { Match } from '@velastack/pocketbase';
|
|
5144
5148
|
import type { RouteId } from './$types';
|
|
5145
5149
|
|
|
@@ -5159,7 +5163,7 @@ describe('POST /reset', () => {
|
|
|
5159
5163
|
expect(response.body.status).toBe(200);
|
|
5160
5164
|
});
|
|
5161
5165
|
});
|
|
5162
|
-
`,
|
|
5166
|
+
`, ca = `import { redirect } from '@sveltejs/kit';
|
|
5163
5167
|
import { fail, superValidate } from 'sveltekit-superforms';
|
|
5164
5168
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
5165
5169
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
@@ -5215,7 +5219,7 @@ export const actions = {
|
|
|
5215
5219
|
return redirect(303, redirectUrl);
|
|
5216
5220
|
}
|
|
5217
5221
|
};
|
|
5218
|
-
`,
|
|
5222
|
+
`, ma = `<script lang="ts">
|
|
5219
5223
|
import { untrack } from 'svelte';
|
|
5220
5224
|
import { Button } from '$lib/components/ui/button';
|
|
5221
5225
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -5382,7 +5386,7 @@ export const actions = {
|
|
|
5382
5386
|
</div>
|
|
5383
5387
|
</div>
|
|
5384
5388
|
</div>
|
|
5385
|
-
`,
|
|
5389
|
+
`, ua = `import { describe, it, expect } from 'vitest';
|
|
5386
5390
|
import type { Match } from '@velastack/pocketbase';
|
|
5387
5391
|
import * as devalue from 'devalue';
|
|
5388
5392
|
import type { RouteId } from './$types';
|
|
@@ -5438,61 +5442,61 @@ describe('POST /signup', () => {
|
|
|
5438
5442
|
expect(data.form.errors.email[0]).toBe('Value must be unique.');
|
|
5439
5443
|
});
|
|
5440
5444
|
});
|
|
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,
|
|
5445
|
+
`, pa = /* @__PURE__ */ Object.assign({
|
|
5446
|
+
"./creates/src/lib/components/app-sidebar.svelte": gr,
|
|
5447
|
+
"./creates/src/lib/components/nav-main.svelte": br,
|
|
5448
|
+
"./creates/src/lib/components/nav-user.svelte": vr,
|
|
5449
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte": wr,
|
|
5450
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte": yr,
|
|
5451
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte": xr,
|
|
5452
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte": $r,
|
|
5453
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte": Fr,
|
|
5454
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte": Cr,
|
|
5455
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu.svelte": _r,
|
|
5456
|
+
"./creates/src/lib/components/ui/auth-menu/context.ts": Sr,
|
|
5457
|
+
"./creates/src/lib/components/ui/auth-menu/index.ts": kr,
|
|
5458
|
+
"./creates/src/lib/schemas/changeEmail.ts": Mr,
|
|
5459
|
+
"./creates/src/lib/schemas/changePassword.ts": Rr,
|
|
5460
|
+
"./creates/src/lib/schemas/confirmEmailChange.ts": Pr,
|
|
5461
|
+
"./creates/src/lib/schemas/confirmReset.ts": Er,
|
|
5462
|
+
"./creates/src/lib/schemas/login.ts": Ir,
|
|
5463
|
+
"./creates/src/lib/schemas/otp.ts": Tr,
|
|
5464
|
+
"./creates/src/lib/schemas/profile.ts": zr,
|
|
5465
|
+
"./creates/src/lib/schemas/reset.ts": Dr,
|
|
5466
|
+
"./creates/src/lib/schemas/signup.ts": Ar,
|
|
5467
|
+
"./creates/src/routes/(app)/+layout.server.ts": Nr,
|
|
5468
|
+
"./creates/src/routes/(app)/+layout.svelte": Br,
|
|
5469
|
+
"./creates/src/routes/(app)/dashboard/+page.svelte": jr,
|
|
5470
|
+
"./creates/src/routes/(app)/dashboard/server.test.ts": Lr,
|
|
5471
|
+
"./creates/src/routes/(app)/settings/+layout.server.ts": Or,
|
|
5472
|
+
"./creates/src/routes/(app)/settings/+page.server.ts": qr,
|
|
5473
|
+
"./creates/src/routes/(app)/settings/+page.svelte": Ur,
|
|
5474
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Vr,
|
|
5475
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Hr,
|
|
5476
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Gr,
|
|
5477
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": Kr,
|
|
5478
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Wr,
|
|
5479
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Xr,
|
|
5480
|
+
"./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": Yr,
|
|
5481
|
+
"./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Jr,
|
|
5482
|
+
"./creates/src/routes/(public)/login/+page.server.ts": Zr,
|
|
5483
|
+
"./creates/src/routes/(public)/login/+page.svelte": Qr,
|
|
5484
|
+
"./creates/src/routes/(public)/login/server.test.ts": ta,
|
|
5485
|
+
"./creates/src/routes/(public)/logout/+server.ts": ea,
|
|
5486
|
+
"./creates/src/routes/(public)/logout/server.test.ts": na,
|
|
5487
|
+
"./creates/src/routes/(public)/otp/[token]/+page.server.ts": ra,
|
|
5488
|
+
"./creates/src/routes/(public)/otp/[token]/+page.svelte": aa,
|
|
5489
|
+
"./creates/src/routes/(public)/otp/[token]/server.test.ts": oa,
|
|
5490
|
+
"./creates/src/routes/(public)/reset/+page.server.ts": sa,
|
|
5491
|
+
"./creates/src/routes/(public)/reset/+page.svelte": ia,
|
|
5492
|
+
"./creates/src/routes/(public)/reset/server.test.ts": la,
|
|
5493
|
+
"./creates/src/routes/(public)/signup/+page.server.ts": ca,
|
|
5494
|
+
"./creates/src/routes/(public)/signup/+page.svelte": ma,
|
|
5495
|
+
"./creates/src/routes/(public)/signup/server.test.ts": ua
|
|
5496
|
+
}), da = "./creates/";
|
|
5497
|
+
async function fa(t) {
|
|
5498
|
+
const e = Object.entries(pa).map(([a, s]) => {
|
|
5499
|
+
const i = Dt(a, da);
|
|
5496
5500
|
return {
|
|
5497
5501
|
path: i,
|
|
5498
5502
|
language: j(i),
|
|
@@ -5583,7 +5587,7 @@ async function da(t) {
|
|
|
5583
5587
|
]
|
|
5584
5588
|
};
|
|
5585
5589
|
}
|
|
5586
|
-
const
|
|
5590
|
+
const ha = `/// <reference path="../pb_data/types.d.ts" />
|
|
5587
5591
|
migrate(
|
|
5588
5592
|
(app) => {
|
|
5589
5593
|
const collection = new Collection({
|
|
@@ -5769,7 +5773,7 @@ migrate(
|
|
|
5769
5773
|
return app.delete(collection);
|
|
5770
5774
|
}
|
|
5771
5775
|
);
|
|
5772
|
-
`,
|
|
5776
|
+
`, ga = `/// <reference path="../pb_data/types.d.ts" />
|
|
5773
5777
|
migrate(
|
|
5774
5778
|
(app) => {
|
|
5775
5779
|
const collection = app.findCollectionByNameOrId('_pb_users_auth_');
|
|
@@ -5824,7 +5828,7 @@ migrate(
|
|
|
5824
5828
|
return app.save(collection);
|
|
5825
5829
|
}
|
|
5826
5830
|
);
|
|
5827
|
-
`,
|
|
5831
|
+
`, ba = `import {
|
|
5828
5832
|
POCKETBASE_URL,
|
|
5829
5833
|
POCKETBASE_SUPERUSER_EMAIL,
|
|
5830
5834
|
POCKETBASE_SUPERUSER_PASSWORD
|
|
@@ -5837,7 +5841,7 @@ export const handle = handlePocketbase({
|
|
|
5837
5841
|
superuserPassword: POCKETBASE_SUPERUSER_PASSWORD,
|
|
5838
5842
|
auth: { protectedRoutes: ['/(app)'] }
|
|
5839
5843
|
});
|
|
5840
|
-
`,
|
|
5844
|
+
`, va = `<script lang="ts">
|
|
5841
5845
|
import { toggleMode } from 'mode-watcher';
|
|
5842
5846
|
import * as Navbar from '$lib/components/ui/navbar';
|
|
5843
5847
|
import { Button } from '$lib/components/ui/button';
|
|
@@ -5939,23 +5943,23 @@ export const handle = handlePocketbase({
|
|
|
5939
5943
|
@apply container mx-auto max-w-7xl px-4 py-8 w-full;
|
|
5940
5944
|
}
|
|
5941
5945
|
</style>
|
|
5942
|
-
`,
|
|
5946
|
+
`, wa = `import { loadFlash } from "sveltekit-flash-message/server";
|
|
5943
5947
|
|
|
5944
5948
|
export const load = loadFlash(async ({ locals }) => {
|
|
5945
5949
|
return {
|
|
5946
5950
|
user: locals.pb.authStore.record,
|
|
5947
5951
|
};
|
|
5948
5952
|
});
|
|
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,
|
|
5953
|
+
`, ya = /* @__PURE__ */ Object.assign({
|
|
5954
|
+
"./preview-modifies/migrations/1776099881_created_oauth_accounts.js": ha,
|
|
5955
|
+
"./preview-modifies/migrations/1776099881_updated_users.js": ga,
|
|
5956
|
+
"./preview-modifies/src/hooks.server.ts": ba,
|
|
5957
|
+
"./preview-modifies/src/routes/(public)/root-layout.svelte": va,
|
|
5958
|
+
"./preview-modifies/src/routes/+layout.server.ts": wa
|
|
5959
|
+
}), xa = "./preview-modifies/";
|
|
5960
|
+
async function $a(t) {
|
|
5961
|
+
const e = Object.entries(ya).map(([n, r]) => {
|
|
5962
|
+
const a = Dt(n, xa);
|
|
5959
5963
|
return {
|
|
5960
5964
|
path: a,
|
|
5961
5965
|
language: j(a),
|
|
@@ -5971,18 +5975,18 @@ async function xa(t) {
|
|
|
5971
5975
|
collections: []
|
|
5972
5976
|
};
|
|
5973
5977
|
}
|
|
5974
|
-
const
|
|
5975
|
-
async function
|
|
5976
|
-
const e = await
|
|
5978
|
+
const Fa = "enable-auth";
|
|
5979
|
+
async function Ca(t) {
|
|
5980
|
+
const e = await fa(t);
|
|
5977
5981
|
if (t.env === "preview") {
|
|
5978
|
-
const s = await
|
|
5982
|
+
const s = await $a();
|
|
5979
5983
|
return k(pt([e, s]));
|
|
5980
5984
|
}
|
|
5981
|
-
const { generate: n } = await import("./generate.runtime-
|
|
5985
|
+
const { generate: n } = await import("./generate.runtime-BT46R-FS.js"), r = await n(t), { writeResult: a } = await import("./write-result-DG5OAbe1.js");
|
|
5982
5986
|
return a(await k(pt([e, r])), t);
|
|
5983
5987
|
}
|
|
5984
|
-
const
|
|
5985
|
-
slug:
|
|
5988
|
+
const _a = {
|
|
5989
|
+
slug: Fa,
|
|
5986
5990
|
title: "Enable authentication",
|
|
5987
5991
|
summary: "Enables authentication.",
|
|
5988
5992
|
categories: ["authentication"],
|
|
@@ -5996,29 +6000,30 @@ const Ca = {
|
|
|
5996
6000
|
],
|
|
5997
6001
|
command: {
|
|
5998
6002
|
raw: "vela enable auth",
|
|
5999
|
-
|
|
6003
|
+
base: "vela enable auth",
|
|
6004
|
+
argv: []
|
|
6000
6005
|
},
|
|
6001
6006
|
baseline: "velastack",
|
|
6002
|
-
generate:
|
|
6003
|
-
},
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
],
|
|
6007
|
+
generate: Ca
|
|
6008
|
+
}, Zt = [
|
|
6009
|
+
Pn,
|
|
6010
|
+
hr,
|
|
6011
|
+
Vn,
|
|
6012
|
+
ir,
|
|
6013
|
+
_a
|
|
6014
|
+
], Sa = Zt.reduce(
|
|
6010
6015
|
(t, e) => (t[e.slug] = e, t),
|
|
6011
6016
|
{}
|
|
6012
|
-
),
|
|
6017
|
+
), Ia = {
|
|
6013
6018
|
version: "0.1.0",
|
|
6014
|
-
patterns:
|
|
6015
|
-
bySlug:
|
|
6019
|
+
patterns: Zt,
|
|
6020
|
+
bySlug: Sa
|
|
6016
6021
|
};
|
|
6017
6022
|
export {
|
|
6018
|
-
|
|
6019
|
-
|
|
6023
|
+
Pa as D,
|
|
6024
|
+
Ea as M,
|
|
6020
6025
|
p as d,
|
|
6021
|
-
|
|
6026
|
+
Ia as i,
|
|
6022
6027
|
j as l
|
|
6023
6028
|
};
|
|
6024
|
-
//# sourceMappingURL=index-
|
|
6029
|
+
//# sourceMappingURL=index-CbDX3h_c.js.map
|