@velastack/patterns 0.0.21 → 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-OI0LQoJt.js → collections-Ch4kZjuV.js} +3 -3
- package/dist/chunks/{collections-OI0LQoJt.js.map → collections-Ch4kZjuV.js.map} +1 -1
- package/dist/chunks/{env.runtime-CSAfqDu4.js → env.runtime-BauEimvd.js} +2 -2
- package/dist/chunks/{env.runtime-CSAfqDu4.js.map → env.runtime-BauEimvd.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BQFcrwn8.js → generate.runtime-CnxTssBQ.js} +3 -3
- package/dist/chunks/{generate.runtime-BQFcrwn8.js.map → generate.runtime-CnxTssBQ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BQg5E0LV.js → generate.runtime-D5bvTbSL.js} +2 -2
- package/dist/chunks/{generate.runtime-BQg5E0LV.js.map → generate.runtime-D5bvTbSL.js.map} +1 -1
- package/dist/chunks/{generate.runtime-ZXBZUjeH.js → generate.runtime-Tk3iuGQE.js} +2 -2
- package/dist/chunks/{generate.runtime-ZXBZUjeH.js.map → generate.runtime-Tk3iuGQE.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CEFyA2-Y.js → generate.runtime-hZV63PD9.js} +4 -4
- package/dist/chunks/{generate.runtime-CEFyA2-Y.js.map → generate.runtime-hZV63PD9.js.map} +1 -1
- package/dist/chunks/{index-9TLCLhJv.js → index-CoeyNVkU.js} +1116 -1214
- package/dist/chunks/index-CoeyNVkU.js.map +1 -0
- package/dist/chunks/{pocketbase-Vk0YzqnQ.js → pocketbase-rvyHmLFw.js} +2 -2
- package/dist/chunks/{pocketbase-Vk0YzqnQ.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.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/index-9TLCLhJv.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-CSAfqDu4.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,271 +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-CSAfqDu4.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
|
-
tests: 2,
|
|
2283
|
-
baseline: "velastack",
|
|
2284
|
-
generate: En
|
|
2285
|
-
}, zn = ["text"], Bn = {
|
|
2010
|
+
const hn = ["text"], bn = {
|
|
2286
2011
|
string: "text",
|
|
2287
2012
|
boolean: "bool",
|
|
2288
2013
|
geopoint: "geoPoint",
|
|
@@ -2309,10 +2034,10 @@ const Dn = {
|
|
|
2309
2034
|
geoPoint: "geoPoint",
|
|
2310
2035
|
relation: "relation"
|
|
2311
2036
|
};
|
|
2312
|
-
function
|
|
2037
|
+
function vn(t) {
|
|
2313
2038
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
|
|
2314
2039
|
}
|
|
2315
|
-
function
|
|
2040
|
+
function H(t, e) {
|
|
2316
2041
|
const n = t.type === "select" ? `[${(t.options ?? []).map((r) => JSON.stringify(r.value)).join(", ")}]` : "";
|
|
2317
2042
|
let a;
|
|
2318
2043
|
switch (t.type) {
|
|
@@ -2329,13 +2054,13 @@ function Ln(t, e) {
|
|
|
2329
2054
|
a = e.forForm ? "z.string()" : "z.date()";
|
|
2330
2055
|
break;
|
|
2331
2056
|
case "email":
|
|
2332
|
-
a = "z.
|
|
2057
|
+
a = "z.email()";
|
|
2333
2058
|
break;
|
|
2334
2059
|
case "password":
|
|
2335
2060
|
a = "z.string()";
|
|
2336
2061
|
break;
|
|
2337
2062
|
case "url":
|
|
2338
|
-
a = "z.
|
|
2063
|
+
a = "z.url()";
|
|
2339
2064
|
break;
|
|
2340
2065
|
case "editor":
|
|
2341
2066
|
a = "z.string()";
|
|
@@ -2358,7 +2083,7 @@ function Ln(t, e) {
|
|
|
2358
2083
|
return val;
|
|
2359
2084
|
}
|
|
2360
2085
|
return JSON.stringify(val);
|
|
2361
|
-
}, z.string()${t.required ? "" : ".optional()"})
|
|
2086
|
+
}, z.string()${t.required ? "" : ".optional()"})` : u`
|
|
2362
2087
|
z.object({
|
|
2363
2088
|
lat: z.number().min(-90).max(90),
|
|
2364
2089
|
lon: z.number().min(-180).max(180)
|
|
@@ -2371,97 +2096,144 @@ function Ln(t, e) {
|
|
|
2371
2096
|
default:
|
|
2372
2097
|
return t.type;
|
|
2373
2098
|
}
|
|
2374
|
-
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
|
+
};
|
|
2375
2135
|
}
|
|
2376
|
-
function
|
|
2136
|
+
function Q(t, e, n) {
|
|
2377
2137
|
const a = [];
|
|
2378
|
-
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
|
+
}));
|
|
2379
2151
|
for (const o of e) {
|
|
2380
2152
|
if (o.type === "file" && o.maxSelect > 1) {
|
|
2381
|
-
a.push({
|
|
2153
|
+
a.push({
|
|
2154
|
+
name: o.name,
|
|
2155
|
+
schema: H({ ...o, required: !1 }, n)
|
|
2156
|
+
}), a.push({
|
|
2382
2157
|
name: `${o.name}+`,
|
|
2383
|
-
|
|
2384
|
-
required: !1,
|
|
2385
|
-
maxSelect: 999
|
|
2158
|
+
schema: "z.instanceof(File).array().optional()"
|
|
2386
2159
|
}), a.push({
|
|
2387
2160
|
name: `${o.name}-`,
|
|
2388
|
-
|
|
2389
|
-
required: !1,
|
|
2390
|
-
maxSelect: 999
|
|
2161
|
+
schema: "z.string().array().optional()"
|
|
2391
2162
|
});
|
|
2392
2163
|
continue;
|
|
2393
2164
|
}
|
|
2394
|
-
a.push(
|
|
2165
|
+
a.push({
|
|
2166
|
+
name: o.name,
|
|
2167
|
+
schema: H(o, n)
|
|
2168
|
+
});
|
|
2395
2169
|
}
|
|
2396
|
-
const r = a.map(
|
|
2397
|
-
(o) => `${An(o.name)}: ${Ln(o, n)}`
|
|
2398
|
-
).join(`,
|
|
2170
|
+
const r = a.map((o) => `${vn(o.name)}: ${o.schema}`).join(`,
|
|
2399
2171
|
`), s = n.includeModelFields ? `
|
|
2400
2172
|
import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
|
|
2401
|
-
return
|
|
2402
|
-
import { z } from "zod
|
|
2173
|
+
return u`
|
|
2174
|
+
import { z } from "zod";${s}
|
|
2403
2175
|
|
|
2404
2176
|
export const ${t.schemaName} = z.object({
|
|
2405
2177
|
${r}
|
|
2406
2178
|
})${i};
|
|
2407
2179
|
`;
|
|
2408
2180
|
}
|
|
2409
|
-
function
|
|
2410
|
-
const e =
|
|
2181
|
+
function xn(t) {
|
|
2182
|
+
const e = bn[t];
|
|
2411
2183
|
if (!e)
|
|
2412
2184
|
throw new Error(
|
|
2413
2185
|
`Unsupported collection field type "${t}" when generating from collection`
|
|
2414
2186
|
);
|
|
2415
2187
|
return e;
|
|
2416
2188
|
}
|
|
2417
|
-
function
|
|
2189
|
+
function yn(t, e, n) {
|
|
2418
2190
|
const a = e.find((o) => o.name === t.tableName);
|
|
2419
2191
|
if (!a)
|
|
2420
2192
|
throw new Error(`Collection "${t.tableName}" not found`);
|
|
2421
|
-
const r =
|
|
2193
|
+
const r = Lt(e), s = new Map(e.map((o) => [o.id, o])), i = [];
|
|
2422
2194
|
for (const o of a.fields) {
|
|
2423
2195
|
if (o.name === "id" || o.system)
|
|
2424
2196
|
continue;
|
|
2425
|
-
const c =
|
|
2197
|
+
const c = xn(o.type), m = !!o.required, h = ct(o.name);
|
|
2426
2198
|
if (c === "relation") {
|
|
2427
|
-
const
|
|
2428
|
-
if (!
|
|
2199
|
+
const p = o.collectionId ? s.get(o.collectionId) : void 0;
|
|
2200
|
+
if (!p)
|
|
2429
2201
|
continue;
|
|
2430
|
-
const
|
|
2202
|
+
const g = Y(p.name, n);
|
|
2431
2203
|
i.push({
|
|
2432
2204
|
name: o.name,
|
|
2433
|
-
title:
|
|
2205
|
+
title: h,
|
|
2434
2206
|
type: "relation",
|
|
2435
2207
|
required: m,
|
|
2436
|
-
collectionId:
|
|
2208
|
+
collectionId: p.id,
|
|
2437
2209
|
maxSelect: o.maxSelect ?? 1,
|
|
2438
|
-
displayField: r[
|
|
2439
|
-
relatedModel:
|
|
2440
|
-
singularRelationName:
|
|
2441
|
-
`${t.displayName} ${
|
|
2210
|
+
displayField: r[p.name] ?? "id",
|
|
2211
|
+
relatedModel: g,
|
|
2212
|
+
singularRelationName: O(
|
|
2213
|
+
`${t.displayName} ${g.displayName}`
|
|
2442
2214
|
),
|
|
2443
|
-
pluralRelationName:
|
|
2444
|
-
`${t.displayName} ${
|
|
2215
|
+
pluralRelationName: O(
|
|
2216
|
+
`${t.displayName} ${g.pluralDisplayName}`
|
|
2445
2217
|
),
|
|
2446
|
-
isCurrentUser: n.features.auth &&
|
|
2218
|
+
isCurrentUser: n.features.auth && p.name === "users" && /user|owner|author/i.test(o.name)
|
|
2447
2219
|
});
|
|
2448
2220
|
continue;
|
|
2449
2221
|
}
|
|
2450
2222
|
if (c === "select") {
|
|
2451
2223
|
i.push({
|
|
2452
2224
|
name: o.name,
|
|
2453
|
-
title:
|
|
2225
|
+
title: h,
|
|
2454
2226
|
type: "select",
|
|
2455
2227
|
required: m,
|
|
2456
2228
|
maxSelect: o.maxSelect ?? 1,
|
|
2457
|
-
options: (o.values ?? []).map((
|
|
2229
|
+
options: (o.values ?? []).map((p) => ({ label: p, value: p }))
|
|
2458
2230
|
});
|
|
2459
2231
|
continue;
|
|
2460
2232
|
}
|
|
2461
2233
|
if (c === "file") {
|
|
2462
2234
|
i.push({
|
|
2463
2235
|
name: o.name,
|
|
2464
|
-
title:
|
|
2236
|
+
title: h,
|
|
2465
2237
|
type: "file",
|
|
2466
2238
|
required: m,
|
|
2467
2239
|
maxSelect: o.maxSelect ?? 1
|
|
@@ -2471,7 +2243,7 @@ function mt(t, e, n) {
|
|
|
2471
2243
|
if (c === "autodate") {
|
|
2472
2244
|
i.push({
|
|
2473
2245
|
name: o.name,
|
|
2474
|
-
title:
|
|
2246
|
+
title: h,
|
|
2475
2247
|
type: "autodate",
|
|
2476
2248
|
required: m,
|
|
2477
2249
|
onCreate: o.onCreate ?? o.name.includes("create"),
|
|
@@ -2481,26 +2253,26 @@ function mt(t, e, n) {
|
|
|
2481
2253
|
}
|
|
2482
2254
|
i.push({
|
|
2483
2255
|
name: o.name,
|
|
2484
|
-
title:
|
|
2256
|
+
title: h,
|
|
2485
2257
|
type: c,
|
|
2486
2258
|
required: m
|
|
2487
2259
|
});
|
|
2488
2260
|
}
|
|
2489
2261
|
return i.filter((o) => o.name !== "id");
|
|
2490
2262
|
}
|
|
2491
|
-
function
|
|
2263
|
+
function jt(t) {
|
|
2492
2264
|
const e = t.filter(
|
|
2493
2265
|
(n) => n.type === "relation"
|
|
2494
2266
|
).map((n) => n.name);
|
|
2495
2267
|
return e.length > 0 ? e.join(",") : void 0;
|
|
2496
2268
|
}
|
|
2497
|
-
function
|
|
2269
|
+
function qt(t) {
|
|
2498
2270
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
2499
2271
|
for (const a of t)
|
|
2500
2272
|
a.type === "relation" && (e.has(a.relatedModel.tableName) || (e.add(a.relatedModel.tableName), n.push(a.relatedModel)));
|
|
2501
2273
|
return n;
|
|
2502
2274
|
}
|
|
2503
|
-
function
|
|
2275
|
+
function $n(t) {
|
|
2504
2276
|
const e = {
|
|
2505
2277
|
name: t.name,
|
|
2506
2278
|
type: t.type,
|
|
@@ -2523,7 +2295,7 @@ function Un(t) {
|
|
|
2523
2295
|
onUpdate: t.onUpdate
|
|
2524
2296
|
} : e;
|
|
2525
2297
|
}
|
|
2526
|
-
function
|
|
2298
|
+
function Nt(t, e, n) {
|
|
2527
2299
|
const a = n ? {
|
|
2528
2300
|
listRule: n.rule,
|
|
2529
2301
|
viewRule: n.rule,
|
|
@@ -2535,72 +2307,236 @@ function Ht(t, e, n) {
|
|
|
2535
2307
|
name: t.tableName,
|
|
2536
2308
|
type: "base",
|
|
2537
2309
|
...a,
|
|
2538
|
-
fields: e.map(
|
|
2310
|
+
fields: e.map($n)
|
|
2539
2311
|
};
|
|
2540
2312
|
}
|
|
2541
|
-
|
|
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
|
|
2422
|
+
};
|
|
2423
|
+
}
|
|
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) {
|
|
2542
2495
|
const [e, ...n] = t;
|
|
2543
2496
|
if (!e)
|
|
2544
2497
|
throw new Error("Invalid command arguments. Expected: <model> [fields...]");
|
|
2545
2498
|
return { modelPath: e, fields: n };
|
|
2546
2499
|
}
|
|
2547
|
-
function
|
|
2500
|
+
function On(t, e) {
|
|
2548
2501
|
return {
|
|
2549
2502
|
path: t,
|
|
2550
2503
|
language: S(t),
|
|
2551
2504
|
content: e
|
|
2552
2505
|
};
|
|
2553
2506
|
}
|
|
2554
|
-
async function
|
|
2555
|
-
Z(e)
|
|
2556
|
-
const a = D(e, t);
|
|
2557
|
-
if (n.length > 0) {
|
|
2558
|
-
const i = await Y(n, a, t);
|
|
2559
|
-
return {
|
|
2560
|
-
model: a,
|
|
2561
|
-
fields: i.fields,
|
|
2562
|
-
auth: i.auth,
|
|
2563
|
-
shouldCreateCollection: !0
|
|
2564
|
-
};
|
|
2565
|
-
}
|
|
2566
|
-
const r = t.env === "runtime" ? await (await import("./env.runtime-CSAfqDu4.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
|
|
2567
|
-
t
|
|
2568
|
-
), s = mt(a, r, t);
|
|
2569
|
-
return { model: a, fields: s, auth: void 0, shouldCreateCollection: !1 };
|
|
2570
|
-
}
|
|
2571
|
-
async function Vn(t) {
|
|
2572
|
-
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, {
|
|
2573
2509
|
includeModelFields: !0,
|
|
2574
2510
|
forForm: !0
|
|
2575
2511
|
});
|
|
2576
2512
|
return {
|
|
2577
|
-
creates: [
|
|
2513
|
+
creates: [On(o, c)],
|
|
2578
2514
|
modifies: [],
|
|
2579
2515
|
deletes: [],
|
|
2580
2516
|
components: [],
|
|
2581
2517
|
packages: [],
|
|
2582
|
-
collections: i ? [
|
|
2518
|
+
collections: i ? [Nt(a, r, s)] : []
|
|
2583
2519
|
};
|
|
2584
2520
|
}
|
|
2585
|
-
const
|
|
2586
|
-
async function
|
|
2587
|
-
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);
|
|
2588
2524
|
if (t.env !== "runtime")
|
|
2589
2525
|
return $(e);
|
|
2590
|
-
const { createCollections: n } = await import("./collections-
|
|
2526
|
+
const { createCollections: n } = await import("./collections-Ch4kZjuV.js"), a = await n(
|
|
2591
2527
|
e.collections,
|
|
2592
2528
|
t
|
|
2593
2529
|
), r = {
|
|
2594
2530
|
...e,
|
|
2595
2531
|
creates: [...e.creates, ...a]
|
|
2596
|
-
}, { writeResult: s } = await import("./write-result-
|
|
2532
|
+
}, { writeResult: s } = await import("./write-result-1Q3LB_k4.js");
|
|
2597
2533
|
return s(await $(r), t);
|
|
2598
2534
|
}
|
|
2599
|
-
const
|
|
2600
|
-
version:
|
|
2601
|
-
slug:
|
|
2602
|
-
source:
|
|
2603
|
-
docs:
|
|
2535
|
+
const Kn = {
|
|
2536
|
+
version: qn,
|
|
2537
|
+
slug: jn,
|
|
2538
|
+
source: Nn,
|
|
2539
|
+
docs: Vn,
|
|
2604
2540
|
plan: "open",
|
|
2605
2541
|
title: "Generate a resource",
|
|
2606
2542
|
summary: "Generates model schema resources.",
|
|
@@ -2621,10 +2557,10 @@ const Xn = {
|
|
|
2621
2557
|
},
|
|
2622
2558
|
tests: 0,
|
|
2623
2559
|
baseline: "velastack",
|
|
2624
|
-
generate:
|
|
2560
|
+
generate: Hn
|
|
2625
2561
|
};
|
|
2626
|
-
var
|
|
2627
|
-
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) {
|
|
2628
2564
|
const [e, ...n] = t;
|
|
2629
2565
|
if (!e)
|
|
2630
2566
|
throw new Error("Invalid command arguments. Expected: <model> [fields...]");
|
|
@@ -2637,59 +2573,59 @@ function k(t, e) {
|
|
|
2637
2573
|
content: e
|
|
2638
2574
|
};
|
|
2639
2575
|
}
|
|
2640
|
-
function
|
|
2576
|
+
function et(t) {
|
|
2641
2577
|
return t.some((e) => e.type === "file");
|
|
2642
2578
|
}
|
|
2643
|
-
function
|
|
2579
|
+
function Ht(t) {
|
|
2644
2580
|
return [...new Set(t.filter(Boolean))];
|
|
2645
2581
|
}
|
|
2646
2582
|
function dt(t) {
|
|
2647
2583
|
return t.filter(
|
|
2648
2584
|
(e) => e.type === "select"
|
|
2649
|
-
).map((e) =>
|
|
2585
|
+
).map((e) => Dt(e)).join(`
|
|
2650
2586
|
|
|
2651
2587
|
`);
|
|
2652
2588
|
}
|
|
2653
|
-
function
|
|
2654
|
-
return
|
|
2589
|
+
function Kt(t, e) {
|
|
2590
|
+
return qt(t).map(
|
|
2655
2591
|
(n) => `const ${n.pluralName} = await ${e}.collection("${n.tableName}").getFullList();`
|
|
2656
2592
|
).join(`
|
|
2657
2593
|
`);
|
|
2658
2594
|
}
|
|
2659
|
-
function
|
|
2660
|
-
return
|
|
2595
|
+
function Gt(t) {
|
|
2596
|
+
return qt(t).map((e) => e.pluralName).join(", ");
|
|
2661
2597
|
}
|
|
2662
|
-
function
|
|
2598
|
+
function Xn(t) {
|
|
2663
2599
|
return t.features.auth ? "locals.pb" : "locals.admin";
|
|
2664
2600
|
}
|
|
2665
|
-
function
|
|
2601
|
+
function Wt(t, e, n = !1) {
|
|
2666
2602
|
const a = dt(e);
|
|
2667
|
-
return
|
|
2603
|
+
return u`
|
|
2668
2604
|
${a}
|
|
2669
2605
|
${n ? "let { data, params } = $props();" : "let { data } = $props();"}
|
|
2670
2606
|
|
|
2671
2607
|
const form = superForm(untrack(() => data.form), {
|
|
2672
|
-
validators:
|
|
2608
|
+
validators: zod4Client(${t.schemaName}),
|
|
2673
2609
|
});
|
|
2674
2610
|
|
|
2675
2611
|
const { form: formData } = form;
|
|
2676
2612
|
`;
|
|
2677
2613
|
}
|
|
2678
|
-
function
|
|
2679
|
-
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([
|
|
2680
2616
|
'import { untrack } from "svelte";',
|
|
2681
2617
|
'import { superForm } from "sveltekit-superforms";',
|
|
2682
|
-
'import {
|
|
2618
|
+
'import { zod4Client } from "sveltekit-superforms/adapters";',
|
|
2683
2619
|
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2684
|
-
...
|
|
2620
|
+
...lt(N(n)),
|
|
2685
2621
|
'import { Button } from "$lib/components/ui/button";',
|
|
2686
2622
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
2687
2623
|
'import * as Form from "$lib/components/ui/form";',
|
|
2688
2624
|
a ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2689
2625
|
]).join(`
|
|
2690
|
-
`), s = n.map((o) =>
|
|
2691
|
-
`), i =
|
|
2692
|
-
return
|
|
2626
|
+
`), s = n.map((o) => it(o)).join(`
|
|
2627
|
+
`), i = et(n) ? ' enctype="multipart/form-data"' : "";
|
|
2628
|
+
return u(Rt || (Rt = tt([`
|
|
2693
2629
|
<script lang="ts">
|
|
2694
2630
|
`, `
|
|
2695
2631
|
`, `
|
|
@@ -2716,23 +2652,23 @@ function ta(t, e, n) {
|
|
|
2716
2652
|
</form>
|
|
2717
2653
|
</div>
|
|
2718
2654
|
</section>
|
|
2719
|
-
`])), r,
|
|
2655
|
+
`])), r, Wt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2720
2656
|
}
|
|
2721
|
-
function
|
|
2722
|
-
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([
|
|
2723
2659
|
'import { untrack } from "svelte";',
|
|
2724
2660
|
'import { superForm } from "sveltekit-superforms";',
|
|
2725
|
-
'import {
|
|
2661
|
+
'import { zod4Client } from "sveltekit-superforms/adapters";',
|
|
2726
2662
|
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2727
|
-
...
|
|
2663
|
+
...lt(N(n)),
|
|
2728
2664
|
'import { Button } from "$lib/components/ui/button";',
|
|
2729
2665
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
2730
2666
|
'import * as Form from "$lib/components/ui/form";',
|
|
2731
2667
|
a ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2732
2668
|
]).join(`
|
|
2733
|
-
`), s = n.map((o) =>
|
|
2734
|
-
`), i =
|
|
2735
|
-
return
|
|
2669
|
+
`), s = n.map((o) => it(o)).join(`
|
|
2670
|
+
`), i = et(n) ? ' enctype="multipart/form-data"' : "";
|
|
2671
|
+
return u(It || (It = tt([`
|
|
2736
2672
|
<script lang="ts">
|
|
2737
2673
|
`, `
|
|
2738
2674
|
`, `
|
|
@@ -2786,12 +2722,12 @@ function ea(t, e, n) {
|
|
|
2786
2722
|
</form>
|
|
2787
2723
|
</div>
|
|
2788
2724
|
</section>
|
|
2789
|
-
`])), r,
|
|
2725
|
+
`])), r, Wt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2790
2726
|
}
|
|
2791
|
-
function
|
|
2727
|
+
function Zn(t, e, n) {
|
|
2792
2728
|
const a = n.some((o) => o.type === "select"), r = a ? `${dt(n)}` : "", s = n.map((o) => {
|
|
2793
2729
|
let c = "{ getValue }", m = "{ value: getValue() }";
|
|
2794
|
-
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`
|
|
2795
2731
|
columnHelper.accessor("${o.name}", {
|
|
2796
2732
|
header: ({ column }) => renderComponent(ColumnHeader, { column, title: "${o.title}" }),
|
|
2797
2733
|
cell: (${c}) => renderComponent(Cells.${o.type.charAt(0).toUpperCase() + o.type.slice(1)}Cell, ${m})
|
|
@@ -2802,7 +2738,7 @@ function na(t, e, n) {
|
|
|
2802
2738
|
(o) => `<FacetedFilter column={table.getColumn("${o.name}")!} title="${o.title}" options={Object.values(${o.name}Labels)} />`
|
|
2803
2739
|
).join(`
|
|
2804
2740
|
`);
|
|
2805
|
-
return
|
|
2741
|
+
return u(Mt || (Mt = tt([`
|
|
2806
2742
|
<script lang="ts">
|
|
2807
2743
|
import {
|
|
2808
2744
|
type ColumnFiltersState,
|
|
@@ -2859,7 +2795,8 @@ function na(t, e, n) {
|
|
|
2859
2795
|
"aria-label": "Select row"
|
|
2860
2796
|
}),
|
|
2861
2797
|
enableSorting: false,
|
|
2862
|
-
enableHiding: false
|
|
2798
|
+
enableHiding: false,
|
|
2799
|
+
meta: { class: "w-0" },
|
|
2863
2800
|
}),
|
|
2864
2801
|
`, "", `
|
|
2865
2802
|
columnHelper.display({
|
|
@@ -2868,6 +2805,7 @@ function na(t, e, n) {
|
|
|
2868
2805
|
renderComponent(RowActions, {
|
|
2869
2806
|
viewPath: \``, "/${row.original.id}`,\n editPath: `", "/${row.original.id}/edit`,\n deletePath: `", `/\${row.original.id}\`
|
|
2870
2807
|
})
|
|
2808
|
+
meta: { class: "w-0 text-right" },
|
|
2871
2809
|
})
|
|
2872
2810
|
];
|
|
2873
2811
|
|
|
@@ -2921,7 +2859,6 @@ function na(t, e, n) {
|
|
|
2921
2859
|
<section data-role="content">
|
|
2922
2860
|
<div class="flex justify-between items-center mb-4">
|
|
2923
2861
|
<h1 class="text-3xl font-bold tracking-tight">`, `</h1>
|
|
2924
|
-
<Button href="`, '" variant="outline">New ', `</Button>
|
|
2925
2862
|
</div>
|
|
2926
2863
|
|
|
2927
2864
|
<div class="space-y-4">
|
|
@@ -3046,7 +2983,8 @@ function na(t, e, n) {
|
|
|
3046
2983
|
"aria-label": "Select row"
|
|
3047
2984
|
}),
|
|
3048
2985
|
enableSorting: false,
|
|
3049
|
-
enableHiding: false
|
|
2986
|
+
enableHiding: false,
|
|
2987
|
+
meta: { class: "w-0" },
|
|
3050
2988
|
}),
|
|
3051
2989
|
`, "", `
|
|
3052
2990
|
columnHelper.display({
|
|
@@ -3055,6 +2993,7 @@ function na(t, e, n) {
|
|
|
3055
2993
|
renderComponent(RowActions, {
|
|
3056
2994
|
viewPath: \\\``, "/\\${row.original.id}\\`,\n editPath: \\`", "/\\${row.original.id}/edit\\`,\n deletePath: \\`", `/\\\${row.original.id}\\\`
|
|
3057
2995
|
})
|
|
2996
|
+
meta: { class: "w-0 text-right" },
|
|
3058
2997
|
})
|
|
3059
2998
|
];
|
|
3060
2999
|
|
|
@@ -3108,7 +3047,6 @@ function na(t, e, n) {
|
|
|
3108
3047
|
<section data-role="content">
|
|
3109
3048
|
<div class="flex justify-between items-center mb-4">
|
|
3110
3049
|
<h1 class="text-3xl font-bold tracking-tight">`, `</h1>
|
|
3111
|
-
<Button href="`, '" variant="outline">New ', `</Button>
|
|
3112
3050
|
</div>
|
|
3113
3051
|
|
|
3114
3052
|
<div class="space-y-4">
|
|
@@ -3176,55 +3114,55 @@ function na(t, e, n) {
|
|
|
3176
3114
|
<Pagination {table} />
|
|
3177
3115
|
</div>
|
|
3178
3116
|
</section>
|
|
3179
|
-
`])), 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());
|
|
3180
3118
|
}
|
|
3181
|
-
function
|
|
3182
|
-
const a =
|
|
3183
|
-
return
|
|
3119
|
+
function Qn(t, e, n) {
|
|
3120
|
+
const a = jt(e), r = a ? `{ expand: "${a}" }` : "";
|
|
3121
|
+
return u`
|
|
3184
3122
|
export const load = async ({ locals }) => {
|
|
3185
3123
|
const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${r});
|
|
3186
3124
|
return { ${t.pluralName} };
|
|
3187
3125
|
};
|
|
3188
3126
|
`;
|
|
3189
3127
|
}
|
|
3190
|
-
function
|
|
3191
|
-
const s =
|
|
3192
|
-
(
|
|
3193
|
-
),
|
|
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`
|
|
3194
3132
|
{
|
|
3195
3133
|
...form.data,
|
|
3196
|
-
${
|
|
3134
|
+
${m.name}: locals.pb.authStore.record?.id
|
|
3197
3135
|
}
|
|
3198
3136
|
` : "form.data";
|
|
3199
|
-
return
|
|
3137
|
+
return u`
|
|
3200
3138
|
import { fail, redirect } from "@sveltejs/kit";
|
|
3201
|
-
import { superValidate } from "sveltekit-superforms";
|
|
3202
|
-
import {
|
|
3139
|
+
import { superValidate${s ? ", withFiles" : ""} } from "sveltekit-superforms";
|
|
3140
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
3203
3141
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
3204
3142
|
import { ${t.schemaName} } from "$lib/schemas/${t.name}";
|
|
3205
3143
|
|
|
3206
3144
|
export const load = async ({ locals }) => {
|
|
3207
|
-
${
|
|
3208
|
-
return { form: await superValidate(
|
|
3145
|
+
${i}
|
|
3146
|
+
return { form: await superValidate(zod4(${t.schemaName}))${c} };
|
|
3209
3147
|
};
|
|
3210
3148
|
|
|
3211
3149
|
export const actions = {
|
|
3212
3150
|
default: async ({ locals, request }) => {
|
|
3213
|
-
const form = await superValidate(request,
|
|
3151
|
+
const form = await superValidate(request, zod4(${t.schemaName}));
|
|
3214
3152
|
|
|
3215
3153
|
if (!form.valid) {
|
|
3216
|
-
return fail(400, { form });
|
|
3154
|
+
return fail(400, ${s ? "withFiles({ form })" : "{ form }"});
|
|
3217
3155
|
}
|
|
3218
3156
|
|
|
3219
3157
|
let ${t.name};
|
|
3220
3158
|
|
|
3221
3159
|
try {
|
|
3222
3160
|
${t.name} = await ${a}.collection("${t.tableName}").create(
|
|
3223
|
-
${
|
|
3161
|
+
${h}
|
|
3224
3162
|
);
|
|
3225
3163
|
} catch (error) {
|
|
3226
3164
|
setPocketbaseErrors(form, error);
|
|
3227
|
-
return fail(400, { form });
|
|
3165
|
+
return fail(400, ${s ? "withFiles({ form })" : "{ form }"});
|
|
3228
3166
|
}
|
|
3229
3167
|
|
|
3230
3168
|
return redirect(303, \`${e.list}/\${${t.name}.id}\`);
|
|
@@ -3232,9 +3170,9 @@ function ra(t, e, n, a, r) {
|
|
|
3232
3170
|
};
|
|
3233
3171
|
`;
|
|
3234
3172
|
}
|
|
3235
|
-
function
|
|
3236
|
-
const r =
|
|
3237
|
-
return
|
|
3173
|
+
function ea(t, e, n, a) {
|
|
3174
|
+
const r = jt(n), s = r ? `, { expand: "${r}" }` : "";
|
|
3175
|
+
return u`
|
|
3238
3176
|
import { error, redirect } from "@sveltejs/kit";
|
|
3239
3177
|
|
|
3240
3178
|
export const load = async ({ locals, params }) => {
|
|
@@ -3254,7 +3192,7 @@ function oa(t, e, n, a) {
|
|
|
3254
3192
|
};
|
|
3255
3193
|
`;
|
|
3256
3194
|
}
|
|
3257
|
-
function
|
|
3195
|
+
function na(t, e, n) {
|
|
3258
3196
|
const a = n.some((m) => m.type === "select"), r = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
|
|
3259
3197
|
'import { Button } from "$lib/components/ui/button";',
|
|
3260
3198
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
@@ -3262,9 +3200,9 @@ function sa(t, e, n) {
|
|
|
3262
3200
|
r ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
|
|
3263
3201
|
s ? 'import FileIcon from "@lucide/svelte/icons/file";' : ""
|
|
3264
3202
|
].filter(Boolean).join(`
|
|
3265
|
-
`), o = dt(n), c = n.map((m) =>
|
|
3203
|
+
`), o = dt(n), c = n.map((m) => Fe(t, m)).join(`
|
|
3266
3204
|
`);
|
|
3267
|
-
return
|
|
3205
|
+
return u(Pt || (Pt = tt([`
|
|
3268
3206
|
<script lang="ts">
|
|
3269
3207
|
`, `
|
|
3270
3208
|
`, `
|
|
@@ -3298,13 +3236,13 @@ function sa(t, e, n) {
|
|
|
3298
3236
|
</section>
|
|
3299
3237
|
`])), i, o, t.displayName, e.list, c, e.list, t.name);
|
|
3300
3238
|
}
|
|
3301
|
-
function
|
|
3302
|
-
const r =
|
|
3303
|
-
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`
|
|
3304
3242
|
import { error, fail, redirect } from "@sveltejs/kit";
|
|
3305
3243
|
import { setPocketbaseErrors, setDefaultData } from "@velastack/pocketbase";
|
|
3306
|
-
import { superValidate } from "sveltekit-superforms";
|
|
3307
|
-
import {
|
|
3244
|
+
import { superValidate${r ? ", withFiles" : ""} } from "sveltekit-superforms";
|
|
3245
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
3308
3246
|
import { ${t.schemaName} } from "$lib/schemas/${t.name}";
|
|
3309
3247
|
|
|
3310
3248
|
export const load = async ({ locals, params }) => {
|
|
@@ -3314,18 +3252,18 @@ function ia(t, e, n, a) {
|
|
|
3314
3252
|
} catch {
|
|
3315
3253
|
throw error(404, "Not found");
|
|
3316
3254
|
}
|
|
3317
|
-
${
|
|
3318
|
-
return { form: await superValidate(${t.name},
|
|
3255
|
+
${s}
|
|
3256
|
+
return { form: await superValidate(${t.name}, zod4(${t.schemaName}))${o} };
|
|
3319
3257
|
};
|
|
3320
3258
|
|
|
3321
3259
|
export const actions = {
|
|
3322
3260
|
default: async ({ locals, params, request }) => {
|
|
3323
3261
|
const ${t.name} = await ${a}.collection("${t.tableName}").getOne(params.id);
|
|
3324
|
-
const form = await superValidate(request,
|
|
3262
|
+
const form = await superValidate(request, zod4(${t.schemaName}));
|
|
3325
3263
|
|
|
3326
3264
|
if (!form.valid) {
|
|
3327
3265
|
setDefaultData(form, ${t.name});
|
|
3328
|
-
return fail(400, { form });
|
|
3266
|
+
return fail(400, ${r ? "withFiles({ form })" : "{ form }"});
|
|
3329
3267
|
}
|
|
3330
3268
|
|
|
3331
3269
|
try {
|
|
@@ -3334,79 +3272,55 @@ function ia(t, e, n, a) {
|
|
|
3334
3272
|
} catch (error) {
|
|
3335
3273
|
setPocketbaseErrors(form, error);
|
|
3336
3274
|
setDefaultData(form, ${t.name});
|
|
3337
|
-
return fail(400, { form });
|
|
3275
|
+
return fail(400, ${r ? "withFiles({ form })" : "{ form }"});
|
|
3338
3276
|
}
|
|
3339
3277
|
},
|
|
3340
3278
|
};
|
|
3341
3279
|
`;
|
|
3342
3280
|
}
|
|
3343
|
-
async function
|
|
3344
|
-
Z(e)
|
|
3345
|
-
const a = D(e, t), r = t.env === "runtime" ? await (await import("./env.runtime-CSAfqDu4.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
|
|
3346
|
-
t
|
|
3347
|
-
);
|
|
3348
|
-
if (n.length > 0) {
|
|
3349
|
-
const i = await Y(n, a, t);
|
|
3350
|
-
return {
|
|
3351
|
-
model: a,
|
|
3352
|
-
fields: i.fields,
|
|
3353
|
-
auth: i.auth,
|
|
3354
|
-
shouldCreateCollection: !0,
|
|
3355
|
-
collections: r
|
|
3356
|
-
};
|
|
3357
|
-
}
|
|
3358
|
-
const s = mt(a, r, t);
|
|
3359
|
-
return {
|
|
3360
|
-
model: a,
|
|
3361
|
-
fields: s,
|
|
3362
|
-
auth: void 0,
|
|
3363
|
-
shouldCreateCollection: !1,
|
|
3364
|
-
collections: r
|
|
3365
|
-
};
|
|
3366
|
-
}
|
|
3367
|
-
async function ca(t) {
|
|
3368
|
-
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(
|
|
3369
3283
|
(d) => !(d.type === "relation" && d.isCurrentUser)
|
|
3370
|
-
),
|
|
3284
|
+
), g = [
|
|
3371
3285
|
k(
|
|
3372
3286
|
`src/lib/schemas/${a.name}.ts`,
|
|
3373
|
-
|
|
3287
|
+
Q(a, r, {
|
|
3374
3288
|
includeModelFields: !0,
|
|
3375
3289
|
forForm: !0
|
|
3376
3290
|
})
|
|
3377
3291
|
),
|
|
3378
3292
|
k(
|
|
3379
3293
|
`${c.list}/+page.server.ts`,
|
|
3380
|
-
|
|
3294
|
+
Qn(a, p, h)
|
|
3381
3295
|
),
|
|
3382
3296
|
k(
|
|
3383
3297
|
`${c.list}/+page.svelte`,
|
|
3384
|
-
|
|
3298
|
+
Zn(a, m, p)
|
|
3385
3299
|
),
|
|
3386
3300
|
k(
|
|
3387
3301
|
`${c.new}/+page.server.ts`,
|
|
3388
|
-
|
|
3302
|
+
ta(a, m, p, h, t.features.auth)
|
|
3389
3303
|
),
|
|
3390
|
-
k(`${c.new}/+page.svelte`,
|
|
3304
|
+
k(`${c.new}/+page.svelte`, Jn(a, m, p)),
|
|
3391
3305
|
k(
|
|
3392
3306
|
`${c.show}/+page.server.ts`,
|
|
3393
|
-
|
|
3307
|
+
ea(a, m, p, h)
|
|
3394
3308
|
),
|
|
3395
3309
|
k(
|
|
3396
3310
|
`${c.show}/+page.svelte`,
|
|
3397
|
-
|
|
3311
|
+
na(a, m, p)
|
|
3398
3312
|
),
|
|
3399
3313
|
k(
|
|
3400
3314
|
`${c.edit}/+page.server.ts`,
|
|
3401
|
-
|
|
3315
|
+
aa(a, m, p, h)
|
|
3402
3316
|
),
|
|
3403
3317
|
k(
|
|
3404
3318
|
`${c.edit}/+page.svelte`,
|
|
3405
|
-
|
|
3319
|
+
Yn(a, m, p)
|
|
3406
3320
|
),
|
|
3407
3321
|
k(
|
|
3408
3322
|
`${c.list}/server.test.ts`,
|
|
3409
|
-
|
|
3323
|
+
fn(
|
|
3410
3324
|
a,
|
|
3411
3325
|
m,
|
|
3412
3326
|
r,
|
|
@@ -3415,7 +3329,7 @@ async function ca(t) {
|
|
|
3415
3329
|
)
|
|
3416
3330
|
)
|
|
3417
3331
|
], y = [
|
|
3418
|
-
...
|
|
3332
|
+
...N(p),
|
|
3419
3333
|
"button",
|
|
3420
3334
|
"table",
|
|
3421
3335
|
"data-table",
|
|
@@ -3433,33 +3347,33 @@ async function ca(t) {
|
|
|
3433
3347
|
"row-actions"
|
|
3434
3348
|
];
|
|
3435
3349
|
return {
|
|
3436
|
-
creates:
|
|
3350
|
+
creates: g,
|
|
3437
3351
|
modifies: [],
|
|
3438
3352
|
deletes: [],
|
|
3439
3353
|
components: [...new Set(y)],
|
|
3440
3354
|
packages: ["@tanstack/table-core"],
|
|
3441
|
-
collections: i ? [
|
|
3355
|
+
collections: i ? [Nt(a, r, s)] : []
|
|
3442
3356
|
};
|
|
3443
3357
|
}
|
|
3444
|
-
const
|
|
3445
|
-
async function
|
|
3446
|
-
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);
|
|
3447
3361
|
if (t.env !== "runtime")
|
|
3448
3362
|
return $(e);
|
|
3449
|
-
const { createCollections: n } = await import("./collections-
|
|
3363
|
+
const { createCollections: n } = await import("./collections-Ch4kZjuV.js"), a = await n(
|
|
3450
3364
|
e.collections,
|
|
3451
3365
|
t
|
|
3452
3366
|
), r = {
|
|
3453
3367
|
...e,
|
|
3454
3368
|
creates: [...e.creates, ...a]
|
|
3455
|
-
}, { writeResult: s } = await import("./write-result-
|
|
3369
|
+
}, { writeResult: s } = await import("./write-result-1Q3LB_k4.js");
|
|
3456
3370
|
return s(await $(r), t);
|
|
3457
3371
|
}
|
|
3458
|
-
const
|
|
3459
|
-
version:
|
|
3460
|
-
slug:
|
|
3461
|
-
source:
|
|
3462
|
-
docs:
|
|
3372
|
+
const ma = {
|
|
3373
|
+
version: sa,
|
|
3374
|
+
slug: oa,
|
|
3375
|
+
source: ia,
|
|
3376
|
+
docs: la,
|
|
3463
3377
|
plan: "open",
|
|
3464
3378
|
title: "Generate a scaffold",
|
|
3465
3379
|
summary: "Generates CRUD routes and schema.",
|
|
@@ -3480,44 +3394,32 @@ const ga = {
|
|
|
3480
3394
|
},
|
|
3481
3395
|
tests: 7,
|
|
3482
3396
|
baseline: "velastack",
|
|
3483
|
-
generate:
|
|
3397
|
+
generate: ca
|
|
3484
3398
|
};
|
|
3485
|
-
function
|
|
3399
|
+
function da(t) {
|
|
3486
3400
|
const [e, ...n] = t;
|
|
3487
3401
|
if (!e)
|
|
3488
3402
|
throw new Error("Invalid command arguments. Expected: <model> [fields...]");
|
|
3489
3403
|
return { modelPath: e, fields: n };
|
|
3490
3404
|
}
|
|
3491
|
-
function
|
|
3405
|
+
function pa(t, e) {
|
|
3492
3406
|
return {
|
|
3493
3407
|
path: t,
|
|
3494
3408
|
language: S(t),
|
|
3495
3409
|
content: e
|
|
3496
3410
|
};
|
|
3497
3411
|
}
|
|
3498
|
-
async function
|
|
3499
|
-
Z(
|
|
3500
|
-
const a = D(e, t);
|
|
3501
|
-
if (n.length > 0) {
|
|
3502
|
-
const i = await Y(n, a, t);
|
|
3503
|
-
return { model: a, fields: i.fields, includeModelFields: !1 };
|
|
3504
|
-
}
|
|
3505
|
-
const r = t.env === "runtime" ? await (await import("./env.runtime-CSAfqDu4.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
|
|
3506
|
-
t
|
|
3507
|
-
), s = mt(a, r, t);
|
|
3508
|
-
return { model: a, fields: s, includeModelFields: !0 };
|
|
3509
|
-
}
|
|
3510
|
-
async function wa(t) {
|
|
3511
|
-
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(
|
|
3512
3414
|
t,
|
|
3513
3415
|
e,
|
|
3514
3416
|
n
|
|
3515
|
-
), i = `src/lib/schemas/${a.name}.ts`, o =
|
|
3516
|
-
includeModelFields: s,
|
|
3417
|
+
), i = `src/lib/schemas/${a.name}.ts`, o = Q(a, r, {
|
|
3418
|
+
includeModelFields: !s,
|
|
3517
3419
|
forForm: !0
|
|
3518
3420
|
});
|
|
3519
3421
|
return {
|
|
3520
|
-
creates: [
|
|
3422
|
+
creates: [pa(i, o)],
|
|
3521
3423
|
modifies: [],
|
|
3522
3424
|
deletes: [],
|
|
3523
3425
|
components: [],
|
|
@@ -3525,19 +3427,19 @@ async function wa(t) {
|
|
|
3525
3427
|
collections: []
|
|
3526
3428
|
};
|
|
3527
3429
|
}
|
|
3528
|
-
const
|
|
3529
|
-
async function
|
|
3530
|
-
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);
|
|
3531
3433
|
if (t.env !== "runtime")
|
|
3532
3434
|
return $(e);
|
|
3533
|
-
const { writeResult: n } = await import("./write-result-
|
|
3435
|
+
const { writeResult: n } = await import("./write-result-1Q3LB_k4.js");
|
|
3534
3436
|
return n(await $(e), t);
|
|
3535
3437
|
}
|
|
3536
|
-
const
|
|
3537
|
-
version:
|
|
3538
|
-
slug:
|
|
3539
|
-
source:
|
|
3540
|
-
docs:
|
|
3438
|
+
const wa = {
|
|
3439
|
+
version: ga,
|
|
3440
|
+
slug: fa,
|
|
3441
|
+
source: ha,
|
|
3442
|
+
docs: ba,
|
|
3541
3443
|
plan: "open",
|
|
3542
3444
|
title: "Generate a schema",
|
|
3543
3445
|
summary: "Generates a zod schema.",
|
|
@@ -3558,8 +3460,8 @@ const Sa = {
|
|
|
3558
3460
|
},
|
|
3559
3461
|
tests: 0,
|
|
3560
3462
|
baseline: "velastack",
|
|
3561
|
-
generate:
|
|
3562
|
-
},
|
|
3463
|
+
generate: va
|
|
3464
|
+
}, xa = `<script lang="ts">
|
|
3563
3465
|
import type { ComponentProps } from 'svelte';
|
|
3564
3466
|
import HomeIcon from '@lucide/svelte/icons/home';
|
|
3565
3467
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
@@ -3612,7 +3514,7 @@ const Sa = {
|
|
|
3612
3514
|
<NavUser {user} />
|
|
3613
3515
|
</Sidebar.Footer>
|
|
3614
3516
|
</Sidebar.Root>
|
|
3615
|
-
`,
|
|
3517
|
+
`, ya = `<script lang="ts">
|
|
3616
3518
|
import type { Component } from 'svelte';
|
|
3617
3519
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3618
3520
|
import { page } from '$app/state';
|
|
@@ -3652,7 +3554,7 @@ const Sa = {
|
|
|
3652
3554
|
{/each}
|
|
3653
3555
|
</Sidebar.Menu>
|
|
3654
3556
|
</Sidebar.Group>
|
|
3655
|
-
`,
|
|
3557
|
+
`, $a = `<script lang="ts">
|
|
3656
3558
|
import { toggleMode, mode } from 'mode-watcher';
|
|
3657
3559
|
import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';
|
|
3658
3560
|
import Settings2Icon from '@lucide/svelte/icons/settings-2';
|
|
@@ -3768,12 +3670,12 @@ const Sa = {
|
|
|
3768
3670
|
</DropdownMenu.Root>
|
|
3769
3671
|
</Sidebar.MenuItem>
|
|
3770
3672
|
</Sidebar.Menu>
|
|
3771
|
-
`,
|
|
3673
|
+
`, _a = `import { z } from "zod";
|
|
3772
3674
|
|
|
3773
3675
|
export const changeEmailSchema = z.object({
|
|
3774
|
-
email: z.
|
|
3676
|
+
email: z.email(),
|
|
3775
3677
|
});
|
|
3776
|
-
`,
|
|
3678
|
+
`, Ca = `import { z } from "zod";
|
|
3777
3679
|
|
|
3778
3680
|
export const changePasswordSchema = z
|
|
3779
3681
|
.object({
|
|
@@ -3784,33 +3686,33 @@ export const changePasswordSchema = z
|
|
|
3784
3686
|
message: "Passwords don't match",
|
|
3785
3687
|
path: ["passwordConfirm"],
|
|
3786
3688
|
});
|
|
3787
|
-
`,
|
|
3689
|
+
`, Sa = `import { z } from "zod";
|
|
3788
3690
|
|
|
3789
3691
|
export const confirmEmailChangeSchema = z.object({
|
|
3790
3692
|
password: z.string(),
|
|
3791
3693
|
});
|
|
3792
|
-
`,
|
|
3694
|
+
`, Fa = `import { z } from "zod";
|
|
3793
3695
|
|
|
3794
3696
|
export const confirmResetSchema = z.object({
|
|
3795
3697
|
password: z.string(),
|
|
3796
3698
|
passwordConfirm: z.string(),
|
|
3797
3699
|
});
|
|
3798
|
-
`,
|
|
3700
|
+
`, ka = `import { z } from "zod";
|
|
3799
3701
|
|
|
3800
3702
|
const otpSchema = z.object({
|
|
3801
3703
|
type: z.literal("otp"),
|
|
3802
|
-
email: z.
|
|
3704
|
+
email: z.email(),
|
|
3803
3705
|
});
|
|
3804
3706
|
|
|
3805
3707
|
const passwordSchema = z.object({
|
|
3806
3708
|
type: z.literal("password"),
|
|
3807
|
-
email: z.
|
|
3709
|
+
email: z.email(),
|
|
3808
3710
|
password: z.string(),
|
|
3809
3711
|
});
|
|
3810
3712
|
|
|
3811
3713
|
const oAuth2Schema = z.object({
|
|
3812
3714
|
type: z.literal("oauth2"),
|
|
3813
|
-
email: z.
|
|
3715
|
+
email: z.email(),
|
|
3814
3716
|
});
|
|
3815
3717
|
|
|
3816
3718
|
export const loginSchema = z.discriminatedUnion("type", [
|
|
@@ -3818,37 +3720,37 @@ export const loginSchema = z.discriminatedUnion("type", [
|
|
|
3818
3720
|
passwordSchema,
|
|
3819
3721
|
oAuth2Schema,
|
|
3820
3722
|
]);
|
|
3821
|
-
`,
|
|
3723
|
+
`, Ra = `import { z } from "zod";
|
|
3822
3724
|
|
|
3823
3725
|
export const otpSchema = z.object({
|
|
3824
3726
|
otp: z.string(),
|
|
3825
3727
|
});
|
|
3826
|
-
`,
|
|
3728
|
+
`, Ia = `import { z } from "zod";
|
|
3827
3729
|
|
|
3828
3730
|
export const profileSchema = z.object({
|
|
3829
3731
|
name: z.string().optional(),
|
|
3830
3732
|
avatar: z.union([z.instanceof(File), z.string()]).optional(),
|
|
3831
3733
|
emailVisibility: z.boolean().optional(),
|
|
3832
3734
|
});
|
|
3833
|
-
`,
|
|
3735
|
+
`, Ma = `import { z } from "zod";
|
|
3834
3736
|
|
|
3835
3737
|
export const resetSchema = z.object({
|
|
3836
|
-
email: z.
|
|
3738
|
+
email: z.email(),
|
|
3837
3739
|
});
|
|
3838
|
-
`,
|
|
3740
|
+
`, Pa = `import { z } from "zod";
|
|
3839
3741
|
|
|
3840
3742
|
export const signupSchema = z.object({
|
|
3841
|
-
email: z.
|
|
3743
|
+
email: z.email(),
|
|
3842
3744
|
password: z.string(),
|
|
3843
3745
|
passwordConfirm: z.string(),
|
|
3844
3746
|
});
|
|
3845
|
-
`,
|
|
3747
|
+
`, Ta = `export const load = ({ locals }) => {
|
|
3846
3748
|
const user = locals.pb.authStore.record!;
|
|
3847
3749
|
const breadcrumbs = [{ title: "Home", url: "/dashboard" }];
|
|
3848
3750
|
|
|
3849
3751
|
return { user, breadcrumbs };
|
|
3850
3752
|
};
|
|
3851
|
-
`,
|
|
3753
|
+
`, Ea = `<script lang="ts">
|
|
3852
3754
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3853
3755
|
import { Separator } from '$lib/components/ui/separator';
|
|
3854
3756
|
import AppSidebar from '$lib/components/app-sidebar.svelte';
|
|
@@ -3898,7 +3800,7 @@ export const signupSchema = z.object({
|
|
|
3898
3800
|
background-color: var(--color-sidebar);
|
|
3899
3801
|
}
|
|
3900
3802
|
</style>
|
|
3901
|
-
`,
|
|
3803
|
+
`, Da = "", Ba = `import { describe, it, expect } from "vitest";
|
|
3902
3804
|
import type { Match } from "@velastack/pocketbase";
|
|
3903
3805
|
import type { RouteId } from "./$types";
|
|
3904
3806
|
|
|
@@ -3919,15 +3821,15 @@ describe("dashboard", () => {
|
|
|
3919
3821
|
expect(response.status).toBe(200);
|
|
3920
3822
|
});
|
|
3921
3823
|
});
|
|
3922
|
-
`,
|
|
3824
|
+
`, Aa = `export const load = async ({ parent }) => {
|
|
3923
3825
|
const { breadcrumbs } = await parent();
|
|
3924
3826
|
|
|
3925
3827
|
return {
|
|
3926
3828
|
breadcrumbs: [...breadcrumbs, { title: "Settings", url: "/settings" }],
|
|
3927
3829
|
};
|
|
3928
3830
|
};
|
|
3929
|
-
`,
|
|
3930
|
-
import {
|
|
3831
|
+
`, za = `import { superValidate, fail, withFiles } from "sveltekit-superforms";
|
|
3832
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
3931
3833
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
3932
3834
|
import { profileSchema } from "$lib/schemas/profile";
|
|
3933
3835
|
import { changeEmailSchema } from "$lib/schemas/changeEmail";
|
|
@@ -3942,17 +3844,17 @@ export const load = async ({ parent }) => {
|
|
|
3942
3844
|
name: user.name,
|
|
3943
3845
|
emailVisibility: user.emailVisibility,
|
|
3944
3846
|
},
|
|
3945
|
-
|
|
3847
|
+
zod4(profileSchema),
|
|
3946
3848
|
);
|
|
3947
|
-
const emailForm = await superValidate(
|
|
3948
|
-
const passwordForm = await superValidate(
|
|
3849
|
+
const emailForm = await superValidate(zod4(changeEmailSchema));
|
|
3850
|
+
const passwordForm = await superValidate(zod4(changePasswordSchema));
|
|
3949
3851
|
|
|
3950
3852
|
return { profileForm, emailForm, passwordForm, user };
|
|
3951
3853
|
};
|
|
3952
3854
|
|
|
3953
3855
|
export const actions = {
|
|
3954
3856
|
updateProfile: async ({ locals, request, cookies }) => {
|
|
3955
|
-
const form = await superValidate(request,
|
|
3857
|
+
const form = await superValidate(request, zod4(profileSchema));
|
|
3956
3858
|
|
|
3957
3859
|
if (!form.valid) {
|
|
3958
3860
|
return fail(400, { profileForm: form });
|
|
@@ -3969,7 +3871,7 @@ export const actions = {
|
|
|
3969
3871
|
return withFiles({ profileForm: form });
|
|
3970
3872
|
},
|
|
3971
3873
|
changeEmail: async ({ locals, request, cookies }) => {
|
|
3972
|
-
const form = await superValidate(request,
|
|
3874
|
+
const form = await superValidate(request, zod4(changeEmailSchema));
|
|
3973
3875
|
|
|
3974
3876
|
if (!form.valid) {
|
|
3975
3877
|
return fail(400, { emailForm: form });
|
|
@@ -3986,7 +3888,7 @@ export const actions = {
|
|
|
3986
3888
|
return { emailForm: form };
|
|
3987
3889
|
},
|
|
3988
3890
|
changePassword: async ({ locals, request, cookies }) => {
|
|
3989
|
-
const form = await superValidate(request,
|
|
3891
|
+
const form = await superValidate(request, zod4(changePasswordSchema));
|
|
3990
3892
|
|
|
3991
3893
|
if (!form.valid) {
|
|
3992
3894
|
return fail(400, { passwordForm: form });
|
|
@@ -4016,10 +3918,10 @@ export const actions = {
|
|
|
4016
3918
|
return {};
|
|
4017
3919
|
},
|
|
4018
3920
|
};
|
|
4019
|
-
`,
|
|
3921
|
+
`, La = `<script lang="ts">
|
|
4020
3922
|
import { untrack } from 'svelte';
|
|
4021
3923
|
import { superForm } from 'sveltekit-superforms';
|
|
4022
|
-
import {
|
|
3924
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
4023
3925
|
import { changeEmailSchema } from '$lib/schemas/changeEmail';
|
|
4024
3926
|
import { changePasswordSchema } from '$lib/schemas/changePassword';
|
|
4025
3927
|
import { profileSchema } from '$lib/schemas/profile';
|
|
@@ -4038,7 +3940,7 @@ export const actions = {
|
|
|
4038
3940
|
const profileForm = superForm(
|
|
4039
3941
|
untrack(() => data.profileForm),
|
|
4040
3942
|
{
|
|
4041
|
-
validators:
|
|
3943
|
+
validators: zod4Client(profileSchema),
|
|
4042
3944
|
id: 'profileForm'
|
|
4043
3945
|
}
|
|
4044
3946
|
);
|
|
@@ -4046,7 +3948,7 @@ export const actions = {
|
|
|
4046
3948
|
const emailForm = superForm(
|
|
4047
3949
|
untrack(() => data.emailForm),
|
|
4048
3950
|
{
|
|
4049
|
-
validators:
|
|
3951
|
+
validators: zod4Client(changeEmailSchema),
|
|
4050
3952
|
id: 'emailForm'
|
|
4051
3953
|
}
|
|
4052
3954
|
);
|
|
@@ -4054,7 +3956,7 @@ export const actions = {
|
|
|
4054
3956
|
const passwordForm = superForm(
|
|
4055
3957
|
untrack(() => data.passwordForm),
|
|
4056
3958
|
{
|
|
4057
|
-
validators:
|
|
3959
|
+
validators: zod4Client(changePasswordSchema),
|
|
4058
3960
|
id: 'passwordForm'
|
|
4059
3961
|
}
|
|
4060
3962
|
);
|
|
@@ -4294,19 +4196,19 @@ export const actions = {
|
|
|
4294
4196
|
</form>
|
|
4295
4197
|
</div>
|
|
4296
4198
|
</div>
|
|
4297
|
-
`,
|
|
4298
|
-
import {
|
|
4199
|
+
`, Oa = `import { fail, superValidate } from "sveltekit-superforms";
|
|
4200
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
4299
4201
|
import { confirmEmailChangeSchema } from "$lib/schemas/confirmEmailChange";
|
|
4300
4202
|
import { redirect } from "@sveltejs/kit";
|
|
4301
4203
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
4302
4204
|
|
|
4303
4205
|
export const load = async () => {
|
|
4304
|
-
return { form: await superValidate(
|
|
4206
|
+
return { form: await superValidate(zod4(confirmEmailChangeSchema)) };
|
|
4305
4207
|
};
|
|
4306
4208
|
|
|
4307
4209
|
export const actions = {
|
|
4308
4210
|
default: async ({ locals, params, request, cookies }) => {
|
|
4309
|
-
const form = await superValidate(request,
|
|
4211
|
+
const form = await superValidate(request, zod4(confirmEmailChangeSchema));
|
|
4310
4212
|
|
|
4311
4213
|
if (!form.valid) {
|
|
4312
4214
|
return fail(400, { form });
|
|
@@ -4326,12 +4228,12 @@ export const actions = {
|
|
|
4326
4228
|
return redirect(303, "/login");
|
|
4327
4229
|
},
|
|
4328
4230
|
};
|
|
4329
|
-
`,
|
|
4231
|
+
`, Ua = `<script lang="ts">
|
|
4330
4232
|
import { untrack } from 'svelte';
|
|
4331
4233
|
import { Button } from '$lib/components/ui/button';
|
|
4332
4234
|
import * as Card from '$lib/components/ui/card';
|
|
4333
4235
|
import { superForm } from 'sveltekit-superforms';
|
|
4334
|
-
import {
|
|
4236
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
4335
4237
|
import { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';
|
|
4336
4238
|
import * as Form from '$lib/components/ui/form';
|
|
4337
4239
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -4341,7 +4243,7 @@ export const actions = {
|
|
|
4341
4243
|
const form = superForm(
|
|
4342
4244
|
untrack(() => data.form),
|
|
4343
4245
|
{
|
|
4344
|
-
validators:
|
|
4246
|
+
validators: zod4Client(confirmEmailChangeSchema)
|
|
4345
4247
|
}
|
|
4346
4248
|
);
|
|
4347
4249
|
|
|
@@ -4394,7 +4296,7 @@ export const actions = {
|
|
|
4394
4296
|
</div>
|
|
4395
4297
|
</div>
|
|
4396
4298
|
</div>
|
|
4397
|
-
`,
|
|
4299
|
+
`, ja = `import { describe, it, expect } from "vitest";
|
|
4398
4300
|
import type { Match } from "@velastack/pocketbase";
|
|
4399
4301
|
import type { RouteId } from "./$types";
|
|
4400
4302
|
|
|
@@ -4406,19 +4308,19 @@ describe("GET /confirm-email-change/[token]", () => {
|
|
|
4406
4308
|
expect(response.status).toBe(200);
|
|
4407
4309
|
});
|
|
4408
4310
|
});
|
|
4409
|
-
`,
|
|
4410
|
-
import {
|
|
4311
|
+
`, qa = `import { fail, superValidate } from "sveltekit-superforms";
|
|
4312
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
4411
4313
|
import { confirmResetSchema } from "$lib/schemas/confirmReset";
|
|
4412
4314
|
import { redirect } from "@sveltejs/kit";
|
|
4413
4315
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
4414
4316
|
|
|
4415
4317
|
export const load = async () => {
|
|
4416
|
-
return { form: await superValidate(
|
|
4318
|
+
return { form: await superValidate(zod4(confirmResetSchema)) };
|
|
4417
4319
|
};
|
|
4418
4320
|
|
|
4419
4321
|
export const actions = {
|
|
4420
4322
|
default: async ({ locals, request, params, cookies }) => {
|
|
4421
|
-
const form = await superValidate(request,
|
|
4323
|
+
const form = await superValidate(request, zod4(confirmResetSchema));
|
|
4422
4324
|
|
|
4423
4325
|
if (!form.valid) {
|
|
4424
4326
|
return fail(400, { form });
|
|
@@ -4442,12 +4344,12 @@ export const actions = {
|
|
|
4442
4344
|
return redirect(303, "/login");
|
|
4443
4345
|
},
|
|
4444
4346
|
};
|
|
4445
|
-
`,
|
|
4347
|
+
`, Na = `<script lang="ts">
|
|
4446
4348
|
import { untrack } from 'svelte';
|
|
4447
4349
|
import { Button } from '$lib/components/ui/button';
|
|
4448
4350
|
import * as Card from '$lib/components/ui/card';
|
|
4449
4351
|
import { superForm } from 'sveltekit-superforms';
|
|
4450
|
-
import {
|
|
4352
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
4451
4353
|
import { confirmResetSchema } from '$lib/schemas/confirmReset';
|
|
4452
4354
|
import * as Form from '$lib/components/ui/form';
|
|
4453
4355
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -4457,7 +4359,7 @@ export const actions = {
|
|
|
4457
4359
|
const form = superForm(
|
|
4458
4360
|
untrack(() => data.form),
|
|
4459
4361
|
{
|
|
4460
|
-
validators:
|
|
4362
|
+
validators: zod4Client(confirmResetSchema)
|
|
4461
4363
|
}
|
|
4462
4364
|
);
|
|
4463
4365
|
|
|
@@ -4526,7 +4428,7 @@ export const actions = {
|
|
|
4526
4428
|
</div>
|
|
4527
4429
|
</div>
|
|
4528
4430
|
</div>
|
|
4529
|
-
`,
|
|
4431
|
+
`, Va = `import { describe, it, expect } from "vitest";
|
|
4530
4432
|
import type { Match } from "@velastack/pocketbase";
|
|
4531
4433
|
import type { RouteId } from "./$types";
|
|
4532
4434
|
|
|
@@ -4538,7 +4440,7 @@ describe("GET /confirm-reset/[token]", () => {
|
|
|
4538
4440
|
expect(response.status).toBe(200);
|
|
4539
4441
|
});
|
|
4540
4442
|
});
|
|
4541
|
-
`,
|
|
4443
|
+
`, Ha = `import { redirect } from "@sveltejs/kit";
|
|
4542
4444
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
4543
4445
|
|
|
4544
4446
|
export const GET = async ({ params, locals, cookies }) => {
|
|
@@ -4558,7 +4460,7 @@ export const GET = async ({ params, locals, cookies }) => {
|
|
|
4558
4460
|
setFlash({ type: "toast", message }, cookies);
|
|
4559
4461
|
redirect(303, redirectPath);
|
|
4560
4462
|
};
|
|
4561
|
-
`,
|
|
4463
|
+
`, Ka = `import { describe, it, expect } from "vitest";
|
|
4562
4464
|
import type { Match } from "@velastack/pocketbase";
|
|
4563
4465
|
import type { RouteId } from "./$types";
|
|
4564
4466
|
|
|
@@ -4571,8 +4473,8 @@ describe("GET /confirm-verification/[token]", () => {
|
|
|
4571
4473
|
expect(response.headers["location"]).toBe("/login");
|
|
4572
4474
|
});
|
|
4573
4475
|
});
|
|
4574
|
-
`,
|
|
4575
|
-
import {
|
|
4476
|
+
`, Ga = `import { fail, superValidate, message } from "sveltekit-superforms";
|
|
4477
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
4576
4478
|
import { loginSchema } from "$lib/schemas/login";
|
|
4577
4479
|
import { redirect } from "@sveltejs/kit";
|
|
4578
4480
|
import { dev } from "$app/environment";
|
|
@@ -4592,7 +4494,7 @@ export const load = async ({ locals }) => {
|
|
|
4592
4494
|
|
|
4593
4495
|
return {
|
|
4594
4496
|
form: await superValidate(
|
|
4595
|
-
|
|
4497
|
+
zod4(loginSchema.default({ type, email: "", password: "" })),
|
|
4596
4498
|
),
|
|
4597
4499
|
authMethods,
|
|
4598
4500
|
};
|
|
@@ -4600,7 +4502,7 @@ export const load = async ({ locals }) => {
|
|
|
4600
4502
|
|
|
4601
4503
|
export const actions = {
|
|
4602
4504
|
default: async ({ locals, request, cookies, url }) => {
|
|
4603
|
-
const form = await superValidate(request,
|
|
4505
|
+
const form = await superValidate(request, zod4(loginSchema));
|
|
4604
4506
|
|
|
4605
4507
|
if (!form.valid) {
|
|
4606
4508
|
return fail(400, { form });
|
|
@@ -4642,12 +4544,12 @@ export const actions = {
|
|
|
4642
4544
|
redirect(303, redirectUrl);
|
|
4643
4545
|
},
|
|
4644
4546
|
};
|
|
4645
|
-
`,
|
|
4547
|
+
`, Wa = `<script lang="ts">
|
|
4646
4548
|
import { untrack } from 'svelte';
|
|
4647
4549
|
import { Button } from '$lib/components/ui/button';
|
|
4648
4550
|
import * as Card from '$lib/components/ui/card';
|
|
4649
4551
|
import { superForm } from 'sveltekit-superforms';
|
|
4650
|
-
import {
|
|
4552
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
4651
4553
|
import { loginSchema } from '$lib/schemas/login';
|
|
4652
4554
|
import * as Form from '$lib/components/ui/form';
|
|
4653
4555
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -4665,7 +4567,7 @@ export const actions = {
|
|
|
4665
4567
|
const form = superForm(
|
|
4666
4568
|
untrack(() => data.form),
|
|
4667
4569
|
{
|
|
4668
|
-
validators:
|
|
4570
|
+
validators: zod4Client(loginSchema)
|
|
4669
4571
|
}
|
|
4670
4572
|
);
|
|
4671
4573
|
|
|
@@ -4825,7 +4727,7 @@ export const actions = {
|
|
|
4825
4727
|
</div>
|
|
4826
4728
|
</div>
|
|
4827
4729
|
</div>
|
|
4828
|
-
`,
|
|
4730
|
+
`, Xa = `import { describe, it, expect } from "vitest";
|
|
4829
4731
|
import * as devalue from "devalue";
|
|
4830
4732
|
import type { Match } from "@velastack/pocketbase";
|
|
4831
4733
|
import type { RouteId } from "./$types";
|
|
@@ -4872,14 +4774,14 @@ describe("POST /login", () => {
|
|
|
4872
4774
|
expect(data.form.message.text).toBe("Failed to authenticate.");
|
|
4873
4775
|
});
|
|
4874
4776
|
});
|
|
4875
|
-
`,
|
|
4777
|
+
`, Ja = `import { redirect } from "@sveltejs/kit";
|
|
4876
4778
|
|
|
4877
4779
|
export const POST = ({ cookies, locals }) => {
|
|
4878
4780
|
locals.pb.authStore.clear();
|
|
4879
4781
|
locals.pb.authStore.clearCookie(cookies);
|
|
4880
4782
|
throw redirect(303, "/");
|
|
4881
4783
|
};
|
|
4882
|
-
`,
|
|
4784
|
+
`, Ya = `import { describe, it, expect } from "vitest";
|
|
4883
4785
|
import type { Match } from "@velastack/pocketbase";
|
|
4884
4786
|
import type { RouteId } from "./$types";
|
|
4885
4787
|
|
|
@@ -4893,8 +4795,8 @@ describe("POST /logout", () => {
|
|
|
4893
4795
|
expect(response.headers.location).toBe("/");
|
|
4894
4796
|
});
|
|
4895
4797
|
});
|
|
4896
|
-
`,
|
|
4897
|
-
import {
|
|
4798
|
+
`, Za = `import { fail, message, superValidate } from "sveltekit-superforms";
|
|
4799
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
4898
4800
|
import { otpSchema } from "$lib/schemas/otp";
|
|
4899
4801
|
import { redirect } from "@sveltejs/kit";
|
|
4900
4802
|
import { dev } from "$app/environment";
|
|
@@ -4904,12 +4806,12 @@ export const load = async ({ locals }) => {
|
|
|
4904
4806
|
redirect(303, "/dashboard");
|
|
4905
4807
|
}
|
|
4906
4808
|
|
|
4907
|
-
return { form: await superValidate(
|
|
4809
|
+
return { form: await superValidate(zod4(otpSchema)) };
|
|
4908
4810
|
};
|
|
4909
4811
|
|
|
4910
4812
|
export const actions = {
|
|
4911
4813
|
default: async ({ locals, request, params, cookies, url }) => {
|
|
4912
|
-
const form = await superValidate(request,
|
|
4814
|
+
const form = await superValidate(request, zod4(otpSchema));
|
|
4913
4815
|
|
|
4914
4816
|
if (!form.valid) {
|
|
4915
4817
|
return fail(400, { form });
|
|
@@ -4940,12 +4842,12 @@ export const actions = {
|
|
|
4940
4842
|
redirect(303, redirectUrl);
|
|
4941
4843
|
},
|
|
4942
4844
|
};
|
|
4943
|
-
`,
|
|
4845
|
+
`, Qa = `<script lang="ts">
|
|
4944
4846
|
import { untrack } from 'svelte';
|
|
4945
4847
|
import { Button } from '$lib/components/ui/button';
|
|
4946
4848
|
import * as Card from '$lib/components/ui/card';
|
|
4947
4849
|
import { superForm } from 'sveltekit-superforms';
|
|
4948
|
-
import {
|
|
4850
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
4949
4851
|
import { otpSchema } from '$lib/schemas/otp';
|
|
4950
4852
|
import * as Form from '$lib/components/ui/form';
|
|
4951
4853
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -4955,7 +4857,7 @@ export const actions = {
|
|
|
4955
4857
|
const form = superForm(
|
|
4956
4858
|
untrack(() => data.form),
|
|
4957
4859
|
{
|
|
4958
|
-
validators:
|
|
4860
|
+
validators: zod4Client(otpSchema)
|
|
4959
4861
|
}
|
|
4960
4862
|
);
|
|
4961
4863
|
|
|
@@ -5006,7 +4908,7 @@ export const actions = {
|
|
|
5006
4908
|
</div>
|
|
5007
4909
|
</div>
|
|
5008
4910
|
</div>
|
|
5009
|
-
`,
|
|
4911
|
+
`, tr = `import { describe, it, expect } from "vitest";
|
|
5010
4912
|
import type { Match } from "@velastack/pocketbase";
|
|
5011
4913
|
import type { RouteId } from "./$types";
|
|
5012
4914
|
|
|
@@ -5028,8 +4930,8 @@ describe("POST /otp/[token]", () => {
|
|
|
5028
4930
|
expect(response.body.status).toBe(400);
|
|
5029
4931
|
});
|
|
5030
4932
|
});
|
|
5031
|
-
`,
|
|
5032
|
-
import {
|
|
4933
|
+
`, er = `import { fail, superValidate } from "sveltekit-superforms";
|
|
4934
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
5033
4935
|
import { resetSchema } from "$lib/schemas/reset";
|
|
5034
4936
|
import { redirect } from "@sveltejs/kit";
|
|
5035
4937
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
@@ -5039,12 +4941,12 @@ export const load = async ({ locals }) => {
|
|
|
5039
4941
|
redirect(303, "/dashboard");
|
|
5040
4942
|
}
|
|
5041
4943
|
|
|
5042
|
-
return { form: await superValidate(
|
|
4944
|
+
return { form: await superValidate(zod4(resetSchema)) };
|
|
5043
4945
|
};
|
|
5044
4946
|
|
|
5045
4947
|
export const actions = {
|
|
5046
4948
|
default: async ({ locals, request, cookies }) => {
|
|
5047
|
-
const form = await superValidate(request,
|
|
4949
|
+
const form = await superValidate(request, zod4(resetSchema));
|
|
5048
4950
|
|
|
5049
4951
|
if (!form.valid) {
|
|
5050
4952
|
return fail(400, { form });
|
|
@@ -5062,12 +4964,12 @@ export const actions = {
|
|
|
5062
4964
|
return { form };
|
|
5063
4965
|
},
|
|
5064
4966
|
};
|
|
5065
|
-
`,
|
|
4967
|
+
`, nr = `<script lang="ts">
|
|
5066
4968
|
import { untrack } from 'svelte';
|
|
5067
4969
|
import { Button } from '$lib/components/ui/button';
|
|
5068
4970
|
import * as Card from '$lib/components/ui/card';
|
|
5069
4971
|
import { superForm } from 'sveltekit-superforms';
|
|
5070
|
-
import {
|
|
4972
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
5071
4973
|
import { resetSchema } from '$lib/schemas/reset';
|
|
5072
4974
|
import * as Form from '$lib/components/ui/form';
|
|
5073
4975
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -5077,7 +4979,7 @@ export const actions = {
|
|
|
5077
4979
|
const form = superForm(
|
|
5078
4980
|
untrack(() => data.form),
|
|
5079
4981
|
{
|
|
5080
|
-
validators:
|
|
4982
|
+
validators: zod4Client(resetSchema)
|
|
5081
4983
|
}
|
|
5082
4984
|
);
|
|
5083
4985
|
|
|
@@ -5129,7 +5031,7 @@ export const actions = {
|
|
|
5129
5031
|
</div>
|
|
5130
5032
|
</div>
|
|
5131
5033
|
</div>
|
|
5132
|
-
`,
|
|
5034
|
+
`, ar = `import { describe, it, expect } from "vitest";
|
|
5133
5035
|
import type { Match } from "@velastack/pocketbase";
|
|
5134
5036
|
import type { RouteId } from "./$types";
|
|
5135
5037
|
|
|
@@ -5151,9 +5053,9 @@ describe("POST /reset", () => {
|
|
|
5151
5053
|
expect(response.body.status).toBe(200);
|
|
5152
5054
|
});
|
|
5153
5055
|
});
|
|
5154
|
-
`,
|
|
5056
|
+
`, rr = `import { redirect } from "@sveltejs/kit";
|
|
5155
5057
|
import { fail, superValidate } from "sveltekit-superforms";
|
|
5156
|
-
import {
|
|
5058
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
5157
5059
|
import { setFlash } from "sveltekit-flash-message/server";
|
|
5158
5060
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
5159
5061
|
import { dev } from "$app/environment";
|
|
@@ -5166,12 +5068,12 @@ export const load = async ({ locals }) => {
|
|
|
5166
5068
|
redirect(303, "/dashboard");
|
|
5167
5069
|
}
|
|
5168
5070
|
|
|
5169
|
-
return { form: await superValidate(
|
|
5071
|
+
return { form: await superValidate(zod4(signupSchema)), authMethods };
|
|
5170
5072
|
};
|
|
5171
5073
|
|
|
5172
5074
|
export const actions = {
|
|
5173
5075
|
default: async ({ locals, request, cookies, url }) => {
|
|
5174
|
-
const form = await superValidate(request,
|
|
5076
|
+
const form = await superValidate(request, zod4(signupSchema));
|
|
5175
5077
|
|
|
5176
5078
|
if (!form.valid) {
|
|
5177
5079
|
return fail(400, { form });
|
|
@@ -5212,12 +5114,12 @@ export const actions = {
|
|
|
5212
5114
|
return redirect(303, redirectUrl);
|
|
5213
5115
|
},
|
|
5214
5116
|
};
|
|
5215
|
-
`,
|
|
5117
|
+
`, or = `<script lang="ts">
|
|
5216
5118
|
import { untrack } from 'svelte';
|
|
5217
5119
|
import { Button } from '$lib/components/ui/button';
|
|
5218
5120
|
import * as Card from '$lib/components/ui/card';
|
|
5219
5121
|
import { superForm } from 'sveltekit-superforms';
|
|
5220
|
-
import {
|
|
5122
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
5221
5123
|
import { signupSchema } from '$lib/schemas/signup';
|
|
5222
5124
|
import * as Form from '$lib/components/ui/form';
|
|
5223
5125
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -5235,7 +5137,7 @@ export const actions = {
|
|
|
5235
5137
|
const form = superForm(
|
|
5236
5138
|
untrack(() => data.form),
|
|
5237
5139
|
{
|
|
5238
|
-
validators:
|
|
5140
|
+
validators: zod4Client(signupSchema)
|
|
5239
5141
|
}
|
|
5240
5142
|
);
|
|
5241
5143
|
|
|
@@ -5379,7 +5281,7 @@ export const actions = {
|
|
|
5379
5281
|
</div>
|
|
5380
5282
|
</div>
|
|
5381
5283
|
</div>
|
|
5382
|
-
`,
|
|
5284
|
+
`, sr = `import { describe, it, expect } from "vitest";
|
|
5383
5285
|
import type { Match } from "@velastack/pocketbase";
|
|
5384
5286
|
import * as devalue from "devalue";
|
|
5385
5287
|
import type { RouteId } from "./$types";
|
|
@@ -5437,52 +5339,52 @@ describe("POST /signup", () => {
|
|
|
5437
5339
|
expect(data.form.errors.email[0]).toBe("Value must be unique.");
|
|
5438
5340
|
});
|
|
5439
5341
|
});
|
|
5440
|
-
`,
|
|
5441
|
-
"./creates/src/lib/components/app-sidebar.svelte":
|
|
5442
|
-
"./creates/src/lib/components/nav-main.svelte":
|
|
5443
|
-
"./creates/src/lib/components/nav-user.svelte":
|
|
5444
|
-
"./creates/src/lib/schemas/changeEmail.ts":
|
|
5445
|
-
"./creates/src/lib/schemas/changePassword.ts":
|
|
5446
|
-
"./creates/src/lib/schemas/confirmEmailChange.ts":
|
|
5447
|
-
"./creates/src/lib/schemas/confirmReset.ts":
|
|
5448
|
-
"./creates/src/lib/schemas/login.ts":
|
|
5449
|
-
"./creates/src/lib/schemas/otp.ts":
|
|
5450
|
-
"./creates/src/lib/schemas/profile.ts":
|
|
5451
|
-
"./creates/src/lib/schemas/reset.ts":
|
|
5452
|
-
"./creates/src/lib/schemas/signup.ts":
|
|
5453
|
-
"./creates/src/routes/(app)/+layout.server.ts":
|
|
5454
|
-
"./creates/src/routes/(app)/+layout.svelte":
|
|
5455
|
-
"./creates/src/routes/(app)/dashboard/+page.svelte":
|
|
5456
|
-
"./creates/src/routes/(app)/dashboard/server.test.ts":
|
|
5457
|
-
"./creates/src/routes/(app)/settings/+layout.server.ts":
|
|
5458
|
-
"./creates/src/routes/(app)/settings/+page.server.ts":
|
|
5459
|
-
"./creates/src/routes/(app)/settings/+page.svelte":
|
|
5460
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts":
|
|
5461
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte":
|
|
5462
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts":
|
|
5463
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts":
|
|
5464
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte":
|
|
5465
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts":
|
|
5466
|
-
"./creates/src/routes/(public)/confirm-verification/[token]/+server.ts":
|
|
5467
|
-
"./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts":
|
|
5468
|
-
"./creates/src/routes/(public)/login/+page.server.ts":
|
|
5469
|
-
"./creates/src/routes/(public)/login/+page.svelte":
|
|
5470
|
-
"./creates/src/routes/(public)/login/server.test.ts":
|
|
5471
|
-
"./creates/src/routes/(public)/logout/+server.ts":
|
|
5472
|
-
"./creates/src/routes/(public)/logout/server.test.ts":
|
|
5473
|
-
"./creates/src/routes/(public)/otp/[token]/+page.server.ts":
|
|
5474
|
-
"./creates/src/routes/(public)/otp/[token]/+page.svelte":
|
|
5475
|
-
"./creates/src/routes/(public)/otp/[token]/server.test.ts":
|
|
5476
|
-
"./creates/src/routes/(public)/reset/+page.server.ts":
|
|
5477
|
-
"./creates/src/routes/(public)/reset/+page.svelte":
|
|
5478
|
-
"./creates/src/routes/(public)/reset/server.test.ts":
|
|
5479
|
-
"./creates/src/routes/(public)/signup/+page.server.ts":
|
|
5480
|
-
"./creates/src/routes/(public)/signup/+page.svelte":
|
|
5481
|
-
"./creates/src/routes/(public)/signup/server.test.ts":
|
|
5482
|
-
}),
|
|
5483
|
-
async function
|
|
5484
|
-
const e = Object.entries(
|
|
5485
|
-
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);
|
|
5486
5388
|
return {
|
|
5487
5389
|
path: i,
|
|
5488
5390
|
language: S(i),
|
|
@@ -5573,7 +5475,7 @@ async function gr(t) {
|
|
|
5573
5475
|
]
|
|
5574
5476
|
};
|
|
5575
5477
|
}
|
|
5576
|
-
const
|
|
5478
|
+
const mr = `import {
|
|
5577
5479
|
POCKETBASE_URL,
|
|
5578
5480
|
POCKETBASE_SUPERUSER_EMAIL,
|
|
5579
5481
|
POCKETBASE_SUPERUSER_PASSWORD,
|
|
@@ -5587,7 +5489,7 @@ export const handle = handlePocketbase({
|
|
|
5587
5489
|
// [!code highlight:1]
|
|
5588
5490
|
auth: { protectedRoutes: ["/(app)"] },
|
|
5589
5491
|
});
|
|
5590
|
-
`,
|
|
5492
|
+
`, dr = `<script lang="ts">
|
|
5591
5493
|
import { toggleMode } from "mode-watcher";
|
|
5592
5494
|
import * as Navbar from "$lib/components/ui/navbar";
|
|
5593
5495
|
import { Button } from "$lib/components/ui/button";
|
|
@@ -5694,7 +5596,7 @@ export const handle = handlePocketbase({
|
|
|
5694
5596
|
@apply container mx-auto max-w-7xl px-4 py-8 w-full;
|
|
5695
5597
|
}
|
|
5696
5598
|
</style>
|
|
5697
|
-
`,
|
|
5599
|
+
`, pr = `import { loadFlash } from "sveltekit-flash-message/server";
|
|
5698
5600
|
|
|
5699
5601
|
export const load = loadFlash(async ({ locals }) => {
|
|
5700
5602
|
return {
|
|
@@ -5702,14 +5604,14 @@ export const load = loadFlash(async ({ locals }) => {
|
|
|
5702
5604
|
user: locals.pb.authStore.record,
|
|
5703
5605
|
};
|
|
5704
5606
|
});
|
|
5705
|
-
`,
|
|
5706
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
5707
|
-
"./preview-modifies/src/routes/(public)/root-layout.svelte":
|
|
5708
|
-
"./preview-modifies/src/routes/+layout.server.ts":
|
|
5709
|
-
}),
|
|
5710
|
-
async function
|
|
5711
|
-
const e = Object.entries(
|
|
5712
|
-
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);
|
|
5713
5615
|
return {
|
|
5714
5616
|
path: r,
|
|
5715
5617
|
language: S(r),
|
|
@@ -5725,24 +5627,24 @@ async function yr(t) {
|
|
|
5725
5627
|
collections: []
|
|
5726
5628
|
};
|
|
5727
5629
|
}
|
|
5728
|
-
const
|
|
5729
|
-
async function
|
|
5730
|
-
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);
|
|
5731
5633
|
if (t.env === "preview") {
|
|
5732
|
-
const s = await
|
|
5634
|
+
const s = await gr();
|
|
5733
5635
|
return $(I([e, s]));
|
|
5734
5636
|
}
|
|
5735
|
-
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");
|
|
5736
5638
|
return r(
|
|
5737
5639
|
await $(I([e, a])),
|
|
5738
5640
|
t
|
|
5739
5641
|
);
|
|
5740
5642
|
}
|
|
5741
|
-
const
|
|
5742
|
-
version:
|
|
5743
|
-
slug:
|
|
5744
|
-
source:
|
|
5745
|
-
docs:
|
|
5643
|
+
const yr = {
|
|
5644
|
+
version: br,
|
|
5645
|
+
slug: hr,
|
|
5646
|
+
source: vr,
|
|
5647
|
+
docs: wr,
|
|
5746
5648
|
plan: "open",
|
|
5747
5649
|
title: "Enable authentication",
|
|
5748
5650
|
summary: "Enables authentication.",
|
|
@@ -5770,8 +5672,8 @@ const kr = {
|
|
|
5770
5672
|
},
|
|
5771
5673
|
tests: 18,
|
|
5772
5674
|
baseline: "velastack",
|
|
5773
|
-
generate:
|
|
5774
|
-
},
|
|
5675
|
+
generate: xr
|
|
5676
|
+
}, $r = `import { describe, expect, it } from "vitest";
|
|
5775
5677
|
|
|
5776
5678
|
describe("GET /api/health", () => {
|
|
5777
5679
|
it("should return a 200 status code", async (context) => {
|
|
@@ -5779,13 +5681,13 @@ describe("GET /api/health", () => {
|
|
|
5779
5681
|
expect(response.status).toBe(200);
|
|
5780
5682
|
});
|
|
5781
5683
|
});
|
|
5782
|
-
`,
|
|
5783
|
-
"./creates/src/routes/api/server.test.ts":
|
|
5784
|
-
}),
|
|
5785
|
-
async function
|
|
5684
|
+
`, _r = /* @__PURE__ */ Object.assign({
|
|
5685
|
+
"./creates/src/routes/api/server.test.ts": $r
|
|
5686
|
+
}), Cr = "./creates/";
|
|
5687
|
+
async function Sr(t) {
|
|
5786
5688
|
return {
|
|
5787
|
-
creates: Object.entries(
|
|
5788
|
-
const r = M(n,
|
|
5689
|
+
creates: Object.entries(_r).map(([n, a]) => {
|
|
5690
|
+
const r = M(n, Cr);
|
|
5789
5691
|
return {
|
|
5790
5692
|
path: r,
|
|
5791
5693
|
language: S(r),
|
|
@@ -5799,7 +5701,7 @@ async function Pr(t) {
|
|
|
5799
5701
|
collections: []
|
|
5800
5702
|
};
|
|
5801
5703
|
}
|
|
5802
|
-
const
|
|
5704
|
+
const Fr = `import {
|
|
5803
5705
|
POCKETBASE_URL,
|
|
5804
5706
|
POCKETBASE_SUPERUSER_EMAIL,
|
|
5805
5707
|
POCKETBASE_SUPERUSER_PASSWORD,
|
|
@@ -5813,12 +5715,12 @@ export const handle = handlePocketbase({
|
|
|
5813
5715
|
// [!code highlight:1]
|
|
5814
5716
|
api: { enabled: true },
|
|
5815
5717
|
});
|
|
5816
|
-
`,
|
|
5817
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
5818
|
-
}),
|
|
5819
|
-
async function
|
|
5820
|
-
const e = Object.entries(
|
|
5821
|
-
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);
|
|
5822
5724
|
return {
|
|
5823
5725
|
path: r,
|
|
5824
5726
|
language: S(r),
|
|
@@ -5834,24 +5736,24 @@ async function zr(t) {
|
|
|
5834
5736
|
collections: []
|
|
5835
5737
|
};
|
|
5836
5738
|
}
|
|
5837
|
-
const
|
|
5838
|
-
async function
|
|
5839
|
-
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();
|
|
5840
5742
|
if (t.env === "preview") {
|
|
5841
|
-
const s = await
|
|
5743
|
+
const s = await Ir();
|
|
5842
5744
|
return $(I([e, s]));
|
|
5843
5745
|
}
|
|
5844
|
-
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");
|
|
5845
5747
|
return r(
|
|
5846
5748
|
await $(I([e, a])),
|
|
5847
5749
|
t
|
|
5848
5750
|
);
|
|
5849
5751
|
}
|
|
5850
|
-
const
|
|
5851
|
-
version:
|
|
5852
|
-
slug:
|
|
5853
|
-
source:
|
|
5854
|
-
docs:
|
|
5752
|
+
const Br = {
|
|
5753
|
+
version: Pr,
|
|
5754
|
+
slug: Mr,
|
|
5755
|
+
source: Tr,
|
|
5756
|
+
docs: Er,
|
|
5855
5757
|
plan: "open",
|
|
5856
5758
|
title: "Enable API",
|
|
5857
5759
|
summary: "Enables the PocketBase API.",
|
|
@@ -5872,18 +5774,18 @@ const jr = {
|
|
|
5872
5774
|
},
|
|
5873
5775
|
tests: 1,
|
|
5874
5776
|
baseline: "velastack",
|
|
5875
|
-
generate:
|
|
5876
|
-
},
|
|
5777
|
+
generate: Dr
|
|
5778
|
+
}, Ar = `import { z } from "zod";
|
|
5877
5779
|
import type { Schemas } from "pocketbase-svelte";
|
|
5878
5780
|
|
|
5879
5781
|
export const apiKeySchema = z.object({
|
|
5880
5782
|
label: z.string().optional(),
|
|
5881
5783
|
}) satisfies Schemas["api_keys"];
|
|
5882
|
-
`,
|
|
5784
|
+
`, zr = `export const load = async ({ locals }) => {
|
|
5883
5785
|
const apiKeys = await locals.pb.collection("api_keys").getFullList();
|
|
5884
5786
|
return { apiKeys };
|
|
5885
5787
|
};
|
|
5886
|
-
`,
|
|
5788
|
+
`, Lr = `<script lang="ts">
|
|
5887
5789
|
import { getFlash } from 'sveltekit-flash-message';
|
|
5888
5790
|
import { page } from '$app/state';
|
|
5889
5791
|
import * as AlertDialog from '$lib/components/ui/alert-dialog';
|
|
@@ -6021,7 +5923,7 @@ export const apiKeySchema = z.object({
|
|
|
6021
5923
|
</div>
|
|
6022
5924
|
</div>
|
|
6023
5925
|
</section>
|
|
6024
|
-
`,
|
|
5926
|
+
`, Or = `import { redirect } from "@sveltejs/kit";
|
|
6025
5927
|
|
|
6026
5928
|
export const actions = {
|
|
6027
5929
|
delete: async ({ locals, params }) => {
|
|
@@ -6029,20 +5931,20 @@ export const actions = {
|
|
|
6029
5931
|
redirect(303, "/api-keys");
|
|
6030
5932
|
},
|
|
6031
5933
|
};
|
|
6032
|
-
`,
|
|
6033
|
-
import {
|
|
5934
|
+
`, Ur = `import { fail, superValidate } from "sveltekit-superforms";
|
|
5935
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
6034
5936
|
import { redirect } from "sveltekit-flash-message/server";
|
|
6035
5937
|
import { apiKeySchema } from "$lib/schemas/apiKey";
|
|
6036
5938
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
6037
5939
|
import { createApiKey } from "./create-api-key";
|
|
6038
5940
|
|
|
6039
5941
|
export const load = async () => {
|
|
6040
|
-
return { form: await superValidate(
|
|
5942
|
+
return { form: await superValidate(zod4(apiKeySchema)) };
|
|
6041
5943
|
};
|
|
6042
5944
|
|
|
6043
5945
|
export const actions = {
|
|
6044
5946
|
default: async ({ locals, request, cookies }) => {
|
|
6045
|
-
const form = await superValidate(request,
|
|
5947
|
+
const form = await superValidate(request, zod4(apiKeySchema));
|
|
6046
5948
|
|
|
6047
5949
|
if (!form.valid) {
|
|
6048
5950
|
return fail(400, { form });
|
|
@@ -6073,10 +5975,10 @@ export const actions = {
|
|
|
6073
5975
|
);
|
|
6074
5976
|
},
|
|
6075
5977
|
};
|
|
6076
|
-
`,
|
|
5978
|
+
`, jr = `<script lang="ts">
|
|
6077
5979
|
import { untrack } from 'svelte';
|
|
6078
5980
|
import { superForm } from 'sveltekit-superforms';
|
|
6079
|
-
import {
|
|
5981
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
6080
5982
|
import { apiKeySchema } from '$lib/schemas/apiKey';
|
|
6081
5983
|
import * as Form from '$lib/components/ui/form';
|
|
6082
5984
|
import { Input } from '$lib/components/ui/input';
|
|
@@ -6088,7 +5990,7 @@ export const actions = {
|
|
|
6088
5990
|
const form = superForm(
|
|
6089
5991
|
untrack(() => data.form),
|
|
6090
5992
|
{
|
|
6091
|
-
validators:
|
|
5993
|
+
validators: zod4Client(apiKeySchema)
|
|
6092
5994
|
}
|
|
6093
5995
|
);
|
|
6094
5996
|
|
|
@@ -6125,7 +6027,7 @@ export const actions = {
|
|
|
6125
6027
|
</form>
|
|
6126
6028
|
</div>
|
|
6127
6029
|
</section>
|
|
6128
|
-
`,
|
|
6030
|
+
`, qr = `import PocketBase from "pocketbase-svelte";
|
|
6129
6031
|
import argon2 from "argon2";
|
|
6130
6032
|
import { randomBytes } from "node:crypto";
|
|
6131
6033
|
|
|
@@ -6142,7 +6044,7 @@ export const createApiKey = async (
|
|
|
6142
6044
|
|
|
6143
6045
|
return \`\${apiKey.id}.\${keySecret}\`;
|
|
6144
6046
|
};
|
|
6145
|
-
`,
|
|
6047
|
+
`, Nr = `import { describe, it, expect, beforeEach } from "vitest";
|
|
6146
6048
|
import type { Match } from "@velastack/pocketbase";
|
|
6147
6049
|
import { createApiKey } from "./create-api-key";
|
|
6148
6050
|
import type { RouteId } from "./$types";
|
|
@@ -6208,7 +6110,7 @@ describe("api keys authenticate as a user", () => {
|
|
|
6208
6110
|
expect(response2.status).toBe(200);
|
|
6209
6111
|
});
|
|
6210
6112
|
});
|
|
6211
|
-
`,
|
|
6113
|
+
`, Vr = `import { describe, it, expect, beforeEach } from "vitest";
|
|
6212
6114
|
import type { Match } from "@velastack/pocketbase";
|
|
6213
6115
|
import type { RouteId } from "./$types";
|
|
6214
6116
|
|
|
@@ -6224,21 +6126,21 @@ describe("GET /api-keys", () => {
|
|
|
6224
6126
|
expect(response.status).toBe(200);
|
|
6225
6127
|
});
|
|
6226
6128
|
});
|
|
6227
|
-
`,
|
|
6228
|
-
"./creates/src/lib/schemas/apiKey.ts":
|
|
6229
|
-
"./creates/src/routes/(app)/api-keys/+page.server.ts":
|
|
6230
|
-
"./creates/src/routes/(app)/api-keys/+page.svelte":
|
|
6231
|
-
"./creates/src/routes/(app)/api-keys/[id]/+page.server.ts":
|
|
6232
|
-
"./creates/src/routes/(app)/api-keys/new/+page.server.ts":
|
|
6233
|
-
"./creates/src/routes/(app)/api-keys/new/+page.svelte":
|
|
6234
|
-
"./creates/src/routes/(app)/api-keys/new/create-api-key.ts":
|
|
6235
|
-
"./creates/src/routes/(app)/api-keys/new/server.test.ts":
|
|
6236
|
-
"./creates/src/routes/(app)/api-keys/server.test.ts":
|
|
6237
|
-
}),
|
|
6238
|
-
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) {
|
|
6239
6141
|
return {
|
|
6240
|
-
creates: Object.entries(
|
|
6241
|
-
const r = M(n,
|
|
6142
|
+
creates: Object.entries(Hr).map(([n, a]) => {
|
|
6143
|
+
const r = M(n, Kr);
|
|
6242
6144
|
return {
|
|
6243
6145
|
path: r,
|
|
6244
6146
|
language: S(r),
|
|
@@ -6252,7 +6154,7 @@ async function Qr(t) {
|
|
|
6252
6154
|
collections: []
|
|
6253
6155
|
};
|
|
6254
6156
|
}
|
|
6255
|
-
const
|
|
6157
|
+
const Wr = `import {
|
|
6256
6158
|
POCKETBASE_URL,
|
|
6257
6159
|
POCKETBASE_SUPERUSER_EMAIL,
|
|
6258
6160
|
POCKETBASE_SUPERUSER_PASSWORD,
|
|
@@ -6269,12 +6171,12 @@ export const handle = handlePocketbase({
|
|
|
6269
6171
|
apiKeys: { enabled: true },
|
|
6270
6172
|
},
|
|
6271
6173
|
});
|
|
6272
|
-
`,
|
|
6273
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
6274
|
-
}),
|
|
6275
|
-
async function
|
|
6276
|
-
const e = Object.entries(
|
|
6277
|
-
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);
|
|
6278
6180
|
return {
|
|
6279
6181
|
path: r,
|
|
6280
6182
|
language: S(r),
|
|
@@ -6290,24 +6192,24 @@ async function ao(t) {
|
|
|
6290
6192
|
collections: []
|
|
6291
6193
|
};
|
|
6292
6194
|
}
|
|
6293
|
-
const
|
|
6294
|
-
async function
|
|
6295
|
-
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();
|
|
6296
6198
|
if (t.env === "preview") {
|
|
6297
|
-
const s = await
|
|
6199
|
+
const s = await Yr();
|
|
6298
6200
|
return $(I([e, s]));
|
|
6299
6201
|
}
|
|
6300
|
-
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");
|
|
6301
6203
|
return r(
|
|
6302
6204
|
await $(I([e, a])),
|
|
6303
6205
|
t
|
|
6304
6206
|
);
|
|
6305
6207
|
}
|
|
6306
|
-
const
|
|
6307
|
-
version:
|
|
6308
|
-
slug:
|
|
6309
|
-
source:
|
|
6310
|
-
docs:
|
|
6208
|
+
const ao = {
|
|
6209
|
+
version: Qr,
|
|
6210
|
+
slug: Zr,
|
|
6211
|
+
source: to,
|
|
6212
|
+
docs: eo,
|
|
6311
6213
|
plan: "open",
|
|
6312
6214
|
title: "Enable API keys",
|
|
6313
6215
|
summary: "Adds API key management for authenticated users and PocketBase API access.",
|
|
@@ -6335,8 +6237,8 @@ const co = {
|
|
|
6335
6237
|
},
|
|
6336
6238
|
tests: 6,
|
|
6337
6239
|
baseline: "velastack",
|
|
6338
|
-
generate:
|
|
6339
|
-
},
|
|
6240
|
+
generate: no
|
|
6241
|
+
}, ro = `import { deLocalizeDefault } from "wuchale/url";
|
|
6340
6242
|
import { matchUrl } from "$locales/main.url";
|
|
6341
6243
|
import { locales } from "$locales/data";
|
|
6342
6244
|
|
|
@@ -6345,7 +6247,7 @@ export const reroute = ({ url }) => {
|
|
|
6345
6247
|
const { path } = matchUrl(upath, locale);
|
|
6346
6248
|
return path ?? url.pathname;
|
|
6347
6249
|
};
|
|
6348
|
-
`,
|
|
6250
|
+
`, oo = `import { deLocalizeDefault, fillParams } from "wuchale/url";
|
|
6349
6251
|
import type { Locale } from "../locales/data";
|
|
6350
6252
|
import { matchUrl } from "../locales/main.url";
|
|
6351
6253
|
import { locales } from "../locales/data";
|
|
@@ -6373,7 +6275,7 @@ export function translateUrl(
|
|
|
6373
6275
|
}
|
|
6374
6276
|
return localize(url, toLocale);
|
|
6375
6277
|
}
|
|
6376
|
-
`,
|
|
6278
|
+
`, so = `// @ts-check
|
|
6377
6279
|
import { adapter as svelte } from "@wuchale/svelte";
|
|
6378
6280
|
import { adapter as js } from "wuchale/adapter-vanilla";
|
|
6379
6281
|
import { defineConfig } from "wuchale";
|
|
@@ -6394,15 +6296,15 @@ export default defineConfig({
|
|
|
6394
6296
|
}),
|
|
6395
6297
|
},
|
|
6396
6298
|
});
|
|
6397
|
-
`,
|
|
6398
|
-
"./creates/src/hooks.ts":
|
|
6399
|
-
"./creates/src/lib/url.ts":
|
|
6400
|
-
"./creates/wuchale.config.js":
|
|
6401
|
-
}),
|
|
6402
|
-
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) {
|
|
6403
6305
|
return {
|
|
6404
|
-
creates: Object.entries(
|
|
6405
|
-
const r = M(n,
|
|
6306
|
+
creates: Object.entries(io).map(([n, a]) => {
|
|
6307
|
+
const r = M(n, lo);
|
|
6406
6308
|
return {
|
|
6407
6309
|
path: r,
|
|
6408
6310
|
language: S(r),
|
|
@@ -6416,7 +6318,7 @@ async function ho(t) {
|
|
|
6416
6318
|
collections: []
|
|
6417
6319
|
};
|
|
6418
6320
|
}
|
|
6419
|
-
const
|
|
6321
|
+
const mo = `<!doctype html>
|
|
6420
6322
|
<!-- [!code highlight:1] -->
|
|
6421
6323
|
<html lang="%sveltekit.lang%">
|
|
6422
6324
|
<head>
|
|
@@ -6427,7 +6329,7 @@ const bo = `<!doctype html>
|
|
|
6427
6329
|
<div style="display: contents">%sveltekit.body%</div>
|
|
6428
6330
|
</body>
|
|
6429
6331
|
</html>
|
|
6430
|
-
`,
|
|
6332
|
+
`, po = `import { env } from "$env/dynamic/private";
|
|
6431
6333
|
import { handlePocketbase } from "@velastack/pocketbase";
|
|
6432
6334
|
// [!code highlight:6]
|
|
6433
6335
|
import { sequence } from "@sveltejs/kit/hooks";
|
|
@@ -6461,7 +6363,7 @@ export const handle = sequence(
|
|
|
6461
6363
|
superuserPassword: env.POCKETBASE_SUPERUSER_PASSWORD,
|
|
6462
6364
|
}),
|
|
6463
6365
|
);
|
|
6464
|
-
`,
|
|
6366
|
+
`, uo = `import { browser } from "$app/environment";
|
|
6465
6367
|
// [!code highlight:4]
|
|
6466
6368
|
import { loadLocale } from "wuchale/load-utils";
|
|
6467
6369
|
import { getLocale } from "$locales/main.url";
|
|
@@ -6478,7 +6380,7 @@ export const load = async ({ url, data }) => {
|
|
|
6478
6380
|
|
|
6479
6381
|
return data;
|
|
6480
6382
|
};
|
|
6481
|
-
`,
|
|
6383
|
+
`, fo = `import adapter from "@sveltejs/adapter-auto";
|
|
6482
6384
|
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
|
6483
6385
|
|
|
6484
6386
|
const config = {
|
|
@@ -6493,7 +6395,7 @@ const config = {
|
|
|
6493
6395
|
};
|
|
6494
6396
|
|
|
6495
6397
|
export default config;
|
|
6496
|
-
`,
|
|
6398
|
+
`, go = `import { defineConfig } from "vite";
|
|
6497
6399
|
import { sveltekit } from "@sveltejs/kit/vite";
|
|
6498
6400
|
import tailwindcss from "@tailwindcss/vite";
|
|
6499
6401
|
// [!code highlight:1]
|
|
@@ -6503,16 +6405,16 @@ export default defineConfig({
|
|
|
6503
6405
|
// [!code highlight:1]
|
|
6504
6406
|
plugins: [wuchale(), tailwindcss(), sveltekit()],
|
|
6505
6407
|
});
|
|
6506
|
-
`,
|
|
6507
|
-
"./preview-modifies/src/app.html":
|
|
6508
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
6509
|
-
"./preview-modifies/src/routes/+layout.ts":
|
|
6510
|
-
"./preview-modifies/svelte.config.js":
|
|
6511
|
-
"./preview-modifies/vite.config.ts":
|
|
6512
|
-
}),
|
|
6513
|
-
async function
|
|
6514
|
-
const e = Object.entries(
|
|
6515
|
-
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);
|
|
6516
6418
|
return {
|
|
6517
6419
|
path: r,
|
|
6518
6420
|
language: S(r),
|
|
@@ -6528,24 +6430,24 @@ async function Co(t) {
|
|
|
6528
6430
|
collections: []
|
|
6529
6431
|
};
|
|
6530
6432
|
}
|
|
6531
|
-
const
|
|
6532
|
-
async function
|
|
6533
|
-
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();
|
|
6534
6436
|
if (t.env === "preview") {
|
|
6535
|
-
const s = await
|
|
6437
|
+
const s = await vo();
|
|
6536
6438
|
return $(I([e, s]));
|
|
6537
6439
|
}
|
|
6538
|
-
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");
|
|
6539
6441
|
return r(
|
|
6540
6442
|
await $(I([e, a])),
|
|
6541
6443
|
t
|
|
6542
6444
|
);
|
|
6543
6445
|
}
|
|
6544
|
-
const
|
|
6545
|
-
version:
|
|
6546
|
-
slug:
|
|
6547
|
-
source:
|
|
6548
|
-
docs:
|
|
6446
|
+
const Co = {
|
|
6447
|
+
version: xo,
|
|
6448
|
+
slug: wo,
|
|
6449
|
+
source: yo,
|
|
6450
|
+
docs: $o,
|
|
6549
6451
|
plan: "open",
|
|
6550
6452
|
title: "Enable i18n",
|
|
6551
6453
|
summary: "Enables i18n with Wuchale and locale-aware routing.",
|
|
@@ -6566,8 +6468,8 @@ const Mo = {
|
|
|
6566
6468
|
},
|
|
6567
6469
|
tests: 0,
|
|
6568
6470
|
baseline: "velastack",
|
|
6569
|
-
generate:
|
|
6570
|
-
},
|
|
6471
|
+
generate: _o
|
|
6472
|
+
}, So = `<script lang="ts">
|
|
6571
6473
|
import type { Snippet } from 'svelte';
|
|
6572
6474
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
6573
6475
|
import * as Sidebar from '$lib/components/ui/sidebar/index.js';
|
|
@@ -6628,22 +6530,22 @@ const Mo = {
|
|
|
6628
6530
|
</DropdownMenu.Root>
|
|
6629
6531
|
</Sidebar.MenuItem>
|
|
6630
6532
|
</Sidebar.Menu>
|
|
6631
|
-
`,
|
|
6533
|
+
`, Fo = `import { z } from "zod";
|
|
6632
6534
|
|
|
6633
6535
|
export const teamSchema = z.object({
|
|
6634
6536
|
name: z.string(),
|
|
6635
6537
|
});
|
|
6636
|
-
`,
|
|
6538
|
+
`, ko = `import { z } from "zod";
|
|
6637
6539
|
|
|
6638
6540
|
export const teamInviteSchema = z.object({
|
|
6639
|
-
email: z.
|
|
6541
|
+
email: z.email(),
|
|
6640
6542
|
});
|
|
6641
|
-
`,
|
|
6543
|
+
`, Ro = `import { z } from "zod";
|
|
6642
6544
|
|
|
6643
6545
|
export const teamRoleSchema = z.object({
|
|
6644
6546
|
role: z.enum(["owner", "admin", "member"]),
|
|
6645
6547
|
});
|
|
6646
|
-
`,
|
|
6548
|
+
`, Io = `<script lang="ts">
|
|
6647
6549
|
import RootLayout from '../../../(public)/root-layout.svelte';
|
|
6648
6550
|
|
|
6649
6551
|
let { data, children } = $props();
|
|
@@ -6652,7 +6554,7 @@ export const teamRoleSchema = z.object({
|
|
|
6652
6554
|
<RootLayout {data}>
|
|
6653
6555
|
{@render children?.()}
|
|
6654
6556
|
</RootLayout>
|
|
6655
|
-
`,
|
|
6557
|
+
`, Mo = `import { error } from "@sveltejs/kit";
|
|
6656
6558
|
import { redirect } from "sveltekit-flash-message/server";
|
|
6657
6559
|
|
|
6658
6560
|
export const load = async ({ params, locals }) => {
|
|
@@ -6695,7 +6597,7 @@ export const actions = {
|
|
|
6695
6597
|
);
|
|
6696
6598
|
},
|
|
6697
6599
|
};
|
|
6698
|
-
`,
|
|
6600
|
+
`, Po = `<script lang="ts">
|
|
6699
6601
|
import { Button } from '$lib/components/ui/button';
|
|
6700
6602
|
import * as Card from '$lib/components/ui/card';
|
|
6701
6603
|
|
|
@@ -6734,7 +6636,7 @@ export const actions = {
|
|
|
6734
6636
|
</div>
|
|
6735
6637
|
</div>
|
|
6736
6638
|
</div>
|
|
6737
|
-
`,
|
|
6639
|
+
`, To = `<script lang="ts">
|
|
6738
6640
|
import RootLayout from '../../../(public)/root-layout.svelte';
|
|
6739
6641
|
|
|
6740
6642
|
let { data, children } = $props();
|
|
@@ -6743,7 +6645,7 @@ export const actions = {
|
|
|
6743
6645
|
<RootLayout {data}>
|
|
6744
6646
|
{@render children?.()}
|
|
6745
6647
|
</RootLayout>
|
|
6746
|
-
`,
|
|
6648
|
+
`, Eo = `import { error } from "@sveltejs/kit";
|
|
6747
6649
|
import { redirect } from "sveltekit-flash-message/server";
|
|
6748
6650
|
|
|
6749
6651
|
export const load = async ({ params, locals }) => {
|
|
@@ -6788,7 +6690,7 @@ export const actions = {
|
|
|
6788
6690
|
);
|
|
6789
6691
|
},
|
|
6790
6692
|
};
|
|
6791
|
-
`,
|
|
6693
|
+
`, Do = `<script lang="ts">
|
|
6792
6694
|
import { Button } from '$lib/components/ui/button';
|
|
6793
6695
|
import * as Card from '$lib/components/ui/card';
|
|
6794
6696
|
|
|
@@ -6827,7 +6729,7 @@ export const actions = {
|
|
|
6827
6729
|
</div>
|
|
6828
6730
|
</div>
|
|
6829
6731
|
</div>
|
|
6830
|
-
`,
|
|
6732
|
+
`, Bo = `export const load = async ({ locals, parent }) => {
|
|
6831
6733
|
const { user, breadcrumbs } = await parent();
|
|
6832
6734
|
|
|
6833
6735
|
const ownedTeams = await locals.pb.collection("teams").getFullList({
|
|
@@ -6879,7 +6781,7 @@ export const actions = {
|
|
|
6879
6781
|
breadcrumbs: [...breadcrumbs, { title: "Teams", url: "/teams" }],
|
|
6880
6782
|
};
|
|
6881
6783
|
};
|
|
6882
|
-
`,
|
|
6784
|
+
`, Ao = `<script lang="ts">
|
|
6883
6785
|
import * as Card from '$lib/components/ui/card';
|
|
6884
6786
|
import { Button } from '$lib/components/ui/button';
|
|
6885
6787
|
import UserIcon from '@lucide/svelte/icons/user';
|
|
@@ -7000,7 +6902,7 @@ export const actions = {
|
|
|
7000
6902
|
</section>
|
|
7001
6903
|
|
|
7002
6904
|
{@render children?.()}
|
|
7003
|
-
`,
|
|
6905
|
+
`, zo = `import { error, fail } from "@sveltejs/kit";
|
|
7004
6906
|
import { redirect } from "sveltekit-flash-message/server";
|
|
7005
6907
|
|
|
7006
6908
|
export const actions = {
|
|
@@ -7060,9 +6962,9 @@ export const actions = {
|
|
|
7060
6962
|
redirect(303, \`/teams\`, { type: "toast", message: "Left team" }, cookies);
|
|
7061
6963
|
},
|
|
7062
6964
|
};
|
|
7063
|
-
`,
|
|
6965
|
+
`, Lo = "", Oo = `import { redirect } from "@sveltejs/kit";
|
|
7064
6966
|
import { superValidate } from "sveltekit-superforms";
|
|
7065
|
-
import {
|
|
6967
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
7066
6968
|
import { teamSchema } from "$lib/schemas/team";
|
|
7067
6969
|
|
|
7068
6970
|
export const load = async ({ params, locals, parent }) => {
|
|
@@ -7107,7 +7009,7 @@ export const load = async ({ params, locals, parent }) => {
|
|
|
7107
7009
|
filter: locals.pb.filter("team = {:team}", { team: id }),
|
|
7108
7010
|
});
|
|
7109
7011
|
|
|
7110
|
-
const form = await superValidate(team,
|
|
7012
|
+
const form = await superValidate(team, zod4(teamSchema));
|
|
7111
7013
|
|
|
7112
7014
|
return {
|
|
7113
7015
|
team,
|
|
@@ -7123,7 +7025,7 @@ export const load = async ({ params, locals, parent }) => {
|
|
|
7123
7025
|
],
|
|
7124
7026
|
};
|
|
7125
7027
|
};
|
|
7126
|
-
`,
|
|
7028
|
+
`, Uo = `<script lang="ts">
|
|
7127
7029
|
import { untrack } from 'svelte';
|
|
7128
7030
|
import * as Card from '$lib/components/ui/card';
|
|
7129
7031
|
import { Button, buttonVariants } from '$lib/components/ui/button';
|
|
@@ -7144,7 +7046,7 @@ export const load = async ({ params, locals, parent }) => {
|
|
|
7144
7046
|
import TrashIcon from '@lucide/svelte/icons/trash-2';
|
|
7145
7047
|
import { Input } from '$lib/components/ui/input';
|
|
7146
7048
|
import { superForm } from 'sveltekit-superforms';
|
|
7147
|
-
import {
|
|
7049
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
7148
7050
|
import { teamSchema } from '$lib/schemas/team';
|
|
7149
7051
|
|
|
7150
7052
|
let { data, children } = $props();
|
|
@@ -7152,7 +7054,7 @@ export const load = async ({ params, locals, parent }) => {
|
|
|
7152
7054
|
const form = superForm(
|
|
7153
7055
|
untrack(() => data.form),
|
|
7154
7056
|
{
|
|
7155
|
-
validators:
|
|
7057
|
+
validators: zod4Client(teamSchema),
|
|
7156
7058
|
warnings: {
|
|
7157
7059
|
duplicateId: false
|
|
7158
7060
|
}
|
|
@@ -7514,16 +7416,16 @@ export const load = async ({ params, locals, parent }) => {
|
|
|
7514
7416
|
</section>
|
|
7515
7417
|
|
|
7516
7418
|
{@render children?.()}
|
|
7517
|
-
`,
|
|
7419
|
+
`, jo = `import { error, fail } from "@sveltejs/kit";
|
|
7518
7420
|
import { redirect } from "sveltekit-flash-message/server";
|
|
7519
|
-
import {
|
|
7421
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
7520
7422
|
import { superValidate } from "sveltekit-superforms";
|
|
7521
7423
|
import { teamSchema } from "$lib/schemas/team";
|
|
7522
7424
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
7523
7425
|
|
|
7524
7426
|
export const actions = {
|
|
7525
7427
|
updateTeam: async ({ locals, params, request, cookies }) => {
|
|
7526
|
-
const form = await superValidate(request,
|
|
7428
|
+
const form = await superValidate(request, zod4(teamSchema));
|
|
7527
7429
|
|
|
7528
7430
|
if (!form.valid) {
|
|
7529
7431
|
return fail(400, { form });
|
|
@@ -7608,7 +7510,7 @@ export const actions = {
|
|
|
7608
7510
|
);
|
|
7609
7511
|
},
|
|
7610
7512
|
};
|
|
7611
|
-
`,
|
|
7513
|
+
`, qo = "", No = `type Role = "owner" | "admin" | "member";
|
|
7612
7514
|
|
|
7613
7515
|
interface User {
|
|
7614
7516
|
id: string;
|
|
@@ -7661,20 +7563,20 @@ export const getAuthorization = ({
|
|
|
7661
7563
|
canChangeRole: false,
|
|
7662
7564
|
};
|
|
7663
7565
|
};
|
|
7664
|
-
`,
|
|
7665
|
-
import {
|
|
7566
|
+
`, Vo = `import { fail, superValidate } from "sveltekit-superforms";
|
|
7567
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
7666
7568
|
import { teamInviteSchema } from "$lib/schemas/teamInvite";
|
|
7667
7569
|
import { redirect } from "sveltekit-flash-message/server";
|
|
7668
7570
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
7669
7571
|
|
|
7670
7572
|
export const load = async () => {
|
|
7671
|
-
const form = await superValidate(
|
|
7573
|
+
const form = await superValidate(zod4(teamInviteSchema));
|
|
7672
7574
|
return { form };
|
|
7673
7575
|
};
|
|
7674
7576
|
|
|
7675
7577
|
export const actions = {
|
|
7676
7578
|
default: async ({ locals, params, request, cookies }) => {
|
|
7677
|
-
const form = await superValidate(request,
|
|
7579
|
+
const form = await superValidate(request, zod4(teamInviteSchema));
|
|
7678
7580
|
|
|
7679
7581
|
if (!form.valid) {
|
|
7680
7582
|
return fail(400, { form });
|
|
@@ -7700,13 +7602,13 @@ export const actions = {
|
|
|
7700
7602
|
);
|
|
7701
7603
|
},
|
|
7702
7604
|
};
|
|
7703
|
-
`,
|
|
7605
|
+
`, Ho = `<script lang="ts">
|
|
7704
7606
|
import { untrack } from 'svelte';
|
|
7705
7607
|
import * as Dialog from '$lib/components/ui/dialog';
|
|
7706
7608
|
import { Input } from '$lib/components/ui/input';
|
|
7707
7609
|
import { goto } from '$app/navigation';
|
|
7708
7610
|
import { superForm } from 'sveltekit-superforms';
|
|
7709
|
-
import {
|
|
7611
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
7710
7612
|
import { teamInviteSchema } from '$lib/schemas/teamInvite';
|
|
7711
7613
|
import * as Form from '$lib/components/ui/form';
|
|
7712
7614
|
|
|
@@ -7715,7 +7617,7 @@ export const actions = {
|
|
|
7715
7617
|
const form = superForm(
|
|
7716
7618
|
untrack(() => data.form),
|
|
7717
7619
|
{
|
|
7718
|
-
validators:
|
|
7620
|
+
validators: zod4Client(teamInviteSchema)
|
|
7719
7621
|
}
|
|
7720
7622
|
);
|
|
7721
7623
|
|
|
@@ -7749,7 +7651,7 @@ export const actions = {
|
|
|
7749
7651
|
</form>
|
|
7750
7652
|
</Dialog.Content>
|
|
7751
7653
|
</Dialog.Root>
|
|
7752
|
-
`,
|
|
7654
|
+
`, Ko = `import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
7753
7655
|
import type { Match } from "@velastack/pocketbase";
|
|
7754
7656
|
import * as devalue from "devalue";
|
|
7755
7657
|
import type { RouteId } from "./$types";
|
|
@@ -7925,8 +7827,8 @@ describe("POST /teams/[id]/invite", () => {
|
|
|
7925
7827
|
expect(data.form.valid).toBe(false);
|
|
7926
7828
|
});
|
|
7927
7829
|
});
|
|
7928
|
-
`,
|
|
7929
|
-
import {
|
|
7830
|
+
`, Go = `import { fail, superValidate } from "sveltekit-superforms";
|
|
7831
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
7930
7832
|
import { teamRoleSchema } from "$lib/schemas/teamRole";
|
|
7931
7833
|
import { redirect } from "sveltekit-flash-message/server";
|
|
7932
7834
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
@@ -7935,14 +7837,14 @@ export const load = async ({ locals, params }) => {
|
|
|
7935
7837
|
const member = await locals.pb
|
|
7936
7838
|
.collection("team_memberships")
|
|
7937
7839
|
.getOne(params.member_id);
|
|
7938
|
-
const form = await superValidate(member,
|
|
7840
|
+
const form = await superValidate(member, zod4(teamRoleSchema));
|
|
7939
7841
|
|
|
7940
7842
|
return { form };
|
|
7941
7843
|
};
|
|
7942
7844
|
|
|
7943
7845
|
export const actions = {
|
|
7944
7846
|
default: async ({ locals, params, request, cookies }) => {
|
|
7945
|
-
const form = await superValidate(request,
|
|
7847
|
+
const form = await superValidate(request, zod4(teamRoleSchema));
|
|
7946
7848
|
|
|
7947
7849
|
if (!form.valid) {
|
|
7948
7850
|
return fail(400, { form });
|
|
@@ -7964,12 +7866,12 @@ export const actions = {
|
|
|
7964
7866
|
);
|
|
7965
7867
|
},
|
|
7966
7868
|
};
|
|
7967
|
-
`,
|
|
7869
|
+
`, Wo = `<script lang="ts">
|
|
7968
7870
|
import { untrack } from 'svelte';
|
|
7969
7871
|
import * as Dialog from '$lib/components/ui/dialog';
|
|
7970
7872
|
import { goto } from '$app/navigation';
|
|
7971
7873
|
import { superForm } from 'sveltekit-superforms';
|
|
7972
|
-
import {
|
|
7874
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
7973
7875
|
import { teamRoleSchema } from '$lib/schemas/teamRole';
|
|
7974
7876
|
import * as Form from '$lib/components/ui/form';
|
|
7975
7877
|
import * as Select from '$lib/components/ui/select';
|
|
@@ -7994,7 +7896,7 @@ export const actions = {
|
|
|
7994
7896
|
const form = superForm(
|
|
7995
7897
|
untrack(() => data.form),
|
|
7996
7898
|
{
|
|
7997
|
-
validators:
|
|
7899
|
+
validators: zod4Client(teamRoleSchema)
|
|
7998
7900
|
}
|
|
7999
7901
|
);
|
|
8000
7902
|
|
|
@@ -8037,7 +7939,7 @@ export const actions = {
|
|
|
8037
7939
|
</form>
|
|
8038
7940
|
</Dialog.Content>
|
|
8039
7941
|
</Dialog.Root>
|
|
8040
|
-
`,
|
|
7942
|
+
`, Xo = `import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
8041
7943
|
import type { Match } from "@velastack/pocketbase";
|
|
8042
7944
|
import * as devalue from "devalue";
|
|
8043
7945
|
import type { RouteId } from "./$types";
|
|
@@ -8216,7 +8118,7 @@ describe("POST /teams/[id]/member/[member_id]", () => {
|
|
|
8216
8118
|
expect(data.form.valid).toBe(false);
|
|
8217
8119
|
});
|
|
8218
8120
|
});
|
|
8219
|
-
`,
|
|
8121
|
+
`, Jo = `import {
|
|
8220
8122
|
describe,
|
|
8221
8123
|
it,
|
|
8222
8124
|
expect,
|
|
@@ -8637,21 +8539,21 @@ describe("POST /teams/[id]?/deleteTeam", () => {
|
|
|
8637
8539
|
context.admin.collection("users").delete(memberUser.id);
|
|
8638
8540
|
});
|
|
8639
8541
|
});
|
|
8640
|
-
`,
|
|
8641
|
-
import {
|
|
8542
|
+
`, Yo = `import { fail, superValidate } from "sveltekit-superforms";
|
|
8543
|
+
import { zod4 } from "sveltekit-superforms/adapters";
|
|
8642
8544
|
import { teamSchema } from "$lib/schemas/team";
|
|
8643
8545
|
import { redirect } from "sveltekit-flash-message/server";
|
|
8644
8546
|
import { setPocketbaseErrors } from "@velastack/pocketbase";
|
|
8645
8547
|
|
|
8646
8548
|
export const load = async () => {
|
|
8647
|
-
const form = await superValidate(
|
|
8549
|
+
const form = await superValidate(zod4(teamSchema));
|
|
8648
8550
|
return { form };
|
|
8649
8551
|
};
|
|
8650
8552
|
|
|
8651
8553
|
export const actions = {
|
|
8652
8554
|
default: async ({ locals, request, cookies }) => {
|
|
8653
8555
|
const user = locals.pb.authStore.record!;
|
|
8654
|
-
const form = await superValidate(request,
|
|
8556
|
+
const form = await superValidate(request, zod4(teamSchema));
|
|
8655
8557
|
|
|
8656
8558
|
if (!form.valid) {
|
|
8657
8559
|
return fail(400, { form });
|
|
@@ -8683,13 +8585,13 @@ export const actions = {
|
|
|
8683
8585
|
redirect("/teams", { type: "toast", message: "Team created" }, cookies);
|
|
8684
8586
|
},
|
|
8685
8587
|
};
|
|
8686
|
-
`,
|
|
8588
|
+
`, Zo = `<script lang="ts">
|
|
8687
8589
|
import { untrack } from 'svelte';
|
|
8688
8590
|
import * as Dialog from '$lib/components/ui/dialog';
|
|
8689
8591
|
import { Input } from '$lib/components/ui/input';
|
|
8690
8592
|
import { goto } from '$app/navigation';
|
|
8691
8593
|
import { superForm } from 'sveltekit-superforms';
|
|
8692
|
-
import {
|
|
8594
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
8693
8595
|
import { teamSchema } from '$lib/schemas/team';
|
|
8694
8596
|
import * as Form from '$lib/components/ui/form';
|
|
8695
8597
|
|
|
@@ -8698,7 +8600,7 @@ export const actions = {
|
|
|
8698
8600
|
const form = superForm(
|
|
8699
8601
|
untrack(() => data.form),
|
|
8700
8602
|
{
|
|
8701
|
-
validators:
|
|
8603
|
+
validators: zod4Client(teamSchema)
|
|
8702
8604
|
}
|
|
8703
8605
|
);
|
|
8704
8606
|
|
|
@@ -8732,7 +8634,7 @@ export const actions = {
|
|
|
8732
8634
|
</form>
|
|
8733
8635
|
</Dialog.Content>
|
|
8734
8636
|
</Dialog.Root>
|
|
8735
|
-
`,
|
|
8637
|
+
`, Qo = `import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
8736
8638
|
import type { Match } from "@velastack/pocketbase";
|
|
8737
8639
|
import * as devalue from "devalue";
|
|
8738
8640
|
import type { RouteId } from "./$types";
|
|
@@ -8810,7 +8712,7 @@ describe("POST /teams/new", () => {
|
|
|
8810
8712
|
expect(data.form.valid).toBe(false);
|
|
8811
8713
|
});
|
|
8812
8714
|
});
|
|
8813
|
-
`,
|
|
8715
|
+
`, ts = `import { describe, it, expect } from "vitest";
|
|
8814
8716
|
import type { Match } from "@velastack/pocketbase";
|
|
8815
8717
|
import type { RouteId } from "./$types";
|
|
8816
8718
|
|
|
@@ -8821,7 +8723,7 @@ describe("GET /teams", () => {
|
|
|
8821
8723
|
expect(response.status).toBe(200);
|
|
8822
8724
|
});
|
|
8823
8725
|
});
|
|
8824
|
-
`,
|
|
8726
|
+
`, es = `import { error, redirect } from "@sveltejs/kit";
|
|
8825
8727
|
import { dev } from "$app/environment";
|
|
8826
8728
|
|
|
8827
8729
|
export const load = async ({ params, cookies, url, locals }) => {
|
|
@@ -8844,7 +8746,7 @@ export const load = async ({ params, cookies, url, locals }) => {
|
|
|
8844
8746
|
|
|
8845
8747
|
return redirect(303, redirectUrl);
|
|
8846
8748
|
};
|
|
8847
|
-
`,
|
|
8749
|
+
`, ns = `import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
8848
8750
|
import type { Match } from "@velastack/pocketbase";
|
|
8849
8751
|
import type { RouteId } from "./$types";
|
|
8850
8752
|
|
|
@@ -8929,44 +8831,44 @@ describe("GET /teams/switch/[id]", () => {
|
|
|
8929
8831
|
expect(cookies).toBeUndefined();
|
|
8930
8832
|
});
|
|
8931
8833
|
});
|
|
8932
|
-
`,
|
|
8933
|
-
"./creates/src/lib/components/team-switcher.svelte":
|
|
8934
|
-
"./creates/src/lib/schemas/team.ts":
|
|
8935
|
-
"./creates/src/lib/schemas/teamInvite.ts":
|
|
8936
|
-
"./creates/src/lib/schemas/teamRole.ts":
|
|
8937
|
-
"./creates/src/routes/(app)/invite/[id]/+layout@.svelte":
|
|
8938
|
-
"./creates/src/routes/(app)/invite/[id]/+page.server.ts":
|
|
8939
|
-
"./creates/src/routes/(app)/invite/[id]/+page.svelte":
|
|
8940
|
-
"./creates/src/routes/(app)/join/[id]/+layout@.svelte":
|
|
8941
|
-
"./creates/src/routes/(app)/join/[id]/+page.server.ts":
|
|
8942
|
-
"./creates/src/routes/(app)/join/[id]/+page.svelte":
|
|
8943
|
-
"./creates/src/routes/(app)/teams/+layout.server.ts":
|
|
8944
|
-
"./creates/src/routes/(app)/teams/+layout.svelte":
|
|
8945
|
-
"./creates/src/routes/(app)/teams/+page.server.ts":
|
|
8946
|
-
"./creates/src/routes/(app)/teams/+page.svelte":
|
|
8947
|
-
"./creates/src/routes/(app)/teams/[id]/+layout.server.ts":
|
|
8948
|
-
"./creates/src/routes/(app)/teams/[id]/+layout@(app).svelte":
|
|
8949
|
-
"./creates/src/routes/(app)/teams/[id]/+page.server.ts":
|
|
8950
|
-
"./creates/src/routes/(app)/teams/[id]/+page.svelte":
|
|
8951
|
-
"./creates/src/routes/(app)/teams/[id]/authorization.ts":
|
|
8952
|
-
"./creates/src/routes/(app)/teams/[id]/invite/+page.server.ts":
|
|
8953
|
-
"./creates/src/routes/(app)/teams/[id]/invite/+page.svelte":
|
|
8954
|
-
"./creates/src/routes/(app)/teams/[id]/invite/server.test.ts":
|
|
8955
|
-
"./creates/src/routes/(app)/teams/[id]/member/[member_id]/+page.server.ts":
|
|
8956
|
-
"./creates/src/routes/(app)/teams/[id]/member/[member_id]/+page.svelte":
|
|
8957
|
-
"./creates/src/routes/(app)/teams/[id]/member/[member_id]/server.test.ts":
|
|
8958
|
-
"./creates/src/routes/(app)/teams/[id]/server.test.ts":
|
|
8959
|
-
"./creates/src/routes/(app)/teams/new/+page.server.ts":
|
|
8960
|
-
"./creates/src/routes/(app)/teams/new/+page.svelte":
|
|
8961
|
-
"./creates/src/routes/(app)/teams/new/server.test.ts":
|
|
8962
|
-
"./creates/src/routes/(app)/teams/server.test.ts":
|
|
8963
|
-
"./creates/src/routes/(app)/teams/switch/[id]/+page.server.ts":
|
|
8964
|
-
"./creates/src/routes/(app)/teams/switch/[id]/server.test.ts":
|
|
8965
|
-
}),
|
|
8966
|
-
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) {
|
|
8967
8869
|
return {
|
|
8968
|
-
creates: Object.entries(
|
|
8969
|
-
const r = M(n,
|
|
8870
|
+
creates: Object.entries(as).map(([n, a]) => {
|
|
8871
|
+
const r = M(n, rs);
|
|
8970
8872
|
return {
|
|
8971
8873
|
path: r,
|
|
8972
8874
|
language: S(r),
|
|
@@ -8992,7 +8894,7 @@ async function ds(t) {
|
|
|
8992
8894
|
collections: []
|
|
8993
8895
|
};
|
|
8994
8896
|
}
|
|
8995
|
-
const
|
|
8897
|
+
const ss = `<script lang="ts">
|
|
8996
8898
|
import type { ComponentProps } from 'svelte';
|
|
8997
8899
|
import HomeIcon from '@lucide/svelte/icons/home';
|
|
8998
8900
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
@@ -9067,7 +8969,7 @@ const ps = `<script lang="ts">
|
|
|
9067
8969
|
<NavUser {user} />
|
|
9068
8970
|
</Sidebar.Footer>
|
|
9069
8971
|
</Sidebar.Root>
|
|
9070
|
-
`,
|
|
8972
|
+
`, is = `<script lang="ts">
|
|
9071
8973
|
import { toggleMode, mode } from 'mode-watcher';
|
|
9072
8974
|
import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';
|
|
9073
8975
|
import Settings2Icon from '@lucide/svelte/icons/settings-2';
|
|
@@ -9191,7 +9093,7 @@ const ps = `<script lang="ts">
|
|
|
9191
9093
|
</DropdownMenu.Root>
|
|
9192
9094
|
</Sidebar.MenuItem>
|
|
9193
9095
|
</Sidebar.Menu>
|
|
9194
|
-
`,
|
|
9096
|
+
`, ls = `export const load = async ({ locals, depends }) => {
|
|
9195
9097
|
const user = locals.pb.authStore.record!;
|
|
9196
9098
|
// [!code highlight:3]
|
|
9197
9099
|
const team = locals.team;
|
|
@@ -9202,7 +9104,7 @@ const ps = `<script lang="ts">
|
|
|
9202
9104
|
|
|
9203
9105
|
return { user, team, teams, breadcrumbs };
|
|
9204
9106
|
};
|
|
9205
|
-
`,
|
|
9107
|
+
`, cs = `<script lang="ts">
|
|
9206
9108
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
9207
9109
|
import { Separator } from '$lib/components/ui/separator';
|
|
9208
9110
|
import AppSidebar from '$lib/components/app-sidebar.svelte';
|
|
@@ -9253,7 +9155,7 @@ const ps = `<script lang="ts">
|
|
|
9253
9155
|
background-color: var(--color-sidebar);
|
|
9254
9156
|
}
|
|
9255
9157
|
</style>
|
|
9256
|
-
`,
|
|
9158
|
+
`, ms = [
|
|
9257
9159
|
{
|
|
9258
9160
|
collectionName: "teams",
|
|
9259
9161
|
listRule: "team_memberships_via_team.user ?= @request.auth.id || owner = @request.auth.id",
|
|
@@ -9294,9 +9196,9 @@ const ps = `<script lang="ts">
|
|
|
9294
9196
|
updateRule: null,
|
|
9295
9197
|
deleteRule: null
|
|
9296
9198
|
}
|
|
9297
|
-
],
|
|
9298
|
-
function
|
|
9299
|
-
const e =
|
|
9199
|
+
], Tt = "users", G = "teams", ds = "team_memberships";
|
|
9200
|
+
function j(t) {
|
|
9201
|
+
const e = ms.find((n) => n.collectionName === t);
|
|
9300
9202
|
if (!e)
|
|
9301
9203
|
throw new Error(
|
|
9302
9204
|
`teams: missing TEAM_RULE_PATCHES entry for "${t}"`
|
|
@@ -9309,11 +9211,11 @@ function q(t) {
|
|
|
9309
9211
|
deleteRule: e.deleteRule
|
|
9310
9212
|
};
|
|
9311
9213
|
}
|
|
9312
|
-
const
|
|
9214
|
+
const ps = [
|
|
9313
9215
|
{
|
|
9314
9216
|
name: "teams",
|
|
9315
9217
|
type: "base",
|
|
9316
|
-
...
|
|
9218
|
+
...j("teams"),
|
|
9317
9219
|
fields: [
|
|
9318
9220
|
{
|
|
9319
9221
|
name: "id",
|
|
@@ -9334,7 +9236,7 @@ const vs = [
|
|
|
9334
9236
|
name: "owner",
|
|
9335
9237
|
type: "relation",
|
|
9336
9238
|
cascadeDelete: !1,
|
|
9337
|
-
collectionId:
|
|
9239
|
+
collectionId: Tt,
|
|
9338
9240
|
maxSelect: 1,
|
|
9339
9241
|
minSelect: 0,
|
|
9340
9242
|
required: !0
|
|
@@ -9356,7 +9258,7 @@ const vs = [
|
|
|
9356
9258
|
{
|
|
9357
9259
|
name: "team_memberships",
|
|
9358
9260
|
type: "base",
|
|
9359
|
-
...
|
|
9261
|
+
...j("team_memberships"),
|
|
9360
9262
|
fields: [
|
|
9361
9263
|
{
|
|
9362
9264
|
name: "id",
|
|
@@ -9380,7 +9282,7 @@ const vs = [
|
|
|
9380
9282
|
{
|
|
9381
9283
|
name: "user",
|
|
9382
9284
|
cascadeDelete: !0,
|
|
9383
|
-
collectionId:
|
|
9285
|
+
collectionId: Tt,
|
|
9384
9286
|
maxSelect: 1,
|
|
9385
9287
|
minSelect: 0,
|
|
9386
9288
|
required: !0,
|
|
@@ -9410,7 +9312,7 @@ const vs = [
|
|
|
9410
9312
|
{
|
|
9411
9313
|
name: "team_users",
|
|
9412
9314
|
type: "view",
|
|
9413
|
-
...
|
|
9315
|
+
...j("team_users"),
|
|
9414
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;",
|
|
9415
9317
|
fields: [
|
|
9416
9318
|
{
|
|
@@ -9436,7 +9338,7 @@ const vs = [
|
|
|
9436
9338
|
{
|
|
9437
9339
|
name: "membership_id",
|
|
9438
9340
|
cascadeDelete: !1,
|
|
9439
|
-
collectionId:
|
|
9341
|
+
collectionId: ds,
|
|
9440
9342
|
maxSelect: 1,
|
|
9441
9343
|
minSelect: 0,
|
|
9442
9344
|
required: !1,
|
|
@@ -9463,7 +9365,7 @@ const vs = [
|
|
|
9463
9365
|
{
|
|
9464
9366
|
name: "team_invites",
|
|
9465
9367
|
type: "base",
|
|
9466
|
-
...
|
|
9368
|
+
...j("team_invites"),
|
|
9467
9369
|
fields: [
|
|
9468
9370
|
{
|
|
9469
9371
|
name: "id",
|
|
@@ -9506,7 +9408,7 @@ const vs = [
|
|
|
9506
9408
|
{
|
|
9507
9409
|
name: "team_invite_links",
|
|
9508
9410
|
type: "base",
|
|
9509
|
-
...
|
|
9411
|
+
...j("team_invite_links"),
|
|
9510
9412
|
indexes: [
|
|
9511
9413
|
"CREATE UNIQUE INDEX `idx_9y3Oz1KVzz` ON `team_invite_links` (`team`)"
|
|
9512
9414
|
],
|
|
@@ -9544,15 +9446,15 @@ const vs = [
|
|
|
9544
9446
|
}
|
|
9545
9447
|
]
|
|
9546
9448
|
}
|
|
9547
|
-
],
|
|
9548
|
-
"./preview-modifies/src/lib/components/app-sidebar.svelte":
|
|
9549
|
-
"./preview-modifies/src/lib/components/nav-user.svelte":
|
|
9550
|
-
"./preview-modifies/src/routes/(app)/+layout.server.ts":
|
|
9551
|
-
"./preview-modifies/src/routes/(app)/+layout.svelte":
|
|
9552
|
-
}),
|
|
9553
|
-
async function
|
|
9554
|
-
const e = Object.entries(
|
|
9555
|
-
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);
|
|
9556
9458
|
return {
|
|
9557
9459
|
path: r,
|
|
9558
9460
|
language: S(r),
|
|
@@ -9565,27 +9467,27 @@ async function ys(t) {
|
|
|
9565
9467
|
deletes: [],
|
|
9566
9468
|
components: [],
|
|
9567
9469
|
packages: [],
|
|
9568
|
-
collections:
|
|
9470
|
+
collections: ps
|
|
9569
9471
|
};
|
|
9570
9472
|
}
|
|
9571
|
-
const
|
|
9572
|
-
async function
|
|
9573
|
-
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();
|
|
9574
9476
|
if (t.env === "preview") {
|
|
9575
|
-
const s = await
|
|
9477
|
+
const s = await gs();
|
|
9576
9478
|
return $(I([e, s]));
|
|
9577
9479
|
}
|
|
9578
|
-
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");
|
|
9579
9481
|
return r(
|
|
9580
9482
|
await $(I([e, a])),
|
|
9581
9483
|
t
|
|
9582
9484
|
);
|
|
9583
9485
|
}
|
|
9584
|
-
const
|
|
9585
|
-
version:
|
|
9586
|
-
slug:
|
|
9587
|
-
source:
|
|
9588
|
-
docs:
|
|
9486
|
+
const ys = {
|
|
9487
|
+
version: bs,
|
|
9488
|
+
slug: hs,
|
|
9489
|
+
source: vs,
|
|
9490
|
+
docs: ws,
|
|
9589
9491
|
plan: "pro",
|
|
9590
9492
|
title: "Enable teams",
|
|
9591
9493
|
summary: "Adds multi-tenant teams with memberships, invites, and a sidebar team switcher.",
|
|
@@ -9613,20 +9515,20 @@ const ks = {
|
|
|
9613
9515
|
},
|
|
9614
9516
|
tests: 36,
|
|
9615
9517
|
baseline: "velastack",
|
|
9616
|
-
generate:
|
|
9617
|
-
},
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
],
|
|
9628
|
-
|
|
9629
|
-
),
|
|
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(
|
|
9630
9532
|
(t, e) => {
|
|
9631
9533
|
const n = e.category;
|
|
9632
9534
|
return t[n] ?? (t[n] = []), t[n].push(e), t;
|
|
@@ -9634,14 +9536,14 @@ const ks = {
|
|
|
9634
9536
|
{}
|
|
9635
9537
|
);
|
|
9636
9538
|
export {
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9539
|
+
Ss as D,
|
|
9540
|
+
Fs as M,
|
|
9541
|
+
ms as T,
|
|
9542
|
+
Rs as a,
|
|
9543
|
+
Is as b,
|
|
9544
|
+
u as d,
|
|
9643
9545
|
S as l,
|
|
9644
|
-
|
|
9645
|
-
|
|
9546
|
+
Xt as p,
|
|
9547
|
+
ks as v
|
|
9646
9548
|
};
|
|
9647
|
-
//# sourceMappingURL=index-
|
|
9549
|
+
//# sourceMappingURL=index-CoeyNVkU.js.map
|