@velastack/patterns 0.0.2 → 0.0.3
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-BCHbdy1Q.js → collections-Hdx-NhPn.js} +3 -3
- package/dist/chunks/{collections-BCHbdy1Q.js.map → collections-Hdx-NhPn.js.map} +1 -1
- package/dist/chunks/{env.runtime-arRRKYvH.js → env.runtime-B18zkdjb.js} +2 -2
- package/dist/chunks/{env.runtime-arRRKYvH.js.map → env.runtime-B18zkdjb.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BXbRs6o2.js → generate.runtime-B5XT4Q2Z.js} +75 -141
- package/dist/chunks/{generate.runtime-BXbRs6o2.js.map → generate.runtime-B5XT4Q2Z.js.map} +1 -1
- package/dist/chunks/{index-8rNhWMFD.js → index-Crknwby3.js} +669 -571
- package/dist/chunks/index-Crknwby3.js.map +1 -0
- package/dist/chunks/{pocketbase-CNlQBo9r.js → pocketbase-BBMFXc3L.js} +2 -2
- package/dist/chunks/{pocketbase-CNlQBo9r.js.map → pocketbase-BBMFXc3L.js.map} +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +1 -1
- package/package.json +4 -2
- package/dist/chunks/index-8rNhWMFD.js.map +0 -1
|
@@ -1,4 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import oe from "prettier";
|
|
2
|
+
import se from "prettier-plugin-svelte";
|
|
3
|
+
function ie(t) {
|
|
4
|
+
return t.language === "ts" || t.language === "svelte" || t.path.endsWith(".json");
|
|
5
|
+
}
|
|
6
|
+
async function le(t) {
|
|
7
|
+
if (!ie(t))
|
|
8
|
+
return t;
|
|
9
|
+
try {
|
|
10
|
+
const e = await oe.format(t.content, {
|
|
11
|
+
filepath: t.path,
|
|
12
|
+
plugins: [se]
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
...t,
|
|
16
|
+
content: e
|
|
17
|
+
};
|
|
18
|
+
} catch {
|
|
19
|
+
return t;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function ct(t) {
|
|
23
|
+
return Promise.all(t.map((e) => le(e)));
|
|
24
|
+
}
|
|
25
|
+
async function k(t) {
|
|
26
|
+
const [e, n] = await Promise.all([
|
|
27
|
+
ct(t.creates),
|
|
28
|
+
ct(t.modifies)
|
|
29
|
+
]);
|
|
30
|
+
return {
|
|
31
|
+
...t,
|
|
32
|
+
creates: e,
|
|
33
|
+
modifies: n
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function mt(t, e) {
|
|
2
37
|
var n = Object.keys(t);
|
|
3
38
|
if (Object.getOwnPropertySymbols) {
|
|
4
39
|
var r = Object.getOwnPropertySymbols(t);
|
|
@@ -8,25 +43,25 @@ function lt(t, e) {
|
|
|
8
43
|
}
|
|
9
44
|
return n;
|
|
10
45
|
}
|
|
11
|
-
function
|
|
46
|
+
function ut(t) {
|
|
12
47
|
for (var e = 1; e < arguments.length; e++) {
|
|
13
48
|
var n = arguments[e] != null ? arguments[e] : {};
|
|
14
|
-
e % 2 ?
|
|
15
|
-
|
|
16
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) :
|
|
49
|
+
e % 2 ? mt(Object(n), !0).forEach(function(r) {
|
|
50
|
+
ce(t, r, n[r]);
|
|
51
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : mt(Object(n)).forEach(function(r) {
|
|
17
52
|
Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
|
|
18
53
|
});
|
|
19
54
|
}
|
|
20
55
|
return t;
|
|
21
56
|
}
|
|
22
|
-
function
|
|
23
|
-
return e =
|
|
57
|
+
function ce(t, e, n) {
|
|
58
|
+
return e = me(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
|
|
24
59
|
}
|
|
25
|
-
function
|
|
26
|
-
var e =
|
|
60
|
+
function me(t) {
|
|
61
|
+
var e = ue(t, "string");
|
|
27
62
|
return typeof e == "symbol" ? e : String(e);
|
|
28
63
|
}
|
|
29
|
-
function
|
|
64
|
+
function ue(t, e) {
|
|
30
65
|
if (typeof t != "object" || t === null) return t;
|
|
31
66
|
var n = t[Symbol.toPrimitive];
|
|
32
67
|
if (n !== void 0) {
|
|
@@ -36,9 +71,9 @@ function oe(t, e) {
|
|
|
36
71
|
}
|
|
37
72
|
return (e === "string" ? String : Number)(t);
|
|
38
73
|
}
|
|
39
|
-
const p =
|
|
40
|
-
function
|
|
41
|
-
return e.withOptions = (n) =>
|
|
74
|
+
const p = zt({});
|
|
75
|
+
function zt(t) {
|
|
76
|
+
return e.withOptions = (n) => zt(ut(ut({}, t), n)), e;
|
|
42
77
|
function e(n, ...r) {
|
|
43
78
|
const a = typeof n == "string" ? [n] : n.raw, {
|
|
44
79
|
alignValues: s = !1,
|
|
@@ -49,7 +84,7 @@ function Tt(t) {
|
|
|
49
84
|
for (let f = 0; f < a.length; f++) {
|
|
50
85
|
let g = a[f];
|
|
51
86
|
if (i && (g = g.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), c += g, f < r.length) {
|
|
52
|
-
const x = s ?
|
|
87
|
+
const x = s ? pe(r[f], c) : r[f];
|
|
53
88
|
c += x;
|
|
54
89
|
}
|
|
55
90
|
}
|
|
@@ -80,7 +115,7 @@ function Tt(t) {
|
|
|
80
115
|
)), c;
|
|
81
116
|
}
|
|
82
117
|
}
|
|
83
|
-
function
|
|
118
|
+
function pe(t, e) {
|
|
84
119
|
if (typeof t != "string" || !t.includes(`
|
|
85
120
|
`))
|
|
86
121
|
return t;
|
|
@@ -93,13 +128,13 @@ ${a}`);
|
|
|
93
128
|
}
|
|
94
129
|
return t;
|
|
95
130
|
}
|
|
96
|
-
function
|
|
131
|
+
function Dt(t, e) {
|
|
97
132
|
return t.startsWith(e) ? t.slice(e.length) : t.replace(/^\.\//, "");
|
|
98
133
|
}
|
|
99
|
-
function
|
|
134
|
+
function j(t) {
|
|
100
135
|
return t.endsWith(".svelte") ? "svelte" : t.endsWith(".tsx") || t.endsWith(".ts") ? "ts" : t.endsWith(".jsx") || t.endsWith(".js") ? "js" : "text";
|
|
101
136
|
}
|
|
102
|
-
function
|
|
137
|
+
function pt(t) {
|
|
103
138
|
return t.reduce(
|
|
104
139
|
(e, n) => (e.creates.push(...n.creates), e.modifies.push(...n.modifies), e.deletes.push(...n.deletes), e.components.push(...n.components), e.packages.push(...n.packages), e.collections.push(...n.collections), e),
|
|
105
140
|
{
|
|
@@ -112,7 +147,7 @@ function mt(t) {
|
|
|
112
147
|
}
|
|
113
148
|
);
|
|
114
149
|
}
|
|
115
|
-
const
|
|
150
|
+
const de = {
|
|
116
151
|
text: ["form", "input"],
|
|
117
152
|
number: ["form", "input"],
|
|
118
153
|
email: ["form", "input"],
|
|
@@ -127,7 +162,7 @@ const ie = {
|
|
|
127
162
|
url: ["form", "input"],
|
|
128
163
|
editor: ["form", "textarea"],
|
|
129
164
|
autodate: ["form", "input"]
|
|
130
|
-
},
|
|
165
|
+
}, fe = {
|
|
131
166
|
form: ['import * as Form from "$lib/components/ui/form";'],
|
|
132
167
|
"file-form": ['import * as FileForm from "$lib/components/ui/file-form";'],
|
|
133
168
|
multiselect: [
|
|
@@ -141,10 +176,10 @@ const ie = {
|
|
|
141
176
|
geopoint: ['import { GeopointInput } from "$lib/components/ui/geopoint";'],
|
|
142
177
|
button: ['import { Button } from "$lib/components/ui/button";']
|
|
143
178
|
};
|
|
144
|
-
function
|
|
179
|
+
function R(t) {
|
|
145
180
|
return `$formData.${t.name}`;
|
|
146
181
|
}
|
|
147
|
-
function
|
|
182
|
+
function L(t) {
|
|
148
183
|
return t.inputProps ? Object.entries(t.inputProps).flatMap(([e, n]) => n == null || n === !1 ? [] : n === !0 ? [` ${e}`] : [` ${e}=${JSON.stringify(String(n))}`]).join("") : "";
|
|
149
184
|
}
|
|
150
185
|
function P(t) {
|
|
@@ -155,41 +190,41 @@ function P(t) {
|
|
|
155
190
|
</div>
|
|
156
191
|
` : `<Form.Label>${t.title}</Form.Label>`;
|
|
157
192
|
}
|
|
158
|
-
function
|
|
193
|
+
function z(t, e) {
|
|
159
194
|
const n = t.required ? " required" : "";
|
|
160
195
|
return p`
|
|
161
196
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
162
197
|
<Form.Control>
|
|
163
198
|
{#snippet children({ props })}
|
|
164
199
|
${P(t)}
|
|
165
|
-
<Input {...props} type="${e}" bind:value={${
|
|
200
|
+
<Input {...props} type="${e}" bind:value={${R(t)}}${n}${L(t)} />
|
|
166
201
|
{/snippet}
|
|
167
202
|
</Form.Control>
|
|
168
203
|
<Form.FieldErrors class="contents text-destructive" />
|
|
169
204
|
</Form.Field>
|
|
170
205
|
`;
|
|
171
206
|
}
|
|
172
|
-
function
|
|
207
|
+
function he(t) {
|
|
173
208
|
const e = t.required ? " required" : "";
|
|
174
209
|
return p`
|
|
175
210
|
<Form.Field {form} name="${t.name}" class="col-span-2">
|
|
176
211
|
<Form.Control>
|
|
177
212
|
{#snippet children({ props })}
|
|
178
213
|
${P(t)}
|
|
179
|
-
<Textarea {...props} bind:value={${
|
|
214
|
+
<Textarea {...props} bind:value={${R(t)}}${e}${L(t)} />
|
|
180
215
|
{/snippet}
|
|
181
216
|
</Form.Control>
|
|
182
217
|
<Form.FieldErrors class="contents text-destructive" />
|
|
183
218
|
</Form.Field>
|
|
184
219
|
`;
|
|
185
220
|
}
|
|
186
|
-
function
|
|
221
|
+
function ge(t) {
|
|
187
222
|
const e = t.required ? " required" : "";
|
|
188
223
|
return p`
|
|
189
224
|
<Form.Field {form} name="${t.name}" class="col-span-1 flex items-start space-x-2">
|
|
190
225
|
<Form.Control>
|
|
191
226
|
{#snippet children({ props })}
|
|
192
|
-
<Checkbox {...props} bind:checked={${
|
|
227
|
+
<Checkbox {...props} bind:checked={${R(t)}}${e}${L(t)} />
|
|
193
228
|
${P(t)}
|
|
194
229
|
{/snippet}
|
|
195
230
|
</Form.Control>
|
|
@@ -197,20 +232,20 @@ function me(t) {
|
|
|
197
232
|
</Form.Field>
|
|
198
233
|
`;
|
|
199
234
|
}
|
|
200
|
-
function
|
|
235
|
+
function be(t) {
|
|
201
236
|
return p`
|
|
202
237
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
203
238
|
<Form.Control>
|
|
204
239
|
{#snippet children({ props })}
|
|
205
240
|
${P(t)}
|
|
206
|
-
<GeopointInput {...props} bind:value={${
|
|
241
|
+
<GeopointInput {...props} bind:value={${R(t)}} />
|
|
207
242
|
{/snippet}
|
|
208
243
|
</Form.Control>
|
|
209
244
|
<Form.FieldErrors class="contents text-destructive" />
|
|
210
245
|
</Form.Field>
|
|
211
246
|
`;
|
|
212
247
|
}
|
|
213
|
-
function
|
|
248
|
+
function ve(t) {
|
|
214
249
|
const e = t.required ? " required" : "", n = t.maxSelect > 1 ? "Multiple" : "Single";
|
|
215
250
|
return p`
|
|
216
251
|
<FileForm.Field {form} name="${t.name}" class="col-span-1">
|
|
@@ -228,7 +263,7 @@ function pe(t) {
|
|
|
228
263
|
</div>
|
|
229
264
|
{/snippet}
|
|
230
265
|
{#snippet input()}
|
|
231
|
-
<FileForm.Input {...props}${e}${
|
|
266
|
+
<FileForm.Input {...props}${e}${L(t)} />
|
|
232
267
|
{/snippet}
|
|
233
268
|
</FileForm.${n}>
|
|
234
269
|
{/snippet}
|
|
@@ -237,7 +272,7 @@ function pe(t) {
|
|
|
237
272
|
</FileForm.Field>
|
|
238
273
|
`;
|
|
239
274
|
}
|
|
240
|
-
function
|
|
275
|
+
function we(t) {
|
|
241
276
|
const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", r = t.maxSelect > 1 ? "Select options" : "Select an option", a = t.options.map(
|
|
242
277
|
(s) => `<MultiSelect.Item value=${JSON.stringify(s.value)} label={${t.name}Labels[${JSON.stringify(s.value)}].label} />`
|
|
243
278
|
).join(`
|
|
@@ -248,7 +283,7 @@ function de(t) {
|
|
|
248
283
|
{#snippet children({ props })}
|
|
249
284
|
${P(t)}
|
|
250
285
|
<MultiSelect.Trigger class="w-full justify-between">
|
|
251
|
-
<MultiSelect.Input bind:value={${
|
|
286
|
+
<MultiSelect.Input bind:value={${R(t)}} placeholder="${r}" {...props}>
|
|
252
287
|
{#snippet children({ selected })}
|
|
253
288
|
<div class="flex flex-wrap gap-1">
|
|
254
289
|
{#each selected as value}
|
|
@@ -275,7 +310,7 @@ function de(t) {
|
|
|
275
310
|
</MultiSelect.Field>
|
|
276
311
|
`;
|
|
277
312
|
}
|
|
278
|
-
function
|
|
313
|
+
function ye(t) {
|
|
279
314
|
const e = t.maxSelect > 1 ? "multiple" : "single", n = t.maxSelect > 1 ? `Select ${t.relatedModel.pluralDisplayName.toLowerCase()}` : `Select ${t.relatedModel.displayName.toLowerCase()}`, r = `Search ${t.relatedModel.pluralDisplayName.toLowerCase()}...`, a = `No ${t.relatedModel.pluralDisplayName.toLowerCase()} found`, s = t.relatedModel.name, i = t.relatedModel.pluralName;
|
|
280
315
|
return p`
|
|
281
316
|
<MultiSelect.Field {form} type="${e}" name="${t.name}" class="col-span-1">
|
|
@@ -283,7 +318,7 @@ function fe(t) {
|
|
|
283
318
|
{#snippet children({ props })}
|
|
284
319
|
<Form.Label>${t.title}</Form.Label>
|
|
285
320
|
<MultiSelect.Trigger class="w-full justify-between">
|
|
286
|
-
<MultiSelect.Input bind:value={${
|
|
321
|
+
<MultiSelect.Input bind:value={${R(t)}} placeholder="${n}" {...props}>
|
|
287
322
|
{#snippet children({ selected })}
|
|
288
323
|
<div class="flex flex-wrap gap-1">
|
|
289
324
|
{#each selected as value}
|
|
@@ -313,53 +348,53 @@ function fe(t) {
|
|
|
313
348
|
</MultiSelect.Field>
|
|
314
349
|
`;
|
|
315
350
|
}
|
|
316
|
-
function
|
|
351
|
+
function xe(t) {
|
|
317
352
|
return p`
|
|
318
353
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
319
354
|
<Form.Control>
|
|
320
355
|
{#snippet children({ props })}
|
|
321
356
|
${P(t)}
|
|
322
|
-
<Input {...props} type="text" value={${
|
|
357
|
+
<Input {...props} type="text" value={${R(t)}}${L(t)} readonly />
|
|
323
358
|
{/snippet}
|
|
324
359
|
</Form.Control>
|
|
325
360
|
<Form.FieldErrors class="contents text-destructive" />
|
|
326
361
|
</Form.Field>
|
|
327
362
|
`;
|
|
328
363
|
}
|
|
329
|
-
function
|
|
364
|
+
function et(t) {
|
|
330
365
|
switch (t.type) {
|
|
331
366
|
case "text":
|
|
332
|
-
return
|
|
367
|
+
return z(t, "text");
|
|
333
368
|
case "number":
|
|
334
|
-
return
|
|
369
|
+
return z(t, "number");
|
|
335
370
|
case "date":
|
|
336
|
-
return
|
|
371
|
+
return z(t, "date");
|
|
337
372
|
case "email":
|
|
338
|
-
return
|
|
373
|
+
return z(t, "email");
|
|
339
374
|
case "password":
|
|
340
|
-
return
|
|
375
|
+
return z(t, "password");
|
|
341
376
|
case "url":
|
|
342
|
-
return
|
|
377
|
+
return z(t, "url");
|
|
343
378
|
case "autodate":
|
|
344
|
-
return
|
|
379
|
+
return xe(t);
|
|
345
380
|
case "editor":
|
|
346
381
|
case "json":
|
|
347
|
-
return
|
|
382
|
+
return he(t);
|
|
348
383
|
case "bool":
|
|
349
|
-
return
|
|
384
|
+
return ge(t);
|
|
350
385
|
case "geoPoint":
|
|
351
|
-
return
|
|
386
|
+
return be(t);
|
|
352
387
|
case "file":
|
|
353
|
-
return
|
|
388
|
+
return ve(t);
|
|
354
389
|
case "select":
|
|
355
|
-
return
|
|
390
|
+
return we(t);
|
|
356
391
|
case "relation":
|
|
357
|
-
return
|
|
392
|
+
return ye(t);
|
|
358
393
|
default:
|
|
359
394
|
return t;
|
|
360
395
|
}
|
|
361
396
|
}
|
|
362
|
-
function
|
|
397
|
+
function At(t) {
|
|
363
398
|
const e = t.options.map(
|
|
364
399
|
(n) => p`
|
|
365
400
|
${JSON.stringify(n.value)}: {
|
|
@@ -375,17 +410,17 @@ function Dt(t) {
|
|
|
375
410
|
} as const;
|
|
376
411
|
`;
|
|
377
412
|
}
|
|
378
|
-
function
|
|
379
|
-
const e = t.flatMap((n) =>
|
|
413
|
+
function O(t) {
|
|
414
|
+
const e = t.flatMap((n) => de[n.type]);
|
|
380
415
|
return [...new Set(e)];
|
|
381
416
|
}
|
|
382
|
-
function
|
|
383
|
-
return [...new Set(t.flatMap((e) =>
|
|
417
|
+
function nt(t) {
|
|
418
|
+
return [...new Set(t.flatMap((e) => fe[e]))];
|
|
384
419
|
}
|
|
385
|
-
function
|
|
420
|
+
function M(t, e) {
|
|
386
421
|
return `data.${t.name}.${e.name}`;
|
|
387
422
|
}
|
|
388
|
-
function
|
|
423
|
+
function J(t, e, n) {
|
|
389
424
|
return p`
|
|
390
425
|
<div class="space-y-2">
|
|
391
426
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
@@ -393,8 +428,8 @@ function Y(t, e, n) {
|
|
|
393
428
|
</div>
|
|
394
429
|
`;
|
|
395
430
|
}
|
|
396
|
-
function
|
|
397
|
-
const n =
|
|
431
|
+
function $e(t, e) {
|
|
432
|
+
const n = M(t, e), r = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, a = e.required ? r : p`
|
|
398
433
|
{#if ${n}}
|
|
399
434
|
${r}
|
|
400
435
|
{/if}
|
|
@@ -406,8 +441,8 @@ function ge(t, e) {
|
|
|
406
441
|
</div>
|
|
407
442
|
`;
|
|
408
443
|
}
|
|
409
|
-
function
|
|
410
|
-
const n =
|
|
444
|
+
function Fe(t, e) {
|
|
445
|
+
const n = M(t, e), r = p`
|
|
411
446
|
<a href={${n}} target="_blank" rel="noopener noreferrer">
|
|
412
447
|
{${n}}
|
|
413
448
|
</a>
|
|
@@ -425,8 +460,8 @@ function be(t, e) {
|
|
|
425
460
|
</div>
|
|
426
461
|
`;
|
|
427
462
|
}
|
|
428
|
-
function
|
|
429
|
-
const n =
|
|
463
|
+
function Ce(t, e) {
|
|
464
|
+
const n = M(t, e);
|
|
430
465
|
if (e.maxSelect > 1)
|
|
431
466
|
return p`
|
|
432
467
|
<div class="space-y-2">
|
|
@@ -448,8 +483,8 @@ function ve(t, e) {
|
|
|
448
483
|
</div>
|
|
449
484
|
`;
|
|
450
485
|
}
|
|
451
|
-
function
|
|
452
|
-
const n =
|
|
486
|
+
function _e(t, e) {
|
|
487
|
+
const n = M(t, e);
|
|
453
488
|
return e.maxSelect > 1 ? p`
|
|
454
489
|
<div class="space-y-2">
|
|
455
490
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
@@ -494,11 +529,11 @@ function we(t, e) {
|
|
|
494
529
|
</div>
|
|
495
530
|
`;
|
|
496
531
|
}
|
|
497
|
-
function
|
|
532
|
+
function Se(t) {
|
|
498
533
|
return `/${t.relatedModel.routeSegment}`;
|
|
499
534
|
}
|
|
500
|
-
function
|
|
501
|
-
const n = `data.${t.name}.expand?.${e.name}`, r =
|
|
535
|
+
function ke(t, e) {
|
|
536
|
+
const n = `data.${t.name}.expand?.${e.name}`, r = Se(e);
|
|
502
537
|
return e.maxSelect > 1 ? p`
|
|
503
538
|
<div class="space-y-2">
|
|
504
539
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
@@ -525,8 +560,8 @@ function xe(t, e) {
|
|
|
525
560
|
</div>
|
|
526
561
|
`;
|
|
527
562
|
}
|
|
528
|
-
function
|
|
529
|
-
const n =
|
|
563
|
+
function Me(t, e) {
|
|
564
|
+
const n = M(t, e), r = p`
|
|
530
565
|
{#await import("$lib/components/ui/leaflet/leaflet.svelte")}
|
|
531
566
|
<div class="h-56.25 w-full bg-input rounded-md"></div>
|
|
532
567
|
{:then { default: Leaflet }}
|
|
@@ -547,13 +582,13 @@ function $e(t, e) {
|
|
|
547
582
|
</div>
|
|
548
583
|
`;
|
|
549
584
|
}
|
|
550
|
-
function
|
|
585
|
+
function Re(t, e) {
|
|
551
586
|
switch (e.type) {
|
|
552
587
|
case "text":
|
|
553
588
|
case "number":
|
|
554
589
|
case "email":
|
|
555
590
|
case "editor":
|
|
556
|
-
return
|
|
591
|
+
return J(t, e, `{${M(t, e)}}`);
|
|
557
592
|
case "password":
|
|
558
593
|
return p`
|
|
559
594
|
<div class="space-y-2">
|
|
@@ -564,34 +599,34 @@ function Fe(t, e) {
|
|
|
564
599
|
</div>
|
|
565
600
|
`;
|
|
566
601
|
case "bool":
|
|
567
|
-
return
|
|
602
|
+
return J(
|
|
568
603
|
t,
|
|
569
604
|
e,
|
|
570
|
-
`{${
|
|
605
|
+
`{${M(t, e)} ? "Yes" : "No"}`
|
|
571
606
|
);
|
|
572
607
|
case "date":
|
|
573
608
|
case "autodate":
|
|
574
|
-
return
|
|
609
|
+
return $e(t, e);
|
|
575
610
|
case "url":
|
|
576
|
-
return
|
|
611
|
+
return Fe(t, e);
|
|
577
612
|
case "select":
|
|
578
|
-
return
|
|
613
|
+
return Ce(t, e);
|
|
579
614
|
case "file":
|
|
580
|
-
return
|
|
615
|
+
return _e(t, e);
|
|
581
616
|
case "json":
|
|
582
|
-
return
|
|
617
|
+
return J(t, e, `{JSON.stringify(${M(t, e)})}`);
|
|
583
618
|
case "geoPoint":
|
|
584
|
-
return
|
|
619
|
+
return Me(t, e);
|
|
585
620
|
case "relation":
|
|
586
|
-
return
|
|
621
|
+
return ke(t, e);
|
|
587
622
|
default:
|
|
588
623
|
return e;
|
|
589
624
|
}
|
|
590
625
|
}
|
|
591
|
-
const
|
|
592
|
-
function
|
|
626
|
+
const Pe = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), Ee = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), Ie = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), Te = /[^\p{L}\d]+/giu, dt = "$1\0$2", ft = "";
|
|
627
|
+
function Nt(t) {
|
|
593
628
|
let e = t.trim();
|
|
594
|
-
e = e.replace(
|
|
629
|
+
e = e.replace(Pe, dt).replace(Ee, dt), e = e.replace(Te, "\0");
|
|
595
630
|
let n = 0, r = e.length;
|
|
596
631
|
for (; e.charAt(n) === "\0"; )
|
|
597
632
|
n++;
|
|
@@ -601,10 +636,10 @@ function At(t) {
|
|
|
601
636
|
r--;
|
|
602
637
|
return e.slice(n, r).split(/\0/g);
|
|
603
638
|
}
|
|
604
|
-
function
|
|
605
|
-
const e =
|
|
639
|
+
function ze(t) {
|
|
640
|
+
const e = Nt(t);
|
|
606
641
|
for (let n = 0; n < e.length; n++) {
|
|
607
|
-
const r = e[n], a =
|
|
642
|
+
const r = e[n], a = Ie.exec(r);
|
|
608
643
|
if (a) {
|
|
609
644
|
const s = a.index + (a[1] ?? a[2]).length;
|
|
610
645
|
e.splice(n, 1, r.slice(0, s), r.slice(s));
|
|
@@ -612,45 +647,45 @@ function Me(t) {
|
|
|
612
647
|
}
|
|
613
648
|
return e;
|
|
614
649
|
}
|
|
615
|
-
function
|
|
616
|
-
const [n, r, a] =
|
|
617
|
-
return n + r.map(
|
|
650
|
+
function Bt(t, e) {
|
|
651
|
+
const [n, r, a] = G(t, e);
|
|
652
|
+
return n + r.map(H(e == null ? void 0 : e.locale)).join((e == null ? void 0 : e.delimiter) ?? " ") + a;
|
|
618
653
|
}
|
|
619
|
-
function
|
|
620
|
-
const [n, r, a] =
|
|
654
|
+
function N(t, e) {
|
|
655
|
+
const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), o = jt(s, i);
|
|
621
656
|
return n + r.map((c, m) => m === 0 ? s(c) : o(c, m)).join("") + a;
|
|
622
657
|
}
|
|
623
|
-
function
|
|
624
|
-
const [n, r, a] =
|
|
658
|
+
function De(t, e) {
|
|
659
|
+
const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), o = jt(s, i);
|
|
625
660
|
return n + r.map(o).join("") + a;
|
|
626
661
|
}
|
|
627
|
-
function
|
|
628
|
-
const [n, r, a] =
|
|
629
|
-
return n + r.map(
|
|
662
|
+
function rt(t, e) {
|
|
663
|
+
const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale);
|
|
664
|
+
return n + r.map(Be(s, i)).join(" ") + a;
|
|
630
665
|
}
|
|
631
|
-
function
|
|
632
|
-
return
|
|
666
|
+
function Ae(t, e) {
|
|
667
|
+
return Bt(t, { delimiter: "-", ...e });
|
|
633
668
|
}
|
|
634
|
-
function
|
|
635
|
-
return
|
|
669
|
+
function Ne(t, e) {
|
|
670
|
+
return Bt(t, { delimiter: "_", ...e });
|
|
636
671
|
}
|
|
637
|
-
function
|
|
672
|
+
function H(t) {
|
|
638
673
|
return t === !1 ? (e) => e.toLowerCase() : (e) => e.toLocaleLowerCase(t);
|
|
639
674
|
}
|
|
640
|
-
function
|
|
675
|
+
function at(t) {
|
|
641
676
|
return (e) => e.toLocaleUpperCase(t);
|
|
642
677
|
}
|
|
643
|
-
function
|
|
678
|
+
function Be(t, e) {
|
|
644
679
|
return (n) => `${e(n[0])}${t(n.slice(1))}`;
|
|
645
680
|
}
|
|
646
|
-
function
|
|
681
|
+
function jt(t, e) {
|
|
647
682
|
return (n, r) => {
|
|
648
683
|
const a = n[0];
|
|
649
684
|
return (r > 0 && a >= "0" && a <= "9" ? "_" + a : e(a)) + t(n.slice(1));
|
|
650
685
|
};
|
|
651
686
|
}
|
|
652
|
-
function
|
|
653
|
-
const n = e.split ?? (e.separateNumbers ?
|
|
687
|
+
function G(t, e = {}) {
|
|
688
|
+
const n = e.split ?? (e.separateNumbers ? ze : Nt), r = e.prefixCharacters ?? ft, a = e.suffixCharacters ?? ft;
|
|
654
689
|
let s = 0, i = t.length;
|
|
655
690
|
for (; s < t.length; ) {
|
|
656
691
|
const o = t.charAt(s);
|
|
@@ -670,18 +705,18 @@ function H(t, e = {}) {
|
|
|
670
705
|
t.slice(i)
|
|
671
706
|
];
|
|
672
707
|
}
|
|
673
|
-
function
|
|
708
|
+
function je(t) {
|
|
674
709
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
675
710
|
}
|
|
676
|
-
function
|
|
711
|
+
function Le(t) {
|
|
677
712
|
throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
678
713
|
}
|
|
679
|
-
var
|
|
680
|
-
function
|
|
681
|
-
return
|
|
714
|
+
var V = { exports: {} }, Oe = V.exports, ht;
|
|
715
|
+
function qe() {
|
|
716
|
+
return ht || (ht = 1, (function(t, e) {
|
|
682
717
|
(function(n, r) {
|
|
683
|
-
typeof
|
|
684
|
-
})(
|
|
718
|
+
typeof Le == "function" ? t.exports = r() : n.pluralize = r();
|
|
719
|
+
})(Oe, function() {
|
|
685
720
|
var n = [], r = [], a = {}, s = {}, i = {};
|
|
686
721
|
function o(l) {
|
|
687
722
|
return typeof l == "string" ? new RegExp("^" + l + "$", "i") : l;
|
|
@@ -717,8 +752,8 @@ function Ae() {
|
|
|
717
752
|
}
|
|
718
753
|
function x(l, d, w, $) {
|
|
719
754
|
return function(F) {
|
|
720
|
-
var
|
|
721
|
-
return d.hasOwnProperty(
|
|
755
|
+
var I = F.toLowerCase();
|
|
756
|
+
return d.hasOwnProperty(I) ? !0 : l.hasOwnProperty(I) ? !1 : f(I, I, w) === I;
|
|
722
757
|
};
|
|
723
758
|
}
|
|
724
759
|
function u(l, d, w) {
|
|
@@ -974,10 +1009,10 @@ function Ae() {
|
|
|
974
1009
|
/sheep$/i
|
|
975
1010
|
].forEach(u.addUncountableRule), u;
|
|
976
1011
|
});
|
|
977
|
-
})(
|
|
1012
|
+
})(V)), V.exports;
|
|
978
1013
|
}
|
|
979
|
-
var
|
|
980
|
-
const S = /* @__PURE__ */
|
|
1014
|
+
var Ue = qe();
|
|
1015
|
+
const S = /* @__PURE__ */ je(Ue), Ra = "data", Pa = "migrations", Ve = "(app)", He = /* @__PURE__ */ new Set([
|
|
981
1016
|
"break",
|
|
982
1017
|
"case",
|
|
983
1018
|
"catch",
|
|
@@ -1029,7 +1064,7 @@ const S = /* @__PURE__ */ Te(Ne), ha = "data", ga = "migrations", Be = "(app)",
|
|
|
1029
1064
|
"async",
|
|
1030
1065
|
"arguments",
|
|
1031
1066
|
"constructor"
|
|
1032
|
-
]),
|
|
1067
|
+
]), Ge = {
|
|
1033
1068
|
function: "fn",
|
|
1034
1069
|
interface: "iface",
|
|
1035
1070
|
type: "type_",
|
|
@@ -1078,33 +1113,33 @@ const S = /* @__PURE__ */ Te(Ne), ha = "data", ga = "migrations", Be = "(app)",
|
|
|
1078
1113
|
arguments: "args",
|
|
1079
1114
|
constructor: "ctor"
|
|
1080
1115
|
};
|
|
1081
|
-
function
|
|
1082
|
-
return
|
|
1116
|
+
function Z(t) {
|
|
1117
|
+
return He.has(t) ? Ge[t] ?? `${t}_` : t;
|
|
1083
1118
|
}
|
|
1084
|
-
function
|
|
1119
|
+
function K(t) {
|
|
1085
1120
|
if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(t))
|
|
1086
1121
|
throw new Error(
|
|
1087
1122
|
"Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore"
|
|
1088
1123
|
);
|
|
1089
1124
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return t.features.auth ? `src/routes/${
|
|
1125
|
+
function Ke(t) {
|
|
1126
|
+
return t.features.auth ? `src/routes/${Ve}` : "src/routes";
|
|
1092
1127
|
}
|
|
1093
|
-
function
|
|
1094
|
-
const n = t.split("/"), r = n[n.length - 1], a = n.slice(0, -1), s = S.singular(
|
|
1128
|
+
function E(t, e) {
|
|
1129
|
+
const n = t.split("/"), r = n[n.length - 1], a = n.slice(0, -1), s = S.singular(rt(r)), i = S.plural(s), o = N(s), c = Ae(i), m = [...a, c].join("/");
|
|
1095
1130
|
return {
|
|
1096
|
-
name:
|
|
1097
|
-
pluralName:
|
|
1098
|
-
typeName:
|
|
1099
|
-
tableName:
|
|
1131
|
+
name: Z(o),
|
|
1132
|
+
pluralName: Z(N(i)),
|
|
1133
|
+
typeName: De(s),
|
|
1134
|
+
tableName: Ne(i),
|
|
1100
1135
|
displayName: s,
|
|
1101
1136
|
pluralDisplayName: i,
|
|
1102
|
-
schemaName: `${
|
|
1137
|
+
schemaName: `${Z(o)}Schema`,
|
|
1103
1138
|
routeSegment: m,
|
|
1104
|
-
routesDir:
|
|
1139
|
+
routesDir: Ke(e)
|
|
1105
1140
|
};
|
|
1106
1141
|
}
|
|
1107
|
-
function
|
|
1142
|
+
function Lt(t) {
|
|
1108
1143
|
const e = `${t.routesDir}/${t.routeSegment}`;
|
|
1109
1144
|
return {
|
|
1110
1145
|
list: e,
|
|
@@ -1113,7 +1148,7 @@ function jt(t) {
|
|
|
1113
1148
|
edit: `${e}/[id]/edit`
|
|
1114
1149
|
};
|
|
1115
1150
|
}
|
|
1116
|
-
function
|
|
1151
|
+
function Ot(t) {
|
|
1117
1152
|
const e = `/${t.routeSegment}`;
|
|
1118
1153
|
return {
|
|
1119
1154
|
list: e,
|
|
@@ -1122,7 +1157,7 @@ function Lt(t) {
|
|
|
1122
1157
|
edit: `${e}/[id]/edit`
|
|
1123
1158
|
};
|
|
1124
1159
|
}
|
|
1125
|
-
const
|
|
1160
|
+
const We = [
|
|
1126
1161
|
"title",
|
|
1127
1162
|
"name",
|
|
1128
1163
|
"label",
|
|
@@ -1156,24 +1191,24 @@ const qe = [
|
|
|
1156
1191
|
"url",
|
|
1157
1192
|
"id"
|
|
1158
1193
|
];
|
|
1159
|
-
function
|
|
1160
|
-
for (const e of
|
|
1194
|
+
function Xe(t) {
|
|
1195
|
+
for (const e of We)
|
|
1161
1196
|
if (t.some((n) => n.name === e))
|
|
1162
1197
|
return e;
|
|
1163
1198
|
return "id";
|
|
1164
1199
|
}
|
|
1165
|
-
function
|
|
1200
|
+
function Ye(t) {
|
|
1166
1201
|
return t.map((e) => e.name).filter((e) => !e.startsWith("_"));
|
|
1167
1202
|
}
|
|
1168
|
-
function
|
|
1203
|
+
function Je(t) {
|
|
1169
1204
|
return Object.fromEntries(t.map((e) => [e.name, e.id]));
|
|
1170
1205
|
}
|
|
1171
|
-
function
|
|
1206
|
+
function qt(t) {
|
|
1172
1207
|
return Object.fromEntries(
|
|
1173
|
-
t.map((e) => [e.name,
|
|
1208
|
+
t.map((e) => [e.name, Xe(e.fields)])
|
|
1174
1209
|
);
|
|
1175
1210
|
}
|
|
1176
|
-
const
|
|
1211
|
+
const Ze = [
|
|
1177
1212
|
"user",
|
|
1178
1213
|
"owner",
|
|
1179
1214
|
"created_by",
|
|
@@ -1182,10 +1217,10 @@ const Ge = [
|
|
|
1182
1217
|
"account",
|
|
1183
1218
|
"creator"
|
|
1184
1219
|
];
|
|
1185
|
-
function
|
|
1220
|
+
function D(t) {
|
|
1186
1221
|
return t.toLowerCase();
|
|
1187
1222
|
}
|
|
1188
|
-
function
|
|
1223
|
+
function gt(t) {
|
|
1189
1224
|
return {
|
|
1190
1225
|
rule: '@request.auth.id != ""',
|
|
1191
1226
|
ownershipChainCollections: [t],
|
|
@@ -1193,15 +1228,15 @@ function ft(t) {
|
|
|
1193
1228
|
operator: "="
|
|
1194
1229
|
};
|
|
1195
1230
|
}
|
|
1196
|
-
function
|
|
1197
|
-
const r = new Set((n.authCollections ?? ["users"]).map(
|
|
1198
|
-
(n.userFieldHints ??
|
|
1231
|
+
function Qe(t, e, n = {}) {
|
|
1232
|
+
const r = new Set((n.authCollections ?? ["users"]).map(D)), a = new Set(
|
|
1233
|
+
(n.userFieldHints ?? Ze).map(D)
|
|
1199
1234
|
), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1200
1235
|
for (const b of t)
|
|
1201
1236
|
i.set(b.name, b), o.set(b.id, b);
|
|
1202
1237
|
if (!i.has(e))
|
|
1203
|
-
return
|
|
1204
|
-
if (r.has(
|
|
1238
|
+
return gt(e);
|
|
1239
|
+
if (r.has(D(e)))
|
|
1205
1240
|
return {
|
|
1206
1241
|
rule: "@request.auth.id = id",
|
|
1207
1242
|
ownershipChainCollections: [e],
|
|
@@ -1209,7 +1244,7 @@ function Ke(t, e, n = {}) {
|
|
|
1209
1244
|
operator: "="
|
|
1210
1245
|
};
|
|
1211
1246
|
function c(b) {
|
|
1212
|
-
const v =
|
|
1247
|
+
const v = D(b);
|
|
1213
1248
|
return v === "user" ? 50 : a.has(v) ? 20 : 0;
|
|
1214
1249
|
}
|
|
1215
1250
|
function m(b) {
|
|
@@ -1218,19 +1253,19 @@ function Ke(t, e, n = {}) {
|
|
|
1218
1253
|
const C = [];
|
|
1219
1254
|
for (const y of v.fields) {
|
|
1220
1255
|
if (y.type !== "relation" || !y.collectionId) continue;
|
|
1221
|
-
const
|
|
1222
|
-
|
|
1256
|
+
const T = o.get(y.collectionId);
|
|
1257
|
+
T && C.push({
|
|
1223
1258
|
from: b,
|
|
1224
1259
|
fieldName: y.name,
|
|
1225
|
-
to:
|
|
1260
|
+
to: T.name,
|
|
1226
1261
|
isMulti: !!(y.maxSelect && y.maxSelect > 1),
|
|
1227
1262
|
hintScore: c(y.name)
|
|
1228
1263
|
});
|
|
1229
1264
|
}
|
|
1230
|
-
return C.sort((y,
|
|
1265
|
+
return C.sort((y, T) => y.fieldName.localeCompare(T.fieldName)), C;
|
|
1231
1266
|
}
|
|
1232
1267
|
function h(b) {
|
|
1233
|
-
return r.has(
|
|
1268
|
+
return r.has(D(b));
|
|
1234
1269
|
}
|
|
1235
1270
|
function f(b) {
|
|
1236
1271
|
if (b.length === 0) return !1;
|
|
@@ -1239,8 +1274,8 @@ function Ke(t, e, n = {}) {
|
|
|
1239
1274
|
return h(b[b.length - 1].to);
|
|
1240
1275
|
}
|
|
1241
1276
|
function g(b) {
|
|
1242
|
-
const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((
|
|
1243
|
-
return 100 * b.length + 50 * C - 40 *
|
|
1277
|
+
const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, T = b.reduce((Y, ae) => Y + ae.hintScore, 0), re = D(v.fieldName) === "user" ? 1 : 0;
|
|
1278
|
+
return 100 * b.length + 50 * C - 40 * re - 15 * y - T;
|
|
1244
1279
|
}
|
|
1245
1280
|
function x(b) {
|
|
1246
1281
|
return b.map((v) => `${v.from}.${v.fieldName}->${v.to}`).join("|");
|
|
@@ -1257,20 +1292,20 @@ function Ke(t, e, n = {}) {
|
|
|
1257
1292
|
}
|
|
1258
1293
|
}
|
|
1259
1294
|
if (d(e, [], 0), u.length === 0)
|
|
1260
|
-
return
|
|
1295
|
+
return gt(e);
|
|
1261
1296
|
u.sort((b, v) => {
|
|
1262
1297
|
const C = g(b) - g(v);
|
|
1263
1298
|
return C !== 0 ? C : x(b).localeCompare(x(v));
|
|
1264
1299
|
});
|
|
1265
|
-
const w = u[0], $ = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)],
|
|
1300
|
+
const w = u[0], $ = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)], lt = w[w.length - 1].isMulti ? "?=" : "=", ee = $.join("."), ne = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
|
|
1266
1301
|
return {
|
|
1267
|
-
rule: `@request.auth.id ${
|
|
1302
|
+
rule: `@request.auth.id ${lt} ${ne}${ee}.id`,
|
|
1268
1303
|
ownershipChainCollections: F,
|
|
1269
1304
|
ownershipChainFields: $,
|
|
1270
|
-
operator:
|
|
1305
|
+
operator: lt
|
|
1271
1306
|
};
|
|
1272
1307
|
}
|
|
1273
|
-
function
|
|
1308
|
+
function tn(t) {
|
|
1274
1309
|
let e = null, n = !1, r = 0;
|
|
1275
1310
|
for (let a = 0; a < t.length; a++) {
|
|
1276
1311
|
const s = t[a];
|
|
@@ -1303,11 +1338,11 @@ function We(t) {
|
|
|
1303
1338
|
}
|
|
1304
1339
|
return [t, ""];
|
|
1305
1340
|
}
|
|
1306
|
-
function
|
|
1341
|
+
function bt(t) {
|
|
1307
1342
|
const e = t.trim();
|
|
1308
1343
|
return e.startsWith('"') && e.endsWith('"') || e.startsWith("'") && e.endsWith("'") ? e.slice(1, -1).replace(/\\(["'])/g, "$1") : e;
|
|
1309
1344
|
}
|
|
1310
|
-
function
|
|
1345
|
+
function vt(t) {
|
|
1311
1346
|
let e = -1, n = null, r = !1;
|
|
1312
1347
|
for (let i = 0; i < t.length; i++) {
|
|
1313
1348
|
const o = t[i];
|
|
@@ -1333,9 +1368,9 @@ function gt(t) {
|
|
|
1333
1368
|
}
|
|
1334
1369
|
}
|
|
1335
1370
|
let a, s;
|
|
1336
|
-
return e >= 0 ? (a = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (a = t.trim(), s = a), { label:
|
|
1371
|
+
return e >= 0 ? (a = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (a = t.trim(), s = a), { label: bt(s), value: bt(a) };
|
|
1337
1372
|
}
|
|
1338
|
-
function
|
|
1373
|
+
function en(t) {
|
|
1339
1374
|
const e = [];
|
|
1340
1375
|
let n = "", r = null, a = !1;
|
|
1341
1376
|
for (let i = 0; i < t.length; i++) {
|
|
@@ -1362,15 +1397,15 @@ function Xe(t) {
|
|
|
1362
1397
|
}
|
|
1363
1398
|
if (o === ",") {
|
|
1364
1399
|
const c = n.trim();
|
|
1365
|
-
c.length > 0 && e.push(
|
|
1400
|
+
c.length > 0 && e.push(vt(c)), n = "";
|
|
1366
1401
|
continue;
|
|
1367
1402
|
}
|
|
1368
1403
|
n += o;
|
|
1369
1404
|
}
|
|
1370
1405
|
const s = n.trim();
|
|
1371
|
-
return s.length > 0 && e.push(
|
|
1406
|
+
return s.length > 0 && e.push(vt(s)), e;
|
|
1372
1407
|
}
|
|
1373
|
-
const
|
|
1408
|
+
const wt = {
|
|
1374
1409
|
string: "text",
|
|
1375
1410
|
boolean: "bool",
|
|
1376
1411
|
geopoint: "geoPoint",
|
|
@@ -1383,38 +1418,38 @@ const bt = {
|
|
|
1383
1418
|
datetime: "date",
|
|
1384
1419
|
timestamp: "date"
|
|
1385
1420
|
};
|
|
1386
|
-
function
|
|
1421
|
+
function nn(t) {
|
|
1387
1422
|
const e = t.endsWith("!");
|
|
1388
1423
|
let n = e ? t.slice(0, -1) : t, r = [];
|
|
1389
1424
|
if (n.startsWith("select(") && n.endsWith(")")) {
|
|
1390
1425
|
const a = n.slice(7, -1);
|
|
1391
|
-
r =
|
|
1426
|
+
r = en(a), n = "select";
|
|
1392
1427
|
}
|
|
1393
|
-
return n === "files" ? { type: "file", required: e, selectOptions: r } : (n in
|
|
1428
|
+
return n === "files" ? { type: "file", required: e, selectOptions: r } : (n in wt && (n = wt[n]), { type: n, required: e, selectOptions: r });
|
|
1394
1429
|
}
|
|
1395
|
-
function
|
|
1430
|
+
function yt(t) {
|
|
1396
1431
|
const e = S.singular(t), n = S.plural(e);
|
|
1397
1432
|
return t === n ? 99 : 1;
|
|
1398
1433
|
}
|
|
1399
|
-
function
|
|
1400
|
-
const i =
|
|
1434
|
+
function q(t, e, n, r, a, s) {
|
|
1435
|
+
const i = E(e, s), o = S.singular(t), c = S.plural(o);
|
|
1401
1436
|
return {
|
|
1402
1437
|
collectionId: r[e],
|
|
1403
1438
|
displayField: a[e] ?? "id",
|
|
1404
1439
|
relatedModel: i,
|
|
1405
|
-
singularRelationName:
|
|
1440
|
+
singularRelationName: N(
|
|
1406
1441
|
`${n.displayName} ${i.displayName}`
|
|
1407
1442
|
),
|
|
1408
|
-
pluralRelationName:
|
|
1443
|
+
pluralRelationName: N(
|
|
1409
1444
|
`${n.displayName} ${i.pluralDisplayName}`
|
|
1410
1445
|
),
|
|
1411
1446
|
maxSelect: t === c ? 999 : 1
|
|
1412
1447
|
};
|
|
1413
1448
|
}
|
|
1414
|
-
function
|
|
1415
|
-
const s =
|
|
1449
|
+
function rn(t, e, n, r, a) {
|
|
1450
|
+
const s = rt(t), { type: i, required: o, selectOptions: c } = e, m = Ye(r), h = Je(r), f = qt(r), g = m.map((u) => S.singular(u));
|
|
1416
1451
|
if (a.features.auth && i === "current_user" && h.users) {
|
|
1417
|
-
const u =
|
|
1452
|
+
const u = q(
|
|
1418
1453
|
t,
|
|
1419
1454
|
"users",
|
|
1420
1455
|
n,
|
|
@@ -1450,7 +1485,7 @@ function Je(t, e, n, r, a) {
|
|
|
1450
1485
|
name: t,
|
|
1451
1486
|
title: s,
|
|
1452
1487
|
required: o,
|
|
1453
|
-
maxSelect:
|
|
1488
|
+
maxSelect: yt(t),
|
|
1454
1489
|
options: c
|
|
1455
1490
|
};
|
|
1456
1491
|
if (i === "file")
|
|
@@ -1459,7 +1494,7 @@ function Je(t, e, n, r, a) {
|
|
|
1459
1494
|
name: t,
|
|
1460
1495
|
title: s,
|
|
1461
1496
|
required: o,
|
|
1462
|
-
maxSelect:
|
|
1497
|
+
maxSelect: yt(t)
|
|
1463
1498
|
};
|
|
1464
1499
|
if (i === "relation") {
|
|
1465
1500
|
const u = S.singular(t), l = S.plural(u);
|
|
@@ -1467,7 +1502,7 @@ function Je(t, e, n, r, a) {
|
|
|
1467
1502
|
throw new Error(
|
|
1468
1503
|
`Invalid relation field: ${t}. Must be one of ${m.join(", ")} (singular or plural)`
|
|
1469
1504
|
);
|
|
1470
|
-
const d =
|
|
1505
|
+
const d = q(
|
|
1471
1506
|
t,
|
|
1472
1507
|
l,
|
|
1473
1508
|
n,
|
|
@@ -1485,7 +1520,7 @@ function Je(t, e, n, r, a) {
|
|
|
1485
1520
|
};
|
|
1486
1521
|
}
|
|
1487
1522
|
if (m.includes(i)) {
|
|
1488
|
-
const u =
|
|
1523
|
+
const u = q(
|
|
1489
1524
|
t,
|
|
1490
1525
|
i,
|
|
1491
1526
|
n,
|
|
@@ -1505,7 +1540,7 @@ function Je(t, e, n, r, a) {
|
|
|
1505
1540
|
if (g.includes(i)) {
|
|
1506
1541
|
const u = S.plural(i);
|
|
1507
1542
|
if (m.includes(u)) {
|
|
1508
|
-
const l =
|
|
1543
|
+
const l = q(
|
|
1509
1544
|
t,
|
|
1510
1545
|
u,
|
|
1511
1546
|
n,
|
|
@@ -1565,10 +1600,10 @@ function Je(t, e, n, r, a) {
|
|
|
1565
1600
|
);
|
|
1566
1601
|
return { type: i, name: t, title: s, required: o };
|
|
1567
1602
|
}
|
|
1568
|
-
function
|
|
1603
|
+
function an(t, e, n, r) {
|
|
1569
1604
|
const a = [];
|
|
1570
1605
|
for (const i of t) {
|
|
1571
|
-
const [o, c] =
|
|
1606
|
+
const [o, c] = tn(i);
|
|
1572
1607
|
if (!o || !c)
|
|
1573
1608
|
throw new Error(
|
|
1574
1609
|
`Invalid field format: ${i}. Expected format: name:type or name:type!`
|
|
@@ -1577,10 +1612,10 @@ function Ze(t, e, n, r) {
|
|
|
1577
1612
|
throw new Error(
|
|
1578
1613
|
`Invalid field name: ${o}. Must start with a letter and contain only alphanumeric characters`
|
|
1579
1614
|
);
|
|
1580
|
-
const m =
|
|
1581
|
-
a.push(
|
|
1615
|
+
const m = nn(c);
|
|
1616
|
+
a.push(rn(o, m, e, n, r));
|
|
1582
1617
|
}
|
|
1583
|
-
const s = r.features.auth ?
|
|
1618
|
+
const s = r.features.auth ? Qe(
|
|
1584
1619
|
[
|
|
1585
1620
|
...n,
|
|
1586
1621
|
{
|
|
@@ -1599,32 +1634,32 @@ function Ze(t, e, n, r) {
|
|
|
1599
1634
|
) : void 0;
|
|
1600
1635
|
return { fields: a, auth: s };
|
|
1601
1636
|
}
|
|
1602
|
-
async function
|
|
1637
|
+
async function W(t, e, n) {
|
|
1603
1638
|
let r;
|
|
1604
1639
|
if (n.env === "runtime") {
|
|
1605
|
-
const { getCollections: a } = await import("./env.runtime-
|
|
1640
|
+
const { getCollections: a } = await import("./env.runtime-B18zkdjb.js");
|
|
1606
1641
|
r = await a();
|
|
1607
1642
|
} else {
|
|
1608
1643
|
const { getPreviewCollections: a } = await import("./env.preview-HlXZOEL4.js");
|
|
1609
1644
|
r = a(n);
|
|
1610
1645
|
}
|
|
1611
|
-
return
|
|
1646
|
+
return an(t, e, r, n);
|
|
1612
1647
|
}
|
|
1613
|
-
const
|
|
1614
|
-
class
|
|
1648
|
+
const on = "2024-01-01T00:00:00.000Z";
|
|
1649
|
+
class B {
|
|
1615
1650
|
constructor(e) {
|
|
1616
1651
|
this.expression = e;
|
|
1617
1652
|
}
|
|
1618
1653
|
}
|
|
1619
|
-
function
|
|
1620
|
-
return t instanceof
|
|
1654
|
+
function tt(t) {
|
|
1655
|
+
return t instanceof B ? t.expression : Array.isArray(t) ? `[${t.map((e) => tt(e)).join(", ")}]` : t && typeof t == "object" ? `{ ${Object.entries(t).map(([n, r]) => `${JSON.stringify(n)}: ${tt(r)}`).join(", ")} }` : JSON.stringify(t);
|
|
1621
1656
|
}
|
|
1622
|
-
function
|
|
1657
|
+
function Q(t) {
|
|
1623
1658
|
return `{ ${Object.entries(t).map(
|
|
1624
|
-
([n, r]) => `${JSON.stringify(n)}: ${
|
|
1659
|
+
([n, r]) => `${JSON.stringify(n)}: ${tt(r)}`
|
|
1625
1660
|
).join(", ")} }`;
|
|
1626
1661
|
}
|
|
1627
|
-
function
|
|
1662
|
+
function sn(t) {
|
|
1628
1663
|
switch (t) {
|
|
1629
1664
|
case "text":
|
|
1630
1665
|
case "number":
|
|
@@ -1660,10 +1695,10 @@ function tn(t) {
|
|
|
1660
1695
|
return;
|
|
1661
1696
|
}
|
|
1662
1697
|
}
|
|
1663
|
-
function
|
|
1698
|
+
function A(t, e) {
|
|
1664
1699
|
return t.replace("[id]", `\${${e}}`);
|
|
1665
1700
|
}
|
|
1666
|
-
function
|
|
1701
|
+
function Ut(t, e, n) {
|
|
1667
1702
|
var r, a, s;
|
|
1668
1703
|
switch (t.type) {
|
|
1669
1704
|
case "text":
|
|
@@ -1674,7 +1709,7 @@ function qt(t, e, n) {
|
|
|
1674
1709
|
case "bool":
|
|
1675
1710
|
return !0;
|
|
1676
1711
|
case "date":
|
|
1677
|
-
return
|
|
1712
|
+
return on;
|
|
1678
1713
|
case "email":
|
|
1679
1714
|
return `test-${t.name}@example.com`;
|
|
1680
1715
|
case "password":
|
|
@@ -1691,9 +1726,9 @@ function qt(t, e, n) {
|
|
|
1691
1726
|
}
|
|
1692
1727
|
case "relation": {
|
|
1693
1728
|
if (n.authEnabled && (t.isCurrentUser || ((s = t.relatedModel) == null ? void 0 : s.tableName) === "users"))
|
|
1694
|
-
return new
|
|
1729
|
+
return new B("context.user.id");
|
|
1695
1730
|
const i = t.collectionId ? e[t.collectionId] : void 0;
|
|
1696
|
-
return i ? new
|
|
1731
|
+
return i ? new B(i) : "missing-relation-id";
|
|
1697
1732
|
}
|
|
1698
1733
|
case "file":
|
|
1699
1734
|
case "autodate":
|
|
@@ -1702,39 +1737,39 @@ function qt(t, e, n) {
|
|
|
1702
1737
|
return;
|
|
1703
1738
|
}
|
|
1704
1739
|
}
|
|
1705
|
-
function
|
|
1740
|
+
function xt(t, e, n) {
|
|
1706
1741
|
const r = {};
|
|
1707
1742
|
for (const a of t) {
|
|
1708
1743
|
if (a.type === "file" || a.type === "autodate")
|
|
1709
1744
|
continue;
|
|
1710
1745
|
if (n.authEnabled && a.type === "relation" && a.isCurrentUser) {
|
|
1711
|
-
n.forForm || (r[a.name] = new
|
|
1746
|
+
n.forForm || (r[a.name] = new B("context.user.id"));
|
|
1712
1747
|
continue;
|
|
1713
1748
|
}
|
|
1714
|
-
const s =
|
|
1749
|
+
const s = Ut(a, e, n);
|
|
1715
1750
|
s !== void 0 && (r[a.name] = s);
|
|
1716
1751
|
}
|
|
1717
1752
|
return r;
|
|
1718
1753
|
}
|
|
1719
|
-
function
|
|
1754
|
+
function ln(t, e, n) {
|
|
1720
1755
|
var a;
|
|
1721
1756
|
const r = {};
|
|
1722
1757
|
for (const s of t) {
|
|
1723
1758
|
if (s.system || s.name === "id")
|
|
1724
1759
|
continue;
|
|
1725
|
-
const i =
|
|
1760
|
+
const i = sn(s.type);
|
|
1726
1761
|
if (!i || i === "file" || i === "autodate" || i === "relation" && !s.collectionId)
|
|
1727
1762
|
continue;
|
|
1728
1763
|
let o;
|
|
1729
1764
|
if (i === "relation")
|
|
1730
|
-
o = s.collectionId ? new
|
|
1765
|
+
o = s.collectionId ? new B(
|
|
1731
1766
|
e[s.collectionId] ?? '"missing-relation-id"'
|
|
1732
1767
|
) : void 0;
|
|
1733
1768
|
else if (i === "select") {
|
|
1734
1769
|
const c = ((a = s.values) == null ? void 0 : a[0]) ?? "default";
|
|
1735
1770
|
o = (s.maxSelect ?? 1) > 1 ? [c] : c;
|
|
1736
1771
|
} else
|
|
1737
|
-
o =
|
|
1772
|
+
o = Ut(
|
|
1738
1773
|
{ name: s.name, type: i },
|
|
1739
1774
|
e,
|
|
1740
1775
|
{ forForm: !1, authEnabled: n.features.auth }
|
|
@@ -1743,12 +1778,12 @@ function en(t, e, n) {
|
|
|
1743
1778
|
}
|
|
1744
1779
|
return r;
|
|
1745
1780
|
}
|
|
1746
|
-
function
|
|
1747
|
-
t.email = new
|
|
1781
|
+
function cn(t) {
|
|
1782
|
+
t.email = new B(
|
|
1748
1783
|
"`test-${Math.random().toString(36).slice(2)}@example.com`"
|
|
1749
1784
|
), t.password = "password", t.passwordConfirm = "password";
|
|
1750
1785
|
}
|
|
1751
|
-
function
|
|
1786
|
+
function mn(t, e) {
|
|
1752
1787
|
if (!t)
|
|
1753
1788
|
return [];
|
|
1754
1789
|
const n = new Map(e.map((o) => [o.id, o])), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = [], i = (o) => {
|
|
@@ -1766,7 +1801,7 @@ function rn(t, e) {
|
|
|
1766
1801
|
o.type !== "relation" || !o.collectionId || i(o.collectionId);
|
|
1767
1802
|
return s;
|
|
1768
1803
|
}
|
|
1769
|
-
function
|
|
1804
|
+
function un(t, e) {
|
|
1770
1805
|
if (!e.has(t))
|
|
1771
1806
|
return e.add(t), t;
|
|
1772
1807
|
let n = 2;
|
|
@@ -1775,7 +1810,7 @@ function an(t, e) {
|
|
|
1775
1810
|
const r = `${t}${n}`;
|
|
1776
1811
|
return e.add(r), r;
|
|
1777
1812
|
}
|
|
1778
|
-
function
|
|
1813
|
+
function pn(t, e) {
|
|
1779
1814
|
return {
|
|
1780
1815
|
id: `generated-${t.tableName}`,
|
|
1781
1816
|
name: t.tableName,
|
|
@@ -1797,24 +1832,24 @@ function on(t, e) {
|
|
|
1797
1832
|
} : { name: n.name, type: n.type })
|
|
1798
1833
|
};
|
|
1799
1834
|
}
|
|
1800
|
-
function
|
|
1801
|
-
const a = r.find((l) => l.name === t.tableName) ??
|
|
1835
|
+
function Vt(t, e, n, r) {
|
|
1836
|
+
const a = r.find((l) => l.name === t.tableName) ?? pn(t, e), s = mn(a, r).filter(
|
|
1802
1837
|
(l) => !(n.features.auth && l.name === "users")
|
|
1803
1838
|
), i = {}, o = [], c = /* @__PURE__ */ new Set();
|
|
1804
1839
|
for (const l of s) {
|
|
1805
|
-
const d =
|
|
1840
|
+
const d = un(E(l.name, n).name, c);
|
|
1806
1841
|
o.push({ varName: d, collection: l }), i[l.id] = `${d}.id`;
|
|
1807
1842
|
}
|
|
1808
1843
|
const m = o.length ? `${o.map((l) => `let ${l.varName}: { id: string };`).join(`
|
|
1809
1844
|
`)}
|
|
1810
1845
|
|
|
1811
1846
|
` : "", h = o.map(({ varName: l, collection: d }) => {
|
|
1812
|
-
const w =
|
|
1847
|
+
const w = ln(
|
|
1813
1848
|
d.fields,
|
|
1814
1849
|
i,
|
|
1815
1850
|
n
|
|
1816
1851
|
);
|
|
1817
|
-
return d.type === "auth" &&
|
|
1852
|
+
return d.type === "auth" && cn(w), `${l} = await context.admin.collection("${d.name}").create(${Q(w)});`;
|
|
1818
1853
|
}), f = o.slice().reverse().map(
|
|
1819
1854
|
({ varName: l, collection: d }) => `await context.admin.collection("${d.name}").delete(${l}.id);`
|
|
1820
1855
|
), g = n.features.auth ? "context.agent" : "context.request", x = n.features.auth ? `await context.agent.authenticateUser();
|
|
@@ -1836,22 +1871,22 @@ function Ut(t, e, n, r) {
|
|
|
1836
1871
|
declarations: m,
|
|
1837
1872
|
setupSection: u,
|
|
1838
1873
|
requestAgent: g,
|
|
1839
|
-
modelDbData:
|
|
1840
|
-
|
|
1874
|
+
modelDbData: Q(
|
|
1875
|
+
xt(e, i, {
|
|
1841
1876
|
forForm: !1,
|
|
1842
1877
|
authEnabled: n.features.auth
|
|
1843
1878
|
})
|
|
1844
1879
|
),
|
|
1845
|
-
modelFormData:
|
|
1846
|
-
|
|
1880
|
+
modelFormData: Q(
|
|
1881
|
+
xt(e, i, {
|
|
1847
1882
|
forForm: !0,
|
|
1848
1883
|
authEnabled: n.features.auth
|
|
1849
1884
|
})
|
|
1850
1885
|
)
|
|
1851
1886
|
};
|
|
1852
1887
|
}
|
|
1853
|
-
function
|
|
1854
|
-
const { declarations: s, setupSection: i, requestAgent: o, modelDbData: c, modelFormData: m } =
|
|
1888
|
+
function dn(t, e, n, r, a) {
|
|
1889
|
+
const { declarations: s, setupSection: i, requestAgent: o, modelDbData: c, modelFormData: m } = Vt(t, n, r, a);
|
|
1855
1890
|
return p`
|
|
1856
1891
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
1857
1892
|
|
|
@@ -1885,7 +1920,7 @@ function sn(t, e, n, r, a) {
|
|
|
1885
1920
|
describe("GET ${e.show}", () => {
|
|
1886
1921
|
it("should return a 200 status code", async (context) => {
|
|
1887
1922
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1888
|
-
const response = await ${o}.get(\`${
|
|
1923
|
+
const response = await ${o}.get(\`${A(e.show, "id")}\`);
|
|
1889
1924
|
expect(response.status).toBe(200);
|
|
1890
1925
|
});
|
|
1891
1926
|
|
|
@@ -1898,10 +1933,10 @@ function sn(t, e, n, r, a) {
|
|
|
1898
1933
|
describe("POST ${e.show}", () => {
|
|
1899
1934
|
it("should delete a ${t.displayName.toLowerCase()}", async (context) => {
|
|
1900
1935
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1901
|
-
const response = await ${o}.post(\`${
|
|
1936
|
+
const response = await ${o}.post(\`${A(e.show, "id")}\`).type("form");
|
|
1902
1937
|
expect(response.body.status).toBe(303);
|
|
1903
1938
|
|
|
1904
|
-
const response2 = await ${o}.get(\`${
|
|
1939
|
+
const response2 = await ${o}.get(\`${A(e.show, "id")}\`);
|
|
1905
1940
|
expect(response2.status).toBe(404);
|
|
1906
1941
|
});
|
|
1907
1942
|
});
|
|
@@ -1909,7 +1944,7 @@ function sn(t, e, n, r, a) {
|
|
|
1909
1944
|
describe("GET ${e.edit}", () => {
|
|
1910
1945
|
it("should return a 200 status code", async (context) => {
|
|
1911
1946
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1912
|
-
const response = await ${o}.get(\`${
|
|
1947
|
+
const response = await ${o}.get(\`${A(e.edit, "id")}\`);
|
|
1913
1948
|
expect(response.status).toBe(200);
|
|
1914
1949
|
});
|
|
1915
1950
|
});
|
|
@@ -1918,18 +1953,18 @@ function sn(t, e, n, r, a) {
|
|
|
1918
1953
|
it("should update a ${t.displayName.toLowerCase()}", async (context) => {
|
|
1919
1954
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1920
1955
|
const response = await ${o}
|
|
1921
|
-
.post(\`${
|
|
1956
|
+
.post(\`${A(e.edit, "id")}\`)
|
|
1922
1957
|
.type("form")
|
|
1923
1958
|
.send(${m});
|
|
1924
1959
|
expect(response.body.status).toBe(303);
|
|
1925
|
-
expect(response.body.location).toBe(\`${
|
|
1960
|
+
expect(response.body.location).toBe(\`${A(e.show, "id")}\`);
|
|
1926
1961
|
});
|
|
1927
1962
|
});
|
|
1928
1963
|
});
|
|
1929
1964
|
`;
|
|
1930
1965
|
}
|
|
1931
|
-
function
|
|
1932
|
-
const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } =
|
|
1966
|
+
function fn(t, e, n, r, a) {
|
|
1967
|
+
const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } = Vt(t, n, r, a);
|
|
1933
1968
|
return p`
|
|
1934
1969
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
1935
1970
|
|
|
@@ -1952,10 +1987,10 @@ function ln(t, e, n, r, a) {
|
|
|
1952
1987
|
});
|
|
1953
1988
|
`;
|
|
1954
1989
|
}
|
|
1955
|
-
var
|
|
1956
|
-
const
|
|
1957
|
-
function
|
|
1958
|
-
if (t.length <=
|
|
1990
|
+
var $t = Object.freeze, hn = Object.defineProperty, gn = (t, e) => $t(hn(t, "raw", { value: $t(t.slice()) })), Ft;
|
|
1991
|
+
const Ct = 2, bn = 3;
|
|
1992
|
+
function vn(t) {
|
|
1993
|
+
if (t.length <= Ct)
|
|
1959
1994
|
throw new Error(
|
|
1960
1995
|
"Invalid command arguments. Expected: generate form <model> <fields...>"
|
|
1961
1996
|
);
|
|
@@ -1964,18 +1999,18 @@ function pn(t) {
|
|
|
1964
1999
|
throw new Error(
|
|
1965
2000
|
`Invalid command "${t.join(" ")}". Expected to start with "generate form".`
|
|
1966
2001
|
);
|
|
1967
|
-
const r = t[
|
|
2002
|
+
const r = t[Ct], a = t.slice(bn);
|
|
1968
2003
|
if (a.length === 0)
|
|
1969
2004
|
throw new Error("At least one field definition is required.");
|
|
1970
2005
|
return { modelPath: r, fields: a };
|
|
1971
2006
|
}
|
|
1972
|
-
function
|
|
2007
|
+
function Ht(t) {
|
|
1973
2008
|
return t.some((e) => e.type === "file");
|
|
1974
2009
|
}
|
|
1975
|
-
function
|
|
2010
|
+
function wn(t) {
|
|
1976
2011
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
|
|
1977
2012
|
}
|
|
1978
|
-
function
|
|
2013
|
+
function _t(t) {
|
|
1979
2014
|
const e = t.type === "select" ? `[${t.options.map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
|
|
1980
2015
|
let n;
|
|
1981
2016
|
switch (t.type) {
|
|
@@ -2031,13 +2066,13 @@ function Ft(t) {
|
|
|
2031
2066
|
}
|
|
2032
2067
|
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()`;
|
|
2033
2068
|
}
|
|
2034
|
-
function
|
|
2069
|
+
function yn(t) {
|
|
2035
2070
|
const e = [];
|
|
2036
2071
|
for (const n of t) {
|
|
2037
2072
|
if (n.type === "file" && n.maxSelect > 1) {
|
|
2038
2073
|
e.push({
|
|
2039
2074
|
name: n.name,
|
|
2040
|
-
schema:
|
|
2075
|
+
schema: _t({ ...n, required: !1 })
|
|
2041
2076
|
}), e.push({
|
|
2042
2077
|
name: `${n.name}+`,
|
|
2043
2078
|
schema: "z.instanceof(File).array().optional()"
|
|
@@ -2047,12 +2082,12 @@ function fn(t) {
|
|
|
2047
2082
|
});
|
|
2048
2083
|
continue;
|
|
2049
2084
|
}
|
|
2050
|
-
e.push({ name: n.name, schema:
|
|
2085
|
+
e.push({ name: n.name, schema: _t(n) });
|
|
2051
2086
|
}
|
|
2052
2087
|
return e;
|
|
2053
2088
|
}
|
|
2054
|
-
function
|
|
2055
|
-
const n =
|
|
2089
|
+
function xn(t, e) {
|
|
2090
|
+
const n = yn(e).map((r) => `${wn(r.name)}: ${r.schema}`).join(`,
|
|
2056
2091
|
`);
|
|
2057
2092
|
return p`
|
|
2058
2093
|
import { z } from "zod/v3";
|
|
@@ -2062,20 +2097,20 @@ function hn(t, e) {
|
|
|
2062
2097
|
});
|
|
2063
2098
|
`;
|
|
2064
2099
|
}
|
|
2065
|
-
function
|
|
2066
|
-
const n =
|
|
2100
|
+
function $n(t, e) {
|
|
2101
|
+
const n = O(e), r = [
|
|
2067
2102
|
'import { untrack } from "svelte";',
|
|
2068
2103
|
'import { superForm } from "sveltekit-superforms";',
|
|
2069
2104
|
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
2070
2105
|
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2071
|
-
...
|
|
2106
|
+
...nt(n)
|
|
2072
2107
|
];
|
|
2073
2108
|
return [...new Set(r)];
|
|
2074
2109
|
}
|
|
2075
|
-
function
|
|
2110
|
+
function Fn(t, e) {
|
|
2076
2111
|
const r = e.filter(
|
|
2077
2112
|
(a) => a.type === "select"
|
|
2078
|
-
).map((a) =>
|
|
2113
|
+
).map((a) => At(a)).join(`
|
|
2079
2114
|
|
|
2080
2115
|
`);
|
|
2081
2116
|
return p`
|
|
@@ -2088,11 +2123,11 @@ function bn(t, e) {
|
|
|
2088
2123
|
const { form: formData } = form;
|
|
2089
2124
|
`;
|
|
2090
2125
|
}
|
|
2091
|
-
function
|
|
2092
|
-
const n =
|
|
2093
|
-
`), r =
|
|
2094
|
-
`), s =
|
|
2095
|
-
return p(
|
|
2126
|
+
function Cn(t, e) {
|
|
2127
|
+
const n = $n(t, e).join(`
|
|
2128
|
+
`), r = Fn(t, e), a = e.map((i) => et(i)).join(`
|
|
2129
|
+
`), s = Ht(e) ? ' enctype="multipart/form-data"' : "";
|
|
2130
|
+
return p(Ft || (Ft = gn([`
|
|
2096
2131
|
<script lang="ts">
|
|
2097
2132
|
`, `
|
|
2098
2133
|
|
|
@@ -2117,8 +2152,8 @@ function vn(t, e) {
|
|
|
2117
2152
|
</section>
|
|
2118
2153
|
`])), n, r, t.displayName, s, a);
|
|
2119
2154
|
}
|
|
2120
|
-
function
|
|
2121
|
-
const n =
|
|
2155
|
+
function _n(t, e) {
|
|
2156
|
+
const n = Ht(e), r = p`
|
|
2122
2157
|
import { fail, superValidate${n ? ", withFiles" : ""} } from "sveltekit-superforms";
|
|
2123
2158
|
import { zod } from "sveltekit-superforms/adapters";
|
|
2124
2159
|
import { ${t.schemaName} } from "$lib/schemas/${t.name}";
|
|
@@ -2147,25 +2182,25 @@ function wn(t, e) {
|
|
|
2147
2182
|
};
|
|
2148
2183
|
`;
|
|
2149
2184
|
}
|
|
2150
|
-
function
|
|
2185
|
+
function U(t, e) {
|
|
2151
2186
|
return {
|
|
2152
2187
|
path: t,
|
|
2153
|
-
language:
|
|
2188
|
+
language: j(t),
|
|
2154
2189
|
content: e
|
|
2155
2190
|
};
|
|
2156
2191
|
}
|
|
2157
|
-
async function
|
|
2158
|
-
const { modelPath: e, fields: n } =
|
|
2159
|
-
|
|
2160
|
-
const r =
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2192
|
+
async function Sn(t) {
|
|
2193
|
+
const { modelPath: e, fields: n } = vn(t.argv);
|
|
2194
|
+
K(e);
|
|
2195
|
+
const r = E(e, t), s = (await W(n, r, t)).fields, i = Lt(r), o = Ot(r), c = t.env === "runtime" ? await (await import("./env.runtime-B18zkdjb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), m = [
|
|
2196
|
+
U(`${i.new}/+page.svelte`, Cn(r, s)),
|
|
2197
|
+
U(`${i.new}/+page.server.ts`, _n(r, s)),
|
|
2198
|
+
U(
|
|
2164
2199
|
`${i.new}/server.test.ts`,
|
|
2165
|
-
|
|
2200
|
+
fn(r, o.new, s, t, c)
|
|
2166
2201
|
),
|
|
2167
|
-
|
|
2168
|
-
], h =
|
|
2202
|
+
U(`src/lib/schemas/${r.name}.ts`, xn(r, s))
|
|
2203
|
+
], h = O(s);
|
|
2169
2204
|
return {
|
|
2170
2205
|
creates: m,
|
|
2171
2206
|
modifies: [],
|
|
@@ -2175,15 +2210,16 @@ async function yn(t) {
|
|
|
2175
2210
|
collections: []
|
|
2176
2211
|
};
|
|
2177
2212
|
}
|
|
2178
|
-
|
|
2179
|
-
|
|
2213
|
+
const kn = "generate-form";
|
|
2214
|
+
async function Mn(t) {
|
|
2215
|
+
const e = await Sn(t);
|
|
2180
2216
|
if (t.env !== "runtime")
|
|
2181
|
-
return e;
|
|
2217
|
+
return k(e);
|
|
2182
2218
|
const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
|
|
2183
|
-
return n(e, t);
|
|
2219
|
+
return n(await k(e), t);
|
|
2184
2220
|
}
|
|
2185
|
-
const
|
|
2186
|
-
slug:
|
|
2221
|
+
const Rn = {
|
|
2222
|
+
slug: kn,
|
|
2187
2223
|
title: "Generate a form",
|
|
2188
2224
|
summary: "Generates a form.",
|
|
2189
2225
|
categories: ["forms"],
|
|
@@ -2200,8 +2236,8 @@ const $n = {
|
|
|
2200
2236
|
]
|
|
2201
2237
|
},
|
|
2202
2238
|
baseline: "velastack",
|
|
2203
|
-
generate:
|
|
2204
|
-
},
|
|
2239
|
+
generate: Mn
|
|
2240
|
+
}, Pn = ["text"], En = {
|
|
2205
2241
|
string: "text",
|
|
2206
2242
|
boolean: "bool",
|
|
2207
2243
|
geopoint: "geoPoint",
|
|
@@ -2228,10 +2264,10 @@ const $n = {
|
|
|
2228
2264
|
geoPoint: "geoPoint",
|
|
2229
2265
|
relation: "relation"
|
|
2230
2266
|
};
|
|
2231
|
-
function
|
|
2267
|
+
function In(t) {
|
|
2232
2268
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
|
|
2233
2269
|
}
|
|
2234
|
-
function
|
|
2270
|
+
function Tn(t, e) {
|
|
2235
2271
|
const n = t.type === "select" ? `[${(t.options ?? []).map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
|
|
2236
2272
|
let r;
|
|
2237
2273
|
switch (t.type) {
|
|
@@ -2290,9 +2326,9 @@ function Sn(t, e) {
|
|
|
2290
2326
|
default:
|
|
2291
2327
|
return t.type;
|
|
2292
2328
|
}
|
|
2293
|
-
return
|
|
2329
|
+
return Pn.includes(t.type) ? t.required ? `${r}.nonempty()` : `${r}.optional()` : t.required || t.type === "geoPoint" ? r : t.type === "file" && (t.maxSelect ?? 1) <= 1 ? `${r}.optional().default("")` : `${r}.optional()`;
|
|
2294
2330
|
}
|
|
2295
|
-
function
|
|
2331
|
+
function ot(t, e, n) {
|
|
2296
2332
|
const r = [];
|
|
2297
2333
|
n.includeModelFields && (r.push({ name: "id", type: "text", required: !1 }), r.push({ name: "collectionId", type: "text", required: !1 }));
|
|
2298
2334
|
for (const o of e) {
|
|
@@ -2302,7 +2338,7 @@ function at(t, e, n) {
|
|
|
2302
2338
|
}
|
|
2303
2339
|
r.push(o);
|
|
2304
2340
|
}
|
|
2305
|
-
const a = r.map((o) => `${
|
|
2341
|
+
const a = r.map((o) => `${In(o.name)}: ${Tn(o, n)}`).join(`,
|
|
2306
2342
|
`), s = n.includeModelFields ? `
|
|
2307
2343
|
import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
|
|
2308
2344
|
return p`
|
|
@@ -2313,26 +2349,26 @@ import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelField
|
|
|
2313
2349
|
})${i};
|
|
2314
2350
|
`;
|
|
2315
2351
|
}
|
|
2316
|
-
function
|
|
2317
|
-
const e =
|
|
2352
|
+
function zn(t) {
|
|
2353
|
+
const e = En[t];
|
|
2318
2354
|
if (!e)
|
|
2319
2355
|
throw new Error(`Unsupported collection field type "${t}" when generating from collection`);
|
|
2320
2356
|
return e;
|
|
2321
2357
|
}
|
|
2322
|
-
function
|
|
2358
|
+
function st(t, e, n) {
|
|
2323
2359
|
const r = e.find((o) => o.name === t.tableName);
|
|
2324
2360
|
if (!r)
|
|
2325
2361
|
throw new Error(`Collection "${t.tableName}" not found`);
|
|
2326
|
-
const a =
|
|
2362
|
+
const a = qt(e), s = new Map(e.map((o) => [o.id, o])), i = [];
|
|
2327
2363
|
for (const o of r.fields) {
|
|
2328
2364
|
if (o.name === "id" || o.system)
|
|
2329
2365
|
continue;
|
|
2330
|
-
const c =
|
|
2366
|
+
const c = zn(o.type), m = !!o.required, h = rt(o.name);
|
|
2331
2367
|
if (c === "relation") {
|
|
2332
2368
|
const f = o.collectionId ? s.get(o.collectionId) : void 0;
|
|
2333
2369
|
if (!f)
|
|
2334
2370
|
continue;
|
|
2335
|
-
const g =
|
|
2371
|
+
const g = E(f.name, n);
|
|
2336
2372
|
i.push({
|
|
2337
2373
|
name: o.name,
|
|
2338
2374
|
title: h,
|
|
@@ -2342,10 +2378,10 @@ function ot(t, e, n) {
|
|
|
2342
2378
|
maxSelect: o.maxSelect ?? 1,
|
|
2343
2379
|
displayField: a[f.name] ?? "id",
|
|
2344
2380
|
relatedModel: g,
|
|
2345
|
-
singularRelationName:
|
|
2381
|
+
singularRelationName: N(
|
|
2346
2382
|
`${t.displayName} ${g.displayName}`
|
|
2347
2383
|
),
|
|
2348
|
-
pluralRelationName:
|
|
2384
|
+
pluralRelationName: N(
|
|
2349
2385
|
`${t.displayName} ${g.pluralDisplayName}`
|
|
2350
2386
|
),
|
|
2351
2387
|
isCurrentUser: n.features.auth && f.name === "users" && /user|owner|author/i.test(o.name)
|
|
@@ -2393,17 +2429,17 @@ function ot(t, e, n) {
|
|
|
2393
2429
|
}
|
|
2394
2430
|
return i.filter((o) => o.name !== "id");
|
|
2395
2431
|
}
|
|
2396
|
-
function
|
|
2432
|
+
function Gt(t) {
|
|
2397
2433
|
const e = t.filter((n) => n.type === "relation").map((n) => n.name);
|
|
2398
2434
|
return e.length > 0 ? e.join(",") : void 0;
|
|
2399
2435
|
}
|
|
2400
|
-
function
|
|
2436
|
+
function Kt(t) {
|
|
2401
2437
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
2402
2438
|
for (const r of t)
|
|
2403
2439
|
r.type === "relation" && (e.has(r.relatedModel.tableName) || (e.add(r.relatedModel.tableName), n.push(r.relatedModel)));
|
|
2404
2440
|
return n;
|
|
2405
2441
|
}
|
|
2406
|
-
function
|
|
2442
|
+
function Dn(t) {
|
|
2407
2443
|
const e = {
|
|
2408
2444
|
name: t.name,
|
|
2409
2445
|
type: t.type,
|
|
@@ -2426,7 +2462,7 @@ function Mn(t) {
|
|
|
2426
2462
|
onUpdate: t.onUpdate
|
|
2427
2463
|
} : e;
|
|
2428
2464
|
}
|
|
2429
|
-
function
|
|
2465
|
+
function Wt(t, e, n) {
|
|
2430
2466
|
const r = n ? {
|
|
2431
2467
|
listRule: n.rule,
|
|
2432
2468
|
viewRule: n.rule,
|
|
@@ -2438,12 +2474,12 @@ function Kt(t, e, n) {
|
|
|
2438
2474
|
name: t.tableName,
|
|
2439
2475
|
type: "base",
|
|
2440
2476
|
...r,
|
|
2441
|
-
fields: e.map(
|
|
2477
|
+
fields: e.map(Dn)
|
|
2442
2478
|
};
|
|
2443
2479
|
}
|
|
2444
|
-
const
|
|
2445
|
-
function
|
|
2446
|
-
if (t.length <=
|
|
2480
|
+
const St = 2, An = 3;
|
|
2481
|
+
function Nn(t) {
|
|
2482
|
+
if (t.length <= St)
|
|
2447
2483
|
throw new Error(
|
|
2448
2484
|
"Invalid command arguments. Expected: generate resource <model> [fields...]"
|
|
2449
2485
|
);
|
|
@@ -2452,56 +2488,57 @@ function Rn(t) {
|
|
|
2452
2488
|
throw new Error(
|
|
2453
2489
|
`Invalid command "${t.join(" ")}". Expected to start with "generate resource".`
|
|
2454
2490
|
);
|
|
2455
|
-
const r = t[
|
|
2491
|
+
const r = t[St], a = t.slice(An);
|
|
2456
2492
|
return { modelPath: r, fields: a };
|
|
2457
2493
|
}
|
|
2458
|
-
function
|
|
2494
|
+
function Bn(t, e) {
|
|
2459
2495
|
return {
|
|
2460
2496
|
path: t,
|
|
2461
|
-
language:
|
|
2497
|
+
language: j(t),
|
|
2462
2498
|
content: e
|
|
2463
2499
|
};
|
|
2464
2500
|
}
|
|
2465
|
-
async function
|
|
2466
|
-
|
|
2467
|
-
const r =
|
|
2501
|
+
async function jn(t, e, n) {
|
|
2502
|
+
K(e);
|
|
2503
|
+
const r = E(e, t);
|
|
2468
2504
|
if (n.length > 0) {
|
|
2469
|
-
const i = await
|
|
2505
|
+
const i = await W(n, r, t);
|
|
2470
2506
|
return { model: r, fields: i.fields, auth: i.auth, shouldCreateCollection: !0 };
|
|
2471
2507
|
}
|
|
2472
|
-
const a = t.env === "runtime" ? await (await import("./env.runtime-
|
|
2508
|
+
const a = t.env === "runtime" ? await (await import("./env.runtime-B18zkdjb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, a, t);
|
|
2473
2509
|
return { model: r, fields: s, auth: void 0, shouldCreateCollection: !1 };
|
|
2474
2510
|
}
|
|
2475
|
-
async function
|
|
2476
|
-
const { modelPath: e, fields: n } =
|
|
2511
|
+
async function Ln(t) {
|
|
2512
|
+
const { modelPath: e, fields: n } = Nn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i } = await jn(
|
|
2477
2513
|
t,
|
|
2478
2514
|
e,
|
|
2479
2515
|
n
|
|
2480
|
-
), o = `src/lib/schemas/${r.name}.ts`, c =
|
|
2516
|
+
), o = `src/lib/schemas/${r.name}.ts`, c = ot(r, a, {
|
|
2481
2517
|
includeModelFields: !0,
|
|
2482
2518
|
forForm: !0
|
|
2483
2519
|
});
|
|
2484
2520
|
return {
|
|
2485
|
-
creates: [
|
|
2521
|
+
creates: [Bn(o, c)],
|
|
2486
2522
|
modifies: [],
|
|
2487
2523
|
deletes: [],
|
|
2488
2524
|
components: [],
|
|
2489
2525
|
packages: [],
|
|
2490
|
-
collections: i ? [
|
|
2526
|
+
collections: i ? [Wt(r, a, s)] : []
|
|
2491
2527
|
};
|
|
2492
2528
|
}
|
|
2493
|
-
|
|
2494
|
-
|
|
2529
|
+
const On = "generate-resource";
|
|
2530
|
+
async function qn(t) {
|
|
2531
|
+
const e = await Ln(t);
|
|
2495
2532
|
if (t.env !== "runtime")
|
|
2496
|
-
return e;
|
|
2497
|
-
const { createCollections: n } = await import("./collections-
|
|
2533
|
+
return k(e);
|
|
2534
|
+
const { createCollections: n } = await import("./collections-Hdx-NhPn.js"), r = await n(e.collections, t), a = {
|
|
2498
2535
|
...e,
|
|
2499
2536
|
creates: [...e.creates, ...r]
|
|
2500
2537
|
}, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
|
|
2501
|
-
return s(a, t);
|
|
2538
|
+
return s(await k(a), t);
|
|
2502
2539
|
}
|
|
2503
|
-
const
|
|
2504
|
-
slug:
|
|
2540
|
+
const Un = {
|
|
2541
|
+
slug: On,
|
|
2505
2542
|
title: "Generate a resource",
|
|
2506
2543
|
summary: "Generates model schema resources.",
|
|
2507
2544
|
categories: ["data"],
|
|
@@ -2511,12 +2548,12 @@ const Dn = {
|
|
|
2511
2548
|
argv: ["generate", "resource", "contact", "name:text", "email:email"]
|
|
2512
2549
|
},
|
|
2513
2550
|
baseline: "velastack",
|
|
2514
|
-
generate:
|
|
2551
|
+
generate: qn
|
|
2515
2552
|
};
|
|
2516
|
-
var
|
|
2517
|
-
const
|
|
2518
|
-
function
|
|
2519
|
-
if (t.length <=
|
|
2553
|
+
var kt = Object.freeze, Vn = Object.defineProperty, X = (t, e) => kt(Vn(t, "raw", { value: kt(e || t.slice()) })), Mt, Rt, Pt, Et;
|
|
2554
|
+
const It = 2, Hn = 3;
|
|
2555
|
+
function Gn(t) {
|
|
2556
|
+
if (t.length <= It)
|
|
2520
2557
|
throw new Error(
|
|
2521
2558
|
"Invalid command arguments. Expected: generate scaffold <model> [fields...]"
|
|
2522
2559
|
);
|
|
@@ -2525,43 +2562,43 @@ function Bn(t) {
|
|
|
2525
2562
|
throw new Error(
|
|
2526
2563
|
`Invalid command "${t.join(" ")}". Expected to start with "generate scaffold".`
|
|
2527
2564
|
);
|
|
2528
|
-
const r = t[
|
|
2565
|
+
const r = t[It], a = t.slice(Hn);
|
|
2529
2566
|
return { modelPath: r, fields: a };
|
|
2530
2567
|
}
|
|
2531
2568
|
function _(t, e) {
|
|
2532
2569
|
return {
|
|
2533
2570
|
path: t,
|
|
2534
|
-
language:
|
|
2571
|
+
language: j(t),
|
|
2535
2572
|
content: e
|
|
2536
2573
|
};
|
|
2537
2574
|
}
|
|
2538
|
-
function
|
|
2575
|
+
function Xt(t) {
|
|
2539
2576
|
return t.some((e) => e.type === "file");
|
|
2540
2577
|
}
|
|
2541
|
-
function
|
|
2578
|
+
function Yt(t) {
|
|
2542
2579
|
return [...new Set(t.filter(Boolean))];
|
|
2543
2580
|
}
|
|
2544
|
-
function
|
|
2581
|
+
function it(t) {
|
|
2545
2582
|
return t.filter(
|
|
2546
2583
|
(e) => e.type === "select"
|
|
2547
|
-
).map((e) =>
|
|
2584
|
+
).map((e) => At(e)).join(`
|
|
2548
2585
|
|
|
2549
2586
|
`);
|
|
2550
2587
|
}
|
|
2551
|
-
function
|
|
2552
|
-
return
|
|
2588
|
+
function Jt(t, e) {
|
|
2589
|
+
return Kt(t).map(
|
|
2553
2590
|
(n) => `const ${n.pluralName} = await ${e}.collection("${n.tableName}").getFullList();`
|
|
2554
2591
|
).join(`
|
|
2555
2592
|
`);
|
|
2556
2593
|
}
|
|
2557
|
-
function
|
|
2558
|
-
return
|
|
2594
|
+
function Zt(t) {
|
|
2595
|
+
return Kt(t).map((e) => e.pluralName).join(", ");
|
|
2559
2596
|
}
|
|
2560
|
-
function
|
|
2597
|
+
function Kn(t) {
|
|
2561
2598
|
return t.features.auth ? "locals.pb" : "locals.admin";
|
|
2562
2599
|
}
|
|
2563
|
-
function
|
|
2564
|
-
const r =
|
|
2600
|
+
function Qt(t, e, n = !1) {
|
|
2601
|
+
const r = it(e);
|
|
2565
2602
|
return p`
|
|
2566
2603
|
${r}
|
|
2567
2604
|
${n ? "let { data, params } = $props();" : "let { data } = $props();"}
|
|
@@ -2573,21 +2610,21 @@ function Zt(t, e, n = !1) {
|
|
|
2573
2610
|
const { form: formData } = form;
|
|
2574
2611
|
`;
|
|
2575
2612
|
}
|
|
2576
|
-
function
|
|
2577
|
-
const r = n.some((o) => o.type === "select"), a =
|
|
2613
|
+
function Wn(t, e, n) {
|
|
2614
|
+
const r = n.some((o) => o.type === "select"), a = Yt([
|
|
2578
2615
|
'import { untrack } from "svelte";',
|
|
2579
2616
|
'import { superForm } from "sveltekit-superforms";',
|
|
2580
2617
|
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
2581
2618
|
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2582
|
-
...
|
|
2619
|
+
...nt(O(n)),
|
|
2583
2620
|
'import { Button } from "$lib/components/ui/button";',
|
|
2584
2621
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
2585
2622
|
'import * as Form from "$lib/components/ui/form";',
|
|
2586
2623
|
r ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2587
2624
|
]).join(`
|
|
2588
|
-
`), s = n.map((o) =>
|
|
2589
|
-
`), i =
|
|
2590
|
-
return p(
|
|
2625
|
+
`), s = n.map((o) => et(o)).join(`
|
|
2626
|
+
`), i = Xt(n) ? ' enctype="multipart/form-data"' : "";
|
|
2627
|
+
return p(Mt || (Mt = X([`
|
|
2591
2628
|
<script lang="ts">
|
|
2592
2629
|
`, `
|
|
2593
2630
|
`, `
|
|
@@ -2614,23 +2651,23 @@ function Ln(t, e, n) {
|
|
|
2614
2651
|
</form>
|
|
2615
2652
|
</div>
|
|
2616
2653
|
</section>
|
|
2617
|
-
`])), a,
|
|
2654
|
+
`])), a, Qt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2618
2655
|
}
|
|
2619
|
-
function
|
|
2620
|
-
const r = n.some((o) => o.type === "select"), a =
|
|
2656
|
+
function Xn(t, e, n) {
|
|
2657
|
+
const r = n.some((o) => o.type === "select"), a = Yt([
|
|
2621
2658
|
'import { untrack } from "svelte";',
|
|
2622
2659
|
'import { superForm } from "sveltekit-superforms";',
|
|
2623
2660
|
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
2624
2661
|
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2625
|
-
...
|
|
2662
|
+
...nt(O(n)),
|
|
2626
2663
|
'import { Button } from "$lib/components/ui/button";',
|
|
2627
2664
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
2628
2665
|
'import * as Form from "$lib/components/ui/form";',
|
|
2629
2666
|
r ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2630
2667
|
]).join(`
|
|
2631
|
-
`), s = n.map((o) =>
|
|
2632
|
-
`), i =
|
|
2633
|
-
return p(
|
|
2668
|
+
`), s = n.map((o) => et(o)).join(`
|
|
2669
|
+
`), i = Xt(n) ? ' enctype="multipart/form-data"' : "";
|
|
2670
|
+
return p(Rt || (Rt = X([`
|
|
2634
2671
|
<script lang="ts">
|
|
2635
2672
|
`, `
|
|
2636
2673
|
`, `
|
|
@@ -2684,10 +2721,10 @@ function On(t, e, n) {
|
|
|
2684
2721
|
</form>
|
|
2685
2722
|
</div>
|
|
2686
2723
|
</section>
|
|
2687
|
-
`])), a,
|
|
2724
|
+
`])), a, Qt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2688
2725
|
}
|
|
2689
|
-
function
|
|
2690
|
-
const r = n.some((o) => o.type === "select"), a = r ? `${
|
|
2726
|
+
function Yn(t, e, n) {
|
|
2727
|
+
const r = n.some((o) => o.type === "select"), a = r ? `${it(n)}` : "", s = n.map((o) => {
|
|
2691
2728
|
let c = "{ getValue }", m = "{ value: getValue() }";
|
|
2692
2729
|
return o.type === "relation" && (c = "{ getValue, row }", m = `{ value: getValue(), expanded: row.original.expand?.${o.name}, displayField: "${o.displayField}" }`), o.type === "select" && (m = `{ value: getValue(), options: ${o.name}Labels }`), o.type === "file" && (c = "{ getValue, row }", m = "{ value: getValue(), collectionId: row.original.collectionId, id: row.original.id }"), p`
|
|
2693
2730
|
columnHelper.accessor("${o.name}", {
|
|
@@ -2700,7 +2737,7 @@ function qn(t, e, n) {
|
|
|
2700
2737
|
(o) => `<FacetedFilter column={table.getColumn("${o.name}")!} title="${o.title}" options={Object.values(${o.name}Labels)} />`
|
|
2701
2738
|
).join(`
|
|
2702
2739
|
`);
|
|
2703
|
-
return p(
|
|
2740
|
+
return p(Pt || (Pt = X([`
|
|
2704
2741
|
<script lang="ts">
|
|
2705
2742
|
import {
|
|
2706
2743
|
type ColumnFiltersState,
|
|
@@ -3076,8 +3113,8 @@ function qn(t, e, n) {
|
|
|
3076
3113
|
</section>
|
|
3077
3114
|
`])), r ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "", a, t.tableName, s, n.length > 0 ? "," : "", e.list, e.list, e.list, t.pluralName, t.pluralDisplayName, e.new, t.displayName.toLowerCase(), t.pluralDisplayName.toLowerCase(), i, e.new, t.displayName.toLowerCase());
|
|
3078
3115
|
}
|
|
3079
|
-
function
|
|
3080
|
-
const r =
|
|
3116
|
+
function Jn(t, e, n) {
|
|
3117
|
+
const r = Gt(e), a = r ? `{ expand: "${r}" }` : "";
|
|
3081
3118
|
return p`
|
|
3082
3119
|
export const load = async ({ locals }) => {
|
|
3083
3120
|
const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${a});
|
|
@@ -3085,8 +3122,8 @@ function Un(t, e, n) {
|
|
|
3085
3122
|
};
|
|
3086
3123
|
`;
|
|
3087
3124
|
}
|
|
3088
|
-
function
|
|
3089
|
-
const s =
|
|
3125
|
+
function Zn(t, e, n, r, a) {
|
|
3126
|
+
const s = Jt(n, r), i = Zt(n), o = i ? `, ${i}` : "", c = n.find(
|
|
3090
3127
|
(h) => h.type === "relation" && h.isCurrentUser
|
|
3091
3128
|
), m = a && c ? p`
|
|
3092
3129
|
{
|
|
@@ -3127,8 +3164,8 @@ function Vn(t, e, n, r, a) {
|
|
|
3127
3164
|
};
|
|
3128
3165
|
`;
|
|
3129
3166
|
}
|
|
3130
|
-
function
|
|
3131
|
-
const a =
|
|
3167
|
+
function Qn(t, e, n, r) {
|
|
3168
|
+
const a = Gt(n), s = a ? `, { expand: "${a}" }` : "";
|
|
3132
3169
|
return p`
|
|
3133
3170
|
import { error, redirect } from "@sveltejs/kit";
|
|
3134
3171
|
|
|
@@ -3149,7 +3186,7 @@ function Hn(t, e, n, r) {
|
|
|
3149
3186
|
};
|
|
3150
3187
|
`;
|
|
3151
3188
|
}
|
|
3152
|
-
function
|
|
3189
|
+
function tr(t, e, n) {
|
|
3153
3190
|
const r = n.some((m) => m.type === "select"), a = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
|
|
3154
3191
|
'import { Button } from "$lib/components/ui/button";',
|
|
3155
3192
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
@@ -3157,9 +3194,9 @@ function Gn(t, e, n) {
|
|
|
3157
3194
|
a ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
|
|
3158
3195
|
s ? 'import FileIcon from "@lucide/svelte/icons/file";' : ""
|
|
3159
3196
|
].filter(Boolean).join(`
|
|
3160
|
-
`), o =
|
|
3197
|
+
`), o = it(n), c = n.map((m) => Re(t, m)).join(`
|
|
3161
3198
|
`);
|
|
3162
|
-
return p(
|
|
3199
|
+
return p(Et || (Et = X([`
|
|
3163
3200
|
<script lang="ts">
|
|
3164
3201
|
`, `
|
|
3165
3202
|
`, `
|
|
@@ -3193,8 +3230,8 @@ function Gn(t, e, n) {
|
|
|
3193
3230
|
</section>
|
|
3194
3231
|
`])), i, o, t.displayName, e.list, c, e.list, t.name);
|
|
3195
3232
|
}
|
|
3196
|
-
function
|
|
3197
|
-
const a =
|
|
3233
|
+
function er(t, e, n, r) {
|
|
3234
|
+
const a = Jt(n, r), s = Zt(n), i = s ? `, ${s}` : "";
|
|
3198
3235
|
return p`
|
|
3199
3236
|
import { error, fail, redirect } from "@sveltejs/kit";
|
|
3200
3237
|
import { setPocketbaseErrors, setDefaultData } from "@velastack/pocketbase";
|
|
@@ -3235,11 +3272,11 @@ function Kn(t, e, n, r) {
|
|
|
3235
3272
|
};
|
|
3236
3273
|
`;
|
|
3237
3274
|
}
|
|
3238
|
-
async function
|
|
3239
|
-
|
|
3240
|
-
const r =
|
|
3275
|
+
async function nr(t, e, n) {
|
|
3276
|
+
K(e);
|
|
3277
|
+
const r = E(e, t), a = t.env === "runtime" ? await (await import("./env.runtime-B18zkdjb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t);
|
|
3241
3278
|
if (n.length > 0) {
|
|
3242
|
-
const i = await
|
|
3279
|
+
const i = await W(n, r, t);
|
|
3243
3280
|
return {
|
|
3244
3281
|
model: r,
|
|
3245
3282
|
fields: i.fields,
|
|
@@ -3248,7 +3285,7 @@ async function Wn(t, e, n) {
|
|
|
3248
3285
|
collections: a
|
|
3249
3286
|
};
|
|
3250
3287
|
}
|
|
3251
|
-
const s =
|
|
3288
|
+
const s = st(r, a, t);
|
|
3252
3289
|
return {
|
|
3253
3290
|
model: r,
|
|
3254
3291
|
fields: s,
|
|
@@ -3257,52 +3294,52 @@ async function Wn(t, e, n) {
|
|
|
3257
3294
|
collections: a
|
|
3258
3295
|
};
|
|
3259
3296
|
}
|
|
3260
|
-
async function
|
|
3261
|
-
const { modelPath: e, fields: n } =
|
|
3297
|
+
async function rr(t) {
|
|
3298
|
+
const { modelPath: e, fields: n } = Gn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i, collections: o } = await nr(t, e, n), c = Lt(r), m = Ot(r), h = Kn(t), f = a.filter(
|
|
3262
3299
|
(u) => !(u.type === "relation" && u.isCurrentUser)
|
|
3263
3300
|
), g = [
|
|
3264
3301
|
_(
|
|
3265
3302
|
`src/lib/schemas/${r.name}.ts`,
|
|
3266
|
-
|
|
3303
|
+
ot(r, a, {
|
|
3267
3304
|
includeModelFields: !0,
|
|
3268
3305
|
forForm: !0
|
|
3269
3306
|
})
|
|
3270
3307
|
),
|
|
3271
3308
|
_(
|
|
3272
3309
|
`${c.list}/+page.server.ts`,
|
|
3273
|
-
|
|
3310
|
+
Jn(r, f, h)
|
|
3274
3311
|
),
|
|
3275
3312
|
_(
|
|
3276
3313
|
`${c.list}/+page.svelte`,
|
|
3277
|
-
|
|
3314
|
+
Yn(r, m, f)
|
|
3278
3315
|
),
|
|
3279
3316
|
_(
|
|
3280
3317
|
`${c.new}/+page.server.ts`,
|
|
3281
|
-
|
|
3318
|
+
Zn(r, m, f, h, t.features.auth)
|
|
3282
3319
|
),
|
|
3283
|
-
_(`${c.new}/+page.svelte`,
|
|
3320
|
+
_(`${c.new}/+page.svelte`, Wn(r, m, f)),
|
|
3284
3321
|
_(
|
|
3285
3322
|
`${c.show}/+page.server.ts`,
|
|
3286
|
-
|
|
3323
|
+
Qn(r, m, f, h)
|
|
3287
3324
|
),
|
|
3288
3325
|
_(
|
|
3289
3326
|
`${c.show}/+page.svelte`,
|
|
3290
|
-
|
|
3327
|
+
tr(r, m, f)
|
|
3291
3328
|
),
|
|
3292
3329
|
_(
|
|
3293
3330
|
`${c.edit}/+page.server.ts`,
|
|
3294
|
-
|
|
3331
|
+
er(r, m, f, h)
|
|
3295
3332
|
),
|
|
3296
3333
|
_(
|
|
3297
3334
|
`${c.edit}/+page.svelte`,
|
|
3298
|
-
|
|
3335
|
+
Xn(r, m, f)
|
|
3299
3336
|
),
|
|
3300
3337
|
_(
|
|
3301
3338
|
`${c.list}/server.test.ts`,
|
|
3302
|
-
|
|
3339
|
+
dn(r, m, a, t, o)
|
|
3303
3340
|
)
|
|
3304
3341
|
], x = [
|
|
3305
|
-
...
|
|
3342
|
+
...O(f),
|
|
3306
3343
|
"button",
|
|
3307
3344
|
"table",
|
|
3308
3345
|
"data-table",
|
|
@@ -3325,21 +3362,22 @@ async function Xn(t) {
|
|
|
3325
3362
|
deletes: [],
|
|
3326
3363
|
components: [...new Set(x)],
|
|
3327
3364
|
packages: [],
|
|
3328
|
-
collections: i ? [
|
|
3365
|
+
collections: i ? [Wt(r, a, s)] : []
|
|
3329
3366
|
};
|
|
3330
3367
|
}
|
|
3331
|
-
|
|
3332
|
-
|
|
3368
|
+
const ar = "generate-scaffold";
|
|
3369
|
+
async function or(t) {
|
|
3370
|
+
const e = await rr(t);
|
|
3333
3371
|
if (t.env !== "runtime")
|
|
3334
|
-
return e;
|
|
3335
|
-
const { createCollections: n } = await import("./collections-
|
|
3372
|
+
return k(e);
|
|
3373
|
+
const { createCollections: n } = await import("./collections-Hdx-NhPn.js"), r = await n(e.collections, t), a = {
|
|
3336
3374
|
...e,
|
|
3337
3375
|
creates: [...e.creates, ...r]
|
|
3338
3376
|
}, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
|
|
3339
|
-
return s(a, t);
|
|
3377
|
+
return s(await k(a), t);
|
|
3340
3378
|
}
|
|
3341
|
-
const
|
|
3342
|
-
slug:
|
|
3379
|
+
const sr = {
|
|
3380
|
+
slug: ar,
|
|
3343
3381
|
title: "Generate a scaffold",
|
|
3344
3382
|
summary: "Generates CRUD routes and schema.",
|
|
3345
3383
|
categories: ["data", "forms"],
|
|
@@ -3349,10 +3387,10 @@ const Jn = {
|
|
|
3349
3387
|
argv: ["generate", "scaffold", "contact", "name:text", "email:email"]
|
|
3350
3388
|
},
|
|
3351
3389
|
baseline: "velastack",
|
|
3352
|
-
generate:
|
|
3353
|
-
},
|
|
3354
|
-
function
|
|
3355
|
-
if (t.length <=
|
|
3390
|
+
generate: or
|
|
3391
|
+
}, Tt = 2, ir = 3;
|
|
3392
|
+
function lr(t) {
|
|
3393
|
+
if (t.length <= Tt)
|
|
3356
3394
|
throw new Error(
|
|
3357
3395
|
"Invalid command arguments. Expected: generate schema <model> [fields...]"
|
|
3358
3396
|
);
|
|
@@ -3361,37 +3399,37 @@ function Qn(t) {
|
|
|
3361
3399
|
throw new Error(
|
|
3362
3400
|
`Invalid command "${t.join(" ")}". Expected to start with "generate schema".`
|
|
3363
3401
|
);
|
|
3364
|
-
const r = t[
|
|
3402
|
+
const r = t[Tt], a = t.slice(ir);
|
|
3365
3403
|
return { modelPath: r, fields: a };
|
|
3366
3404
|
}
|
|
3367
|
-
function
|
|
3405
|
+
function cr(t, e) {
|
|
3368
3406
|
return {
|
|
3369
3407
|
path: t,
|
|
3370
|
-
language:
|
|
3408
|
+
language: j(t),
|
|
3371
3409
|
content: e
|
|
3372
3410
|
};
|
|
3373
3411
|
}
|
|
3374
|
-
async function
|
|
3375
|
-
|
|
3376
|
-
const r =
|
|
3412
|
+
async function mr(t, e, n) {
|
|
3413
|
+
K(e);
|
|
3414
|
+
const r = E(e, t);
|
|
3377
3415
|
if (n.length > 0) {
|
|
3378
|
-
const i = await
|
|
3416
|
+
const i = await W(n, r, t);
|
|
3379
3417
|
return { model: r, fields: i.fields, includeModelFields: !1 };
|
|
3380
3418
|
}
|
|
3381
|
-
const a = t.env === "runtime" ? await (await import("./env.runtime-
|
|
3419
|
+
const a = t.env === "runtime" ? await (await import("./env.runtime-B18zkdjb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, a, t);
|
|
3382
3420
|
return { model: r, fields: s, includeModelFields: !0 };
|
|
3383
3421
|
}
|
|
3384
|
-
async function
|
|
3385
|
-
const { modelPath: e, fields: n } =
|
|
3422
|
+
async function ur(t) {
|
|
3423
|
+
const { modelPath: e, fields: n } = lr(t.argv), { model: r, fields: a, includeModelFields: s } = await mr(
|
|
3386
3424
|
t,
|
|
3387
3425
|
e,
|
|
3388
3426
|
n
|
|
3389
|
-
), i = `src/lib/schemas/${r.name}.ts`, o =
|
|
3427
|
+
), i = `src/lib/schemas/${r.name}.ts`, o = ot(r, a, {
|
|
3390
3428
|
includeModelFields: s,
|
|
3391
3429
|
forForm: !0
|
|
3392
3430
|
});
|
|
3393
3431
|
return {
|
|
3394
|
-
creates: [
|
|
3432
|
+
creates: [cr(i, o)],
|
|
3395
3433
|
modifies: [],
|
|
3396
3434
|
deletes: [],
|
|
3397
3435
|
components: [],
|
|
@@ -3399,15 +3437,16 @@ async function nr(t) {
|
|
|
3399
3437
|
collections: []
|
|
3400
3438
|
};
|
|
3401
3439
|
}
|
|
3402
|
-
|
|
3403
|
-
|
|
3440
|
+
const pr = "generate-schema";
|
|
3441
|
+
async function dr(t) {
|
|
3442
|
+
const e = await ur(t);
|
|
3404
3443
|
if (t.env !== "runtime")
|
|
3405
|
-
return e;
|
|
3444
|
+
return k(e);
|
|
3406
3445
|
const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
|
|
3407
|
-
return n(e, t);
|
|
3446
|
+
return n(await k(e), t);
|
|
3408
3447
|
}
|
|
3409
|
-
const
|
|
3410
|
-
slug:
|
|
3448
|
+
const fr = {
|
|
3449
|
+
slug: pr,
|
|
3411
3450
|
title: "Generate a schema",
|
|
3412
3451
|
summary: "Generates a zod schema.",
|
|
3413
3452
|
categories: ["data"],
|
|
@@ -3417,8 +3456,8 @@ const ar = {
|
|
|
3417
3456
|
argv: ["generate", "schema", "contact", "name:text", "email:email"]
|
|
3418
3457
|
},
|
|
3419
3458
|
baseline: "velastack",
|
|
3420
|
-
generate:
|
|
3421
|
-
},
|
|
3459
|
+
generate: dr
|
|
3460
|
+
}, hr = `<script lang="ts" module>
|
|
3422
3461
|
import HomeIcon from '@lucide/svelte/icons/home';
|
|
3423
3462
|
|
|
3424
3463
|
let data = {
|
|
@@ -3474,7 +3513,7 @@ const ar = {
|
|
|
3474
3513
|
<NavUser {user} />
|
|
3475
3514
|
</Sidebar.Footer>
|
|
3476
3515
|
</Sidebar.Root>
|
|
3477
|
-
`,
|
|
3516
|
+
`, gr = `<script lang="ts">
|
|
3478
3517
|
import type { Component } from 'svelte';
|
|
3479
3518
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3480
3519
|
import { page } from '$app/state';
|
|
@@ -3514,7 +3553,7 @@ const ar = {
|
|
|
3514
3553
|
{/each}
|
|
3515
3554
|
</Sidebar.Menu>
|
|
3516
3555
|
</Sidebar.Group>
|
|
3517
|
-
`,
|
|
3556
|
+
`, br = `<script lang="ts" module>
|
|
3518
3557
|
import Settings2Icon from '@lucide/svelte/icons/settings-2';
|
|
3519
3558
|
|
|
3520
3559
|
let data = {
|
|
@@ -3633,7 +3672,7 @@ const ar = {
|
|
|
3633
3672
|
</DropdownMenu.Root>
|
|
3634
3673
|
</Sidebar.MenuItem>
|
|
3635
3674
|
</Sidebar.Menu>
|
|
3636
|
-
`,
|
|
3675
|
+
`, vr = `<script lang="ts">
|
|
3637
3676
|
import { cn } from '$lib/utils';
|
|
3638
3677
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3639
3678
|
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
|
|
@@ -3661,7 +3700,7 @@ const ar = {
|
|
|
3661
3700
|
{@render children?.()}
|
|
3662
3701
|
</div>
|
|
3663
3702
|
{/if}
|
|
3664
|
-
`,
|
|
3703
|
+
`, wr = `<script lang="ts">
|
|
3665
3704
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3666
3705
|
import { getContext } from 'svelte';
|
|
3667
3706
|
import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
|
|
@@ -3677,7 +3716,7 @@ const ar = {
|
|
|
3677
3716
|
{:else}
|
|
3678
3717
|
{@render children?.()}
|
|
3679
3718
|
{/if}
|
|
3680
|
-
`,
|
|
3719
|
+
`, yr = `<script lang="ts">
|
|
3681
3720
|
import { goto } from '$app/navigation';
|
|
3682
3721
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
|
|
3683
3722
|
import { Button } from '$lib/components/ui/button';
|
|
@@ -3713,7 +3752,7 @@ const ar = {
|
|
|
3713
3752
|
{@render children?.()}
|
|
3714
3753
|
</Button>
|
|
3715
3754
|
{/if}
|
|
3716
|
-
`,
|
|
3755
|
+
`, xr = `<script lang="ts">
|
|
3717
3756
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3718
3757
|
import { getContext } from 'svelte';
|
|
3719
3758
|
import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
|
|
@@ -3727,7 +3766,7 @@ const ar = {
|
|
|
3727
3766
|
{@render children?.()}
|
|
3728
3767
|
</DropdownMenu.Label>
|
|
3729
3768
|
{/if}
|
|
3730
|
-
`,
|
|
3769
|
+
`, $r = `<script lang="ts">
|
|
3731
3770
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3732
3771
|
import { getContext } from 'svelte';
|
|
3733
3772
|
import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
|
|
@@ -3739,7 +3778,7 @@ const ar = {
|
|
|
3739
3778
|
{#if isDesktop}
|
|
3740
3779
|
<DropdownMenu.Separator {...restProps} />
|
|
3741
3780
|
{/if}
|
|
3742
|
-
`,
|
|
3781
|
+
`, Fr = `<script lang="ts">
|
|
3743
3782
|
import { cn } from '$lib/utils';
|
|
3744
3783
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
|
|
3745
3784
|
import { getContext } from 'svelte';
|
|
@@ -3753,7 +3792,7 @@ const ar = {
|
|
|
3753
3792
|
{#if isDesktop}
|
|
3754
3793
|
<DropdownMenu.Trigger class={cn('inline-flex', className)} {...restProps} />
|
|
3755
3794
|
{/if}
|
|
3756
|
-
`,
|
|
3795
|
+
`, Cr = `<script lang="ts">
|
|
3757
3796
|
import { page } from '$app/state';
|
|
3758
3797
|
import { browser } from '$app/environment';
|
|
3759
3798
|
import { onMount, setContext } from 'svelte';
|
|
@@ -3799,12 +3838,12 @@ const ar = {
|
|
|
3799
3838
|
{:else}
|
|
3800
3839
|
{@render guest?.()}
|
|
3801
3840
|
{/if}
|
|
3802
|
-
`,
|
|
3841
|
+
`, _r = `export type AuthMenuContext = {
|
|
3803
3842
|
isDesktop: boolean;
|
|
3804
3843
|
};
|
|
3805
3844
|
|
|
3806
3845
|
export const AUTH_MENU_CONTEXT_KEY = Symbol('auth-menu-context');
|
|
3807
|
-
`,
|
|
3846
|
+
`, Sr = `import Root from './auth-menu.svelte';
|
|
3808
3847
|
import Content from './auth-menu-content.svelte';
|
|
3809
3848
|
import Trigger from './auth-menu-trigger.svelte';
|
|
3810
3849
|
import Group from './auth-menu-group.svelte';
|
|
@@ -3813,12 +3852,12 @@ import Separator from './auth-menu-separator.svelte';
|
|
|
3813
3852
|
import Item from './auth-menu-item.svelte';
|
|
3814
3853
|
|
|
3815
3854
|
export { Root, Content, Trigger, Group, Label, Separator, Item };
|
|
3816
|
-
`,
|
|
3855
|
+
`, kr = `import { z } from 'zod/v3';
|
|
3817
3856
|
|
|
3818
3857
|
export const changeEmailSchema = z.object({
|
|
3819
3858
|
email: z.string().email()
|
|
3820
3859
|
});
|
|
3821
|
-
`,
|
|
3860
|
+
`, Mr = `import { z } from 'zod/v3';
|
|
3822
3861
|
|
|
3823
3862
|
export const changePasswordSchema = z
|
|
3824
3863
|
.object({
|
|
@@ -3829,16 +3868,16 @@ export const changePasswordSchema = z
|
|
|
3829
3868
|
message: "Passwords don't match",
|
|
3830
3869
|
path: ['passwordConfirm']
|
|
3831
3870
|
});
|
|
3832
|
-
`,
|
|
3871
|
+
`, Rr = `import { z } from 'zod/v3';
|
|
3833
3872
|
export const confirmEmailChangeSchema = z.object({
|
|
3834
3873
|
password: z.string()
|
|
3835
3874
|
});
|
|
3836
|
-
`,
|
|
3875
|
+
`, Pr = `import { z } from 'zod/v3';
|
|
3837
3876
|
export const confirmResetSchema = z.object({
|
|
3838
3877
|
password: z.string(),
|
|
3839
3878
|
passwordConfirm: z.string()
|
|
3840
3879
|
});
|
|
3841
|
-
`,
|
|
3880
|
+
`, Er = `import { z } from 'zod/v3';
|
|
3842
3881
|
|
|
3843
3882
|
const otpSchema = z.object({
|
|
3844
3883
|
type: z.literal('otp'),
|
|
@@ -3857,35 +3896,35 @@ const oAuth2Schema = z.object({
|
|
|
3857
3896
|
});
|
|
3858
3897
|
|
|
3859
3898
|
export const loginSchema = z.discriminatedUnion('type', [otpSchema, passwordSchema, oAuth2Schema]);
|
|
3860
|
-
`,
|
|
3899
|
+
`, Ir = `import { z } from 'zod/v3';
|
|
3861
3900
|
export const otpSchema = z.object({
|
|
3862
3901
|
otp: z.string()
|
|
3863
3902
|
});
|
|
3864
|
-
`,
|
|
3903
|
+
`, Tr = `import { z } from 'zod/v3';
|
|
3865
3904
|
|
|
3866
3905
|
export const profileSchema = z.object({
|
|
3867
3906
|
name: z.string().optional(),
|
|
3868
3907
|
avatar: z.union([z.instanceof(File), z.string()]).optional(),
|
|
3869
3908
|
emailVisibility: z.boolean().optional()
|
|
3870
3909
|
});
|
|
3871
|
-
`,
|
|
3910
|
+
`, zr = `import { z } from 'zod/v3';
|
|
3872
3911
|
export const resetSchema = z.object({
|
|
3873
3912
|
email: z.string().email()
|
|
3874
3913
|
});
|
|
3875
|
-
`,
|
|
3914
|
+
`, Dr = `import { z } from 'zod/v3';
|
|
3876
3915
|
|
|
3877
3916
|
export const signupSchema = z.object({
|
|
3878
3917
|
email: z.string().email(),
|
|
3879
3918
|
password: z.string(),
|
|
3880
3919
|
passwordConfirm: z.string()
|
|
3881
3920
|
});
|
|
3882
|
-
`,
|
|
3921
|
+
`, Ar = `export const load = ({ locals }) => {
|
|
3883
3922
|
const user = locals.pb.authStore.record!;
|
|
3884
3923
|
const breadcrumbs = [{ title: 'Home', url: '/dashboard' }];
|
|
3885
3924
|
|
|
3886
3925
|
return { user, breadcrumbs };
|
|
3887
3926
|
};
|
|
3888
|
-
`,
|
|
3927
|
+
`, Nr = `<script lang="ts">
|
|
3889
3928
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3890
3929
|
import { Separator } from '$lib/components/ui/separator';
|
|
3891
3930
|
import AppSidebar from '$lib/components/app-sidebar.svelte';
|
|
@@ -3935,7 +3974,7 @@ export const signupSchema = z.object({
|
|
|
3935
3974
|
background-color: var(--color-sidebar);
|
|
3936
3975
|
}
|
|
3937
3976
|
</style>
|
|
3938
|
-
`,
|
|
3977
|
+
`, Br = "", jr = `import { describe, it, expect } from 'vitest';
|
|
3939
3978
|
import type { Match } from '@velastack/pocketbase';
|
|
3940
3979
|
import type { RouteId } from './$types';
|
|
3941
3980
|
|
|
@@ -3952,14 +3991,14 @@ describe('dashboard', () => {
|
|
|
3952
3991
|
expect(response.status).toBe(200);
|
|
3953
3992
|
});
|
|
3954
3993
|
});
|
|
3955
|
-
`,
|
|
3994
|
+
`, Lr = `export const load = async ({ parent }) => {
|
|
3956
3995
|
const { breadcrumbs } = await parent();
|
|
3957
3996
|
|
|
3958
3997
|
return {
|
|
3959
3998
|
breadcrumbs: [...breadcrumbs, { title: 'Settings', url: '/settings' }]
|
|
3960
3999
|
};
|
|
3961
4000
|
};
|
|
3962
|
-
`,
|
|
4001
|
+
`, Or = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
|
|
3963
4002
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
3964
4003
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
3965
4004
|
import { profileSchema } from '$lib/schemas/profile';
|
|
@@ -4028,7 +4067,7 @@ export const actions = {
|
|
|
4028
4067
|
return {};
|
|
4029
4068
|
}
|
|
4030
4069
|
};
|
|
4031
|
-
`,
|
|
4070
|
+
`, qr = `<script lang="ts">
|
|
4032
4071
|
import { untrack } from 'svelte';
|
|
4033
4072
|
import { superForm } from 'sveltekit-superforms';
|
|
4034
4073
|
import { zodClient } from 'sveltekit-superforms/adapters';
|
|
@@ -4306,7 +4345,7 @@ export const actions = {
|
|
|
4306
4345
|
</form>
|
|
4307
4346
|
</div>
|
|
4308
4347
|
</div>
|
|
4309
|
-
`,
|
|
4348
|
+
`, Ur = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
4310
4349
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4311
4350
|
import { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';
|
|
4312
4351
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4333,7 +4372,7 @@ export const actions = {
|
|
|
4333
4372
|
return redirect(303, '/login');
|
|
4334
4373
|
}
|
|
4335
4374
|
};
|
|
4336
|
-
`,
|
|
4375
|
+
`, Vr = `<script lang="ts">
|
|
4337
4376
|
import { untrack } from 'svelte';
|
|
4338
4377
|
import { Button } from '$lib/components/ui/button';
|
|
4339
4378
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4401,7 +4440,7 @@ export const actions = {
|
|
|
4401
4440
|
</div>
|
|
4402
4441
|
</div>
|
|
4403
4442
|
</div>
|
|
4404
|
-
`,
|
|
4443
|
+
`, Hr = `import { describe, it, expect } from 'vitest';
|
|
4405
4444
|
import type { Match } from '@velastack/pocketbase';
|
|
4406
4445
|
import type { RouteId } from './$types';
|
|
4407
4446
|
|
|
@@ -4413,7 +4452,7 @@ describe('GET /confirm-email-change/[token]', () => {
|
|
|
4413
4452
|
expect(response.status).toBe(200);
|
|
4414
4453
|
});
|
|
4415
4454
|
});
|
|
4416
|
-
`,
|
|
4455
|
+
`, Gr = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
4417
4456
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4418
4457
|
import { confirmResetSchema } from '$lib/schemas/confirmReset';
|
|
4419
4458
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4442,7 +4481,7 @@ export const actions = {
|
|
|
4442
4481
|
return redirect(303, '/login');
|
|
4443
4482
|
}
|
|
4444
4483
|
};
|
|
4445
|
-
`,
|
|
4484
|
+
`, Kr = `<script lang="ts">
|
|
4446
4485
|
import { untrack } from 'svelte';
|
|
4447
4486
|
import { Button } from '$lib/components/ui/button';
|
|
4448
4487
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4526,7 +4565,7 @@ export const actions = {
|
|
|
4526
4565
|
</div>
|
|
4527
4566
|
</div>
|
|
4528
4567
|
</div>
|
|
4529
|
-
`,
|
|
4568
|
+
`, Wr = `import { describe, it, expect } from 'vitest';
|
|
4530
4569
|
import type { Match } from '@velastack/pocketbase';
|
|
4531
4570
|
import type { RouteId } from './$types';
|
|
4532
4571
|
|
|
@@ -4536,7 +4575,7 @@ describe('GET /confirm-reset/[token]', () => {
|
|
|
4536
4575
|
expect(response.status).toBe(200);
|
|
4537
4576
|
});
|
|
4538
4577
|
});
|
|
4539
|
-
`,
|
|
4578
|
+
`, Xr = `import { redirect } from '@sveltejs/kit';
|
|
4540
4579
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
4541
4580
|
|
|
4542
4581
|
export const GET = async ({ params, locals, cookies }) => {
|
|
@@ -4555,7 +4594,7 @@ export const GET = async ({ params, locals, cookies }) => {
|
|
|
4555
4594
|
setFlash({ type: 'toast', message }, cookies);
|
|
4556
4595
|
redirect(303, redirectPath);
|
|
4557
4596
|
};
|
|
4558
|
-
`,
|
|
4597
|
+
`, Yr = `import { describe, it, expect } from 'vitest';
|
|
4559
4598
|
import type { Match } from '@velastack/pocketbase';
|
|
4560
4599
|
import type { RouteId } from './$types';
|
|
4561
4600
|
|
|
@@ -4568,7 +4607,7 @@ describe('GET /confirm-verification/[token]', () => {
|
|
|
4568
4607
|
expect(response.headers['location']).toBe('/login');
|
|
4569
4608
|
});
|
|
4570
4609
|
});
|
|
4571
|
-
`,
|
|
4610
|
+
`, Jr = `import { fail, superValidate, message } from 'sveltekit-superforms';
|
|
4572
4611
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4573
4612
|
import { loginSchema } from '$lib/schemas/login';
|
|
4574
4613
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4629,7 +4668,7 @@ export const actions = {
|
|
|
4629
4668
|
redirect(303, redirectUrl);
|
|
4630
4669
|
}
|
|
4631
4670
|
};
|
|
4632
|
-
`,
|
|
4671
|
+
`, Zr = `<script lang="ts">
|
|
4633
4672
|
import { untrack } from 'svelte';
|
|
4634
4673
|
import { Button } from '$lib/components/ui/button';
|
|
4635
4674
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4812,7 +4851,7 @@ export const actions = {
|
|
|
4812
4851
|
</div>
|
|
4813
4852
|
</div>
|
|
4814
4853
|
</div>
|
|
4815
|
-
`,
|
|
4854
|
+
`, Qr = `import { describe, it, expect } from 'vitest';
|
|
4816
4855
|
import * as devalue from 'devalue';
|
|
4817
4856
|
import type { Match } from '@velastack/pocketbase';
|
|
4818
4857
|
import type { RouteId } from './$types';
|
|
@@ -4859,14 +4898,14 @@ describe('POST /login', () => {
|
|
|
4859
4898
|
expect(data.form.message.text).toBe('Failed to authenticate.');
|
|
4860
4899
|
});
|
|
4861
4900
|
});
|
|
4862
|
-
`,
|
|
4901
|
+
`, ta = `import { redirect } from '@sveltejs/kit';
|
|
4863
4902
|
|
|
4864
4903
|
export const POST = ({ cookies, locals }) => {
|
|
4865
4904
|
locals.pb.authStore.clear();
|
|
4866
4905
|
locals.pb.authStore.clearCookie(cookies);
|
|
4867
4906
|
throw redirect(303, '/');
|
|
4868
4907
|
};
|
|
4869
|
-
`,
|
|
4908
|
+
`, ea = `import { describe, it, expect } from 'vitest';
|
|
4870
4909
|
import type { Match } from '@velastack/pocketbase';
|
|
4871
4910
|
import type { RouteId } from './$types';
|
|
4872
4911
|
|
|
@@ -4878,7 +4917,7 @@ describe('POST /logout', () => {
|
|
|
4878
4917
|
expect(response.headers.location).toBe('/');
|
|
4879
4918
|
});
|
|
4880
4919
|
});
|
|
4881
|
-
`,
|
|
4920
|
+
`, na = `import { fail, message, superValidate } from 'sveltekit-superforms';
|
|
4882
4921
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4883
4922
|
import { otpSchema } from '$lib/schemas/otp';
|
|
4884
4923
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4919,7 +4958,7 @@ export const actions = {
|
|
|
4919
4958
|
redirect(303, redirectUrl);
|
|
4920
4959
|
}
|
|
4921
4960
|
};
|
|
4922
|
-
`,
|
|
4961
|
+
`, ra = `<script lang="ts">
|
|
4923
4962
|
import { untrack } from 'svelte';
|
|
4924
4963
|
import { Button } from '$lib/components/ui/button';
|
|
4925
4964
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4985,7 +5024,7 @@ export const actions = {
|
|
|
4985
5024
|
</div>
|
|
4986
5025
|
</div>
|
|
4987
5026
|
</div>
|
|
4988
|
-
`,
|
|
5027
|
+
`, aa = `import { describe, it, expect } from 'vitest';
|
|
4989
5028
|
import type { Match } from '@velastack/pocketbase';
|
|
4990
5029
|
import type { RouteId } from './$types';
|
|
4991
5030
|
|
|
@@ -5005,7 +5044,7 @@ describe('POST /otp/[token]', () => {
|
|
|
5005
5044
|
expect(response.body.status).toBe(400);
|
|
5006
5045
|
});
|
|
5007
5046
|
});
|
|
5008
|
-
`,
|
|
5047
|
+
`, oa = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
5009
5048
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
5010
5049
|
import { resetSchema } from '$lib/schemas/reset';
|
|
5011
5050
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -5033,7 +5072,7 @@ export const actions = {
|
|
|
5033
5072
|
return { form };
|
|
5034
5073
|
}
|
|
5035
5074
|
};
|
|
5036
|
-
`,
|
|
5075
|
+
`, sa = `<script lang="ts">
|
|
5037
5076
|
import { untrack } from 'svelte';
|
|
5038
5077
|
import { Button } from '$lib/components/ui/button';
|
|
5039
5078
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -5100,7 +5139,7 @@ export const actions = {
|
|
|
5100
5139
|
</div>
|
|
5101
5140
|
</div>
|
|
5102
5141
|
</div>
|
|
5103
|
-
`,
|
|
5142
|
+
`, ia = `import { describe, it, expect } from 'vitest';
|
|
5104
5143
|
import type { Match } from '@velastack/pocketbase';
|
|
5105
5144
|
import type { RouteId } from './$types';
|
|
5106
5145
|
|
|
@@ -5120,7 +5159,7 @@ describe('POST /reset', () => {
|
|
|
5120
5159
|
expect(response.body.status).toBe(200);
|
|
5121
5160
|
});
|
|
5122
5161
|
});
|
|
5123
|
-
`,
|
|
5162
|
+
`, la = `import { redirect } from '@sveltejs/kit';
|
|
5124
5163
|
import { fail, superValidate } from 'sveltekit-superforms';
|
|
5125
5164
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
5126
5165
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
@@ -5176,7 +5215,7 @@ export const actions = {
|
|
|
5176
5215
|
return redirect(303, redirectUrl);
|
|
5177
5216
|
}
|
|
5178
5217
|
};
|
|
5179
|
-
`,
|
|
5218
|
+
`, ca = `<script lang="ts">
|
|
5180
5219
|
import { untrack } from 'svelte';
|
|
5181
5220
|
import { Button } from '$lib/components/ui/button';
|
|
5182
5221
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -5343,7 +5382,7 @@ export const actions = {
|
|
|
5343
5382
|
</div>
|
|
5344
5383
|
</div>
|
|
5345
5384
|
</div>
|
|
5346
|
-
`,
|
|
5385
|
+
`, ma = `import { describe, it, expect } from 'vitest';
|
|
5347
5386
|
import type { Match } from '@velastack/pocketbase';
|
|
5348
5387
|
import * as devalue from 'devalue';
|
|
5349
5388
|
import type { RouteId } from './$types';
|
|
@@ -5399,67 +5438,67 @@ describe('POST /signup', () => {
|
|
|
5399
5438
|
expect(data.form.errors.email[0]).toBe('Value must be unique.');
|
|
5400
5439
|
});
|
|
5401
5440
|
});
|
|
5402
|
-
`,
|
|
5403
|
-
"./creates/src/lib/components/app-sidebar.svelte":
|
|
5404
|
-
"./creates/src/lib/components/nav-main.svelte":
|
|
5405
|
-
"./creates/src/lib/components/nav-user.svelte":
|
|
5406
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte":
|
|
5407
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte":
|
|
5408
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte":
|
|
5409
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte":
|
|
5410
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte":
|
|
5411
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte":
|
|
5412
|
-
"./creates/src/lib/components/ui/auth-menu/auth-menu.svelte":
|
|
5413
|
-
"./creates/src/lib/components/ui/auth-menu/context.ts":
|
|
5414
|
-
"./creates/src/lib/components/ui/auth-menu/index.ts":
|
|
5415
|
-
"./creates/src/lib/schemas/changeEmail.ts":
|
|
5416
|
-
"./creates/src/lib/schemas/changePassword.ts":
|
|
5417
|
-
"./creates/src/lib/schemas/confirmEmailChange.ts":
|
|
5418
|
-
"./creates/src/lib/schemas/confirmReset.ts":
|
|
5419
|
-
"./creates/src/lib/schemas/login.ts":
|
|
5420
|
-
"./creates/src/lib/schemas/otp.ts":
|
|
5421
|
-
"./creates/src/lib/schemas/profile.ts":
|
|
5422
|
-
"./creates/src/lib/schemas/reset.ts":
|
|
5423
|
-
"./creates/src/lib/schemas/signup.ts":
|
|
5424
|
-
"./creates/src/routes/(app)/+layout.server.ts":
|
|
5425
|
-
"./creates/src/routes/(app)/+layout.svelte":
|
|
5426
|
-
"./creates/src/routes/(app)/dashboard/+page.svelte":
|
|
5427
|
-
"./creates/src/routes/(app)/dashboard/server.test.ts":
|
|
5428
|
-
"./creates/src/routes/(app)/settings/+layout.server.ts":
|
|
5429
|
-
"./creates/src/routes/(app)/settings/+page.server.ts":
|
|
5430
|
-
"./creates/src/routes/(app)/settings/+page.svelte":
|
|
5431
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts":
|
|
5432
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte":
|
|
5433
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts":
|
|
5434
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts":
|
|
5435
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte":
|
|
5436
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts":
|
|
5437
|
-
"./creates/src/routes/(public)/confirm-verification/[token]/+server.ts":
|
|
5438
|
-
"./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts":
|
|
5439
|
-
"./creates/src/routes/(public)/login/+page.server.ts":
|
|
5440
|
-
"./creates/src/routes/(public)/login/+page.svelte":
|
|
5441
|
-
"./creates/src/routes/(public)/login/server.test.ts":
|
|
5442
|
-
"./creates/src/routes/(public)/logout/+server.ts":
|
|
5443
|
-
"./creates/src/routes/(public)/logout/server.test.ts":
|
|
5444
|
-
"./creates/src/routes/(public)/otp/[token]/+page.server.ts":
|
|
5445
|
-
"./creates/src/routes/(public)/otp/[token]/+page.svelte":
|
|
5446
|
-
"./creates/src/routes/(public)/otp/[token]/server.test.ts":
|
|
5447
|
-
"./creates/src/routes/(public)/reset/+page.server.ts":
|
|
5448
|
-
"./creates/src/routes/(public)/reset/+page.svelte":
|
|
5449
|
-
"./creates/src/routes/(public)/reset/server.test.ts":
|
|
5450
|
-
"./creates/src/routes/(public)/signup/+page.server.ts":
|
|
5451
|
-
"./creates/src/routes/(public)/signup/+page.svelte":
|
|
5452
|
-
"./creates/src/routes/(public)/signup/server.test.ts":
|
|
5453
|
-
}),
|
|
5454
|
-
async function
|
|
5455
|
-
const e = Object.entries(
|
|
5456
|
-
const
|
|
5441
|
+
`, ua = /* @__PURE__ */ Object.assign({
|
|
5442
|
+
"./creates/src/lib/components/app-sidebar.svelte": hr,
|
|
5443
|
+
"./creates/src/lib/components/nav-main.svelte": gr,
|
|
5444
|
+
"./creates/src/lib/components/nav-user.svelte": br,
|
|
5445
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte": vr,
|
|
5446
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte": wr,
|
|
5447
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte": yr,
|
|
5448
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte": xr,
|
|
5449
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte": $r,
|
|
5450
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte": Fr,
|
|
5451
|
+
"./creates/src/lib/components/ui/auth-menu/auth-menu.svelte": Cr,
|
|
5452
|
+
"./creates/src/lib/components/ui/auth-menu/context.ts": _r,
|
|
5453
|
+
"./creates/src/lib/components/ui/auth-menu/index.ts": Sr,
|
|
5454
|
+
"./creates/src/lib/schemas/changeEmail.ts": kr,
|
|
5455
|
+
"./creates/src/lib/schemas/changePassword.ts": Mr,
|
|
5456
|
+
"./creates/src/lib/schemas/confirmEmailChange.ts": Rr,
|
|
5457
|
+
"./creates/src/lib/schemas/confirmReset.ts": Pr,
|
|
5458
|
+
"./creates/src/lib/schemas/login.ts": Er,
|
|
5459
|
+
"./creates/src/lib/schemas/otp.ts": Ir,
|
|
5460
|
+
"./creates/src/lib/schemas/profile.ts": Tr,
|
|
5461
|
+
"./creates/src/lib/schemas/reset.ts": zr,
|
|
5462
|
+
"./creates/src/lib/schemas/signup.ts": Dr,
|
|
5463
|
+
"./creates/src/routes/(app)/+layout.server.ts": Ar,
|
|
5464
|
+
"./creates/src/routes/(app)/+layout.svelte": Nr,
|
|
5465
|
+
"./creates/src/routes/(app)/dashboard/+page.svelte": Br,
|
|
5466
|
+
"./creates/src/routes/(app)/dashboard/server.test.ts": jr,
|
|
5467
|
+
"./creates/src/routes/(app)/settings/+layout.server.ts": Lr,
|
|
5468
|
+
"./creates/src/routes/(app)/settings/+page.server.ts": Or,
|
|
5469
|
+
"./creates/src/routes/(app)/settings/+page.svelte": qr,
|
|
5470
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Ur,
|
|
5471
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Vr,
|
|
5472
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Hr,
|
|
5473
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": Gr,
|
|
5474
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Kr,
|
|
5475
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Wr,
|
|
5476
|
+
"./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": Xr,
|
|
5477
|
+
"./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Yr,
|
|
5478
|
+
"./creates/src/routes/(public)/login/+page.server.ts": Jr,
|
|
5479
|
+
"./creates/src/routes/(public)/login/+page.svelte": Zr,
|
|
5480
|
+
"./creates/src/routes/(public)/login/server.test.ts": Qr,
|
|
5481
|
+
"./creates/src/routes/(public)/logout/+server.ts": ta,
|
|
5482
|
+
"./creates/src/routes/(public)/logout/server.test.ts": ea,
|
|
5483
|
+
"./creates/src/routes/(public)/otp/[token]/+page.server.ts": na,
|
|
5484
|
+
"./creates/src/routes/(public)/otp/[token]/+page.svelte": ra,
|
|
5485
|
+
"./creates/src/routes/(public)/otp/[token]/server.test.ts": aa,
|
|
5486
|
+
"./creates/src/routes/(public)/reset/+page.server.ts": oa,
|
|
5487
|
+
"./creates/src/routes/(public)/reset/+page.svelte": sa,
|
|
5488
|
+
"./creates/src/routes/(public)/reset/server.test.ts": ia,
|
|
5489
|
+
"./creates/src/routes/(public)/signup/+page.server.ts": la,
|
|
5490
|
+
"./creates/src/routes/(public)/signup/+page.svelte": ca,
|
|
5491
|
+
"./creates/src/routes/(public)/signup/server.test.ts": ma
|
|
5492
|
+
}), pa = "./creates/";
|
|
5493
|
+
async function da(t) {
|
|
5494
|
+
const e = Object.entries(ua).map(([a, s]) => {
|
|
5495
|
+
const i = Dt(a, pa);
|
|
5457
5496
|
return {
|
|
5458
|
-
path:
|
|
5459
|
-
language:
|
|
5460
|
-
content:
|
|
5497
|
+
path: i,
|
|
5498
|
+
language: j(i),
|
|
5499
|
+
content: s
|
|
5461
5500
|
};
|
|
5462
|
-
}).sort((
|
|
5501
|
+
}).sort((a, s) => a.path.localeCompare(s.path)), n = [
|
|
5463
5502
|
"sidebar",
|
|
5464
5503
|
"breadcrumb",
|
|
5465
5504
|
"separator",
|
|
@@ -5483,10 +5522,68 @@ async function ra(t) {
|
|
|
5483
5522
|
deletes: [],
|
|
5484
5523
|
components: n,
|
|
5485
5524
|
packages: [],
|
|
5486
|
-
collections: [
|
|
5525
|
+
collections: [
|
|
5526
|
+
{
|
|
5527
|
+
listRule: "@request.auth.id = user.id",
|
|
5528
|
+
viewRule: "@request.auth.id = user.id",
|
|
5529
|
+
name: "oauth_accounts",
|
|
5530
|
+
type: "base",
|
|
5531
|
+
fields: [
|
|
5532
|
+
{
|
|
5533
|
+
collectionId: "_pb_users_auth_",
|
|
5534
|
+
name: "user",
|
|
5535
|
+
type: "relation",
|
|
5536
|
+
required: !0,
|
|
5537
|
+
maxSelect: 1
|
|
5538
|
+
},
|
|
5539
|
+
{
|
|
5540
|
+
name: "providerId",
|
|
5541
|
+
required: !0,
|
|
5542
|
+
type: "text"
|
|
5543
|
+
},
|
|
5544
|
+
{
|
|
5545
|
+
name: "provider",
|
|
5546
|
+
required: !0,
|
|
5547
|
+
type: "text"
|
|
5548
|
+
},
|
|
5549
|
+
{
|
|
5550
|
+
name: "accessToken",
|
|
5551
|
+
type: "text"
|
|
5552
|
+
},
|
|
5553
|
+
{
|
|
5554
|
+
name: "refreshToken",
|
|
5555
|
+
type: "text"
|
|
5556
|
+
},
|
|
5557
|
+
{
|
|
5558
|
+
name: "avatarURL",
|
|
5559
|
+
type: "text"
|
|
5560
|
+
},
|
|
5561
|
+
{
|
|
5562
|
+
name: "expiry",
|
|
5563
|
+
type: "date"
|
|
5564
|
+
},
|
|
5565
|
+
{
|
|
5566
|
+
name: "email",
|
|
5567
|
+
type: "text"
|
|
5568
|
+
},
|
|
5569
|
+
{
|
|
5570
|
+
name: "name",
|
|
5571
|
+
type: "text"
|
|
5572
|
+
},
|
|
5573
|
+
{
|
|
5574
|
+
name: "username",
|
|
5575
|
+
type: "text"
|
|
5576
|
+
},
|
|
5577
|
+
{
|
|
5578
|
+
name: "rawUser",
|
|
5579
|
+
type: "json"
|
|
5580
|
+
}
|
|
5581
|
+
]
|
|
5582
|
+
}
|
|
5583
|
+
]
|
|
5487
5584
|
};
|
|
5488
5585
|
}
|
|
5489
|
-
const
|
|
5586
|
+
const fa = `/// <reference path="../pb_data/types.d.ts" />
|
|
5490
5587
|
migrate(
|
|
5491
5588
|
(app) => {
|
|
5492
5589
|
const collection = new Collection({
|
|
@@ -5672,7 +5769,7 @@ migrate(
|
|
|
5672
5769
|
return app.delete(collection);
|
|
5673
5770
|
}
|
|
5674
5771
|
);
|
|
5675
|
-
`,
|
|
5772
|
+
`, ha = `/// <reference path="../pb_data/types.d.ts" />
|
|
5676
5773
|
migrate(
|
|
5677
5774
|
(app) => {
|
|
5678
5775
|
const collection = app.findCollectionByNameOrId('_pb_users_auth_');
|
|
@@ -5727,7 +5824,7 @@ migrate(
|
|
|
5727
5824
|
return app.save(collection);
|
|
5728
5825
|
}
|
|
5729
5826
|
);
|
|
5730
|
-
`,
|
|
5827
|
+
`, ga = `import {
|
|
5731
5828
|
POCKETBASE_URL,
|
|
5732
5829
|
POCKETBASE_SUPERUSER_EMAIL,
|
|
5733
5830
|
POCKETBASE_SUPERUSER_PASSWORD
|
|
@@ -5740,7 +5837,7 @@ export const handle = handlePocketbase({
|
|
|
5740
5837
|
superuserPassword: POCKETBASE_SUPERUSER_PASSWORD,
|
|
5741
5838
|
auth: { protectedRoutes: ['/(app)'] }
|
|
5742
5839
|
});
|
|
5743
|
-
`,
|
|
5840
|
+
`, ba = `<script lang="ts">
|
|
5744
5841
|
import { toggleMode } from 'mode-watcher';
|
|
5745
5842
|
import * as Navbar from '$lib/components/ui/navbar';
|
|
5746
5843
|
import { Button } from '$lib/components/ui/button';
|
|
@@ -5842,26 +5939,26 @@ export const handle = handlePocketbase({
|
|
|
5842
5939
|
@apply container mx-auto max-w-7xl px-4 py-8 w-full;
|
|
5843
5940
|
}
|
|
5844
5941
|
</style>
|
|
5845
|
-
`,
|
|
5942
|
+
`, va = `import { loadFlash } from "sveltekit-flash-message/server";
|
|
5846
5943
|
|
|
5847
5944
|
export const load = loadFlash(async ({ locals }) => {
|
|
5848
5945
|
return {
|
|
5849
5946
|
user: locals.pb.authStore.record,
|
|
5850
5947
|
};
|
|
5851
5948
|
});
|
|
5852
|
-
`,
|
|
5853
|
-
"./preview-modifies/migrations/1776099881_created_oauth_accounts.js":
|
|
5854
|
-
"./preview-modifies/migrations/1776099881_updated_users.js":
|
|
5855
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
5856
|
-
"./preview-modifies/src/routes/(public)/root-layout.svelte":
|
|
5857
|
-
"./preview-modifies/src/routes/+layout.server.ts":
|
|
5858
|
-
}),
|
|
5859
|
-
async function
|
|
5860
|
-
const e = Object.entries(
|
|
5861
|
-
const a =
|
|
5949
|
+
`, wa = /* @__PURE__ */ Object.assign({
|
|
5950
|
+
"./preview-modifies/migrations/1776099881_created_oauth_accounts.js": fa,
|
|
5951
|
+
"./preview-modifies/migrations/1776099881_updated_users.js": ha,
|
|
5952
|
+
"./preview-modifies/src/hooks.server.ts": ga,
|
|
5953
|
+
"./preview-modifies/src/routes/(public)/root-layout.svelte": ba,
|
|
5954
|
+
"./preview-modifies/src/routes/+layout.server.ts": va
|
|
5955
|
+
}), ya = "./preview-modifies/";
|
|
5956
|
+
async function xa(t) {
|
|
5957
|
+
const e = Object.entries(wa).map(([n, r]) => {
|
|
5958
|
+
const a = Dt(n, ya);
|
|
5862
5959
|
return {
|
|
5863
5960
|
path: a,
|
|
5864
|
-
language:
|
|
5961
|
+
language: j(a),
|
|
5865
5962
|
content: r
|
|
5866
5963
|
};
|
|
5867
5964
|
}).sort((n, r) => n.path.localeCompare(r.path));
|
|
@@ -5874,17 +5971,18 @@ async function ua(t) {
|
|
|
5874
5971
|
collections: []
|
|
5875
5972
|
};
|
|
5876
5973
|
}
|
|
5877
|
-
|
|
5878
|
-
|
|
5974
|
+
const $a = "enable-auth";
|
|
5975
|
+
async function Fa(t) {
|
|
5976
|
+
const e = await da(t);
|
|
5879
5977
|
if (t.env === "preview") {
|
|
5880
|
-
const s = await
|
|
5881
|
-
return
|
|
5978
|
+
const s = await xa();
|
|
5979
|
+
return k(pt([e, s]));
|
|
5882
5980
|
}
|
|
5883
|
-
const { generate: n } = await import("./generate.runtime-
|
|
5884
|
-
return a(
|
|
5981
|
+
const { generate: n } = await import("./generate.runtime-B5XT4Q2Z.js"), r = await n(t), { writeResult: a } = await import("./write-result-DG5OAbe1.js");
|
|
5982
|
+
return a(await k(pt([e, r])), t);
|
|
5885
5983
|
}
|
|
5886
|
-
const
|
|
5887
|
-
slug:
|
|
5984
|
+
const Ca = {
|
|
5985
|
+
slug: $a,
|
|
5888
5986
|
title: "Enable authentication",
|
|
5889
5987
|
summary: "Enables authentication.",
|
|
5890
5988
|
categories: ["authentication"],
|
|
@@ -5901,26 +5999,26 @@ const da = {
|
|
|
5901
5999
|
argv: ["enable", "auth"]
|
|
5902
6000
|
},
|
|
5903
6001
|
baseline: "velastack",
|
|
5904
|
-
generate:
|
|
5905
|
-
},
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
],
|
|
6002
|
+
generate: Fa
|
|
6003
|
+
}, te = [
|
|
6004
|
+
Rn,
|
|
6005
|
+
fr,
|
|
6006
|
+
Un,
|
|
6007
|
+
sr,
|
|
6008
|
+
Ca
|
|
6009
|
+
], _a = te.reduce(
|
|
6010
|
+
(t, e) => (t[e.slug] = e, t),
|
|
6011
|
+
{}
|
|
6012
|
+
), Ea = {
|
|
5912
6013
|
version: "0.1.0",
|
|
5913
|
-
patterns:
|
|
5914
|
-
bySlug:
|
|
5915
|
-
(t, e) => (t[e.slug] = e, t),
|
|
5916
|
-
{}
|
|
5917
|
-
)
|
|
6014
|
+
patterns: te,
|
|
6015
|
+
bySlug: _a
|
|
5918
6016
|
};
|
|
5919
6017
|
export {
|
|
5920
|
-
|
|
5921
|
-
|
|
6018
|
+
Ra as D,
|
|
6019
|
+
Pa as M,
|
|
5922
6020
|
p as d,
|
|
5923
|
-
|
|
5924
|
-
|
|
6021
|
+
Ea as i,
|
|
6022
|
+
j as l
|
|
5925
6023
|
};
|
|
5926
|
-
//# sourceMappingURL=index-
|
|
6024
|
+
//# sourceMappingURL=index-Crknwby3.js.map
|