@velastack/patterns 0.0.13 → 0.0.14

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.
@@ -1,10 +1,13 @@
1
1
  import Qt from "prettier";
2
2
  import te from "prettier-plugin-svelte";
3
- function ee(t) {
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 ne(t) {
7
- if (!ee(t))
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, {
@@ -20,7 +23,7 @@ async function ne(t) {
20
23
  }
21
24
  }
22
25
  async function ct(t) {
23
- return Promise.all(t.map((e) => ne(e)));
26
+ return Promise.all(t.map((e) => ae(e)));
24
27
  }
25
28
  async function k(t) {
26
29
  const [e, n] = await Promise.all([
@@ -47,21 +50,21 @@ function ut(t) {
47
50
  for (var e = 1; e < arguments.length; e++) {
48
51
  var n = arguments[e] != null ? arguments[e] : {};
49
52
  e % 2 ? mt(Object(n), !0).forEach(function(r) {
50
- re(t, r, n[r]);
53
+ oe(t, r, n[r]);
51
54
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : mt(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 re(t, e, n) {
58
- return e = ae(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
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 ae(t) {
61
- var e = oe(t, "string");
63
+ function se(t) {
64
+ var e = ie(t, "string");
62
65
  return typeof e == "symbol" ? e : String(e);
63
66
  }
64
- function oe(t, e) {
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) {
@@ -84,7 +87,7 @@ function zt(t) {
84
87
  for (let f = 0; f < o.length; f++) {
85
88
  let h = o[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 ? se(r[f], c) : r[f];
90
+ const $ = s ? le(r[f], c) : r[f];
88
91
  c += $;
89
92
  }
90
93
  }
@@ -115,7 +118,7 @@ function zt(t) {
115
118
  )), c;
116
119
  }
117
120
  }
118
- function se(t, e) {
121
+ function le(t, e) {
119
122
  if (typeof t != "string" || !t.includes(`
120
123
  `))
121
124
  return t;
@@ -147,7 +150,7 @@ function dt(t) {
147
150
  }
148
151
  );
149
152
  }
150
- const ie = {
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
- }, le = {
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: [
@@ -204,7 +207,7 @@ function B(t, e) {
204
207
  </Form.Field>
205
208
  `;
206
209
  }
207
- function ce(t) {
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">
@@ -218,7 +221,7 @@ function ce(t) {
218
221
  </Form.Field>
219
222
  `;
220
223
  }
221
- function me(t) {
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">
@@ -232,7 +235,7 @@ function me(t) {
232
235
  </Form.Field>
233
236
  `;
234
237
  }
235
- function ue(t) {
238
+ function pe(t) {
236
239
  return d`
237
240
  <Form.Field {form} name="${t.name}" class="col-span-1">
238
241
  <Form.Control>
@@ -245,7 +248,7 @@ function ue(t) {
245
248
  </Form.Field>
246
249
  `;
247
250
  }
248
- function de(t) {
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">
@@ -272,7 +275,7 @@ function de(t) {
272
275
  </FileForm.Field>
273
276
  `;
274
277
  }
275
- function pe(t) {
278
+ function ge(t) {
276
279
  const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", r = t.maxSelect > 1 ? "Select options" : "Select an option", o = 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(`
@@ -310,7 +313,7 @@ function pe(t) {
310
313
  </MultiSelect.Field>
311
314
  `;
312
315
  }
313
- function fe(t) {
316
+ function he(t) {
314
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()}...`, o = `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">
@@ -348,7 +351,7 @@ function fe(t) {
348
351
  </MultiSelect.Field>
349
352
  `;
350
353
  }
351
- function ge(t) {
354
+ function be(t) {
352
355
  return d`
353
356
  <Form.Field {form} name="${t.name}" class="col-span-1">
354
357
  <Form.Control>
@@ -376,20 +379,20 @@ function et(t) {
376
379
  case "url":
377
380
  return B(t, "url");
378
381
  case "autodate":
379
- return ge(t);
382
+ return be(t);
380
383
  case "editor":
381
384
  case "json":
382
- return ce(t);
385
+ return ue(t);
383
386
  case "bool":
384
- return me(t);
387
+ return de(t);
385
388
  case "geoPoint":
386
- return ue(t);
389
+ return pe(t);
387
390
  case "file":
388
- return de(t);
391
+ return fe(t);
389
392
  case "select":
390
- return pe(t);
393
+ return ge(t);
391
394
  case "relation":
392
- return fe(t);
395
+ return he(t);
393
396
  default:
394
397
  return t;
395
398
  }
@@ -411,11 +414,11 @@ function It(t) {
411
414
  `;
412
415
  }
413
416
  function O(t) {
414
- const e = t.flatMap((n) => ie[n.type]);
417
+ const e = t.flatMap((n) => ce[n.type]);
415
418
  return [...new Set(e)];
416
419
  }
417
420
  function nt(t) {
418
- return [...new Set(t.flatMap((e) => le[e]))];
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}`;
@@ -428,7 +431,7 @@ function Y(t, e, n) {
428
431
  </div>
429
432
  `;
430
433
  }
431
- function he(t, e) {
434
+ function ve(t, e) {
432
435
  const n = R(t, e), r = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, o = e.required ? r : d`
433
436
  {#if ${n}}
434
437
  ${r}
@@ -441,7 +444,7 @@ function he(t, e) {
441
444
  </div>
442
445
  `;
443
446
  }
444
- function be(t, e) {
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}}
@@ -460,7 +463,7 @@ function be(t, e) {
460
463
  </div>
461
464
  `;
462
465
  }
463
- function ve(t, e) {
466
+ function ye(t, e) {
464
467
  const n = R(t, e);
465
468
  if (e.maxSelect > 1)
466
469
  return d`
@@ -483,7 +486,7 @@ function ve(t, e) {
483
486
  </div>
484
487
  `;
485
488
  }
486
- function we(t, e) {
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 ye(t) {
535
+ function xe(t) {
533
536
  return `/${t.relatedModel.routeSegment}`;
534
537
  }
535
- function $e(t, e) {
536
- const n = `data.${t.name}.expand?.${e.name}`, r = ye(e);
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 xe(t, e) {
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>
@@ -582,7 +585,7 @@ function xe(t, e) {
582
585
  </div>
583
586
  `;
584
587
  }
585
- function Fe(t, e) {
588
+ function Ce(t, e) {
586
589
  switch (e.type) {
587
590
  case "text":
588
591
  case "number":
@@ -606,27 +609,27 @@ function Fe(t, e) {
606
609
  );
607
610
  case "date":
608
611
  case "autodate":
609
- return he(t, e);
612
+ return ve(t, e);
610
613
  case "url":
611
- return be(t, e);
614
+ return we(t, e);
612
615
  case "select":
613
- return ve(t, e);
616
+ return ye(t, e);
614
617
  case "file":
615
- return we(t, e);
618
+ return $e(t, e);
616
619
  case "json":
617
620
  return Y(t, e, `{JSON.stringify(${R(t, e)})}`);
618
621
  case "geoPoint":
619
- return xe(t, e);
622
+ return Se(t, e);
620
623
  case "relation":
621
- return $e(t, e);
624
+ return Fe(t, e);
622
625
  default:
623
626
  return e;
624
627
  }
625
628
  }
626
- const Se = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), Ce = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), _e = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), ke = /[^\p{L}\d]+/giu, pt = "$1\0$2", ft = "";
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, pt = "$1\0$2", ft = "";
627
630
  function Et(t) {
628
631
  let e = t.trim();
629
- e = e.replace(Se, pt).replace(Ce, pt), e = e.replace(ke, "\0");
632
+ e = e.replace(_e, pt).replace(ke, pt), e = e.replace(Pe, "\0");
630
633
  let n = 0, r = e.length;
631
634
  for (; e.charAt(n) === "\0"; )
632
635
  n++;
@@ -636,10 +639,10 @@ function Et(t) {
636
639
  r--;
637
640
  return e.slice(n, r).split(/\0/g);
638
641
  }
639
- function Re(t) {
642
+ function ze(t) {
640
643
  const e = Et(t);
641
644
  for (let n = 0; n < e.length; n++) {
642
- const r = e[n], o = _e.exec(r);
645
+ const r = e[n], o = Re.exec(r);
643
646
  if (o) {
644
647
  const s = o.index + (o[1] ?? o[2]).length;
645
648
  e.splice(n, 1, r.slice(0, s), r.slice(s));
@@ -655,18 +658,18 @@ function A(t, e) {
655
658
  const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), a = Dt(s, i);
656
659
  return n + r.map((c, m) => m === 0 ? s(c) : a(c, m)).join("") + o;
657
660
  }
658
- function Pe(t, e) {
661
+ function Me(t, e) {
659
662
  const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), a = Dt(s, i);
660
663
  return n + r.map(a).join("") + o;
661
664
  }
662
665
  function rt(t, e) {
663
666
  const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale);
664
- return n + r.map(Ie(s, i)).join(" ") + o;
667
+ return n + r.map(Be(s, i)).join(" ") + o;
665
668
  }
666
- function ze(t, e) {
669
+ function Ie(t, e) {
667
670
  return Bt(t, { delimiter: "-", ...e });
668
671
  }
669
- function Me(t, e) {
672
+ function Ee(t, e) {
670
673
  return Bt(t, { delimiter: "_", ...e });
671
674
  }
672
675
  function H(t) {
@@ -675,7 +678,7 @@ function H(t) {
675
678
  function at(t) {
676
679
  return (e) => e.toLocaleUpperCase(t);
677
680
  }
678
- function Ie(t, e) {
681
+ function Be(t, e) {
679
682
  return (n) => `${e(n[0])}${t(n.slice(1))}`;
680
683
  }
681
684
  function Dt(t, e) {
@@ -685,7 +688,7 @@ function Dt(t, e) {
685
688
  };
686
689
  }
687
690
  function G(t, e = {}) {
688
- const n = e.split ?? (e.separateNumbers ? Re : Et), r = e.prefixCharacters ?? ft, o = e.suffixCharacters ?? ft;
691
+ const n = e.split ?? (e.separateNumbers ? ze : Et), r = e.prefixCharacters ?? ft, o = e.suffixCharacters ?? ft;
689
692
  let s = 0, i = t.length;
690
693
  for (; s < t.length; ) {
691
694
  const a = t.charAt(s);
@@ -705,18 +708,18 @@ function G(t, e = {}) {
705
708
  t.slice(i)
706
709
  ];
707
710
  }
708
- function Ee(t) {
711
+ function De(t) {
709
712
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
710
713
  }
711
- function Be(t) {
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: {} }, De = U.exports, gt;
715
- function Te() {
717
+ var U = { exports: {} }, Ae = U.exports, gt;
718
+ function Ne() {
716
719
  return gt || (gt = 1, (function(t, e) {
717
720
  (function(n, r) {
718
- typeof Be == "function" ? t.exports = r() : n.pluralize = r();
719
- })(De, function() {
721
+ typeof Te == "function" ? t.exports = r() : n.pluralize = r();
722
+ })(Ae, function() {
720
723
  var n = [], r = [], o = {}, s = {}, i = {};
721
724
  function a(l) {
722
725
  return typeof l == "string" ? new RegExp("^" + l + "$", "i") : l;
@@ -1011,8 +1014,8 @@ function Te() {
1011
1014
  });
1012
1015
  })(U)), U.exports;
1013
1016
  }
1014
- var Ae = Te();
1015
- const _ = /* @__PURE__ */ Ee(Ae), _a = "data", ka = "migrations", Ne = "(app)", je = /* @__PURE__ */ new Set([
1017
+ var je = Ne();
1018
+ const _ = /* @__PURE__ */ De(je), ka = "data", Ra = "migrations", Le = "(app)", Oe = /* @__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
- ]), Le = {
1070
+ ]), qe = {
1068
1071
  function: "fn",
1069
1072
  interface: "iface",
1070
1073
  type: "type_",
@@ -1114,7 +1117,7 @@ const _ = /* @__PURE__ */ Ee(Ae), _a = "data", ka = "migrations", Ne = "(app)",
1114
1117
  constructor: "ctor"
1115
1118
  };
1116
1119
  function K(t) {
1117
- return je.has(t) ? Le[t] ?? `${t}_` : t;
1120
+ return Oe.has(t) ? qe[t] ?? `${t}_` : t;
1118
1121
  }
1119
1122
  function W(t) {
1120
1123
  if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(t))
@@ -1122,24 +1125,24 @@ function W(t) {
1122
1125
  "Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore"
1123
1126
  );
1124
1127
  }
1125
- function Oe(t) {
1126
- return t.features.auth ? `src/routes/${Ne}` : "src/routes";
1128
+ function Ve(t) {
1129
+ return t.features.auth ? `src/routes/${Le}` : "src/routes";
1127
1130
  }
1128
1131
  function M(t, e) {
1129
- const n = t.split("/"), r = n[n.length - 1], o = n.slice(0, -1), s = _.singular(rt(r)), i = _.plural(s), a = A(s), c = ze(i), m = [...o, c].join("/");
1132
+ const n = t.split("/"), r = n[n.length - 1], o = n.slice(0, -1), s = _.singular(rt(r)), i = _.plural(s), a = A(s), c = Ie(i), m = [...o, c].join("/");
1130
1133
  return {
1131
1134
  name: K(a),
1132
1135
  pluralName: K(A(i)),
1133
- typeName: Pe(s),
1134
- tableName: Me(i),
1136
+ typeName: Me(s),
1137
+ tableName: Ee(i),
1135
1138
  displayName: s,
1136
1139
  pluralDisplayName: i,
1137
1140
  schemaName: `${K(a)}Schema`,
1138
1141
  routeSegment: m,
1139
- routesDir: Oe(e)
1142
+ routesDir: Ve(e)
1140
1143
  };
1141
1144
  }
1142
- function qe(t) {
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 Ve(t) {
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 Ue = [
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 He(t) {
1195
- for (const e of Ue)
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 Ge(t) {
1203
+ function Je(t) {
1201
1204
  return t.map((e) => e.name).filter((e) => !e.startsWith("_"));
1202
1205
  }
1203
- function We(t) {
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, He(e.fields)])
1211
+ t.map((e) => [e.name, We(e.fields)])
1209
1212
  );
1210
1213
  }
1211
- const Je = [
1214
+ const Xe = [
1212
1215
  "user",
1213
1216
  "owner",
1214
1217
  "created_by",
@@ -1228,9 +1231,9 @@ function ht(t) {
1228
1231
  operator: "="
1229
1232
  };
1230
1233
  }
1231
- function Ze(t, e, n = {}) {
1234
+ function Ye(t, e, n = {}) {
1232
1235
  const r = new Set((n.authCollections ?? ["users"]).map(D)), o = new Set(
1233
- (n.userFieldHints ?? Je).map(D)
1236
+ (n.userFieldHints ?? Xe).map(D)
1234
1237
  ), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
1235
1238
  for (const b of t)
1236
1239
  i.set(b.name, b), a.set(b.id, b);
@@ -1305,7 +1308,7 @@ function Ze(t, e, n = {}) {
1305
1308
  operator: lt
1306
1309
  };
1307
1310
  }
1308
- function Xe(t) {
1311
+ function Ke(t) {
1309
1312
  let e = null, n = !1, r = 0;
1310
1313
  for (let o = 0; o < t.length; o++) {
1311
1314
  const s = t[o];
@@ -1370,7 +1373,7 @@ function vt(t) {
1370
1373
  let o, s;
1371
1374
  return e >= 0 ? (o = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (o = t.trim(), s = o), { label: bt(s), value: bt(o) };
1372
1375
  }
1373
- function Ye(t) {
1376
+ function Qe(t) {
1374
1377
  const e = [];
1375
1378
  let n = "", r = null, o = !1;
1376
1379
  for (let i = 0; i < t.length; i++) {
@@ -1418,12 +1421,12 @@ const wt = {
1418
1421
  datetime: "date",
1419
1422
  timestamp: "date"
1420
1423
  };
1421
- function Ke(t) {
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
1428
  const o = n.slice(7, -1);
1426
- r = Ye(o), n = "select";
1429
+ r = Qe(o), n = "select";
1427
1430
  }
1428
1431
  return n === "files" ? { type: "file", required: e, selectOptions: r } : (n in wt && (n = wt[n]), { type: n, required: e, selectOptions: r });
1429
1432
  }
@@ -1446,8 +1449,8 @@ function q(t, e, n, r, o, s) {
1446
1449
  maxSelect: t === c ? 999 : 1
1447
1450
  };
1448
1451
  }
1449
- function Qe(t, e, n, r, o) {
1450
- const s = rt(t), { type: i, required: a, selectOptions: c } = e, m = Ge(r), g = We(r), f = Tt(r), h = m.map((u) => _.singular(u));
1452
+ function en(t, e, n, r, o) {
1453
+ const s = rt(t), { type: i, required: a, selectOptions: c } = e, m = Je(r), g = Ze(r), f = Tt(r), h = m.map((u) => _.singular(u));
1451
1454
  if (o.features.auth && i === "current_user" && g.users) {
1452
1455
  const u = q(
1453
1456
  t,
@@ -1600,10 +1603,10 @@ function Qe(t, e, n, r, o) {
1600
1603
  );
1601
1604
  return { type: i, name: t, title: s, required: a };
1602
1605
  }
1603
- function tn(t, e, n, r) {
1606
+ function nn(t, e, n, r) {
1604
1607
  const o = [];
1605
1608
  for (const i of t) {
1606
- const [a, c] = Xe(i);
1609
+ const [a, c] = Ke(i);
1607
1610
  if (!a || !c)
1608
1611
  throw new Error(
1609
1612
  `Invalid field format: ${i}. Expected format: name:type or name:type!`
@@ -1612,10 +1615,10 @@ function tn(t, e, n, r) {
1612
1615
  throw new Error(
1613
1616
  `Invalid field name: ${a}. Must start with a letter and contain only alphanumeric characters`
1614
1617
  );
1615
- const m = Ke(c);
1616
- o.push(Qe(a, m, e, n, r));
1618
+ const m = tn(c);
1619
+ o.push(en(a, m, e, n, r));
1617
1620
  }
1618
- const s = r.features.auth ? Ze(
1621
+ const s = r.features.auth ? Ye(
1619
1622
  [
1620
1623
  ...n,
1621
1624
  {
@@ -1637,15 +1640,15 @@ function tn(t, e, n, r) {
1637
1640
  async function J(t, e, n) {
1638
1641
  let r;
1639
1642
  if (n.env === "runtime") {
1640
- const { getCollections: o } = await import("./env.runtime-DwuZBxzA.js");
1643
+ const { getCollections: o } = await import("./env.runtime-9ntayaBG.js");
1641
1644
  r = await o();
1642
1645
  } else {
1643
1646
  const { getPreviewCollections: o } = await import("./env.preview-HlXZOEL4.js");
1644
1647
  r = o(n);
1645
1648
  }
1646
- return tn(t, e, r, n);
1649
+ return nn(t, e, r, n);
1647
1650
  }
1648
- const en = "2024-01-01T00:00:00.000Z";
1651
+ const rn = "2024-01-01T00:00:00.000Z";
1649
1652
  class N {
1650
1653
  constructor(e) {
1651
1654
  this.expression = e;
@@ -1659,7 +1662,7 @@ function Q(t) {
1659
1662
  ([n, r]) => `${JSON.stringify(n)}: ${tt(r)}`
1660
1663
  ).join(", ")} }`;
1661
1664
  }
1662
- function nn(t) {
1665
+ function an(t) {
1663
1666
  switch (t) {
1664
1667
  case "text":
1665
1668
  case "number":
@@ -1709,7 +1712,7 @@ function At(t, e, n) {
1709
1712
  case "bool":
1710
1713
  return !0;
1711
1714
  case "date":
1712
- return en;
1715
+ return rn;
1713
1716
  case "email":
1714
1717
  return `test-${t.name}@example.com`;
1715
1718
  case "password":
@@ -1751,13 +1754,13 @@ function $t(t, e, n) {
1751
1754
  }
1752
1755
  return r;
1753
1756
  }
1754
- function rn(t, e, n) {
1757
+ function on(t, e, n) {
1755
1758
  var o;
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 = nn(s.type);
1763
+ const i = an(s.type);
1761
1764
  if (!i || i === "file" || i === "autodate" || i === "relation" && !s.collectionId)
1762
1765
  continue;
1763
1766
  let a;
@@ -1778,12 +1781,12 @@ function rn(t, e, n) {
1778
1781
  }
1779
1782
  return r;
1780
1783
  }
1781
- function an(t) {
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 on(t, e) {
1789
+ function ln(t, e) {
1787
1790
  if (!t)
1788
1791
  return [];
1789
1792
  const n = new Map(e.map((a) => [a.id, a])), r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = [], i = (a) => {
@@ -1801,7 +1804,7 @@ function on(t, e) {
1801
1804
  a.type !== "relation" || !a.collectionId || i(a.collectionId);
1802
1805
  return s;
1803
1806
  }
1804
- function sn(t, e) {
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 ln(t, e) {
1816
+ function mn(t, e) {
1814
1817
  return {
1815
1818
  id: `generated-${t.tableName}`,
1816
1819
  name: t.tableName,
@@ -1833,23 +1836,23 @@ function ln(t, e) {
1833
1836
  };
1834
1837
  }
1835
1838
  function Nt(t, e, n, r) {
1836
- const o = r.find((l) => l.name === t.tableName) ?? ln(t, e), s = on(o, r).filter(
1839
+ const o = r.find((l) => l.name === t.tableName) ?? mn(t, e), s = ln(o, r).filter(
1837
1840
  (l) => !(n.features.auth && l.name === "users")
1838
1841
  ), i = {}, a = [], c = /* @__PURE__ */ new Set();
1839
1842
  for (const l of s) {
1840
- const p = sn(M(l.name, n).name, c);
1843
+ const p = cn(M(l.name, n).name, c);
1841
1844
  a.push({ varName: p, collection: l }), i[l.id] = `${p}.id`;
1842
1845
  }
1843
1846
  const m = a.length ? `${a.map((l) => `let ${l.varName}: { id: string };`).join(`
1844
1847
  `)}
1845
1848
 
1846
1849
  ` : "", g = a.map(({ varName: l, collection: p }) => {
1847
- const w = rn(
1850
+ const w = on(
1848
1851
  p.fields,
1849
1852
  i,
1850
1853
  n
1851
1854
  );
1852
- return p.type === "auth" && an(w), `${l} = await context.admin.collection("${p.name}").create(${Q(w)});`;
1855
+ return p.type === "auth" && sn(w), `${l} = await context.admin.collection("${p.name}").create(${Q(w)});`;
1853
1856
  }), f = a.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();
@@ -1885,7 +1888,7 @@ function Nt(t, e, n, r) {
1885
1888
  )
1886
1889
  };
1887
1890
  }
1888
- function cn(t, e, n, r, o) {
1891
+ function un(t, e, n, r, o) {
1889
1892
  const { declarations: s, setupSection: i, requestAgent: a, modelDbData: c, modelFormData: m } = Nt(t, n, r, o);
1890
1893
  return d`
1891
1894
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
@@ -1963,7 +1966,7 @@ function cn(t, e, n, r, o) {
1963
1966
  });
1964
1967
  `;
1965
1968
  }
1966
- function mn(t, e, n, r, o) {
1969
+ function dn(t, e, n, r, o) {
1967
1970
  const { declarations: s, setupSection: i, requestAgent: a, modelFormData: c } = Nt(t, n, r, o);
1968
1971
  return d`
1969
1972
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
@@ -1987,15 +1990,15 @@ function mn(t, e, n, r, o) {
1987
1990
  });
1988
1991
  `;
1989
1992
  }
1990
- var xt = Object.freeze, un = Object.defineProperty, dn = (t, e) => xt(un(t, "raw", { value: xt(t.slice()) })), Ft;
1991
- function pn(t, e) {
1993
+ var xt = Object.freeze, pn = Object.defineProperty, fn = (t, e) => xt(pn(t, "raw", { value: xt(t.slice()) })), Ft;
1994
+ function gn(t, e) {
1992
1995
  const n = t.replace(/^\/+|\/+$/g, ""), r = `${e}/${n}`, o = `/${n}`;
1993
1996
  return {
1994
1997
  pagePath: r,
1995
1998
  pageUrl: o
1996
1999
  };
1997
2000
  }
1998
- function fn(t) {
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...>");
@@ -2006,7 +2009,7 @@ function fn(t) {
2006
2009
  function jt(t) {
2007
2010
  return t.some((e) => e.type === "file");
2008
2011
  }
2009
- function gn(t) {
2012
+ function bn(t) {
2010
2013
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
2011
2014
  }
2012
2015
  function St(t) {
@@ -2065,7 +2068,7 @@ 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 hn(t) {
2071
+ function vn(t) {
2069
2072
  const e = [];
2070
2073
  for (const n of t) {
2071
2074
  if (n.type === "file" && n.maxSelect > 1) {
@@ -2085,8 +2088,8 @@ function hn(t) {
2085
2088
  }
2086
2089
  return e;
2087
2090
  }
2088
- function bn(t, e) {
2089
- const n = hn(e).map((r) => `${gn(r.name)}: ${r.schema}`).join(`,
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,7 +2099,7 @@ function bn(t, e) {
2096
2099
  });
2097
2100
  `;
2098
2101
  }
2099
- function vn(t, e) {
2102
+ function yn(t, e) {
2100
2103
  const n = O(e), r = [
2101
2104
  'import { untrack } from "svelte";',
2102
2105
  'import { superForm } from "sveltekit-superforms";',
@@ -2106,7 +2109,7 @@ function vn(t, e) {
2106
2109
  ];
2107
2110
  return [...new Set(r)];
2108
2111
  }
2109
- function wn(t, e) {
2112
+ function $n(t, e) {
2110
2113
  const r = e.filter(
2111
2114
  (o) => o.type === "select"
2112
2115
  ).map((o) => It(o)).join(`
@@ -2122,11 +2125,11 @@ function wn(t, e) {
2122
2125
  const { form: formData } = form;
2123
2126
  `;
2124
2127
  }
2125
- function yn(t, e) {
2126
- const n = vn(t, e).join(`
2127
- `), r = wn(t, e), o = e.map((i) => et(i)).join(`
2128
+ function xn(t, e) {
2129
+ const n = yn(t, e).join(`
2130
+ `), r = $n(t, e), o = e.map((i) => et(i)).join(`
2128
2131
  `), s = jt(e) ? ' enctype="multipart/form-data"' : "";
2129
- return d(Ft || (Ft = dn([`
2132
+ return d(Ft || (Ft = fn([`
2130
2133
  <script lang="ts">
2131
2134
  `, `
2132
2135
 
@@ -2151,7 +2154,7 @@ function yn(t, e) {
2151
2154
  </section>
2152
2155
  `])), n, r, t.displayName, s, o);
2153
2156
  }
2154
- function $n(t, e) {
2157
+ function Fn(t, e) {
2155
2158
  const n = jt(e), r = d`
2156
2159
  import { fail, superValidate${n ? ", withFiles" : ""} } from "sveltekit-superforms";
2157
2160
  import { zod } from "sveltekit-superforms/adapters";
@@ -2188,17 +2191,17 @@ function V(t, e) {
2188
2191
  content: e
2189
2192
  };
2190
2193
  }
2191
- async function xn(t) {
2192
- const { modelPath: e, fields: n } = fn(t.argv);
2194
+ async function Sn(t) {
2195
+ const { modelPath: e, fields: n } = hn(t.argv);
2193
2196
  W(e);
2194
- const r = M(e, t), s = (await J(n, r, t)).fields, { pagePath: i, pageUrl: a } = pn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-DwuZBxzA.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
2197
+ const r = M(e, t), s = (await J(n, r, t)).fields, { pagePath: i, pageUrl: a } = gn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-9ntayaBG.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
2195
2198
  t
2196
2199
  ), m = [
2197
- V(`${i}/+page.svelte`, yn(r, s)),
2198
- V(`${i}/+page.server.ts`, $n(r, s)),
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
- mn(
2204
+ dn(
2202
2205
  r,
2203
2206
  a,
2204
2207
  s,
@@ -2206,7 +2209,7 @@ async function xn(t) {
2206
2209
  c
2207
2210
  )
2208
2211
  ),
2209
- V(`src/lib/schemas/${r.name}.ts`, bn(r, s))
2212
+ V(`src/lib/schemas/${r.name}.ts`, wn(r, s))
2210
2213
  ], g = O(s);
2211
2214
  return {
2212
2215
  creates: m,
@@ -2217,19 +2220,19 @@ async function xn(t) {
2217
2220
  collections: []
2218
2221
  };
2219
2222
  }
2220
- const Fn = "generate-form", Sn = "1.0.7", Cn = "src/patterns/generate/form", _n = "/generate/form";
2221
- async function kn(t) {
2222
- const e = await xn(t);
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
2227
  return k(e);
2225
2228
  const { writeResult: n } = await import("./write-result-CbUTMeAc.js");
2226
2229
  return n(await k(e), t);
2227
2230
  }
2228
- const Rn = {
2229
- version: Sn,
2230
- slug: Fn,
2231
- source: Cn,
2232
- docs: _n,
2231
+ const zn = {
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
- categories: ["forms"],
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: kn
2249
- }, Pn = ["text"], zn = {
2251
+ generate: Pn
2252
+ }, Mn = ["text"], In = {
2250
2253
  string: "text",
2251
2254
  boolean: "bool",
2252
2255
  geopoint: "geoPoint",
@@ -2273,10 +2276,10 @@ const Rn = {
2273
2276
  geoPoint: "geoPoint",
2274
2277
  relation: "relation"
2275
2278
  };
2276
- function Mn(t) {
2279
+ function En(t) {
2277
2280
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
2278
2281
  }
2279
- function In(t, e) {
2282
+ function Bn(t, e) {
2280
2283
  const n = t.type === "select" ? `[${(t.options ?? []).map((o) => JSON.stringify(o.value)).join(", ")}]` : "";
2281
2284
  let r;
2282
2285
  switch (t.type) {
@@ -2335,7 +2338,7 @@ function In(t, e) {
2335
2338
  default:
2336
2339
  return t.type;
2337
2340
  }
2338
- return Pn.includes(t.type) ? t.required ? `${r}.nonempty()` : `${r}.optional()` : t.required || t.type === "geoPoint" ? r : t.type === "file" && (t.maxSelect ?? 1) <= 1 ? `${r}.optional().default("")` : `${r}.optional()`;
2341
+ return Mn.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
2343
  function ot(t, e, n) {
2341
2344
  const r = [];
@@ -2347,7 +2350,7 @@ function ot(t, e, n) {
2347
2350
  }
2348
2351
  r.push(a);
2349
2352
  }
2350
- const o = r.map((a) => `${Mn(a.name)}: ${In(a, n)}`).join(`,
2353
+ const o = r.map((a) => `${En(a.name)}: ${Bn(a, 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`
@@ -2358,8 +2361,8 @@ import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelField
2358
2361
  })${i};
2359
2362
  `;
2360
2363
  }
2361
- function En(t) {
2362
- const e = zn[t];
2364
+ function Dn(t) {
2365
+ const e = In[t];
2363
2366
  if (!e)
2364
2367
  throw new Error(`Unsupported collection field type "${t}" when generating from collection`);
2365
2368
  return e;
@@ -2372,7 +2375,7 @@ function st(t, e, n) {
2372
2375
  for (const a of r.fields) {
2373
2376
  if (a.name === "id" || a.system)
2374
2377
  continue;
2375
- const c = En(a.type), m = !!a.required, g = rt(a.name);
2378
+ const c = Dn(a.type), m = !!a.required, g = rt(a.name);
2376
2379
  if (c === "relation") {
2377
2380
  const f = a.collectionId ? s.get(a.collectionId) : void 0;
2378
2381
  if (!f)
@@ -2448,7 +2451,7 @@ function Ot(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 Bn(t) {
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(Bn)
2489
+ fields: e.map(Tn)
2487
2490
  };
2488
2491
  }
2489
- function Dn(t) {
2492
+ function An(t) {
2490
2493
  const [e, ...n] = t;
2491
2494
  if (!e)
2492
2495
  throw new Error(
@@ -2494,25 +2497,25 @@ function Dn(t) {
2494
2497
  );
2495
2498
  return { modelPath: e, fields: n };
2496
2499
  }
2497
- function Tn(t, e) {
2500
+ function Nn(t, e) {
2498
2501
  return {
2499
2502
  path: t,
2500
2503
  language: j(t),
2501
2504
  content: e
2502
2505
  };
2503
2506
  }
2504
- async function An(t, e, n) {
2507
+ async function jn(t, e, n) {
2505
2508
  W(e);
2506
2509
  const r = M(e, t);
2507
2510
  if (n.length > 0) {
2508
2511
  const i = await J(n, r, t);
2509
2512
  return { model: r, fields: i.fields, auth: i.auth, shouldCreateCollection: !0 };
2510
2513
  }
2511
- const o = t.env === "runtime" ? await (await import("./env.runtime-DwuZBxzA.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
2514
+ const o = t.env === "runtime" ? await (await import("./env.runtime-9ntayaBG.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
2512
2515
  return { model: r, fields: s, auth: void 0, shouldCreateCollection: !1 };
2513
2516
  }
2514
- async function Nn(t) {
2515
- const { modelPath: e, fields: n } = Dn(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i } = await An(
2517
+ async function Ln(t) {
2518
+ const { modelPath: e, fields: n } = An(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i } = await jn(
2516
2519
  t,
2517
2520
  e,
2518
2521
  n
@@ -2521,7 +2524,7 @@ async function Nn(t) {
2521
2524
  forForm: !0
2522
2525
  });
2523
2526
  return {
2524
- creates: [Tn(a, c)],
2527
+ creates: [Nn(a, c)],
2525
2528
  modifies: [],
2526
2529
  deletes: [],
2527
2530
  components: [],
@@ -2529,12 +2532,12 @@ async function Nn(t) {
2529
2532
  collections: i ? [qt(r, o, s)] : []
2530
2533
  };
2531
2534
  }
2532
- const jn = "generate-resource", Ln = "1.0.7", On = "src/patterns/generate/resource", qn = "/generate/resource";
2533
- async function Vn(t) {
2534
- const e = await Nn(t);
2535
+ const On = "generate-resource", qn = "1.0.7", Vn = "src/patterns/generate/resource", Un = "/generate/resource";
2536
+ async function Hn(t) {
2537
+ const e = await Ln(t);
2535
2538
  if (t.env !== "runtime")
2536
2539
  return k(e);
2537
- const { createCollections: n } = await import("./collections-DgjC5QHp.js"), r = await n(
2540
+ const { createCollections: n } = await import("./collections-C81jPRX2.js"), r = await n(
2538
2541
  e.collections,
2539
2542
  t
2540
2543
  ), o = {
@@ -2543,11 +2546,11 @@ async function Vn(t) {
2543
2546
  }, { writeResult: s } = await import("./write-result-CbUTMeAc.js");
2544
2547
  return s(await k(o), t);
2545
2548
  }
2546
- const Un = {
2547
- version: Ln,
2548
- slug: jn,
2549
- source: On,
2550
- docs: qn,
2549
+ const Gn = {
2550
+ version: qn,
2551
+ slug: On,
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
- categories: ["data"],
2561
+ category: "generators",
2559
2562
  tags: ["pocketbase", "resource", "schema"],
2560
2563
  command: {
2561
2564
  raw: "vela generate resource contact name:text email:email",
@@ -2563,10 +2566,10 @@ const Un = {
2563
2566
  argv: ["contact", "name:text", "email:email"]
2564
2567
  },
2565
2568
  baseline: "velastack",
2566
- generate: Vn
2569
+ generate: Hn
2567
2570
  };
2568
- var Ct = Object.freeze, Hn = Object.defineProperty, Z = (t, e) => Ct(Hn(t, "raw", { value: Ct(e || t.slice()) })), _t, kt, Rt, Pt;
2569
- function Gn(t) {
2571
+ var Ct = Object.freeze, Wn = Object.defineProperty, Z = (t, e) => Ct(Wn(t, "raw", { value: Ct(e || t.slice()) })), _t, kt, Rt, Pt;
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...]");
@@ -2601,7 +2604,7 @@ function Ht(t, e) {
2601
2604
  function Gt(t) {
2602
2605
  return Ot(t).map((e) => e.pluralName).join(", ");
2603
2606
  }
2604
- function Wn(t) {
2607
+ function Zn(t) {
2605
2608
  return t.features.auth ? "locals.pb" : "locals.admin";
2606
2609
  }
2607
2610
  function Wt(t, e, n = !1) {
@@ -2617,7 +2620,7 @@ function Wt(t, e, n = !1) {
2617
2620
  const { form: formData } = form;
2618
2621
  `;
2619
2622
  }
2620
- function Jn(t, e, n) {
2623
+ function Xn(t, e, n) {
2621
2624
  const r = n.some((a) => a.type === "select"), o = Ut([
2622
2625
  'import { untrack } from "svelte";',
2623
2626
  'import { superForm } from "sveltekit-superforms";',
@@ -2660,7 +2663,7 @@ function Jn(t, e, n) {
2660
2663
  </section>
2661
2664
  `])), o, Wt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
2662
2665
  }
2663
- function Zn(t, e, n) {
2666
+ function Yn(t, e, n) {
2664
2667
  const r = n.some((a) => a.type === "select"), o = Ut([
2665
2668
  'import { untrack } from "svelte";',
2666
2669
  'import { superForm } from "sveltekit-superforms";',
@@ -2730,7 +2733,7 @@ function Zn(t, e, n) {
2730
2733
  </section>
2731
2734
  `])), o, Wt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
2732
2735
  }
2733
- function Xn(t, e, n) {
2736
+ function Kn(t, e, n) {
2734
2737
  const r = n.some((a) => a.type === "select"), o = r ? `${it(n)}` : "", s = n.map((a) => {
2735
2738
  let c = "{ getValue }", m = "{ value: getValue() }";
2736
2739
  return a.type === "relation" && (c = "{ getValue, row }", m = `{ value: getValue(), expanded: row.original.expand?.${a.name}, displayField: "${a.displayField}" }`), a.type === "select" && (m = `{ value: getValue(), options: ${a.name}Labels }`), a.type === "file" && (c = "{ getValue, row }", m = "{ value: getValue(), collectionId: row.original.collectionId, id: row.original.id }"), d`
@@ -3120,7 +3123,7 @@ function Xn(t, e, n) {
3120
3123
  </section>
3121
3124
  `])), r ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "", o, 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 Yn(t, e, n) {
3126
+ function Qn(t, e, n) {
3124
3127
  const r = Lt(e), o = r ? `{ expand: "${r}" }` : "";
3125
3128
  return d`
3126
3129
  export const load = async ({ locals }) => {
@@ -3129,7 +3132,7 @@ function Yn(t, e, n) {
3129
3132
  };
3130
3133
  `;
3131
3134
  }
3132
- function Kn(t, e, n, r, o) {
3135
+ function tr(t, e, n, r, o) {
3133
3136
  const s = Ht(n, r), i = Gt(n), a = i ? `, ${i}` : "", c = n.find(
3134
3137
  (g) => g.type === "relation" && g.isCurrentUser
3135
3138
  ), m = o && c ? d`
@@ -3171,7 +3174,7 @@ function Kn(t, e, n, r, o) {
3171
3174
  };
3172
3175
  `;
3173
3176
  }
3174
- function Qn(t, e, n, r) {
3177
+ function er(t, e, n, r) {
3175
3178
  const o = Lt(n), s = o ? `, { expand: "${o}" }` : "";
3176
3179
  return d`
3177
3180
  import { error, redirect } from "@sveltejs/kit";
@@ -3193,7 +3196,7 @@ function Qn(t, e, n, r) {
3193
3196
  };
3194
3197
  `;
3195
3198
  }
3196
- function tr(t, e, n) {
3199
+ function nr(t, e, n) {
3197
3200
  const r = n.some((m) => m.type === "select"), o = 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";',
@@ -3201,7 +3204,7 @@ function tr(t, e, n) {
3201
3204
  o ? '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
- `), a = it(n), c = n.map((m) => Fe(t, m)).join(`
3207
+ `), a = it(n), c = n.map((m) => Ce(t, m)).join(`
3205
3208
  `);
3206
3209
  return d(Pt || (Pt = Z([`
3207
3210
  <script lang="ts">
@@ -3237,7 +3240,7 @@ function tr(t, e, n) {
3237
3240
  </section>
3238
3241
  `])), i, a, t.displayName, e.list, c, e.list, t.name);
3239
3242
  }
3240
- function er(t, e, n, r) {
3243
+ function rr(t, e, n, r) {
3241
3244
  const o = Ht(n, r), s = Gt(n), i = s ? `, ${s}` : "";
3242
3245
  return d`
3243
3246
  import { error, fail, redirect } from "@sveltejs/kit";
@@ -3279,9 +3282,9 @@ function er(t, e, n, r) {
3279
3282
  };
3280
3283
  `;
3281
3284
  }
3282
- async function nr(t, e, n) {
3285
+ async function ar(t, e, n) {
3283
3286
  W(e);
3284
- const r = M(e, t), o = t.env === "runtime" ? await (await import("./env.runtime-DwuZBxzA.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
3287
+ const r = M(e, t), o = t.env === "runtime" ? await (await import("./env.runtime-9ntayaBG.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
3285
3288
  t
3286
3289
  );
3287
3290
  if (n.length > 0) {
@@ -3303,8 +3306,8 @@ async function nr(t, e, n) {
3303
3306
  collections: o
3304
3307
  };
3305
3308
  }
3306
- async function rr(t) {
3307
- const { modelPath: e, fields: n } = Gn(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i, collections: a } = await nr(t, e, n), c = qe(r), m = Ve(r), g = Wn(t), f = o.filter(
3309
+ async function or(t) {
3310
+ const { modelPath: e, fields: n } = Jn(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i, collections: a } = await ar(t, e, n), c = Ue(r), m = He(r), g = Zn(t), f = o.filter(
3308
3311
  (u) => !(u.type === "relation" && u.isCurrentUser)
3309
3312
  ), h = [
3310
3313
  C(
@@ -3316,36 +3319,36 @@ async function rr(t) {
3316
3319
  ),
3317
3320
  C(
3318
3321
  `${c.list}/+page.server.ts`,
3319
- Yn(r, f, g)
3322
+ Qn(r, f, g)
3320
3323
  ),
3321
3324
  C(
3322
3325
  `${c.list}/+page.svelte`,
3323
- Xn(r, m, f)
3326
+ Kn(r, m, f)
3324
3327
  ),
3325
3328
  C(
3326
3329
  `${c.new}/+page.server.ts`,
3327
- Kn(r, m, f, g, t.features.auth)
3330
+ tr(r, m, f, g, t.features.auth)
3328
3331
  ),
3329
- C(`${c.new}/+page.svelte`, Jn(r, m, f)),
3332
+ C(`${c.new}/+page.svelte`, Xn(r, m, f)),
3330
3333
  C(
3331
3334
  `${c.show}/+page.server.ts`,
3332
- Qn(r, m, f, g)
3335
+ er(r, m, f, g)
3333
3336
  ),
3334
3337
  C(
3335
3338
  `${c.show}/+page.svelte`,
3336
- tr(r, m, f)
3339
+ nr(r, m, f)
3337
3340
  ),
3338
3341
  C(
3339
3342
  `${c.edit}/+page.server.ts`,
3340
- er(r, m, f, g)
3343
+ rr(r, m, f, g)
3341
3344
  ),
3342
3345
  C(
3343
3346
  `${c.edit}/+page.svelte`,
3344
- Zn(r, m, f)
3347
+ Yn(r, m, f)
3345
3348
  ),
3346
3349
  C(
3347
3350
  `${c.list}/server.test.ts`,
3348
- cn(
3351
+ un(
3349
3352
  r,
3350
3353
  m,
3351
3354
  o,
@@ -3380,12 +3383,12 @@ async function rr(t) {
3380
3383
  collections: i ? [qt(r, o, s)] : []
3381
3384
  };
3382
3385
  }
3383
- const ar = "generate-scaffold", or = "1.0.7", sr = "src/patterns/generate/scaffold", ir = "/generate/scaffold";
3384
- async function lr(t) {
3385
- const e = await rr(t);
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
3390
  return k(e);
3388
- const { createCollections: n } = await import("./collections-DgjC5QHp.js"), r = await n(
3391
+ const { createCollections: n } = await import("./collections-C81jPRX2.js"), r = await n(
3389
3392
  e.collections,
3390
3393
  t
3391
3394
  ), o = {
@@ -3394,11 +3397,11 @@ async function lr(t) {
3394
3397
  }, { writeResult: s } = await import("./write-result-CbUTMeAc.js");
3395
3398
  return s(await k(o), t);
3396
3399
  }
3397
- const cr = {
3398
- version: or,
3399
- slug: ar,
3400
- source: sr,
3401
- docs: ir,
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
- categories: ["data", "forms"],
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: lr
3420
+ generate: mr
3418
3421
  };
3419
- function mr(t) {
3422
+ function dr(t) {
3420
3423
  const [e, ...n] = t;
3421
3424
  if (!e)
3422
3425
  throw new Error(
@@ -3424,25 +3427,25 @@ function mr(t) {
3424
3427
  );
3425
3428
  return { modelPath: e, fields: n };
3426
3429
  }
3427
- function ur(t, e) {
3430
+ function pr(t, e) {
3428
3431
  return {
3429
3432
  path: t,
3430
3433
  language: j(t),
3431
3434
  content: e
3432
3435
  };
3433
3436
  }
3434
- async function dr(t, e, n) {
3437
+ async function fr(t, e, n) {
3435
3438
  W(e);
3436
3439
  const r = M(e, t);
3437
3440
  if (n.length > 0) {
3438
3441
  const i = await J(n, r, t);
3439
3442
  return { model: r, fields: i.fields, includeModelFields: !1 };
3440
3443
  }
3441
- const o = t.env === "runtime" ? await (await import("./env.runtime-DwuZBxzA.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
3444
+ const o = t.env === "runtime" ? await (await import("./env.runtime-9ntayaBG.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
3442
3445
  return { model: r, fields: s, includeModelFields: !0 };
3443
3446
  }
3444
- async function pr(t) {
3445
- const { modelPath: e, fields: n } = mr(t.argv), { model: r, fields: o, includeModelFields: s } = await dr(
3447
+ async function gr(t) {
3448
+ const { modelPath: e, fields: n } = dr(t.argv), { model: r, fields: o, includeModelFields: s } = await fr(
3446
3449
  t,
3447
3450
  e,
3448
3451
  n
@@ -3451,7 +3454,7 @@ async function pr(t) {
3451
3454
  forForm: !0
3452
3455
  });
3453
3456
  return {
3454
- creates: [ur(i, a)],
3457
+ creates: [pr(i, a)],
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 fr = "generate-schema", gr = "1.0.7", hr = "src/patterns/generate/schema", br = "/generate/schema";
3463
- async function vr(t) {
3464
- const e = await pr(t);
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
3469
  return k(e);
3467
3470
  const { writeResult: n } = await import("./write-result-CbUTMeAc.js");
3468
3471
  return n(await k(e), t);
3469
3472
  }
3470
- const wr = {
3471
- version: gr,
3472
- slug: fr,
3473
- source: hr,
3474
- docs: br,
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
- categories: ["data"],
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: vr
3491
- }, yr = `<script lang="ts">
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
- `, $r = `<script lang="ts">
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
- `, xr = `<script lang="ts">
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
- `, Fr = `import { z } from 'zod/v3';
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
- `, Sr = `import { z } from 'zod/v3';
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
- `, Cr = `import { z } from 'zod/v3';
3719
+ `, kr = `import { z } from 'zod/v3';
3717
3720
 
3718
3721
  export const confirmEmailChangeSchema = z.object({
3719
3722
  password: z.string()
3720
3723
  });
3721
- `, _r = `import { z } from 'zod/v3';
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
- `, kr = `import { z } from 'zod/v3';
3730
+ `, Pr = `import { z } from 'zod/v3';
3728
3731
 
3729
3732
  const otpSchema = z.object({
3730
3733
  type: z.literal('otp'),
@@ -3743,37 +3746,37 @@ const oAuth2Schema = z.object({
3743
3746
  });
3744
3747
 
3745
3748
  export const loginSchema = z.discriminatedUnion('type', [otpSchema, passwordSchema, oAuth2Schema]);
3746
- `, Rr = `import { z } from 'zod/v3';
3749
+ `, zr = `import { z } from 'zod/v3';
3747
3750
 
3748
3751
  export const otpSchema = z.object({
3749
3752
  otp: z.string()
3750
3753
  });
3751
- `, Pr = `import { z } from 'zod/v3';
3754
+ `, Mr = `import { z } from 'zod/v3';
3752
3755
 
3753
3756
  export const profileSchema = z.object({
3754
3757
  name: z.string().optional(),
3755
3758
  avatar: z.union([z.instanceof(File), z.string()]).optional(),
3756
3759
  emailVisibility: z.boolean().optional()
3757
3760
  });
3758
- `, zr = `import { z } from 'zod/v3';
3761
+ `, Ir = `import { z } from 'zod/v3';
3759
3762
 
3760
3763
  export const resetSchema = z.object({
3761
3764
  email: z.string().email()
3762
3765
  });
3763
- `, Mr = `import { z } from 'zod/v3';
3766
+ `, Er = `import { z } from 'zod/v3';
3764
3767
 
3765
3768
  export const signupSchema = z.object({
3766
3769
  email: z.string().email(),
3767
3770
  password: z.string(),
3768
3771
  passwordConfirm: z.string()
3769
3772
  });
3770
- `, Ir = `export const load = ({ locals }) => {
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
- `, Er = `<script lang="ts">
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
- `, Br = "", Dr = `import { describe, it, expect } from 'vitest';
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
- `, Tr = `export const load = async ({ parent }) => {
3846
+ `, Nr = `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
- `, Ar = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
3853
+ `, jr = `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
- `, Nr = `<script lang="ts">
3922
+ `, Lr = `<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
- `, jr = `import { fail, superValidate } from 'sveltekit-superforms';
4200
+ `, Or = `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
- `, Lr = `<script lang="ts">
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
- `, Or = `import { describe, it, expect } from 'vitest';
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
- `, qr = `import { fail, superValidate } from 'sveltekit-superforms';
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
- `, Vr = `<script lang="ts">
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
- `, Ur = `import { describe, it, expect } from 'vitest';
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
- `, Hr = `import { redirect } from '@sveltejs/kit';
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
- `, Gr = `import { describe, it, expect } from 'vitest';
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
- `, Wr = `import { fail, superValidate, message } from 'sveltekit-superforms';
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
- `, Jr = `<script lang="ts">
4523
+ `, Xr = `<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
- `, Zr = `import { describe, it, expect } from 'vitest';
4706
+ `, Yr = `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
- `, Xr = `import { redirect } from '@sveltejs/kit';
4753
+ `, Kr = `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
- `, Yr = `import { describe, it, expect } from 'vitest';
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
- `, Kr = `import { fail, message, superValidate } from 'sveltekit-superforms';
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
- `, Qr = `<script lang="ts">
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
- `, ta = `import { describe, it, expect } from 'vitest';
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
- `, ea = `import { fail, superValidate } from 'sveltekit-superforms';
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
- `, na = `<script lang="ts">
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
- `, ra = `import { describe, it, expect } from 'vitest';
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
- `, aa = `import { redirect } from '@sveltejs/kit';
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
- `, oa = `<script lang="ts">
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
- `, sa = `import { describe, it, expect } from 'vitest';
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,52 +5290,52 @@ describe('POST /signup', () => {
5287
5290
  expect(data.form.errors.email[0]).toBe('Value must be unique.');
5288
5291
  });
5289
5292
  });
5290
- `, ia = /* @__PURE__ */ Object.assign({
5291
- "./creates/src/lib/components/app-sidebar.svelte": yr,
5292
- "./creates/src/lib/components/nav-main.svelte": $r,
5293
- "./creates/src/lib/components/nav-user.svelte": xr,
5294
- "./creates/src/lib/schemas/changeEmail.ts": Fr,
5295
- "./creates/src/lib/schemas/changePassword.ts": Sr,
5296
- "./creates/src/lib/schemas/confirmEmailChange.ts": Cr,
5297
- "./creates/src/lib/schemas/confirmReset.ts": _r,
5298
- "./creates/src/lib/schemas/login.ts": kr,
5299
- "./creates/src/lib/schemas/otp.ts": Rr,
5300
- "./creates/src/lib/schemas/profile.ts": Pr,
5301
- "./creates/src/lib/schemas/reset.ts": zr,
5302
- "./creates/src/lib/schemas/signup.ts": Mr,
5303
- "./creates/src/routes/(app)/+layout.server.ts": Ir,
5304
- "./creates/src/routes/(app)/+layout.svelte": Er,
5305
- "./creates/src/routes/(app)/dashboard/+page.svelte": Br,
5306
- "./creates/src/routes/(app)/dashboard/server.test.ts": Dr,
5307
- "./creates/src/routes/(app)/settings/+layout.server.ts": Tr,
5308
- "./creates/src/routes/(app)/settings/+page.server.ts": Ar,
5309
- "./creates/src/routes/(app)/settings/+page.svelte": Nr,
5310
- "./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": jr,
5311
- "./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Lr,
5312
- "./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Or,
5313
- "./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": qr,
5314
- "./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Vr,
5315
- "./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Ur,
5316
- "./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": Hr,
5317
- "./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Gr,
5318
- "./creates/src/routes/(public)/login/+page.server.ts": Wr,
5319
- "./creates/src/routes/(public)/login/+page.svelte": Jr,
5320
- "./creates/src/routes/(public)/login/server.test.ts": Zr,
5321
- "./creates/src/routes/(public)/logout/+server.ts": Xr,
5322
- "./creates/src/routes/(public)/logout/server.test.ts": Yr,
5323
- "./creates/src/routes/(public)/otp/[token]/+page.server.ts": Kr,
5324
- "./creates/src/routes/(public)/otp/[token]/+page.svelte": Qr,
5325
- "./creates/src/routes/(public)/otp/[token]/server.test.ts": ta,
5326
- "./creates/src/routes/(public)/reset/+page.server.ts": ea,
5327
- "./creates/src/routes/(public)/reset/+page.svelte": na,
5328
- "./creates/src/routes/(public)/reset/server.test.ts": ra,
5329
- "./creates/src/routes/(public)/signup/+page.server.ts": aa,
5330
- "./creates/src/routes/(public)/signup/+page.svelte": oa,
5331
- "./creates/src/routes/(public)/signup/server.test.ts": sa
5332
- }), la = "./creates/";
5333
- async function ca(t) {
5334
- const e = Object.entries(ia).map(([o, s]) => {
5335
- const i = Mt(o, la);
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": zr,
5303
+ "./creates/src/lib/schemas/profile.ts": Mr,
5304
+ "./creates/src/lib/schemas/reset.ts": Ir,
5305
+ "./creates/src/lib/schemas/signup.ts": Er,
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": Nr,
5311
+ "./creates/src/routes/(app)/settings/+page.server.ts": jr,
5312
+ "./creates/src/routes/(app)/settings/+page.svelte": Lr,
5313
+ "./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Or,
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": Xr,
5323
+ "./creates/src/routes/(public)/login/server.test.ts": Yr,
5324
+ "./creates/src/routes/(public)/logout/+server.ts": Kr,
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(([o, s]) => {
5338
+ const i = Mt(o, ma);
5336
5339
  return {
5337
5340
  path: i,
5338
5341
  language: j(i),
@@ -5423,7 +5426,7 @@ async function ca(t) {
5423
5426
  ]
5424
5427
  };
5425
5428
  }
5426
- const ma = `import {
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
- `, ua = `<script lang="ts">
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:46] -->
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
- `, da = `import { loadFlash } from "sveltekit-flash-message/server";
5550
+ `, fa = `import { loadFlash } from "sveltekit-flash-message/server";
5550
5551
 
5551
5552
  export const load = loadFlash(async ({ locals }) => {
5552
5553
  return {
@@ -5554,14 +5555,14 @@ export const load = loadFlash(async ({ locals }) => {
5554
5555
  user: locals.pb.authStore.record,
5555
5556
  };
5556
5557
  });
5557
- `, pa = /* @__PURE__ */ Object.assign({
5558
- "./preview-modifies/src/hooks.server.ts": ma,
5559
- "./preview-modifies/src/routes/(public)/root-layout.svelte": ua,
5560
- "./preview-modifies/src/routes/+layout.server.ts": da
5561
- }), fa = "./preview-modifies/";
5562
- async function ga(t) {
5563
- const e = Object.entries(pa).map(([n, r]) => {
5564
- const o = Mt(n, fa);
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 o = Mt(n, ha);
5565
5566
  return {
5566
5567
  path: o,
5567
5568
  language: j(o),
@@ -5577,24 +5578,24 @@ async function ga(t) {
5577
5578
  collections: []
5578
5579
  };
5579
5580
  }
5580
- const ha = "enable-auth", ba = "1.0.7", va = "src/patterns/enable/auth", wa = "/enable/auth";
5581
- async function ya(t) {
5582
- const e = await ca(t);
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 ga();
5585
+ const s = await ba();
5585
5586
  return k(dt([e, s]));
5586
5587
  }
5587
- const { generate: n } = await import("./generate.runtime-n2maauJK.js"), r = await n(t), { writeResult: o } = await import("./write-result-CbUTMeAc.js");
5588
+ const { generate: n } = await import("./generate.runtime-C9KDy9UE.js"), r = await n(t), { writeResult: o } = await import("./write-result-CbUTMeAc.js");
5588
5589
  return o(
5589
5590
  await k(dt([e, r])),
5590
5591
  t
5591
5592
  );
5592
5593
  }
5593
- const $a = {
5594
- version: ba,
5595
- slug: ha,
5596
- source: va,
5597
- docs: wa,
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
- categories: ["authentication"],
5606
+ category: "auth",
5606
5607
  tags: [
5607
5608
  "sveltekit",
5608
5609
  "authentication",
@@ -5617,25 +5618,30 @@ const $a = {
5617
5618
  argv: []
5618
5619
  },
5619
5620
  baseline: "velastack",
5620
- generate: ya
5621
- }, Jt = [
5622
- Rn,
5623
- wr,
5624
- Un,
5625
- cr,
5626
- $a
5627
- ], xa = Object.fromEntries(
5621
+ generate: xa
5622
+ }, Pa = ne.version, Jt = [
5623
+ zn,
5624
+ $r,
5625
+ Gn,
5626
+ ur,
5627
+ Fa
5628
+ ], za = Object.fromEntries(
5628
5629
  Jt.map((t) => [t.slug, t])
5629
- ), Ra = {
5630
- version: "0.1.0",
5631
- patterns: Jt,
5632
- bySlug: xa
5633
- };
5630
+ ), Ma = Jt.reduce(
5631
+ (t, e) => {
5632
+ const n = e.category;
5633
+ return t[n] ?? (t[n] = []), t[n].push(e), t;
5634
+ },
5635
+ {}
5636
+ );
5634
5637
  export {
5635
- _a as D,
5636
- ka as M,
5638
+ ka as D,
5639
+ Ra as M,
5640
+ za as a,
5641
+ Ma as b,
5637
5642
  d,
5638
- Ra as i,
5639
- j as l
5643
+ j as l,
5644
+ Jt as p,
5645
+ Pa as v
5640
5646
  };
5641
- //# sourceMappingURL=index-DIeQIeIr.js.map
5647
+ //# sourceMappingURL=index-hHlIVU0l.js.map