@velastack/patterns 0.0.13 → 0.0.15
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-DgjC5QHp.js → collections-t61Ot2Ax.js} +3 -3
- package/dist/chunks/{collections-DgjC5QHp.js.map → collections-t61Ot2Ax.js.map} +1 -1
- package/dist/chunks/{env.runtime-DwuZBxzA.js → env.runtime-BTggk_Vb.js} +2 -2
- package/dist/chunks/{env.runtime-DwuZBxzA.js.map → env.runtime-BTggk_Vb.js.map} +1 -1
- package/dist/chunks/{generate.runtime-n2maauJK.js → generate.runtime-5EvPE9YS.js} +3 -3
- package/dist/chunks/{generate.runtime-n2maauJK.js.map → generate.runtime-5EvPE9YS.js.map} +1 -1
- package/dist/chunks/generate.runtime-C7g-zL0o.js +55 -0
- package/dist/chunks/generate.runtime-C7g-zL0o.js.map +1 -0
- package/dist/chunks/{index-DIeQIeIr.js → index-Dav9F9Qf.js} +834 -730
- package/dist/chunks/index-Dav9F9Qf.js.map +1 -0
- package/dist/chunks/{pocketbase-C3cbcp55.js → pocketbase-nb-YtqiX.js} +2 -2
- package/dist/chunks/{pocketbase-C3cbcp55.js.map → pocketbase-nb-YtqiX.js.map} +1 -1
- package/dist/index.d.ts +165 -122
- package/dist/index.js +5 -2
- package/package.json +1 -1
- package/dist/chunks/index-DIeQIeIr.js.map +0 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import Qt from "prettier";
|
|
2
2
|
import te from "prettier-plugin-svelte";
|
|
3
|
-
|
|
3
|
+
const ee = "0.0.14", ne = {
|
|
4
|
+
version: ee
|
|
5
|
+
};
|
|
6
|
+
function re(t) {
|
|
4
7
|
return t.language === "ts" || t.language === "svelte" || t.path.endsWith(".json");
|
|
5
8
|
}
|
|
6
|
-
async function
|
|
7
|
-
if (!
|
|
9
|
+
async function ae(t) {
|
|
10
|
+
if (!re(t))
|
|
8
11
|
return t;
|
|
9
12
|
try {
|
|
10
13
|
const e = await Qt.format(t.content, {
|
|
@@ -19,13 +22,13 @@ async function ne(t) {
|
|
|
19
22
|
return t;
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
|
-
async function
|
|
23
|
-
return Promise.all(t.map((e) =>
|
|
25
|
+
async function ut(t) {
|
|
26
|
+
return Promise.all(t.map((e) => ae(e)));
|
|
24
27
|
}
|
|
25
|
-
async function
|
|
28
|
+
async function S(t) {
|
|
26
29
|
const [e, n] = await Promise.all([
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
ut(t.creates),
|
|
31
|
+
ut(t.modifies)
|
|
29
32
|
]);
|
|
30
33
|
return {
|
|
31
34
|
...t,
|
|
@@ -33,35 +36,35 @@ async function k(t) {
|
|
|
33
36
|
modifies: n
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
|
-
function
|
|
39
|
+
function dt(t, e) {
|
|
37
40
|
var n = Object.keys(t);
|
|
38
41
|
if (Object.getOwnPropertySymbols) {
|
|
39
42
|
var r = Object.getOwnPropertySymbols(t);
|
|
40
|
-
e && (r = r.filter(function(
|
|
41
|
-
return Object.getOwnPropertyDescriptor(t,
|
|
43
|
+
e && (r = r.filter(function(a) {
|
|
44
|
+
return Object.getOwnPropertyDescriptor(t, a).enumerable;
|
|
42
45
|
})), n.push.apply(n, r);
|
|
43
46
|
}
|
|
44
47
|
return n;
|
|
45
48
|
}
|
|
46
|
-
function
|
|
49
|
+
function pt(t) {
|
|
47
50
|
for (var e = 1; e < arguments.length; e++) {
|
|
48
51
|
var n = arguments[e] != null ? arguments[e] : {};
|
|
49
|
-
e % 2 ?
|
|
50
|
-
|
|
51
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) :
|
|
52
|
+
e % 2 ? dt(Object(n), !0).forEach(function(r) {
|
|
53
|
+
oe(t, r, n[r]);
|
|
54
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : dt(Object(n)).forEach(function(r) {
|
|
52
55
|
Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
|
|
53
56
|
});
|
|
54
57
|
}
|
|
55
58
|
return t;
|
|
56
59
|
}
|
|
57
|
-
function
|
|
58
|
-
return e =
|
|
60
|
+
function oe(t, e, n) {
|
|
61
|
+
return e = se(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
|
|
59
62
|
}
|
|
60
|
-
function
|
|
61
|
-
var e =
|
|
63
|
+
function se(t) {
|
|
64
|
+
var e = ie(t, "string");
|
|
62
65
|
return typeof e == "symbol" ? e : String(e);
|
|
63
66
|
}
|
|
64
|
-
function
|
|
67
|
+
function ie(t, e) {
|
|
65
68
|
if (typeof t != "object" || t === null) return t;
|
|
66
69
|
var n = t[Symbol.toPrimitive];
|
|
67
70
|
if (n !== void 0) {
|
|
@@ -71,20 +74,20 @@ function oe(t, e) {
|
|
|
71
74
|
}
|
|
72
75
|
return (e === "string" ? String : Number)(t);
|
|
73
76
|
}
|
|
74
|
-
const d =
|
|
75
|
-
function
|
|
76
|
-
return e.withOptions = (n) =>
|
|
77
|
+
const d = It({});
|
|
78
|
+
function It(t) {
|
|
79
|
+
return e.withOptions = (n) => It(pt(pt({}, t), n)), e;
|
|
77
80
|
function e(n, ...r) {
|
|
78
|
-
const
|
|
81
|
+
const a = typeof n == "string" ? [n] : n.raw, {
|
|
79
82
|
alignValues: s = !1,
|
|
80
83
|
escapeSpecialCharacters: i = Array.isArray(n),
|
|
81
|
-
trimWhitespace:
|
|
84
|
+
trimWhitespace: o = !0
|
|
82
85
|
} = t;
|
|
83
86
|
let c = "";
|
|
84
|
-
for (let f = 0; f <
|
|
85
|
-
let h =
|
|
87
|
+
for (let f = 0; f < a.length; f++) {
|
|
88
|
+
let h = a[f];
|
|
86
89
|
if (i && (h = h.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), c += h, f < r.length) {
|
|
87
|
-
const $ = s ?
|
|
90
|
+
const $ = s ? le(r[f], c) : r[f];
|
|
88
91
|
c += $;
|
|
89
92
|
}
|
|
90
93
|
}
|
|
@@ -103,7 +106,7 @@ function zt(t) {
|
|
|
103
106
|
c = m.map((h) => h[0] === " " || h[0] === " " ? h.slice(f) : h).join(`
|
|
104
107
|
`);
|
|
105
108
|
}
|
|
106
|
-
return
|
|
109
|
+
return o && (c = c.trim()), i && (c = c.replace(/\\n/g, `
|
|
107
110
|
`).replace(/\\t/g, " ").replace(/\\r/g, "\r").replace(/\\v/g, "\v").replace(/\\b/g, "\b").replace(/\\f/g, "\f").replace(/\\0/g, "\0").replace(/\\x([\da-fA-F]{2})/g, (f, h) => String.fromCharCode(parseInt(h, 16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g, (f, h) => String.fromCodePoint(parseInt(h, 16))).replace(/\\u([\da-fA-F]{4})/g, (f, h) => String.fromCharCode(parseInt(h, 16)))), typeof Bun < "u" && (c = c.replace(
|
|
108
111
|
// Matches e.g. \\u{1f60a} or \\u5F1F
|
|
109
112
|
/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,
|
|
@@ -115,26 +118,26 @@ function zt(t) {
|
|
|
115
118
|
)), c;
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
|
-
function
|
|
121
|
+
function le(t, e) {
|
|
119
122
|
if (typeof t != "string" || !t.includes(`
|
|
120
123
|
`))
|
|
121
124
|
return t;
|
|
122
125
|
const r = e.slice(e.lastIndexOf(`
|
|
123
126
|
`) + 1).match(/^(\s+)/);
|
|
124
127
|
if (r) {
|
|
125
|
-
const
|
|
128
|
+
const a = r[1];
|
|
126
129
|
return t.replace(/\n/g, `
|
|
127
|
-
${
|
|
130
|
+
${a}`);
|
|
128
131
|
}
|
|
129
132
|
return t;
|
|
130
133
|
}
|
|
131
|
-
function
|
|
134
|
+
function G(t, e) {
|
|
132
135
|
return t.startsWith(e) ? t.slice(e.length) : t.replace(/^\.\//, "");
|
|
133
136
|
}
|
|
134
|
-
function
|
|
137
|
+
function P(t) {
|
|
135
138
|
return t.endsWith(".svelte") ? "svelte" : t.endsWith(".tsx") || t.endsWith(".ts") ? "ts" : t.endsWith(".jsx") || t.endsWith(".js") ? "js" : "text";
|
|
136
139
|
}
|
|
137
|
-
function
|
|
140
|
+
function H(t) {
|
|
138
141
|
return t.reduce(
|
|
139
142
|
(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),
|
|
140
143
|
{
|
|
@@ -147,7 +150,7 @@ function dt(t) {
|
|
|
147
150
|
}
|
|
148
151
|
);
|
|
149
152
|
}
|
|
150
|
-
const
|
|
153
|
+
const ce = {
|
|
151
154
|
text: ["form", "input"],
|
|
152
155
|
number: ["form", "input"],
|
|
153
156
|
email: ["form", "input"],
|
|
@@ -162,7 +165,7 @@ const ie = {
|
|
|
162
165
|
url: ["form", "input"],
|
|
163
166
|
editor: ["form", "textarea"],
|
|
164
167
|
autodate: ["form", "input"]
|
|
165
|
-
},
|
|
168
|
+
}, me = {
|
|
166
169
|
form: ['import * as Form from "$lib/components/ui/form";'],
|
|
167
170
|
"file-form": ['import * as FileForm from "$lib/components/ui/file-form";'],
|
|
168
171
|
multiselect: [
|
|
@@ -176,13 +179,13 @@ const ie = {
|
|
|
176
179
|
geopoint: ['import { GeopointInput } from "$lib/components/ui/geopoint";'],
|
|
177
180
|
button: ['import { Button } from "$lib/components/ui/button";']
|
|
178
181
|
};
|
|
179
|
-
function
|
|
182
|
+
function E(t) {
|
|
180
183
|
return `$formData.${t.name}`;
|
|
181
184
|
}
|
|
182
|
-
function
|
|
185
|
+
function O(t) {
|
|
183
186
|
return t.inputProps ? Object.entries(t.inputProps).flatMap(([e, n]) => n == null || n === !1 ? [] : n === !0 ? [` ${e}`] : [` ${e}=${JSON.stringify(String(n))}`]).join("") : "";
|
|
184
187
|
}
|
|
185
|
-
function
|
|
188
|
+
function I(t) {
|
|
186
189
|
return t.labelAside ? d`
|
|
187
190
|
<div class="flex justify-between">
|
|
188
191
|
<Form.Label>${t.title}</Form.Label>
|
|
@@ -190,68 +193,68 @@ function z(t) {
|
|
|
190
193
|
</div>
|
|
191
194
|
` : `<Form.Label>${t.title}</Form.Label>`;
|
|
192
195
|
}
|
|
193
|
-
function
|
|
196
|
+
function D(t, e) {
|
|
194
197
|
const n = t.required ? " required" : "";
|
|
195
198
|
return d`
|
|
196
199
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
197
200
|
<Form.Control>
|
|
198
201
|
{#snippet children({ props })}
|
|
199
|
-
${
|
|
200
|
-
<Input {...props} type="${e}" bind:value={${
|
|
202
|
+
${I(t)}
|
|
203
|
+
<Input {...props} type="${e}" bind:value={${E(t)}}${n}${O(t)} />
|
|
201
204
|
{/snippet}
|
|
202
205
|
</Form.Control>
|
|
203
206
|
<Form.FieldErrors class="contents text-destructive" />
|
|
204
207
|
</Form.Field>
|
|
205
208
|
`;
|
|
206
209
|
}
|
|
207
|
-
function
|
|
210
|
+
function ue(t) {
|
|
208
211
|
const e = t.required ? " required" : "";
|
|
209
212
|
return d`
|
|
210
213
|
<Form.Field {form} name="${t.name}" class="col-span-2">
|
|
211
214
|
<Form.Control>
|
|
212
215
|
{#snippet children({ props })}
|
|
213
|
-
${
|
|
214
|
-
<Textarea {...props} bind:value={${
|
|
216
|
+
${I(t)}
|
|
217
|
+
<Textarea {...props} bind:value={${E(t)}}${e}${O(t)} />
|
|
215
218
|
{/snippet}
|
|
216
219
|
</Form.Control>
|
|
217
220
|
<Form.FieldErrors class="contents text-destructive" />
|
|
218
221
|
</Form.Field>
|
|
219
222
|
`;
|
|
220
223
|
}
|
|
221
|
-
function
|
|
224
|
+
function de(t) {
|
|
222
225
|
const e = t.required ? " required" : "";
|
|
223
226
|
return d`
|
|
224
227
|
<Form.Field {form} name="${t.name}" class="col-span-1 flex items-start space-x-2">
|
|
225
228
|
<Form.Control>
|
|
226
229
|
{#snippet children({ props })}
|
|
227
|
-
<Checkbox {...props} bind:checked={${
|
|
228
|
-
${
|
|
230
|
+
<Checkbox {...props} bind:checked={${E(t)}}${e}${O(t)} />
|
|
231
|
+
${I(t)}
|
|
229
232
|
{/snippet}
|
|
230
233
|
</Form.Control>
|
|
231
234
|
<Form.FieldErrors class="contents text-destructive" />
|
|
232
235
|
</Form.Field>
|
|
233
236
|
`;
|
|
234
237
|
}
|
|
235
|
-
function
|
|
238
|
+
function pe(t) {
|
|
236
239
|
return d`
|
|
237
240
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
238
241
|
<Form.Control>
|
|
239
242
|
{#snippet children({ props })}
|
|
240
|
-
${
|
|
241
|
-
<GeopointInput {...props} bind:value={${
|
|
243
|
+
${I(t)}
|
|
244
|
+
<GeopointInput {...props} bind:value={${E(t)}} />
|
|
242
245
|
{/snippet}
|
|
243
246
|
</Form.Control>
|
|
244
247
|
<Form.FieldErrors class="contents text-destructive" />
|
|
245
248
|
</Form.Field>
|
|
246
249
|
`;
|
|
247
250
|
}
|
|
248
|
-
function
|
|
251
|
+
function fe(t) {
|
|
249
252
|
const e = t.required ? " required" : "", n = t.maxSelect > 1 ? "Multiple" : "Single";
|
|
250
253
|
return d`
|
|
251
254
|
<FileForm.Field {form} name="${t.name}" class="col-span-1">
|
|
252
255
|
<Form.Control>
|
|
253
256
|
{#snippet children({ props })}
|
|
254
|
-
${
|
|
257
|
+
${I(t)}
|
|
255
258
|
<FileForm.${n}>
|
|
256
259
|
{#snippet display({ file, filename, onremove })}
|
|
257
260
|
<div class="flex gap-2 justify-between items-center">
|
|
@@ -263,7 +266,7 @@ function de(t) {
|
|
|
263
266
|
</div>
|
|
264
267
|
{/snippet}
|
|
265
268
|
{#snippet input()}
|
|
266
|
-
<FileForm.Input {...props}${e}${
|
|
269
|
+
<FileForm.Input {...props}${e}${O(t)} />
|
|
267
270
|
{/snippet}
|
|
268
271
|
</FileForm.${n}>
|
|
269
272
|
{/snippet}
|
|
@@ -272,8 +275,8 @@ function de(t) {
|
|
|
272
275
|
</FileForm.Field>
|
|
273
276
|
`;
|
|
274
277
|
}
|
|
275
|
-
function
|
|
276
|
-
const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", r = t.maxSelect > 1 ? "Select options" : "Select an option",
|
|
278
|
+
function ge(t) {
|
|
279
|
+
const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", r = t.maxSelect > 1 ? "Select options" : "Select an option", a = t.options.map(
|
|
277
280
|
(s) => `<MultiSelect.Item value=${JSON.stringify(s.value)} label={${t.name}Labels[${JSON.stringify(s.value)}].label} />`
|
|
278
281
|
).join(`
|
|
279
282
|
`);
|
|
@@ -281,9 +284,9 @@ function pe(t) {
|
|
|
281
284
|
<MultiSelect.Field {form} type="${e}" name="${t.name}"${n} class="col-span-1">
|
|
282
285
|
<Form.Control>
|
|
283
286
|
{#snippet children({ props })}
|
|
284
|
-
${
|
|
287
|
+
${I(t)}
|
|
285
288
|
<MultiSelect.Trigger class="w-full justify-between">
|
|
286
|
-
<MultiSelect.Input bind:value={${
|
|
289
|
+
<MultiSelect.Input bind:value={${E(t)}} placeholder="${r}" {...props}>
|
|
287
290
|
{#snippet children({ selected })}
|
|
288
291
|
<div class="flex flex-wrap gap-1">
|
|
289
292
|
{#each selected as value}
|
|
@@ -301,7 +304,7 @@ function pe(t) {
|
|
|
301
304
|
<Command.Input autofocus placeholder="Search..." />
|
|
302
305
|
<Command.Empty>No options found</Command.Empty>
|
|
303
306
|
<Command.Group>
|
|
304
|
-
${
|
|
307
|
+
${a}
|
|
305
308
|
</Command.Group>
|
|
306
309
|
</Command.Root>
|
|
307
310
|
</MultiSelect.Content>
|
|
@@ -310,15 +313,15 @@ function pe(t) {
|
|
|
310
313
|
</MultiSelect.Field>
|
|
311
314
|
`;
|
|
312
315
|
}
|
|
313
|
-
function
|
|
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()}...`,
|
|
316
|
+
function he(t) {
|
|
317
|
+
const e = t.maxSelect > 1 ? "multiple" : "single", n = t.maxSelect > 1 ? `Select ${t.relatedModel.pluralDisplayName.toLowerCase()}` : `Select ${t.relatedModel.displayName.toLowerCase()}`, r = `Search ${t.relatedModel.pluralDisplayName.toLowerCase()}...`, a = `No ${t.relatedModel.pluralDisplayName.toLowerCase()} found`, s = t.relatedModel.name, i = t.relatedModel.pluralName;
|
|
315
318
|
return d`
|
|
316
319
|
<MultiSelect.Field {form} type="${e}" name="${t.name}" class="col-span-1">
|
|
317
320
|
<Form.Control>
|
|
318
321
|
{#snippet children({ props })}
|
|
319
322
|
<Form.Label>${t.title}</Form.Label>
|
|
320
323
|
<MultiSelect.Trigger class="w-full justify-between">
|
|
321
|
-
<MultiSelect.Input bind:value={${
|
|
324
|
+
<MultiSelect.Input bind:value={${E(t)}} placeholder="${n}" {...props}>
|
|
322
325
|
{#snippet children({ selected })}
|
|
323
326
|
<div class="flex flex-wrap gap-1">
|
|
324
327
|
{#each selected as value}
|
|
@@ -335,7 +338,7 @@ function fe(t) {
|
|
|
335
338
|
<MultiSelect.Content class="p-0">
|
|
336
339
|
<Command.Root>
|
|
337
340
|
<Command.Input autofocus placeholder="${r}" />
|
|
338
|
-
<Command.Empty>${
|
|
341
|
+
<Command.Empty>${a}</Command.Empty>
|
|
339
342
|
<Command.Group>
|
|
340
343
|
{#each data.${i} as ${s}}
|
|
341
344
|
<MultiSelect.Item value={${s}.id} label={${s}.${t.displayField}} />
|
|
@@ -348,53 +351,53 @@ function fe(t) {
|
|
|
348
351
|
</MultiSelect.Field>
|
|
349
352
|
`;
|
|
350
353
|
}
|
|
351
|
-
function
|
|
354
|
+
function be(t) {
|
|
352
355
|
return d`
|
|
353
356
|
<Form.Field {form} name="${t.name}" class="col-span-1">
|
|
354
357
|
<Form.Control>
|
|
355
358
|
{#snippet children({ props })}
|
|
356
|
-
${
|
|
357
|
-
<Input {...props} type="text" value={${
|
|
359
|
+
${I(t)}
|
|
360
|
+
<Input {...props} type="text" value={${E(t)}}${O(t)} readonly />
|
|
358
361
|
{/snippet}
|
|
359
362
|
</Form.Control>
|
|
360
363
|
<Form.FieldErrors class="contents text-destructive" />
|
|
361
364
|
</Form.Field>
|
|
362
365
|
`;
|
|
363
366
|
}
|
|
364
|
-
function
|
|
367
|
+
function rt(t) {
|
|
365
368
|
switch (t.type) {
|
|
366
369
|
case "text":
|
|
367
|
-
return
|
|
370
|
+
return D(t, "text");
|
|
368
371
|
case "number":
|
|
369
|
-
return
|
|
372
|
+
return D(t, "number");
|
|
370
373
|
case "date":
|
|
371
|
-
return
|
|
374
|
+
return D(t, "date");
|
|
372
375
|
case "email":
|
|
373
|
-
return
|
|
376
|
+
return D(t, "email");
|
|
374
377
|
case "password":
|
|
375
|
-
return
|
|
378
|
+
return D(t, "password");
|
|
376
379
|
case "url":
|
|
377
|
-
return
|
|
380
|
+
return D(t, "url");
|
|
378
381
|
case "autodate":
|
|
379
|
-
return
|
|
382
|
+
return be(t);
|
|
380
383
|
case "editor":
|
|
381
384
|
case "json":
|
|
382
|
-
return
|
|
385
|
+
return ue(t);
|
|
383
386
|
case "bool":
|
|
384
|
-
return
|
|
387
|
+
return de(t);
|
|
385
388
|
case "geoPoint":
|
|
386
|
-
return
|
|
389
|
+
return pe(t);
|
|
387
390
|
case "file":
|
|
388
|
-
return
|
|
391
|
+
return fe(t);
|
|
389
392
|
case "select":
|
|
390
|
-
return
|
|
393
|
+
return ge(t);
|
|
391
394
|
case "relation":
|
|
392
|
-
return
|
|
395
|
+
return he(t);
|
|
393
396
|
default:
|
|
394
397
|
return t;
|
|
395
398
|
}
|
|
396
399
|
}
|
|
397
|
-
function
|
|
400
|
+
function zt(t) {
|
|
398
401
|
const e = t.options.map(
|
|
399
402
|
(n) => d`
|
|
400
403
|
${JSON.stringify(n.value)}: {
|
|
@@ -410,17 +413,17 @@ function It(t) {
|
|
|
410
413
|
} as const;
|
|
411
414
|
`;
|
|
412
415
|
}
|
|
413
|
-
function
|
|
414
|
-
const e = t.flatMap((n) =>
|
|
416
|
+
function L(t) {
|
|
417
|
+
const e = t.flatMap((n) => ce[n.type]);
|
|
415
418
|
return [...new Set(e)];
|
|
416
419
|
}
|
|
417
|
-
function
|
|
418
|
-
return [...new Set(t.flatMap((e) =>
|
|
420
|
+
function at(t) {
|
|
421
|
+
return [...new Set(t.flatMap((e) => me[e]))];
|
|
419
422
|
}
|
|
420
423
|
function R(t, e) {
|
|
421
424
|
return `data.${t.name}.${e.name}`;
|
|
422
425
|
}
|
|
423
|
-
function
|
|
426
|
+
function Q(t, e, n) {
|
|
424
427
|
return d`
|
|
425
428
|
<div class="space-y-2">
|
|
426
429
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
@@ -428,8 +431,8 @@ function Y(t, e, n) {
|
|
|
428
431
|
</div>
|
|
429
432
|
`;
|
|
430
433
|
}
|
|
431
|
-
function
|
|
432
|
-
const n = R(t, e), r = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`,
|
|
434
|
+
function ve(t, e) {
|
|
435
|
+
const n = R(t, e), r = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, a = e.required ? r : d`
|
|
433
436
|
{#if ${n}}
|
|
434
437
|
${r}
|
|
435
438
|
{/if}
|
|
@@ -437,16 +440,16 @@ function he(t, e) {
|
|
|
437
440
|
return d`
|
|
438
441
|
<div class="space-y-2">
|
|
439
442
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
440
|
-
${
|
|
443
|
+
${a}
|
|
441
444
|
</div>
|
|
442
445
|
`;
|
|
443
446
|
}
|
|
444
|
-
function
|
|
447
|
+
function we(t, e) {
|
|
445
448
|
const n = R(t, e), r = d`
|
|
446
449
|
<a href={${n}} target="_blank" rel="noopener noreferrer">
|
|
447
450
|
{${n}}
|
|
448
451
|
</a>
|
|
449
|
-
`,
|
|
452
|
+
`, a = e.required ? r : d`
|
|
450
453
|
{#if ${n}}
|
|
451
454
|
${r}
|
|
452
455
|
{/if}
|
|
@@ -455,12 +458,12 @@ function be(t, e) {
|
|
|
455
458
|
<div class="space-y-2">
|
|
456
459
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
457
460
|
<p class="text-muted-foreground">
|
|
458
|
-
${
|
|
461
|
+
${a}
|
|
459
462
|
</p>
|
|
460
463
|
</div>
|
|
461
464
|
`;
|
|
462
465
|
}
|
|
463
|
-
function
|
|
466
|
+
function ye(t, e) {
|
|
464
467
|
const n = R(t, e);
|
|
465
468
|
if (e.maxSelect > 1)
|
|
466
469
|
return d`
|
|
@@ -471,7 +474,7 @@ function ve(t, e) {
|
|
|
471
474
|
{/each}
|
|
472
475
|
</div>
|
|
473
476
|
`;
|
|
474
|
-
const r = `<Badge variant="outline" class="mr-1">{${e.name}Labels[${n}].label}</Badge>`,
|
|
477
|
+
const r = `<Badge variant="outline" class="mr-1">{${e.name}Labels[${n}].label}</Badge>`, a = e.required ? r : d`
|
|
475
478
|
{#if ${n}}
|
|
476
479
|
${r}
|
|
477
480
|
{/if}
|
|
@@ -479,11 +482,11 @@ function ve(t, e) {
|
|
|
479
482
|
return d`
|
|
480
483
|
<div class="space-y-2">
|
|
481
484
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
482
|
-
${
|
|
485
|
+
${a}
|
|
483
486
|
</div>
|
|
484
487
|
`;
|
|
485
488
|
}
|
|
486
|
-
function
|
|
489
|
+
function $e(t, e) {
|
|
487
490
|
const n = R(t, e);
|
|
488
491
|
return e.maxSelect > 1 ? d`
|
|
489
492
|
<div class="space-y-2">
|
|
@@ -529,11 +532,11 @@ function we(t, e) {
|
|
|
529
532
|
</div>
|
|
530
533
|
`;
|
|
531
534
|
}
|
|
532
|
-
function
|
|
535
|
+
function xe(t) {
|
|
533
536
|
return `/${t.relatedModel.routeSegment}`;
|
|
534
537
|
}
|
|
535
|
-
function
|
|
536
|
-
const n = `data.${t.name}.expand?.${e.name}`, r =
|
|
538
|
+
function Fe(t, e) {
|
|
539
|
+
const n = `data.${t.name}.expand?.${e.name}`, r = xe(e);
|
|
537
540
|
return e.maxSelect > 1 ? d`
|
|
538
541
|
<div class="space-y-2">
|
|
539
542
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
@@ -560,7 +563,7 @@ function $e(t, e) {
|
|
|
560
563
|
</div>
|
|
561
564
|
`;
|
|
562
565
|
}
|
|
563
|
-
function
|
|
566
|
+
function Se(t, e) {
|
|
564
567
|
const n = R(t, e), r = d`
|
|
565
568
|
{#await import("$lib/components/ui/leaflet/leaflet.svelte")}
|
|
566
569
|
<div class="h-56.25 w-full bg-input rounded-md"></div>
|
|
@@ -570,7 +573,7 @@ function xe(t, e) {
|
|
|
570
573
|
<p class="text-muted-foreground">
|
|
571
574
|
{${n}?.lat.toFixed(6)}, {${n}?.lon.toFixed(6)}
|
|
572
575
|
</p>
|
|
573
|
-
`,
|
|
576
|
+
`, a = e.required ? r : d`
|
|
574
577
|
{#if ${n}}
|
|
575
578
|
${r}
|
|
576
579
|
{/if}
|
|
@@ -578,17 +581,17 @@ function xe(t, e) {
|
|
|
578
581
|
return d`
|
|
579
582
|
<div class="space-y-2">
|
|
580
583
|
<h3 class="font-medium leading-none">${e.title}</h3>
|
|
581
|
-
${
|
|
584
|
+
${a}
|
|
582
585
|
</div>
|
|
583
586
|
`;
|
|
584
587
|
}
|
|
585
|
-
function
|
|
588
|
+
function Ce(t, e) {
|
|
586
589
|
switch (e.type) {
|
|
587
590
|
case "text":
|
|
588
591
|
case "number":
|
|
589
592
|
case "email":
|
|
590
593
|
case "editor":
|
|
591
|
-
return
|
|
594
|
+
return Q(t, e, `{${R(t, e)}}`);
|
|
592
595
|
case "password":
|
|
593
596
|
return d`
|
|
594
597
|
<div class="space-y-2">
|
|
@@ -599,34 +602,34 @@ function Fe(t, e) {
|
|
|
599
602
|
</div>
|
|
600
603
|
`;
|
|
601
604
|
case "bool":
|
|
602
|
-
return
|
|
605
|
+
return Q(
|
|
603
606
|
t,
|
|
604
607
|
e,
|
|
605
608
|
`{${R(t, e)} ? "Yes" : "No"}`
|
|
606
609
|
);
|
|
607
610
|
case "date":
|
|
608
611
|
case "autodate":
|
|
609
|
-
return
|
|
612
|
+
return ve(t, e);
|
|
610
613
|
case "url":
|
|
611
|
-
return
|
|
614
|
+
return we(t, e);
|
|
612
615
|
case "select":
|
|
613
|
-
return
|
|
616
|
+
return ye(t, e);
|
|
614
617
|
case "file":
|
|
615
|
-
return
|
|
618
|
+
return $e(t, e);
|
|
616
619
|
case "json":
|
|
617
|
-
return
|
|
620
|
+
return Q(t, e, `{JSON.stringify(${R(t, e)})}`);
|
|
618
621
|
case "geoPoint":
|
|
619
|
-
return
|
|
622
|
+
return Se(t, e);
|
|
620
623
|
case "relation":
|
|
621
|
-
return
|
|
624
|
+
return Fe(t, e);
|
|
622
625
|
default:
|
|
623
626
|
return e;
|
|
624
627
|
}
|
|
625
628
|
}
|
|
626
|
-
const
|
|
627
|
-
function
|
|
629
|
+
const _e = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), ke = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), Re = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), Pe = /[^\p{L}\d]+/giu, ft = "$1\0$2", gt = "";
|
|
630
|
+
function Mt(t) {
|
|
628
631
|
let e = t.trim();
|
|
629
|
-
e = e.replace(
|
|
632
|
+
e = e.replace(_e, ft).replace(ke, ft), e = e.replace(Pe, "\0");
|
|
630
633
|
let n = 0, r = e.length;
|
|
631
634
|
for (; e.charAt(n) === "\0"; )
|
|
632
635
|
n++;
|
|
@@ -636,32 +639,32 @@ function Et(t) {
|
|
|
636
639
|
r--;
|
|
637
640
|
return e.slice(n, r).split(/\0/g);
|
|
638
641
|
}
|
|
639
|
-
function
|
|
640
|
-
const e =
|
|
642
|
+
function Ee(t) {
|
|
643
|
+
const e = Mt(t);
|
|
641
644
|
for (let n = 0; n < e.length; n++) {
|
|
642
|
-
const r = e[n],
|
|
643
|
-
if (
|
|
644
|
-
const s =
|
|
645
|
+
const r = e[n], a = Re.exec(r);
|
|
646
|
+
if (a) {
|
|
647
|
+
const s = a.index + (a[1] ?? a[2]).length;
|
|
645
648
|
e.splice(n, 1, r.slice(0, s), r.slice(s));
|
|
646
649
|
}
|
|
647
650
|
}
|
|
648
651
|
return e;
|
|
649
652
|
}
|
|
650
653
|
function Bt(t, e) {
|
|
651
|
-
const [n, r,
|
|
652
|
-
return n + r.map(
|
|
654
|
+
const [n, r, a] = J(t, e);
|
|
655
|
+
return n + r.map(W(e == null ? void 0 : e.locale)).join((e == null ? void 0 : e.delimiter) ?? " ") + a;
|
|
653
656
|
}
|
|
654
|
-
function
|
|
655
|
-
const [n, r,
|
|
656
|
-
return n + r.map((c, m) => m === 0 ? s(c) :
|
|
657
|
+
function j(t, e) {
|
|
658
|
+
const [n, r, a] = J(t, e), s = W(e == null ? void 0 : e.locale), i = st(e == null ? void 0 : e.locale), o = Dt(s, i);
|
|
659
|
+
return n + r.map((c, m) => m === 0 ? s(c) : o(c, m)).join("") + a;
|
|
657
660
|
}
|
|
658
|
-
function
|
|
659
|
-
const [n, r,
|
|
660
|
-
return n + r.map(
|
|
661
|
+
function Ie(t, e) {
|
|
662
|
+
const [n, r, a] = J(t, e), s = W(e == null ? void 0 : e.locale), i = st(e == null ? void 0 : e.locale), o = Dt(s, i);
|
|
663
|
+
return n + r.map(o).join("") + a;
|
|
661
664
|
}
|
|
662
|
-
function
|
|
663
|
-
const [n, r,
|
|
664
|
-
return n + r.map(
|
|
665
|
+
function ot(t, e) {
|
|
666
|
+
const [n, r, a] = J(t, e), s = W(e == null ? void 0 : e.locale), i = st(e == null ? void 0 : e.locale);
|
|
667
|
+
return n + r.map(Be(s, i)).join(" ") + a;
|
|
665
668
|
}
|
|
666
669
|
function ze(t, e) {
|
|
667
670
|
return Bt(t, { delimiter: "-", ...e });
|
|
@@ -669,35 +672,35 @@ function ze(t, e) {
|
|
|
669
672
|
function Me(t, e) {
|
|
670
673
|
return Bt(t, { delimiter: "_", ...e });
|
|
671
674
|
}
|
|
672
|
-
function
|
|
675
|
+
function W(t) {
|
|
673
676
|
return t === !1 ? (e) => e.toLowerCase() : (e) => e.toLocaleLowerCase(t);
|
|
674
677
|
}
|
|
675
|
-
function
|
|
678
|
+
function st(t) {
|
|
676
679
|
return (e) => e.toLocaleUpperCase(t);
|
|
677
680
|
}
|
|
678
|
-
function
|
|
681
|
+
function Be(t, e) {
|
|
679
682
|
return (n) => `${e(n[0])}${t(n.slice(1))}`;
|
|
680
683
|
}
|
|
681
684
|
function Dt(t, e) {
|
|
682
685
|
return (n, r) => {
|
|
683
|
-
const
|
|
684
|
-
return (r > 0 &&
|
|
686
|
+
const a = n[0];
|
|
687
|
+
return (r > 0 && a >= "0" && a <= "9" ? "_" + a : e(a)) + t(n.slice(1));
|
|
685
688
|
};
|
|
686
689
|
}
|
|
687
|
-
function
|
|
688
|
-
const n = e.split ?? (e.separateNumbers ?
|
|
690
|
+
function J(t, e = {}) {
|
|
691
|
+
const n = e.split ?? (e.separateNumbers ? Ee : Mt), r = e.prefixCharacters ?? gt, a = e.suffixCharacters ?? gt;
|
|
689
692
|
let s = 0, i = t.length;
|
|
690
693
|
for (; s < t.length; ) {
|
|
691
|
-
const
|
|
692
|
-
if (!r.includes(
|
|
694
|
+
const o = t.charAt(s);
|
|
695
|
+
if (!r.includes(o))
|
|
693
696
|
break;
|
|
694
697
|
s++;
|
|
695
698
|
}
|
|
696
699
|
for (; i > s; ) {
|
|
697
|
-
const
|
|
698
|
-
if (!
|
|
700
|
+
const o = i - 1, c = t.charAt(o);
|
|
701
|
+
if (!a.includes(c))
|
|
699
702
|
break;
|
|
700
|
-
i =
|
|
703
|
+
i = o;
|
|
701
704
|
}
|
|
702
705
|
return [
|
|
703
706
|
t.slice(0, s),
|
|
@@ -705,20 +708,20 @@ function G(t, e = {}) {
|
|
|
705
708
|
t.slice(i)
|
|
706
709
|
];
|
|
707
710
|
}
|
|
708
|
-
function
|
|
711
|
+
function De(t) {
|
|
709
712
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
710
713
|
}
|
|
711
|
-
function
|
|
714
|
+
function Te(t) {
|
|
712
715
|
throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
713
716
|
}
|
|
714
|
-
var U = { exports: {} },
|
|
715
|
-
function
|
|
716
|
-
return
|
|
717
|
+
var U = { exports: {} }, Ae = U.exports, ht;
|
|
718
|
+
function je() {
|
|
719
|
+
return ht || (ht = 1, (function(t, e) {
|
|
717
720
|
(function(n, r) {
|
|
718
|
-
typeof
|
|
719
|
-
})(
|
|
720
|
-
var n = [], r = [],
|
|
721
|
-
function
|
|
721
|
+
typeof Te == "function" ? t.exports = r() : n.pluralize = r();
|
|
722
|
+
})(Ae, function() {
|
|
723
|
+
var n = [], r = [], a = {}, s = {}, i = {};
|
|
724
|
+
function o(l) {
|
|
722
725
|
return typeof l == "string" ? new RegExp("^" + l + "$", "i") : l;
|
|
723
726
|
}
|
|
724
727
|
function c(l, p) {
|
|
@@ -736,7 +739,7 @@ function Te() {
|
|
|
736
739
|
});
|
|
737
740
|
}
|
|
738
741
|
function f(l, p, w) {
|
|
739
|
-
if (!l.length ||
|
|
742
|
+
if (!l.length || a.hasOwnProperty(l))
|
|
740
743
|
return p;
|
|
741
744
|
for (var x = w.length; x--; ) {
|
|
742
745
|
var F = w[x];
|
|
@@ -752,8 +755,8 @@ function Te() {
|
|
|
752
755
|
}
|
|
753
756
|
function $(l, p, w, x) {
|
|
754
757
|
return function(F) {
|
|
755
|
-
var
|
|
756
|
-
return p.hasOwnProperty(
|
|
758
|
+
var M = F.toLowerCase();
|
|
759
|
+
return p.hasOwnProperty(M) ? !0 : l.hasOwnProperty(M) ? !1 : f(M, M, w) === M;
|
|
757
760
|
};
|
|
758
761
|
}
|
|
759
762
|
function u(l, p, w) {
|
|
@@ -777,12 +780,12 @@ function Te() {
|
|
|
777
780
|
i,
|
|
778
781
|
r
|
|
779
782
|
), u.addPluralRule = function(l, p) {
|
|
780
|
-
n.push([
|
|
783
|
+
n.push([o(l), p]);
|
|
781
784
|
}, u.addSingularRule = function(l, p) {
|
|
782
|
-
r.push([
|
|
785
|
+
r.push([o(l), p]);
|
|
783
786
|
}, u.addUncountableRule = function(l) {
|
|
784
787
|
if (typeof l == "string") {
|
|
785
|
-
|
|
788
|
+
a[l.toLowerCase()] = !0;
|
|
786
789
|
return;
|
|
787
790
|
}
|
|
788
791
|
u.addPluralRule(l, "$0"), u.addSingularRule(l, "$0");
|
|
@@ -1011,8 +1014,8 @@ function Te() {
|
|
|
1011
1014
|
});
|
|
1012
1015
|
})(U)), U.exports;
|
|
1013
1016
|
}
|
|
1014
|
-
var
|
|
1015
|
-
const
|
|
1017
|
+
var Ne = je();
|
|
1018
|
+
const k = /* @__PURE__ */ De(Ne), La = "data", qa = "migrations", Oe = "(app)", Le = /* @__PURE__ */ new Set([
|
|
1016
1019
|
"break",
|
|
1017
1020
|
"case",
|
|
1018
1021
|
"catch",
|
|
@@ -1064,7 +1067,7 @@ const _ = /* @__PURE__ */ Ee(Ae), _a = "data", ka = "migrations", Ne = "(app)",
|
|
|
1064
1067
|
"async",
|
|
1065
1068
|
"arguments",
|
|
1066
1069
|
"constructor"
|
|
1067
|
-
]),
|
|
1070
|
+
]), qe = {
|
|
1068
1071
|
function: "fn",
|
|
1069
1072
|
interface: "iface",
|
|
1070
1073
|
type: "type_",
|
|
@@ -1113,33 +1116,33 @@ const _ = /* @__PURE__ */ Ee(Ae), _a = "data", ka = "migrations", Ne = "(app)",
|
|
|
1113
1116
|
arguments: "args",
|
|
1114
1117
|
constructor: "ctor"
|
|
1115
1118
|
};
|
|
1116
|
-
function
|
|
1117
|
-
return
|
|
1119
|
+
function tt(t) {
|
|
1120
|
+
return Le.has(t) ? qe[t] ?? `${t}_` : t;
|
|
1118
1121
|
}
|
|
1119
|
-
function
|
|
1122
|
+
function Z(t) {
|
|
1120
1123
|
if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(t))
|
|
1121
1124
|
throw new Error(
|
|
1122
1125
|
"Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore"
|
|
1123
1126
|
);
|
|
1124
1127
|
}
|
|
1125
|
-
function
|
|
1126
|
-
return t.features.auth ? `src/routes/${
|
|
1128
|
+
function Ve(t) {
|
|
1129
|
+
return t.features.auth ? `src/routes/${Oe}` : "src/routes";
|
|
1127
1130
|
}
|
|
1128
|
-
function
|
|
1129
|
-
const n = t.split("/"), r = n[n.length - 1],
|
|
1131
|
+
function z(t, e) {
|
|
1132
|
+
const n = t.split("/"), r = n[n.length - 1], a = n.slice(0, -1), s = k.singular(ot(r)), i = k.plural(s), o = j(s), c = ze(i), m = [...a, c].join("/");
|
|
1130
1133
|
return {
|
|
1131
|
-
name:
|
|
1132
|
-
pluralName:
|
|
1133
|
-
typeName:
|
|
1134
|
+
name: tt(o),
|
|
1135
|
+
pluralName: tt(j(i)),
|
|
1136
|
+
typeName: Ie(s),
|
|
1134
1137
|
tableName: Me(i),
|
|
1135
1138
|
displayName: s,
|
|
1136
1139
|
pluralDisplayName: i,
|
|
1137
|
-
schemaName: `${
|
|
1140
|
+
schemaName: `${tt(o)}Schema`,
|
|
1138
1141
|
routeSegment: m,
|
|
1139
|
-
routesDir:
|
|
1142
|
+
routesDir: Ve(e)
|
|
1140
1143
|
};
|
|
1141
1144
|
}
|
|
1142
|
-
function
|
|
1145
|
+
function Ue(t) {
|
|
1143
1146
|
const e = `${t.routesDir}/${t.routeSegment}`;
|
|
1144
1147
|
return {
|
|
1145
1148
|
list: e,
|
|
@@ -1148,7 +1151,7 @@ function qe(t) {
|
|
|
1148
1151
|
edit: `${e}/[id]/edit`
|
|
1149
1152
|
};
|
|
1150
1153
|
}
|
|
1151
|
-
function
|
|
1154
|
+
function He(t) {
|
|
1152
1155
|
const e = `/${t.routeSegment}`;
|
|
1153
1156
|
return {
|
|
1154
1157
|
list: e,
|
|
@@ -1157,7 +1160,7 @@ function Ve(t) {
|
|
|
1157
1160
|
edit: `${e}/[id]/edit`
|
|
1158
1161
|
};
|
|
1159
1162
|
}
|
|
1160
|
-
const
|
|
1163
|
+
const Ge = [
|
|
1161
1164
|
"title",
|
|
1162
1165
|
"name",
|
|
1163
1166
|
"label",
|
|
@@ -1191,24 +1194,24 @@ const Ue = [
|
|
|
1191
1194
|
"url",
|
|
1192
1195
|
"id"
|
|
1193
1196
|
];
|
|
1194
|
-
function
|
|
1195
|
-
for (const e of
|
|
1197
|
+
function We(t) {
|
|
1198
|
+
for (const e of Ge)
|
|
1196
1199
|
if (t.some((n) => n.name === e))
|
|
1197
1200
|
return e;
|
|
1198
1201
|
return "id";
|
|
1199
1202
|
}
|
|
1200
|
-
function
|
|
1203
|
+
function Je(t) {
|
|
1201
1204
|
return t.map((e) => e.name).filter((e) => !e.startsWith("_"));
|
|
1202
1205
|
}
|
|
1203
|
-
function
|
|
1206
|
+
function Ze(t) {
|
|
1204
1207
|
return Object.fromEntries(t.map((e) => [e.name, e.id]));
|
|
1205
1208
|
}
|
|
1206
1209
|
function Tt(t) {
|
|
1207
1210
|
return Object.fromEntries(
|
|
1208
|
-
t.map((e) => [e.name,
|
|
1211
|
+
t.map((e) => [e.name, We(e.fields)])
|
|
1209
1212
|
);
|
|
1210
1213
|
}
|
|
1211
|
-
const
|
|
1214
|
+
const Ke = [
|
|
1212
1215
|
"user",
|
|
1213
1216
|
"owner",
|
|
1214
1217
|
"created_by",
|
|
@@ -1217,10 +1220,10 @@ const Je = [
|
|
|
1217
1220
|
"account",
|
|
1218
1221
|
"creator"
|
|
1219
1222
|
];
|
|
1220
|
-
function
|
|
1223
|
+
function T(t) {
|
|
1221
1224
|
return t.toLowerCase();
|
|
1222
1225
|
}
|
|
1223
|
-
function
|
|
1226
|
+
function bt(t) {
|
|
1224
1227
|
return {
|
|
1225
1228
|
rule: '@request.auth.id != ""',
|
|
1226
1229
|
ownershipChainCollections: [t],
|
|
@@ -1228,15 +1231,15 @@ function ht(t) {
|
|
|
1228
1231
|
operator: "="
|
|
1229
1232
|
};
|
|
1230
1233
|
}
|
|
1231
|
-
function
|
|
1232
|
-
const r = new Set((n.authCollections ?? ["users"]).map(
|
|
1233
|
-
(n.userFieldHints ??
|
|
1234
|
-
), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(),
|
|
1234
|
+
function Xe(t, e, n = {}) {
|
|
1235
|
+
const r = new Set((n.authCollections ?? ["users"]).map(T)), a = new Set(
|
|
1236
|
+
(n.userFieldHints ?? Ke).map(T)
|
|
1237
|
+
), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1235
1238
|
for (const b of t)
|
|
1236
|
-
i.set(b.name, b),
|
|
1239
|
+
i.set(b.name, b), o.set(b.id, b);
|
|
1237
1240
|
if (!i.has(e))
|
|
1238
|
-
return
|
|
1239
|
-
if (r.has(
|
|
1241
|
+
return bt(e);
|
|
1242
|
+
if (r.has(T(e)))
|
|
1240
1243
|
return {
|
|
1241
1244
|
rule: "@request.auth.id = id",
|
|
1242
1245
|
ownershipChainCollections: [e],
|
|
@@ -1244,28 +1247,28 @@ function Ze(t, e, n = {}) {
|
|
|
1244
1247
|
operator: "="
|
|
1245
1248
|
};
|
|
1246
1249
|
function c(b) {
|
|
1247
|
-
const v =
|
|
1248
|
-
return v === "user" ? 50 :
|
|
1250
|
+
const v = T(b);
|
|
1251
|
+
return v === "user" ? 50 : a.has(v) ? 20 : 0;
|
|
1249
1252
|
}
|
|
1250
1253
|
function m(b) {
|
|
1251
1254
|
const v = i.get(b);
|
|
1252
1255
|
if (!(v != null && v.fields)) return [];
|
|
1253
|
-
const
|
|
1256
|
+
const C = [];
|
|
1254
1257
|
for (const y of v.fields) {
|
|
1255
1258
|
if (y.type !== "relation" || !y.collectionId) continue;
|
|
1256
|
-
const
|
|
1257
|
-
|
|
1259
|
+
const B = o.get(y.collectionId);
|
|
1260
|
+
B && C.push({
|
|
1258
1261
|
from: b,
|
|
1259
1262
|
fieldName: y.name,
|
|
1260
|
-
to:
|
|
1263
|
+
to: B.name,
|
|
1261
1264
|
isMulti: !!(y.maxSelect && y.maxSelect > 1),
|
|
1262
1265
|
hintScore: c(y.name)
|
|
1263
1266
|
});
|
|
1264
1267
|
}
|
|
1265
|
-
return
|
|
1268
|
+
return C.sort((y, B) => y.fieldName.localeCompare(B.fieldName)), C;
|
|
1266
1269
|
}
|
|
1267
1270
|
function g(b) {
|
|
1268
|
-
return r.has(
|
|
1271
|
+
return r.has(T(b));
|
|
1269
1272
|
}
|
|
1270
1273
|
function f(b) {
|
|
1271
1274
|
if (b.length === 0) return !1;
|
|
@@ -1274,41 +1277,41 @@ function Ze(t, e, n = {}) {
|
|
|
1274
1277
|
return g(b[b.length - 1].to);
|
|
1275
1278
|
}
|
|
1276
1279
|
function h(b) {
|
|
1277
|
-
const v = b[b.length - 1],
|
|
1278
|
-
return 100 * b.length + 50 *
|
|
1280
|
+
const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, B = b.reduce((Y, Yt) => Y + Yt.hintScore, 0), Xt = T(v.fieldName) === "user" ? 1 : 0;
|
|
1281
|
+
return 100 * b.length + 50 * C - 40 * Xt - 15 * y - B;
|
|
1279
1282
|
}
|
|
1280
1283
|
function $(b) {
|
|
1281
1284
|
return b.map((v) => `${v.from}.${v.fieldName}->${v.to}`).join("|");
|
|
1282
1285
|
}
|
|
1283
1286
|
const u = [], l = /* @__PURE__ */ new Set([e]);
|
|
1284
|
-
function p(b, v,
|
|
1285
|
-
if (!(
|
|
1287
|
+
function p(b, v, C) {
|
|
1288
|
+
if (!(C > s)) {
|
|
1286
1289
|
if (v.length > 0 && g(v[v.length - 1].to) && f(v)) {
|
|
1287
1290
|
u.push([...v]);
|
|
1288
1291
|
return;
|
|
1289
1292
|
}
|
|
1290
1293
|
for (const y of m(b))
|
|
1291
|
-
l.has(y.to) || y.isMulti && !g(y.to) || (l.add(y.to), v.push(y), p(y.to, v,
|
|
1294
|
+
l.has(y.to) || y.isMulti && !g(y.to) || (l.add(y.to), v.push(y), p(y.to, v, C + 1), v.pop(), l.delete(y.to));
|
|
1292
1295
|
}
|
|
1293
1296
|
}
|
|
1294
1297
|
if (p(e, [], 0), u.length === 0)
|
|
1295
|
-
return
|
|
1298
|
+
return bt(e);
|
|
1296
1299
|
u.sort((b, v) => {
|
|
1297
|
-
const
|
|
1298
|
-
return
|
|
1300
|
+
const C = h(b) - h(v);
|
|
1301
|
+
return C !== 0 ? C : $(b).localeCompare($(v));
|
|
1299
1302
|
});
|
|
1300
|
-
const w = u[0], x = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)],
|
|
1303
|
+
const w = u[0], x = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)], mt = w[w.length - 1].isMulti ? "?=" : "=", Zt = x.join("."), Kt = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
|
|
1301
1304
|
return {
|
|
1302
|
-
rule: `@request.auth.id ${
|
|
1305
|
+
rule: `@request.auth.id ${mt} ${Kt}${Zt}.id`,
|
|
1303
1306
|
ownershipChainCollections: F,
|
|
1304
1307
|
ownershipChainFields: x,
|
|
1305
|
-
operator:
|
|
1308
|
+
operator: mt
|
|
1306
1309
|
};
|
|
1307
1310
|
}
|
|
1308
|
-
function
|
|
1311
|
+
function Ye(t) {
|
|
1309
1312
|
let e = null, n = !1, r = 0;
|
|
1310
|
-
for (let
|
|
1311
|
-
const s = t[
|
|
1313
|
+
for (let a = 0; a < t.length; a++) {
|
|
1314
|
+
const s = t[a];
|
|
1312
1315
|
if (n) {
|
|
1313
1316
|
n = !1;
|
|
1314
1317
|
continue;
|
|
@@ -1334,78 +1337,78 @@ function Xe(t) {
|
|
|
1334
1337
|
continue;
|
|
1335
1338
|
}
|
|
1336
1339
|
if (s === ":" && r === 0)
|
|
1337
|
-
return [t.slice(0,
|
|
1340
|
+
return [t.slice(0, a), t.slice(a + 1)];
|
|
1338
1341
|
}
|
|
1339
1342
|
return [t, ""];
|
|
1340
1343
|
}
|
|
1341
|
-
function
|
|
1344
|
+
function vt(t) {
|
|
1342
1345
|
const e = t.trim();
|
|
1343
1346
|
return e.startsWith('"') && e.endsWith('"') || e.startsWith("'") && e.endsWith("'") ? e.slice(1, -1).replace(/\\(["'])/g, "$1") : e;
|
|
1344
1347
|
}
|
|
1345
|
-
function
|
|
1348
|
+
function wt(t) {
|
|
1346
1349
|
let e = -1, n = null, r = !1;
|
|
1347
1350
|
for (let i = 0; i < t.length; i++) {
|
|
1348
|
-
const
|
|
1351
|
+
const o = t[i];
|
|
1349
1352
|
if (r) {
|
|
1350
1353
|
r = !1;
|
|
1351
1354
|
continue;
|
|
1352
1355
|
}
|
|
1353
1356
|
if (n) {
|
|
1354
|
-
if (
|
|
1357
|
+
if (o === "\\") {
|
|
1355
1358
|
r = !0;
|
|
1356
1359
|
continue;
|
|
1357
1360
|
}
|
|
1358
|
-
|
|
1361
|
+
o === n && (n = null);
|
|
1359
1362
|
continue;
|
|
1360
1363
|
}
|
|
1361
|
-
if (
|
|
1362
|
-
n =
|
|
1364
|
+
if (o === '"' || o === "'") {
|
|
1365
|
+
n = o;
|
|
1363
1366
|
continue;
|
|
1364
1367
|
}
|
|
1365
|
-
if (
|
|
1368
|
+
if (o === ":") {
|
|
1366
1369
|
e = i;
|
|
1367
1370
|
break;
|
|
1368
1371
|
}
|
|
1369
1372
|
}
|
|
1370
|
-
let
|
|
1371
|
-
return e >= 0 ? (
|
|
1373
|
+
let a, s;
|
|
1374
|
+
return e >= 0 ? (a = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (a = t.trim(), s = a), { label: vt(s), value: vt(a) };
|
|
1372
1375
|
}
|
|
1373
|
-
function
|
|
1376
|
+
function Qe(t) {
|
|
1374
1377
|
const e = [];
|
|
1375
|
-
let n = "", r = null,
|
|
1378
|
+
let n = "", r = null, a = !1;
|
|
1376
1379
|
for (let i = 0; i < t.length; i++) {
|
|
1377
|
-
const
|
|
1378
|
-
if (
|
|
1379
|
-
n +=
|
|
1380
|
+
const o = t[i];
|
|
1381
|
+
if (a) {
|
|
1382
|
+
n += o, a = !1;
|
|
1380
1383
|
continue;
|
|
1381
1384
|
}
|
|
1382
1385
|
if (r) {
|
|
1383
|
-
if (
|
|
1384
|
-
|
|
1386
|
+
if (o === "\\") {
|
|
1387
|
+
a = !0, n += o;
|
|
1385
1388
|
continue;
|
|
1386
1389
|
}
|
|
1387
|
-
if (
|
|
1388
|
-
r = null, n +=
|
|
1390
|
+
if (o === r) {
|
|
1391
|
+
r = null, n += o;
|
|
1389
1392
|
continue;
|
|
1390
1393
|
}
|
|
1391
|
-
n +=
|
|
1394
|
+
n += o;
|
|
1392
1395
|
continue;
|
|
1393
1396
|
}
|
|
1394
|
-
if (
|
|
1395
|
-
r =
|
|
1397
|
+
if (o === '"' || o === "'") {
|
|
1398
|
+
r = o, n += o;
|
|
1396
1399
|
continue;
|
|
1397
1400
|
}
|
|
1398
|
-
if (
|
|
1401
|
+
if (o === ",") {
|
|
1399
1402
|
const c = n.trim();
|
|
1400
|
-
c.length > 0 && e.push(
|
|
1403
|
+
c.length > 0 && e.push(wt(c)), n = "";
|
|
1401
1404
|
continue;
|
|
1402
1405
|
}
|
|
1403
|
-
n +=
|
|
1406
|
+
n += o;
|
|
1404
1407
|
}
|
|
1405
1408
|
const s = n.trim();
|
|
1406
|
-
return s.length > 0 && e.push(
|
|
1409
|
+
return s.length > 0 && e.push(wt(s)), e;
|
|
1407
1410
|
}
|
|
1408
|
-
const
|
|
1411
|
+
const yt = {
|
|
1409
1412
|
string: "text",
|
|
1410
1413
|
boolean: "bool",
|
|
1411
1414
|
geopoint: "geoPoint",
|
|
@@ -1418,50 +1421,50 @@ const wt = {
|
|
|
1418
1421
|
datetime: "date",
|
|
1419
1422
|
timestamp: "date"
|
|
1420
1423
|
};
|
|
1421
|
-
function
|
|
1424
|
+
function tn(t) {
|
|
1422
1425
|
const e = t.endsWith("!");
|
|
1423
1426
|
let n = e ? t.slice(0, -1) : t, r = [];
|
|
1424
1427
|
if (n.startsWith("select(") && n.endsWith(")")) {
|
|
1425
|
-
const
|
|
1426
|
-
r =
|
|
1428
|
+
const a = n.slice(7, -1);
|
|
1429
|
+
r = Qe(a), n = "select";
|
|
1427
1430
|
}
|
|
1428
|
-
return n === "files" ? { type: "file", required: e, selectOptions: r } : (n in
|
|
1431
|
+
return n === "files" ? { type: "file", required: e, selectOptions: r } : (n in yt && (n = yt[n]), { type: n, required: e, selectOptions: r });
|
|
1429
1432
|
}
|
|
1430
|
-
function
|
|
1431
|
-
const e =
|
|
1433
|
+
function $t(t) {
|
|
1434
|
+
const e = k.singular(t), n = k.plural(e);
|
|
1432
1435
|
return t === n ? 99 : 1;
|
|
1433
1436
|
}
|
|
1434
|
-
function q(t, e, n, r,
|
|
1435
|
-
const i =
|
|
1437
|
+
function q(t, e, n, r, a, s) {
|
|
1438
|
+
const i = z(e, s), o = k.singular(t), c = k.plural(o);
|
|
1436
1439
|
return {
|
|
1437
1440
|
collectionId: r[e],
|
|
1438
|
-
displayField:
|
|
1441
|
+
displayField: a[e] ?? "id",
|
|
1439
1442
|
relatedModel: i,
|
|
1440
|
-
singularRelationName:
|
|
1443
|
+
singularRelationName: j(
|
|
1441
1444
|
`${n.displayName} ${i.displayName}`
|
|
1442
1445
|
),
|
|
1443
|
-
pluralRelationName:
|
|
1446
|
+
pluralRelationName: j(
|
|
1444
1447
|
`${n.displayName} ${i.pluralDisplayName}`
|
|
1445
1448
|
),
|
|
1446
1449
|
maxSelect: t === c ? 999 : 1
|
|
1447
1450
|
};
|
|
1448
1451
|
}
|
|
1449
|
-
function
|
|
1450
|
-
const s =
|
|
1451
|
-
if (
|
|
1452
|
+
function en(t, e, n, r, a) {
|
|
1453
|
+
const s = ot(t), { type: i, required: o, selectOptions: c } = e, m = Je(r), g = Ze(r), f = Tt(r), h = m.map((u) => k.singular(u));
|
|
1454
|
+
if (a.features.auth && i === "current_user" && g.users) {
|
|
1452
1455
|
const u = q(
|
|
1453
1456
|
t,
|
|
1454
1457
|
"users",
|
|
1455
1458
|
n,
|
|
1456
1459
|
g,
|
|
1457
1460
|
f,
|
|
1458
|
-
|
|
1461
|
+
a
|
|
1459
1462
|
);
|
|
1460
1463
|
return {
|
|
1461
1464
|
type: "relation",
|
|
1462
1465
|
name: t,
|
|
1463
1466
|
title: s,
|
|
1464
|
-
required:
|
|
1467
|
+
required: o,
|
|
1465
1468
|
collectionId: u.collectionId,
|
|
1466
1469
|
maxSelect: 1,
|
|
1467
1470
|
displayField: u.displayField,
|
|
@@ -1477,15 +1480,15 @@ function Qe(t, e, n, r, o) {
|
|
|
1477
1480
|
throw new Error(
|
|
1478
1481
|
`Invalid autodate field: ${t}. Must be one of created/created_at/updated/updated_at.`
|
|
1479
1482
|
);
|
|
1480
|
-
return { type: "autodate", name: t, title: s, required:
|
|
1483
|
+
return { type: "autodate", name: t, title: s, required: o, onCreate: u, onUpdate: l };
|
|
1481
1484
|
}
|
|
1482
1485
|
if (i === "select")
|
|
1483
1486
|
return {
|
|
1484
1487
|
type: "select",
|
|
1485
1488
|
name: t,
|
|
1486
1489
|
title: s,
|
|
1487
|
-
required:
|
|
1488
|
-
maxSelect:
|
|
1490
|
+
required: o,
|
|
1491
|
+
maxSelect: $t(t),
|
|
1489
1492
|
options: c
|
|
1490
1493
|
};
|
|
1491
1494
|
if (i === "file")
|
|
@@ -1493,11 +1496,11 @@ function Qe(t, e, n, r, o) {
|
|
|
1493
1496
|
type: "file",
|
|
1494
1497
|
name: t,
|
|
1495
1498
|
title: s,
|
|
1496
|
-
required:
|
|
1497
|
-
maxSelect:
|
|
1499
|
+
required: o,
|
|
1500
|
+
maxSelect: $t(t)
|
|
1498
1501
|
};
|
|
1499
1502
|
if (i === "relation") {
|
|
1500
|
-
const u =
|
|
1503
|
+
const u = k.singular(t), l = k.plural(u);
|
|
1501
1504
|
if (!m.includes(l))
|
|
1502
1505
|
throw new Error(
|
|
1503
1506
|
`Invalid relation field: ${t}. Must be one of ${m.join(", ")} (singular or plural)`
|
|
@@ -1508,13 +1511,13 @@ function Qe(t, e, n, r, o) {
|
|
|
1508
1511
|
n,
|
|
1509
1512
|
g,
|
|
1510
1513
|
f,
|
|
1511
|
-
|
|
1514
|
+
a
|
|
1512
1515
|
);
|
|
1513
1516
|
return {
|
|
1514
1517
|
type: "relation",
|
|
1515
1518
|
name: t,
|
|
1516
1519
|
title: s,
|
|
1517
|
-
required:
|
|
1520
|
+
required: o,
|
|
1518
1521
|
...p,
|
|
1519
1522
|
isCurrentUser: !1
|
|
1520
1523
|
};
|
|
@@ -1526,19 +1529,19 @@ function Qe(t, e, n, r, o) {
|
|
|
1526
1529
|
n,
|
|
1527
1530
|
g,
|
|
1528
1531
|
f,
|
|
1529
|
-
|
|
1532
|
+
a
|
|
1530
1533
|
);
|
|
1531
1534
|
return {
|
|
1532
1535
|
type: "relation",
|
|
1533
1536
|
name: t,
|
|
1534
1537
|
title: s,
|
|
1535
|
-
required:
|
|
1538
|
+
required: o,
|
|
1536
1539
|
...u,
|
|
1537
1540
|
isCurrentUser: !1
|
|
1538
1541
|
};
|
|
1539
1542
|
}
|
|
1540
1543
|
if (h.includes(i)) {
|
|
1541
|
-
const u =
|
|
1544
|
+
const u = k.plural(i);
|
|
1542
1545
|
if (m.includes(u)) {
|
|
1543
1546
|
const l = q(
|
|
1544
1547
|
t,
|
|
@@ -1546,13 +1549,13 @@ function Qe(t, e, n, r, o) {
|
|
|
1546
1549
|
n,
|
|
1547
1550
|
g,
|
|
1548
1551
|
f,
|
|
1549
|
-
|
|
1552
|
+
a
|
|
1550
1553
|
);
|
|
1551
1554
|
return {
|
|
1552
1555
|
type: "relation",
|
|
1553
1556
|
name: t,
|
|
1554
1557
|
title: s,
|
|
1555
|
-
required:
|
|
1558
|
+
required: o,
|
|
1556
1559
|
collectionId: l.collectionId,
|
|
1557
1560
|
displayField: l.displayField,
|
|
1558
1561
|
relatedModel: l.relatedModel,
|
|
@@ -1579,7 +1582,7 @@ function Qe(t, e, n, r, o) {
|
|
|
1579
1582
|
"select",
|
|
1580
1583
|
"file",
|
|
1581
1584
|
"relation",
|
|
1582
|
-
...
|
|
1585
|
+
...a.features.auth ? ["current_user"] : [],
|
|
1583
1586
|
...m
|
|
1584
1587
|
])
|
|
1585
1588
|
];
|
|
@@ -1598,31 +1601,31 @@ function Qe(t, e, n, r, o) {
|
|
|
1598
1601
|
throw new Error(
|
|
1599
1602
|
`Invalid field type: ${i}. Valid types are: ${$.join(", ").replace("relation", "references")}`
|
|
1600
1603
|
);
|
|
1601
|
-
return { type: i, name: t, title: s, required:
|
|
1604
|
+
return { type: i, name: t, title: s, required: o };
|
|
1602
1605
|
}
|
|
1603
|
-
function
|
|
1604
|
-
const
|
|
1606
|
+
function nn(t, e, n, r) {
|
|
1607
|
+
const a = [];
|
|
1605
1608
|
for (const i of t) {
|
|
1606
|
-
const [
|
|
1607
|
-
if (!
|
|
1609
|
+
const [o, c] = Ye(i);
|
|
1610
|
+
if (!o || !c)
|
|
1608
1611
|
throw new Error(
|
|
1609
1612
|
`Invalid field format: ${i}. Expected format: name:type or name:type!`
|
|
1610
1613
|
);
|
|
1611
|
-
if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(
|
|
1614
|
+
if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(o))
|
|
1612
1615
|
throw new Error(
|
|
1613
|
-
`Invalid field name: ${
|
|
1616
|
+
`Invalid field name: ${o}. Must start with a letter and contain only alphanumeric characters`
|
|
1614
1617
|
);
|
|
1615
|
-
const m =
|
|
1616
|
-
|
|
1618
|
+
const m = tn(c);
|
|
1619
|
+
a.push(en(o, m, e, n, r));
|
|
1617
1620
|
}
|
|
1618
|
-
const s = r.features.auth ?
|
|
1621
|
+
const s = r.features.auth ? Xe(
|
|
1619
1622
|
[
|
|
1620
1623
|
...n,
|
|
1621
1624
|
{
|
|
1622
1625
|
id: "new",
|
|
1623
1626
|
name: e.tableName,
|
|
1624
1627
|
type: "base",
|
|
1625
|
-
fields:
|
|
1628
|
+
fields: a.map((i) => ({
|
|
1626
1629
|
name: i.name,
|
|
1627
1630
|
type: i.type,
|
|
1628
1631
|
collectionId: i.type === "relation" ? i.collectionId : void 0,
|
|
@@ -1632,34 +1635,34 @@ function tn(t, e, n, r) {
|
|
|
1632
1635
|
],
|
|
1633
1636
|
e.tableName
|
|
1634
1637
|
) : void 0;
|
|
1635
|
-
return { fields:
|
|
1638
|
+
return { fields: a, auth: s };
|
|
1636
1639
|
}
|
|
1637
|
-
async function
|
|
1640
|
+
async function K(t, e, n) {
|
|
1638
1641
|
let r;
|
|
1639
1642
|
if (n.env === "runtime") {
|
|
1640
|
-
const { getCollections:
|
|
1641
|
-
r = await
|
|
1643
|
+
const { getCollections: a } = await import("./env.runtime-BTggk_Vb.js");
|
|
1644
|
+
r = await a();
|
|
1642
1645
|
} else {
|
|
1643
|
-
const { getPreviewCollections:
|
|
1644
|
-
r =
|
|
1646
|
+
const { getPreviewCollections: a } = await import("./env.preview-HlXZOEL4.js");
|
|
1647
|
+
r = a(n);
|
|
1645
1648
|
}
|
|
1646
|
-
return
|
|
1649
|
+
return nn(t, e, r, n);
|
|
1647
1650
|
}
|
|
1648
|
-
const
|
|
1651
|
+
const rn = "2024-01-01T00:00:00.000Z";
|
|
1649
1652
|
class N {
|
|
1650
1653
|
constructor(e) {
|
|
1651
1654
|
this.expression = e;
|
|
1652
1655
|
}
|
|
1653
1656
|
}
|
|
1654
|
-
function
|
|
1655
|
-
return t instanceof N ? t.expression : Array.isArray(t) ? `[${t.map((e) =>
|
|
1657
|
+
function nt(t) {
|
|
1658
|
+
return t instanceof N ? t.expression : Array.isArray(t) ? `[${t.map((e) => nt(e)).join(", ")}]` : t && typeof t == "object" ? `{ ${Object.entries(t).map(([n, r]) => `${JSON.stringify(n)}: ${nt(r)}`).join(", ")} }` : JSON.stringify(t);
|
|
1656
1659
|
}
|
|
1657
|
-
function
|
|
1660
|
+
function et(t) {
|
|
1658
1661
|
return `{ ${Object.entries(t).map(
|
|
1659
|
-
([n, r]) => `${JSON.stringify(n)}: ${
|
|
1662
|
+
([n, r]) => `${JSON.stringify(n)}: ${nt(r)}`
|
|
1660
1663
|
).join(", ")} }`;
|
|
1661
1664
|
}
|
|
1662
|
-
function
|
|
1665
|
+
function an(t) {
|
|
1663
1666
|
switch (t) {
|
|
1664
1667
|
case "text":
|
|
1665
1668
|
case "number":
|
|
@@ -1695,11 +1698,11 @@ function nn(t) {
|
|
|
1695
1698
|
return;
|
|
1696
1699
|
}
|
|
1697
1700
|
}
|
|
1698
|
-
function
|
|
1701
|
+
function A(t, e) {
|
|
1699
1702
|
return t.replace("[id]", `\${${e}}`);
|
|
1700
1703
|
}
|
|
1701
1704
|
function At(t, e, n) {
|
|
1702
|
-
var r,
|
|
1705
|
+
var r, a, s;
|
|
1703
1706
|
switch (t.type) {
|
|
1704
1707
|
case "text":
|
|
1705
1708
|
case "editor":
|
|
@@ -1709,7 +1712,7 @@ function At(t, e, n) {
|
|
|
1709
1712
|
case "bool":
|
|
1710
1713
|
return !0;
|
|
1711
1714
|
case "date":
|
|
1712
|
-
return
|
|
1715
|
+
return rn;
|
|
1713
1716
|
case "email":
|
|
1714
1717
|
return `test-${t.name}@example.com`;
|
|
1715
1718
|
case "password":
|
|
@@ -1721,7 +1724,7 @@ function At(t, e, n) {
|
|
|
1721
1724
|
case "geoPoint":
|
|
1722
1725
|
return n.forForm ? JSON.stringify({ lat: 40.7128, lon: -74.006 }) : { lat: 40.7128, lon: -74.006 };
|
|
1723
1726
|
case "select": {
|
|
1724
|
-
const i = ((
|
|
1727
|
+
const i = ((a = (r = t.options) == null ? void 0 : r[0]) == null ? void 0 : a.value) ?? "default";
|
|
1725
1728
|
return t.maxSelect && t.maxSelect > 1 ? [i] : i;
|
|
1726
1729
|
}
|
|
1727
1730
|
case "relation": {
|
|
@@ -1737,71 +1740,71 @@ function At(t, e, n) {
|
|
|
1737
1740
|
return;
|
|
1738
1741
|
}
|
|
1739
1742
|
}
|
|
1740
|
-
function
|
|
1743
|
+
function xt(t, e, n) {
|
|
1741
1744
|
const r = {};
|
|
1742
|
-
for (const
|
|
1743
|
-
if (
|
|
1745
|
+
for (const a of t) {
|
|
1746
|
+
if (a.type === "file" || a.type === "autodate")
|
|
1744
1747
|
continue;
|
|
1745
|
-
if (n.authEnabled &&
|
|
1746
|
-
n.forForm || (r[
|
|
1748
|
+
if (n.authEnabled && a.type === "relation" && a.isCurrentUser) {
|
|
1749
|
+
n.forForm || (r[a.name] = new N("context.user.id"));
|
|
1747
1750
|
continue;
|
|
1748
1751
|
}
|
|
1749
|
-
const s = At(
|
|
1750
|
-
s !== void 0 && (r[
|
|
1752
|
+
const s = At(a, e, n);
|
|
1753
|
+
s !== void 0 && (r[a.name] = s);
|
|
1751
1754
|
}
|
|
1752
1755
|
return r;
|
|
1753
1756
|
}
|
|
1754
|
-
function
|
|
1755
|
-
var
|
|
1757
|
+
function on(t, e, n) {
|
|
1758
|
+
var a;
|
|
1756
1759
|
const r = {};
|
|
1757
1760
|
for (const s of t) {
|
|
1758
1761
|
if (s.system || s.name === "id")
|
|
1759
1762
|
continue;
|
|
1760
|
-
const i =
|
|
1763
|
+
const i = an(s.type);
|
|
1761
1764
|
if (!i || i === "file" || i === "autodate" || i === "relation" && !s.collectionId)
|
|
1762
1765
|
continue;
|
|
1763
|
-
let
|
|
1766
|
+
let o;
|
|
1764
1767
|
if (i === "relation")
|
|
1765
|
-
|
|
1768
|
+
o = s.collectionId ? new N(
|
|
1766
1769
|
e[s.collectionId] ?? '"missing-relation-id"'
|
|
1767
1770
|
) : void 0;
|
|
1768
1771
|
else if (i === "select") {
|
|
1769
|
-
const c = ((
|
|
1770
|
-
|
|
1772
|
+
const c = ((a = s.values) == null ? void 0 : a[0]) ?? "default";
|
|
1773
|
+
o = (s.maxSelect ?? 1) > 1 ? [c] : c;
|
|
1771
1774
|
} else
|
|
1772
|
-
|
|
1775
|
+
o = At(
|
|
1773
1776
|
{ name: s.name, type: i },
|
|
1774
1777
|
e,
|
|
1775
1778
|
{ forForm: !1, authEnabled: n.features.auth }
|
|
1776
1779
|
);
|
|
1777
|
-
|
|
1780
|
+
o !== void 0 && (r[s.name] = o);
|
|
1778
1781
|
}
|
|
1779
1782
|
return r;
|
|
1780
1783
|
}
|
|
1781
|
-
function
|
|
1784
|
+
function sn(t) {
|
|
1782
1785
|
t.email = new N(
|
|
1783
1786
|
"`test-${Math.random().toString(36).slice(2)}@example.com`"
|
|
1784
1787
|
), t.password = "password", t.passwordConfirm = "password";
|
|
1785
1788
|
}
|
|
1786
|
-
function
|
|
1789
|
+
function ln(t, e) {
|
|
1787
1790
|
if (!t)
|
|
1788
1791
|
return [];
|
|
1789
|
-
const n = new Map(e.map((
|
|
1790
|
-
if (r.has(
|
|
1792
|
+
const n = new Map(e.map((o) => [o.id, o])), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = [], i = (o) => {
|
|
1793
|
+
if (r.has(o) || a.has(o))
|
|
1791
1794
|
return;
|
|
1792
|
-
const c = n.get(
|
|
1795
|
+
const c = n.get(o);
|
|
1793
1796
|
if (c) {
|
|
1794
|
-
|
|
1797
|
+
a.add(o);
|
|
1795
1798
|
for (const m of c.fields)
|
|
1796
1799
|
m.type !== "relation" || !m.collectionId || i(m.collectionId);
|
|
1797
|
-
|
|
1800
|
+
a.delete(o), r.add(o), s.push(c);
|
|
1798
1801
|
}
|
|
1799
1802
|
};
|
|
1800
|
-
for (const
|
|
1801
|
-
|
|
1803
|
+
for (const o of t.fields)
|
|
1804
|
+
o.type !== "relation" || !o.collectionId || i(o.collectionId);
|
|
1802
1805
|
return s;
|
|
1803
1806
|
}
|
|
1804
|
-
function
|
|
1807
|
+
function cn(t, e) {
|
|
1805
1808
|
if (!e.has(t))
|
|
1806
1809
|
return e.add(t), t;
|
|
1807
1810
|
let n = 2;
|
|
@@ -1810,7 +1813,7 @@ function sn(t, e) {
|
|
|
1810
1813
|
const r = `${t}${n}`;
|
|
1811
1814
|
return e.add(r), r;
|
|
1812
1815
|
}
|
|
1813
|
-
function
|
|
1816
|
+
function mn(t, e) {
|
|
1814
1817
|
return {
|
|
1815
1818
|
id: `generated-${t.tableName}`,
|
|
1816
1819
|
name: t.tableName,
|
|
@@ -1832,25 +1835,25 @@ function ln(t, e) {
|
|
|
1832
1835
|
} : { name: n.name, type: n.type })
|
|
1833
1836
|
};
|
|
1834
1837
|
}
|
|
1835
|
-
function
|
|
1836
|
-
const
|
|
1838
|
+
function jt(t, e, n, r) {
|
|
1839
|
+
const a = r.find((l) => l.name === t.tableName) ?? mn(t, e), s = ln(a, r).filter(
|
|
1837
1840
|
(l) => !(n.features.auth && l.name === "users")
|
|
1838
|
-
), i = {},
|
|
1841
|
+
), i = {}, o = [], c = /* @__PURE__ */ new Set();
|
|
1839
1842
|
for (const l of s) {
|
|
1840
|
-
const p =
|
|
1841
|
-
|
|
1843
|
+
const p = cn(z(l.name, n).name, c);
|
|
1844
|
+
o.push({ varName: p, collection: l }), i[l.id] = `${p}.id`;
|
|
1842
1845
|
}
|
|
1843
|
-
const m =
|
|
1846
|
+
const m = o.length ? `${o.map((l) => `let ${l.varName}: { id: string };`).join(`
|
|
1844
1847
|
`)}
|
|
1845
1848
|
|
|
1846
|
-
` : "", g =
|
|
1847
|
-
const w =
|
|
1849
|
+
` : "", g = o.map(({ varName: l, collection: p }) => {
|
|
1850
|
+
const w = on(
|
|
1848
1851
|
p.fields,
|
|
1849
1852
|
i,
|
|
1850
1853
|
n
|
|
1851
1854
|
);
|
|
1852
|
-
return p.type === "auth" &&
|
|
1853
|
-
}), f =
|
|
1855
|
+
return p.type === "auth" && sn(w), `${l} = await context.admin.collection("${p.name}").create(${et(w)});`;
|
|
1856
|
+
}), f = o.slice().reverse().map(
|
|
1854
1857
|
({ varName: l, collection: p }) => `await context.admin.collection("${p.name}").delete(${l}.id);`
|
|
1855
1858
|
), h = n.features.auth ? "context.agent" : "context.request", $ = n.features.auth ? `await context.agent.authenticateUser();
|
|
1856
1859
|
` : "";
|
|
@@ -1871,22 +1874,22 @@ function Nt(t, e, n, r) {
|
|
|
1871
1874
|
declarations: m,
|
|
1872
1875
|
setupSection: u,
|
|
1873
1876
|
requestAgent: h,
|
|
1874
|
-
modelDbData:
|
|
1875
|
-
|
|
1877
|
+
modelDbData: et(
|
|
1878
|
+
xt(e, i, {
|
|
1876
1879
|
forForm: !1,
|
|
1877
1880
|
authEnabled: n.features.auth
|
|
1878
1881
|
})
|
|
1879
1882
|
),
|
|
1880
|
-
modelFormData:
|
|
1881
|
-
|
|
1883
|
+
modelFormData: et(
|
|
1884
|
+
xt(e, i, {
|
|
1882
1885
|
forForm: !0,
|
|
1883
1886
|
authEnabled: n.features.auth
|
|
1884
1887
|
})
|
|
1885
1888
|
)
|
|
1886
1889
|
};
|
|
1887
1890
|
}
|
|
1888
|
-
function
|
|
1889
|
-
const { declarations: s, setupSection: i, requestAgent:
|
|
1891
|
+
function un(t, e, n, r, a) {
|
|
1892
|
+
const { declarations: s, setupSection: i, requestAgent: o, modelDbData: c, modelFormData: m } = jt(t, n, r, a);
|
|
1890
1893
|
return d`
|
|
1891
1894
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
1892
1895
|
|
|
@@ -1895,24 +1898,24 @@ function cn(t, e, n, r, o) {
|
|
|
1895
1898
|
|
|
1896
1899
|
describe("GET ${e.list}", () => {
|
|
1897
1900
|
it("should return a 200 status code", async (context) => {
|
|
1898
|
-
const response = await ${
|
|
1901
|
+
const response = await ${o}.get("${e.list}");
|
|
1899
1902
|
expect(response.status).toBe(200);
|
|
1900
1903
|
});
|
|
1901
1904
|
});
|
|
1902
1905
|
|
|
1903
1906
|
describe("GET ${e.new}", () => {
|
|
1904
1907
|
it("should return a 200 status code", async (context) => {
|
|
1905
|
-
const response = await ${
|
|
1908
|
+
const response = await ${o}.get("${e.new}");
|
|
1906
1909
|
expect(response.status).toBe(200);
|
|
1907
1910
|
});
|
|
1908
1911
|
});
|
|
1909
1912
|
|
|
1910
1913
|
describe("POST ${e.new}", () => {
|
|
1911
1914
|
it("should create a new ${t.displayName.toLowerCase()}", async (context) => {
|
|
1912
|
-
const response = await ${
|
|
1915
|
+
const response = await ${o}.post("${e.new}").type("form").send(${m});
|
|
1913
1916
|
expect(response.body.status).toBe(303);
|
|
1914
1917
|
|
|
1915
|
-
const response2 = await ${
|
|
1918
|
+
const response2 = await ${o}.get(response.body.location);
|
|
1916
1919
|
expect(response2.status).toBe(200);
|
|
1917
1920
|
});
|
|
1918
1921
|
});
|
|
@@ -1920,12 +1923,12 @@ function cn(t, e, n, r, o) {
|
|
|
1920
1923
|
describe("GET ${e.show}", () => {
|
|
1921
1924
|
it("should return a 200 status code", async (context) => {
|
|
1922
1925
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1923
|
-
const response = await ${
|
|
1926
|
+
const response = await ${o}.get(\`${A(e.show, "id")}\`);
|
|
1924
1927
|
expect(response.status).toBe(200);
|
|
1925
1928
|
});
|
|
1926
1929
|
|
|
1927
1930
|
it("should return a 404 status code", async (context) => {
|
|
1928
|
-
const response = await ${
|
|
1931
|
+
const response = await ${o}.get("${e.show.replace("[id]", "non-existent")}");
|
|
1929
1932
|
expect(response.status).toBe(404);
|
|
1930
1933
|
});
|
|
1931
1934
|
});
|
|
@@ -1933,10 +1936,10 @@ function cn(t, e, n, r, o) {
|
|
|
1933
1936
|
describe("POST ${e.show}", () => {
|
|
1934
1937
|
it("should delete a ${t.displayName.toLowerCase()}", async (context) => {
|
|
1935
1938
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1936
|
-
const response = await ${
|
|
1939
|
+
const response = await ${o}.post(\`${A(e.show, "id")}\`).type("form");
|
|
1937
1940
|
expect(response.body.status).toBe(303);
|
|
1938
1941
|
|
|
1939
|
-
const response2 = await ${
|
|
1942
|
+
const response2 = await ${o}.get(\`${A(e.show, "id")}\`);
|
|
1940
1943
|
expect(response2.status).toBe(404);
|
|
1941
1944
|
});
|
|
1942
1945
|
});
|
|
@@ -1944,7 +1947,7 @@ function cn(t, e, n, r, o) {
|
|
|
1944
1947
|
describe("GET ${e.edit}", () => {
|
|
1945
1948
|
it("should return a 200 status code", async (context) => {
|
|
1946
1949
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1947
|
-
const response = await ${
|
|
1950
|
+
const response = await ${o}.get(\`${A(e.edit, "id")}\`);
|
|
1948
1951
|
expect(response.status).toBe(200);
|
|
1949
1952
|
});
|
|
1950
1953
|
});
|
|
@@ -1952,19 +1955,19 @@ function cn(t, e, n, r, o) {
|
|
|
1952
1955
|
describe("POST ${e.edit}", () => {
|
|
1953
1956
|
it("should update a ${t.displayName.toLowerCase()}", async (context) => {
|
|
1954
1957
|
const { id } = await context.admin.collection("${t.tableName}").create(${c});
|
|
1955
|
-
const response = await ${
|
|
1956
|
-
.post(\`${
|
|
1958
|
+
const response = await ${o}
|
|
1959
|
+
.post(\`${A(e.edit, "id")}\`)
|
|
1957
1960
|
.type("form")
|
|
1958
1961
|
.send(${m});
|
|
1959
1962
|
expect(response.body.status).toBe(303);
|
|
1960
|
-
expect(response.body.location).toBe(\`${
|
|
1963
|
+
expect(response.body.location).toBe(\`${A(e.show, "id")}\`);
|
|
1961
1964
|
});
|
|
1962
1965
|
});
|
|
1963
1966
|
});
|
|
1964
1967
|
`;
|
|
1965
1968
|
}
|
|
1966
|
-
function
|
|
1967
|
-
const { declarations: s, setupSection: i, requestAgent:
|
|
1969
|
+
function dn(t, e, n, r, a) {
|
|
1970
|
+
const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } = jt(t, n, r, a);
|
|
1968
1971
|
return d`
|
|
1969
1972
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
1970
1973
|
|
|
@@ -1973,29 +1976,29 @@ function mn(t, e, n, r, o) {
|
|
|
1973
1976
|
|
|
1974
1977
|
describe("GET ${e}", () => {
|
|
1975
1978
|
it("should return a 200 status code", async (context) => {
|
|
1976
|
-
const response = await ${
|
|
1979
|
+
const response = await ${o}.get("${e}");
|
|
1977
1980
|
expect(response.status).toBe(200);
|
|
1978
1981
|
});
|
|
1979
1982
|
});
|
|
1980
1983
|
|
|
1981
1984
|
describe("POST ${e}", () => {
|
|
1982
1985
|
it("should submit the form successfully", async (context) => {
|
|
1983
|
-
const response = await ${
|
|
1986
|
+
const response = await ${o}.post("${e}").type("form").send(${c});
|
|
1984
1987
|
expect(response.body.status).toBe(200);
|
|
1985
1988
|
});
|
|
1986
1989
|
});
|
|
1987
1990
|
});
|
|
1988
1991
|
`;
|
|
1989
1992
|
}
|
|
1990
|
-
var
|
|
1991
|
-
function
|
|
1992
|
-
const n = t.replace(/^\/+|\/+$/g, ""), r = `${e}/${n}`,
|
|
1993
|
+
var Ft = Object.freeze, pn = Object.defineProperty, fn = (t, e) => Ft(pn(t, "raw", { value: Ft(t.slice()) })), St;
|
|
1994
|
+
function gn(t, e) {
|
|
1995
|
+
const n = t.replace(/^\/+|\/+$/g, ""), r = `${e}/${n}`, a = `/${n}`;
|
|
1993
1996
|
return {
|
|
1994
1997
|
pagePath: r,
|
|
1995
|
-
pageUrl:
|
|
1998
|
+
pageUrl: a
|
|
1996
1999
|
};
|
|
1997
2000
|
}
|
|
1998
|
-
function
|
|
2001
|
+
function hn(t) {
|
|
1999
2002
|
const [e, ...n] = t;
|
|
2000
2003
|
if (!e)
|
|
2001
2004
|
throw new Error("Invalid command arguments. Expected: <model> <fields...>");
|
|
@@ -2003,14 +2006,14 @@ function fn(t) {
|
|
|
2003
2006
|
throw new Error("At least one field definition is required.");
|
|
2004
2007
|
return { modelPath: e, fields: n };
|
|
2005
2008
|
}
|
|
2006
|
-
function
|
|
2009
|
+
function Nt(t) {
|
|
2007
2010
|
return t.some((e) => e.type === "file");
|
|
2008
2011
|
}
|
|
2009
|
-
function
|
|
2012
|
+
function bn(t) {
|
|
2010
2013
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
|
|
2011
2014
|
}
|
|
2012
|
-
function
|
|
2013
|
-
const e = t.type === "select" ? `[${t.options.map((
|
|
2015
|
+
function Ct(t) {
|
|
2016
|
+
const e = t.type === "select" ? `[${t.options.map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
|
|
2014
2017
|
let n;
|
|
2015
2018
|
switch (t.type) {
|
|
2016
2019
|
case "text":
|
|
@@ -2065,13 +2068,13 @@ function St(t) {
|
|
|
2065
2068
|
}
|
|
2066
2069
|
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()`;
|
|
2067
2070
|
}
|
|
2068
|
-
function
|
|
2071
|
+
function vn(t) {
|
|
2069
2072
|
const e = [];
|
|
2070
2073
|
for (const n of t) {
|
|
2071
2074
|
if (n.type === "file" && n.maxSelect > 1) {
|
|
2072
2075
|
e.push({
|
|
2073
2076
|
name: n.name,
|
|
2074
|
-
schema:
|
|
2077
|
+
schema: Ct({ ...n, required: !1 })
|
|
2075
2078
|
}), e.push({
|
|
2076
2079
|
name: `${n.name}+`,
|
|
2077
2080
|
schema: "z.instanceof(File).array().optional()"
|
|
@@ -2081,12 +2084,12 @@ function hn(t) {
|
|
|
2081
2084
|
});
|
|
2082
2085
|
continue;
|
|
2083
2086
|
}
|
|
2084
|
-
e.push({ name: n.name, schema:
|
|
2087
|
+
e.push({ name: n.name, schema: Ct(n) });
|
|
2085
2088
|
}
|
|
2086
2089
|
return e;
|
|
2087
2090
|
}
|
|
2088
|
-
function
|
|
2089
|
-
const n =
|
|
2091
|
+
function wn(t, e) {
|
|
2092
|
+
const n = vn(e).map((r) => `${bn(r.name)}: ${r.schema}`).join(`,
|
|
2090
2093
|
`);
|
|
2091
2094
|
return d`
|
|
2092
2095
|
import { z } from "zod/v3";
|
|
@@ -2096,20 +2099,20 @@ function bn(t, e) {
|
|
|
2096
2099
|
});
|
|
2097
2100
|
`;
|
|
2098
2101
|
}
|
|
2099
|
-
function
|
|
2100
|
-
const n =
|
|
2102
|
+
function yn(t, e) {
|
|
2103
|
+
const n = L(e), r = [
|
|
2101
2104
|
'import { untrack } from "svelte";',
|
|
2102
2105
|
'import { superForm } from "sveltekit-superforms";',
|
|
2103
2106
|
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
2104
2107
|
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2105
|
-
...
|
|
2108
|
+
...at(n)
|
|
2106
2109
|
];
|
|
2107
2110
|
return [...new Set(r)];
|
|
2108
2111
|
}
|
|
2109
|
-
function
|
|
2112
|
+
function $n(t, e) {
|
|
2110
2113
|
const r = e.filter(
|
|
2111
|
-
(
|
|
2112
|
-
).map((
|
|
2114
|
+
(a) => a.type === "select"
|
|
2115
|
+
).map((a) => zt(a)).join(`
|
|
2113
2116
|
|
|
2114
2117
|
`);
|
|
2115
2118
|
return d`
|
|
@@ -2122,11 +2125,11 @@ function wn(t, e) {
|
|
|
2122
2125
|
const { form: formData } = form;
|
|
2123
2126
|
`;
|
|
2124
2127
|
}
|
|
2125
|
-
function
|
|
2126
|
-
const n =
|
|
2127
|
-
`), r =
|
|
2128
|
-
`), s =
|
|
2129
|
-
return d(
|
|
2128
|
+
function xn(t, e) {
|
|
2129
|
+
const n = yn(t, e).join(`
|
|
2130
|
+
`), r = $n(t, e), a = e.map((i) => rt(i)).join(`
|
|
2131
|
+
`), s = Nt(e) ? ' enctype="multipart/form-data"' : "";
|
|
2132
|
+
return d(St || (St = fn([`
|
|
2130
2133
|
<script lang="ts">
|
|
2131
2134
|
`, `
|
|
2132
2135
|
|
|
@@ -2149,10 +2152,10 @@ function yn(t, e) {
|
|
|
2149
2152
|
</form>
|
|
2150
2153
|
</div>
|
|
2151
2154
|
</section>
|
|
2152
|
-
`])), n, r, t.displayName, s,
|
|
2155
|
+
`])), n, r, t.displayName, s, a);
|
|
2153
2156
|
}
|
|
2154
|
-
function
|
|
2155
|
-
const n =
|
|
2157
|
+
function Fn(t, e) {
|
|
2158
|
+
const n = Nt(e), r = d`
|
|
2156
2159
|
import { fail, superValidate${n ? ", withFiles" : ""} } from "sveltekit-superforms";
|
|
2157
2160
|
import { zod } from "sveltekit-superforms/adapters";
|
|
2158
2161
|
import { ${t.schemaName} } from "$lib/schemas/${t.name}";
|
|
@@ -2184,30 +2187,30 @@ function $n(t, e) {
|
|
|
2184
2187
|
function V(t, e) {
|
|
2185
2188
|
return {
|
|
2186
2189
|
path: t,
|
|
2187
|
-
language:
|
|
2190
|
+
language: P(t),
|
|
2188
2191
|
content: e
|
|
2189
2192
|
};
|
|
2190
2193
|
}
|
|
2191
|
-
async function
|
|
2192
|
-
const { modelPath: e, fields: n } =
|
|
2193
|
-
|
|
2194
|
-
const r =
|
|
2194
|
+
async function Sn(t) {
|
|
2195
|
+
const { modelPath: e, fields: n } = hn(t.argv);
|
|
2196
|
+
Z(e);
|
|
2197
|
+
const r = z(e, t), s = (await K(n, r, t)).fields, { pagePath: i, pageUrl: o } = gn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-BTggk_Vb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
|
|
2195
2198
|
t
|
|
2196
2199
|
), m = [
|
|
2197
|
-
V(`${i}/+page.svelte`,
|
|
2198
|
-
V(`${i}/+page.server.ts`,
|
|
2200
|
+
V(`${i}/+page.svelte`, xn(r, s)),
|
|
2201
|
+
V(`${i}/+page.server.ts`, Fn(r, s)),
|
|
2199
2202
|
V(
|
|
2200
2203
|
`${i}/server.test.ts`,
|
|
2201
|
-
|
|
2204
|
+
dn(
|
|
2202
2205
|
r,
|
|
2203
|
-
|
|
2206
|
+
o,
|
|
2204
2207
|
s,
|
|
2205
2208
|
t,
|
|
2206
2209
|
c
|
|
2207
2210
|
)
|
|
2208
2211
|
),
|
|
2209
|
-
V(`src/lib/schemas/${r.name}.ts`,
|
|
2210
|
-
], g =
|
|
2212
|
+
V(`src/lib/schemas/${r.name}.ts`, wn(r, s))
|
|
2213
|
+
], g = L(s);
|
|
2211
2214
|
return {
|
|
2212
2215
|
creates: m,
|
|
2213
2216
|
modifies: [],
|
|
@@ -2217,19 +2220,19 @@ async function xn(t) {
|
|
|
2217
2220
|
collections: []
|
|
2218
2221
|
};
|
|
2219
2222
|
}
|
|
2220
|
-
const
|
|
2221
|
-
async function
|
|
2222
|
-
const e = await
|
|
2223
|
+
const Cn = "generate-form", _n = "1.0.7", kn = "src/patterns/generate/form", Rn = "/generate/form";
|
|
2224
|
+
async function Pn(t) {
|
|
2225
|
+
const e = await Sn(t);
|
|
2223
2226
|
if (t.env !== "runtime")
|
|
2224
|
-
return
|
|
2227
|
+
return S(e);
|
|
2225
2228
|
const { writeResult: n } = await import("./write-result-CbUTMeAc.js");
|
|
2226
|
-
return n(await
|
|
2229
|
+
return n(await S(e), t);
|
|
2227
2230
|
}
|
|
2228
|
-
const
|
|
2229
|
-
version:
|
|
2230
|
-
slug:
|
|
2231
|
-
source:
|
|
2232
|
-
docs:
|
|
2231
|
+
const En = {
|
|
2232
|
+
version: _n,
|
|
2233
|
+
slug: Cn,
|
|
2234
|
+
source: kn,
|
|
2235
|
+
docs: Rn,
|
|
2233
2236
|
plan: "open",
|
|
2234
2237
|
title: "Generate a form",
|
|
2235
2238
|
summary: "Generates a form.",
|
|
@@ -2237,7 +2240,7 @@ const Rn = {
|
|
|
2237
2240
|
auth: !1,
|
|
2238
2241
|
payments: !1
|
|
2239
2242
|
},
|
|
2240
|
-
|
|
2243
|
+
category: "generators",
|
|
2241
2244
|
tags: ["sveltekit", "superforms", "validation", "zod"],
|
|
2242
2245
|
command: {
|
|
2243
2246
|
raw: "vela generate form contact name:text email:email message:editor",
|
|
@@ -2245,8 +2248,8 @@ const Rn = {
|
|
|
2245
2248
|
argv: ["contact", "name:text", "email:email", "message:editor"]
|
|
2246
2249
|
},
|
|
2247
2250
|
baseline: "velastack",
|
|
2248
|
-
generate:
|
|
2249
|
-
},
|
|
2251
|
+
generate: Pn
|
|
2252
|
+
}, In = ["text"], zn = {
|
|
2250
2253
|
string: "text",
|
|
2251
2254
|
boolean: "bool",
|
|
2252
2255
|
geopoint: "geoPoint",
|
|
@@ -2276,8 +2279,8 @@ const Rn = {
|
|
|
2276
2279
|
function Mn(t) {
|
|
2277
2280
|
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
|
|
2278
2281
|
}
|
|
2279
|
-
function
|
|
2280
|
-
const n = t.type === "select" ? `[${(t.options ?? []).map((
|
|
2282
|
+
function Bn(t, e) {
|
|
2283
|
+
const n = t.type === "select" ? `[${(t.options ?? []).map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
|
|
2281
2284
|
let r;
|
|
2282
2285
|
switch (t.type) {
|
|
2283
2286
|
case "text":
|
|
@@ -2335,120 +2338,120 @@ function In(t, e) {
|
|
|
2335
2338
|
default:
|
|
2336
2339
|
return t.type;
|
|
2337
2340
|
}
|
|
2338
|
-
return
|
|
2341
|
+
return In.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()`;
|
|
2339
2342
|
}
|
|
2340
|
-
function
|
|
2343
|
+
function it(t, e, n) {
|
|
2341
2344
|
const r = [];
|
|
2342
2345
|
n.includeModelFields && (r.push({ name: "id", type: "text", required: !1 }), r.push({ name: "collectionId", type: "text", required: !1 }));
|
|
2343
|
-
for (const
|
|
2344
|
-
if (
|
|
2345
|
-
r.push({ ...
|
|
2346
|
+
for (const o of e) {
|
|
2347
|
+
if (o.type === "file" && o.maxSelect > 1) {
|
|
2348
|
+
r.push({ ...o, required: !1 }), r.push({ name: `${o.name}+`, type: "file", required: !1, maxSelect: 999 }), r.push({ name: `${o.name}-`, type: "file", required: !1, maxSelect: 999 });
|
|
2346
2349
|
continue;
|
|
2347
2350
|
}
|
|
2348
|
-
r.push(
|
|
2351
|
+
r.push(o);
|
|
2349
2352
|
}
|
|
2350
|
-
const
|
|
2353
|
+
const a = r.map((o) => `${Mn(o.name)}: ${Bn(o, n)}`).join(`,
|
|
2351
2354
|
`), s = n.includeModelFields ? `
|
|
2352
2355
|
import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
|
|
2353
2356
|
return d`
|
|
2354
2357
|
import { z } from "zod/v3";${s}
|
|
2355
2358
|
|
|
2356
2359
|
export const ${t.schemaName} = z.object({
|
|
2357
|
-
${
|
|
2360
|
+
${a}
|
|
2358
2361
|
})${i};
|
|
2359
2362
|
`;
|
|
2360
2363
|
}
|
|
2361
|
-
function
|
|
2364
|
+
function Dn(t) {
|
|
2362
2365
|
const e = zn[t];
|
|
2363
2366
|
if (!e)
|
|
2364
2367
|
throw new Error(`Unsupported collection field type "${t}" when generating from collection`);
|
|
2365
2368
|
return e;
|
|
2366
2369
|
}
|
|
2367
|
-
function
|
|
2368
|
-
const r = e.find((
|
|
2370
|
+
function lt(t, e, n) {
|
|
2371
|
+
const r = e.find((o) => o.name === t.tableName);
|
|
2369
2372
|
if (!r)
|
|
2370
2373
|
throw new Error(`Collection "${t.tableName}" not found`);
|
|
2371
|
-
const
|
|
2372
|
-
for (const
|
|
2373
|
-
if (
|
|
2374
|
+
const a = Tt(e), s = new Map(e.map((o) => [o.id, o])), i = [];
|
|
2375
|
+
for (const o of r.fields) {
|
|
2376
|
+
if (o.name === "id" || o.system)
|
|
2374
2377
|
continue;
|
|
2375
|
-
const c =
|
|
2378
|
+
const c = Dn(o.type), m = !!o.required, g = ot(o.name);
|
|
2376
2379
|
if (c === "relation") {
|
|
2377
|
-
const f =
|
|
2380
|
+
const f = o.collectionId ? s.get(o.collectionId) : void 0;
|
|
2378
2381
|
if (!f)
|
|
2379
2382
|
continue;
|
|
2380
|
-
const h =
|
|
2383
|
+
const h = z(f.name, n);
|
|
2381
2384
|
i.push({
|
|
2382
|
-
name:
|
|
2385
|
+
name: o.name,
|
|
2383
2386
|
title: g,
|
|
2384
2387
|
type: "relation",
|
|
2385
2388
|
required: m,
|
|
2386
2389
|
collectionId: f.id,
|
|
2387
|
-
maxSelect:
|
|
2388
|
-
displayField:
|
|
2390
|
+
maxSelect: o.maxSelect ?? 1,
|
|
2391
|
+
displayField: a[f.name] ?? "id",
|
|
2389
2392
|
relatedModel: h,
|
|
2390
|
-
singularRelationName:
|
|
2393
|
+
singularRelationName: j(
|
|
2391
2394
|
`${t.displayName} ${h.displayName}`
|
|
2392
2395
|
),
|
|
2393
|
-
pluralRelationName:
|
|
2396
|
+
pluralRelationName: j(
|
|
2394
2397
|
`${t.displayName} ${h.pluralDisplayName}`
|
|
2395
2398
|
),
|
|
2396
|
-
isCurrentUser: n.features.auth && f.name === "users" && /user|owner|author/i.test(
|
|
2399
|
+
isCurrentUser: n.features.auth && f.name === "users" && /user|owner|author/i.test(o.name)
|
|
2397
2400
|
});
|
|
2398
2401
|
continue;
|
|
2399
2402
|
}
|
|
2400
2403
|
if (c === "select") {
|
|
2401
2404
|
i.push({
|
|
2402
|
-
name:
|
|
2405
|
+
name: o.name,
|
|
2403
2406
|
title: g,
|
|
2404
2407
|
type: "select",
|
|
2405
2408
|
required: m,
|
|
2406
|
-
maxSelect:
|
|
2407
|
-
options: (
|
|
2409
|
+
maxSelect: o.maxSelect ?? 1,
|
|
2410
|
+
options: (o.values ?? []).map((f) => ({ label: f, value: f }))
|
|
2408
2411
|
});
|
|
2409
2412
|
continue;
|
|
2410
2413
|
}
|
|
2411
2414
|
if (c === "file") {
|
|
2412
2415
|
i.push({
|
|
2413
|
-
name:
|
|
2416
|
+
name: o.name,
|
|
2414
2417
|
title: g,
|
|
2415
2418
|
type: "file",
|
|
2416
2419
|
required: m,
|
|
2417
|
-
maxSelect:
|
|
2420
|
+
maxSelect: o.maxSelect ?? 1
|
|
2418
2421
|
});
|
|
2419
2422
|
continue;
|
|
2420
2423
|
}
|
|
2421
2424
|
if (c === "autodate") {
|
|
2422
2425
|
i.push({
|
|
2423
|
-
name:
|
|
2426
|
+
name: o.name,
|
|
2424
2427
|
title: g,
|
|
2425
2428
|
type: "autodate",
|
|
2426
2429
|
required: m,
|
|
2427
|
-
onCreate:
|
|
2428
|
-
onUpdate:
|
|
2430
|
+
onCreate: o.onCreate ?? o.name.includes("create"),
|
|
2431
|
+
onUpdate: o.onUpdate ?? o.name.includes("update")
|
|
2429
2432
|
});
|
|
2430
2433
|
continue;
|
|
2431
2434
|
}
|
|
2432
2435
|
i.push({
|
|
2433
|
-
name:
|
|
2436
|
+
name: o.name,
|
|
2434
2437
|
title: g,
|
|
2435
2438
|
type: c,
|
|
2436
2439
|
required: m
|
|
2437
2440
|
});
|
|
2438
2441
|
}
|
|
2439
|
-
return i.filter((
|
|
2442
|
+
return i.filter((o) => o.name !== "id");
|
|
2440
2443
|
}
|
|
2441
|
-
function
|
|
2444
|
+
function Ot(t) {
|
|
2442
2445
|
const e = t.filter((n) => n.type === "relation").map((n) => n.name);
|
|
2443
2446
|
return e.length > 0 ? e.join(",") : void 0;
|
|
2444
2447
|
}
|
|
2445
|
-
function
|
|
2448
|
+
function Lt(t) {
|
|
2446
2449
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
2447
2450
|
for (const r of t)
|
|
2448
2451
|
r.type === "relation" && (e.has(r.relatedModel.tableName) || (e.add(r.relatedModel.tableName), n.push(r.relatedModel)));
|
|
2449
2452
|
return n;
|
|
2450
2453
|
}
|
|
2451
|
-
function
|
|
2454
|
+
function Tn(t) {
|
|
2452
2455
|
const e = {
|
|
2453
2456
|
name: t.name,
|
|
2454
2457
|
type: t.type,
|
|
@@ -2483,10 +2486,10 @@ function qt(t, e, n) {
|
|
|
2483
2486
|
name: t.tableName,
|
|
2484
2487
|
type: "base",
|
|
2485
2488
|
...r,
|
|
2486
|
-
fields: e.map(
|
|
2489
|
+
fields: e.map(Tn)
|
|
2487
2490
|
};
|
|
2488
2491
|
}
|
|
2489
|
-
function
|
|
2492
|
+
function An(t) {
|
|
2490
2493
|
const [e, ...n] = t;
|
|
2491
2494
|
if (!e)
|
|
2492
2495
|
throw new Error(
|
|
@@ -2494,60 +2497,60 @@ function Dn(t) {
|
|
|
2494
2497
|
);
|
|
2495
2498
|
return { modelPath: e, fields: n };
|
|
2496
2499
|
}
|
|
2497
|
-
function
|
|
2500
|
+
function jn(t, e) {
|
|
2498
2501
|
return {
|
|
2499
2502
|
path: t,
|
|
2500
|
-
language:
|
|
2503
|
+
language: P(t),
|
|
2501
2504
|
content: e
|
|
2502
2505
|
};
|
|
2503
2506
|
}
|
|
2504
|
-
async function
|
|
2505
|
-
|
|
2506
|
-
const r =
|
|
2507
|
+
async function Nn(t, e, n) {
|
|
2508
|
+
Z(e);
|
|
2509
|
+
const r = z(e, t);
|
|
2507
2510
|
if (n.length > 0) {
|
|
2508
|
-
const i = await
|
|
2511
|
+
const i = await K(n, r, t);
|
|
2509
2512
|
return { model: r, fields: i.fields, auth: i.auth, shouldCreateCollection: !0 };
|
|
2510
2513
|
}
|
|
2511
|
-
const
|
|
2514
|
+
const a = t.env === "runtime" ? await (await import("./env.runtime-BTggk_Vb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = lt(r, a, t);
|
|
2512
2515
|
return { model: r, fields: s, auth: void 0, shouldCreateCollection: !1 };
|
|
2513
2516
|
}
|
|
2514
|
-
async function
|
|
2515
|
-
const { modelPath: e, fields: n } =
|
|
2517
|
+
async function On(t) {
|
|
2518
|
+
const { modelPath: e, fields: n } = An(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i } = await Nn(
|
|
2516
2519
|
t,
|
|
2517
2520
|
e,
|
|
2518
2521
|
n
|
|
2519
|
-
),
|
|
2522
|
+
), o = `src/lib/schemas/${r.name}.ts`, c = it(r, a, {
|
|
2520
2523
|
includeModelFields: !0,
|
|
2521
2524
|
forForm: !0
|
|
2522
2525
|
});
|
|
2523
2526
|
return {
|
|
2524
|
-
creates: [
|
|
2527
|
+
creates: [jn(o, c)],
|
|
2525
2528
|
modifies: [],
|
|
2526
2529
|
deletes: [],
|
|
2527
2530
|
components: [],
|
|
2528
2531
|
packages: [],
|
|
2529
|
-
collections: i ? [qt(r,
|
|
2532
|
+
collections: i ? [qt(r, a, s)] : []
|
|
2530
2533
|
};
|
|
2531
2534
|
}
|
|
2532
|
-
const
|
|
2533
|
-
async function
|
|
2534
|
-
const e = await
|
|
2535
|
+
const Ln = "generate-resource", qn = "1.0.7", Vn = "src/patterns/generate/resource", Un = "/generate/resource";
|
|
2536
|
+
async function Hn(t) {
|
|
2537
|
+
const e = await On(t);
|
|
2535
2538
|
if (t.env !== "runtime")
|
|
2536
|
-
return
|
|
2537
|
-
const { createCollections: n } = await import("./collections-
|
|
2539
|
+
return S(e);
|
|
2540
|
+
const { createCollections: n } = await import("./collections-t61Ot2Ax.js"), r = await n(
|
|
2538
2541
|
e.collections,
|
|
2539
2542
|
t
|
|
2540
|
-
),
|
|
2543
|
+
), a = {
|
|
2541
2544
|
...e,
|
|
2542
2545
|
creates: [...e.creates, ...r]
|
|
2543
2546
|
}, { writeResult: s } = await import("./write-result-CbUTMeAc.js");
|
|
2544
|
-
return s(await
|
|
2547
|
+
return s(await S(a), t);
|
|
2545
2548
|
}
|
|
2546
|
-
const
|
|
2547
|
-
version:
|
|
2548
|
-
slug:
|
|
2549
|
-
source:
|
|
2550
|
-
docs:
|
|
2549
|
+
const Gn = {
|
|
2550
|
+
version: qn,
|
|
2551
|
+
slug: Ln,
|
|
2552
|
+
source: Vn,
|
|
2553
|
+
docs: Un,
|
|
2551
2554
|
plan: "open",
|
|
2552
2555
|
title: "Generate a resource",
|
|
2553
2556
|
summary: "Generates model schema resources.",
|
|
@@ -2555,7 +2558,7 @@ const Un = {
|
|
|
2555
2558
|
auth: !1,
|
|
2556
2559
|
payments: !1
|
|
2557
2560
|
},
|
|
2558
|
-
|
|
2561
|
+
category: "generators",
|
|
2559
2562
|
tags: ["pocketbase", "resource", "schema"],
|
|
2560
2563
|
command: {
|
|
2561
2564
|
raw: "vela generate resource contact name:text email:email",
|
|
@@ -2563,19 +2566,19 @@ const Un = {
|
|
|
2563
2566
|
argv: ["contact", "name:text", "email:email"]
|
|
2564
2567
|
},
|
|
2565
2568
|
baseline: "velastack",
|
|
2566
|
-
generate:
|
|
2569
|
+
generate: Hn
|
|
2567
2570
|
};
|
|
2568
|
-
var
|
|
2569
|
-
function
|
|
2571
|
+
var _t = Object.freeze, Wn = Object.defineProperty, X = (t, e) => _t(Wn(t, "raw", { value: _t(e || t.slice()) })), kt, Rt, Pt, Et;
|
|
2572
|
+
function Jn(t) {
|
|
2570
2573
|
const [e, ...n] = t;
|
|
2571
2574
|
if (!e)
|
|
2572
2575
|
throw new Error("Invalid command arguments. Expected: <model> [fields...]");
|
|
2573
2576
|
return { modelPath: e, fields: n };
|
|
2574
2577
|
}
|
|
2575
|
-
function
|
|
2578
|
+
function _(t, e) {
|
|
2576
2579
|
return {
|
|
2577
2580
|
path: t,
|
|
2578
|
-
language:
|
|
2581
|
+
language: P(t),
|
|
2579
2582
|
content: e
|
|
2580
2583
|
};
|
|
2581
2584
|
}
|
|
@@ -2585,27 +2588,27 @@ function Vt(t) {
|
|
|
2585
2588
|
function Ut(t) {
|
|
2586
2589
|
return [...new Set(t.filter(Boolean))];
|
|
2587
2590
|
}
|
|
2588
|
-
function
|
|
2591
|
+
function ct(t) {
|
|
2589
2592
|
return t.filter(
|
|
2590
2593
|
(e) => e.type === "select"
|
|
2591
|
-
).map((e) =>
|
|
2594
|
+
).map((e) => zt(e)).join(`
|
|
2592
2595
|
|
|
2593
2596
|
`);
|
|
2594
2597
|
}
|
|
2595
2598
|
function Ht(t, e) {
|
|
2596
|
-
return
|
|
2599
|
+
return Lt(t).map(
|
|
2597
2600
|
(n) => `const ${n.pluralName} = await ${e}.collection("${n.tableName}").getFullList();`
|
|
2598
2601
|
).join(`
|
|
2599
2602
|
`);
|
|
2600
2603
|
}
|
|
2601
2604
|
function Gt(t) {
|
|
2602
|
-
return
|
|
2605
|
+
return Lt(t).map((e) => e.pluralName).join(", ");
|
|
2603
2606
|
}
|
|
2604
|
-
function
|
|
2607
|
+
function Zn(t) {
|
|
2605
2608
|
return t.features.auth ? "locals.pb" : "locals.admin";
|
|
2606
2609
|
}
|
|
2607
2610
|
function Wt(t, e, n = !1) {
|
|
2608
|
-
const r =
|
|
2611
|
+
const r = ct(e);
|
|
2609
2612
|
return d`
|
|
2610
2613
|
${r}
|
|
2611
2614
|
${n ? "let { data, params } = $props();" : "let { data } = $props();"}
|
|
@@ -2617,21 +2620,21 @@ function Wt(t, e, n = !1) {
|
|
|
2617
2620
|
const { form: formData } = form;
|
|
2618
2621
|
`;
|
|
2619
2622
|
}
|
|
2620
|
-
function
|
|
2621
|
-
const r = n.some((
|
|
2623
|
+
function Kn(t, e, n) {
|
|
2624
|
+
const r = n.some((o) => o.type === "select"), a = Ut([
|
|
2622
2625
|
'import { untrack } from "svelte";',
|
|
2623
2626
|
'import { superForm } from "sveltekit-superforms";',
|
|
2624
2627
|
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
2625
2628
|
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2626
|
-
...
|
|
2629
|
+
...at(L(n)),
|
|
2627
2630
|
'import { Button } from "$lib/components/ui/button";',
|
|
2628
2631
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
2629
2632
|
'import * as Form from "$lib/components/ui/form";',
|
|
2630
2633
|
r ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2631
2634
|
]).join(`
|
|
2632
|
-
`), s = n.map((
|
|
2635
|
+
`), s = n.map((o) => rt(o)).join(`
|
|
2633
2636
|
`), i = Vt(n) ? ' enctype="multipart/form-data"' : "";
|
|
2634
|
-
return d(
|
|
2637
|
+
return d(kt || (kt = X([`
|
|
2635
2638
|
<script lang="ts">
|
|
2636
2639
|
`, `
|
|
2637
2640
|
`, `
|
|
@@ -2658,23 +2661,23 @@ function Jn(t, e, n) {
|
|
|
2658
2661
|
</form>
|
|
2659
2662
|
</div>
|
|
2660
2663
|
</section>
|
|
2661
|
-
`])),
|
|
2664
|
+
`])), a, Wt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2662
2665
|
}
|
|
2663
|
-
function
|
|
2664
|
-
const r = n.some((
|
|
2666
|
+
function Xn(t, e, n) {
|
|
2667
|
+
const r = n.some((o) => o.type === "select"), a = Ut([
|
|
2665
2668
|
'import { untrack } from "svelte";',
|
|
2666
2669
|
'import { superForm } from "sveltekit-superforms";',
|
|
2667
2670
|
'import { zodClient } from "sveltekit-superforms/adapters";',
|
|
2668
2671
|
`import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
|
|
2669
|
-
...
|
|
2672
|
+
...at(L(n)),
|
|
2670
2673
|
'import { Button } from "$lib/components/ui/button";',
|
|
2671
2674
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
2672
2675
|
'import * as Form from "$lib/components/ui/form";',
|
|
2673
2676
|
r ? 'import type { Models } from "pocketbase-svelte";' : ""
|
|
2674
2677
|
]).join(`
|
|
2675
|
-
`), s = n.map((
|
|
2678
|
+
`), s = n.map((o) => rt(o)).join(`
|
|
2676
2679
|
`), i = Vt(n) ? ' enctype="multipart/form-data"' : "";
|
|
2677
|
-
return d(
|
|
2680
|
+
return d(Rt || (Rt = X([`
|
|
2678
2681
|
<script lang="ts">
|
|
2679
2682
|
`, `
|
|
2680
2683
|
`, `
|
|
@@ -2728,23 +2731,23 @@ function Zn(t, e, n) {
|
|
|
2728
2731
|
</form>
|
|
2729
2732
|
</div>
|
|
2730
2733
|
</section>
|
|
2731
|
-
`])),
|
|
2734
|
+
`])), a, Wt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
|
|
2732
2735
|
}
|
|
2733
|
-
function
|
|
2734
|
-
const r = n.some((
|
|
2736
|
+
function Yn(t, e, n) {
|
|
2737
|
+
const r = n.some((o) => o.type === "select"), a = r ? `${ct(n)}` : "", s = n.map((o) => {
|
|
2735
2738
|
let c = "{ getValue }", m = "{ value: getValue() }";
|
|
2736
|
-
return
|
|
2737
|
-
columnHelper.accessor("${
|
|
2738
|
-
header: ({ column }) => renderComponent(ColumnHeader, { column, title: "${
|
|
2739
|
-
cell: (${c}) => renderComponent(Cells.${
|
|
2739
|
+
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 }"), d`
|
|
2740
|
+
columnHelper.accessor("${o.name}", {
|
|
2741
|
+
header: ({ column }) => renderComponent(ColumnHeader, { column, title: "${o.title}" }),
|
|
2742
|
+
cell: (${c}) => renderComponent(Cells.${o.type.charAt(0).toUpperCase() + o.type.slice(1)}Cell, ${m})
|
|
2740
2743
|
})
|
|
2741
2744
|
`;
|
|
2742
2745
|
}).join(`,
|
|
2743
|
-
`), i = n.filter((
|
|
2744
|
-
(
|
|
2746
|
+
`), i = n.filter((o) => o.type === "select").map(
|
|
2747
|
+
(o) => `<FacetedFilter column={table.getColumn("${o.name}")!} title="${o.title}" options={Object.values(${o.name}Labels)} />`
|
|
2745
2748
|
).join(`
|
|
2746
2749
|
`);
|
|
2747
|
-
return d(
|
|
2750
|
+
return d(Pt || (Pt = X([`
|
|
2748
2751
|
<script lang="ts">
|
|
2749
2752
|
import {
|
|
2750
2753
|
type ColumnFiltersState,
|
|
@@ -3118,21 +3121,21 @@ function Xn(t, e, n) {
|
|
|
3118
3121
|
<Pagination {table} />
|
|
3119
3122
|
</div>
|
|
3120
3123
|
</section>
|
|
3121
|
-
`])), r ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "",
|
|
3124
|
+
`])), 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());
|
|
3122
3125
|
}
|
|
3123
|
-
function
|
|
3124
|
-
const r =
|
|
3126
|
+
function Qn(t, e, n) {
|
|
3127
|
+
const r = Ot(e), a = r ? `{ expand: "${r}" }` : "";
|
|
3125
3128
|
return d`
|
|
3126
3129
|
export const load = async ({ locals }) => {
|
|
3127
|
-
const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${
|
|
3130
|
+
const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${a});
|
|
3128
3131
|
return { ${t.pluralName} };
|
|
3129
3132
|
};
|
|
3130
3133
|
`;
|
|
3131
3134
|
}
|
|
3132
|
-
function
|
|
3133
|
-
const s = Ht(n, r), i = Gt(n),
|
|
3135
|
+
function tr(t, e, n, r, a) {
|
|
3136
|
+
const s = Ht(n, r), i = Gt(n), o = i ? `, ${i}` : "", c = n.find(
|
|
3134
3137
|
(g) => g.type === "relation" && g.isCurrentUser
|
|
3135
|
-
), m =
|
|
3138
|
+
), m = a && c ? d`
|
|
3136
3139
|
{
|
|
3137
3140
|
...form.data,
|
|
3138
3141
|
${c.name}: locals.pb.authStore.record?.id
|
|
@@ -3147,7 +3150,7 @@ function Kn(t, e, n, r, o) {
|
|
|
3147
3150
|
|
|
3148
3151
|
export const load = async ({ locals }) => {
|
|
3149
3152
|
${s}
|
|
3150
|
-
return { form: await superValidate(zod(${t.schemaName}))${
|
|
3153
|
+
return { form: await superValidate(zod(${t.schemaName}))${o} };
|
|
3151
3154
|
};
|
|
3152
3155
|
|
|
3153
3156
|
export const actions = {
|
|
@@ -3171,8 +3174,8 @@ function Kn(t, e, n, r, o) {
|
|
|
3171
3174
|
};
|
|
3172
3175
|
`;
|
|
3173
3176
|
}
|
|
3174
|
-
function
|
|
3175
|
-
const
|
|
3177
|
+
function er(t, e, n, r) {
|
|
3178
|
+
const a = Ot(n), s = a ? `, { expand: "${a}" }` : "";
|
|
3176
3179
|
return d`
|
|
3177
3180
|
import { error, redirect } from "@sveltejs/kit";
|
|
3178
3181
|
|
|
@@ -3193,17 +3196,17 @@ function Qn(t, e, n, r) {
|
|
|
3193
3196
|
};
|
|
3194
3197
|
`;
|
|
3195
3198
|
}
|
|
3196
|
-
function
|
|
3197
|
-
const r = n.some((m) => m.type === "select"),
|
|
3199
|
+
function nr(t, e, n) {
|
|
3200
|
+
const r = n.some((m) => m.type === "select"), a = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
|
|
3198
3201
|
'import { Button } from "$lib/components/ui/button";',
|
|
3199
3202
|
'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
|
|
3200
|
-
r ||
|
|
3201
|
-
|
|
3203
|
+
r || a ? 'import { Badge } from "$lib/components/ui/badge";' : "",
|
|
3204
|
+
a ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
|
|
3202
3205
|
s ? 'import FileIcon from "@lucide/svelte/icons/file";' : ""
|
|
3203
3206
|
].filter(Boolean).join(`
|
|
3204
|
-
`),
|
|
3207
|
+
`), o = ct(n), c = n.map((m) => Ce(t, m)).join(`
|
|
3205
3208
|
`);
|
|
3206
|
-
return d(
|
|
3209
|
+
return d(Et || (Et = X([`
|
|
3207
3210
|
<script lang="ts">
|
|
3208
3211
|
`, `
|
|
3209
3212
|
`, `
|
|
@@ -3235,10 +3238,10 @@ function tr(t, e, n) {
|
|
|
3235
3238
|
</div>
|
|
3236
3239
|
</div>
|
|
3237
3240
|
</section>
|
|
3238
|
-
`])), i,
|
|
3241
|
+
`])), i, o, t.displayName, e.list, c, e.list, t.name);
|
|
3239
3242
|
}
|
|
3240
|
-
function
|
|
3241
|
-
const
|
|
3243
|
+
function rr(t, e, n, r) {
|
|
3244
|
+
const a = Ht(n, r), s = Gt(n), i = s ? `, ${s}` : "";
|
|
3242
3245
|
return d`
|
|
3243
3246
|
import { error, fail, redirect } from "@sveltejs/kit";
|
|
3244
3247
|
import { setPocketbaseErrors, setDefaultData } from "@velastack/pocketbase";
|
|
@@ -3253,7 +3256,7 @@ function er(t, e, n, r) {
|
|
|
3253
3256
|
} catch {
|
|
3254
3257
|
throw error(404, "Not found");
|
|
3255
3258
|
}
|
|
3256
|
-
${
|
|
3259
|
+
${a}
|
|
3257
3260
|
return { form: await superValidate(${t.name}, zod(${t.schemaName}))${i} };
|
|
3258
3261
|
};
|
|
3259
3262
|
|
|
@@ -3279,82 +3282,82 @@ function er(t, e, n, r) {
|
|
|
3279
3282
|
};
|
|
3280
3283
|
`;
|
|
3281
3284
|
}
|
|
3282
|
-
async function
|
|
3283
|
-
|
|
3284
|
-
const r =
|
|
3285
|
+
async function ar(t, e, n) {
|
|
3286
|
+
Z(e);
|
|
3287
|
+
const r = z(e, t), a = t.env === "runtime" ? await (await import("./env.runtime-BTggk_Vb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
|
|
3285
3288
|
t
|
|
3286
3289
|
);
|
|
3287
3290
|
if (n.length > 0) {
|
|
3288
|
-
const i = await
|
|
3291
|
+
const i = await K(n, r, t);
|
|
3289
3292
|
return {
|
|
3290
3293
|
model: r,
|
|
3291
3294
|
fields: i.fields,
|
|
3292
3295
|
auth: i.auth,
|
|
3293
3296
|
shouldCreateCollection: !0,
|
|
3294
|
-
collections:
|
|
3297
|
+
collections: a
|
|
3295
3298
|
};
|
|
3296
3299
|
}
|
|
3297
|
-
const s =
|
|
3300
|
+
const s = lt(r, a, t);
|
|
3298
3301
|
return {
|
|
3299
3302
|
model: r,
|
|
3300
3303
|
fields: s,
|
|
3301
3304
|
auth: void 0,
|
|
3302
3305
|
shouldCreateCollection: !1,
|
|
3303
|
-
collections:
|
|
3306
|
+
collections: a
|
|
3304
3307
|
};
|
|
3305
3308
|
}
|
|
3306
|
-
async function
|
|
3307
|
-
const { modelPath: e, fields: n } =
|
|
3309
|
+
async function or(t) {
|
|
3310
|
+
const { modelPath: e, fields: n } = Jn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i, collections: o } = await ar(t, e, n), c = Ue(r), m = He(r), g = Zn(t), f = a.filter(
|
|
3308
3311
|
(u) => !(u.type === "relation" && u.isCurrentUser)
|
|
3309
3312
|
), h = [
|
|
3310
|
-
|
|
3313
|
+
_(
|
|
3311
3314
|
`src/lib/schemas/${r.name}.ts`,
|
|
3312
|
-
|
|
3315
|
+
it(r, a, {
|
|
3313
3316
|
includeModelFields: !0,
|
|
3314
3317
|
forForm: !0
|
|
3315
3318
|
})
|
|
3316
3319
|
),
|
|
3317
|
-
|
|
3320
|
+
_(
|
|
3318
3321
|
`${c.list}/+page.server.ts`,
|
|
3319
|
-
|
|
3322
|
+
Qn(r, f, g)
|
|
3320
3323
|
),
|
|
3321
|
-
|
|
3324
|
+
_(
|
|
3322
3325
|
`${c.list}/+page.svelte`,
|
|
3323
|
-
|
|
3326
|
+
Yn(r, m, f)
|
|
3324
3327
|
),
|
|
3325
|
-
|
|
3328
|
+
_(
|
|
3326
3329
|
`${c.new}/+page.server.ts`,
|
|
3327
|
-
|
|
3330
|
+
tr(r, m, f, g, t.features.auth)
|
|
3328
3331
|
),
|
|
3329
|
-
|
|
3330
|
-
|
|
3332
|
+
_(`${c.new}/+page.svelte`, Kn(r, m, f)),
|
|
3333
|
+
_(
|
|
3331
3334
|
`${c.show}/+page.server.ts`,
|
|
3332
|
-
|
|
3335
|
+
er(r, m, f, g)
|
|
3333
3336
|
),
|
|
3334
|
-
|
|
3337
|
+
_(
|
|
3335
3338
|
`${c.show}/+page.svelte`,
|
|
3336
|
-
|
|
3339
|
+
nr(r, m, f)
|
|
3337
3340
|
),
|
|
3338
|
-
|
|
3341
|
+
_(
|
|
3339
3342
|
`${c.edit}/+page.server.ts`,
|
|
3340
|
-
|
|
3343
|
+
rr(r, m, f, g)
|
|
3341
3344
|
),
|
|
3342
|
-
|
|
3345
|
+
_(
|
|
3343
3346
|
`${c.edit}/+page.svelte`,
|
|
3344
|
-
|
|
3347
|
+
Xn(r, m, f)
|
|
3345
3348
|
),
|
|
3346
|
-
|
|
3349
|
+
_(
|
|
3347
3350
|
`${c.list}/server.test.ts`,
|
|
3348
|
-
|
|
3351
|
+
un(
|
|
3349
3352
|
r,
|
|
3350
3353
|
m,
|
|
3351
|
-
|
|
3354
|
+
a,
|
|
3352
3355
|
t,
|
|
3353
|
-
|
|
3356
|
+
o
|
|
3354
3357
|
)
|
|
3355
3358
|
)
|
|
3356
3359
|
], $ = [
|
|
3357
|
-
...
|
|
3360
|
+
...L(f),
|
|
3358
3361
|
"button",
|
|
3359
3362
|
"table",
|
|
3360
3363
|
"data-table",
|
|
@@ -3377,28 +3380,28 @@ async function rr(t) {
|
|
|
3377
3380
|
deletes: [],
|
|
3378
3381
|
components: [...new Set($)],
|
|
3379
3382
|
packages: ["@tanstack/table-core"],
|
|
3380
|
-
collections: i ? [qt(r,
|
|
3383
|
+
collections: i ? [qt(r, a, s)] : []
|
|
3381
3384
|
};
|
|
3382
3385
|
}
|
|
3383
|
-
const
|
|
3384
|
-
async function
|
|
3385
|
-
const e = await
|
|
3386
|
+
const sr = "generate-scaffold", ir = "1.0.7", lr = "src/patterns/generate/scaffold", cr = "/generate/scaffold";
|
|
3387
|
+
async function mr(t) {
|
|
3388
|
+
const e = await or(t);
|
|
3386
3389
|
if (t.env !== "runtime")
|
|
3387
|
-
return
|
|
3388
|
-
const { createCollections: n } = await import("./collections-
|
|
3390
|
+
return S(e);
|
|
3391
|
+
const { createCollections: n } = await import("./collections-t61Ot2Ax.js"), r = await n(
|
|
3389
3392
|
e.collections,
|
|
3390
3393
|
t
|
|
3391
|
-
),
|
|
3394
|
+
), a = {
|
|
3392
3395
|
...e,
|
|
3393
3396
|
creates: [...e.creates, ...r]
|
|
3394
3397
|
}, { writeResult: s } = await import("./write-result-CbUTMeAc.js");
|
|
3395
|
-
return s(await
|
|
3398
|
+
return s(await S(a), t);
|
|
3396
3399
|
}
|
|
3397
|
-
const
|
|
3398
|
-
version:
|
|
3399
|
-
slug:
|
|
3400
|
-
source:
|
|
3401
|
-
docs:
|
|
3400
|
+
const ur = {
|
|
3401
|
+
version: ir,
|
|
3402
|
+
slug: sr,
|
|
3403
|
+
source: lr,
|
|
3404
|
+
docs: cr,
|
|
3402
3405
|
plan: "open",
|
|
3403
3406
|
title: "Generate a scaffold",
|
|
3404
3407
|
summary: "Generates CRUD routes and schema.",
|
|
@@ -3406,7 +3409,7 @@ const cr = {
|
|
|
3406
3409
|
auth: !1,
|
|
3407
3410
|
payments: !1
|
|
3408
3411
|
},
|
|
3409
|
-
|
|
3412
|
+
category: "generators",
|
|
3410
3413
|
tags: ["crud", "scaffold", "pocketbase", "sveltekit"],
|
|
3411
3414
|
command: {
|
|
3412
3415
|
raw: "vela generate scaffold contact name:text email:email",
|
|
@@ -3414,9 +3417,9 @@ const cr = {
|
|
|
3414
3417
|
argv: ["contact", "name:text", "email:email"]
|
|
3415
3418
|
},
|
|
3416
3419
|
baseline: "velastack",
|
|
3417
|
-
generate:
|
|
3420
|
+
generate: mr
|
|
3418
3421
|
};
|
|
3419
|
-
function
|
|
3422
|
+
function dr(t) {
|
|
3420
3423
|
const [e, ...n] = t;
|
|
3421
3424
|
if (!e)
|
|
3422
3425
|
throw new Error(
|
|
@@ -3424,34 +3427,34 @@ function mr(t) {
|
|
|
3424
3427
|
);
|
|
3425
3428
|
return { modelPath: e, fields: n };
|
|
3426
3429
|
}
|
|
3427
|
-
function
|
|
3430
|
+
function pr(t, e) {
|
|
3428
3431
|
return {
|
|
3429
3432
|
path: t,
|
|
3430
|
-
language:
|
|
3433
|
+
language: P(t),
|
|
3431
3434
|
content: e
|
|
3432
3435
|
};
|
|
3433
3436
|
}
|
|
3434
|
-
async function
|
|
3435
|
-
|
|
3436
|
-
const r =
|
|
3437
|
+
async function fr(t, e, n) {
|
|
3438
|
+
Z(e);
|
|
3439
|
+
const r = z(e, t);
|
|
3437
3440
|
if (n.length > 0) {
|
|
3438
|
-
const i = await
|
|
3441
|
+
const i = await K(n, r, t);
|
|
3439
3442
|
return { model: r, fields: i.fields, includeModelFields: !1 };
|
|
3440
3443
|
}
|
|
3441
|
-
const
|
|
3444
|
+
const a = t.env === "runtime" ? await (await import("./env.runtime-BTggk_Vb.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = lt(r, a, t);
|
|
3442
3445
|
return { model: r, fields: s, includeModelFields: !0 };
|
|
3443
3446
|
}
|
|
3444
|
-
async function
|
|
3445
|
-
const { modelPath: e, fields: n } =
|
|
3447
|
+
async function gr(t) {
|
|
3448
|
+
const { modelPath: e, fields: n } = dr(t.argv), { model: r, fields: a, includeModelFields: s } = await fr(
|
|
3446
3449
|
t,
|
|
3447
3450
|
e,
|
|
3448
3451
|
n
|
|
3449
|
-
), i = `src/lib/schemas/${r.name}.ts`,
|
|
3452
|
+
), i = `src/lib/schemas/${r.name}.ts`, o = it(r, a, {
|
|
3450
3453
|
includeModelFields: s,
|
|
3451
3454
|
forForm: !0
|
|
3452
3455
|
});
|
|
3453
3456
|
return {
|
|
3454
|
-
creates: [
|
|
3457
|
+
creates: [pr(i, o)],
|
|
3455
3458
|
modifies: [],
|
|
3456
3459
|
deletes: [],
|
|
3457
3460
|
components: [],
|
|
@@ -3459,19 +3462,19 @@ async function pr(t) {
|
|
|
3459
3462
|
collections: []
|
|
3460
3463
|
};
|
|
3461
3464
|
}
|
|
3462
|
-
const
|
|
3463
|
-
async function
|
|
3464
|
-
const e = await
|
|
3465
|
+
const hr = "generate-schema", br = "1.0.7", vr = "src/patterns/generate/schema", wr = "/generate/schema";
|
|
3466
|
+
async function yr(t) {
|
|
3467
|
+
const e = await gr(t);
|
|
3465
3468
|
if (t.env !== "runtime")
|
|
3466
|
-
return
|
|
3469
|
+
return S(e);
|
|
3467
3470
|
const { writeResult: n } = await import("./write-result-CbUTMeAc.js");
|
|
3468
|
-
return n(await
|
|
3471
|
+
return n(await S(e), t);
|
|
3469
3472
|
}
|
|
3470
|
-
const
|
|
3471
|
-
version:
|
|
3472
|
-
slug:
|
|
3473
|
-
source:
|
|
3474
|
-
docs:
|
|
3473
|
+
const $r = {
|
|
3474
|
+
version: br,
|
|
3475
|
+
slug: hr,
|
|
3476
|
+
source: vr,
|
|
3477
|
+
docs: wr,
|
|
3475
3478
|
plan: "open",
|
|
3476
3479
|
title: "Generate a schema",
|
|
3477
3480
|
summary: "Generates a zod schema.",
|
|
@@ -3479,7 +3482,7 @@ const wr = {
|
|
|
3479
3482
|
auth: !1,
|
|
3480
3483
|
payments: !1
|
|
3481
3484
|
},
|
|
3482
|
-
|
|
3485
|
+
category: "generators",
|
|
3483
3486
|
tags: ["zod", "schema", "pocketbase"],
|
|
3484
3487
|
command: {
|
|
3485
3488
|
raw: "vela generate schema contact name:text email:email",
|
|
@@ -3487,8 +3490,8 @@ const wr = {
|
|
|
3487
3490
|
argv: ["contact", "name:text", "email:email"]
|
|
3488
3491
|
},
|
|
3489
3492
|
baseline: "velastack",
|
|
3490
|
-
generate:
|
|
3491
|
-
},
|
|
3493
|
+
generate: yr
|
|
3494
|
+
}, xr = `<script lang="ts">
|
|
3492
3495
|
import type { ComponentProps } from 'svelte';
|
|
3493
3496
|
import HomeIcon from '@lucide/svelte/icons/home';
|
|
3494
3497
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
@@ -3541,7 +3544,7 @@ const wr = {
|
|
|
3541
3544
|
<NavUser {user} />
|
|
3542
3545
|
</Sidebar.Footer>
|
|
3543
3546
|
</Sidebar.Root>
|
|
3544
|
-
`,
|
|
3547
|
+
`, Fr = `<script lang="ts">
|
|
3545
3548
|
import type { Component } from 'svelte';
|
|
3546
3549
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3547
3550
|
import { page } from '$app/state';
|
|
@@ -3581,7 +3584,7 @@ const wr = {
|
|
|
3581
3584
|
{/each}
|
|
3582
3585
|
</Sidebar.Menu>
|
|
3583
3586
|
</Sidebar.Group>
|
|
3584
|
-
`,
|
|
3587
|
+
`, Sr = `<script lang="ts">
|
|
3585
3588
|
import { toggleMode, mode } from 'mode-watcher';
|
|
3586
3589
|
import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';
|
|
3587
3590
|
import Settings2Icon from '@lucide/svelte/icons/settings-2';
|
|
@@ -3697,12 +3700,12 @@ const wr = {
|
|
|
3697
3700
|
</DropdownMenu.Root>
|
|
3698
3701
|
</Sidebar.MenuItem>
|
|
3699
3702
|
</Sidebar.Menu>
|
|
3700
|
-
`,
|
|
3703
|
+
`, Cr = `import { z } from 'zod/v3';
|
|
3701
3704
|
|
|
3702
3705
|
export const changeEmailSchema = z.object({
|
|
3703
3706
|
email: z.string().email()
|
|
3704
3707
|
});
|
|
3705
|
-
`,
|
|
3708
|
+
`, _r = `import { z } from 'zod/v3';
|
|
3706
3709
|
|
|
3707
3710
|
export const changePasswordSchema = z
|
|
3708
3711
|
.object({
|
|
@@ -3713,18 +3716,18 @@ export const changePasswordSchema = z
|
|
|
3713
3716
|
message: "Passwords don't match",
|
|
3714
3717
|
path: ['passwordConfirm']
|
|
3715
3718
|
});
|
|
3716
|
-
`,
|
|
3719
|
+
`, kr = `import { z } from 'zod/v3';
|
|
3717
3720
|
|
|
3718
3721
|
export const confirmEmailChangeSchema = z.object({
|
|
3719
3722
|
password: z.string()
|
|
3720
3723
|
});
|
|
3721
|
-
`,
|
|
3724
|
+
`, Rr = `import { z } from 'zod/v3';
|
|
3722
3725
|
|
|
3723
3726
|
export const confirmResetSchema = z.object({
|
|
3724
3727
|
password: z.string(),
|
|
3725
3728
|
passwordConfirm: z.string()
|
|
3726
3729
|
});
|
|
3727
|
-
`,
|
|
3730
|
+
`, Pr = `import { z } from 'zod/v3';
|
|
3728
3731
|
|
|
3729
3732
|
const otpSchema = z.object({
|
|
3730
3733
|
type: z.literal('otp'),
|
|
@@ -3743,12 +3746,12 @@ const oAuth2Schema = z.object({
|
|
|
3743
3746
|
});
|
|
3744
3747
|
|
|
3745
3748
|
export const loginSchema = z.discriminatedUnion('type', [otpSchema, passwordSchema, oAuth2Schema]);
|
|
3746
|
-
`,
|
|
3749
|
+
`, Er = `import { z } from 'zod/v3';
|
|
3747
3750
|
|
|
3748
3751
|
export const otpSchema = z.object({
|
|
3749
3752
|
otp: z.string()
|
|
3750
3753
|
});
|
|
3751
|
-
`,
|
|
3754
|
+
`, Ir = `import { z } from 'zod/v3';
|
|
3752
3755
|
|
|
3753
3756
|
export const profileSchema = z.object({
|
|
3754
3757
|
name: z.string().optional(),
|
|
@@ -3767,13 +3770,13 @@ export const signupSchema = z.object({
|
|
|
3767
3770
|
password: z.string(),
|
|
3768
3771
|
passwordConfirm: z.string()
|
|
3769
3772
|
});
|
|
3770
|
-
`,
|
|
3773
|
+
`, Br = `export const load = ({ locals }) => {
|
|
3771
3774
|
const user = locals.pb.authStore.record!;
|
|
3772
3775
|
const breadcrumbs = [{ title: 'Home', url: '/dashboard' }];
|
|
3773
3776
|
|
|
3774
3777
|
return { user, breadcrumbs };
|
|
3775
3778
|
};
|
|
3776
|
-
`,
|
|
3779
|
+
`, Dr = `<script lang="ts">
|
|
3777
3780
|
import * as Sidebar from '$lib/components/ui/sidebar';
|
|
3778
3781
|
import { Separator } from '$lib/components/ui/separator';
|
|
3779
3782
|
import AppSidebar from '$lib/components/app-sidebar.svelte';
|
|
@@ -3823,7 +3826,7 @@ export const signupSchema = z.object({
|
|
|
3823
3826
|
background-color: var(--color-sidebar);
|
|
3824
3827
|
}
|
|
3825
3828
|
</style>
|
|
3826
|
-
`,
|
|
3829
|
+
`, Tr = "", Ar = `import { describe, it, expect } from 'vitest';
|
|
3827
3830
|
import type { Match } from '@velastack/pocketbase';
|
|
3828
3831
|
import type { RouteId } from './$types';
|
|
3829
3832
|
|
|
@@ -3840,14 +3843,14 @@ describe('dashboard', () => {
|
|
|
3840
3843
|
expect(response.status).toBe(200);
|
|
3841
3844
|
});
|
|
3842
3845
|
});
|
|
3843
|
-
`,
|
|
3846
|
+
`, jr = `export const load = async ({ parent }) => {
|
|
3844
3847
|
const { breadcrumbs } = await parent();
|
|
3845
3848
|
|
|
3846
3849
|
return {
|
|
3847
3850
|
breadcrumbs: [...breadcrumbs, { title: 'Settings', url: '/settings' }]
|
|
3848
3851
|
};
|
|
3849
3852
|
};
|
|
3850
|
-
`,
|
|
3853
|
+
`, Nr = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
|
|
3851
3854
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
3852
3855
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
3853
3856
|
import { profileSchema } from '$lib/schemas/profile';
|
|
@@ -3916,7 +3919,7 @@ export const actions = {
|
|
|
3916
3919
|
return {};
|
|
3917
3920
|
}
|
|
3918
3921
|
};
|
|
3919
|
-
`,
|
|
3922
|
+
`, Or = `<script lang="ts">
|
|
3920
3923
|
import { untrack } from 'svelte';
|
|
3921
3924
|
import { superForm } from 'sveltekit-superforms';
|
|
3922
3925
|
import { zodClient } from 'sveltekit-superforms/adapters';
|
|
@@ -4194,7 +4197,7 @@ export const actions = {
|
|
|
4194
4197
|
</form>
|
|
4195
4198
|
</div>
|
|
4196
4199
|
</div>
|
|
4197
|
-
`,
|
|
4200
|
+
`, Lr = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
4198
4201
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4199
4202
|
import { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';
|
|
4200
4203
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4221,7 +4224,7 @@ export const actions = {
|
|
|
4221
4224
|
return redirect(303, '/login');
|
|
4222
4225
|
}
|
|
4223
4226
|
};
|
|
4224
|
-
`,
|
|
4227
|
+
`, qr = `<script lang="ts">
|
|
4225
4228
|
import { untrack } from 'svelte';
|
|
4226
4229
|
import { Button } from '$lib/components/ui/button';
|
|
4227
4230
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4289,7 +4292,7 @@ export const actions = {
|
|
|
4289
4292
|
</div>
|
|
4290
4293
|
</div>
|
|
4291
4294
|
</div>
|
|
4292
|
-
`,
|
|
4295
|
+
`, Vr = `import { describe, it, expect } from 'vitest';
|
|
4293
4296
|
import type { Match } from '@velastack/pocketbase';
|
|
4294
4297
|
import type { RouteId } from './$types';
|
|
4295
4298
|
|
|
@@ -4301,7 +4304,7 @@ describe('GET /confirm-email-change/[token]', () => {
|
|
|
4301
4304
|
expect(response.status).toBe(200);
|
|
4302
4305
|
});
|
|
4303
4306
|
});
|
|
4304
|
-
`,
|
|
4307
|
+
`, Ur = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
4305
4308
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4306
4309
|
import { confirmResetSchema } from '$lib/schemas/confirmReset';
|
|
4307
4310
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4330,7 +4333,7 @@ export const actions = {
|
|
|
4330
4333
|
return redirect(303, '/login');
|
|
4331
4334
|
}
|
|
4332
4335
|
};
|
|
4333
|
-
`,
|
|
4336
|
+
`, Hr = `<script lang="ts">
|
|
4334
4337
|
import { untrack } from 'svelte';
|
|
4335
4338
|
import { Button } from '$lib/components/ui/button';
|
|
4336
4339
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4414,7 +4417,7 @@ export const actions = {
|
|
|
4414
4417
|
</div>
|
|
4415
4418
|
</div>
|
|
4416
4419
|
</div>
|
|
4417
|
-
`,
|
|
4420
|
+
`, Gr = `import { describe, it, expect } from 'vitest';
|
|
4418
4421
|
import type { Match } from '@velastack/pocketbase';
|
|
4419
4422
|
import type { RouteId } from './$types';
|
|
4420
4423
|
|
|
@@ -4424,7 +4427,7 @@ describe('GET /confirm-reset/[token]', () => {
|
|
|
4424
4427
|
expect(response.status).toBe(200);
|
|
4425
4428
|
});
|
|
4426
4429
|
});
|
|
4427
|
-
`,
|
|
4430
|
+
`, Wr = `import { redirect } from '@sveltejs/kit';
|
|
4428
4431
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
4429
4432
|
|
|
4430
4433
|
export const GET = async ({ params, locals, cookies }) => {
|
|
@@ -4443,7 +4446,7 @@ export const GET = async ({ params, locals, cookies }) => {
|
|
|
4443
4446
|
setFlash({ type: 'toast', message }, cookies);
|
|
4444
4447
|
redirect(303, redirectPath);
|
|
4445
4448
|
};
|
|
4446
|
-
`,
|
|
4449
|
+
`, Jr = `import { describe, it, expect } from 'vitest';
|
|
4447
4450
|
import type { Match } from '@velastack/pocketbase';
|
|
4448
4451
|
import type { RouteId } from './$types';
|
|
4449
4452
|
|
|
@@ -4456,7 +4459,7 @@ describe('GET /confirm-verification/[token]', () => {
|
|
|
4456
4459
|
expect(response.headers['location']).toBe('/login');
|
|
4457
4460
|
});
|
|
4458
4461
|
});
|
|
4459
|
-
`,
|
|
4462
|
+
`, Zr = `import { fail, superValidate, message } from 'sveltekit-superforms';
|
|
4460
4463
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4461
4464
|
import { loginSchema } from '$lib/schemas/login';
|
|
4462
4465
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4517,7 +4520,7 @@ export const actions = {
|
|
|
4517
4520
|
redirect(303, redirectUrl);
|
|
4518
4521
|
}
|
|
4519
4522
|
};
|
|
4520
|
-
`,
|
|
4523
|
+
`, Kr = `<script lang="ts">
|
|
4521
4524
|
import { untrack } from 'svelte';
|
|
4522
4525
|
import { Button } from '$lib/components/ui/button';
|
|
4523
4526
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4700,7 +4703,7 @@ export const actions = {
|
|
|
4700
4703
|
</div>
|
|
4701
4704
|
</div>
|
|
4702
4705
|
</div>
|
|
4703
|
-
`,
|
|
4706
|
+
`, Xr = `import { describe, it, expect } from 'vitest';
|
|
4704
4707
|
import * as devalue from 'devalue';
|
|
4705
4708
|
import type { Match } from '@velastack/pocketbase';
|
|
4706
4709
|
import type { RouteId } from './$types';
|
|
@@ -4747,14 +4750,14 @@ describe('POST /login', () => {
|
|
|
4747
4750
|
expect(data.form.message.text).toBe('Failed to authenticate.');
|
|
4748
4751
|
});
|
|
4749
4752
|
});
|
|
4750
|
-
`,
|
|
4753
|
+
`, Yr = `import { redirect } from '@sveltejs/kit';
|
|
4751
4754
|
|
|
4752
4755
|
export const POST = ({ cookies, locals }) => {
|
|
4753
4756
|
locals.pb.authStore.clear();
|
|
4754
4757
|
locals.pb.authStore.clearCookie(cookies);
|
|
4755
4758
|
throw redirect(303, '/');
|
|
4756
4759
|
};
|
|
4757
|
-
`,
|
|
4760
|
+
`, Qr = `import { describe, it, expect } from 'vitest';
|
|
4758
4761
|
import type { Match } from '@velastack/pocketbase';
|
|
4759
4762
|
import type { RouteId } from './$types';
|
|
4760
4763
|
|
|
@@ -4766,7 +4769,7 @@ describe('POST /logout', () => {
|
|
|
4766
4769
|
expect(response.headers.location).toBe('/');
|
|
4767
4770
|
});
|
|
4768
4771
|
});
|
|
4769
|
-
`,
|
|
4772
|
+
`, ta = `import { fail, message, superValidate } from 'sveltekit-superforms';
|
|
4770
4773
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4771
4774
|
import { otpSchema } from '$lib/schemas/otp';
|
|
4772
4775
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4807,7 +4810,7 @@ export const actions = {
|
|
|
4807
4810
|
redirect(303, redirectUrl);
|
|
4808
4811
|
}
|
|
4809
4812
|
};
|
|
4810
|
-
`,
|
|
4813
|
+
`, ea = `<script lang="ts">
|
|
4811
4814
|
import { untrack } from 'svelte';
|
|
4812
4815
|
import { Button } from '$lib/components/ui/button';
|
|
4813
4816
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4873,7 +4876,7 @@ export const actions = {
|
|
|
4873
4876
|
</div>
|
|
4874
4877
|
</div>
|
|
4875
4878
|
</div>
|
|
4876
|
-
`,
|
|
4879
|
+
`, na = `import { describe, it, expect } from 'vitest';
|
|
4877
4880
|
import type { Match } from '@velastack/pocketbase';
|
|
4878
4881
|
import type { RouteId } from './$types';
|
|
4879
4882
|
|
|
@@ -4893,7 +4896,7 @@ describe('POST /otp/[token]', () => {
|
|
|
4893
4896
|
expect(response.body.status).toBe(400);
|
|
4894
4897
|
});
|
|
4895
4898
|
});
|
|
4896
|
-
`,
|
|
4899
|
+
`, ra = `import { fail, superValidate } from 'sveltekit-superforms';
|
|
4897
4900
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
4898
4901
|
import { resetSchema } from '$lib/schemas/reset';
|
|
4899
4902
|
import { redirect } from '@sveltejs/kit';
|
|
@@ -4921,7 +4924,7 @@ export const actions = {
|
|
|
4921
4924
|
return { form };
|
|
4922
4925
|
}
|
|
4923
4926
|
};
|
|
4924
|
-
`,
|
|
4927
|
+
`, aa = `<script lang="ts">
|
|
4925
4928
|
import { untrack } from 'svelte';
|
|
4926
4929
|
import { Button } from '$lib/components/ui/button';
|
|
4927
4930
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -4988,7 +4991,7 @@ export const actions = {
|
|
|
4988
4991
|
</div>
|
|
4989
4992
|
</div>
|
|
4990
4993
|
</div>
|
|
4991
|
-
`,
|
|
4994
|
+
`, oa = `import { describe, it, expect } from 'vitest';
|
|
4992
4995
|
import type { Match } from '@velastack/pocketbase';
|
|
4993
4996
|
import type { RouteId } from './$types';
|
|
4994
4997
|
|
|
@@ -5008,7 +5011,7 @@ describe('POST /reset', () => {
|
|
|
5008
5011
|
expect(response.body.status).toBe(200);
|
|
5009
5012
|
});
|
|
5010
5013
|
});
|
|
5011
|
-
`,
|
|
5014
|
+
`, sa = `import { redirect } from '@sveltejs/kit';
|
|
5012
5015
|
import { fail, superValidate } from 'sveltekit-superforms';
|
|
5013
5016
|
import { zod } from 'sveltekit-superforms/adapters';
|
|
5014
5017
|
import { setFlash } from 'sveltekit-flash-message/server';
|
|
@@ -5064,7 +5067,7 @@ export const actions = {
|
|
|
5064
5067
|
return redirect(303, redirectUrl);
|
|
5065
5068
|
}
|
|
5066
5069
|
};
|
|
5067
|
-
`,
|
|
5070
|
+
`, ia = `<script lang="ts">
|
|
5068
5071
|
import { untrack } from 'svelte';
|
|
5069
5072
|
import { Button } from '$lib/components/ui/button';
|
|
5070
5073
|
import * as Card from '$lib/components/ui/card';
|
|
@@ -5231,7 +5234,7 @@ export const actions = {
|
|
|
5231
5234
|
</div>
|
|
5232
5235
|
</div>
|
|
5233
5236
|
</div>
|
|
5234
|
-
`,
|
|
5237
|
+
`, la = `import { describe, it, expect } from 'vitest';
|
|
5235
5238
|
import type { Match } from '@velastack/pocketbase';
|
|
5236
5239
|
import * as devalue from 'devalue';
|
|
5237
5240
|
import type { RouteId } from './$types';
|
|
@@ -5287,58 +5290,58 @@ describe('POST /signup', () => {
|
|
|
5287
5290
|
expect(data.form.errors.email[0]).toBe('Value must be unique.');
|
|
5288
5291
|
});
|
|
5289
5292
|
});
|
|
5290
|
-
`,
|
|
5291
|
-
"./creates/src/lib/components/app-sidebar.svelte":
|
|
5292
|
-
"./creates/src/lib/components/nav-main.svelte":
|
|
5293
|
-
"./creates/src/lib/components/nav-user.svelte":
|
|
5294
|
-
"./creates/src/lib/schemas/changeEmail.ts":
|
|
5295
|
-
"./creates/src/lib/schemas/changePassword.ts":
|
|
5296
|
-
"./creates/src/lib/schemas/confirmEmailChange.ts":
|
|
5297
|
-
"./creates/src/lib/schemas/confirmReset.ts":
|
|
5298
|
-
"./creates/src/lib/schemas/login.ts":
|
|
5299
|
-
"./creates/src/lib/schemas/otp.ts":
|
|
5300
|
-
"./creates/src/lib/schemas/profile.ts":
|
|
5293
|
+
`, ca = /* @__PURE__ */ Object.assign({
|
|
5294
|
+
"./creates/src/lib/components/app-sidebar.svelte": xr,
|
|
5295
|
+
"./creates/src/lib/components/nav-main.svelte": Fr,
|
|
5296
|
+
"./creates/src/lib/components/nav-user.svelte": Sr,
|
|
5297
|
+
"./creates/src/lib/schemas/changeEmail.ts": Cr,
|
|
5298
|
+
"./creates/src/lib/schemas/changePassword.ts": _r,
|
|
5299
|
+
"./creates/src/lib/schemas/confirmEmailChange.ts": kr,
|
|
5300
|
+
"./creates/src/lib/schemas/confirmReset.ts": Rr,
|
|
5301
|
+
"./creates/src/lib/schemas/login.ts": Pr,
|
|
5302
|
+
"./creates/src/lib/schemas/otp.ts": Er,
|
|
5303
|
+
"./creates/src/lib/schemas/profile.ts": Ir,
|
|
5301
5304
|
"./creates/src/lib/schemas/reset.ts": zr,
|
|
5302
5305
|
"./creates/src/lib/schemas/signup.ts": Mr,
|
|
5303
|
-
"./creates/src/routes/(app)/+layout.server.ts":
|
|
5304
|
-
"./creates/src/routes/(app)/+layout.svelte":
|
|
5305
|
-
"./creates/src/routes/(app)/dashboard/+page.svelte":
|
|
5306
|
-
"./creates/src/routes/(app)/dashboard/server.test.ts":
|
|
5307
|
-
"./creates/src/routes/(app)/settings/+layout.server.ts":
|
|
5308
|
-
"./creates/src/routes/(app)/settings/+page.server.ts":
|
|
5309
|
-
"./creates/src/routes/(app)/settings/+page.svelte":
|
|
5310
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts":
|
|
5311
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte":
|
|
5312
|
-
"./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts":
|
|
5313
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts":
|
|
5314
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte":
|
|
5315
|
-
"./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts":
|
|
5316
|
-
"./creates/src/routes/(public)/confirm-verification/[token]/+server.ts":
|
|
5317
|
-
"./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts":
|
|
5318
|
-
"./creates/src/routes/(public)/login/+page.server.ts":
|
|
5319
|
-
"./creates/src/routes/(public)/login/+page.svelte":
|
|
5320
|
-
"./creates/src/routes/(public)/login/server.test.ts":
|
|
5321
|
-
"./creates/src/routes/(public)/logout/+server.ts":
|
|
5322
|
-
"./creates/src/routes/(public)/logout/server.test.ts":
|
|
5323
|
-
"./creates/src/routes/(public)/otp/[token]/+page.server.ts":
|
|
5324
|
-
"./creates/src/routes/(public)/otp/[token]/+page.svelte":
|
|
5325
|
-
"./creates/src/routes/(public)/otp/[token]/server.test.ts":
|
|
5326
|
-
"./creates/src/routes/(public)/reset/+page.server.ts":
|
|
5327
|
-
"./creates/src/routes/(public)/reset/+page.svelte":
|
|
5328
|
-
"./creates/src/routes/(public)/reset/server.test.ts":
|
|
5329
|
-
"./creates/src/routes/(public)/signup/+page.server.ts":
|
|
5330
|
-
"./creates/src/routes/(public)/signup/+page.svelte":
|
|
5331
|
-
"./creates/src/routes/(public)/signup/server.test.ts":
|
|
5332
|
-
}),
|
|
5333
|
-
async function
|
|
5334
|
-
const e = Object.entries(
|
|
5335
|
-
const i =
|
|
5306
|
+
"./creates/src/routes/(app)/+layout.server.ts": Br,
|
|
5307
|
+
"./creates/src/routes/(app)/+layout.svelte": Dr,
|
|
5308
|
+
"./creates/src/routes/(app)/dashboard/+page.svelte": Tr,
|
|
5309
|
+
"./creates/src/routes/(app)/dashboard/server.test.ts": Ar,
|
|
5310
|
+
"./creates/src/routes/(app)/settings/+layout.server.ts": jr,
|
|
5311
|
+
"./creates/src/routes/(app)/settings/+page.server.ts": Nr,
|
|
5312
|
+
"./creates/src/routes/(app)/settings/+page.svelte": Or,
|
|
5313
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Lr,
|
|
5314
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": qr,
|
|
5315
|
+
"./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Vr,
|
|
5316
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": Ur,
|
|
5317
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Hr,
|
|
5318
|
+
"./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Gr,
|
|
5319
|
+
"./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": Wr,
|
|
5320
|
+
"./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Jr,
|
|
5321
|
+
"./creates/src/routes/(public)/login/+page.server.ts": Zr,
|
|
5322
|
+
"./creates/src/routes/(public)/login/+page.svelte": Kr,
|
|
5323
|
+
"./creates/src/routes/(public)/login/server.test.ts": Xr,
|
|
5324
|
+
"./creates/src/routes/(public)/logout/+server.ts": Yr,
|
|
5325
|
+
"./creates/src/routes/(public)/logout/server.test.ts": Qr,
|
|
5326
|
+
"./creates/src/routes/(public)/otp/[token]/+page.server.ts": ta,
|
|
5327
|
+
"./creates/src/routes/(public)/otp/[token]/+page.svelte": ea,
|
|
5328
|
+
"./creates/src/routes/(public)/otp/[token]/server.test.ts": na,
|
|
5329
|
+
"./creates/src/routes/(public)/reset/+page.server.ts": ra,
|
|
5330
|
+
"./creates/src/routes/(public)/reset/+page.svelte": aa,
|
|
5331
|
+
"./creates/src/routes/(public)/reset/server.test.ts": oa,
|
|
5332
|
+
"./creates/src/routes/(public)/signup/+page.server.ts": sa,
|
|
5333
|
+
"./creates/src/routes/(public)/signup/+page.svelte": ia,
|
|
5334
|
+
"./creates/src/routes/(public)/signup/server.test.ts": la
|
|
5335
|
+
}), ma = "./creates/";
|
|
5336
|
+
async function ua(t) {
|
|
5337
|
+
const e = Object.entries(ca).map(([a, s]) => {
|
|
5338
|
+
const i = G(a, ma);
|
|
5336
5339
|
return {
|
|
5337
5340
|
path: i,
|
|
5338
|
-
language:
|
|
5341
|
+
language: P(i),
|
|
5339
5342
|
content: s
|
|
5340
5343
|
};
|
|
5341
|
-
}).sort((
|
|
5344
|
+
}).sort((a, s) => a.path.localeCompare(s.path)), n = [
|
|
5342
5345
|
"sidebar",
|
|
5343
5346
|
"breadcrumb",
|
|
5344
5347
|
"separator",
|
|
@@ -5423,7 +5426,7 @@ async function ca(t) {
|
|
|
5423
5426
|
]
|
|
5424
5427
|
};
|
|
5425
5428
|
}
|
|
5426
|
-
const
|
|
5429
|
+
const da = `import {
|
|
5427
5430
|
POCKETBASE_URL,
|
|
5428
5431
|
POCKETBASE_SUPERUSER_EMAIL,
|
|
5429
5432
|
POCKETBASE_SUPERUSER_PASSWORD,
|
|
@@ -5437,7 +5440,7 @@ export const handle = handlePocketbase({
|
|
|
5437
5440
|
// [!code highlight:1]
|
|
5438
5441
|
auth: { protectedRoutes: ["/(app)"] },
|
|
5439
5442
|
});
|
|
5440
|
-
`,
|
|
5443
|
+
`, pa = `<script lang="ts">
|
|
5441
5444
|
import { toggleMode } from "mode-watcher";
|
|
5442
5445
|
import * as Navbar from "$lib/components/ui/navbar";
|
|
5443
5446
|
import { Button } from "$lib/components/ui/button";
|
|
@@ -5467,7 +5470,7 @@ export const handle = handlePocketbase({
|
|
|
5467
5470
|
</Button>
|
|
5468
5471
|
</Navbar.Item>
|
|
5469
5472
|
|
|
5470
|
-
<!-- [!code highlight:
|
|
5473
|
+
<!-- [!code highlight:44] -->
|
|
5471
5474
|
<Navbar.Item
|
|
5472
5475
|
class="flex flex-col md:flex-row items-center space-y-2 md:space-y-0 md:space-x-4"
|
|
5473
5476
|
>
|
|
@@ -5486,7 +5489,6 @@ export const handle = handlePocketbase({
|
|
|
5486
5489
|
</Avatar.Fallback>
|
|
5487
5490
|
</Avatar.Root>
|
|
5488
5491
|
</AuthMenu.Trigger>
|
|
5489
|
-
|
|
5490
5492
|
<AuthMenu.Content align="end">
|
|
5491
5493
|
<AuthMenu.Item href="/dashboard">Dashboard</AuthMenu.Item>
|
|
5492
5494
|
<AuthMenu.Group>
|
|
@@ -5499,7 +5501,6 @@ export const handle = handlePocketbase({
|
|
|
5499
5501
|
</AuthMenu.Group>
|
|
5500
5502
|
</AuthMenu.Content>
|
|
5501
5503
|
{/snippet}
|
|
5502
|
-
|
|
5503
5504
|
{#snippet guest()}
|
|
5504
5505
|
<Button
|
|
5505
5506
|
class="w-full justify-start md:justify-center md:w-auto"
|
|
@@ -5546,7 +5547,7 @@ export const handle = handlePocketbase({
|
|
|
5546
5547
|
@apply container mx-auto max-w-7xl px-4 py-8 w-full;
|
|
5547
5548
|
}
|
|
5548
5549
|
</style>
|
|
5549
|
-
`,
|
|
5550
|
+
`, fa = `import { loadFlash } from "sveltekit-flash-message/server";
|
|
5550
5551
|
|
|
5551
5552
|
export const load = loadFlash(async ({ locals }) => {
|
|
5552
5553
|
return {
|
|
@@ -5554,17 +5555,17 @@ export const load = loadFlash(async ({ locals }) => {
|
|
|
5554
5555
|
user: locals.pb.authStore.record,
|
|
5555
5556
|
};
|
|
5556
5557
|
});
|
|
5557
|
-
`,
|
|
5558
|
-
"./preview-modifies/src/hooks.server.ts":
|
|
5559
|
-
"./preview-modifies/src/routes/(public)/root-layout.svelte":
|
|
5560
|
-
"./preview-modifies/src/routes/+layout.server.ts":
|
|
5561
|
-
}),
|
|
5562
|
-
async function
|
|
5563
|
-
const e = Object.entries(
|
|
5564
|
-
const
|
|
5558
|
+
`, ga = /* @__PURE__ */ Object.assign({
|
|
5559
|
+
"./preview-modifies/src/hooks.server.ts": da,
|
|
5560
|
+
"./preview-modifies/src/routes/(public)/root-layout.svelte": pa,
|
|
5561
|
+
"./preview-modifies/src/routes/+layout.server.ts": fa
|
|
5562
|
+
}), ha = "./preview-modifies/";
|
|
5563
|
+
async function ba(t) {
|
|
5564
|
+
const e = Object.entries(ga).map(([n, r]) => {
|
|
5565
|
+
const a = G(n, ha);
|
|
5565
5566
|
return {
|
|
5566
|
-
path:
|
|
5567
|
-
language:
|
|
5567
|
+
path: a,
|
|
5568
|
+
language: P(a),
|
|
5568
5569
|
content: r
|
|
5569
5570
|
};
|
|
5570
5571
|
}).sort((n, r) => n.path.localeCompare(r.path));
|
|
@@ -5577,24 +5578,24 @@ async function ga(t) {
|
|
|
5577
5578
|
collections: []
|
|
5578
5579
|
};
|
|
5579
5580
|
}
|
|
5580
|
-
const
|
|
5581
|
-
async function
|
|
5582
|
-
const e = await
|
|
5581
|
+
const va = "enable-auth", wa = "1.0.7", ya = "src/patterns/enable/auth", $a = "/enable/auth";
|
|
5582
|
+
async function xa(t) {
|
|
5583
|
+
const e = await ua(t);
|
|
5583
5584
|
if (t.env === "preview") {
|
|
5584
|
-
const s = await
|
|
5585
|
-
return
|
|
5585
|
+
const s = await ba();
|
|
5586
|
+
return S(H([e, s]));
|
|
5586
5587
|
}
|
|
5587
|
-
const { generate: n } = await import("./generate.runtime-
|
|
5588
|
-
return
|
|
5589
|
-
await
|
|
5588
|
+
const { generate: n } = await import("./generate.runtime-5EvPE9YS.js"), r = await n(t), { writeResult: a } = await import("./write-result-CbUTMeAc.js");
|
|
5589
|
+
return a(
|
|
5590
|
+
await S(H([e, r])),
|
|
5590
5591
|
t
|
|
5591
5592
|
);
|
|
5592
5593
|
}
|
|
5593
|
-
const
|
|
5594
|
-
version:
|
|
5595
|
-
slug:
|
|
5596
|
-
source:
|
|
5597
|
-
docs:
|
|
5594
|
+
const Fa = {
|
|
5595
|
+
version: wa,
|
|
5596
|
+
slug: va,
|
|
5597
|
+
source: ya,
|
|
5598
|
+
docs: $a,
|
|
5598
5599
|
plan: "open",
|
|
5599
5600
|
title: "Enable authentication",
|
|
5600
5601
|
summary: "Enables authentication.",
|
|
@@ -5602,7 +5603,7 @@ const $a = {
|
|
|
5602
5603
|
auth: !1,
|
|
5603
5604
|
payments: !1
|
|
5604
5605
|
},
|
|
5605
|
-
|
|
5606
|
+
category: "auth",
|
|
5606
5607
|
tags: [
|
|
5607
5608
|
"sveltekit",
|
|
5608
5609
|
"authentication",
|
|
@@ -5617,25 +5618,128 @@ const $a = {
|
|
|
5617
5618
|
argv: []
|
|
5618
5619
|
},
|
|
5619
5620
|
baseline: "velastack",
|
|
5620
|
-
generate:
|
|
5621
|
-
},
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5621
|
+
generate: xa
|
|
5622
|
+
}, Sa = `import { describe, expect, it } from "vitest";
|
|
5623
|
+
|
|
5624
|
+
describe("GET /api/health", () => {
|
|
5625
|
+
it("should return a 200 status code", async (context) => {
|
|
5626
|
+
const response = await context.request.get("/api/health");
|
|
5627
|
+
expect(response.status).toBe(200);
|
|
5628
|
+
});
|
|
5629
|
+
});
|
|
5630
|
+
`, Ca = /* @__PURE__ */ Object.assign({
|
|
5631
|
+
"./creates/src/routes/api/server.test.ts": Sa
|
|
5632
|
+
}), _a = "./creates/";
|
|
5633
|
+
async function ka(t) {
|
|
5634
|
+
return {
|
|
5635
|
+
creates: Object.entries(Ca).map(([n, r]) => {
|
|
5636
|
+
const a = G(n, _a);
|
|
5637
|
+
return {
|
|
5638
|
+
path: a,
|
|
5639
|
+
language: P(a),
|
|
5640
|
+
content: r
|
|
5641
|
+
};
|
|
5642
|
+
}).sort((n, r) => n.path.localeCompare(r.path)),
|
|
5643
|
+
modifies: [],
|
|
5644
|
+
deletes: [],
|
|
5645
|
+
components: [],
|
|
5646
|
+
packages: [],
|
|
5647
|
+
collections: []
|
|
5648
|
+
};
|
|
5649
|
+
}
|
|
5650
|
+
const Ra = `import {
|
|
5651
|
+
POCKETBASE_URL,
|
|
5652
|
+
POCKETBASE_SUPERUSER_EMAIL,
|
|
5653
|
+
POCKETBASE_SUPERUSER_PASSWORD,
|
|
5654
|
+
} from "$env/static/private";
|
|
5655
|
+
import { handlePocketbase } from "@velastack/pocketbase";
|
|
5656
|
+
|
|
5657
|
+
export const handle = handlePocketbase({
|
|
5658
|
+
pocketbaseUrl: POCKETBASE_URL,
|
|
5659
|
+
superuserEmail: POCKETBASE_SUPERUSER_EMAIL,
|
|
5660
|
+
superuserPassword: POCKETBASE_SUPERUSER_PASSWORD,
|
|
5661
|
+
// [!code highlight:1]
|
|
5662
|
+
api: { enabled: true },
|
|
5663
|
+
});
|
|
5664
|
+
`, Pa = /* @__PURE__ */ Object.assign({
|
|
5665
|
+
"./preview-modifies/src/hooks.server.ts": Ra
|
|
5666
|
+
}), Ea = "./preview-modifies/";
|
|
5667
|
+
async function Ia(t) {
|
|
5668
|
+
const e = Object.entries(Pa).map(([n, r]) => {
|
|
5669
|
+
const a = G(n, Ea);
|
|
5670
|
+
return {
|
|
5671
|
+
path: a,
|
|
5672
|
+
language: P(a),
|
|
5673
|
+
content: r
|
|
5674
|
+
};
|
|
5675
|
+
}).sort((n, r) => n.path.localeCompare(r.path));
|
|
5676
|
+
return {
|
|
5677
|
+
creates: [],
|
|
5678
|
+
modifies: e,
|
|
5679
|
+
deletes: [],
|
|
5680
|
+
components: [],
|
|
5681
|
+
packages: [],
|
|
5682
|
+
collections: []
|
|
5683
|
+
};
|
|
5684
|
+
}
|
|
5685
|
+
const za = "enable-api", Ma = "1.0.7", Ba = "src/patterns/enable/api", Da = "/enable/api";
|
|
5686
|
+
async function Ta(t) {
|
|
5687
|
+
const e = await ka();
|
|
5688
|
+
if (t.env === "preview") {
|
|
5689
|
+
const s = await Ia();
|
|
5690
|
+
return S(H([e, s]));
|
|
5691
|
+
}
|
|
5692
|
+
const { generate: n } = await import("./generate.runtime-C7g-zL0o.js"), r = await n(t), { writeResult: a } = await import("./write-result-CbUTMeAc.js");
|
|
5693
|
+
return a(
|
|
5694
|
+
await S(H([e, r])),
|
|
5695
|
+
t
|
|
5696
|
+
);
|
|
5697
|
+
}
|
|
5698
|
+
const Aa = {
|
|
5699
|
+
version: Ma,
|
|
5700
|
+
slug: za,
|
|
5701
|
+
source: Ba,
|
|
5702
|
+
docs: Da,
|
|
5703
|
+
plan: "open",
|
|
5704
|
+
title: "Enable API",
|
|
5705
|
+
summary: "Enables the PocketBase API.",
|
|
5706
|
+
requires: {
|
|
5707
|
+
auth: !1,
|
|
5708
|
+
payments: !1
|
|
5709
|
+
},
|
|
5710
|
+
category: "api",
|
|
5711
|
+
tags: ["sveltekit", "api", "rest", "backend", "pocketbase", "velastack"],
|
|
5712
|
+
command: {
|
|
5713
|
+
raw: "vela enable api",
|
|
5714
|
+
base: "vela enable api",
|
|
5715
|
+
argv: []
|
|
5716
|
+
},
|
|
5717
|
+
baseline: "velastack",
|
|
5718
|
+
generate: Ta
|
|
5719
|
+
}, Va = ne.version, Jt = [
|
|
5720
|
+
En,
|
|
5721
|
+
$r,
|
|
5722
|
+
Gn,
|
|
5723
|
+
ur,
|
|
5724
|
+
Fa,
|
|
5725
|
+
Aa
|
|
5726
|
+
], Ua = Object.fromEntries(
|
|
5628
5727
|
Jt.map((t) => [t.slug, t])
|
|
5629
|
-
),
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
}
|
|
5728
|
+
), Ha = Jt.reduce(
|
|
5729
|
+
(t, e) => {
|
|
5730
|
+
const n = e.category;
|
|
5731
|
+
return t[n] ?? (t[n] = []), t[n].push(e), t;
|
|
5732
|
+
},
|
|
5733
|
+
{}
|
|
5734
|
+
);
|
|
5634
5735
|
export {
|
|
5635
|
-
|
|
5636
|
-
|
|
5736
|
+
La as D,
|
|
5737
|
+
qa as M,
|
|
5738
|
+
Ua as a,
|
|
5739
|
+
Ha as b,
|
|
5637
5740
|
d,
|
|
5638
|
-
|
|
5639
|
-
|
|
5741
|
+
P as l,
|
|
5742
|
+
Jt as p,
|
|
5743
|
+
Va as v
|
|
5640
5744
|
};
|
|
5641
|
-
//# sourceMappingURL=index-
|
|
5745
|
+
//# sourceMappingURL=index-Dav9F9Qf.js.map
|