@velastack/patterns 0.0.20 → 0.0.22
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-C7dgGs-E.js → collections-Ch4kZjuV.js} +3 -3
- package/dist/chunks/{collections-C7dgGs-E.js.map → collections-Ch4kZjuV.js.map} +1 -1
- package/dist/chunks/{env.runtime-DwDRkEXV.js → env.runtime-BauEimvd.js} +2 -2
- package/dist/chunks/{env.runtime-DwDRkEXV.js.map → env.runtime-BauEimvd.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DcDyK2xK.js → generate.runtime-CnxTssBQ.js} +3 -3
- package/dist/chunks/{generate.runtime-DcDyK2xK.js.map → generate.runtime-CnxTssBQ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D21wXYWT.js → generate.runtime-D5bvTbSL.js} +2 -2
- package/dist/chunks/{generate.runtime-D21wXYWT.js.map → generate.runtime-D5bvTbSL.js.map} +1 -1
- package/dist/chunks/{generate.runtime-cNqC7P0N.js → generate.runtime-Tk3iuGQE.js} +2 -2
- package/dist/chunks/{generate.runtime-cNqC7P0N.js.map → generate.runtime-Tk3iuGQE.js.map} +1 -1
- package/dist/chunks/{generate.runtime-toUqgDQY.js → generate.runtime-hZV63PD9.js} +4 -4
- package/dist/chunks/{generate.runtime-toUqgDQY.js.map → generate.runtime-hZV63PD9.js.map} +1 -1
- package/dist/chunks/{index-GTS4D08Z.js → index-CoeyNVkU.js} +1124 -1213
- package/dist/chunks/index-CoeyNVkU.js.map +1 -0
- package/dist/chunks/{pocketbase-QZ34CciJ.js → pocketbase-rvyHmLFw.js} +2 -2
- package/dist/chunks/{pocketbase-QZ34CciJ.js.map → pocketbase-rvyHmLFw.js.map} +1 -1
- package/dist/chunks/{write-result-DmD7kWlV.js → write-result-1Q3LB_k4.js} +27 -25
- package/dist/chunks/write-result-1Q3LB_k4.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/index-GTS4D08Z.js.map +0 -1
- package/dist/chunks/write-result-DmD7kWlV.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
version:
|
|
1
|
+
import te from "prettier";
|
|
2
|
+
import ee from "prettier-plugin-svelte";
|
|
3
|
+
const ne = "0.0.22", ae = {
|
|
4
|
+
version: ne
|
|
5
5
|
};
|
|
6
|
-
function
|
|
6
|
+
function re(t) {
|
|
7
7
|
return t.language === "ts" || t.language === "svelte" || t.path.endsWith(".json");
|
|
8
8
|
}
|
|
9
|
-
async function
|
|
10
|
-
if (!
|
|
9
|
+
async function oe(t) {
|
|
10
|
+
if (!re(t))
|
|
11
11
|
return t;
|
|
12
12
|
try {
|
|
13
|
-
const e = await
|
|
13
|
+
const e = await te.format(t.content, {
|
|
14
14
|
filepath: t.path,
|
|
15
|
-
plugins: [
|
|
15
|
+
plugins: [ee]
|
|
16
16
|
});
|
|
17
17
|
return {
|
|
18
18
|
...t,
|
|
@@ -23,7 +23,7 @@ async function ie(t) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
async function ut(t) {
|
|
26
|
-
return Promise.all(t.map((e) =>
|
|
26
|
+
return Promise.all(t.map((e) => oe(e)));
|
|
27
27
|
}
|
|
28
28
|
async function $(t) {
|
|
29
29
|
const [e, n] = await Promise.all([
|
|
@@ -50,21 +50,21 @@ function gt(t) {
|
|
|
50
50
|
for (var e = 1; e < arguments.length; e++) {
|
|
51
51
|
var n = arguments[e] != null ? arguments[e] : {};
|
|
52
52
|
e % 2 ? ft(Object(n), !0).forEach(function(a) {
|
|
53
|
-
|
|
53
|
+
se(t, a, n[a]);
|
|
54
54
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : ft(Object(n)).forEach(function(a) {
|
|
55
55
|
Object.defineProperty(t, a, Object.getOwnPropertyDescriptor(n, a));
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
return t;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
return e =
|
|
60
|
+
function se(t, e, n) {
|
|
61
|
+
return e = ie(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
var e =
|
|
63
|
+
function ie(t) {
|
|
64
|
+
var e = le(t, "string");
|
|
65
65
|
return typeof e == "symbol" ? e : String(e);
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function le(t, e) {
|
|
68
68
|
if (typeof t != "object" || t === null) return t;
|
|
69
69
|
var n = t[Symbol.toPrimitive];
|
|
70
70
|
if (n !== void 0) {
|
|
@@ -74,9 +74,9 @@ function me(t, e) {
|
|
|
74
74
|
}
|
|
75
75
|
return (e === "string" ? String : Number)(t);
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
function
|
|
79
|
-
return e.withOptions = (n) =>
|
|
77
|
+
const u = Et({});
|
|
78
|
+
function Et(t) {
|
|
79
|
+
return e.withOptions = (n) => Et(gt(gt({}, t), n)), e;
|
|
80
80
|
function e(n, ...a) {
|
|
81
81
|
const r = typeof n == "string" ? [n] : n.raw, {
|
|
82
82
|
alignValues: s = !1,
|
|
@@ -84,41 +84,41 @@ function Dt(t) {
|
|
|
84
84
|
trimWhitespace: o = !0
|
|
85
85
|
} = t;
|
|
86
86
|
let c = "";
|
|
87
|
-
for (let
|
|
88
|
-
let
|
|
89
|
-
if (i && (
|
|
90
|
-
const y = s ?
|
|
87
|
+
for (let p = 0; p < r.length; p++) {
|
|
88
|
+
let g = r[p];
|
|
89
|
+
if (i && (g = g.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), c += g, p < a.length) {
|
|
90
|
+
const y = s ? ce(a[p], c) : a[p];
|
|
91
91
|
c += y;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
const m = c.split(`
|
|
95
95
|
`);
|
|
96
|
-
let
|
|
97
|
-
for (const
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const y =
|
|
101
|
-
|
|
96
|
+
let h = null;
|
|
97
|
+
for (const p of m) {
|
|
98
|
+
const g = p.match(/^(\s+)\S+/);
|
|
99
|
+
if (g) {
|
|
100
|
+
const y = g[1].length;
|
|
101
|
+
h ? h = Math.min(h, y) : h = y;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
if (
|
|
105
|
-
const
|
|
106
|
-
c = m.map((
|
|
104
|
+
if (h !== null) {
|
|
105
|
+
const p = h;
|
|
106
|
+
c = m.map((g) => g[0] === " " || g[0] === " " ? g.slice(p) : g).join(`
|
|
107
107
|
`);
|
|
108
108
|
}
|
|
109
109
|
return o && (c = c.trim()), i && (c = c.replace(/\\n/g, `
|
|
110
|
-
`).replace(/\\t/g, " ").replace(/\\r/g, "\r").replace(/\\v/g, "\v").replace(/\\b/g, "\b").replace(/\\f/g, "\f").replace(/\\0/g, "\0").replace(/\\x([\da-fA-F]{2})/g, (
|
|
110
|
+
`).replace(/\\t/g, " ").replace(/\\r/g, "\r").replace(/\\v/g, "\v").replace(/\\b/g, "\b").replace(/\\f/g, "\f").replace(/\\0/g, "\0").replace(/\\x([\da-fA-F]{2})/g, (p, g) => String.fromCharCode(parseInt(g, 16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g, (p, g) => String.fromCodePoint(parseInt(g, 16))).replace(/\\u([\da-fA-F]{4})/g, (p, g) => String.fromCharCode(parseInt(g, 16)))), typeof Bun < "u" && (c = c.replace(
|
|
111
111
|
// Matches e.g. \\u{1f60a} or \\u5F1F
|
|
112
112
|
/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,
|
|
113
|
-
(
|
|
113
|
+
(p, g, y) => {
|
|
114
114
|
var d;
|
|
115
|
-
const l = (d =
|
|
115
|
+
const l = (d = g ?? y) !== null && d !== void 0 ? d : "";
|
|
116
116
|
return String.fromCodePoint(parseInt(l, 16));
|
|
117
117
|
}
|
|
118
118
|
)), c;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function ce(t, e) {
|
|
122
122
|
if (typeof t != "string" || !t.includes(`
|
|
123
123
|
`))
|
|
124
124
|
return t;
|
|
@@ -150,7 +150,7 @@ function I(t) {
|
|
|
150
150
|
}
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
|
-
const
|
|
153
|
+
const me = {
|
|
154
154
|
text: ["form", "input"],
|
|
155
155
|
number: ["form", "input"],
|
|
156
156
|
email: ["form", "input"],
|
|
@@ -165,7 +165,7 @@ const pe = {
|
|
|
165
165
|
url: ["form", "input"],
|
|
166
166
|
editor: ["form", "textarea"],
|
|
167
167
|
autodate: ["form", "input"]
|
|
168
|
-
},
|
|
168
|
+
}, de = {
|
|
169
169
|
form: ['import * as Form from "$lib/components/ui/form";'],
|
|
170
170
|
"file-form": ['import * as FileForm from "$lib/components/ui/file-form";'],
|
|
171
171
|
multiselect: [
|
|
@@ -182,11 +182,11 @@ const pe = {
|
|
|
182
182
|
function T(t) {
|
|
183
183
|
return `$formData.${t.name}`;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function q(t) {
|
|
186
186
|
return t.inputProps ? Object.entries(t.inputProps).flatMap(([e, n]) => n == null || n === !1 ? [] : n === !0 ? [` ${e}`] : [` ${e}=${JSON.stringify(String(n))}`]).join("") : "";
|
|
187
187
|
}
|
|
188
188
|
function E(t) {
|
|
189
|
-
return t.labelAside ?
|
|
189
|
+
return t.labelAside ? u`
|
|
190
190
|
<div class="flex justify-between">
|
|
191
191
|
<Form.Label>${t.title}</Form.Label>
|
|
192
192
|
${t.labelAside}
|
|
@@ -195,39 +195,39 @@ function E(t) {
|
|
|
195
195
|
}
|
|
196
196
|
function A(t, e) {
|
|
197
197
|
const n = t.required ? " required" : "";
|
|
198
|
-
return
|
|
198
|
+
return u`
|
|
199
199
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
200
200
|
<Form.Control>
|
|
201
201
|
{#snippet children({ props })}
|
|
202
202
|
${E(t)}
|
|
203
|
-
<Input {...props} type="${e}" bind:value={${T(t)}}${n}${
|
|
203
|
+
<Input {...props} type="${e}" bind:value={${T(t)}}${n}${q(t)} />
|
|
204
204
|
{/snippet}
|
|
205
205
|
</Form.Control>
|
|
206
206
|
<Form.FieldErrors class="contents text-destructive" />
|
|
207
207
|
</Form.Field>
|
|
208
208
|
`;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function pe(t) {
|
|
211
211
|
const e = t.required ? " required" : "";
|
|
212
|
-
return
|
|
212
|
+
return u`
|
|
213
213
|
<Form.Field {form} name="${t.name}" class="col-span-2">
|
|
214
214
|
<Form.Control>
|
|
215
215
|
{#snippet children({ props })}
|
|
216
216
|
${E(t)}
|
|
217
|
-
<Textarea {...props} bind:value={${T(t)}}${e}${
|
|
217
|
+
<Textarea {...props} bind:value={${T(t)}}${e}${q(t)} />
|
|
218
218
|
{/snippet}
|
|
219
219
|
</Form.Control>
|
|
220
220
|
<Form.FieldErrors class="contents text-destructive" />
|
|
221
221
|
</Form.Field>
|
|
222
222
|
`;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function ue(t) {
|
|
225
225
|
const e = t.required ? " required" : "";
|
|
226
|
-
return
|
|
226
|
+
return u`
|
|
227
227
|
<Form.Field {form} name="${t.name}" class="col-span-1 flex items-start space-x-2">
|
|
228
228
|
<Form.Control>
|
|
229
229
|
{#snippet children({ props })}
|
|
230
|
-
<Checkbox {...props} bind:checked={${T(t)}}${e}${
|
|
230
|
+
<Checkbox {...props} bind:checked={${T(t)}}${e}${q(t)} />
|
|
231
231
|
${E(t)}
|
|
232
232
|
{/snippet}
|
|
233
233
|
</Form.Control>
|
|
@@ -235,8 +235,8 @@ function ge(t) {
|
|
|
235
235
|
</Form.Field>
|
|
236
236
|
`;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
return
|
|
238
|
+
function fe(t) {
|
|
239
|
+
return u`
|
|
240
240
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
241
241
|
<Form.Control>
|
|
242
242
|
{#snippet children({ props })}
|
|
@@ -248,9 +248,9 @@ function he(t) {
|
|
|
248
248
|
</Form.Field>
|
|
249
249
|
`;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function ge(t) {
|
|
252
252
|
const e = t.required ? " required" : "", n = t.maxSelect > 1 ? "Multiple" : "Single";
|
|
253
|
-
return
|
|
253
|
+
return u`
|
|
254
254
|
<FileForm.Field {form} name="${t.name}" class="col-span-1">
|
|
255
255
|
<Form.Control>
|
|
256
256
|
{#snippet children({ props })}
|
|
@@ -266,7 +266,7 @@ function be(t) {
|
|
|
266
266
|
</div>
|
|
267
267
|
{/snippet}
|
|
268
268
|
{#snippet input()}
|
|
269
|
-
<FileForm.Input {...props}${e}${
|
|
269
|
+
<FileForm.Input {...props}${e}${q(t)} />
|
|
270
270
|
{/snippet}
|
|
271
271
|
</FileForm.${n}>
|
|
272
272
|
{/snippet}
|
|
@@ -275,12 +275,12 @@ function be(t) {
|
|
|
275
275
|
</FileForm.Field>
|
|
276
276
|
`;
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function he(t) {
|
|
279
279
|
const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", a = t.maxSelect > 1 ? "Select options" : "Select an option", r = t.options.map(
|
|
280
280
|
(s) => `<MultiSelect.Item value=${JSON.stringify(s.value)} label={${t.name}Labels[${JSON.stringify(s.value)}].label} />`
|
|
281
281
|
).join(`
|
|
282
282
|
`);
|
|
283
|
-
return
|
|
283
|
+
return u`
|
|
284
284
|
<MultiSelect.Field {form} type="${e}" name="${t.name}"${n} class="col-span-1">
|
|
285
285
|
<Form.Control>
|
|
286
286
|
{#snippet children({ props })}
|
|
@@ -313,9 +313,9 @@ function ve(t) {
|
|
|
313
313
|
</MultiSelect.Field>
|
|
314
314
|
`;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function be(t) {
|
|
317
317
|
const e = t.maxSelect > 1 ? "multiple" : "single", n = t.maxSelect > 1 ? `Select ${t.relatedModel.pluralDisplayName.toLowerCase()}` : `Select ${t.relatedModel.displayName.toLowerCase()}`, a = `Search ${t.relatedModel.pluralDisplayName.toLowerCase()}...`, r = `No ${t.relatedModel.pluralDisplayName.toLowerCase()} found`, s = t.relatedModel.name, i = t.relatedModel.pluralName;
|
|
318
|
-
return
|
|
318
|
+
return u`
|
|
319
319
|
<MultiSelect.Field {form} type="${e}" name="${t.name}" class="col-span-1">
|
|
320
320
|
<Form.Control>
|
|
321
321
|
{#snippet children({ props })}
|
|
@@ -351,20 +351,20 @@ function we(t) {
|
|
|
351
351
|
</MultiSelect.Field>
|
|
352
352
|
`;
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
return
|
|
354
|
+
function ve(t) {
|
|
355
|
+
return u`
|
|
356
356
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
357
357
|
<Form.Control>
|
|
358
358
|
{#snippet children({ props })}
|
|
359
359
|
${E(t)}
|
|
360
|
-
<Input {...props} type="text" value={${T(t)}}${
|
|
360
|
+
<Input {...props} type="text" value={${T(t)}}${q(t)} readonly />
|
|
361
361
|
{/snippet}
|
|
362
362
|
</Form.Control>
|
|
363
363
|
<Form.FieldErrors class="contents text-destructive" />
|
|
364
364
|
</Form.Field>
|
|
365
365
|
`;
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function it(t) {
|
|
368
368
|
switch (t.type) {
|
|
369
369
|
case "text":
|
|
370
370
|
return A(t, "text");
|
|
@@ -379,27 +379,27 @@ function ot(t) {
|
|
|
379
379
|
case "url":
|
|
380
380
|
return A(t, "url");
|
|
381
381
|
case "autodate":
|
|
382
|
-
return
|
|
382
|
+
return ve(t);
|
|
383
383
|
case "editor":
|
|
384
384
|
case "json":
|
|
385
|
-
return
|
|
385
|
+
return pe(t);
|
|
386
386
|
case "bool":
|
|
387
|
-
return
|
|
387
|
+
return ue(t);
|
|
388
388
|
case "geoPoint":
|
|
389
|
-
return
|
|
389
|
+
return fe(t);
|
|
390
390
|
case "file":
|
|
391
|
-
return
|
|
391
|
+
return ge(t);
|
|
392
392
|
case "select":
|
|
393
|
-
return
|
|
393
|
+
return he(t);
|
|
394
394
|
case "relation":
|
|
395
|
-
return
|
|
395
|
+
return be(t);
|
|
396
396
|
default:
|
|
397
397
|
return t;
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function Dt(t) {
|
|
401
401
|
const e = t.options.map(
|
|
402
|
-
(n) =>
|
|
402
|
+
(n) => u`
|
|
403
403
|
${JSON.stringify(n.value)}: {
|
|
404
404
|
label: ${JSON.stringify(n.label)},
|
|
405
405
|
value: ${JSON.stringify(n.value)}
|
|
@@ -407,56 +407,56 @@ function zt(t) {
|
|
|
407
407
|
`
|
|
408
408
|
).join(`,
|
|
409
409
|
`);
|
|
410
|
-
return
|
|
410
|
+
return u`
|
|
411
411
|
const ${t.name}Labels = {
|
|
412
412
|
${e}
|
|
413
413
|
} as const;
|
|
414
414
|
`;
|
|
415
415
|
}
|
|
416
|
-
function
|
|
417
|
-
const e = t.flatMap((n) =>
|
|
416
|
+
function N(t) {
|
|
417
|
+
const e = t.flatMap((n) => me[n.type]);
|
|
418
418
|
return [...new Set(e)];
|
|
419
419
|
}
|
|
420
|
-
function
|
|
420
|
+
function lt(t) {
|
|
421
421
|
return [
|
|
422
|
-
...new Set(t.flatMap((e) =>
|
|
422
|
+
...new Set(t.flatMap((e) => de[e]))
|
|
423
423
|
];
|
|
424
424
|
}
|
|
425
425
|
function P(t, e) {
|
|
426
426
|
return `data.${t.name}.${e.name}`;
|
|
427
427
|
}
|
|
428
|
-
function
|
|
429
|
-
return
|
|
428
|
+
function at(t, e, n) {
|
|
429
|
+
return u`
|
|
430
430
|
<div class="space-y-2">
|
|
431
431
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
432
432
|
<p class="text-muted-foreground">${n}</p>
|
|
433
433
|
</div>
|
|
434
434
|
`;
|
|
435
435
|
}
|
|
436
|
-
function
|
|
437
|
-
const n = P(t, e), a = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, r = e.required ? a :
|
|
436
|
+
function we(t, e) {
|
|
437
|
+
const n = P(t, e), a = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, r = e.required ? a : u`
|
|
438
438
|
{#if ${n}}
|
|
439
439
|
${a}
|
|
440
440
|
{/if}
|
|
441
441
|
`;
|
|
442
|
-
return
|
|
442
|
+
return u`
|
|
443
443
|
<div class="space-y-2">
|
|
444
444
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
445
445
|
${r}
|
|
446
446
|
</div>
|
|
447
447
|
`;
|
|
448
448
|
}
|
|
449
|
-
function
|
|
450
|
-
const n = P(t, e), a =
|
|
449
|
+
function xe(t, e) {
|
|
450
|
+
const n = P(t, e), a = u`
|
|
451
451
|
<a href={${n}} target="_blank" rel="noopener noreferrer">
|
|
452
452
|
{${n}}
|
|
453
453
|
</a>
|
|
454
|
-
`, r = e.required ? a :
|
|
454
|
+
`, r = e.required ? a : u`
|
|
455
455
|
{#if ${n}}
|
|
456
456
|
${a}
|
|
457
457
|
{/if}
|
|
458
458
|
`;
|
|
459
|
-
return
|
|
459
|
+
return u`
|
|
460
460
|
<div class="space-y-2">
|
|
461
461
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
462
462
|
<p class="text-muted-foreground">
|
|
@@ -465,10 +465,10 @@ function $e(t, e) {
|
|
|
465
465
|
</div>
|
|
466
466
|
`;
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function ye(t, e) {
|
|
469
469
|
const n = P(t, e);
|
|
470
470
|
if (e.maxSelect > 1)
|
|
471
|
-
return
|
|
471
|
+
return u`
|
|
472
472
|
<div class="space-y-2">
|
|
473
473
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
474
474
|
{#each ${n} as ${e.name}}
|
|
@@ -476,21 +476,21 @@ function _e(t, e) {
|
|
|
476
476
|
{/each}
|
|
477
477
|
</div>
|
|
478
478
|
`;
|
|
479
|
-
const a = `<Badge variant="outline" class="mr-1">{${e.name}Labels[${n}].label}</Badge>`, r = e.required ? a :
|
|
479
|
+
const a = `<Badge variant="outline" class="mr-1">{${e.name}Labels[${n}].label}</Badge>`, r = e.required ? a : u`
|
|
480
480
|
{#if ${n}}
|
|
481
481
|
${a}
|
|
482
482
|
{/if}
|
|
483
483
|
`;
|
|
484
|
-
return
|
|
484
|
+
return u`
|
|
485
485
|
<div class="space-y-2">
|
|
486
486
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
487
487
|
${r}
|
|
488
488
|
</div>
|
|
489
489
|
`;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function $e(t, e) {
|
|
492
492
|
const n = P(t, e);
|
|
493
|
-
return e.maxSelect > 1 ?
|
|
493
|
+
return e.maxSelect > 1 ? u`
|
|
494
494
|
<div class="space-y-2">
|
|
495
495
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
496
496
|
{#if ${n}}
|
|
@@ -512,7 +512,7 @@ function Ce(t, e) {
|
|
|
512
512
|
{/each}
|
|
513
513
|
{/if}
|
|
514
514
|
</div>
|
|
515
|
-
` :
|
|
515
|
+
` : u`
|
|
516
516
|
<div class="space-y-2">
|
|
517
517
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
518
518
|
{#if ${n}}
|
|
@@ -534,12 +534,12 @@ function Ce(t, e) {
|
|
|
534
534
|
</div>
|
|
535
535
|
`;
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function _e(t) {
|
|
538
538
|
return `/${t.relatedModel.routeSegment}`;
|
|
539
539
|
}
|
|
540
|
-
function
|
|
541
|
-
const n = `data.${t.name}.expand?.${e.name}`, a =
|
|
542
|
-
return e.maxSelect > 1 ?
|
|
540
|
+
function Ce(t, e) {
|
|
541
|
+
const n = `data.${t.name}.expand?.${e.name}`, a = _e(e);
|
|
542
|
+
return e.maxSelect > 1 ? u`
|
|
543
543
|
<div class="space-y-2">
|
|
544
544
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
545
545
|
{#each ${n} ?? [] as ${e.singularRelationName}}
|
|
@@ -551,7 +551,7 @@ function Fe(t, e) {
|
|
|
551
551
|
</a>
|
|
552
552
|
{/each}
|
|
553
553
|
</div>
|
|
554
|
-
` :
|
|
554
|
+
` : u`
|
|
555
555
|
<div class="space-y-2">
|
|
556
556
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
557
557
|
{#if ${n}}
|
|
@@ -565,8 +565,8 @@ function Fe(t, e) {
|
|
|
565
565
|
</div>
|
|
566
566
|
`;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
569
|
-
const n = P(t, e), a =
|
|
568
|
+
function Se(t, e) {
|
|
569
|
+
const n = P(t, e), a = u`
|
|
570
570
|
{#await import("$lib/components/ui/leaflet/leaflet.svelte")}
|
|
571
571
|
<div class="h-56.25 w-full bg-input rounded-md"></div>
|
|
572
572
|
{:then { default: Leaflet }}
|
|
@@ -575,31 +575,31 @@ function ke(t, e) {
|
|
|
575
575
|
<p class="text-muted-foreground">
|
|
576
576
|
{${n}?.lat.toFixed(6)}, {${n}?.lon.toFixed(6)}
|
|
577
577
|
</p>
|
|
578
|
-
`, r = e.required ? a :
|
|
578
|
+
`, r = e.required ? a : u`
|
|
579
579
|
{#if ${n}}
|
|
580
580
|
${a}
|
|
581
581
|
{/if}
|
|
582
582
|
`;
|
|
583
|
-
return
|
|
583
|
+
return u`
|
|
584
584
|
<div class="space-y-2">
|
|
585
585
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
586
586
|
${r}
|
|
587
587
|
</div>
|
|
588
588
|
`;
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function Fe(t, e) {
|
|
591
591
|
switch (e.type) {
|
|
592
592
|
case "text":
|
|
593
593
|
case "number":
|
|
594
594
|
case "email":
|
|
595
595
|
case "editor":
|
|
596
|
-
return
|
|
596
|
+
return at(
|
|
597
597
|
t,
|
|
598
598
|
e,
|
|
599
599
|
`{${P(t, e)}}`
|
|
600
600
|
);
|
|
601
601
|
case "password":
|
|
602
|
-
return
|
|
602
|
+
return u`
|
|
603
603
|
<div class="space-y-2">
|
|
604
604
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
605
605
|
<p class="text-muted-foreground">
|
|
@@ -608,44 +608,44 @@ function Re(t, e) {
|
|
|
608
608
|
</div>
|
|
609
609
|
`;
|
|
610
610
|
case "bool":
|
|
611
|
-
return
|
|
611
|
+
return at(
|
|
612
612
|
t,
|
|
613
613
|
e,
|
|
614
614
|
`{${P(t, e)} ? "Yes" : "No"}`
|
|
615
615
|
);
|
|
616
616
|
case "date":
|
|
617
617
|
case "autodate":
|
|
618
|
-
return
|
|
618
|
+
return we(
|
|
619
619
|
t,
|
|
620
620
|
e
|
|
621
621
|
);
|
|
622
622
|
case "url":
|
|
623
|
-
return
|
|
623
|
+
return xe(t, e);
|
|
624
624
|
case "select":
|
|
625
|
-
return
|
|
625
|
+
return ye(t, e);
|
|
626
626
|
case "file":
|
|
627
|
-
return
|
|
627
|
+
return $e(t, e);
|
|
628
628
|
case "json":
|
|
629
|
-
return
|
|
629
|
+
return at(
|
|
630
630
|
t,
|
|
631
631
|
e,
|
|
632
632
|
`{JSON.stringify(${P(t, e)})}`
|
|
633
633
|
);
|
|
634
634
|
case "geoPoint":
|
|
635
|
-
return
|
|
635
|
+
return Se(
|
|
636
636
|
t,
|
|
637
637
|
e
|
|
638
638
|
);
|
|
639
639
|
case "relation":
|
|
640
|
-
return
|
|
640
|
+
return Ce(t, e);
|
|
641
641
|
default:
|
|
642
642
|
return e;
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
-
const
|
|
645
|
+
const ke = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), Re = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), Ie = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), Me = /[^\p{L}\d]+/giu, ht = "$1\0$2", bt = "";
|
|
646
646
|
function Bt(t) {
|
|
647
647
|
let e = t.trim();
|
|
648
|
-
e = e.replace(
|
|
648
|
+
e = e.replace(ke, ht).replace(Re, ht), e = e.replace(Me, "\0");
|
|
649
649
|
let n = 0, a = e.length;
|
|
650
650
|
for (; e.charAt(n) === "\0"; )
|
|
651
651
|
n++;
|
|
@@ -655,10 +655,10 @@ function Bt(t) {
|
|
|
655
655
|
a--;
|
|
656
656
|
return e.slice(n, a).split(/\0/g);
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function Pe(t) {
|
|
659
659
|
const e = Bt(t);
|
|
660
660
|
for (let n = 0; n < e.length; n++) {
|
|
661
|
-
const a = e[n], r =
|
|
661
|
+
const a = e[n], r = Ie.exec(a);
|
|
662
662
|
if (r) {
|
|
663
663
|
const s = r.index + (r[1] ?? r[2]).length;
|
|
664
664
|
e.splice(n, 1, a.slice(0, s), a.slice(s));
|
|
@@ -667,44 +667,44 @@ function Ee(t) {
|
|
|
667
667
|
return e;
|
|
668
668
|
}
|
|
669
669
|
function At(t, e) {
|
|
670
|
-
const [n, a, r] =
|
|
671
|
-
return n + a.map(
|
|
670
|
+
const [n, a, r] = J(t, e);
|
|
671
|
+
return n + a.map(X(e == null ? void 0 : e.locale)).join((e == null ? void 0 : e.delimiter) ?? " ") + r;
|
|
672
672
|
}
|
|
673
|
-
function
|
|
674
|
-
const [n, a, r] =
|
|
673
|
+
function O(t, e) {
|
|
674
|
+
const [n, a, r] = J(t, e), s = X(e == null ? void 0 : e.locale), i = mt(e == null ? void 0 : e.locale), o = zt(s, i);
|
|
675
675
|
return n + a.map((c, m) => m === 0 ? s(c) : o(c, m)).join("") + r;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
678
|
-
const [n, a, r] =
|
|
677
|
+
function Te(t, e) {
|
|
678
|
+
const [n, a, r] = J(t, e), s = X(e == null ? void 0 : e.locale), i = mt(e == null ? void 0 : e.locale), o = zt(s, i);
|
|
679
679
|
return n + a.map(o).join("") + r;
|
|
680
680
|
}
|
|
681
|
-
function
|
|
682
|
-
const [n, a, r] =
|
|
683
|
-
return n + a.map(
|
|
681
|
+
function ct(t, e) {
|
|
682
|
+
const [n, a, r] = J(t, e), s = X(e == null ? void 0 : e.locale), i = mt(e == null ? void 0 : e.locale);
|
|
683
|
+
return n + a.map(Be(s, i)).join(" ") + r;
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function Ee(t, e) {
|
|
686
686
|
return At(t, { delimiter: "-", ...e });
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function De(t, e) {
|
|
689
689
|
return At(t, { delimiter: "_", ...e });
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function X(t) {
|
|
692
692
|
return t === !1 ? (e) => e.toLowerCase() : (e) => e.toLocaleLowerCase(t);
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function mt(t) {
|
|
695
695
|
return (e) => e.toLocaleUpperCase(t);
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function Be(t, e) {
|
|
698
698
|
return (n) => `${e(n[0])}${t(n.slice(1))}`;
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function zt(t, e) {
|
|
701
701
|
return (n, a) => {
|
|
702
702
|
const r = n[0];
|
|
703
703
|
return (a > 0 && r >= "0" && r <= "9" ? "_" + r : e(r)) + t(n.slice(1));
|
|
704
704
|
};
|
|
705
705
|
}
|
|
706
|
-
function
|
|
707
|
-
const n = e.split ?? (e.separateNumbers ?
|
|
706
|
+
function J(t, e = {}) {
|
|
707
|
+
const n = e.split ?? (e.separateNumbers ? Pe : Bt), a = e.prefixCharacters ?? bt, r = e.suffixCharacters ?? bt;
|
|
708
708
|
let s = 0, i = t.length;
|
|
709
709
|
for (; s < t.length; ) {
|
|
710
710
|
const o = t.charAt(s);
|
|
@@ -724,62 +724,62 @@ function X(t, e = {}) {
|
|
|
724
724
|
t.slice(i)
|
|
725
725
|
];
|
|
726
726
|
}
|
|
727
|
-
function
|
|
727
|
+
function Ae(t) {
|
|
728
728
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
729
729
|
}
|
|
730
|
-
function
|
|
730
|
+
function ze(t) {
|
|
731
731
|
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.');
|
|
732
732
|
}
|
|
733
|
-
var W = { exports: {} },
|
|
734
|
-
function
|
|
733
|
+
var W = { exports: {} }, Le = W.exports, vt;
|
|
734
|
+
function Oe() {
|
|
735
735
|
return vt || (vt = 1, (function(t, e) {
|
|
736
736
|
(function(n, a) {
|
|
737
|
-
typeof
|
|
738
|
-
})(
|
|
737
|
+
typeof ze == "function" ? t.exports = a() : n.pluralize = a();
|
|
738
|
+
})(Le, function() {
|
|
739
739
|
var n = [], a = [], r = {}, s = {}, i = {};
|
|
740
740
|
function o(l) {
|
|
741
741
|
return typeof l == "string" ? new RegExp("^" + l + "$", "i") : l;
|
|
742
742
|
}
|
|
743
|
-
function c(l,
|
|
744
|
-
return l ===
|
|
743
|
+
function c(l, f) {
|
|
744
|
+
return l === f ? f : l === l.toLowerCase() ? f.toLowerCase() : l === l.toUpperCase() ? f.toUpperCase() : l[0] === l[0].toUpperCase() ? f.charAt(0).toUpperCase() + f.substr(1).toLowerCase() : f.toLowerCase();
|
|
745
745
|
}
|
|
746
|
-
function m(l,
|
|
746
|
+
function m(l, f) {
|
|
747
747
|
return l.replace(/\$(\d{1,2})/g, function(w, _) {
|
|
748
|
-
return
|
|
748
|
+
return f[_] || "";
|
|
749
749
|
});
|
|
750
750
|
}
|
|
751
|
-
function
|
|
752
|
-
return l.replace(
|
|
753
|
-
var C = m(
|
|
751
|
+
function h(l, f) {
|
|
752
|
+
return l.replace(f[0], function(w, _) {
|
|
753
|
+
var C = m(f[1], arguments);
|
|
754
754
|
return c(w === "" ? l[_ - 1] : w, C);
|
|
755
755
|
});
|
|
756
756
|
}
|
|
757
|
-
function
|
|
757
|
+
function p(l, f, w) {
|
|
758
758
|
if (!l.length || r.hasOwnProperty(l))
|
|
759
|
-
return
|
|
759
|
+
return f;
|
|
760
760
|
for (var _ = w.length; _--; ) {
|
|
761
761
|
var C = w[_];
|
|
762
|
-
if (C[0].test(
|
|
762
|
+
if (C[0].test(f)) return h(f, C);
|
|
763
763
|
}
|
|
764
|
-
return
|
|
764
|
+
return f;
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function g(l, f, w) {
|
|
767
767
|
return function(_) {
|
|
768
768
|
var C = _.toLowerCase();
|
|
769
|
-
return
|
|
769
|
+
return f.hasOwnProperty(C) ? c(_, C) : l.hasOwnProperty(C) ? c(_, l[C]) : p(C, _, w);
|
|
770
770
|
};
|
|
771
771
|
}
|
|
772
|
-
function y(l,
|
|
772
|
+
function y(l, f, w, _) {
|
|
773
773
|
return function(C) {
|
|
774
|
-
var
|
|
775
|
-
return
|
|
774
|
+
var D = C.toLowerCase();
|
|
775
|
+
return f.hasOwnProperty(D) ? !0 : l.hasOwnProperty(D) ? !1 : p(D, D, w) === D;
|
|
776
776
|
};
|
|
777
777
|
}
|
|
778
|
-
function d(l,
|
|
779
|
-
var _ =
|
|
780
|
-
return (w ?
|
|
778
|
+
function d(l, f, w) {
|
|
779
|
+
var _ = f === 1 ? d.singular(l) : d.plural(l);
|
|
780
|
+
return (w ? f + " " : "") + _;
|
|
781
781
|
}
|
|
782
|
-
return d.plural =
|
|
782
|
+
return d.plural = g(
|
|
783
783
|
i,
|
|
784
784
|
s,
|
|
785
785
|
n
|
|
@@ -787,7 +787,7 @@ function je() {
|
|
|
787
787
|
i,
|
|
788
788
|
s,
|
|
789
789
|
n
|
|
790
|
-
), d.singular =
|
|
790
|
+
), d.singular = g(
|
|
791
791
|
s,
|
|
792
792
|
i,
|
|
793
793
|
a
|
|
@@ -795,18 +795,18 @@ function je() {
|
|
|
795
795
|
s,
|
|
796
796
|
i,
|
|
797
797
|
a
|
|
798
|
-
), d.addPluralRule = function(l,
|
|
799
|
-
n.push([o(l),
|
|
800
|
-
}, d.addSingularRule = function(l,
|
|
801
|
-
a.push([o(l),
|
|
798
|
+
), d.addPluralRule = function(l, f) {
|
|
799
|
+
n.push([o(l), f]);
|
|
800
|
+
}, d.addSingularRule = function(l, f) {
|
|
801
|
+
a.push([o(l), f]);
|
|
802
802
|
}, d.addUncountableRule = function(l) {
|
|
803
803
|
if (typeof l == "string") {
|
|
804
804
|
r[l.toLowerCase()] = !0;
|
|
805
805
|
return;
|
|
806
806
|
}
|
|
807
807
|
d.addPluralRule(l, "$0"), d.addSingularRule(l, "$0");
|
|
808
|
-
}, d.addIrregularRule = function(l,
|
|
809
|
-
|
|
808
|
+
}, d.addIrregularRule = function(l, f) {
|
|
809
|
+
f = f.toLowerCase(), l = l.toLowerCase(), i[l] = f, s[f] = l;
|
|
810
810
|
}, [
|
|
811
811
|
// Pronouns.
|
|
812
812
|
["I", "we"],
|
|
@@ -1030,8 +1030,8 @@ function je() {
|
|
|
1030
1030
|
});
|
|
1031
1031
|
})(W)), W.exports;
|
|
1032
1032
|
}
|
|
1033
|
-
var
|
|
1034
|
-
const R = /* @__PURE__ */
|
|
1033
|
+
var Ue = Oe();
|
|
1034
|
+
const R = /* @__PURE__ */ Ae(Ue), Ss = "data", Fs = "migrations", je = "(public)", qe = "(app)", Ne = /* @__PURE__ */ new Set([
|
|
1035
1035
|
"break",
|
|
1036
1036
|
"case",
|
|
1037
1037
|
"catch",
|
|
@@ -1083,7 +1083,7 @@ const R = /* @__PURE__ */ Le(qe), Ps = "data", Ts = "migrations", Ne = "(public)
|
|
|
1083
1083
|
"async",
|
|
1084
1084
|
"arguments",
|
|
1085
1085
|
"constructor"
|
|
1086
|
-
]),
|
|
1086
|
+
]), Ve = {
|
|
1087
1087
|
function: "fn",
|
|
1088
1088
|
interface: "iface",
|
|
1089
1089
|
type: "type_",
|
|
@@ -1132,33 +1132,33 @@ const R = /* @__PURE__ */ Le(qe), Ps = "data", Ts = "migrations", Ne = "(public)
|
|
|
1132
1132
|
arguments: "args",
|
|
1133
1133
|
constructor: "ctor"
|
|
1134
1134
|
};
|
|
1135
|
-
function
|
|
1136
|
-
return
|
|
1135
|
+
function rt(t) {
|
|
1136
|
+
return Ne.has(t) ? Ve[t] ?? `${t}_` : t;
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1138
|
+
function He(t) {
|
|
1139
1139
|
if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(t))
|
|
1140
1140
|
throw new Error(
|
|
1141
1141
|
"Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore"
|
|
1142
1142
|
);
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1145
|
-
return t.features.auth ? `src/routes/${
|
|
1144
|
+
function Ke(t) {
|
|
1145
|
+
return t.features.auth ? `src/routes/${qe}` : `src/routes/${je}`;
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1148
|
-
const n = t.split("/"), a = n[n.length - 1], r = n.slice(0, -1), s = R.singular(
|
|
1147
|
+
function Y(t, e) {
|
|
1148
|
+
const n = t.split("/"), a = n[n.length - 1], r = n.slice(0, -1), s = R.singular(ct(a)), i = R.plural(s), o = O(s), c = Ee(i), m = [...r, c].join("/");
|
|
1149
1149
|
return {
|
|
1150
|
-
name:
|
|
1151
|
-
pluralName:
|
|
1152
|
-
typeName:
|
|
1153
|
-
tableName:
|
|
1150
|
+
name: rt(o),
|
|
1151
|
+
pluralName: rt(O(i)),
|
|
1152
|
+
typeName: Te(s),
|
|
1153
|
+
tableName: De(i),
|
|
1154
1154
|
displayName: s,
|
|
1155
1155
|
pluralDisplayName: i,
|
|
1156
|
-
schemaName: `${
|
|
1156
|
+
schemaName: `${rt(o)}Schema`,
|
|
1157
1157
|
routeSegment: m,
|
|
1158
|
-
routesDir:
|
|
1158
|
+
routesDir: Ke(e)
|
|
1159
1159
|
};
|
|
1160
1160
|
}
|
|
1161
|
-
function
|
|
1161
|
+
function Ge(t) {
|
|
1162
1162
|
const e = `${t.routesDir}/${t.routeSegment}`;
|
|
1163
1163
|
return {
|
|
1164
1164
|
list: e,
|
|
@@ -1167,7 +1167,7 @@ function We(t) {
|
|
|
1167
1167
|
edit: `${e}/[id]/edit`
|
|
1168
1168
|
};
|
|
1169
1169
|
}
|
|
1170
|
-
function
|
|
1170
|
+
function We(t) {
|
|
1171
1171
|
const e = `/${t.routeSegment}`;
|
|
1172
1172
|
return {
|
|
1173
1173
|
list: e,
|
|
@@ -1210,7 +1210,7 @@ const Xe = [
|
|
|
1210
1210
|
"url",
|
|
1211
1211
|
"id"
|
|
1212
1212
|
];
|
|
1213
|
-
function
|
|
1213
|
+
function Je(t) {
|
|
1214
1214
|
for (const e of Xe)
|
|
1215
1215
|
if (t.some((n) => n.name === e))
|
|
1216
1216
|
return e;
|
|
@@ -1219,15 +1219,15 @@ function Ze(t) {
|
|
|
1219
1219
|
function Ye(t) {
|
|
1220
1220
|
return t.map((e) => e.name).filter((e) => !e.startsWith("_"));
|
|
1221
1221
|
}
|
|
1222
|
-
function
|
|
1222
|
+
function Ze(t) {
|
|
1223
1223
|
return Object.fromEntries(t.map((e) => [e.name, e.id]));
|
|
1224
1224
|
}
|
|
1225
|
-
function
|
|
1225
|
+
function Lt(t) {
|
|
1226
1226
|
return Object.fromEntries(
|
|
1227
|
-
t.map((e) => [e.name,
|
|
1227
|
+
t.map((e) => [e.name, Je(e.fields)])
|
|
1228
1228
|
);
|
|
1229
1229
|
}
|
|
1230
|
-
const
|
|
1230
|
+
const Qe = [
|
|
1231
1231
|
"user",
|
|
1232
1232
|
"owner",
|
|
1233
1233
|
"created_by",
|
|
@@ -1236,7 +1236,7 @@ const tn = [
|
|
|
1236
1236
|
"account",
|
|
1237
1237
|
"creator"
|
|
1238
1238
|
];
|
|
1239
|
-
function
|
|
1239
|
+
function z(t) {
|
|
1240
1240
|
return t.toLowerCase();
|
|
1241
1241
|
}
|
|
1242
1242
|
function wt(t) {
|
|
@@ -1247,15 +1247,15 @@ function wt(t) {
|
|
|
1247
1247
|
operator: "="
|
|
1248
1248
|
};
|
|
1249
1249
|
}
|
|
1250
|
-
function
|
|
1251
|
-
const a = new Set((n.authCollections ?? ["users"]).map(
|
|
1252
|
-
(n.userFieldHints ??
|
|
1250
|
+
function tn(t, e, n = {}) {
|
|
1251
|
+
const a = new Set((n.authCollections ?? ["users"]).map(z)), r = new Set(
|
|
1252
|
+
(n.userFieldHints ?? Qe).map(z)
|
|
1253
1253
|
), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1254
1254
|
for (const b of t)
|
|
1255
1255
|
i.set(b.name, b), o.set(b.id, b);
|
|
1256
1256
|
if (!i.has(e))
|
|
1257
1257
|
return wt(e);
|
|
1258
|
-
if (a.has(
|
|
1258
|
+
if (a.has(z(e)))
|
|
1259
1259
|
return {
|
|
1260
1260
|
rule: "@request.auth.id = id",
|
|
1261
1261
|
ownershipChainCollections: [e],
|
|
@@ -1263,7 +1263,7 @@ function en(t, e, n = {}) {
|
|
|
1263
1263
|
operator: "="
|
|
1264
1264
|
};
|
|
1265
1265
|
function c(b) {
|
|
1266
|
-
const v =
|
|
1266
|
+
const v = z(b);
|
|
1267
1267
|
return v === "user" ? 50 : r.has(v) ? 20 : 0;
|
|
1268
1268
|
}
|
|
1269
1269
|
function m(b) {
|
|
@@ -1283,48 +1283,48 @@ function en(t, e, n = {}) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
return F.sort((x, B) => x.fieldName.localeCompare(B.fieldName)), F;
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1287
|
-
return a.has(
|
|
1286
|
+
function h(b) {
|
|
1287
|
+
return a.has(z(b));
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1289
|
+
function p(b) {
|
|
1290
1290
|
if (b.length === 0) return !1;
|
|
1291
1291
|
for (let v = 0; v < b.length - 1; v++)
|
|
1292
1292
|
if (b[v].isMulti) return !1;
|
|
1293
|
-
return
|
|
1293
|
+
return h(b[b.length - 1].to);
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1296
|
-
const v = b[b.length - 1], F = v.isMulti ? 1 : 0, x = b.every((
|
|
1297
|
-
return 100 * b.length + 50 * F - 40 *
|
|
1295
|
+
function g(b) {
|
|
1296
|
+
const v = b[b.length - 1], F = v.isMulti ? 1 : 0, x = b.every((nt) => !nt.isMulti) ? 1 : 0, B = b.reduce((nt, Qt) => nt + Qt.hintScore, 0), Zt = z(v.fieldName) === "user" ? 1 : 0;
|
|
1297
|
+
return 100 * b.length + 50 * F - 40 * Zt - 15 * x - B;
|
|
1298
1298
|
}
|
|
1299
1299
|
function y(b) {
|
|
1300
1300
|
return b.map((v) => `${v.from}.${v.fieldName}->${v.to}`).join("|");
|
|
1301
1301
|
}
|
|
1302
1302
|
const d = [], l = /* @__PURE__ */ new Set([e]);
|
|
1303
|
-
function
|
|
1303
|
+
function f(b, v, F) {
|
|
1304
1304
|
if (!(F > s)) {
|
|
1305
|
-
if (v.length > 0 &&
|
|
1305
|
+
if (v.length > 0 && h(v[v.length - 1].to) && p(v)) {
|
|
1306
1306
|
d.push([...v]);
|
|
1307
1307
|
return;
|
|
1308
1308
|
}
|
|
1309
1309
|
for (const x of m(b))
|
|
1310
|
-
l.has(x.to) || x.isMulti && !
|
|
1310
|
+
l.has(x.to) || x.isMulti && !h(x.to) || (l.add(x.to), v.push(x), f(x.to, v, F + 1), v.pop(), l.delete(x.to));
|
|
1311
1311
|
}
|
|
1312
1312
|
}
|
|
1313
|
-
if (
|
|
1313
|
+
if (f(e, [], 0), d.length === 0)
|
|
1314
1314
|
return wt(e);
|
|
1315
1315
|
d.sort((b, v) => {
|
|
1316
|
-
const F =
|
|
1316
|
+
const F = g(b) - g(v);
|
|
1317
1317
|
return F !== 0 ? F : y(b).localeCompare(y(v));
|
|
1318
1318
|
});
|
|
1319
|
-
const w = d[0], _ = w.map((b) => b.fieldName), C = [e, ...w.map((b) => b.to)], pt = w[w.length - 1].isMulti ? "?=" : "=",
|
|
1319
|
+
const w = d[0], _ = w.map((b) => b.fieldName), C = [e, ...w.map((b) => b.to)], pt = w[w.length - 1].isMulti ? "?=" : "=", Jt = _.join("."), Yt = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
|
|
1320
1320
|
return {
|
|
1321
|
-
rule: `@request.auth.id ${pt} ${
|
|
1321
|
+
rule: `@request.auth.id ${pt} ${Yt}${Jt}.id`,
|
|
1322
1322
|
ownershipChainCollections: C,
|
|
1323
1323
|
ownershipChainFields: _,
|
|
1324
1324
|
operator: pt
|
|
1325
1325
|
};
|
|
1326
1326
|
}
|
|
1327
|
-
function
|
|
1327
|
+
function en(t) {
|
|
1328
1328
|
let e = null, n = !1, a = 0;
|
|
1329
1329
|
for (let r = 0; r < t.length; r++) {
|
|
1330
1330
|
const s = t[r];
|
|
@@ -1389,7 +1389,7 @@ function yt(t) {
|
|
|
1389
1389
|
let r, s;
|
|
1390
1390
|
return e >= 0 ? (r = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (r = t.trim(), s = r), { label: xt(s), value: xt(r) };
|
|
1391
1391
|
}
|
|
1392
|
-
function
|
|
1392
|
+
function nn(t) {
|
|
1393
1393
|
const e = [];
|
|
1394
1394
|
let n = "", a = null, r = !1;
|
|
1395
1395
|
for (let i = 0; i < t.length; i++) {
|
|
@@ -1437,12 +1437,12 @@ const $t = {
|
|
|
1437
1437
|
datetime: "date",
|
|
1438
1438
|
timestamp: "date"
|
|
1439
1439
|
};
|
|
1440
|
-
function
|
|
1440
|
+
function an(t) {
|
|
1441
1441
|
const e = t.endsWith("!");
|
|
1442
1442
|
let n = e ? t.slice(0, -1) : t, a = [];
|
|
1443
1443
|
if (n.startsWith("select(") && n.endsWith(")")) {
|
|
1444
1444
|
const r = n.slice(7, -1);
|
|
1445
|
-
a =
|
|
1445
|
+
a = nn(r), n = "select";
|
|
1446
1446
|
}
|
|
1447
1447
|
return n === "files" ? { type: "file", required: e, selectOptions: a } : (n in $t && (n = $t[n]), { type: n, required: e, selectOptions: a });
|
|
1448
1448
|
}
|
|
@@ -1450,30 +1450,30 @@ function _t(t) {
|
|
|
1450
1450
|
const e = R.singular(t), n = R.plural(e);
|
|
1451
1451
|
return t === n ? 99 : 1;
|
|
1452
1452
|
}
|
|
1453
|
-
function
|
|
1454
|
-
const i =
|
|
1453
|
+
function V(t, e, n, a, r, s) {
|
|
1454
|
+
const i = Y(e, s), o = R.singular(t), c = R.plural(o);
|
|
1455
1455
|
return {
|
|
1456
1456
|
collectionId: a[e],
|
|
1457
1457
|
displayField: r[e] ?? "id",
|
|
1458
1458
|
relatedModel: i,
|
|
1459
|
-
singularRelationName:
|
|
1459
|
+
singularRelationName: O(
|
|
1460
1460
|
`${n.displayName} ${i.displayName}`
|
|
1461
1461
|
),
|
|
1462
|
-
pluralRelationName:
|
|
1462
|
+
pluralRelationName: O(
|
|
1463
1463
|
`${n.displayName} ${i.pluralDisplayName}`
|
|
1464
1464
|
),
|
|
1465
1465
|
maxSelect: t === c ? 999 : 1
|
|
1466
1466
|
};
|
|
1467
1467
|
}
|
|
1468
|
-
function
|
|
1469
|
-
const s =
|
|
1470
|
-
if (r.features.auth && i === "current_user" &&
|
|
1471
|
-
const d =
|
|
1468
|
+
function rn(t, e, n, a, r) {
|
|
1469
|
+
const s = ct(t), { type: i, required: o, selectOptions: c } = e, m = Ye(a), h = Ze(a), p = Lt(a), g = m.map((d) => R.singular(d));
|
|
1470
|
+
if (r.features.auth && i === "current_user" && h.users) {
|
|
1471
|
+
const d = V(
|
|
1472
1472
|
t,
|
|
1473
1473
|
"users",
|
|
1474
1474
|
n,
|
|
1475
|
-
|
|
1476
|
-
|
|
1475
|
+
h,
|
|
1476
|
+
p,
|
|
1477
1477
|
r
|
|
1478
1478
|
);
|
|
1479
1479
|
return {
|
|
@@ -1521,12 +1521,12 @@ function on(t, e, n, a, r) {
|
|
|
1521
1521
|
throw new Error(
|
|
1522
1522
|
`Invalid relation field: ${t}. Must be one of ${m.join(", ")} (singular or plural)`
|
|
1523
1523
|
);
|
|
1524
|
-
const
|
|
1524
|
+
const f = V(
|
|
1525
1525
|
t,
|
|
1526
1526
|
l,
|
|
1527
1527
|
n,
|
|
1528
|
-
|
|
1529
|
-
|
|
1528
|
+
h,
|
|
1529
|
+
p,
|
|
1530
1530
|
r
|
|
1531
1531
|
);
|
|
1532
1532
|
return {
|
|
@@ -1534,17 +1534,17 @@ function on(t, e, n, a, r) {
|
|
|
1534
1534
|
name: t,
|
|
1535
1535
|
title: s,
|
|
1536
1536
|
required: o,
|
|
1537
|
-
...
|
|
1537
|
+
...f,
|
|
1538
1538
|
isCurrentUser: !1
|
|
1539
1539
|
};
|
|
1540
1540
|
}
|
|
1541
1541
|
if (m.includes(i)) {
|
|
1542
|
-
const d =
|
|
1542
|
+
const d = V(
|
|
1543
1543
|
t,
|
|
1544
1544
|
i,
|
|
1545
1545
|
n,
|
|
1546
|
-
|
|
1547
|
-
|
|
1546
|
+
h,
|
|
1547
|
+
p,
|
|
1548
1548
|
r
|
|
1549
1549
|
);
|
|
1550
1550
|
return {
|
|
@@ -1556,15 +1556,15 @@ function on(t, e, n, a, r) {
|
|
|
1556
1556
|
isCurrentUser: !1
|
|
1557
1557
|
};
|
|
1558
1558
|
}
|
|
1559
|
-
if (
|
|
1559
|
+
if (g.includes(i)) {
|
|
1560
1560
|
const d = R.plural(i);
|
|
1561
1561
|
if (m.includes(d)) {
|
|
1562
|
-
const l =
|
|
1562
|
+
const l = V(
|
|
1563
1563
|
t,
|
|
1564
1564
|
d,
|
|
1565
1565
|
n,
|
|
1566
|
-
|
|
1567
|
-
|
|
1566
|
+
h,
|
|
1567
|
+
p,
|
|
1568
1568
|
r
|
|
1569
1569
|
);
|
|
1570
1570
|
return {
|
|
@@ -1619,10 +1619,10 @@ function on(t, e, n, a, r) {
|
|
|
1619
1619
|
);
|
|
1620
1620
|
return { type: i, name: t, title: s, required: o };
|
|
1621
1621
|
}
|
|
1622
|
-
function
|
|
1622
|
+
function on(t, e, n, a) {
|
|
1623
1623
|
const r = [];
|
|
1624
1624
|
for (const i of t) {
|
|
1625
|
-
const [o, c] =
|
|
1625
|
+
const [o, c] = en(i);
|
|
1626
1626
|
if (!o || !c)
|
|
1627
1627
|
throw new Error(
|
|
1628
1628
|
`Invalid field format: ${i}. Expected format: name:type or name:type!`
|
|
@@ -1631,10 +1631,10 @@ function sn(t, e, n, a) {
|
|
|
1631
1631
|
throw new Error(
|
|
1632
1632
|
`Invalid field name: ${o}. Must start with a letter and contain only alphanumeric characters`
|
|
1633
1633
|
);
|
|
1634
|
-
const m =
|
|
1635
|
-
r.push(
|
|
1634
|
+
const m = an(c);
|
|
1635
|
+
r.push(rn(o, m, e, n, a));
|
|
1636
1636
|
}
|
|
1637
|
-
const s = a.features.auth ?
|
|
1637
|
+
const s = a.features.auth ? tn(
|
|
1638
1638
|
[
|
|
1639
1639
|
...n,
|
|
1640
1640
|
{
|
|
@@ -1653,32 +1653,21 @@ function sn(t, e, n, a) {
|
|
|
1653
1653
|
) : void 0;
|
|
1654
1654
|
return { fields: r, auth: s };
|
|
1655
1655
|
}
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
if (n.env === "runtime") {
|
|
1659
|
-
const { getCollections: r } = await import("./env.runtime-DwDRkEXV.js");
|
|
1660
|
-
a = await r();
|
|
1661
|
-
} else {
|
|
1662
|
-
const { getPreviewCollections: r } = await import("./env.preview-HlXZOEL4.js");
|
|
1663
|
-
a = r(n);
|
|
1664
|
-
}
|
|
1665
|
-
return sn(t, e, a, n);
|
|
1666
|
-
}
|
|
1667
|
-
const ln = "2024-01-01T00:00:00.000Z";
|
|
1668
|
-
class j {
|
|
1656
|
+
const sn = "2024-01-01T00:00:00.000Z";
|
|
1657
|
+
class U {
|
|
1669
1658
|
constructor(e) {
|
|
1670
1659
|
this.expression = e;
|
|
1671
1660
|
}
|
|
1672
1661
|
}
|
|
1673
|
-
function
|
|
1674
|
-
return t instanceof
|
|
1662
|
+
function st(t) {
|
|
1663
|
+
return t instanceof U ? t.expression : Array.isArray(t) ? `[${t.map((e) => st(e)).join(", ")}]` : t && typeof t == "object" ? `{ ${Object.entries(t).map(([n, a]) => `${JSON.stringify(n)}: ${st(a)}`).join(", ")} }` : JSON.stringify(t);
|
|
1675
1664
|
}
|
|
1676
|
-
function
|
|
1665
|
+
function ot(t) {
|
|
1677
1666
|
return `{ ${Object.entries(t).map(
|
|
1678
|
-
([n, a]) => `${JSON.stringify(n)}: ${
|
|
1667
|
+
([n, a]) => `${JSON.stringify(n)}: ${st(a)}`
|
|
1679
1668
|
).join(", ")} }`;
|
|
1680
1669
|
}
|
|
1681
|
-
function
|
|
1670
|
+
function ln(t) {
|
|
1682
1671
|
switch (t) {
|
|
1683
1672
|
case "text":
|
|
1684
1673
|
case "number":
|
|
@@ -1714,10 +1703,10 @@ function cn(t) {
|
|
|
1714
1703
|
return;
|
|
1715
1704
|
}
|
|
1716
1705
|
}
|
|
1717
|
-
function
|
|
1706
|
+
function L(t, e) {
|
|
1718
1707
|
return t.replace("[id]", `\${${e}}`);
|
|
1719
1708
|
}
|
|
1720
|
-
function
|
|
1709
|
+
function Ot(t, e, n) {
|
|
1721
1710
|
var a, r, s;
|
|
1722
1711
|
switch (t.type) {
|
|
1723
1712
|
case "text":
|
|
@@ -1728,7 +1717,7 @@ function Ut(t, e, n) {
|
|
|
1728
1717
|
case "bool":
|
|
1729
1718
|
return !0;
|
|
1730
1719
|
case "date":
|
|
1731
|
-
return
|
|
1720
|
+
return sn;
|
|
1732
1721
|
case "email":
|
|
1733
1722
|
return `test-${t.name}@example.com`;
|
|
1734
1723
|
case "password":
|
|
@@ -1745,9 +1734,9 @@ function Ut(t, e, n) {
|
|
|
1745
1734
|
}
|
|
1746
1735
|
case "relation": {
|
|
1747
1736
|
if (n.authEnabled && (t.isCurrentUser || ((s = t.relatedModel) == null ? void 0 : s.tableName) === "users"))
|
|
1748
|
-
return new
|
|
1737
|
+
return new U("context.user.id");
|
|
1749
1738
|
const i = t.collectionId ? e[t.collectionId] : void 0;
|
|
1750
|
-
return i ? new
|
|
1739
|
+
return i ? new U(i) : "missing-relation-id";
|
|
1751
1740
|
}
|
|
1752
1741
|
case "file":
|
|
1753
1742
|
case "autodate":
|
|
@@ -1762,33 +1751,33 @@ function Ct(t, e, n) {
|
|
|
1762
1751
|
if (r.type === "file" || r.type === "autodate")
|
|
1763
1752
|
continue;
|
|
1764
1753
|
if (n.authEnabled && r.type === "relation" && r.isCurrentUser) {
|
|
1765
|
-
n.forForm || (a[r.name] = new
|
|
1754
|
+
n.forForm || (a[r.name] = new U("context.user.id"));
|
|
1766
1755
|
continue;
|
|
1767
1756
|
}
|
|
1768
|
-
const s =
|
|
1757
|
+
const s = Ot(r, e, n);
|
|
1769
1758
|
s !== void 0 && (a[r.name] = s);
|
|
1770
1759
|
}
|
|
1771
1760
|
return a;
|
|
1772
1761
|
}
|
|
1773
|
-
function
|
|
1762
|
+
function cn(t, e, n) {
|
|
1774
1763
|
var r;
|
|
1775
1764
|
const a = {};
|
|
1776
1765
|
for (const s of t) {
|
|
1777
1766
|
if (s.system || s.name === "id")
|
|
1778
1767
|
continue;
|
|
1779
|
-
const i =
|
|
1768
|
+
const i = ln(s.type);
|
|
1780
1769
|
if (!i || i === "file" || i === "autodate" || i === "relation" && !s.collectionId)
|
|
1781
1770
|
continue;
|
|
1782
1771
|
let o;
|
|
1783
1772
|
if (i === "relation")
|
|
1784
|
-
o = s.collectionId ? new
|
|
1773
|
+
o = s.collectionId ? new U(
|
|
1785
1774
|
e[s.collectionId] ?? '"missing-relation-id"'
|
|
1786
1775
|
) : void 0;
|
|
1787
1776
|
else if (i === "select") {
|
|
1788
1777
|
const c = ((r = s.values) == null ? void 0 : r[0]) ?? "default";
|
|
1789
1778
|
o = (s.maxSelect ?? 1) > 1 ? [c] : c;
|
|
1790
1779
|
} else
|
|
1791
|
-
o =
|
|
1780
|
+
o = Ot(
|
|
1792
1781
|
{ name: s.name, type: i },
|
|
1793
1782
|
e,
|
|
1794
1783
|
{ forForm: !1, authEnabled: n.features.auth }
|
|
@@ -1797,12 +1786,12 @@ function mn(t, e, n) {
|
|
|
1797
1786
|
}
|
|
1798
1787
|
return a;
|
|
1799
1788
|
}
|
|
1800
|
-
function
|
|
1801
|
-
t.email = new
|
|
1789
|
+
function mn(t) {
|
|
1790
|
+
t.email = new U(
|
|
1802
1791
|
"`test-${Math.random().toString(36).slice(2)}@example.com`"
|
|
1803
1792
|
), t.password = "password", t.passwordConfirm = "password";
|
|
1804
1793
|
}
|
|
1805
|
-
function
|
|
1794
|
+
function dn(t, e) {
|
|
1806
1795
|
if (!t)
|
|
1807
1796
|
return [];
|
|
1808
1797
|
const n = new Map(e.map((o) => [o.id, o])), a = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = [], i = (o) => {
|
|
@@ -1820,7 +1809,7 @@ function pn(t, e) {
|
|
|
1820
1809
|
o.type !== "relation" || !o.collectionId || i(o.collectionId);
|
|
1821
1810
|
return s;
|
|
1822
1811
|
}
|
|
1823
|
-
function
|
|
1812
|
+
function pn(t, e) {
|
|
1824
1813
|
if (!e.has(t))
|
|
1825
1814
|
return e.add(t), t;
|
|
1826
1815
|
let n = 2;
|
|
@@ -1829,7 +1818,7 @@ function un(t, e) {
|
|
|
1829
1818
|
const a = `${t}${n}`;
|
|
1830
1819
|
return e.add(a), a;
|
|
1831
1820
|
}
|
|
1832
|
-
function
|
|
1821
|
+
function un(t, e) {
|
|
1833
1822
|
return {
|
|
1834
1823
|
id: `generated-${t.tableName}`,
|
|
1835
1824
|
name: t.tableName,
|
|
@@ -1851,58 +1840,58 @@ function fn(t, e) {
|
|
|
1851
1840
|
} : { name: n.name, type: n.type })
|
|
1852
1841
|
};
|
|
1853
1842
|
}
|
|
1854
|
-
function
|
|
1855
|
-
const r = a.find((l) => l.name === t.tableName) ??
|
|
1843
|
+
function Ut(t, e, n, a) {
|
|
1844
|
+
const r = a.find((l) => l.name === t.tableName) ?? un(t, e), s = dn(
|
|
1856
1845
|
r,
|
|
1857
1846
|
a
|
|
1858
1847
|
).filter((l) => !(n.features.auth && l.name === "users")), i = {}, o = [], c = /* @__PURE__ */ new Set();
|
|
1859
1848
|
for (const l of s) {
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1849
|
+
const f = pn(
|
|
1850
|
+
Y(l.name, n).name,
|
|
1862
1851
|
c
|
|
1863
1852
|
);
|
|
1864
|
-
o.push({ varName:
|
|
1853
|
+
o.push({ varName: f, collection: l }), i[l.id] = `${f}.id`;
|
|
1865
1854
|
}
|
|
1866
1855
|
const m = o.length ? `${o.map((l) => `let ${l.varName}: { id: string };`).join(`
|
|
1867
1856
|
`)}
|
|
1868
1857
|
|
|
1869
|
-
` : "",
|
|
1870
|
-
({ varName: l, collection:
|
|
1871
|
-
const w =
|
|
1872
|
-
|
|
1858
|
+
` : "", h = o.map(
|
|
1859
|
+
({ varName: l, collection: f }) => {
|
|
1860
|
+
const w = cn(
|
|
1861
|
+
f.fields,
|
|
1873
1862
|
i,
|
|
1874
1863
|
n
|
|
1875
1864
|
);
|
|
1876
|
-
return
|
|
1865
|
+
return f.type === "auth" && mn(w), `${l} = await context.admin.collection("${f.name}").create(${ot(w)});`;
|
|
1877
1866
|
}
|
|
1878
|
-
),
|
|
1879
|
-
({ varName: l, collection:
|
|
1880
|
-
),
|
|
1867
|
+
), p = o.slice().reverse().map(
|
|
1868
|
+
({ varName: l, collection: f }) => `await context.admin.collection("${f.name}").delete(${l}.id);`
|
|
1869
|
+
), g = n.features.auth ? "context.agent" : "context.request", y = n.features.auth ? `await context.agent.authenticateUser();
|
|
1881
1870
|
` : "";
|
|
1882
1871
|
let d = "";
|
|
1883
|
-
return (
|
|
1872
|
+
return (h.length > 0 || n.features.auth) && (d += u`
|
|
1884
1873
|
beforeEach(async (context) => {
|
|
1885
|
-
${y}${
|
|
1874
|
+
${y}${h.join(`
|
|
1886
1875
|
`)}
|
|
1887
1876
|
});
|
|
1888
|
-
`),
|
|
1877
|
+
`), p.length > 0 && (d += `
|
|
1889
1878
|
|
|
1890
|
-
` +
|
|
1879
|
+
` + u`
|
|
1891
1880
|
afterEach(async (context) => {
|
|
1892
|
-
${
|
|
1881
|
+
${p.join(`
|
|
1893
1882
|
`)}
|
|
1894
1883
|
});
|
|
1895
1884
|
`), {
|
|
1896
1885
|
declarations: m,
|
|
1897
1886
|
setupSection: d,
|
|
1898
|
-
requestAgent:
|
|
1899
|
-
modelDbData:
|
|
1887
|
+
requestAgent: g,
|
|
1888
|
+
modelDbData: ot(
|
|
1900
1889
|
Ct(e, i, {
|
|
1901
1890
|
forForm: !1,
|
|
1902
1891
|
authEnabled: n.features.auth
|
|
1903
1892
|
})
|
|
1904
1893
|
),
|
|
1905
|
-
modelFormData:
|
|
1894
|
+
modelFormData: ot(
|
|
1906
1895
|
Ct(e, i, {
|
|
1907
1896
|
forForm: !0,
|
|
1908
1897
|
authEnabled: n.features.auth
|
|
@@ -1910,15 +1899,15 @@ function jt(t, e, n, a) {
|
|
|
1910
1899
|
)
|
|
1911
1900
|
};
|
|
1912
1901
|
}
|
|
1913
|
-
function
|
|
1902
|
+
function fn(t, e, n, a, r) {
|
|
1914
1903
|
const {
|
|
1915
1904
|
declarations: s,
|
|
1916
1905
|
setupSection: i,
|
|
1917
1906
|
requestAgent: o,
|
|
1918
1907
|
modelDbData: c,
|
|
1919
1908
|
modelFormData: m
|
|
1920
|
-
} =
|
|
1921
|
-
return
|
|
1909
|
+
} = Ut(t, n, a, r);
|
|
1910
|
+
return u`
|
|
1922
1911
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
1923
1912
|
|
|
1924
1913
|
describe("${t.pluralName}", () => {
|
|
@@ -1951,7 +1940,7 @@ function gn(t, e, n, a, r) {
|
|
|
1951
1940
|
describe("GET ${e.show}", () => {
|
|
1952
1941
|
it("should return a 200 status code", async (context) => {
|
|
1953
1942
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1954
|
-
const response = await ${o}.get(\`${
|
|
1943
|
+
const response = await ${o}.get(\`${L(e.show, "id")}\`);
|
|
1955
1944
|
expect(response.status).toBe(200);
|
|
1956
1945
|
});
|
|
1957
1946
|
|
|
@@ -1964,10 +1953,10 @@ function gn(t, e, n, a, r) {
|
|
|
1964
1953
|
describe("POST ${e.show}", () => {
|
|
1965
1954
|
it("should delete a ${t.displayName.toLowerCase()}", async (context) => {
|
|
1966
1955
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1967
|
-
const response = await ${o}.post(\`${
|
|
1956
|
+
const response = await ${o}.post(\`${L(e.show, "id")}\`).type("form");
|
|
1968
1957
|
expect(response.body.status).toBe(303);
|
|
1969
1958
|
|
|
1970
|
-
const response2 = await ${o}.get(\`${
|
|
1959
|
+
const response2 = await ${o}.get(\`${L(e.show, "id")}\`);
|
|
1971
1960
|
expect(response2.status).toBe(404);
|
|
1972
1961
|
});
|
|
1973
1962
|
});
|
|
@@ -1975,7 +1964,7 @@ function gn(t, e, n, a, r) {
|
|
|
1975
1964
|
describe("GET ${e.edit}", () => {
|
|
1976
1965
|
it("should return a 200 status code", async (context) => {
|
|
1977
1966
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1978
|
-
const response = await ${o}.get(\`${
|
|
1967
|
+
const response = await ${o}.get(\`${L(e.edit, "id")}\`);
|
|
1979
1968
|
expect(response.status).toBe(200);
|
|
1980
1969
|
});
|
|
1981
1970
|
});
|
|
@@ -1984,19 +1973,19 @@ function gn(t, e, n, a, r) {
|
|
|
1984
1973
|
it("should update a ${t.displayName.toLowerCase()}", async (context) => {
|
|
1985
1974
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1986
1975
|
const response = await ${o}
|
|
1987
|
-
.post(\`${
|
|
1976
|
+
.post(\`${L(e.edit, "id")}\`)
|
|
1988
1977
|
.type("form")
|
|
1989
1978
|
.send(${m});
|
|
1990
1979
|
expect(response.body.status).toBe(303);
|
|
1991
|
-
expect(response.body.location).toBe(\`${
|
|
1980
|
+
expect(response.body.location).toBe(\`${L(e.show, "id")}\`);
|
|
1992
1981
|
});
|
|
1993
1982
|
});
|
|
1994
1983
|
});
|
|
1995
1984
|
`;
|
|
1996
1985
|
}
|
|
1997
|
-
function
|
|
1998
|
-
const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } =
|
|
1999
|
-
return
|
|
1986
|
+
function gn(t, e, n, a, r) {
|
|
1987
|
+
const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } = Ut(t, n, a, r);
|
|
1988
|
+
return u`
|
|
2000
1989
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2001
1990
|
|
|
2002
1991
|
describe("${e}", () => {
|
|
@@ -2018,270 +2007,7 @@ function hn(t, e, n, a, r) {
|
|
|
2018
2007
|
});
|
|
2019
2008
|
`;
|
|
2020
2009
|
}
|
|
2021
|
-
|
|
2022
|
-
function wn(t, e) {
|
|
2023
|
-
const n = t.replace(/^\/+|\/+$/g, ""), a = `${e}/${n}`, r = `/${n}`;
|
|
2024
|
-
return {
|
|
2025
|
-
pagePath: a,
|
|
2026
|
-
pageUrl: r
|
|
2027
|
-
};
|
|
2028
|
-
}
|
|
2029
|
-
function xn(t) {
|
|
2030
|
-
const [e, ...n] = t;
|
|
2031
|
-
if (!e)
|
|
2032
|
-
throw new Error("Invalid command arguments. Expected: <model> <fields...>");
|
|
2033
|
-
if (n.length === 0)
|
|
2034
|
-
throw new Error("At least one field definition is required.");
|
|
2035
|
-
return { modelPath: e, fields: n };
|
|
2036
|
-
}
|
|
2037
|
-
function qt(t) {
|
|
2038
|
-
return t.some((e) => e.type === "file");
|
|
2039
|
-
}
|
|
2040
|
-
function yn(t) {
|
|
2041
|
-
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
|
|
2042
|
-
}
|
|
2043
|
-
function kt(t) {
|
|
2044
|
-
const e = t.type === "select" ? `[${t.options.map((r) => JSON.stringify(r.value)).join(", ")}]` : "";
|
|
2045
|
-
let n;
|
|
2046
|
-
switch (t.type) {
|
|
2047
|
-
case "text":
|
|
2048
|
-
n = "z.string()";
|
|
2049
|
-
break;
|
|
2050
|
-
case "number":
|
|
2051
|
-
n = "z.number()";
|
|
2052
|
-
break;
|
|
2053
|
-
case "bool":
|
|
2054
|
-
n = "z.boolean().default(false)";
|
|
2055
|
-
break;
|
|
2056
|
-
case "date":
|
|
2057
|
-
n = "z.string()";
|
|
2058
|
-
break;
|
|
2059
|
-
case "email":
|
|
2060
|
-
n = "z.string().email()";
|
|
2061
|
-
break;
|
|
2062
|
-
case "password":
|
|
2063
|
-
n = "z.string()";
|
|
2064
|
-
break;
|
|
2065
|
-
case "url":
|
|
2066
|
-
n = "z.string().url()";
|
|
2067
|
-
break;
|
|
2068
|
-
case "editor":
|
|
2069
|
-
n = "z.string()";
|
|
2070
|
-
break;
|
|
2071
|
-
case "autodate":
|
|
2072
|
-
n = "z.string()";
|
|
2073
|
-
break;
|
|
2074
|
-
case "select":
|
|
2075
|
-
e ? n = t.maxSelect > 1 ? `z.array(z.enum(${e}))` : `z.enum(${e})` : n = "z.string()";
|
|
2076
|
-
break;
|
|
2077
|
-
case "file":
|
|
2078
|
-
n = t.maxSelect > 1 ? "z.string().array()" : "z.union([z.instanceof(File), z.string()])";
|
|
2079
|
-
break;
|
|
2080
|
-
case "json":
|
|
2081
|
-
n = "z.any()";
|
|
2082
|
-
break;
|
|
2083
|
-
case "geoPoint":
|
|
2084
|
-
n = `z.preprocess((val) => {
|
|
2085
|
-
if (typeof val === "string") {
|
|
2086
|
-
return val;
|
|
2087
|
-
}
|
|
2088
|
-
return JSON.stringify(val);
|
|
2089
|
-
}, z.string()${t.required ? "" : ".optional()"}) as z.ZodEffects<${t.required ? "" : "z.ZodOptional<"}z.ZodString${t.required ? "" : ">"}, any, any>`;
|
|
2090
|
-
break;
|
|
2091
|
-
case "relation":
|
|
2092
|
-
n = t.maxSelect > 1 ? "z.array(z.string())" : "z.string()";
|
|
2093
|
-
break;
|
|
2094
|
-
default:
|
|
2095
|
-
return t;
|
|
2096
|
-
}
|
|
2097
|
-
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()`;
|
|
2098
|
-
}
|
|
2099
|
-
function $n(t) {
|
|
2100
|
-
const e = [];
|
|
2101
|
-
for (const n of t) {
|
|
2102
|
-
if (n.type === "file" && n.maxSelect > 1) {
|
|
2103
|
-
e.push({
|
|
2104
|
-
name: n.name,
|
|
2105
|
-
schema: kt({ ...n, required: !1 })
|
|
2106
|
-
}), e.push({
|
|
2107
|
-
name: `${n.name}+`,
|
|
2108
|
-
schema: "z.instanceof(File).array().optional()"
|
|
2109
|
-
}), e.push({
|
|
2110
|
-
name: `${n.name}-`,
|
|
2111
|
-
schema: "z.string().array().optional()"
|
|
2112
|
-
});
|
|
2113
|
-
continue;
|
|
2114
|
-
}
|
|
2115
|
-
e.push({ name: n.name, schema: kt(n) });
|
|
2116
|
-
}
|
|
2117
|
-
return e;
|
|
2118
|
-
}
|
|
2119
|
-
function _n(t, e) {
|
|
2120
|
-
const n = $n(e).map((a) => `${yn(a.name)}: ${a.schema}`).join(`,
|
|
2121
|
-
`);
|
|
2122
|
-
return p`
|
|
2123
|
-
import { z } from "zod/v3";
|
|
2124
|
-
|
|
2125
|
-
export const ${t.schemaName} = z.object({
|
|
2126
|
-
${n}
|
|
2127
|
-
});
|
|
2128
|
-
`;
|
|
2129
|
-
}
|
|
2130
|
-
function Cn(t, e) {
|
|
2131
|
-
const n = V(e), a = [
|
|
2132
|
-
'import { untrack } from "svelte";',
|
|
2133
|
-
'import { superForm } from "sveltekit-superforms";',
|
|
2134
|
-
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
2135
|
-
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2136
|
-
...st(n)
|
|
2137
|
-
];
|
|
2138
|
-
return [...new Set(a)];
|
|
2139
|
-
}
|
|
2140
|
-
function Sn(t, e) {
|
|
2141
|
-
const a = e.filter(
|
|
2142
|
-
(r) => r.type === "select"
|
|
2143
|
-
).map((r) => zt(r)).join(`
|
|
2144
|
-
|
|
2145
|
-
`);
|
|
2146
|
-
return p`
|
|
2147
|
-
${a}
|
|
2148
|
-
|
|
2149
|
-
const form = superForm(untrack(() => data.form), {
|
|
2150
|
-
validators: zodClient(${t.schemaName}),
|
|
2151
|
-
});
|
|
2152
|
-
|
|
2153
|
-
const { form: formData } = form;
|
|
2154
|
-
`;
|
|
2155
|
-
}
|
|
2156
|
-
function Fn(t, e) {
|
|
2157
|
-
const n = Cn(t, e).join(`
|
|
2158
|
-
`), a = Sn(t, e), r = e.map((i) => ot(i)).join(`
|
|
2159
|
-
`), s = qt(e) ? ' enctype="multipart/form-data"' : "";
|
|
2160
|
-
return p(Ft || (Ft = vn([`
|
|
2161
|
-
<script lang="ts">
|
|
2162
|
-
`, `
|
|
2163
|
-
|
|
2164
|
-
let { data } = $props();
|
|
2165
|
-
`, `
|
|
2166
|
-
<\/script>
|
|
2167
|
-
|
|
2168
|
-
<section data-role="content">
|
|
2169
|
-
<div class="flex justify-between items-center mb-4">
|
|
2170
|
-
<h1 class="text-3xl font-bold tracking-tight">`, `</h1>
|
|
2171
|
-
</div>
|
|
2172
|
-
<div class="bg-card rounded-lg shadow-sm border p-4">
|
|
2173
|
-
<form method="POST"`, `>
|
|
2174
|
-
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
2175
|
-
`, `
|
|
2176
|
-
</div>
|
|
2177
|
-
<div class="mt-4 flex gap-2 border-t pt-4 -mx-4 px-4">
|
|
2178
|
-
<Form.Button>Submit</Form.Button>
|
|
2179
|
-
</div>
|
|
2180
|
-
</form>
|
|
2181
|
-
</div>
|
|
2182
|
-
</section>
|
|
2183
|
-
`])), n, a, t.displayName, s, r);
|
|
2184
|
-
}
|
|
2185
|
-
function kn(t, e) {
|
|
2186
|
-
const n = qt(e), a = p`
|
|
2187
|
-
import { fail, superValidate${n ? ", withFiles" : ""} } from "sveltekit-superforms";
|
|
2188
|
-
import { zod } from "sveltekit-superforms/adapters";
|
|
2189
|
-
import { ${t.schemaName} } from "$lib/schemas/${t.name}";
|
|
2190
|
-
import { setFlash } from "sveltekit-flash-message/server";
|
|
2191
|
-
`;
|
|
2192
|
-
return p`
|
|
2193
|
-
${a}
|
|
2194
|
-
|
|
2195
|
-
export const load = async () => {
|
|
2196
|
-
const form = await superValidate(zod(${t.schemaName}));
|
|
2197
|
-
return { form };
|
|
2198
|
-
};
|
|
2199
|
-
|
|
2200
|
-
export const actions = {
|
|
2201
|
-
default: async ({ request, cookies }) => {
|
|
2202
|
-
const form = await superValidate(request, zod(${t.schemaName}));
|
|
2203
|
-
|
|
2204
|
-
if (!form.valid) {
|
|
2205
|
-
return fail(400, { form });
|
|
2206
|
-
}
|
|
2207
|
-
|
|
2208
|
-
setFlash({ type: "toast", message: "Form posted successfully" }, cookies);
|
|
2209
|
-
|
|
2210
|
-
return ${n ? "withFiles({ form })" : "{ form }"};
|
|
2211
|
-
}
|
|
2212
|
-
};
|
|
2213
|
-
`;
|
|
2214
|
-
}
|
|
2215
|
-
function K(t, e) {
|
|
2216
|
-
return {
|
|
2217
|
-
path: t,
|
|
2218
|
-
language: S(t),
|
|
2219
|
-
content: e
|
|
2220
|
-
};
|
|
2221
|
-
}
|
|
2222
|
-
async function Rn(t) {
|
|
2223
|
-
const { modelPath: e, fields: n } = xn(t.argv);
|
|
2224
|
-
Z(e);
|
|
2225
|
-
const a = D(e, t), s = (await Y(n, a, t)).fields, { pagePath: i, pageUrl: o } = wn(e, a.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-DwDRkEXV.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
|
|
2226
|
-
t
|
|
2227
|
-
), m = [
|
|
2228
|
-
K(`${i}/+page.svelte`, Fn(a, s)),
|
|
2229
|
-
K(`${i}/+page.server.ts`, kn(a, s)),
|
|
2230
|
-
K(
|
|
2231
|
-
`${i}/server.test.ts`,
|
|
2232
|
-
hn(
|
|
2233
|
-
a,
|
|
2234
|
-
o,
|
|
2235
|
-
s,
|
|
2236
|
-
t,
|
|
2237
|
-
c
|
|
2238
|
-
)
|
|
2239
|
-
),
|
|
2240
|
-
K(`src/lib/schemas/${a.name}.ts`, _n(a, s))
|
|
2241
|
-
], g = V(s);
|
|
2242
|
-
return {
|
|
2243
|
-
creates: m,
|
|
2244
|
-
modifies: [],
|
|
2245
|
-
deletes: [],
|
|
2246
|
-
components: g,
|
|
2247
|
-
packages: [],
|
|
2248
|
-
collections: []
|
|
2249
|
-
};
|
|
2250
|
-
}
|
|
2251
|
-
const In = "generate-form", Mn = "1.0.7", Pn = "src/patterns/generate/form", Tn = "/generate/form";
|
|
2252
|
-
async function En(t) {
|
|
2253
|
-
const e = await Rn(t);
|
|
2254
|
-
if (t.env !== "runtime")
|
|
2255
|
-
return $(e);
|
|
2256
|
-
const { writeResult: n } = await import("./write-result-DmD7kWlV.js");
|
|
2257
|
-
return n(await $(e), t);
|
|
2258
|
-
}
|
|
2259
|
-
const Dn = {
|
|
2260
|
-
version: Mn,
|
|
2261
|
-
slug: In,
|
|
2262
|
-
source: Pn,
|
|
2263
|
-
docs: Tn,
|
|
2264
|
-
plan: "open",
|
|
2265
|
-
title: "Generate a form",
|
|
2266
|
-
summary: "Generates a form.",
|
|
2267
|
-
requires: {
|
|
2268
|
-
auth: !1,
|
|
2269
|
-
api: !1,
|
|
2270
|
-
apiKeys: !1,
|
|
2271
|
-
i18n: !1,
|
|
2272
|
-
teams: !1,
|
|
2273
|
-
payments: !1
|
|
2274
|
-
},
|
|
2275
|
-
category: "generators",
|
|
2276
|
-
tags: ["sveltekit", "superforms", "validation", "zod"],
|
|
2277
|
-
command: {
|
|
2278
|
-
raw: "vela generate form contact name:text email:email message:editor",
|
|
2279
|
-
base: "vela generate form",
|
|
2280
|
-
argv: ["contact", "name:text", "email:email", "message:editor"]
|
|
2281
|
-
},
|
|
2282
|
-
baseline: "velastack",
|
|
2283
|
-
generate: En
|
|
2284
|
-
}, zn = ["text"], Bn = {
|
|
2010
|
+
const hn = ["text"], bn = {
|
|
2285
2011
|
string: "text",
|
|
2286
2012
|
boolean: "bool",
|
|
2287
2013
|
geopoint: "geoPoint",
|
|
@@ -2308,10 +2034,10 @@ const Dn = {
|
|
|
2308
2034
|
geoPoint: "geoPoint",
|
|
2309
2035
|
relation: "relation"
|
|
2310
2036
|
};
|
|
2311
|
-
function
|
|
2037
|
+
function vn(t) {
|
|
2312
2038
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
|
|
2313
2039
|
}
|
|
2314
|
-
function
|
|
2040
|
+
function H(t, e) {
|
|
2315
2041
|
const n = t.type === "select" ? `[${(t.options ?? []).map((r) => JSON.stringify(r.value)).join(", ")}]` : "";
|
|
2316
2042
|
let a;
|
|
2317
2043
|
switch (t.type) {
|
|
@@ -2328,13 +2054,13 @@ function Ln(t, e) {
|
|
|
2328
2054
|
a = e.forForm ? "z.string()" : "z.date()";
|
|
2329
2055
|
break;
|
|
2330
2056
|
case "email":
|
|
2331
|
-
a = "z.
|
|
2057
|
+
a = "z.email()";
|
|
2332
2058
|
break;
|
|
2333
2059
|
case "password":
|
|
2334
2060
|
a = "z.string()";
|
|
2335
2061
|
break;
|
|
2336
2062
|
case "url":
|
|
2337
|
-
a = "z.
|
|
2063
|
+
a = "z.url()";
|
|
2338
2064
|
break;
|
|
2339
2065
|
case "editor":
|
|
2340
2066
|
a = "z.string()";
|
|
@@ -2357,7 +2083,7 @@ function Ln(t, e) {
|
|
|
2357
2083
|
return val;
|
|
2358
2084
|
}
|
|
2359
2085
|
return JSON.stringify(val);
|
|
2360
|
-
}, z.string()${t.required ? "" : ".optional()"})
|
|
2086
|
+
}, z.string()${t.required ? "" : ".optional()"})` : u`
|
|
2361
2087
|
z.object({
|
|
2362
2088
|
lat: z.number().min(-90).max(90),
|
|
2363
2089
|
lon: z.number().min(-180).max(180)
|
|
@@ -2370,97 +2096,144 @@ function Ln(t, e) {
|
|
|
2370
2096
|
default:
|
|
2371
2097
|
return t.type;
|
|
2372
2098
|
}
|
|
2373
|
-
return
|
|
2099
|
+
return hn.includes(t.type) ? t.required ? `${a}.nonempty()` : `${a}.optional()` : t.required || t.type === "geoPoint" ? a : t.type === "file" && (t.maxSelect ?? 1) <= 1 ? `${a}.optional().default("")` : `${a}.optional()`;
|
|
2100
|
+
}
|
|
2101
|
+
async function wn(t) {
|
|
2102
|
+
if (t.env === "runtime") {
|
|
2103
|
+
const { getCollections: n } = await import("./env.runtime-BauEimvd.js");
|
|
2104
|
+
return await n();
|
|
2105
|
+
}
|
|
2106
|
+
const { getPreviewCollections: e } = await import("./env.preview-HlXZOEL4.js");
|
|
2107
|
+
return e(t);
|
|
2108
|
+
}
|
|
2109
|
+
async function Z(t, e, n) {
|
|
2110
|
+
He(e);
|
|
2111
|
+
const a = Y(e, t), r = await wn(t);
|
|
2112
|
+
if (n.length > 0) {
|
|
2113
|
+
const { fields: i, auth: o } = on(
|
|
2114
|
+
n,
|
|
2115
|
+
a,
|
|
2116
|
+
r,
|
|
2117
|
+
t
|
|
2118
|
+
);
|
|
2119
|
+
return {
|
|
2120
|
+
model: a,
|
|
2121
|
+
fields: i,
|
|
2122
|
+
auth: o,
|
|
2123
|
+
shouldCreateCollection: !0,
|
|
2124
|
+
collections: r
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
const s = yn(a, r, t);
|
|
2128
|
+
return {
|
|
2129
|
+
model: a,
|
|
2130
|
+
fields: s,
|
|
2131
|
+
auth: void 0,
|
|
2132
|
+
shouldCreateCollection: !1,
|
|
2133
|
+
collections: r
|
|
2134
|
+
};
|
|
2374
2135
|
}
|
|
2375
|
-
function
|
|
2136
|
+
function Q(t, e, n) {
|
|
2376
2137
|
const a = [];
|
|
2377
|
-
n.includeModelFields && (a.push({
|
|
2138
|
+
n.includeModelFields && (a.push({
|
|
2139
|
+
name: "id",
|
|
2140
|
+
schema: H(
|
|
2141
|
+
{ type: "text", required: !1 },
|
|
2142
|
+
n
|
|
2143
|
+
)
|
|
2144
|
+
}), a.push({
|
|
2145
|
+
name: "collectionId",
|
|
2146
|
+
schema: H(
|
|
2147
|
+
{ type: "text", required: !1 },
|
|
2148
|
+
n
|
|
2149
|
+
)
|
|
2150
|
+
}));
|
|
2378
2151
|
for (const o of e) {
|
|
2379
2152
|
if (o.type === "file" && o.maxSelect > 1) {
|
|
2380
|
-
a.push({
|
|
2153
|
+
a.push({
|
|
2154
|
+
name: o.name,
|
|
2155
|
+
schema: H({ ...o, required: !1 }, n)
|
|
2156
|
+
}), a.push({
|
|
2381
2157
|
name: `${o.name}+`,
|
|
2382
|
-
|
|
2383
|
-
required: !1,
|
|
2384
|
-
maxSelect: 999
|
|
2158
|
+
schema: "z.instanceof(File).array().optional()"
|
|
2385
2159
|
}), a.push({
|
|
2386
2160
|
name: `${o.name}-`,
|
|
2387
|
-
|
|
2388
|
-
required: !1,
|
|
2389
|
-
maxSelect: 999
|
|
2161
|
+
schema: "z.string().array().optional()"
|
|
2390
2162
|
});
|
|
2391
2163
|
continue;
|
|
2392
2164
|
}
|
|
2393
|
-
a.push(
|
|
2165
|
+
a.push({
|
|
2166
|
+
name: o.name,
|
|
2167
|
+
schema: H(o, n)
|
|
2168
|
+
});
|
|
2394
2169
|
}
|
|
2395
|
-
const r = a.map(
|
|
2396
|
-
(o) => `${An(o.name)}: ${Ln(o, n)}`
|
|
2397
|
-
).join(`,
|
|
2170
|
+
const r = a.map((o) => `${vn(o.name)}: ${o.schema}`).join(`,
|
|
2398
2171
|
`), s = n.includeModelFields ? `
|
|
2399
2172
|
import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
|
|
2400
|
-
return
|
|
2401
|
-
import { z } from "zod
|
|
2173
|
+
return u`
|
|
2174
|
+
import { z } from "zod";${s}
|
|
2402
2175
|
|
|
2403
2176
|
export const ${t.schemaName} = z.object({
|
|
2404
2177
|
${r}
|
|
2405
2178
|
})${i};
|
|
2406
2179
|
`;
|
|
2407
2180
|
}
|
|
2408
|
-
function
|
|
2409
|
-
const e =
|
|
2181
|
+
function xn(t) {
|
|
2182
|
+
const e = bn[t];
|
|
2410
2183
|
if (!e)
|
|
2411
2184
|
throw new Error(
|
|
2412
2185
|
`Unsupported collection field type "${t}" when generating from collection`
|
|
2413
2186
|
);
|
|
2414
2187
|
return e;
|
|
2415
2188
|
}
|
|
2416
|
-
function
|
|
2189
|
+
function yn(t, e, n) {
|
|
2417
2190
|
const a = e.find((o) => o.name === t.tableName);
|
|
2418
2191
|
if (!a)
|
|
2419
2192
|
throw new Error(`Collection "${t.tableName}" not found`);
|
|
2420
|
-
const r =
|
|
2193
|
+
const r = Lt(e), s = new Map(e.map((o) => [o.id, o])), i = [];
|
|
2421
2194
|
for (const o of a.fields) {
|
|
2422
2195
|
if (o.name === "id" || o.system)
|
|
2423
2196
|
continue;
|
|
2424
|
-
const c =
|
|
2197
|
+
const c = xn(o.type), m = !!o.required, h = ct(o.name);
|
|
2425
2198
|
if (c === "relation") {
|
|
2426
|
-
const
|
|
2427
|
-
if (!
|
|
2199
|
+
const p = o.collectionId ? s.get(o.collectionId) : void 0;
|
|
2200
|
+
if (!p)
|
|
2428
2201
|
continue;
|
|
2429
|
-
const
|
|
2202
|
+
const g = Y(p.name, n);
|
|
2430
2203
|
i.push({
|
|
2431
2204
|
name: o.name,
|
|
2432
|
-
title:
|
|
2205
|
+
title: h,
|
|
2433
2206
|
type: "relation",
|
|
2434
2207
|
required: m,
|
|
2435
|
-
collectionId:
|
|
2208
|
+
collectionId: p.id,
|
|
2436
2209
|
maxSelect: o.maxSelect ?? 1,
|
|
2437
|
-
displayField: r[
|
|
2438
|
-
relatedModel:
|
|
2439
|
-
singularRelationName:
|
|
2440
|
-
`${t.displayName} ${
|
|
2210
|
+
displayField: r[p.name] ?? "id",
|
|
2211
|
+
relatedModel: g,
|
|
2212
|
+
singularRelationName: O(
|
|
2213
|
+
`${t.displayName} ${g.displayName}`
|
|
2441
2214
|
),
|
|
2442
|
-
pluralRelationName:
|
|
2443
|
-
`${t.displayName} ${
|
|
2215
|
+
pluralRelationName: O(
|
|
2216
|
+
`${t.displayName} ${g.pluralDisplayName}`
|
|
2444
2217
|
),
|
|
2445
|
-
isCurrentUser: n.features.auth &&
|
|
2218
|
+
isCurrentUser: n.features.auth && p.name === "users" && /user|owner|author/i.test(o.name)
|
|
2446
2219
|
});
|
|
2447
2220
|
continue;
|
|
2448
2221
|
}
|
|
2449
2222
|
if (c === "select") {
|
|
2450
2223
|
i.push({
|
|
2451
2224
|
name: o.name,
|
|
2452
|
-
title:
|
|
2225
|
+
title: h,
|
|
2453
2226
|
type: "select",
|
|
2454
2227
|
required: m,
|
|
2455
2228
|
maxSelect: o.maxSelect ?? 1,
|
|
2456
|
-
options: (o.values ?? []).map((
|
|
2229
|
+
options: (o.values ?? []).map((p) => ({ label: p, value: p }))
|
|
2457
2230
|
});
|
|
2458
2231
|
continue;
|
|
2459
2232
|
}
|
|
2460
2233
|
if (c === "file") {
|
|
2461
2234
|
i.push({
|
|
2462
2235
|
name: o.name,
|
|
2463
|
-
title:
|
|
2236
|
+
title: h,
|
|
2464
2237
|
type: "file",
|
|
2465
2238
|
required: m,
|
|
2466
2239
|
maxSelect: o.maxSelect ?? 1
|
|
@@ -2470,7 +2243,7 @@ function mt(t, e, n) {
|
|
|
2470
2243
|
if (c === "autodate") {
|
|
2471
2244
|
i.push({
|
|
2472
2245
|
name: o.name,
|
|
2473
|
-
title:
|
|
2246
|
+
title: h,
|
|
2474
2247
|
type: "autodate",
|
|
2475
2248
|
required: m,
|
|
2476
2249
|
onCreate: o.onCreate ?? o.name.includes("create"),
|
|
@@ -2480,26 +2253,26 @@ function mt(t, e, n) {
|
|
|
2480
2253
|
}
|
|
2481
2254
|
i.push({
|
|
2482
2255
|
name: o.name,
|
|
2483
|
-
title:
|
|
2256
|
+
title: h,
|
|
2484
2257
|
type: c,
|
|
2485
2258
|
required: m
|
|
2486
2259
|
});
|
|
2487
2260
|
}
|
|
2488
2261
|
return i.filter((o) => o.name !== "id");
|
|
2489
2262
|
}
|
|
2490
|
-
function
|
|
2263
|
+
function jt(t) {
|
|
2491
2264
|
const e = t.filter(
|
|
2492
2265
|
(n) => n.type === "relation"
|
|
2493
2266
|
).map((n) => n.name);
|
|
2494
2267
|
return e.length > 0 ? e.join(",") : void 0;
|
|
2495
2268
|
}
|
|
2496
|
-
function
|
|
2269
|
+
function qt(t) {
|
|
2497
2270
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
2498
2271
|
for (const a of t)
|
|
2499
2272
|
a.type === "relation" && (e.has(a.relatedModel.tableName) || (e.add(a.relatedModel.tableName), n.push(a.relatedModel)));
|
|
2500
2273
|
return n;
|
|
2501
2274
|
}
|
|
2502
|
-
function
|
|
2275
|
+
function $n(t) {
|
|
2503
2276
|
const e = {
|
|
2504
2277
|
name: t.name,
|
|
2505
2278
|
type: t.type,
|
|
@@ -2522,7 +2295,7 @@ function Un(t) {
|
|
|
2522
2295
|
onUpdate: t.onUpdate
|
|
2523
2296
|
} : e;
|
|
2524
2297
|
}
|
|
2525
|
-
function
|
|
2298
|
+
function Nt(t, e, n) {
|
|
2526
2299
|
const a = n ? {
|
|
2527
2300
|
listRule: n.rule,
|
|
2528
2301
|
viewRule: n.rule,
|
|
@@ -2534,72 +2307,236 @@ function Ht(t, e, n) {
|
|
|
2534
2307
|
name: t.tableName,
|
|
2535
2308
|
type: "base",
|
|
2536
2309
|
...a,
|
|
2537
|
-
fields: e.map(
|
|
2310
|
+
fields: e.map($n)
|
|
2311
|
+
};
|
|
2312
|
+
}
|
|
2313
|
+
var St = Object.freeze, _n = Object.defineProperty, Cn = (t, e) => St(_n(t, "raw", { value: St(t.slice()) })), Ft;
|
|
2314
|
+
function Sn(t, e) {
|
|
2315
|
+
const n = t.replace(/^\/+|\/+$/g, ""), a = `${e}/${n}`, r = `/${n}`;
|
|
2316
|
+
return {
|
|
2317
|
+
pagePath: a,
|
|
2318
|
+
pageUrl: r
|
|
2319
|
+
};
|
|
2320
|
+
}
|
|
2321
|
+
function Fn(t) {
|
|
2322
|
+
const [e, ...n] = t;
|
|
2323
|
+
if (!e)
|
|
2324
|
+
throw new Error("Invalid command arguments. Expected: <model> <fields...>");
|
|
2325
|
+
if (n.length === 0)
|
|
2326
|
+
throw new Error("At least one field definition is required.");
|
|
2327
|
+
return { modelPath: e, fieldDefs: n };
|
|
2328
|
+
}
|
|
2329
|
+
function Vt(t) {
|
|
2330
|
+
return t.some((e) => e.type === "file");
|
|
2331
|
+
}
|
|
2332
|
+
function kn(t, e) {
|
|
2333
|
+
const n = N(e), a = [
|
|
2334
|
+
'import { untrack } from "svelte";',
|
|
2335
|
+
'import { superForm } from "sveltekit-superforms";',
|
|
2336
|
+
'import { zod4Client } from "sveltekit-superforms/adapters";',
|
|
2337
|
+
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2338
|
+
...lt(n)
|
|
2339
|
+
];
|
|
2340
|
+
return [...new Set(a)];
|
|
2341
|
+
}
|
|
2342
|
+
function Rn(t, e) {
|
|
2343
|
+
const a = e.filter(
|
|
2344
|
+
(r) => r.type === "select"
|
|
2345
|
+
).map((r) => Dt(r)).join(`
|
|
2346
|
+
|
|
2347
|
+
`);
|
|
2348
|
+
return u`
|
|
2349
|
+
${a}
|
|
2350
|
+
|
|
2351
|
+
const form = superForm(untrack(() => data.form), {
|
|
2352
|
+
validators: zod4Client(${t.schemaName}),
|
|
2353
|
+
});
|
|
2354
|
+
|
|
2355
|
+
const { form: formData } = form;
|
|
2356
|
+
`;
|
|
2357
|
+
}
|
|
2358
|
+
function In(t, e) {
|
|
2359
|
+
const n = kn(t, e).join(`
|
|
2360
|
+
`), a = Rn(t, e), r = e.map((i) => it(i)).join(`
|
|
2361
|
+
`), s = Vt(e) ? ' enctype="multipart/form-data"' : "";
|
|
2362
|
+
return u(Ft || (Ft = Cn([`
|
|
2363
|
+
<script lang="ts">
|
|
2364
|
+
`, `
|
|
2365
|
+
|
|
2366
|
+
let { data } = $props();
|
|
2367
|
+
`, `
|
|
2368
|
+
<\/script>
|
|
2369
|
+
|
|
2370
|
+
<section data-role="content">
|
|
2371
|
+
<div class="flex justify-between items-center mb-4">
|
|
2372
|
+
<h1 class="text-3xl font-bold tracking-tight">`, `</h1>
|
|
2373
|
+
</div>
|
|
2374
|
+
<div class="bg-card rounded-lg shadow-sm border p-4">
|
|
2375
|
+
<form method="POST"`, `>
|
|
2376
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
2377
|
+
`, `
|
|
2378
|
+
</div>
|
|
2379
|
+
<div class="mt-4 flex gap-2 border-t pt-4 -mx-4 px-4">
|
|
2380
|
+
<Form.Button>Submit</Form.Button>
|
|
2381
|
+
</div>
|
|
2382
|
+
</form>
|
|
2383
|
+
</div>
|
|
2384
|
+
</section>
|
|
2385
|
+
`])), n, a, t.displayName, s, r);
|
|
2386
|
+
}
|
|
2387
|
+
function Mn(t, e) {
|
|
2388
|
+
const n = Vt(e), a = u`
|
|
2389
|
+
import { fail, superValidate${n ? ", withFiles" : ""} } from "sveltekit-superforms";
|
|
2390
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
2391
|
+
import { ${t.schemaName} } from "$lib/schemas/${t.name}";
|
|
2392
|
+
import { setFlash } from "sveltekit-flash-message/server";
|
|
2393
|
+
`;
|
|
2394
|
+
return u`
|
|
2395
|
+
${a}
|
|
2396
|
+
|
|
2397
|
+
export const load = async () => {
|
|
2398
|
+
const form = await superValidate(zod4(${t.schemaName}));
|
|
2399
|
+
return { form };
|
|
2400
|
+
};
|
|
2401
|
+
|
|
2402
|
+
export const actions = {
|
|
2403
|
+
default: async ({ request, cookies }) => {
|
|
2404
|
+
const form = await superValidate(request, zod4(${t.schemaName}));
|
|
2405
|
+
|
|
2406
|
+
if (!form.valid) {
|
|
2407
|
+
return fail(400, { form });
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
setFlash({ type: "toast", message: "Form posted successfully" }, cookies);
|
|
2411
|
+
|
|
2412
|
+
return ${n ? "withFiles({ form })" : "{ form }"};
|
|
2413
|
+
}
|
|
2414
|
+
};
|
|
2415
|
+
`;
|
|
2416
|
+
}
|
|
2417
|
+
function K(t, e) {
|
|
2418
|
+
return {
|
|
2419
|
+
path: t,
|
|
2420
|
+
language: S(t),
|
|
2421
|
+
content: e
|
|
2538
2422
|
};
|
|
2539
2423
|
}
|
|
2540
|
-
function
|
|
2424
|
+
async function Pn(t) {
|
|
2425
|
+
const { modelPath: e, fieldDefs: n } = Fn(t.argv), { model: a, fields: r, collections: s } = await Z(
|
|
2426
|
+
t,
|
|
2427
|
+
e,
|
|
2428
|
+
n
|
|
2429
|
+
), { pagePath: i, pageUrl: o } = Sn(e, a.routesDir), c = [
|
|
2430
|
+
K(`${i}/+page.svelte`, In(a, r)),
|
|
2431
|
+
K(`${i}/+page.server.ts`, Mn(a, r)),
|
|
2432
|
+
K(
|
|
2433
|
+
`${i}/server.test.ts`,
|
|
2434
|
+
gn(
|
|
2435
|
+
a,
|
|
2436
|
+
o,
|
|
2437
|
+
r,
|
|
2438
|
+
t,
|
|
2439
|
+
s
|
|
2440
|
+
)
|
|
2441
|
+
),
|
|
2442
|
+
K(
|
|
2443
|
+
`src/lib/schemas/${a.name}.ts`,
|
|
2444
|
+
Q(a, r, {
|
|
2445
|
+
includeModelFields: !1,
|
|
2446
|
+
forForm: !0
|
|
2447
|
+
})
|
|
2448
|
+
)
|
|
2449
|
+
], m = N(r);
|
|
2450
|
+
return {
|
|
2451
|
+
creates: c,
|
|
2452
|
+
modifies: [],
|
|
2453
|
+
deletes: [],
|
|
2454
|
+
components: m,
|
|
2455
|
+
packages: [],
|
|
2456
|
+
collections: []
|
|
2457
|
+
};
|
|
2458
|
+
}
|
|
2459
|
+
const Tn = "generate-form", En = "1.0.7", Dn = "src/patterns/generate/form", Bn = "/generate/form";
|
|
2460
|
+
async function An(t) {
|
|
2461
|
+
const e = await Pn(t);
|
|
2462
|
+
if (t.env !== "runtime")
|
|
2463
|
+
return $(e);
|
|
2464
|
+
const { writeResult: n } = await import("./write-result-1Q3LB_k4.js");
|
|
2465
|
+
return n(await $(e), t);
|
|
2466
|
+
}
|
|
2467
|
+
const zn = {
|
|
2468
|
+
version: En,
|
|
2469
|
+
slug: Tn,
|
|
2470
|
+
source: Dn,
|
|
2471
|
+
docs: Bn,
|
|
2472
|
+
plan: "open",
|
|
2473
|
+
title: "Generate a form",
|
|
2474
|
+
summary: "Generates a form.",
|
|
2475
|
+
requires: {
|
|
2476
|
+
auth: !1,
|
|
2477
|
+
api: !1,
|
|
2478
|
+
apiKeys: !1,
|
|
2479
|
+
i18n: !1,
|
|
2480
|
+
teams: !1,
|
|
2481
|
+
payments: !1
|
|
2482
|
+
},
|
|
2483
|
+
category: "generators",
|
|
2484
|
+
tags: ["sveltekit", "superforms", "validation", "zod"],
|
|
2485
|
+
command: {
|
|
2486
|
+
raw: "vela generate form contact name:text email:email message:editor",
|
|
2487
|
+
base: "vela generate form",
|
|
2488
|
+
argv: ["contact", "name:text", "email:email", "message:editor"]
|
|
2489
|
+
},
|
|
2490
|
+
tests: 2,
|
|
2491
|
+
baseline: "velastack",
|
|
2492
|
+
generate: An
|
|
2493
|
+
};
|
|
2494
|
+
function Ln(t) {
|
|
2541
2495
|
const [e, ...n] = t;
|
|
2542
2496
|
if (!e)
|
|
2543
2497
|
throw new Error("Invalid command arguments. Expected: <model> [fields...]");
|
|
2544
2498
|
return { modelPath: e, fields: n };
|
|
2545
2499
|
}
|
|
2546
|
-
function
|
|
2500
|
+
function On(t, e) {
|
|
2547
2501
|
return {
|
|
2548
2502
|
path: t,
|
|
2549
2503
|
language: S(t),
|
|
2550
2504
|
content: e
|
|
2551
2505
|
};
|
|
2552
2506
|
}
|
|
2553
|
-
async function
|
|
2554
|
-
Z(e)
|
|
2555
|
-
const a = D(e, t);
|
|
2556
|
-
if (n.length > 0) {
|
|
2557
|
-
const i = await Y(n, a, t);
|
|
2558
|
-
return {
|
|
2559
|
-
model: a,
|
|
2560
|
-
fields: i.fields,
|
|
2561
|
-
auth: i.auth,
|
|
2562
|
-
shouldCreateCollection: !0
|
|
2563
|
-
};
|
|
2564
|
-
}
|
|
2565
|
-
const r = t.env === "runtime" ? await (await import("./env.runtime-DwDRkEXV.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
|
|
2566
|
-
t
|
|
2567
|
-
), s = mt(a, r, t);
|
|
2568
|
-
return { model: a, fields: s, auth: void 0, shouldCreateCollection: !1 };
|
|
2569
|
-
}
|
|
2570
|
-
async function Vn(t) {
|
|
2571
|
-
const { modelPath: e, fields: n } = jn(t.argv), { model: a, fields: r, auth: s, shouldCreateCollection: i } = await Nn(t, e, n), o = `src/lib/schemas/${a.name}.ts`, c = ct(a, r, {
|
|
2507
|
+
async function Un(t) {
|
|
2508
|
+
const { modelPath: e, fields: n } = Ln(t.argv), { model: a, fields: r, auth: s, shouldCreateCollection: i } = await Z(t, e, n), o = `src/lib/schemas/${a.name}.ts`, c = Q(a, r, {
|
|
2572
2509
|
includeModelFields: !0,
|
|
2573
2510
|
forForm: !0
|
|
2574
2511
|
});
|
|
2575
2512
|
return {
|
|
2576
|
-
creates: [
|
|
2513
|
+
creates: [On(o, c)],
|
|
2577
2514
|
modifies: [],
|
|
2578
2515
|
deletes: [],
|
|
2579
2516
|
components: [],
|
|
2580
2517
|
packages: [],
|
|
2581
|
-
collections: i ? [
|
|
2518
|
+
collections: i ? [Nt(a, r, s)] : []
|
|
2582
2519
|
};
|
|
2583
2520
|
}
|
|
2584
|
-
const
|
|
2585
|
-
async function
|
|
2586
|
-
const e = await
|
|
2521
|
+
const jn = "generate-resource", qn = "1.0.7", Nn = "src/patterns/generate/resource", Vn = "/generate/resource";
|
|
2522
|
+
async function Hn(t) {
|
|
2523
|
+
const e = await Un(t);
|
|
2587
2524
|
if (t.env !== "runtime")
|
|
2588
2525
|
return $(e);
|
|
2589
|
-
const { createCollections: n } = await import("./collections-
|
|
2526
|
+
const { createCollections: n } = await import("./collections-Ch4kZjuV.js"), a = await n(
|
|
2590
2527
|
e.collections,
|
|
2591
2528
|
t
|
|
2592
2529
|
), r = {
|
|
2593
2530
|
...e,
|
|
2594
2531
|
creates: [...e.creates, ...a]
|
|
2595
|
-
}, { writeResult: s } = await import("./write-result-
|
|
2532
|
+
}, { writeResult: s } = await import("./write-result-1Q3LB_k4.js");
|
|
2596
2533
|
return s(await $(r), t);
|
|
2597
2534
|
}
|
|
2598
|
-
const
|
|
2599
|
-
version:
|
|
2600
|
-
slug:
|
|
2601
|
-
source:
|
|
2602
|
-
docs:
|
|
2535
|
+
const Kn = {
|
|
2536
|
+
version: qn,
|
|
2537
|
+
slug: jn,
|
|
2538
|
+
source: Nn,
|
|
2539
|
+
docs: Vn,
|
|
2603
2540
|
plan: "open",
|
|
2604
2541
|
title: "Generate a resource",
|
|
2605
2542
|
summary: "Generates model schema resources.",
|
|
@@ -2618,11 +2555,12 @@ const Xn = {
|
|
|
2618
2555
|
base: "vela generate resource",
|
|
2619
2556
|
argv: ["contact", "name:text", "email:email"]
|
|
2620
2557
|
},
|
|
2558
|
+
tests: 0,
|
|
2621
2559
|
baseline: "velastack",
|
|
2622
|
-
generate:
|
|
2560
|
+
generate: Hn
|
|
2623
2561
|
};
|
|
2624
|
-
var
|
|
2625
|
-
function
|
|
2562
|
+
var kt = Object.freeze, Gn = Object.defineProperty, tt = (t, e) => kt(Gn(t, "raw", { value: kt(e || t.slice()) })), Rt, It, Mt, Pt;
|
|
2563
|
+
function Wn(t) {
|
|
2626
2564
|
const [e, ...n] = t;
|
|
2627
2565
|
if (!e)
|
|
2628
2566
|
throw new Error("Invalid command arguments. Expected: <model> [fields...]");
|
|
@@ -2635,59 +2573,59 @@ function k(t, e) {
|
|
|
2635
2573
|
content: e
|
|
2636
2574
|
};
|
|
2637
2575
|
}
|
|
2638
|
-
function
|
|
2576
|
+
function et(t) {
|
|
2639
2577
|
return t.some((e) => e.type === "file");
|
|
2640
2578
|
}
|
|
2641
|
-
function
|
|
2579
|
+
function Ht(t) {
|
|
2642
2580
|
return [...new Set(t.filter(Boolean))];
|
|
2643
2581
|
}
|
|
2644
2582
|
function dt(t) {
|
|
2645
2583
|
return t.filter(
|
|
2646
2584
|
(e) => e.type === "select"
|
|
2647
|
-
).map((e) =>
|
|
2585
|
+
).map((e) => Dt(e)).join(`
|
|
2648
2586
|
|
|
2649
2587
|
`);
|
|
2650
2588
|
}
|
|
2651
|
-
function
|
|
2652
|
-
return
|
|
2589
|
+
function Kt(t, e) {
|
|
2590
|
+
return qt(t).map(
|
|
2653
2591
|
(n) => `const ${n.pluralName} = await ${e}.collection("${n.tableName}").getFullList();`
|
|
2654
2592
|
).join(`
|
|
2655
2593
|
`);
|
|
2656
2594
|
}
|
|
2657
|
-
function
|
|
2658
|
-
return
|
|
2595
|
+
function Gt(t) {
|
|
2596
|
+
return qt(t).map((e) => e.pluralName).join(", ");
|
|
2659
2597
|
}
|
|
2660
|
-
function
|
|
2598
|
+
function Xn(t) {
|
|
2661
2599
|
return t.features.auth ? "locals.pb" : "locals.admin";
|
|
2662
2600
|
}
|
|
2663
|
-
function
|
|
2601
|
+
function Wt(t, e, n = !1) {
|
|
2664
2602
|
const a = dt(e);
|
|
2665
|
-
return
|
|
2603
|
+
return u`
|
|
2666
2604
|
${a}
|
|
2667
2605
|
${n ? "let { data, params } = $props();" : "let { data } = $props();"}
|
|
2668
2606
|
|
|
2669
2607
|
const form = superForm(untrack(() => data.form), {
|
|
2670
|
-
validators:
|
|
2608
|
+
validators: zod4Client(${t.schemaName}),
|
|
2671
2609
|
});
|
|
2672
2610
|
|
|
2673
2611
|
const { form: formData } = form;
|
|
2674
2612
|
`;
|
|
2675
2613
|
}
|
|
2676
|
-
function
|
|
2677
|
-
const a = n.some((o) => o.type === "select"), r =
|
|
2614
|
+
function Jn(t, e, n) {
|
|
2615
|
+
const a = n.some((o) => o.type === "select"), r = Ht([
|
|
2678
2616
|
'import { untrack } from "svelte";',
|
|
2679
2617
|
'import { superForm } from "sveltekit-superforms";',
|
|
2680
|
-
'import {
|
|
2618
|
+
'import { zod4Client } from "sveltekit-superforms/adapters";',
|
|
2681
2619
|
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2682
|
-
...
|
|
2620
|
+
...lt(N(n)),
|
|
2683
2621
|
'import { Button } from "$lib/components/ui/button";',
|
|
2684
2622
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
2685
2623
|
'import * as Form from "$lib/components/ui/form";',
|
|
2686
2624
|
a ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2687
2625
|
]).join(`
|
|
2688
|
-
`), s = n.map((o) =>
|
|
2689
|
-
`), i =
|
|
2690
|
-
return
|
|
2626
|
+
`), s = n.map((o) => it(o)).join(`
|
|
2627
|
+
`), i = et(n) ? ' enctype="multipart/form-data"' : "";
|
|
2628
|
+
return u(Rt || (Rt = tt([`
|
|
2691
2629
|
<script lang="ts">
|
|
2692
2630
|
`, `
|
|
2693
2631
|
`, `
|
|
@@ -2714,23 +2652,23 @@ function ta(t, e, n) {
|
|
|
2714
2652
|
</form>
|
|
2715
2653
|
</div>
|
|
2716
2654
|
</section>
|
|
2717
|
-
`])), r,
|
|
2655
|
+
`])), r, Wt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2718
2656
|
}
|
|
2719
|
-
function
|
|
2720
|
-
const a = n.some((o) => o.type === "select"), r =
|
|
2657
|
+
function Yn(t, e, n) {
|
|
2658
|
+
const a = n.some((o) => o.type === "select"), r = Ht([
|
|
2721
2659
|
'import { untrack } from "svelte";',
|
|
2722
2660
|
'import { superForm } from "sveltekit-superforms";',
|
|
2723
|
-
'import {
|
|
2661
|
+
'import { zod4Client } from "sveltekit-superforms/adapters";',
|
|
2724
2662
|
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2725
|
-
...
|
|
2663
|
+
...lt(N(n)),
|
|
2726
2664
|
'import { Button } from "$lib/components/ui/button";',
|
|
2727
2665
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
2728
2666
|
'import * as Form from "$lib/components/ui/form";',
|
|
2729
2667
|
a ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2730
2668
|
]).join(`
|
|
2731
|
-
`), s = n.map((o) =>
|
|
2732
|
-
`), i =
|
|
2733
|
-
return
|
|
2669
|
+
`), s = n.map((o) => it(o)).join(`
|
|
2670
|
+
`), i = et(n) ? ' enctype="multipart/form-data"' : "";
|
|
2671
|
+
return u(It || (It = tt([`
|
|
2734
2672
|
<script lang="ts">
|
|
2735
2673
|
`, `
|
|
2736
2674
|
`, `
|
|
@@ -2784,12 +2722,12 @@ function ea(t, e, n) {
|
|
|
2784
2722
|
</form>
|
|
2785
2723
|
</div>
|
|
2786
2724
|
</section>
|
|
2787
|
-
`])), r,
|
|
2725
|
+
`])), r, Wt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2788
2726
|
}
|
|
2789
|
-
function
|
|
2727
|
+
function Zn(t, e, n) {
|
|
2790
2728
|
const a = n.some((o) => o.type === "select"), r = a ? `${dt(n)}` : "", s = n.map((o) => {
|
|
2791
2729
|
let c = "{ getValue }", m = "{ value: getValue() }";
|
|
2792
|
-
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 }"),
|
|
2730
|
+
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 }"), u`
|
|
2793
2731
|
columnHelper.accessor("${o.name}", {
|
|
2794
2732
|
header: ({ column }) => renderComponent(ColumnHeader, { column, title: "${o.title}" }),
|
|
2795
2733
|
cell: (${c}) => renderComponent(Cells.${o.type.charAt(0).toUpperCase() + o.type.slice(1)}Cell, ${m})
|
|
@@ -2800,7 +2738,7 @@ function na(t, e, n) {
|
|
|
2800
2738
|
(o) => `<FacetedFilter column={table.getColumn("${o.name}")!} title="${o.title}" options={Object.values(${o.name}Labels)} />`
|
|
2801
2739
|
).join(`
|
|
2802
2740
|
`);
|
|
2803
|
-
return
|
|
2741
|
+
return u(Mt || (Mt = tt([`
|
|
2804
2742
|
<script lang="ts">
|
|
2805
2743
|
import {
|
|
2806
2744
|
type ColumnFiltersState,
|
|
@@ -2857,7 +2795,8 @@ function na(t, e, n) {
|
|
|
2857
2795
|
"aria-label": "Select row"
|
|
2858
2796
|
}),
|
|
2859
2797
|
enableSorting: false,
|
|
2860
|
-
enableHiding: false
|
|
2798
|
+
enableHiding: false,
|
|
2799
|
+
meta: { class: "w-0" },
|
|
2861
2800
|
}),
|
|
2862
2801
|
`, "", `
|
|
2863
2802
|
columnHelper.display({
|
|
@@ -2866,6 +2805,7 @@ function na(t, e, n) {
|
|
|
2866
2805
|
renderComponent(RowActions, {
|
|
2867
2806
|
viewPath: \``, "/${row.original.id}`,\n editPath: `", "/${row.original.id}/edit`,\n deletePath: `", `/\${row.original.id}\`
|
|
2868
2807
|
})
|
|
2808
|
+
meta: { class: "w-0 text-right" },
|
|
2869
2809
|
})
|
|
2870
2810
|
];
|
|
2871
2811
|
|
|
@@ -2919,7 +2859,6 @@ function na(t, e, n) {
|
|
|
2919
2859
|
<section data-role="content">
|
|
2920
2860
|
<div class="flex justify-between items-center mb-4">
|
|
2921
2861
|
<h1 class="text-3xl font-bold tracking-tight">`, `</h1>
|
|
2922
|
-
<Button href="`, '" variant="outline">New ', `</Button>
|
|
2923
2862
|
</div>
|
|
2924
2863
|
|
|
2925
2864
|
<div class="space-y-4">
|
|
@@ -3044,7 +2983,8 @@ function na(t, e, n) {
|
|
|
3044
2983
|
"aria-label": "Select row"
|
|
3045
2984
|
}),
|
|
3046
2985
|
enableSorting: false,
|
|
3047
|
-
enableHiding: false
|
|
2986
|
+
enableHiding: false,
|
|
2987
|
+
meta: { class: "w-0" },
|
|
3048
2988
|
}),
|
|
3049
2989
|
`, "", `
|
|
3050
2990
|
columnHelper.display({
|
|
@@ -3053,6 +2993,7 @@ function na(t, e, n) {
|
|
|
3053
2993
|
renderComponent(RowActions, {
|
|
3054
2994
|
viewPath: \\\``, "/\\${row.original.id}\\`,\n editPath: \\`", "/\\${row.original.id}/edit\\`,\n deletePath: \\`", `/\\\${row.original.id}\\\`
|
|
3055
2995
|
})
|
|
2996
|
+
meta: { class: "w-0 text-right" },
|
|
3056
2997
|
})
|
|
3057
2998
|
];
|
|
3058
2999
|
|
|
@@ -3106,7 +3047,6 @@ function na(t, e, n) {
|
|
|
3106
3047
|
<section data-role="content">
|
|
3107
3048
|
<div class="flex justify-between items-center mb-4">
|
|
3108
3049
|
<h1 class="text-3xl font-bold tracking-tight">`, `</h1>
|
|
3109
|
-
<Button href="`, '" variant="outline">New ', `</Button>
|
|
3110
3050
|
</div>
|
|
3111
3051
|
|
|
3112
3052
|
<div class="space-y-4">
|
|
@@ -3174,55 +3114,55 @@ function na(t, e, n) {
|
|
|
3174
3114
|
<Pagination {table} />
|
|
3175
3115
|
</div>
|
|
3176
3116
|
</section>
|
|
3177
|
-
`])), a ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "", r, t.tableName, s, n.length > 0 ? "," : "", e.list, e.list, e.list, t.pluralName, t.pluralDisplayName,
|
|
3117
|
+
`])), a ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "", r, t.tableName, s, n.length > 0 ? "," : "", e.list, e.list, e.list, t.pluralName, t.pluralDisplayName, t.pluralDisplayName.toLowerCase(), i, e.new, t.displayName.toLowerCase());
|
|
3178
3118
|
}
|
|
3179
|
-
function
|
|
3180
|
-
const a =
|
|
3181
|
-
return
|
|
3119
|
+
function Qn(t, e, n) {
|
|
3120
|
+
const a = jt(e), r = a ? `{ expand: "${a}" }` : "";
|
|
3121
|
+
return u`
|
|
3182
3122
|
export const load = async ({ locals }) => {
|
|
3183
3123
|
const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${r});
|
|
3184
3124
|
return { ${t.pluralName} };
|
|
3185
3125
|
};
|
|
3186
3126
|
`;
|
|
3187
3127
|
}
|
|
3188
|
-
function
|
|
3189
|
-
const s =
|
|
3190
|
-
(
|
|
3191
|
-
),
|
|
3128
|
+
function ta(t, e, n, a, r) {
|
|
3129
|
+
const s = et(n), i = Kt(n, a), o = Gt(n), c = o ? `, ${o}` : "", m = n.find(
|
|
3130
|
+
(p) => p.type === "relation" && p.isCurrentUser
|
|
3131
|
+
), h = r && m ? u`
|
|
3192
3132
|
{
|
|
3193
3133
|
...form.data,
|
|
3194
|
-
${
|
|
3134
|
+
${m.name}: locals.pb.authStore.record?.id
|
|
3195
3135
|
}
|
|
3196
3136
|
` : "form.data";
|
|
3197
|
-
return
|
|
3137
|
+
return u`
|
|
3198
3138
|
import { fail, redirect } from "@sveltejs/kit";
|
|
3199
|
-
import { superValidate } from "sveltekit-superforms";
|
|
3200
|
-
import {
|
|
3139
|
+
import { superValidate${s ? ", withFiles" : ""} } from "sveltekit-superforms";
|
|
3140
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
3201
3141
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
3202
3142
|
import { ${t.schemaName} } from "$lib/schemas/${t.name}";
|
|
3203
3143
|
|
|
3204
3144
|
export const load = async ({ locals }) => {
|
|
3205
|
-
${
|
|
3206
|
-
return { form: await superValidate(
|
|
3145
|
+
${i}
|
|
3146
|
+
return { form: await superValidate(zod4(${t.schemaName}))${c} };
|
|
3207
3147
|
};
|
|
3208
3148
|
|
|
3209
3149
|
export const actions = {
|
|
3210
3150
|
default: async ({ locals, request }) => {
|
|
3211
|
-
const form = await superValidate(request,
|
|
3151
|
+
const form = await superValidate(request, zod4(${t.schemaName}));
|
|
3212
3152
|
|
|
3213
3153
|
if (!form.valid) {
|
|
3214
|
-
return fail(400, { form });
|
|
3154
|
+
return fail(400, ${s ? "withFiles({ form })" : "{ form }"});
|
|
3215
3155
|
}
|
|
3216
3156
|
|
|
3217
3157
|
let ${t.name};
|
|
3218
3158
|
|
|
3219
3159
|
try {
|
|
3220
3160
|
${t.name} = await ${a}.collection("${t.tableName}").create(
|
|
3221
|
-
${
|
|
3161
|
+
${h}
|
|
3222
3162
|
);
|
|
3223
3163
|
} catch (error) {
|
|
3224
3164
|
setPocketbaseErrors(form, error);
|
|
3225
|
-
return fail(400, { form });
|
|
3165
|
+
return fail(400, ${s ? "withFiles({ form })" : "{ form }"});
|
|
3226
3166
|
}
|
|
3227
3167
|
|
|
3228
3168
|
return redirect(303, \`${e.list}/\${${t.name}.id}\`);
|
|
@@ -3230,9 +3170,9 @@ function ra(t, e, n, a, r) {
|
|
|
3230
3170
|
};
|
|
3231
3171
|
`;
|
|
3232
3172
|
}
|
|
3233
|
-
function
|
|
3234
|
-
const r =
|
|
3235
|
-
return
|
|
3173
|
+
function ea(t, e, n, a) {
|
|
3174
|
+
const r = jt(n), s = r ? `, { expand: "${r}" }` : "";
|
|
3175
|
+
return u`
|
|
3236
3176
|
import { error, redirect } from "@sveltejs/kit";
|
|
3237
3177
|
|
|
3238
3178
|
export const load = async ({ locals, params }) => {
|
|
@@ -3252,7 +3192,7 @@ function oa(t, e, n, a) {
|
|
|
3252
3192
|
};
|
|
3253
3193
|
`;
|
|
3254
3194
|
}
|
|
3255
|
-
function
|
|
3195
|
+
function na(t, e, n) {
|
|
3256
3196
|
const a = n.some((m) => m.type === "select"), r = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
|
|
3257
3197
|
'import { Button } from "$lib/components/ui/button";',
|
|
3258
3198
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
@@ -3260,9 +3200,9 @@ function sa(t, e, n) {
|
|
|
3260
3200
|
r ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
|
|
3261
3201
|
s ? 'import FileIcon from "@lucide/svelte/icons/file";' : ""
|
|
3262
3202
|
].filter(Boolean).join(`
|
|
3263
|
-
`), o = dt(n), c = n.map((m) =>
|
|
3203
|
+
`), o = dt(n), c = n.map((m) => Fe(t, m)).join(`
|
|
3264
3204
|
`);
|
|
3265
|
-
return
|
|
3205
|
+
return u(Pt || (Pt = tt([`
|
|
3266
3206
|
<script lang="ts">
|
|
3267
3207
|
`, `
|
|
3268
3208
|
`, `
|
|
@@ -3296,13 +3236,13 @@ function sa(t, e, n) {
|
|
|
3296
3236
|
</section>
|
|
3297
3237
|
`])), i, o, t.displayName, e.list, c, e.list, t.name);
|
|
3298
3238
|
}
|
|
3299
|
-
function
|
|
3300
|
-
const r =
|
|
3301
|
-
return
|
|
3239
|
+
function aa(t, e, n, a) {
|
|
3240
|
+
const r = et(n), s = Kt(n, a), i = Gt(n), o = i ? `, ${i}` : "";
|
|
3241
|
+
return u`
|
|
3302
3242
|
import { error, fail, redirect } from "@sveltejs/kit";
|
|
3303
3243
|
import { setPocketbaseErrors, setDefaultData } from "@velastack/pocketbase";
|
|
3304
|
-
import { superValidate } from "sveltekit-superforms";
|
|
3305
|
-
import {
|
|
3244
|
+
import { superValidate${r ? ", withFiles" : ""} } from "sveltekit-superforms";
|
|
3245
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
3306
3246
|
import { ${t.schemaName} } from "$lib/schemas/${t.name}";
|
|
3307
3247
|
|
|
3308
3248
|
export const load = async ({ locals, params }) => {
|
|
@@ -3312,18 +3252,18 @@ function ia(t, e, n, a) {
|
|
|
3312
3252
|
} catch {
|
|
3313
3253
|
throw error(404, "Not found");
|
|
3314
3254
|
}
|
|
3315
|
-
${
|
|
3316
|
-
return { form: await superValidate(${t.name},
|
|
3255
|
+
${s}
|
|
3256
|
+
return { form: await superValidate(${t.name}, zod4(${t.schemaName}))${o} };
|
|
3317
3257
|
};
|
|
3318
3258
|
|
|
3319
3259
|
export const actions = {
|
|
3320
3260
|
default: async ({ locals, params, request }) => {
|
|
3321
3261
|
const ${t.name} = await ${a}.collection("${t.tableName}").getOne(params.id);
|
|
3322
|
-
const form = await superValidate(request,
|
|
3262
|
+
const form = await superValidate(request, zod4(${t.schemaName}));
|
|
3323
3263
|
|
|
3324
3264
|
if (!form.valid) {
|
|
3325
3265
|
setDefaultData(form, ${t.name});
|
|
3326
|
-
return fail(400, { form });
|
|
3266
|
+
return fail(400, ${r ? "withFiles({ form })" : "{ form }"});
|
|
3327
3267
|
}
|
|
3328
3268
|
|
|
3329
3269
|
try {
|
|
@@ -3332,79 +3272,55 @@ function ia(t, e, n, a) {
|
|
|
3332
3272
|
} catch (error) {
|
|
3333
3273
|
setPocketbaseErrors(form, error);
|
|
3334
3274
|
setDefaultData(form, ${t.name});
|
|
3335
|
-
return fail(400, { form });
|
|
3275
|
+
return fail(400, ${r ? "withFiles({ form })" : "{ form }"});
|
|
3336
3276
|
}
|
|
3337
3277
|
},
|
|
3338
3278
|
};
|
|
3339
3279
|
`;
|
|
3340
3280
|
}
|
|
3341
|
-
async function
|
|
3342
|
-
Z(e)
|
|
3343
|
-
const a = D(e, t), r = t.env === "runtime" ? await (await import("./env.runtime-DwDRkEXV.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
|
|
3344
|
-
t
|
|
3345
|
-
);
|
|
3346
|
-
if (n.length > 0) {
|
|
3347
|
-
const i = await Y(n, a, t);
|
|
3348
|
-
return {
|
|
3349
|
-
model: a,
|
|
3350
|
-
fields: i.fields,
|
|
3351
|
-
auth: i.auth,
|
|
3352
|
-
shouldCreateCollection: !0,
|
|
3353
|
-
collections: r
|
|
3354
|
-
};
|
|
3355
|
-
}
|
|
3356
|
-
const s = mt(a, r, t);
|
|
3357
|
-
return {
|
|
3358
|
-
model: a,
|
|
3359
|
-
fields: s,
|
|
3360
|
-
auth: void 0,
|
|
3361
|
-
shouldCreateCollection: !1,
|
|
3362
|
-
collections: r
|
|
3363
|
-
};
|
|
3364
|
-
}
|
|
3365
|
-
async function ca(t) {
|
|
3366
|
-
const { modelPath: e, fields: n } = Yn(t.argv), { model: a, fields: r, auth: s, shouldCreateCollection: i, collections: o } = await la(t, e, n), c = We(a), m = Je(a), g = Qn(t), f = r.filter(
|
|
3281
|
+
async function ra(t) {
|
|
3282
|
+
const { modelPath: e, fields: n } = Wn(t.argv), { model: a, fields: r, auth: s, shouldCreateCollection: i, collections: o } = await Z(t, e, n), c = Ge(a), m = We(a), h = Xn(t), p = r.filter(
|
|
3367
3283
|
(d) => !(d.type === "relation" && d.isCurrentUser)
|
|
3368
|
-
),
|
|
3284
|
+
), g = [
|
|
3369
3285
|
k(
|
|
3370
3286
|
`src/lib/schemas/${a.name}.ts`,
|
|
3371
|
-
|
|
3287
|
+
Q(a, r, {
|
|
3372
3288
|
includeModelFields: !0,
|
|
3373
3289
|
forForm: !0
|
|
3374
3290
|
})
|
|
3375
3291
|
),
|
|
3376
3292
|
k(
|
|
3377
3293
|
`${c.list}/+page.server.ts`,
|
|
3378
|
-
|
|
3294
|
+
Qn(a, p, h)
|
|
3379
3295
|
),
|
|
3380
3296
|
k(
|
|
3381
3297
|
`${c.list}/+page.svelte`,
|
|
3382
|
-
|
|
3298
|
+
Zn(a, m, p)
|
|
3383
3299
|
),
|
|
3384
3300
|
k(
|
|
3385
3301
|
`${c.new}/+page.server.ts`,
|
|
3386
|
-
|
|
3302
|
+
ta(a, m, p, h, t.features.auth)
|
|
3387
3303
|
),
|
|
3388
|
-
k(`${c.new}/+page.svelte`,
|
|
3304
|
+
k(`${c.new}/+page.svelte`, Jn(a, m, p)),
|
|
3389
3305
|
k(
|
|
3390
3306
|
`${c.show}/+page.server.ts`,
|
|
3391
|
-
|
|
3307
|
+
ea(a, m, p, h)
|
|
3392
3308
|
),
|
|
3393
3309
|
k(
|
|
3394
3310
|
`${c.show}/+page.svelte`,
|
|
3395
|
-
|
|
3311
|
+
na(a, m, p)
|
|
3396
3312
|
),
|
|
3397
3313
|
k(
|
|
3398
3314
|
`${c.edit}/+page.server.ts`,
|
|
3399
|
-
|
|
3315
|
+
aa(a, m, p, h)
|
|
3400
3316
|
),
|
|
3401
3317
|
k(
|
|
3402
3318
|
`${c.edit}/+page.svelte`,
|
|
3403
|
-
|
|
3319
|
+
Yn(a, m, p)
|
|
3404
3320
|
),
|
|
3405
3321
|
k(
|
|
3406
3322
|
`${c.list}/server.test.ts`,
|
|
3407
|
-
|
|
3323
|
+
fn(
|
|
3408
3324
|
a,
|
|
3409
3325
|
m,
|
|
3410
3326
|
r,
|
|
@@ -3413,7 +3329,7 @@ async function ca(t) {
|
|
|
3413
3329
|
)
|
|
3414
3330
|
)
|
|
3415
3331
|
], y = [
|
|
3416
|
-
...
|
|
3332
|
+
...N(p),
|
|
3417
3333
|
"button",
|
|
3418
3334
|
"table",
|
|
3419
3335
|
"data-table",
|
|
@@ -3431,33 +3347,33 @@ async function ca(t) {
|
|
|
3431
3347
|
"row-actions"
|
|
3432
3348
|
];
|
|
3433
3349
|
return {
|
|
3434
|
-
creates:
|
|
3350
|
+
creates: g,
|
|
3435
3351
|
modifies: [],
|
|
3436
3352
|
deletes: [],
|
|
3437
3353
|
components: [...new Set(y)],
|
|
3438
3354
|
packages: ["@tanstack/table-core"],
|
|
3439
|
-
collections: i ? [
|
|
3355
|
+
collections: i ? [Nt(a, r, s)] : []
|
|
3440
3356
|
};
|
|
3441
3357
|
}
|
|
3442
|
-
const
|
|
3443
|
-
async function
|
|
3444
|
-
const e = await
|
|
3358
|
+
const oa = "generate-scaffold", sa = "1.0.7", ia = "src/patterns/generate/scaffold", la = "/generate/scaffold";
|
|
3359
|
+
async function ca(t) {
|
|
3360
|
+
const e = await ra(t);
|
|
3445
3361
|
if (t.env !== "runtime")
|
|
3446
3362
|
return $(e);
|
|
3447
|
-
const { createCollections: n } = await import("./collections-
|
|
3363
|
+
const { createCollections: n } = await import("./collections-Ch4kZjuV.js"), a = await n(
|
|
3448
3364
|
e.collections,
|
|
3449
3365
|
t
|
|
3450
3366
|
), r = {
|
|
3451
3367
|
...e,
|
|
3452
3368
|
creates: [...e.creates, ...a]
|
|
3453
|
-
}, { writeResult: s } = await import("./write-result-
|
|
3369
|
+
}, { writeResult: s } = await import("./write-result-1Q3LB_k4.js");
|
|
3454
3370
|
return s(await $(r), t);
|
|
3455
3371
|
}
|
|
3456
|
-
const
|
|
3457
|
-
version:
|
|
3458
|
-
slug:
|
|
3459
|
-
source:
|
|
3460
|
-
docs:
|
|
3372
|
+
const ma = {
|
|
3373
|
+
version: sa,
|
|
3374
|
+
slug: oa,
|
|
3375
|
+
source: ia,
|
|
3376
|
+
docs: la,
|
|
3461
3377
|
plan: "open",
|
|
3462
3378
|
title: "Generate a scaffold",
|
|
3463
3379
|
summary: "Generates CRUD routes and schema.",
|
|
@@ -3476,45 +3392,34 @@ const ga = {
|
|
|
3476
3392
|
base: "vela generate scaffold",
|
|
3477
3393
|
argv: ["contact", "name:text", "email:email"]
|
|
3478
3394
|
},
|
|
3395
|
+
tests: 7,
|
|
3479
3396
|
baseline: "velastack",
|
|
3480
|
-
generate:
|
|
3397
|
+
generate: ca
|
|
3481
3398
|
};
|
|
3482
|
-
function
|
|
3399
|
+
function da(t) {
|
|
3483
3400
|
const [e, ...n] = t;
|
|
3484
3401
|
if (!e)
|
|
3485
3402
|
throw new Error("Invalid command arguments. Expected: <model> [fields...]");
|
|
3486
3403
|
return { modelPath: e, fields: n };
|
|
3487
3404
|
}
|
|
3488
|
-
function
|
|
3405
|
+
function pa(t, e) {
|
|
3489
3406
|
return {
|
|
3490
3407
|
path: t,
|
|
3491
3408
|
language: S(t),
|
|
3492
3409
|
content: e
|
|
3493
3410
|
};
|
|
3494
3411
|
}
|
|
3495
|
-
async function
|
|
3496
|
-
Z(
|
|
3497
|
-
const a = D(e, t);
|
|
3498
|
-
if (n.length > 0) {
|
|
3499
|
-
const i = await Y(n, a, t);
|
|
3500
|
-
return { model: a, fields: i.fields, includeModelFields: !1 };
|
|
3501
|
-
}
|
|
3502
|
-
const r = t.env === "runtime" ? await (await import("./env.runtime-DwDRkEXV.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
|
|
3503
|
-
t
|
|
3504
|
-
), s = mt(a, r, t);
|
|
3505
|
-
return { model: a, fields: s, includeModelFields: !0 };
|
|
3506
|
-
}
|
|
3507
|
-
async function wa(t) {
|
|
3508
|
-
const { modelPath: e, fields: n } = ha(t.argv), { model: a, fields: r, includeModelFields: s } = await va(
|
|
3412
|
+
async function ua(t) {
|
|
3413
|
+
const { modelPath: e, fields: n } = da(t.argv), { model: a, fields: r, shouldCreateCollection: s } = await Z(
|
|
3509
3414
|
t,
|
|
3510
3415
|
e,
|
|
3511
3416
|
n
|
|
3512
|
-
), i = `src/lib/schemas/${a.name}.ts`, o =
|
|
3513
|
-
includeModelFields: s,
|
|
3417
|
+
), i = `src/lib/schemas/${a.name}.ts`, o = Q(a, r, {
|
|
3418
|
+
includeModelFields: !s,
|
|
3514
3419
|
forForm: !0
|
|
3515
3420
|
});
|
|
3516
3421
|
return {
|
|
3517
|
-
creates: [
|
|
3422
|
+
creates: [pa(i, o)],
|
|
3518
3423
|
modifies: [],
|
|
3519
3424
|
deletes: [],
|
|
3520
3425
|
components: [],
|
|
@@ -3522,19 +3427,19 @@ async function wa(t) {
|
|
|
3522
3427
|
collections: []
|
|
3523
3428
|
};
|
|
3524
3429
|
}
|
|
3525
|
-
const
|
|
3526
|
-
async function
|
|
3527
|
-
const e = await
|
|
3430
|
+
const fa = "generate-schema", ga = "1.0.7", ha = "src/patterns/generate/schema", ba = "/generate/schema";
|
|
3431
|
+
async function va(t) {
|
|
3432
|
+
const e = await ua(t);
|
|
3528
3433
|
if (t.env !== "runtime")
|
|
3529
3434
|
return $(e);
|
|
3530
|
-
const { writeResult: n } = await import("./write-result-
|
|
3435
|
+
const { writeResult: n } = await import("./write-result-1Q3LB_k4.js");
|
|
3531
3436
|
return n(await $(e), t);
|
|
3532
3437
|
}
|
|
3533
|
-
const
|
|
3534
|
-
version:
|
|
3535
|
-
slug:
|
|
3536
|
-
source:
|
|
3537
|
-
docs:
|
|
3438
|
+
const wa = {
|
|
3439
|
+
version: ga,
|
|
3440
|
+
slug: fa,
|
|
3441
|
+
source: ha,
|
|
3442
|
+
docs: ba,
|
|
3538
3443
|
plan: "open",
|
|
3539
3444
|
title: "Generate a schema",
|
|
3540
3445
|
summary: "Generates a zod schema.",
|
|
@@ -3553,9 +3458,10 @@ const Sa = {
|
|
|
3553
3458
|
base: "vela generate schema",
|
|
3554
3459
|
argv: ["contact", "name:text", "email:email"]
|
|
3555
3460
|
},
|
|
3461
|
+
tests: 0,
|
|
3556
3462
|
baseline: "velastack",
|
|
3557
|
-
generate:
|
|
3558
|
-
},
|
|
3463
|
+
generate: va
|
|
3464
|
+
}, xa = `<script lang="ts">
|
|
3559
3465
|
import type { ComponentProps } from 'svelte';
|
|
3560
3466
|
import HomeIcon from '@lucide/svelte/icons/home';
|
|
3561
3467
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
@@ -3608,7 +3514,7 @@ const Sa = {
|
|
|
3608
3514
|
<NavUser {user} />
|
|
3609
3515
|
</Sidebar.Footer>
|
|
3610
3516
|
</Sidebar.Root>
|
|
3611
|
-
`,
|
|
3517
|
+
`, ya = `<script lang="ts">
|
|
3612
3518
|
import type { Component } from 'svelte';
|
|
3613
3519
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3614
3520
|
import { page } from '$app/state';
|
|
@@ -3648,7 +3554,7 @@ const Sa = {
|
|
|
3648
3554
|
{/each}
|
|
3649
3555
|
</Sidebar.Menu>
|
|
3650
3556
|
</Sidebar.Group>
|
|
3651
|
-
`,
|
|
3557
|
+
`, $a = `<script lang="ts">
|
|
3652
3558
|
import { toggleMode, mode } from 'mode-watcher';
|
|
3653
3559
|
import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';
|
|
3654
3560
|
import Settings2Icon from '@lucide/svelte/icons/settings-2';
|
|
@@ -3764,12 +3670,12 @@ const Sa = {
|
|
|
3764
3670
|
</DropdownMenu.Root>
|
|
3765
3671
|
</Sidebar.MenuItem>
|
|
3766
3672
|
</Sidebar.Menu>
|
|
3767
|
-
`,
|
|
3673
|
+
`, _a = `import { z } from "zod";
|
|
3768
3674
|
|
|
3769
3675
|
export const changeEmailSchema = z.object({
|
|
3770
|
-
email: z.
|
|
3676
|
+
email: z.email(),
|
|
3771
3677
|
});
|
|
3772
|
-
`,
|
|
3678
|
+
`, Ca = `import { z } from "zod";
|
|
3773
3679
|
|
|
3774
3680
|
export const changePasswordSchema = z
|
|
3775
3681
|
.object({
|
|
@@ -3780,33 +3686,33 @@ export const changePasswordSchema = z
|
|
|
3780
3686
|
message: "Passwords don't match",
|
|
3781
3687
|
path: ["passwordConfirm"],
|
|
3782
3688
|
});
|
|
3783
|
-
`,
|
|
3689
|
+
`, Sa = `import { z } from "zod";
|
|
3784
3690
|
|
|
3785
3691
|
export const confirmEmailChangeSchema = z.object({
|
|
3786
3692
|
password: z.string(),
|
|
3787
3693
|
});
|
|
3788
|
-
`,
|
|
3694
|
+
`, Fa = `import { z } from "zod";
|
|
3789
3695
|
|
|
3790
3696
|
export const confirmResetSchema = z.object({
|
|
3791
3697
|
password: z.string(),
|
|
3792
3698
|
passwordConfirm: z.string(),
|
|
3793
3699
|
});
|
|
3794
|
-
`,
|
|
3700
|
+
`, ka = `import { z } from "zod";
|
|
3795
3701
|
|
|
3796
3702
|
const otpSchema = z.object({
|
|
3797
3703
|
type: z.literal("otp"),
|
|
3798
|
-
email: z.
|
|
3704
|
+
email: z.email(),
|
|
3799
3705
|
});
|
|
3800
3706
|
|
|
3801
3707
|
const passwordSchema = z.object({
|
|
3802
3708
|
type: z.literal("password"),
|
|
3803
|
-
email: z.
|
|
3709
|
+
email: z.email(),
|
|
3804
3710
|
password: z.string(),
|
|
3805
3711
|
});
|
|
3806
3712
|
|
|
3807
3713
|
const oAuth2Schema = z.object({
|
|
3808
3714
|
type: z.literal("oauth2"),
|
|
3809
|
-
email: z.
|
|
3715
|
+
email: z.email(),
|
|
3810
3716
|
});
|
|
3811
3717
|
|
|
3812
3718
|
export const loginSchema = z.discriminatedUnion("type", [
|
|
@@ -3814,37 +3720,37 @@ export const loginSchema = z.discriminatedUnion("type", [
|
|
|
3814
3720
|
passwordSchema,
|
|
3815
3721
|
oAuth2Schema,
|
|
3816
3722
|
]);
|
|
3817
|
-
`,
|
|
3723
|
+
`, Ra = `import { z } from "zod";
|
|
3818
3724
|
|
|
3819
3725
|
export const otpSchema = z.object({
|
|
3820
3726
|
otp: z.string(),
|
|
3821
3727
|
});
|
|
3822
|
-
`,
|
|
3728
|
+
`, Ia = `import { z } from "zod";
|
|
3823
3729
|
|
|
3824
3730
|
export const profileSchema = z.object({
|
|
3825
3731
|
name: z.string().optional(),
|
|
3826
3732
|
avatar: z.union([z.instanceof(File), z.string()]).optional(),
|
|
3827
3733
|
emailVisibility: z.boolean().optional(),
|
|
3828
3734
|
});
|
|
3829
|
-
`,
|
|
3735
|
+
`, Ma = `import { z } from "zod";
|
|
3830
3736
|
|
|
3831
3737
|
export const resetSchema = z.object({
|
|
3832
|
-
email: z.
|
|
3738
|
+
email: z.email(),
|
|
3833
3739
|
});
|
|
3834
|
-
`,
|
|
3740
|
+
`, Pa = `import { z } from "zod";
|
|
3835
3741
|
|
|
3836
3742
|
export const signupSchema = z.object({
|
|
3837
|
-
email: z.
|
|
3743
|
+
email: z.email(),
|
|
3838
3744
|
password: z.string(),
|
|
3839
3745
|
passwordConfirm: z.string(),
|
|
3840
3746
|
});
|
|
3841
|
-
`,
|
|
3747
|
+
`, Ta = `export const load = ({ locals }) => {
|
|
3842
3748
|
const user = locals.pb.authStore.record!;
|
|
3843
3749
|
const breadcrumbs = [{ title: "Home", url: "/dashboard" }];
|
|
3844
3750
|
|
|
3845
3751
|
return { user, breadcrumbs };
|
|
3846
3752
|
};
|
|
3847
|
-
`,
|
|
3753
|
+
`, Ea = `<script lang="ts">
|
|
3848
3754
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3849
3755
|
import { Separator } from '$lib/components/ui/separator';
|
|
3850
3756
|
import AppSidebar from '$lib/components/app-sidebar.svelte';
|
|
@@ -3894,7 +3800,7 @@ export const signupSchema = z.object({
|
|
|
3894
3800
|
background-color: var(--color-sidebar);
|
|
3895
3801
|
}
|
|
3896
3802
|
</style>
|
|
3897
|
-
`,
|
|
3803
|
+
`, Da = "", Ba = `import { describe, it, expect } from "vitest";
|
|
3898
3804
|
import type { Match } from "@velastack/pocketbase";
|
|
3899
3805
|
import type { RouteId } from "./$types";
|
|
3900
3806
|
|
|
@@ -3915,15 +3821,15 @@ describe("dashboard", () => {
|
|
|
3915
3821
|
expect(response.status).toBe(200);
|
|
3916
3822
|
});
|
|
3917
3823
|
});
|
|
3918
|
-
`,
|
|
3824
|
+
`, Aa = `export const load = async ({ parent }) => {
|
|
3919
3825
|
const { breadcrumbs } = await parent();
|
|
3920
3826
|
|
|
3921
3827
|
return {
|
|
3922
3828
|
breadcrumbs: [...breadcrumbs, { title: "Settings", url: "/settings" }],
|
|
3923
3829
|
};
|
|
3924
3830
|
};
|
|
3925
|
-
`,
|
|
3926
|
-
import {
|
|
3831
|
+
`, za = `import { superValidate, fail, withFiles } from "sveltekit-superforms";
|
|
3832
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
3927
3833
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
3928
3834
|
import { profileSchema } from "$lib/schemas/profile";
|
|
3929
3835
|
import { changeEmailSchema } from "$lib/schemas/changeEmail";
|
|
@@ -3938,17 +3844,17 @@ export const load = async ({ parent }) => {
|
|
|
3938
3844
|
name: user.name,
|
|
3939
3845
|
emailVisibility: user.emailVisibility,
|
|
3940
3846
|
},
|
|
3941
|
-
|
|
3847
|
+
zod4(profileSchema),
|
|
3942
3848
|
);
|
|
3943
|
-
const emailForm = await superValidate(
|
|
3944
|
-
const passwordForm = await superValidate(
|
|
3849
|
+
const emailForm = await superValidate(zod4(changeEmailSchema));
|
|
3850
|
+
const passwordForm = await superValidate(zod4(changePasswordSchema));
|
|
3945
3851
|
|
|
3946
3852
|
return { profileForm, emailForm, passwordForm, user };
|
|
3947
3853
|
};
|
|
3948
3854
|
|
|
3949
3855
|
export const actions = {
|
|
3950
3856
|
updateProfile: async ({ locals, request, cookies }) => {
|
|
3951
|
-
const form = await superValidate(request,
|
|
3857
|
+
const form = await superValidate(request, zod4(profileSchema));
|
|
3952
3858
|
|
|
3953
3859
|
if (!form.valid) {
|
|
3954
3860
|
return fail(400, { profileForm: form });
|
|
@@ -3965,7 +3871,7 @@ export const actions = {
|
|
|
3965
3871
|
return withFiles({ profileForm: form });
|
|
3966
3872
|
},
|
|
3967
3873
|
changeEmail: async ({ locals, request, cookies }) => {
|
|
3968
|
-
const form = await superValidate(request,
|
|
3874
|
+
const form = await superValidate(request, zod4(changeEmailSchema));
|
|
3969
3875
|
|
|
3970
3876
|
if (!form.valid) {
|
|
3971
3877
|
return fail(400, { emailForm: form });
|
|
@@ -3982,7 +3888,7 @@ export const actions = {
|
|
|
3982
3888
|
return { emailForm: form };
|
|
3983
3889
|
},
|
|
3984
3890
|
changePassword: async ({ locals, request, cookies }) => {
|
|
3985
|
-
const form = await superValidate(request,
|
|
3891
|
+
const form = await superValidate(request, zod4(changePasswordSchema));
|
|
3986
3892
|
|
|
3987
3893
|
if (!form.valid) {
|
|
3988
3894
|
return fail(400, { passwordForm: form });
|
|
@@ -4012,10 +3918,10 @@ export const actions = {
|
|
|
4012
3918
|
return {};
|
|
4013
3919
|
},
|
|
4014
3920
|
};
|
|
4015
|
-
`,
|
|
3921
|
+
`, La = `<script lang="ts">
|
|
4016
3922
|
import { untrack } from 'svelte';
|
|
4017
3923
|
import { superForm } from 'sveltekit-superforms';
|
|
4018
|
-
import {
|
|
3924
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
4019
3925
|
import { changeEmailSchema } from '$lib/schemas/changeEmail';
|
|
4020
3926
|
import { changePasswordSchema } from '$lib/schemas/changePassword';
|
|
4021
3927
|
import { profileSchema } from '$lib/schemas/profile';
|
|
@@ -4034,7 +3940,7 @@ export const actions = {
|
|
|
4034
3940
|
const profileForm = superForm(
|
|
4035
3941
|
untrack(() => data.profileForm),
|
|
4036
3942
|
{
|
|
4037
|
-
validators:
|
|
3943
|
+
validators: zod4Client(profileSchema),
|
|
4038
3944
|
id: 'profileForm'
|
|
4039
3945
|
}
|
|
4040
3946
|
);
|
|
@@ -4042,7 +3948,7 @@ export const actions = {
|
|
|
4042
3948
|
const emailForm = superForm(
|
|
4043
3949
|
untrack(() => data.emailForm),
|
|
4044
3950
|
{
|
|
4045
|
-
validators:
|
|
3951
|
+
validators: zod4Client(changeEmailSchema),
|
|
4046
3952
|
id: 'emailForm'
|
|
4047
3953
|
}
|
|
4048
3954
|
);
|
|
@@ -4050,7 +3956,7 @@ export const actions = {
|
|
|
4050
3956
|
const passwordForm = superForm(
|
|
4051
3957
|
untrack(() => data.passwordForm),
|
|
4052
3958
|
{
|
|
4053
|
-
validators:
|
|
3959
|
+
validators: zod4Client(changePasswordSchema),
|
|
4054
3960
|
id: 'passwordForm'
|
|
4055
3961
|
}
|
|
4056
3962
|
);
|
|
@@ -4290,19 +4196,19 @@ export const actions = {
|
|
|
4290
4196
|
</form>
|
|
4291
4197
|
</div>
|
|
4292
4198
|
</div>
|
|
4293
|
-
`,
|
|
4294
|
-
import {
|
|
4199
|
+
`, Oa = `import { fail, superValidate } from "sveltekit-superforms";
|
|
4200
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
4295
4201
|
import { confirmEmailChangeSchema } from "$lib/schemas/confirmEmailChange";
|
|
4296
4202
|
import { redirect } from "@sveltejs/kit";
|
|
4297
4203
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
4298
4204
|
|
|
4299
4205
|
export const load = async () => {
|
|
4300
|
-
return { form: await superValidate(
|
|
4206
|
+
return { form: await superValidate(zod4(confirmEmailChangeSchema)) };
|
|
4301
4207
|
};
|
|
4302
4208
|
|
|
4303
4209
|
export const actions = {
|
|
4304
4210
|
default: async ({ locals, params, request, cookies }) => {
|
|
4305
|
-
const form = await superValidate(request,
|
|
4211
|
+
const form = await superValidate(request, zod4(confirmEmailChangeSchema));
|
|
4306
4212
|
|
|
4307
4213
|
if (!form.valid) {
|
|
4308
4214
|
return fail(400, { form });
|
|
@@ -4322,12 +4228,12 @@ export const actions = {
|
|
|
4322
4228
|
return redirect(303, "/login");
|
|
4323
4229
|
},
|
|
4324
4230
|
};
|
|
4325
|
-
`,
|
|
4231
|
+
`, Ua = `<script lang="ts">
|
|
4326
4232
|
import { untrack } from 'svelte';
|
|
4327
4233
|
import { Button } from '$lib/components/ui/button';
|
|
4328
4234
|
import * as Card from '$lib/components/ui/card';
|
|
4329
4235
|
import { superForm } from 'sveltekit-superforms';
|
|
4330
|
-
import {
|
|
4236
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
4331
4237
|
import { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';
|
|
4332
4238
|
import * as Form from '$lib/components/ui/form';
|
|
4333
4239
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -4337,7 +4243,7 @@ export const actions = {
|
|
|
4337
4243
|
const form = superForm(
|
|
4338
4244
|
untrack(() => data.form),
|
|
4339
4245
|
{
|
|
4340
|
-
validators:
|
|
4246
|
+
validators: zod4Client(confirmEmailChangeSchema)
|
|
4341
4247
|
}
|
|
4342
4248
|
);
|
|
4343
4249
|
|
|
@@ -4390,7 +4296,7 @@ export const actions = {
|
|
|
4390
4296
|
</div>
|
|
4391
4297
|
</div>
|
|
4392
4298
|
</div>
|
|
4393
|
-
`,
|
|
4299
|
+
`, ja = `import { describe, it, expect } from "vitest";
|
|
4394
4300
|
import type { Match } from "@velastack/pocketbase";
|
|
4395
4301
|
import type { RouteId } from "./$types";
|
|
4396
4302
|
|
|
@@ -4402,19 +4308,19 @@ describe("GET /confirm-email-change/[token]", () => {
|
|
|
4402
4308
|
expect(response.status).toBe(200);
|
|
4403
4309
|
});
|
|
4404
4310
|
});
|
|
4405
|
-
`,
|
|
4406
|
-
import {
|
|
4311
|
+
`, qa = `import { fail, superValidate } from "sveltekit-superforms";
|
|
4312
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
4407
4313
|
import { confirmResetSchema } from "$lib/schemas/confirmReset";
|
|
4408
4314
|
import { redirect } from "@sveltejs/kit";
|
|
4409
4315
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
4410
4316
|
|
|
4411
4317
|
export const load = async () => {
|
|
4412
|
-
return { form: await superValidate(
|
|
4318
|
+
return { form: await superValidate(zod4(confirmResetSchema)) };
|
|
4413
4319
|
};
|
|
4414
4320
|
|
|
4415
4321
|
export const actions = {
|
|
4416
4322
|
default: async ({ locals, request, params, cookies }) => {
|
|
4417
|
-
const form = await superValidate(request,
|
|
4323
|
+
const form = await superValidate(request, zod4(confirmResetSchema));
|
|
4418
4324
|
|
|
4419
4325
|
if (!form.valid) {
|
|
4420
4326
|
return fail(400, { form });
|
|
@@ -4438,12 +4344,12 @@ export const actions = {
|
|
|
4438
4344
|
return redirect(303, "/login");
|
|
4439
4345
|
},
|
|
4440
4346
|
};
|
|
4441
|
-
`,
|
|
4347
|
+
`, Na = `<script lang="ts">
|
|
4442
4348
|
import { untrack } from 'svelte';
|
|
4443
4349
|
import { Button } from '$lib/components/ui/button';
|
|
4444
4350
|
import * as Card from '$lib/components/ui/card';
|
|
4445
4351
|
import { superForm } from 'sveltekit-superforms';
|
|
4446
|
-
import {
|
|
4352
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
4447
4353
|
import { confirmResetSchema } from '$lib/schemas/confirmReset';
|
|
4448
4354
|
import * as Form from '$lib/components/ui/form';
|
|
4449
4355
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -4453,7 +4359,7 @@ export const actions = {
|
|
|
4453
4359
|
const form = superForm(
|
|
4454
4360
|
untrack(() => data.form),
|
|
4455
4361
|
{
|
|
4456
|
-
validators:
|
|
4362
|
+
validators: zod4Client(confirmResetSchema)
|
|
4457
4363
|
}
|
|
4458
4364
|
);
|
|
4459
4365
|
|
|
@@ -4522,7 +4428,7 @@ export const actions = {
|
|
|
4522
4428
|
</div>
|
|
4523
4429
|
</div>
|
|
4524
4430
|
</div>
|
|
4525
|
-
`,
|
|
4431
|
+
`, Va = `import { describe, it, expect } from "vitest";
|
|
4526
4432
|
import type { Match } from "@velastack/pocketbase";
|
|
4527
4433
|
import type { RouteId } from "./$types";
|
|
4528
4434
|
|
|
@@ -4534,7 +4440,7 @@ describe("GET /confirm-reset/[token]", () => {
|
|
|
4534
4440
|
expect(response.status).toBe(200);
|
|
4535
4441
|
});
|
|
4536
4442
|
});
|
|
4537
|
-
`,
|
|
4443
|
+
`, Ha = `import { redirect } from "@sveltejs/kit";
|
|
4538
4444
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
4539
4445
|
|
|
4540
4446
|
export const GET = async ({ params, locals, cookies }) => {
|
|
@@ -4554,7 +4460,7 @@ export const GET = async ({ params, locals, cookies }) => {
|
|
|
4554
4460
|
setFlash({ type: "toast", message }, cookies);
|
|
4555
4461
|
redirect(303, redirectPath);
|
|
4556
4462
|
};
|
|
4557
|
-
`,
|
|
4463
|
+
`, Ka = `import { describe, it, expect } from "vitest";
|
|
4558
4464
|
import type { Match } from "@velastack/pocketbase";
|
|
4559
4465
|
import type { RouteId } from "./$types";
|
|
4560
4466
|
|
|
@@ -4567,8 +4473,8 @@ describe("GET /confirm-verification/[token]", () => {
|
|
|
4567
4473
|
expect(response.headers["location"]).toBe("/login");
|
|
4568
4474
|
});
|
|
4569
4475
|
});
|
|
4570
|
-
`,
|
|
4571
|
-
import {
|
|
4476
|
+
`, Ga = `import { fail, superValidate, message } from "sveltekit-superforms";
|
|
4477
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
4572
4478
|
import { loginSchema } from "$lib/schemas/login";
|
|
4573
4479
|
import { redirect } from "@sveltejs/kit";
|
|
4574
4480
|
import { dev } from "$app/environment";
|
|
@@ -4588,7 +4494,7 @@ export const load = async ({ locals }) => {
|
|
|
4588
4494
|
|
|
4589
4495
|
return {
|
|
4590
4496
|
form: await superValidate(
|
|
4591
|
-
|
|
4497
|
+
zod4(loginSchema.default({ type, email: "", password: "" })),
|
|
4592
4498
|
),
|
|
4593
4499
|
authMethods,
|
|
4594
4500
|
};
|
|
@@ -4596,7 +4502,7 @@ export const load = async ({ locals }) => {
|
|
|
4596
4502
|
|
|
4597
4503
|
export const actions = {
|
|
4598
4504
|
default: async ({ locals, request, cookies, url }) => {
|
|
4599
|
-
const form = await superValidate(request,
|
|
4505
|
+
const form = await superValidate(request, zod4(loginSchema));
|
|
4600
4506
|
|
|
4601
4507
|
if (!form.valid) {
|
|
4602
4508
|
return fail(400, { form });
|
|
@@ -4638,12 +4544,12 @@ export const actions = {
|
|
|
4638
4544
|
redirect(303, redirectUrl);
|
|
4639
4545
|
},
|
|
4640
4546
|
};
|
|
4641
|
-
`,
|
|
4547
|
+
`, Wa = `<script lang="ts">
|
|
4642
4548
|
import { untrack } from 'svelte';
|
|
4643
4549
|
import { Button } from '$lib/components/ui/button';
|
|
4644
4550
|
import * as Card from '$lib/components/ui/card';
|
|
4645
4551
|
import { superForm } from 'sveltekit-superforms';
|
|
4646
|
-
import {
|
|
4552
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
4647
4553
|
import { loginSchema } from '$lib/schemas/login';
|
|
4648
4554
|
import * as Form from '$lib/components/ui/form';
|
|
4649
4555
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -4661,7 +4567,7 @@ export const actions = {
|
|
|
4661
4567
|
const form = superForm(
|
|
4662
4568
|
untrack(() => data.form),
|
|
4663
4569
|
{
|
|
4664
|
-
validators:
|
|
4570
|
+
validators: zod4Client(loginSchema)
|
|
4665
4571
|
}
|
|
4666
4572
|
);
|
|
4667
4573
|
|
|
@@ -4821,7 +4727,7 @@ export const actions = {
|
|
|
4821
4727
|
</div>
|
|
4822
4728
|
</div>
|
|
4823
4729
|
</div>
|
|
4824
|
-
`,
|
|
4730
|
+
`, Xa = `import { describe, it, expect } from "vitest";
|
|
4825
4731
|
import * as devalue from "devalue";
|
|
4826
4732
|
import type { Match } from "@velastack/pocketbase";
|
|
4827
4733
|
import type { RouteId } from "./$types";
|
|
@@ -4868,14 +4774,14 @@ describe("POST /login", () => {
|
|
|
4868
4774
|
expect(data.form.message.text).toBe("Failed to authenticate.");
|
|
4869
4775
|
});
|
|
4870
4776
|
});
|
|
4871
|
-
`,
|
|
4777
|
+
`, Ja = `import { redirect } from "@sveltejs/kit";
|
|
4872
4778
|
|
|
4873
4779
|
export const POST = ({ cookies, locals }) => {
|
|
4874
4780
|
locals.pb.authStore.clear();
|
|
4875
4781
|
locals.pb.authStore.clearCookie(cookies);
|
|
4876
4782
|
throw redirect(303, "/");
|
|
4877
4783
|
};
|
|
4878
|
-
`,
|
|
4784
|
+
`, Ya = `import { describe, it, expect } from "vitest";
|
|
4879
4785
|
import type { Match } from "@velastack/pocketbase";
|
|
4880
4786
|
import type { RouteId } from "./$types";
|
|
4881
4787
|
|
|
@@ -4889,8 +4795,8 @@ describe("POST /logout", () => {
|
|
|
4889
4795
|
expect(response.headers.location).toBe("/");
|
|
4890
4796
|
});
|
|
4891
4797
|
});
|
|
4892
|
-
`,
|
|
4893
|
-
import {
|
|
4798
|
+
`, Za = `import { fail, message, superValidate } from "sveltekit-superforms";
|
|
4799
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
4894
4800
|
import { otpSchema } from "$lib/schemas/otp";
|
|
4895
4801
|
import { redirect } from "@sveltejs/kit";
|
|
4896
4802
|
import { dev } from "$app/environment";
|
|
@@ -4900,12 +4806,12 @@ export const load = async ({ locals }) => {
|
|
|
4900
4806
|
redirect(303, "/dashboard");
|
|
4901
4807
|
}
|
|
4902
4808
|
|
|
4903
|
-
return { form: await superValidate(
|
|
4809
|
+
return { form: await superValidate(zod4(otpSchema)) };
|
|
4904
4810
|
};
|
|
4905
4811
|
|
|
4906
4812
|
export const actions = {
|
|
4907
4813
|
default: async ({ locals, request, params, cookies, url }) => {
|
|
4908
|
-
const form = await superValidate(request,
|
|
4814
|
+
const form = await superValidate(request, zod4(otpSchema));
|
|
4909
4815
|
|
|
4910
4816
|
if (!form.valid) {
|
|
4911
4817
|
return fail(400, { form });
|
|
@@ -4936,12 +4842,12 @@ export const actions = {
|
|
|
4936
4842
|
redirect(303, redirectUrl);
|
|
4937
4843
|
},
|
|
4938
4844
|
};
|
|
4939
|
-
`,
|
|
4845
|
+
`, Qa = `<script lang="ts">
|
|
4940
4846
|
import { untrack } from 'svelte';
|
|
4941
4847
|
import { Button } from '$lib/components/ui/button';
|
|
4942
4848
|
import * as Card from '$lib/components/ui/card';
|
|
4943
4849
|
import { superForm } from 'sveltekit-superforms';
|
|
4944
|
-
import {
|
|
4850
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
4945
4851
|
import { otpSchema } from '$lib/schemas/otp';
|
|
4946
4852
|
import * as Form from '$lib/components/ui/form';
|
|
4947
4853
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -4951,7 +4857,7 @@ export const actions = {
|
|
|
4951
4857
|
const form = superForm(
|
|
4952
4858
|
untrack(() => data.form),
|
|
4953
4859
|
{
|
|
4954
|
-
validators:
|
|
4860
|
+
validators: zod4Client(otpSchema)
|
|
4955
4861
|
}
|
|
4956
4862
|
);
|
|
4957
4863
|
|
|
@@ -5002,7 +4908,7 @@ export const actions = {
|
|
|
5002
4908
|
</div>
|
|
5003
4909
|
</div>
|
|
5004
4910
|
</div>
|
|
5005
|
-
`,
|
|
4911
|
+
`, tr = `import { describe, it, expect } from "vitest";
|
|
5006
4912
|
import type { Match } from "@velastack/pocketbase";
|
|
5007
4913
|
import type { RouteId } from "./$types";
|
|
5008
4914
|
|
|
@@ -5024,8 +4930,8 @@ describe("POST /otp/[token]", () => {
|
|
|
5024
4930
|
expect(response.body.status).toBe(400);
|
|
5025
4931
|
});
|
|
5026
4932
|
});
|
|
5027
|
-
`,
|
|
5028
|
-
import {
|
|
4933
|
+
`, er = `import { fail, superValidate } from "sveltekit-superforms";
|
|
4934
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
5029
4935
|
import { resetSchema } from "$lib/schemas/reset";
|
|
5030
4936
|
import { redirect } from "@sveltejs/kit";
|
|
5031
4937
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
@@ -5035,12 +4941,12 @@ export const load = async ({ locals }) => {
|
|
|
5035
4941
|
redirect(303, "/dashboard");
|
|
5036
4942
|
}
|
|
5037
4943
|
|
|
5038
|
-
return { form: await superValidate(
|
|
4944
|
+
return { form: await superValidate(zod4(resetSchema)) };
|
|
5039
4945
|
};
|
|
5040
4946
|
|
|
5041
4947
|
export const actions = {
|
|
5042
4948
|
default: async ({ locals, request, cookies }) => {
|
|
5043
|
-
const form = await superValidate(request,
|
|
4949
|
+
const form = await superValidate(request, zod4(resetSchema));
|
|
5044
4950
|
|
|
5045
4951
|
if (!form.valid) {
|
|
5046
4952
|
return fail(400, { form });
|
|
@@ -5058,12 +4964,12 @@ export const actions = {
|
|
|
5058
4964
|
return { form };
|
|
5059
4965
|
},
|
|
5060
4966
|
};
|
|
5061
|
-
`,
|
|
4967
|
+
`, nr = `<script lang="ts">
|
|
5062
4968
|
import { untrack } from 'svelte';
|
|
5063
4969
|
import { Button } from '$lib/components/ui/button';
|
|
5064
4970
|
import * as Card from '$lib/components/ui/card';
|
|
5065
4971
|
import { superForm } from 'sveltekit-superforms';
|
|
5066
|
-
import {
|
|
4972
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
5067
4973
|
import { resetSchema } from '$lib/schemas/reset';
|
|
5068
4974
|
import * as Form from '$lib/components/ui/form';
|
|
5069
4975
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -5073,7 +4979,7 @@ export const actions = {
|
|
|
5073
4979
|
const form = superForm(
|
|
5074
4980
|
untrack(() => data.form),
|
|
5075
4981
|
{
|
|
5076
|
-
validators:
|
|
4982
|
+
validators: zod4Client(resetSchema)
|
|
5077
4983
|
}
|
|
5078
4984
|
);
|
|
5079
4985
|
|
|
@@ -5125,7 +5031,7 @@ export const actions = {
|
|
|
5125
5031
|
</div>
|
|
5126
5032
|
</div>
|
|
5127
5033
|
</div>
|
|
5128
|
-
`,
|
|
5034
|
+
`, ar = `import { describe, it, expect } from "vitest";
|
|
5129
5035
|
import type { Match } from "@velastack/pocketbase";
|
|
5130
5036
|
import type { RouteId } from "./$types";
|
|
5131
5037
|
|
|
@@ -5147,9 +5053,9 @@ describe("POST /reset", () => {
|
|
|
5147
5053
|
expect(response.body.status).toBe(200);
|
|
5148
5054
|
});
|
|
5149
5055
|
});
|
|
5150
|
-
`,
|
|
5056
|
+
`, rr = `import { redirect } from "@sveltejs/kit";
|
|
5151
5057
|
import { fail, superValidate } from "sveltekit-superforms";
|
|
5152
|
-
import {
|
|
5058
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
5153
5059
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
5154
5060
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
5155
5061
|
import { dev } from "$app/environment";
|
|
@@ -5162,12 +5068,12 @@ export const load = async ({ locals }) => {
|
|
|
5162
5068
|
redirect(303, "/dashboard");
|
|
5163
5069
|
}
|
|
5164
5070
|
|
|
5165
|
-
return { form: await superValidate(
|
|
5071
|
+
return { form: await superValidate(zod4(signupSchema)), authMethods };
|
|
5166
5072
|
};
|
|
5167
5073
|
|
|
5168
5074
|
export const actions = {
|
|
5169
5075
|
default: async ({ locals, request, cookies, url }) => {
|
|
5170
|
-
const form = await superValidate(request,
|
|
5076
|
+
const form = await superValidate(request, zod4(signupSchema));
|
|
5171
5077
|
|
|
5172
5078
|
if (!form.valid) {
|
|
5173
5079
|
return fail(400, { form });
|
|
@@ -5208,12 +5114,12 @@ export const actions = {
|
|
|
5208
5114
|
return redirect(303, redirectUrl);
|
|
5209
5115
|
},
|
|
5210
5116
|
};
|
|
5211
|
-
`,
|
|
5117
|
+
`, or = `<script lang="ts">
|
|
5212
5118
|
import { untrack } from 'svelte';
|
|
5213
5119
|
import { Button } from '$lib/components/ui/button';
|
|
5214
5120
|
import * as Card from '$lib/components/ui/card';
|
|
5215
5121
|
import { superForm } from 'sveltekit-superforms';
|
|
5216
|
-
import {
|
|
5122
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
5217
5123
|
import { signupSchema } from '$lib/schemas/signup';
|
|
5218
5124
|
import * as Form from '$lib/components/ui/form';
|
|
5219
5125
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -5231,7 +5137,7 @@ export const actions = {
|
|
|
5231
5137
|
const form = superForm(
|
|
5232
5138
|
untrack(() => data.form),
|
|
5233
5139
|
{
|
|
5234
|
-
validators:
|
|
5140
|
+
validators: zod4Client(signupSchema)
|
|
5235
5141
|
}
|
|
5236
5142
|
);
|
|
5237
5143
|
|
|
@@ -5375,7 +5281,7 @@ export const actions = {
|
|
|
5375
5281
|
</div>
|
|
5376
5282
|
</div>
|
|
5377
5283
|
</div>
|
|
5378
|
-
`,
|
|
5284
|
+
`, sr = `import { describe, it, expect } from "vitest";
|
|
5379
5285
|
import type { Match } from "@velastack/pocketbase";
|
|
5380
5286
|
import * as devalue from "devalue";
|
|
5381
5287
|
import type { RouteId } from "./$types";
|
|
@@ -5433,52 +5339,52 @@ describe("POST /signup", () => {
|
|
|
5433
5339
|
expect(data.form.errors.email[0]).toBe("Value must be unique.");
|
|
5434
5340
|
});
|
|
5435
5341
|
});
|
|
5436
|
-
`,
|
|
5437
|
-
"./creates/src/lib/components/app-sidebar.svelte":
|
|
5438
|
-
"./creates/src/lib/components/nav-main.svelte":
|
|
5439
|
-
"./creates/src/lib/components/nav-user.svelte":
|
|
5440
|
-
"./creates/src/lib/schemas/changeEmail.ts":
|
|
5441
|
-
"./creates/src/lib/schemas/changePassword.ts":
|
|
5442
|
-
"./creates/src/lib/schemas/confirmEmailChange.ts":
|
|
5443
|
-
"./creates/src/lib/schemas/confirmReset.ts":
|
|
5444
|
-
"./creates/src/lib/schemas/login.ts":
|
|
5445
|
-
"./creates/src/lib/schemas/otp.ts":
|
|
5446
|
-
"./creates/src/lib/schemas/profile.ts":
|
|
5447
|
-
"./creates/src/lib/schemas/reset.ts":
|
|
5448
|
-
"./creates/src/lib/schemas/signup.ts":
|
|
5449
|
-
"./creates/src/routes/(app)/+layout.server.ts":
|
|
5450
|
-
"./creates/src/routes/(app)/+layout.svelte":
|
|
5451
|
-
"./creates/src/routes/(app)/dashboard/+page.svelte":
|
|
5452
|
-
"./creates/src/routes/(app)/dashboard/server.test.ts":
|
|
5453
|
-
"./creates/src/routes/(app)/settings/+layout.server.ts":
|
|
5454
|
-
"./creates/src/routes/(app)/settings/+page.server.ts":
|
|
5455
|
-
"./creates/src/routes/(app)/settings/+page.svelte":
|
|
5456
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts":
|
|
5457
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte":
|
|
5458
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts":
|
|
5459
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts":
|
|
5460
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte":
|
|
5461
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts":
|
|
5462
|
-
"./creates/src/routes/(public)/confirm-verification/[token]/+server.ts":
|
|
5463
|
-
"./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts":
|
|
5464
|
-
"./creates/src/routes/(public)/login/+page.server.ts":
|
|
5465
|
-
"./creates/src/routes/(public)/login/+page.svelte":
|
|
5466
|
-
"./creates/src/routes/(public)/login/server.test.ts":
|
|
5467
|
-
"./creates/src/routes/(public)/logout/+server.ts":
|
|
5468
|
-
"./creates/src/routes/(public)/logout/server.test.ts":
|
|
5469
|
-
"./creates/src/routes/(public)/otp/[token]/+page.server.ts":
|
|
5470
|
-
"./creates/src/routes/(public)/otp/[token]/+page.svelte":
|
|
5471
|
-
"./creates/src/routes/(public)/otp/[token]/server.test.ts":
|
|
5472
|
-
"./creates/src/routes/(public)/reset/+page.server.ts":
|
|
5473
|
-
"./creates/src/routes/(public)/reset/+page.svelte":
|
|
5474
|
-
"./creates/src/routes/(public)/reset/server.test.ts":
|
|
5475
|
-
"./creates/src/routes/(public)/signup/+page.server.ts":
|
|
5476
|
-
"./creates/src/routes/(public)/signup/+page.svelte":
|
|
5477
|
-
"./creates/src/routes/(public)/signup/server.test.ts":
|
|
5478
|
-
}),
|
|
5479
|
-
async function
|
|
5480
|
-
const e = Object.entries(
|
|
5481
|
-
const i = M(r,
|
|
5342
|
+
`, ir = /* @__PURE__ */ Object.assign({
|
|
5343
|
+
"./creates/src/lib/components/app-sidebar.svelte": xa,
|
|
5344
|
+
"./creates/src/lib/components/nav-main.svelte": ya,
|
|
5345
|
+
"./creates/src/lib/components/nav-user.svelte": $a,
|
|
5346
|
+
"./creates/src/lib/schemas/changeEmail.ts": _a,
|
|
5347
|
+
"./creates/src/lib/schemas/changePassword.ts": Ca,
|
|
5348
|
+
"./creates/src/lib/schemas/confirmEmailChange.ts": Sa,
|
|
5349
|
+
"./creates/src/lib/schemas/confirmReset.ts": Fa,
|
|
5350
|
+
"./creates/src/lib/schemas/login.ts": ka,
|
|
5351
|
+
"./creates/src/lib/schemas/otp.ts": Ra,
|
|
5352
|
+
"./creates/src/lib/schemas/profile.ts": Ia,
|
|
5353
|
+
"./creates/src/lib/schemas/reset.ts": Ma,
|
|
5354
|
+
"./creates/src/lib/schemas/signup.ts": Pa,
|
|
5355
|
+
"./creates/src/routes/(app)/+layout.server.ts": Ta,
|
|
5356
|
+
"./creates/src/routes/(app)/+layout.svelte": Ea,
|
|
5357
|
+
"./creates/src/routes/(app)/dashboard/+page.svelte": Da,
|
|
5358
|
+
"./creates/src/routes/(app)/dashboard/server.test.ts": Ba,
|
|
5359
|
+
"./creates/src/routes/(app)/settings/+layout.server.ts": Aa,
|
|
5360
|
+
"./creates/src/routes/(app)/settings/+page.server.ts": za,
|
|
5361
|
+
"./creates/src/routes/(app)/settings/+page.svelte": La,
|
|
5362
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Oa,
|
|
5363
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Ua,
|
|
5364
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": ja,
|
|
5365
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": qa,
|
|
5366
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Na,
|
|
5367
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Va,
|
|
5368
|
+
"./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": Ha,
|
|
5369
|
+
"./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Ka,
|
|
5370
|
+
"./creates/src/routes/(public)/login/+page.server.ts": Ga,
|
|
5371
|
+
"./creates/src/routes/(public)/login/+page.svelte": Wa,
|
|
5372
|
+
"./creates/src/routes/(public)/login/server.test.ts": Xa,
|
|
5373
|
+
"./creates/src/routes/(public)/logout/+server.ts": Ja,
|
|
5374
|
+
"./creates/src/routes/(public)/logout/server.test.ts": Ya,
|
|
5375
|
+
"./creates/src/routes/(public)/otp/[token]/+page.server.ts": Za,
|
|
5376
|
+
"./creates/src/routes/(public)/otp/[token]/+page.svelte": Qa,
|
|
5377
|
+
"./creates/src/routes/(public)/otp/[token]/server.test.ts": tr,
|
|
5378
|
+
"./creates/src/routes/(public)/reset/+page.server.ts": er,
|
|
5379
|
+
"./creates/src/routes/(public)/reset/+page.svelte": nr,
|
|
5380
|
+
"./creates/src/routes/(public)/reset/server.test.ts": ar,
|
|
5381
|
+
"./creates/src/routes/(public)/signup/+page.server.ts": rr,
|
|
5382
|
+
"./creates/src/routes/(public)/signup/+page.svelte": or,
|
|
5383
|
+
"./creates/src/routes/(public)/signup/server.test.ts": sr
|
|
5384
|
+
}), lr = "./creates/";
|
|
5385
|
+
async function cr(t) {
|
|
5386
|
+
const e = Object.entries(ir).map(([r, s]) => {
|
|
5387
|
+
const i = M(r, lr);
|
|
5482
5388
|
return {
|
|
5483
5389
|
path: i,
|
|
5484
5390
|
language: S(i),
|
|
@@ -5569,7 +5475,7 @@ async function gr(t) {
|
|
|
5569
5475
|
]
|
|
5570
5476
|
};
|
|
5571
5477
|
}
|
|
5572
|
-
const
|
|
5478
|
+
const mr = `import {
|
|
5573
5479
|
POCKETBASE_URL,
|
|
5574
5480
|
POCKETBASE_SUPERUSER_EMAIL,
|
|
5575
5481
|
POCKETBASE_SUPERUSER_PASSWORD,
|
|
@@ -5583,7 +5489,7 @@ export const handle = handlePocketbase({
|
|
|
5583
5489
|
// [!code highlight:1]
|
|
5584
5490
|
auth: { protectedRoutes: ["/(app)"] },
|
|
5585
5491
|
});
|
|
5586
|
-
`,
|
|
5492
|
+
`, dr = `<script lang="ts">
|
|
5587
5493
|
import { toggleMode } from "mode-watcher";
|
|
5588
5494
|
import * as Navbar from "$lib/components/ui/navbar";
|
|
5589
5495
|
import { Button } from "$lib/components/ui/button";
|
|
@@ -5690,7 +5596,7 @@ export const handle = handlePocketbase({
|
|
|
5690
5596
|
@apply container mx-auto max-w-7xl px-4 py-8 w-full;
|
|
5691
5597
|
}
|
|
5692
5598
|
</style>
|
|
5693
|
-
`,
|
|
5599
|
+
`, pr = `import { loadFlash } from "sveltekit-flash-message/server";
|
|
5694
5600
|
|
|
5695
5601
|
export const load = loadFlash(async ({ locals }) => {
|
|
5696
5602
|
return {
|
|
@@ -5698,14 +5604,14 @@ export const load = loadFlash(async ({ locals }) => {
|
|
|
5698
5604
|
user: locals.pb.authStore.record,
|
|
5699
5605
|
};
|
|
5700
5606
|
});
|
|
5701
|
-
`,
|
|
5702
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
5703
|
-
"./preview-modifies/src/routes/(public)/root-layout.svelte":
|
|
5704
|
-
"./preview-modifies/src/routes/+layout.server.ts":
|
|
5705
|
-
}),
|
|
5706
|
-
async function
|
|
5707
|
-
const e = Object.entries(
|
|
5708
|
-
const r = M(n,
|
|
5607
|
+
`, ur = /* @__PURE__ */ Object.assign({
|
|
5608
|
+
"./preview-modifies/src/hooks.server.ts": mr,
|
|
5609
|
+
"./preview-modifies/src/routes/(public)/root-layout.svelte": dr,
|
|
5610
|
+
"./preview-modifies/src/routes/+layout.server.ts": pr
|
|
5611
|
+
}), fr = "./preview-modifies/";
|
|
5612
|
+
async function gr(t) {
|
|
5613
|
+
const e = Object.entries(ur).map(([n, a]) => {
|
|
5614
|
+
const r = M(n, fr);
|
|
5709
5615
|
return {
|
|
5710
5616
|
path: r,
|
|
5711
5617
|
language: S(r),
|
|
@@ -5721,24 +5627,24 @@ async function yr(t) {
|
|
|
5721
5627
|
collections: []
|
|
5722
5628
|
};
|
|
5723
5629
|
}
|
|
5724
|
-
const
|
|
5725
|
-
async function
|
|
5726
|
-
const e = await
|
|
5630
|
+
const hr = "enable-auth", br = "1.0.7", vr = "src/patterns/enable/auth", wr = "/enable/auth";
|
|
5631
|
+
async function xr(t) {
|
|
5632
|
+
const e = await cr(t);
|
|
5727
5633
|
if (t.env === "preview") {
|
|
5728
|
-
const s = await
|
|
5634
|
+
const s = await gr();
|
|
5729
5635
|
return $(I([e, s]));
|
|
5730
5636
|
}
|
|
5731
|
-
const { generate: n } = await import("./generate.runtime-
|
|
5637
|
+
const { generate: n } = await import("./generate.runtime-CnxTssBQ.js"), a = await n(t), { writeResult: r } = await import("./write-result-1Q3LB_k4.js");
|
|
5732
5638
|
return r(
|
|
5733
5639
|
await $(I([e, a])),
|
|
5734
5640
|
t
|
|
5735
5641
|
);
|
|
5736
5642
|
}
|
|
5737
|
-
const
|
|
5738
|
-
version:
|
|
5739
|
-
slug:
|
|
5740
|
-
source:
|
|
5741
|
-
docs:
|
|
5643
|
+
const yr = {
|
|
5644
|
+
version: br,
|
|
5645
|
+
slug: hr,
|
|
5646
|
+
source: vr,
|
|
5647
|
+
docs: wr,
|
|
5742
5648
|
plan: "open",
|
|
5743
5649
|
title: "Enable authentication",
|
|
5744
5650
|
summary: "Enables authentication.",
|
|
@@ -5764,9 +5670,10 @@ const kr = {
|
|
|
5764
5670
|
base: "vela enable auth",
|
|
5765
5671
|
argv: []
|
|
5766
5672
|
},
|
|
5673
|
+
tests: 18,
|
|
5767
5674
|
baseline: "velastack",
|
|
5768
|
-
generate:
|
|
5769
|
-
},
|
|
5675
|
+
generate: xr
|
|
5676
|
+
}, $r = `import { describe, expect, it } from "vitest";
|
|
5770
5677
|
|
|
5771
5678
|
describe("GET /api/health", () => {
|
|
5772
5679
|
it("should return a 200 status code", async (context) => {
|
|
@@ -5774,13 +5681,13 @@ describe("GET /api/health", () => {
|
|
|
5774
5681
|
expect(response.status).toBe(200);
|
|
5775
5682
|
});
|
|
5776
5683
|
});
|
|
5777
|
-
`,
|
|
5778
|
-
"./creates/src/routes/api/server.test.ts":
|
|
5779
|
-
}),
|
|
5780
|
-
async function
|
|
5684
|
+
`, _r = /* @__PURE__ */ Object.assign({
|
|
5685
|
+
"./creates/src/routes/api/server.test.ts": $r
|
|
5686
|
+
}), Cr = "./creates/";
|
|
5687
|
+
async function Sr(t) {
|
|
5781
5688
|
return {
|
|
5782
|
-
creates: Object.entries(
|
|
5783
|
-
const r = M(n,
|
|
5689
|
+
creates: Object.entries(_r).map(([n, a]) => {
|
|
5690
|
+
const r = M(n, Cr);
|
|
5784
5691
|
return {
|
|
5785
5692
|
path: r,
|
|
5786
5693
|
language: S(r),
|
|
@@ -5794,7 +5701,7 @@ async function Pr(t) {
|
|
|
5794
5701
|
collections: []
|
|
5795
5702
|
};
|
|
5796
5703
|
}
|
|
5797
|
-
const
|
|
5704
|
+
const Fr = `import {
|
|
5798
5705
|
POCKETBASE_URL,
|
|
5799
5706
|
POCKETBASE_SUPERUSER_EMAIL,
|
|
5800
5707
|
POCKETBASE_SUPERUSER_PASSWORD,
|
|
@@ -5808,12 +5715,12 @@ export const handle = handlePocketbase({
|
|
|
5808
5715
|
// [!code highlight:1]
|
|
5809
5716
|
api: { enabled: true },
|
|
5810
5717
|
});
|
|
5811
|
-
`,
|
|
5812
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
5813
|
-
}),
|
|
5814
|
-
async function
|
|
5815
|
-
const e = Object.entries(
|
|
5816
|
-
const r = M(n,
|
|
5718
|
+
`, kr = /* @__PURE__ */ Object.assign({
|
|
5719
|
+
"./preview-modifies/src/hooks.server.ts": Fr
|
|
5720
|
+
}), Rr = "./preview-modifies/";
|
|
5721
|
+
async function Ir(t) {
|
|
5722
|
+
const e = Object.entries(kr).map(([n, a]) => {
|
|
5723
|
+
const r = M(n, Rr);
|
|
5817
5724
|
return {
|
|
5818
5725
|
path: r,
|
|
5819
5726
|
language: S(r),
|
|
@@ -5829,24 +5736,24 @@ async function zr(t) {
|
|
|
5829
5736
|
collections: []
|
|
5830
5737
|
};
|
|
5831
5738
|
}
|
|
5832
|
-
const
|
|
5833
|
-
async function
|
|
5834
|
-
const e = await
|
|
5739
|
+
const Mr = "enable-api", Pr = "1.0.7", Tr = "src/patterns/enable/api", Er = "/enable/api";
|
|
5740
|
+
async function Dr(t) {
|
|
5741
|
+
const e = await Sr();
|
|
5835
5742
|
if (t.env === "preview") {
|
|
5836
|
-
const s = await
|
|
5743
|
+
const s = await Ir();
|
|
5837
5744
|
return $(I([e, s]));
|
|
5838
5745
|
}
|
|
5839
|
-
const { generate: n } = await import("./generate.runtime-C7g-zL0o.js"), a = await n(t), { writeResult: r } = await import("./write-result-
|
|
5746
|
+
const { generate: n } = await import("./generate.runtime-C7g-zL0o.js"), a = await n(t), { writeResult: r } = await import("./write-result-1Q3LB_k4.js");
|
|
5840
5747
|
return r(
|
|
5841
5748
|
await $(I([e, a])),
|
|
5842
5749
|
t
|
|
5843
5750
|
);
|
|
5844
5751
|
}
|
|
5845
|
-
const
|
|
5846
|
-
version:
|
|
5847
|
-
slug:
|
|
5848
|
-
source:
|
|
5849
|
-
docs:
|
|
5752
|
+
const Br = {
|
|
5753
|
+
version: Pr,
|
|
5754
|
+
slug: Mr,
|
|
5755
|
+
source: Tr,
|
|
5756
|
+
docs: Er,
|
|
5850
5757
|
plan: "open",
|
|
5851
5758
|
title: "Enable API",
|
|
5852
5759
|
summary: "Enables the PocketBase API.",
|
|
@@ -5865,19 +5772,20 @@ const jr = {
|
|
|
5865
5772
|
base: "vela enable api",
|
|
5866
5773
|
argv: []
|
|
5867
5774
|
},
|
|
5775
|
+
tests: 1,
|
|
5868
5776
|
baseline: "velastack",
|
|
5869
|
-
generate:
|
|
5870
|
-
},
|
|
5777
|
+
generate: Dr
|
|
5778
|
+
}, Ar = `import { z } from "zod";
|
|
5871
5779
|
import type { Schemas } from "pocketbase-svelte";
|
|
5872
5780
|
|
|
5873
5781
|
export const apiKeySchema = z.object({
|
|
5874
5782
|
label: z.string().optional(),
|
|
5875
5783
|
}) satisfies Schemas["api_keys"];
|
|
5876
|
-
`,
|
|
5784
|
+
`, zr = `export const load = async ({ locals }) => {
|
|
5877
5785
|
const apiKeys = await locals.pb.collection("api_keys").getFullList();
|
|
5878
5786
|
return { apiKeys };
|
|
5879
5787
|
};
|
|
5880
|
-
`,
|
|
5788
|
+
`, Lr = `<script lang="ts">
|
|
5881
5789
|
import { getFlash } from 'sveltekit-flash-message';
|
|
5882
5790
|
import { page } from '$app/state';
|
|
5883
5791
|
import * as AlertDialog from '$lib/components/ui/alert-dialog';
|
|
@@ -6015,7 +5923,7 @@ export const apiKeySchema = z.object({
|
|
|
6015
5923
|
</div>
|
|
6016
5924
|
</div>
|
|
6017
5925
|
</section>
|
|
6018
|
-
`,
|
|
5926
|
+
`, Or = `import { redirect } from "@sveltejs/kit";
|
|
6019
5927
|
|
|
6020
5928
|
export const actions = {
|
|
6021
5929
|
delete: async ({ locals, params }) => {
|
|
@@ -6023,20 +5931,20 @@ export const actions = {
|
|
|
6023
5931
|
redirect(303, "/api-keys");
|
|
6024
5932
|
},
|
|
6025
5933
|
};
|
|
6026
|
-
`,
|
|
6027
|
-
import {
|
|
5934
|
+
`, Ur = `import { fail, superValidate } from "sveltekit-superforms";
|
|
5935
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
6028
5936
|
import { redirect } from "sveltekit-flash-message/server";
|
|
6029
5937
|
import { apiKeySchema } from "$lib/schemas/apiKey";
|
|
6030
5938
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
6031
5939
|
import { createApiKey } from "./create-api-key";
|
|
6032
5940
|
|
|
6033
5941
|
export const load = async () => {
|
|
6034
|
-
return { form: await superValidate(
|
|
5942
|
+
return { form: await superValidate(zod4(apiKeySchema)) };
|
|
6035
5943
|
};
|
|
6036
5944
|
|
|
6037
5945
|
export const actions = {
|
|
6038
5946
|
default: async ({ locals, request, cookies }) => {
|
|
6039
|
-
const form = await superValidate(request,
|
|
5947
|
+
const form = await superValidate(request, zod4(apiKeySchema));
|
|
6040
5948
|
|
|
6041
5949
|
if (!form.valid) {
|
|
6042
5950
|
return fail(400, { form });
|
|
@@ -6067,10 +5975,10 @@ export const actions = {
|
|
|
6067
5975
|
);
|
|
6068
5976
|
},
|
|
6069
5977
|
};
|
|
6070
|
-
`,
|
|
5978
|
+
`, jr = `<script lang="ts">
|
|
6071
5979
|
import { untrack } from 'svelte';
|
|
6072
5980
|
import { superForm } from 'sveltekit-superforms';
|
|
6073
|
-
import {
|
|
5981
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
6074
5982
|
import { apiKeySchema } from '$lib/schemas/apiKey';
|
|
6075
5983
|
import * as Form from '$lib/components/ui/form';
|
|
6076
5984
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -6082,7 +5990,7 @@ export const actions = {
|
|
|
6082
5990
|
const form = superForm(
|
|
6083
5991
|
untrack(() => data.form),
|
|
6084
5992
|
{
|
|
6085
|
-
validators:
|
|
5993
|
+
validators: zod4Client(apiKeySchema)
|
|
6086
5994
|
}
|
|
6087
5995
|
);
|
|
6088
5996
|
|
|
@@ -6119,7 +6027,7 @@ export const actions = {
|
|
|
6119
6027
|
</form>
|
|
6120
6028
|
</div>
|
|
6121
6029
|
</section>
|
|
6122
|
-
`,
|
|
6030
|
+
`, qr = `import PocketBase from "pocketbase-svelte";
|
|
6123
6031
|
import argon2 from "argon2";
|
|
6124
6032
|
import { randomBytes } from "node:crypto";
|
|
6125
6033
|
|
|
@@ -6136,7 +6044,7 @@ export const createApiKey = async (
|
|
|
6136
6044
|
|
|
6137
6045
|
return \`\${apiKey.id}.\${keySecret}\`;
|
|
6138
6046
|
};
|
|
6139
|
-
`,
|
|
6047
|
+
`, Nr = `import { describe, it, expect, beforeEach } from "vitest";
|
|
6140
6048
|
import type { Match } from "@velastack/pocketbase";
|
|
6141
6049
|
import { createApiKey } from "./create-api-key";
|
|
6142
6050
|
import type { RouteId } from "./$types";
|
|
@@ -6202,7 +6110,7 @@ describe("api keys authenticate as a user", () => {
|
|
|
6202
6110
|
expect(response2.status).toBe(200);
|
|
6203
6111
|
});
|
|
6204
6112
|
});
|
|
6205
|
-
`,
|
|
6113
|
+
`, Vr = `import { describe, it, expect, beforeEach } from "vitest";
|
|
6206
6114
|
import type { Match } from "@velastack/pocketbase";
|
|
6207
6115
|
import type { RouteId } from "./$types";
|
|
6208
6116
|
|
|
@@ -6218,21 +6126,21 @@ describe("GET /api-keys", () => {
|
|
|
6218
6126
|
expect(response.status).toBe(200);
|
|
6219
6127
|
});
|
|
6220
6128
|
});
|
|
6221
|
-
`,
|
|
6222
|
-
"./creates/src/lib/schemas/apiKey.ts":
|
|
6223
|
-
"./creates/src/routes/(app)/api-keys/+page.server.ts":
|
|
6224
|
-
"./creates/src/routes/(app)/api-keys/+page.svelte":
|
|
6225
|
-
"./creates/src/routes/(app)/api-keys/[id]/+page.server.ts":
|
|
6226
|
-
"./creates/src/routes/(app)/api-keys/new/+page.server.ts":
|
|
6227
|
-
"./creates/src/routes/(app)/api-keys/new/+page.svelte":
|
|
6228
|
-
"./creates/src/routes/(app)/api-keys/new/create-api-key.ts":
|
|
6229
|
-
"./creates/src/routes/(app)/api-keys/new/server.test.ts":
|
|
6230
|
-
"./creates/src/routes/(app)/api-keys/server.test.ts":
|
|
6231
|
-
}),
|
|
6232
|
-
async function
|
|
6129
|
+
`, Hr = /* @__PURE__ */ Object.assign({
|
|
6130
|
+
"./creates/src/lib/schemas/apiKey.ts": Ar,
|
|
6131
|
+
"./creates/src/routes/(app)/api-keys/+page.server.ts": zr,
|
|
6132
|
+
"./creates/src/routes/(app)/api-keys/+page.svelte": Lr,
|
|
6133
|
+
"./creates/src/routes/(app)/api-keys/[id]/+page.server.ts": Or,
|
|
6134
|
+
"./creates/src/routes/(app)/api-keys/new/+page.server.ts": Ur,
|
|
6135
|
+
"./creates/src/routes/(app)/api-keys/new/+page.svelte": jr,
|
|
6136
|
+
"./creates/src/routes/(app)/api-keys/new/create-api-key.ts": qr,
|
|
6137
|
+
"./creates/src/routes/(app)/api-keys/new/server.test.ts": Nr,
|
|
6138
|
+
"./creates/src/routes/(app)/api-keys/server.test.ts": Vr
|
|
6139
|
+
}), Kr = "./creates/";
|
|
6140
|
+
async function Gr(t) {
|
|
6233
6141
|
return {
|
|
6234
|
-
creates: Object.entries(
|
|
6235
|
-
const r = M(n,
|
|
6142
|
+
creates: Object.entries(Hr).map(([n, a]) => {
|
|
6143
|
+
const r = M(n, Kr);
|
|
6236
6144
|
return {
|
|
6237
6145
|
path: r,
|
|
6238
6146
|
language: S(r),
|
|
@@ -6246,7 +6154,7 @@ async function Qr(t) {
|
|
|
6246
6154
|
collections: []
|
|
6247
6155
|
};
|
|
6248
6156
|
}
|
|
6249
|
-
const
|
|
6157
|
+
const Wr = `import {
|
|
6250
6158
|
POCKETBASE_URL,
|
|
6251
6159
|
POCKETBASE_SUPERUSER_EMAIL,
|
|
6252
6160
|
POCKETBASE_SUPERUSER_PASSWORD,
|
|
@@ -6263,12 +6171,12 @@ export const handle = handlePocketbase({
|
|
|
6263
6171
|
apiKeys: { enabled: true },
|
|
6264
6172
|
},
|
|
6265
6173
|
});
|
|
6266
|
-
`,
|
|
6267
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
6268
|
-
}),
|
|
6269
|
-
async function
|
|
6270
|
-
const e = Object.entries(
|
|
6271
|
-
const r = M(n,
|
|
6174
|
+
`, Xr = /* @__PURE__ */ Object.assign({
|
|
6175
|
+
"./preview-modifies/src/hooks.server.ts": Wr
|
|
6176
|
+
}), Jr = "./preview-modifies/";
|
|
6177
|
+
async function Yr(t) {
|
|
6178
|
+
const e = Object.entries(Xr).map(([n, a]) => {
|
|
6179
|
+
const r = M(n, Jr);
|
|
6272
6180
|
return {
|
|
6273
6181
|
path: r,
|
|
6274
6182
|
language: S(r),
|
|
@@ -6284,24 +6192,24 @@ async function ao(t) {
|
|
|
6284
6192
|
collections: []
|
|
6285
6193
|
};
|
|
6286
6194
|
}
|
|
6287
|
-
const
|
|
6288
|
-
async function
|
|
6289
|
-
const e = await
|
|
6195
|
+
const Zr = "enable-api-keys", Qr = "1.0.0", to = "src/patterns/enable/api-keys", eo = "/enable/api-keys";
|
|
6196
|
+
async function no(t) {
|
|
6197
|
+
const e = await Gr();
|
|
6290
6198
|
if (t.env === "preview") {
|
|
6291
|
-
const s = await
|
|
6199
|
+
const s = await Yr();
|
|
6292
6200
|
return $(I([e, s]));
|
|
6293
6201
|
}
|
|
6294
|
-
const { generate: n } = await import("./generate.runtime-
|
|
6202
|
+
const { generate: n } = await import("./generate.runtime-D5bvTbSL.js"), a = await n(t), { writeResult: r } = await import("./write-result-1Q3LB_k4.js");
|
|
6295
6203
|
return r(
|
|
6296
6204
|
await $(I([e, a])),
|
|
6297
6205
|
t
|
|
6298
6206
|
);
|
|
6299
6207
|
}
|
|
6300
|
-
const
|
|
6301
|
-
version:
|
|
6302
|
-
slug:
|
|
6303
|
-
source:
|
|
6304
|
-
docs:
|
|
6208
|
+
const ao = {
|
|
6209
|
+
version: Qr,
|
|
6210
|
+
slug: Zr,
|
|
6211
|
+
source: to,
|
|
6212
|
+
docs: eo,
|
|
6305
6213
|
plan: "open",
|
|
6306
6214
|
title: "Enable API keys",
|
|
6307
6215
|
summary: "Adds API key management for authenticated users and PocketBase API access.",
|
|
@@ -6327,9 +6235,10 @@ const co = {
|
|
|
6327
6235
|
base: "vela enable api-keys",
|
|
6328
6236
|
argv: []
|
|
6329
6237
|
},
|
|
6238
|
+
tests: 6,
|
|
6330
6239
|
baseline: "velastack",
|
|
6331
|
-
generate:
|
|
6332
|
-
},
|
|
6240
|
+
generate: no
|
|
6241
|
+
}, ro = `import { deLocalizeDefault } from "wuchale/url";
|
|
6333
6242
|
import { matchUrl } from "$locales/main.url";
|
|
6334
6243
|
import { locales } from "$locales/data";
|
|
6335
6244
|
|
|
@@ -6338,7 +6247,7 @@ export const reroute = ({ url }) => {
|
|
|
6338
6247
|
const { path } = matchUrl(upath, locale);
|
|
6339
6248
|
return path ?? url.pathname;
|
|
6340
6249
|
};
|
|
6341
|
-
`,
|
|
6250
|
+
`, oo = `import { deLocalizeDefault, fillParams } from "wuchale/url";
|
|
6342
6251
|
import type { Locale } from "../locales/data";
|
|
6343
6252
|
import { matchUrl } from "../locales/main.url";
|
|
6344
6253
|
import { locales } from "../locales/data";
|
|
@@ -6366,7 +6275,7 @@ export function translateUrl(
|
|
|
6366
6275
|
}
|
|
6367
6276
|
return localize(url, toLocale);
|
|
6368
6277
|
}
|
|
6369
|
-
`,
|
|
6278
|
+
`, so = `// @ts-check
|
|
6370
6279
|
import { adapter as svelte } from "@wuchale/svelte";
|
|
6371
6280
|
import { adapter as js } from "wuchale/adapter-vanilla";
|
|
6372
6281
|
import { defineConfig } from "wuchale";
|
|
@@ -6387,15 +6296,15 @@ export default defineConfig({
|
|
|
6387
6296
|
}),
|
|
6388
6297
|
},
|
|
6389
6298
|
});
|
|
6390
|
-
`,
|
|
6391
|
-
"./creates/src/hooks.ts":
|
|
6392
|
-
"./creates/src/lib/url.ts":
|
|
6393
|
-
"./creates/wuchale.config.js":
|
|
6394
|
-
}),
|
|
6395
|
-
async function
|
|
6299
|
+
`, io = /* @__PURE__ */ Object.assign({
|
|
6300
|
+
"./creates/src/hooks.ts": ro,
|
|
6301
|
+
"./creates/src/lib/url.ts": oo,
|
|
6302
|
+
"./creates/wuchale.config.js": so
|
|
6303
|
+
}), lo = "./creates/";
|
|
6304
|
+
async function co(t) {
|
|
6396
6305
|
return {
|
|
6397
|
-
creates: Object.entries(
|
|
6398
|
-
const r = M(n,
|
|
6306
|
+
creates: Object.entries(io).map(([n, a]) => {
|
|
6307
|
+
const r = M(n, lo);
|
|
6399
6308
|
return {
|
|
6400
6309
|
path: r,
|
|
6401
6310
|
language: S(r),
|
|
@@ -6409,7 +6318,7 @@ async function ho(t) {
|
|
|
6409
6318
|
collections: []
|
|
6410
6319
|
};
|
|
6411
6320
|
}
|
|
6412
|
-
const
|
|
6321
|
+
const mo = `<!doctype html>
|
|
6413
6322
|
<!-- [!code highlight:1] -->
|
|
6414
6323
|
<html lang="%sveltekit.lang%">
|
|
6415
6324
|
<head>
|
|
@@ -6420,7 +6329,7 @@ const bo = `<!doctype html>
|
|
|
6420
6329
|
<div style="display: contents">%sveltekit.body%</div>
|
|
6421
6330
|
</body>
|
|
6422
6331
|
</html>
|
|
6423
|
-
`,
|
|
6332
|
+
`, po = `import { env } from "$env/dynamic/private";
|
|
6424
6333
|
import { handlePocketbase } from "@velastack/pocketbase";
|
|
6425
6334
|
// [!code highlight:6]
|
|
6426
6335
|
import { sequence } from "@sveltejs/kit/hooks";
|
|
@@ -6454,7 +6363,7 @@ export const handle = sequence(
|
|
|
6454
6363
|
superuserPassword: env.POCKETBASE_SUPERUSER_PASSWORD,
|
|
6455
6364
|
}),
|
|
6456
6365
|
);
|
|
6457
|
-
`,
|
|
6366
|
+
`, uo = `import { browser } from "$app/environment";
|
|
6458
6367
|
// [!code highlight:4]
|
|
6459
6368
|
import { loadLocale } from "wuchale/load-utils";
|
|
6460
6369
|
import { getLocale } from "$locales/main.url";
|
|
@@ -6471,7 +6380,7 @@ export const load = async ({ url, data }) => {
|
|
|
6471
6380
|
|
|
6472
6381
|
return data;
|
|
6473
6382
|
};
|
|
6474
|
-
`,
|
|
6383
|
+
`, fo = `import adapter from "@sveltejs/adapter-auto";
|
|
6475
6384
|
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
|
6476
6385
|
|
|
6477
6386
|
const config = {
|
|
@@ -6486,7 +6395,7 @@ const config = {
|
|
|
6486
6395
|
};
|
|
6487
6396
|
|
|
6488
6397
|
export default config;
|
|
6489
|
-
`,
|
|
6398
|
+
`, go = `import { defineConfig } from "vite";
|
|
6490
6399
|
import { sveltekit } from "@sveltejs/kit/vite";
|
|
6491
6400
|
import tailwindcss from "@tailwindcss/vite";
|
|
6492
6401
|
// [!code highlight:1]
|
|
@@ -6496,16 +6405,16 @@ export default defineConfig({
|
|
|
6496
6405
|
// [!code highlight:1]
|
|
6497
6406
|
plugins: [wuchale(), tailwindcss(), sveltekit()],
|
|
6498
6407
|
});
|
|
6499
|
-
`,
|
|
6500
|
-
"./preview-modifies/src/app.html":
|
|
6501
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
6502
|
-
"./preview-modifies/src/routes/+layout.ts":
|
|
6503
|
-
"./preview-modifies/svelte.config.js":
|
|
6504
|
-
"./preview-modifies/vite.config.ts":
|
|
6505
|
-
}),
|
|
6506
|
-
async function
|
|
6507
|
-
const e = Object.entries(
|
|
6508
|
-
const r = M(n,
|
|
6408
|
+
`, ho = /* @__PURE__ */ Object.assign({
|
|
6409
|
+
"./preview-modifies/src/app.html": mo,
|
|
6410
|
+
"./preview-modifies/src/hooks.server.ts": po,
|
|
6411
|
+
"./preview-modifies/src/routes/+layout.ts": uo,
|
|
6412
|
+
"./preview-modifies/svelte.config.js": fo,
|
|
6413
|
+
"./preview-modifies/vite.config.ts": go
|
|
6414
|
+
}), bo = "./preview-modifies/";
|
|
6415
|
+
async function vo(t) {
|
|
6416
|
+
const e = Object.entries(ho).map(([n, a]) => {
|
|
6417
|
+
const r = M(n, bo);
|
|
6509
6418
|
return {
|
|
6510
6419
|
path: r,
|
|
6511
6420
|
language: S(r),
|
|
@@ -6521,24 +6430,24 @@ async function Co(t) {
|
|
|
6521
6430
|
collections: []
|
|
6522
6431
|
};
|
|
6523
6432
|
}
|
|
6524
|
-
const
|
|
6525
|
-
async function
|
|
6526
|
-
const e = await
|
|
6433
|
+
const wo = "enable-i18n", xo = "1.0.0", yo = "src/patterns/enable/i18n", $o = "/enable/i18n";
|
|
6434
|
+
async function _o(t) {
|
|
6435
|
+
const e = await co();
|
|
6527
6436
|
if (t.env === "preview") {
|
|
6528
|
-
const s = await
|
|
6437
|
+
const s = await vo();
|
|
6529
6438
|
return $(I([e, s]));
|
|
6530
6439
|
}
|
|
6531
|
-
const { generate: n } = await import("./generate.runtime-
|
|
6440
|
+
const { generate: n } = await import("./generate.runtime-Tk3iuGQE.js"), a = await n(t), { writeResult: r } = await import("./write-result-1Q3LB_k4.js");
|
|
6532
6441
|
return r(
|
|
6533
6442
|
await $(I([e, a])),
|
|
6534
6443
|
t
|
|
6535
6444
|
);
|
|
6536
6445
|
}
|
|
6537
|
-
const
|
|
6538
|
-
version:
|
|
6539
|
-
slug:
|
|
6540
|
-
source:
|
|
6541
|
-
docs:
|
|
6446
|
+
const Co = {
|
|
6447
|
+
version: xo,
|
|
6448
|
+
slug: wo,
|
|
6449
|
+
source: yo,
|
|
6450
|
+
docs: $o,
|
|
6542
6451
|
plan: "open",
|
|
6543
6452
|
title: "Enable i18n",
|
|
6544
6453
|
summary: "Enables i18n with Wuchale and locale-aware routing.",
|
|
@@ -6557,9 +6466,10 @@ const Mo = {
|
|
|
6557
6466
|
base: "vela enable i18n",
|
|
6558
6467
|
argv: []
|
|
6559
6468
|
},
|
|
6469
|
+
tests: 0,
|
|
6560
6470
|
baseline: "velastack",
|
|
6561
|
-
generate:
|
|
6562
|
-
},
|
|
6471
|
+
generate: _o
|
|
6472
|
+
}, So = `<script lang="ts">
|
|
6563
6473
|
import type { Snippet } from 'svelte';
|
|
6564
6474
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
6565
6475
|
import * as Sidebar from '$lib/components/ui/sidebar/index.js';
|
|
@@ -6620,22 +6530,22 @@ const Mo = {
|
|
|
6620
6530
|
</DropdownMenu.Root>
|
|
6621
6531
|
</Sidebar.MenuItem>
|
|
6622
6532
|
</Sidebar.Menu>
|
|
6623
|
-
`,
|
|
6533
|
+
`, Fo = `import { z } from "zod";
|
|
6624
6534
|
|
|
6625
6535
|
export const teamSchema = z.object({
|
|
6626
6536
|
name: z.string(),
|
|
6627
6537
|
});
|
|
6628
|
-
`,
|
|
6538
|
+
`, ko = `import { z } from "zod";
|
|
6629
6539
|
|
|
6630
6540
|
export const teamInviteSchema = z.object({
|
|
6631
|
-
email: z.
|
|
6541
|
+
email: z.email(),
|
|
6632
6542
|
});
|
|
6633
|
-
`,
|
|
6543
|
+
`, Ro = `import { z } from "zod";
|
|
6634
6544
|
|
|
6635
6545
|
export const teamRoleSchema = z.object({
|
|
6636
6546
|
role: z.enum(["owner", "admin", "member"]),
|
|
6637
6547
|
});
|
|
6638
|
-
`,
|
|
6548
|
+
`, Io = `<script lang="ts">
|
|
6639
6549
|
import RootLayout from '../../../(public)/root-layout.svelte';
|
|
6640
6550
|
|
|
6641
6551
|
let { data, children } = $props();
|
|
@@ -6644,7 +6554,7 @@ export const teamRoleSchema = z.object({
|
|
|
6644
6554
|
<RootLayout {data}>
|
|
6645
6555
|
{@render children?.()}
|
|
6646
6556
|
</RootLayout>
|
|
6647
|
-
`,
|
|
6557
|
+
`, Mo = `import { error } from "@sveltejs/kit";
|
|
6648
6558
|
import { redirect } from "sveltekit-flash-message/server";
|
|
6649
6559
|
|
|
6650
6560
|
export const load = async ({ params, locals }) => {
|
|
@@ -6687,7 +6597,7 @@ export const actions = {
|
|
|
6687
6597
|
);
|
|
6688
6598
|
},
|
|
6689
6599
|
};
|
|
6690
|
-
`,
|
|
6600
|
+
`, Po = `<script lang="ts">
|
|
6691
6601
|
import { Button } from '$lib/components/ui/button';
|
|
6692
6602
|
import * as Card from '$lib/components/ui/card';
|
|
6693
6603
|
|
|
@@ -6726,7 +6636,7 @@ export const actions = {
|
|
|
6726
6636
|
</div>
|
|
6727
6637
|
</div>
|
|
6728
6638
|
</div>
|
|
6729
|
-
`,
|
|
6639
|
+
`, To = `<script lang="ts">
|
|
6730
6640
|
import RootLayout from '../../../(public)/root-layout.svelte';
|
|
6731
6641
|
|
|
6732
6642
|
let { data, children } = $props();
|
|
@@ -6735,7 +6645,7 @@ export const actions = {
|
|
|
6735
6645
|
<RootLayout {data}>
|
|
6736
6646
|
{@render children?.()}
|
|
6737
6647
|
</RootLayout>
|
|
6738
|
-
`,
|
|
6648
|
+
`, Eo = `import { error } from "@sveltejs/kit";
|
|
6739
6649
|
import { redirect } from "sveltekit-flash-message/server";
|
|
6740
6650
|
|
|
6741
6651
|
export const load = async ({ params, locals }) => {
|
|
@@ -6780,7 +6690,7 @@ export const actions = {
|
|
|
6780
6690
|
);
|
|
6781
6691
|
},
|
|
6782
6692
|
};
|
|
6783
|
-
`,
|
|
6693
|
+
`, Do = `<script lang="ts">
|
|
6784
6694
|
import { Button } from '$lib/components/ui/button';
|
|
6785
6695
|
import * as Card from '$lib/components/ui/card';
|
|
6786
6696
|
|
|
@@ -6819,7 +6729,7 @@ export const actions = {
|
|
|
6819
6729
|
</div>
|
|
6820
6730
|
</div>
|
|
6821
6731
|
</div>
|
|
6822
|
-
`,
|
|
6732
|
+
`, Bo = `export const load = async ({ locals, parent }) => {
|
|
6823
6733
|
const { user, breadcrumbs } = await parent();
|
|
6824
6734
|
|
|
6825
6735
|
const ownedTeams = await locals.pb.collection("teams").getFullList({
|
|
@@ -6871,7 +6781,7 @@ export const actions = {
|
|
|
6871
6781
|
breadcrumbs: [...breadcrumbs, { title: "Teams", url: "/teams" }],
|
|
6872
6782
|
};
|
|
6873
6783
|
};
|
|
6874
|
-
`,
|
|
6784
|
+
`, Ao = `<script lang="ts">
|
|
6875
6785
|
import * as Card from '$lib/components/ui/card';
|
|
6876
6786
|
import { Button } from '$lib/components/ui/button';
|
|
6877
6787
|
import UserIcon from '@lucide/svelte/icons/user';
|
|
@@ -6992,7 +6902,7 @@ export const actions = {
|
|
|
6992
6902
|
</section>
|
|
6993
6903
|
|
|
6994
6904
|
{@render children?.()}
|
|
6995
|
-
`,
|
|
6905
|
+
`, zo = `import { error, fail } from "@sveltejs/kit";
|
|
6996
6906
|
import { redirect } from "sveltekit-flash-message/server";
|
|
6997
6907
|
|
|
6998
6908
|
export const actions = {
|
|
@@ -7052,9 +6962,9 @@ export const actions = {
|
|
|
7052
6962
|
redirect(303, \`/teams\`, { type: "toast", message: "Left team" }, cookies);
|
|
7053
6963
|
},
|
|
7054
6964
|
};
|
|
7055
|
-
`,
|
|
6965
|
+
`, Lo = "", Oo = `import { redirect } from "@sveltejs/kit";
|
|
7056
6966
|
import { superValidate } from "sveltekit-superforms";
|
|
7057
|
-
import {
|
|
6967
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
7058
6968
|
import { teamSchema } from "$lib/schemas/team";
|
|
7059
6969
|
|
|
7060
6970
|
export const load = async ({ params, locals, parent }) => {
|
|
@@ -7099,7 +7009,7 @@ export const load = async ({ params, locals, parent }) => {
|
|
|
7099
7009
|
filter: locals.pb.filter("team = {:team}", { team: id }),
|
|
7100
7010
|
});
|
|
7101
7011
|
|
|
7102
|
-
const form = await superValidate(team,
|
|
7012
|
+
const form = await superValidate(team, zod4(teamSchema));
|
|
7103
7013
|
|
|
7104
7014
|
return {
|
|
7105
7015
|
team,
|
|
@@ -7115,7 +7025,7 @@ export const load = async ({ params, locals, parent }) => {
|
|
|
7115
7025
|
],
|
|
7116
7026
|
};
|
|
7117
7027
|
};
|
|
7118
|
-
`,
|
|
7028
|
+
`, Uo = `<script lang="ts">
|
|
7119
7029
|
import { untrack } from 'svelte';
|
|
7120
7030
|
import * as Card from '$lib/components/ui/card';
|
|
7121
7031
|
import { Button, buttonVariants } from '$lib/components/ui/button';
|
|
@@ -7136,7 +7046,7 @@ export const load = async ({ params, locals, parent }) => {
|
|
|
7136
7046
|
import TrashIcon from '@lucide/svelte/icons/trash-2';
|
|
7137
7047
|
import { Input } from '$lib/components/ui/input';
|
|
7138
7048
|
import { superForm } from 'sveltekit-superforms';
|
|
7139
|
-
import {
|
|
7049
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
7140
7050
|
import { teamSchema } from '$lib/schemas/team';
|
|
7141
7051
|
|
|
7142
7052
|
let { data, children } = $props();
|
|
@@ -7144,7 +7054,7 @@ export const load = async ({ params, locals, parent }) => {
|
|
|
7144
7054
|
const form = superForm(
|
|
7145
7055
|
untrack(() => data.form),
|
|
7146
7056
|
{
|
|
7147
|
-
validators:
|
|
7057
|
+
validators: zod4Client(teamSchema),
|
|
7148
7058
|
warnings: {
|
|
7149
7059
|
duplicateId: false
|
|
7150
7060
|
}
|
|
@@ -7506,16 +7416,16 @@ export const load = async ({ params, locals, parent }) => {
|
|
|
7506
7416
|
</section>
|
|
7507
7417
|
|
|
7508
7418
|
{@render children?.()}
|
|
7509
|
-
`,
|
|
7419
|
+
`, jo = `import { error, fail } from "@sveltejs/kit";
|
|
7510
7420
|
import { redirect } from "sveltekit-flash-message/server";
|
|
7511
|
-
import {
|
|
7421
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
7512
7422
|
import { superValidate } from "sveltekit-superforms";
|
|
7513
7423
|
import { teamSchema } from "$lib/schemas/team";
|
|
7514
7424
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
7515
7425
|
|
|
7516
7426
|
export const actions = {
|
|
7517
7427
|
updateTeam: async ({ locals, params, request, cookies }) => {
|
|
7518
|
-
const form = await superValidate(request,
|
|
7428
|
+
const form = await superValidate(request, zod4(teamSchema));
|
|
7519
7429
|
|
|
7520
7430
|
if (!form.valid) {
|
|
7521
7431
|
return fail(400, { form });
|
|
@@ -7600,7 +7510,7 @@ export const actions = {
|
|
|
7600
7510
|
);
|
|
7601
7511
|
},
|
|
7602
7512
|
};
|
|
7603
|
-
`,
|
|
7513
|
+
`, qo = "", No = `type Role = "owner" | "admin" | "member";
|
|
7604
7514
|
|
|
7605
7515
|
interface User {
|
|
7606
7516
|
id: string;
|
|
@@ -7653,20 +7563,20 @@ export const getAuthorization = ({
|
|
|
7653
7563
|
canChangeRole: false,
|
|
7654
7564
|
};
|
|
7655
7565
|
};
|
|
7656
|
-
`,
|
|
7657
|
-
import {
|
|
7566
|
+
`, Vo = `import { fail, superValidate } from "sveltekit-superforms";
|
|
7567
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
7658
7568
|
import { teamInviteSchema } from "$lib/schemas/teamInvite";
|
|
7659
7569
|
import { redirect } from "sveltekit-flash-message/server";
|
|
7660
7570
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
7661
7571
|
|
|
7662
7572
|
export const load = async () => {
|
|
7663
|
-
const form = await superValidate(
|
|
7573
|
+
const form = await superValidate(zod4(teamInviteSchema));
|
|
7664
7574
|
return { form };
|
|
7665
7575
|
};
|
|
7666
7576
|
|
|
7667
7577
|
export const actions = {
|
|
7668
7578
|
default: async ({ locals, params, request, cookies }) => {
|
|
7669
|
-
const form = await superValidate(request,
|
|
7579
|
+
const form = await superValidate(request, zod4(teamInviteSchema));
|
|
7670
7580
|
|
|
7671
7581
|
if (!form.valid) {
|
|
7672
7582
|
return fail(400, { form });
|
|
@@ -7692,13 +7602,13 @@ export const actions = {
|
|
|
7692
7602
|
);
|
|
7693
7603
|
},
|
|
7694
7604
|
};
|
|
7695
|
-
`,
|
|
7605
|
+
`, Ho = `<script lang="ts">
|
|
7696
7606
|
import { untrack } from 'svelte';
|
|
7697
7607
|
import * as Dialog from '$lib/components/ui/dialog';
|
|
7698
7608
|
import { Input } from '$lib/components/ui/input';
|
|
7699
7609
|
import { goto } from '$app/navigation';
|
|
7700
7610
|
import { superForm } from 'sveltekit-superforms';
|
|
7701
|
-
import {
|
|
7611
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
7702
7612
|
import { teamInviteSchema } from '$lib/schemas/teamInvite';
|
|
7703
7613
|
import * as Form from '$lib/components/ui/form';
|
|
7704
7614
|
|
|
@@ -7707,7 +7617,7 @@ export const actions = {
|
|
|
7707
7617
|
const form = superForm(
|
|
7708
7618
|
untrack(() => data.form),
|
|
7709
7619
|
{
|
|
7710
|
-
validators:
|
|
7620
|
+
validators: zod4Client(teamInviteSchema)
|
|
7711
7621
|
}
|
|
7712
7622
|
);
|
|
7713
7623
|
|
|
@@ -7741,7 +7651,7 @@ export const actions = {
|
|
|
7741
7651
|
</form>
|
|
7742
7652
|
</Dialog.Content>
|
|
7743
7653
|
</Dialog.Root>
|
|
7744
|
-
`,
|
|
7654
|
+
`, Ko = `import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
7745
7655
|
import type { Match } from "@velastack/pocketbase";
|
|
7746
7656
|
import * as devalue from "devalue";
|
|
7747
7657
|
import type { RouteId } from "./$types";
|
|
@@ -7917,8 +7827,8 @@ describe("POST /teams/[id]/invite", () => {
|
|
|
7917
7827
|
expect(data.form.valid).toBe(false);
|
|
7918
7828
|
});
|
|
7919
7829
|
});
|
|
7920
|
-
`,
|
|
7921
|
-
import {
|
|
7830
|
+
`, Go = `import { fail, superValidate } from "sveltekit-superforms";
|
|
7831
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
7922
7832
|
import { teamRoleSchema } from "$lib/schemas/teamRole";
|
|
7923
7833
|
import { redirect } from "sveltekit-flash-message/server";
|
|
7924
7834
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
@@ -7927,14 +7837,14 @@ export const load = async ({ locals, params }) => {
|
|
|
7927
7837
|
const member = await locals.pb
|
|
7928
7838
|
.collection("team_memberships")
|
|
7929
7839
|
.getOne(params.member_id);
|
|
7930
|
-
const form = await superValidate(member,
|
|
7840
|
+
const form = await superValidate(member, zod4(teamRoleSchema));
|
|
7931
7841
|
|
|
7932
7842
|
return { form };
|
|
7933
7843
|
};
|
|
7934
7844
|
|
|
7935
7845
|
export const actions = {
|
|
7936
7846
|
default: async ({ locals, params, request, cookies }) => {
|
|
7937
|
-
const form = await superValidate(request,
|
|
7847
|
+
const form = await superValidate(request, zod4(teamRoleSchema));
|
|
7938
7848
|
|
|
7939
7849
|
if (!form.valid) {
|
|
7940
7850
|
return fail(400, { form });
|
|
@@ -7956,12 +7866,12 @@ export const actions = {
|
|
|
7956
7866
|
);
|
|
7957
7867
|
},
|
|
7958
7868
|
};
|
|
7959
|
-
`,
|
|
7869
|
+
`, Wo = `<script lang="ts">
|
|
7960
7870
|
import { untrack } from 'svelte';
|
|
7961
7871
|
import * as Dialog from '$lib/components/ui/dialog';
|
|
7962
7872
|
import { goto } from '$app/navigation';
|
|
7963
7873
|
import { superForm } from 'sveltekit-superforms';
|
|
7964
|
-
import {
|
|
7874
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
7965
7875
|
import { teamRoleSchema } from '$lib/schemas/teamRole';
|
|
7966
7876
|
import * as Form from '$lib/components/ui/form';
|
|
7967
7877
|
import * as Select from '$lib/components/ui/select';
|
|
@@ -7986,7 +7896,7 @@ export const actions = {
|
|
|
7986
7896
|
const form = superForm(
|
|
7987
7897
|
untrack(() => data.form),
|
|
7988
7898
|
{
|
|
7989
|
-
validators:
|
|
7899
|
+
validators: zod4Client(teamRoleSchema)
|
|
7990
7900
|
}
|
|
7991
7901
|
);
|
|
7992
7902
|
|
|
@@ -8029,7 +7939,7 @@ export const actions = {
|
|
|
8029
7939
|
</form>
|
|
8030
7940
|
</Dialog.Content>
|
|
8031
7941
|
</Dialog.Root>
|
|
8032
|
-
`,
|
|
7942
|
+
`, Xo = `import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
8033
7943
|
import type { Match } from "@velastack/pocketbase";
|
|
8034
7944
|
import * as devalue from "devalue";
|
|
8035
7945
|
import type { RouteId } from "./$types";
|
|
@@ -8208,7 +8118,7 @@ describe("POST /teams/[id]/member/[member_id]", () => {
|
|
|
8208
8118
|
expect(data.form.valid).toBe(false);
|
|
8209
8119
|
});
|
|
8210
8120
|
});
|
|
8211
|
-
`,
|
|
8121
|
+
`, Jo = `import {
|
|
8212
8122
|
describe,
|
|
8213
8123
|
it,
|
|
8214
8124
|
expect,
|
|
@@ -8629,21 +8539,21 @@ describe("POST /teams/[id]?/deleteTeam", () => {
|
|
|
8629
8539
|
context.admin.collection("users").delete(memberUser.id);
|
|
8630
8540
|
});
|
|
8631
8541
|
});
|
|
8632
|
-
`,
|
|
8633
|
-
import {
|
|
8542
|
+
`, Yo = `import { fail, superValidate } from "sveltekit-superforms";
|
|
8543
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
8634
8544
|
import { teamSchema } from "$lib/schemas/team";
|
|
8635
8545
|
import { redirect } from "sveltekit-flash-message/server";
|
|
8636
8546
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
8637
8547
|
|
|
8638
8548
|
export const load = async () => {
|
|
8639
|
-
const form = await superValidate(
|
|
8549
|
+
const form = await superValidate(zod4(teamSchema));
|
|
8640
8550
|
return { form };
|
|
8641
8551
|
};
|
|
8642
8552
|
|
|
8643
8553
|
export const actions = {
|
|
8644
8554
|
default: async ({ locals, request, cookies }) => {
|
|
8645
8555
|
const user = locals.pb.authStore.record!;
|
|
8646
|
-
const form = await superValidate(request,
|
|
8556
|
+
const form = await superValidate(request, zod4(teamSchema));
|
|
8647
8557
|
|
|
8648
8558
|
if (!form.valid) {
|
|
8649
8559
|
return fail(400, { form });
|
|
@@ -8675,13 +8585,13 @@ export const actions = {
|
|
|
8675
8585
|
redirect("/teams", { type: "toast", message: "Team created" }, cookies);
|
|
8676
8586
|
},
|
|
8677
8587
|
};
|
|
8678
|
-
`,
|
|
8588
|
+
`, Zo = `<script lang="ts">
|
|
8679
8589
|
import { untrack } from 'svelte';
|
|
8680
8590
|
import * as Dialog from '$lib/components/ui/dialog';
|
|
8681
8591
|
import { Input } from '$lib/components/ui/input';
|
|
8682
8592
|
import { goto } from '$app/navigation';
|
|
8683
8593
|
import { superForm } from 'sveltekit-superforms';
|
|
8684
|
-
import {
|
|
8594
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
8685
8595
|
import { teamSchema } from '$lib/schemas/team';
|
|
8686
8596
|
import * as Form from '$lib/components/ui/form';
|
|
8687
8597
|
|
|
@@ -8690,7 +8600,7 @@ export const actions = {
|
|
|
8690
8600
|
const form = superForm(
|
|
8691
8601
|
untrack(() => data.form),
|
|
8692
8602
|
{
|
|
8693
|
-
validators:
|
|
8603
|
+
validators: zod4Client(teamSchema)
|
|
8694
8604
|
}
|
|
8695
8605
|
);
|
|
8696
8606
|
|
|
@@ -8724,7 +8634,7 @@ export const actions = {
|
|
|
8724
8634
|
</form>
|
|
8725
8635
|
</Dialog.Content>
|
|
8726
8636
|
</Dialog.Root>
|
|
8727
|
-
`,
|
|
8637
|
+
`, Qo = `import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
8728
8638
|
import type { Match } from "@velastack/pocketbase";
|
|
8729
8639
|
import * as devalue from "devalue";
|
|
8730
8640
|
import type { RouteId } from "./$types";
|
|
@@ -8802,7 +8712,7 @@ describe("POST /teams/new", () => {
|
|
|
8802
8712
|
expect(data.form.valid).toBe(false);
|
|
8803
8713
|
});
|
|
8804
8714
|
});
|
|
8805
|
-
`,
|
|
8715
|
+
`, ts = `import { describe, it, expect } from "vitest";
|
|
8806
8716
|
import type { Match } from "@velastack/pocketbase";
|
|
8807
8717
|
import type { RouteId } from "./$types";
|
|
8808
8718
|
|
|
@@ -8813,7 +8723,7 @@ describe("GET /teams", () => {
|
|
|
8813
8723
|
expect(response.status).toBe(200);
|
|
8814
8724
|
});
|
|
8815
8725
|
});
|
|
8816
|
-
`,
|
|
8726
|
+
`, es = `import { error, redirect } from "@sveltejs/kit";
|
|
8817
8727
|
import { dev } from "$app/environment";
|
|
8818
8728
|
|
|
8819
8729
|
export const load = async ({ params, cookies, url, locals }) => {
|
|
@@ -8836,7 +8746,7 @@ export const load = async ({ params, cookies, url, locals }) => {
|
|
|
8836
8746
|
|
|
8837
8747
|
return redirect(303, redirectUrl);
|
|
8838
8748
|
};
|
|
8839
|
-
`,
|
|
8749
|
+
`, ns = `import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
8840
8750
|
import type { Match } from "@velastack/pocketbase";
|
|
8841
8751
|
import type { RouteId } from "./$types";
|
|
8842
8752
|
|
|
@@ -8921,44 +8831,44 @@ describe("GET /teams/switch/[id]", () => {
|
|
|
8921
8831
|
expect(cookies).toBeUndefined();
|
|
8922
8832
|
});
|
|
8923
8833
|
});
|
|
8924
|
-
`,
|
|
8925
|
-
"./creates/src/lib/components/team-switcher.svelte":
|
|
8926
|
-
"./creates/src/lib/schemas/team.ts":
|
|
8927
|
-
"./creates/src/lib/schemas/teamInvite.ts":
|
|
8928
|
-
"./creates/src/lib/schemas/teamRole.ts":
|
|
8929
|
-
"./creates/src/routes/(app)/invite/[id]/+layout@.svelte":
|
|
8930
|
-
"./creates/src/routes/(app)/invite/[id]/+page.server.ts":
|
|
8931
|
-
"./creates/src/routes/(app)/invite/[id]/+page.svelte":
|
|
8932
|
-
"./creates/src/routes/(app)/join/[id]/+layout@.svelte":
|
|
8933
|
-
"./creates/src/routes/(app)/join/[id]/+page.server.ts":
|
|
8934
|
-
"./creates/src/routes/(app)/join/[id]/+page.svelte":
|
|
8935
|
-
"./creates/src/routes/(app)/teams/+layout.server.ts":
|
|
8936
|
-
"./creates/src/routes/(app)/teams/+layout.svelte":
|
|
8937
|
-
"./creates/src/routes/(app)/teams/+page.server.ts":
|
|
8938
|
-
"./creates/src/routes/(app)/teams/+page.svelte":
|
|
8939
|
-
"./creates/src/routes/(app)/teams/[id]/+layout.server.ts":
|
|
8940
|
-
"./creates/src/routes/(app)/teams/[id]/+layout@(app).svelte":
|
|
8941
|
-
"./creates/src/routes/(app)/teams/[id]/+page.server.ts":
|
|
8942
|
-
"./creates/src/routes/(app)/teams/[id]/+page.svelte":
|
|
8943
|
-
"./creates/src/routes/(app)/teams/[id]/authorization.ts":
|
|
8944
|
-
"./creates/src/routes/(app)/teams/[id]/invite/+page.server.ts":
|
|
8945
|
-
"./creates/src/routes/(app)/teams/[id]/invite/+page.svelte":
|
|
8946
|
-
"./creates/src/routes/(app)/teams/[id]/invite/server.test.ts":
|
|
8947
|
-
"./creates/src/routes/(app)/teams/[id]/member/[member_id]/+page.server.ts":
|
|
8948
|
-
"./creates/src/routes/(app)/teams/[id]/member/[member_id]/+page.svelte":
|
|
8949
|
-
"./creates/src/routes/(app)/teams/[id]/member/[member_id]/server.test.ts":
|
|
8950
|
-
"./creates/src/routes/(app)/teams/[id]/server.test.ts":
|
|
8951
|
-
"./creates/src/routes/(app)/teams/new/+page.server.ts":
|
|
8952
|
-
"./creates/src/routes/(app)/teams/new/+page.svelte":
|
|
8953
|
-
"./creates/src/routes/(app)/teams/new/server.test.ts":
|
|
8954
|
-
"./creates/src/routes/(app)/teams/server.test.ts":
|
|
8955
|
-
"./creates/src/routes/(app)/teams/switch/[id]/+page.server.ts":
|
|
8956
|
-
"./creates/src/routes/(app)/teams/switch/[id]/server.test.ts":
|
|
8957
|
-
}),
|
|
8958
|
-
async function
|
|
8834
|
+
`, as = /* @__PURE__ */ Object.assign({
|
|
8835
|
+
"./creates/src/lib/components/team-switcher.svelte": So,
|
|
8836
|
+
"./creates/src/lib/schemas/team.ts": Fo,
|
|
8837
|
+
"./creates/src/lib/schemas/teamInvite.ts": ko,
|
|
8838
|
+
"./creates/src/lib/schemas/teamRole.ts": Ro,
|
|
8839
|
+
"./creates/src/routes/(app)/invite/[id]/+layout@.svelte": Io,
|
|
8840
|
+
"./creates/src/routes/(app)/invite/[id]/+page.server.ts": Mo,
|
|
8841
|
+
"./creates/src/routes/(app)/invite/[id]/+page.svelte": Po,
|
|
8842
|
+
"./creates/src/routes/(app)/join/[id]/+layout@.svelte": To,
|
|
8843
|
+
"./creates/src/routes/(app)/join/[id]/+page.server.ts": Eo,
|
|
8844
|
+
"./creates/src/routes/(app)/join/[id]/+page.svelte": Do,
|
|
8845
|
+
"./creates/src/routes/(app)/teams/+layout.server.ts": Bo,
|
|
8846
|
+
"./creates/src/routes/(app)/teams/+layout.svelte": Ao,
|
|
8847
|
+
"./creates/src/routes/(app)/teams/+page.server.ts": zo,
|
|
8848
|
+
"./creates/src/routes/(app)/teams/+page.svelte": Lo,
|
|
8849
|
+
"./creates/src/routes/(app)/teams/[id]/+layout.server.ts": Oo,
|
|
8850
|
+
"./creates/src/routes/(app)/teams/[id]/+layout@(app).svelte": Uo,
|
|
8851
|
+
"./creates/src/routes/(app)/teams/[id]/+page.server.ts": jo,
|
|
8852
|
+
"./creates/src/routes/(app)/teams/[id]/+page.svelte": qo,
|
|
8853
|
+
"./creates/src/routes/(app)/teams/[id]/authorization.ts": No,
|
|
8854
|
+
"./creates/src/routes/(app)/teams/[id]/invite/+page.server.ts": Vo,
|
|
8855
|
+
"./creates/src/routes/(app)/teams/[id]/invite/+page.svelte": Ho,
|
|
8856
|
+
"./creates/src/routes/(app)/teams/[id]/invite/server.test.ts": Ko,
|
|
8857
|
+
"./creates/src/routes/(app)/teams/[id]/member/[member_id]/+page.server.ts": Go,
|
|
8858
|
+
"./creates/src/routes/(app)/teams/[id]/member/[member_id]/+page.svelte": Wo,
|
|
8859
|
+
"./creates/src/routes/(app)/teams/[id]/member/[member_id]/server.test.ts": Xo,
|
|
8860
|
+
"./creates/src/routes/(app)/teams/[id]/server.test.ts": Jo,
|
|
8861
|
+
"./creates/src/routes/(app)/teams/new/+page.server.ts": Yo,
|
|
8862
|
+
"./creates/src/routes/(app)/teams/new/+page.svelte": Zo,
|
|
8863
|
+
"./creates/src/routes/(app)/teams/new/server.test.ts": Qo,
|
|
8864
|
+
"./creates/src/routes/(app)/teams/server.test.ts": ts,
|
|
8865
|
+
"./creates/src/routes/(app)/teams/switch/[id]/+page.server.ts": es,
|
|
8866
|
+
"./creates/src/routes/(app)/teams/switch/[id]/server.test.ts": ns
|
|
8867
|
+
}), rs = "./creates/";
|
|
8868
|
+
async function os(t) {
|
|
8959
8869
|
return {
|
|
8960
|
-
creates: Object.entries(
|
|
8961
|
-
const r = M(n,
|
|
8870
|
+
creates: Object.entries(as).map(([n, a]) => {
|
|
8871
|
+
const r = M(n, rs);
|
|
8962
8872
|
return {
|
|
8963
8873
|
path: r,
|
|
8964
8874
|
language: S(r),
|
|
@@ -8984,7 +8894,7 @@ async function ds(t) {
|
|
|
8984
8894
|
collections: []
|
|
8985
8895
|
};
|
|
8986
8896
|
}
|
|
8987
|
-
const
|
|
8897
|
+
const ss = `<script lang="ts">
|
|
8988
8898
|
import type { ComponentProps } from 'svelte';
|
|
8989
8899
|
import HomeIcon from '@lucide/svelte/icons/home';
|
|
8990
8900
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
@@ -9059,7 +8969,7 @@ const ps = `<script lang="ts">
|
|
|
9059
8969
|
<NavUser {user} />
|
|
9060
8970
|
</Sidebar.Footer>
|
|
9061
8971
|
</Sidebar.Root>
|
|
9062
|
-
`,
|
|
8972
|
+
`, is = `<script lang="ts">
|
|
9063
8973
|
import { toggleMode, mode } from 'mode-watcher';
|
|
9064
8974
|
import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';
|
|
9065
8975
|
import Settings2Icon from '@lucide/svelte/icons/settings-2';
|
|
@@ -9183,7 +9093,7 @@ const ps = `<script lang="ts">
|
|
|
9183
9093
|
</DropdownMenu.Root>
|
|
9184
9094
|
</Sidebar.MenuItem>
|
|
9185
9095
|
</Sidebar.Menu>
|
|
9186
|
-
`,
|
|
9096
|
+
`, ls = `export const load = async ({ locals, depends }) => {
|
|
9187
9097
|
const user = locals.pb.authStore.record!;
|
|
9188
9098
|
// [!code highlight:3]
|
|
9189
9099
|
const team = locals.team;
|
|
@@ -9194,7 +9104,7 @@ const ps = `<script lang="ts">
|
|
|
9194
9104
|
|
|
9195
9105
|
return { user, team, teams, breadcrumbs };
|
|
9196
9106
|
};
|
|
9197
|
-
`,
|
|
9107
|
+
`, cs = `<script lang="ts">
|
|
9198
9108
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
9199
9109
|
import { Separator } from '$lib/components/ui/separator';
|
|
9200
9110
|
import AppSidebar from '$lib/components/app-sidebar.svelte';
|
|
@@ -9245,7 +9155,7 @@ const ps = `<script lang="ts">
|
|
|
9245
9155
|
background-color: var(--color-sidebar);
|
|
9246
9156
|
}
|
|
9247
9157
|
</style>
|
|
9248
|
-
`,
|
|
9158
|
+
`, ms = [
|
|
9249
9159
|
{
|
|
9250
9160
|
collectionName: "teams",
|
|
9251
9161
|
listRule: "team_memberships_via_team.user ?= @request.auth.id || owner = @request.auth.id",
|
|
@@ -9286,9 +9196,9 @@ const ps = `<script lang="ts">
|
|
|
9286
9196
|
updateRule: null,
|
|
9287
9197
|
deleteRule: null
|
|
9288
9198
|
}
|
|
9289
|
-
],
|
|
9290
|
-
function
|
|
9291
|
-
const e =
|
|
9199
|
+
], Tt = "users", G = "teams", ds = "team_memberships";
|
|
9200
|
+
function j(t) {
|
|
9201
|
+
const e = ms.find((n) => n.collectionName === t);
|
|
9292
9202
|
if (!e)
|
|
9293
9203
|
throw new Error(
|
|
9294
9204
|
`teams: missing TEAM_RULE_PATCHES entry for "${t}"`
|
|
@@ -9301,11 +9211,11 @@ function q(t) {
|
|
|
9301
9211
|
deleteRule: e.deleteRule
|
|
9302
9212
|
};
|
|
9303
9213
|
}
|
|
9304
|
-
const
|
|
9214
|
+
const ps = [
|
|
9305
9215
|
{
|
|
9306
9216
|
name: "teams",
|
|
9307
9217
|
type: "base",
|
|
9308
|
-
...
|
|
9218
|
+
...j("teams"),
|
|
9309
9219
|
fields: [
|
|
9310
9220
|
{
|
|
9311
9221
|
name: "id",
|
|
@@ -9326,7 +9236,7 @@ const vs = [
|
|
|
9326
9236
|
name: "owner",
|
|
9327
9237
|
type: "relation",
|
|
9328
9238
|
cascadeDelete: !1,
|
|
9329
|
-
collectionId:
|
|
9239
|
+
collectionId: Tt,
|
|
9330
9240
|
maxSelect: 1,
|
|
9331
9241
|
minSelect: 0,
|
|
9332
9242
|
required: !0
|
|
@@ -9348,7 +9258,7 @@ const vs = [
|
|
|
9348
9258
|
{
|
|
9349
9259
|
name: "team_memberships",
|
|
9350
9260
|
type: "base",
|
|
9351
|
-
...
|
|
9261
|
+
...j("team_memberships"),
|
|
9352
9262
|
fields: [
|
|
9353
9263
|
{
|
|
9354
9264
|
name: "id",
|
|
@@ -9372,7 +9282,7 @@ const vs = [
|
|
|
9372
9282
|
{
|
|
9373
9283
|
name: "user",
|
|
9374
9284
|
cascadeDelete: !0,
|
|
9375
|
-
collectionId:
|
|
9285
|
+
collectionId: Tt,
|
|
9376
9286
|
maxSelect: 1,
|
|
9377
9287
|
minSelect: 0,
|
|
9378
9288
|
required: !0,
|
|
@@ -9402,7 +9312,7 @@ const vs = [
|
|
|
9402
9312
|
{
|
|
9403
9313
|
name: "team_users",
|
|
9404
9314
|
type: "view",
|
|
9405
|
-
...
|
|
9315
|
+
...j("team_users"),
|
|
9406
9316
|
viewQuery: "select users.id, users.email, users.name, team_memberships.id as membership_id, team_memberships.team, team_memberships.role from users join team_memberships on team_memberships.user = users.id;",
|
|
9407
9317
|
fields: [
|
|
9408
9318
|
{
|
|
@@ -9428,7 +9338,7 @@ const vs = [
|
|
|
9428
9338
|
{
|
|
9429
9339
|
name: "membership_id",
|
|
9430
9340
|
cascadeDelete: !1,
|
|
9431
|
-
collectionId:
|
|
9341
|
+
collectionId: ds,
|
|
9432
9342
|
maxSelect: 1,
|
|
9433
9343
|
minSelect: 0,
|
|
9434
9344
|
required: !1,
|
|
@@ -9455,7 +9365,7 @@ const vs = [
|
|
|
9455
9365
|
{
|
|
9456
9366
|
name: "team_invites",
|
|
9457
9367
|
type: "base",
|
|
9458
|
-
...
|
|
9368
|
+
...j("team_invites"),
|
|
9459
9369
|
fields: [
|
|
9460
9370
|
{
|
|
9461
9371
|
name: "id",
|
|
@@ -9498,7 +9408,7 @@ const vs = [
|
|
|
9498
9408
|
{
|
|
9499
9409
|
name: "team_invite_links",
|
|
9500
9410
|
type: "base",
|
|
9501
|
-
...
|
|
9411
|
+
...j("team_invite_links"),
|
|
9502
9412
|
indexes: [
|
|
9503
9413
|
"CREATE UNIQUE INDEX `idx_9y3Oz1KVzz` ON `team_invite_links` (`team`)"
|
|
9504
9414
|
],
|
|
@@ -9536,15 +9446,15 @@ const vs = [
|
|
|
9536
9446
|
}
|
|
9537
9447
|
]
|
|
9538
9448
|
}
|
|
9539
|
-
],
|
|
9540
|
-
"./preview-modifies/src/lib/components/app-sidebar.svelte":
|
|
9541
|
-
"./preview-modifies/src/lib/components/nav-user.svelte":
|
|
9542
|
-
"./preview-modifies/src/routes/(app)/+layout.server.ts":
|
|
9543
|
-
"./preview-modifies/src/routes/(app)/+layout.svelte":
|
|
9544
|
-
}),
|
|
9545
|
-
async function
|
|
9546
|
-
const e = Object.entries(
|
|
9547
|
-
const r = M(n,
|
|
9449
|
+
], us = /* @__PURE__ */ Object.assign({
|
|
9450
|
+
"./preview-modifies/src/lib/components/app-sidebar.svelte": ss,
|
|
9451
|
+
"./preview-modifies/src/lib/components/nav-user.svelte": is,
|
|
9452
|
+
"./preview-modifies/src/routes/(app)/+layout.server.ts": ls,
|
|
9453
|
+
"./preview-modifies/src/routes/(app)/+layout.svelte": cs
|
|
9454
|
+
}), fs = "./preview-modifies/";
|
|
9455
|
+
async function gs(t) {
|
|
9456
|
+
const e = Object.entries(us).map(([n, a]) => {
|
|
9457
|
+
const r = M(n, fs);
|
|
9548
9458
|
return {
|
|
9549
9459
|
path: r,
|
|
9550
9460
|
language: S(r),
|
|
@@ -9557,27 +9467,27 @@ async function ys(t) {
|
|
|
9557
9467
|
deletes: [],
|
|
9558
9468
|
components: [],
|
|
9559
9469
|
packages: [],
|
|
9560
|
-
collections:
|
|
9470
|
+
collections: ps
|
|
9561
9471
|
};
|
|
9562
9472
|
}
|
|
9563
|
-
const
|
|
9564
|
-
async function
|
|
9565
|
-
const e = await
|
|
9473
|
+
const hs = "enable-teams", bs = "1.0.0", vs = "src/patterns/enable/teams", ws = "/enable/teams";
|
|
9474
|
+
async function xs(t) {
|
|
9475
|
+
const e = await os();
|
|
9566
9476
|
if (t.env === "preview") {
|
|
9567
|
-
const s = await
|
|
9477
|
+
const s = await gs();
|
|
9568
9478
|
return $(I([e, s]));
|
|
9569
9479
|
}
|
|
9570
|
-
const { generate: n } = await import("./generate.runtime-
|
|
9480
|
+
const { generate: n } = await import("./generate.runtime-hZV63PD9.js"), a = await n(t), { writeResult: r } = await import("./write-result-1Q3LB_k4.js");
|
|
9571
9481
|
return r(
|
|
9572
9482
|
await $(I([e, a])),
|
|
9573
9483
|
t
|
|
9574
9484
|
);
|
|
9575
9485
|
}
|
|
9576
|
-
const
|
|
9577
|
-
version:
|
|
9578
|
-
slug:
|
|
9579
|
-
source:
|
|
9580
|
-
docs:
|
|
9486
|
+
const ys = {
|
|
9487
|
+
version: bs,
|
|
9488
|
+
slug: hs,
|
|
9489
|
+
source: vs,
|
|
9490
|
+
docs: ws,
|
|
9581
9491
|
plan: "pro",
|
|
9582
9492
|
title: "Enable teams",
|
|
9583
9493
|
summary: "Adds multi-tenant teams with memberships, invites, and a sidebar team switcher.",
|
|
@@ -9603,21 +9513,22 @@ const ks = {
|
|
|
9603
9513
|
base: "vela enable teams",
|
|
9604
9514
|
argv: []
|
|
9605
9515
|
},
|
|
9516
|
+
tests: 36,
|
|
9606
9517
|
baseline: "velastack",
|
|
9607
|
-
generate:
|
|
9608
|
-
},
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
],
|
|
9619
|
-
|
|
9620
|
-
),
|
|
9518
|
+
generate: xs
|
|
9519
|
+
}, ks = ae.version, Xt = [
|
|
9520
|
+
zn,
|
|
9521
|
+
wa,
|
|
9522
|
+
Kn,
|
|
9523
|
+
ma,
|
|
9524
|
+
yr,
|
|
9525
|
+
Br,
|
|
9526
|
+
ao,
|
|
9527
|
+
Co,
|
|
9528
|
+
ys
|
|
9529
|
+
], Rs = Object.fromEntries(
|
|
9530
|
+
Xt.map((t) => [t.slug, t])
|
|
9531
|
+
), Is = Xt.reduce(
|
|
9621
9532
|
(t, e) => {
|
|
9622
9533
|
const n = e.category;
|
|
9623
9534
|
return t[n] ?? (t[n] = []), t[n].push(e), t;
|
|
@@ -9625,14 +9536,14 @@ const ks = {
|
|
|
9625
9536
|
{}
|
|
9626
9537
|
);
|
|
9627
9538
|
export {
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9539
|
+
Ss as D,
|
|
9540
|
+
Fs as M,
|
|
9541
|
+
ms as T,
|
|
9542
|
+
Rs as a,
|
|
9543
|
+
Is as b,
|
|
9544
|
+
u as d,
|
|
9634
9545
|
S as l,
|
|
9635
|
-
|
|
9636
|
-
|
|
9546
|
+
Xt as p,
|
|
9547
|
+
ks as v
|
|
9637
9548
|
};
|
|
9638
|
-
//# sourceMappingURL=index-
|
|
9549
|
+
//# sourceMappingURL=index-CoeyNVkU.js.map
|