@velastack/patterns 0.0.7 → 0.0.8

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.
@@ -179,7 +179,7 @@ const ie = {
179
179
  function M(t) {
180
180
  return `$formData.${t.name}`;
181
181
  }
182
- function L(t) {
182
+ function O(t) {
183
183
  return t.inputProps ? Object.entries(t.inputProps).flatMap(([e, n]) => n == null || n === !1 ? [] : n === !0 ? [` ${e}`] : [` ${e}=${JSON.stringify(String(n))}`]).join("") : "";
184
184
  }
185
185
  function R(t) {
@@ -190,14 +190,14 @@ function R(t) {
190
190
  </div>
191
191
  ` : `<Form.Label>${t.title}</Form.Label>`;
192
192
  }
193
- function I(t, e) {
193
+ function T(t, e) {
194
194
  const n = t.required ? " required" : "";
195
195
  return p`
196
196
  <Form.Field {form} name="${t.name}" class="col-span-1">
197
197
  <Form.Control>
198
198
  {#snippet children({ props })}
199
199
  ${R(t)}
200
- <Input {...props} type="${e}" bind:value={${M(t)}}${n}${L(t)} />
200
+ <Input {...props} type="${e}" bind:value={${M(t)}}${n}${O(t)} />
201
201
  {/snippet}
202
202
  </Form.Control>
203
203
  <Form.FieldErrors class="contents text-destructive" />
@@ -211,7 +211,7 @@ function ce(t) {
211
211
  <Form.Control>
212
212
  {#snippet children({ props })}
213
213
  ${R(t)}
214
- <Textarea {...props} bind:value={${M(t)}}${e}${L(t)} />
214
+ <Textarea {...props} bind:value={${M(t)}}${e}${O(t)} />
215
215
  {/snippet}
216
216
  </Form.Control>
217
217
  <Form.FieldErrors class="contents text-destructive" />
@@ -224,7 +224,7 @@ function me(t) {
224
224
  <Form.Field {form} name="${t.name}" class="col-span-1 flex items-start space-x-2">
225
225
  <Form.Control>
226
226
  {#snippet children({ props })}
227
- <Checkbox {...props} bind:checked={${M(t)}}${e}${L(t)} />
227
+ <Checkbox {...props} bind:checked={${M(t)}}${e}${O(t)} />
228
228
  ${R(t)}
229
229
  {/snippet}
230
230
  </Form.Control>
@@ -263,7 +263,7 @@ function pe(t) {
263
263
  </div>
264
264
  {/snippet}
265
265
  {#snippet input()}
266
- <FileForm.Input {...props}${e}${L(t)} />
266
+ <FileForm.Input {...props}${e}${O(t)} />
267
267
  {/snippet}
268
268
  </FileForm.${n}>
269
269
  {/snippet}
@@ -354,7 +354,7 @@ function he(t) {
354
354
  <Form.Control>
355
355
  {#snippet children({ props })}
356
356
  ${R(t)}
357
- <Input {...props} type="text" value={${M(t)}}${L(t)} readonly />
357
+ <Input {...props} type="text" value={${M(t)}}${O(t)} readonly />
358
358
  {/snippet}
359
359
  </Form.Control>
360
360
  <Form.FieldErrors class="contents text-destructive" />
@@ -364,17 +364,17 @@ function he(t) {
364
364
  function et(t) {
365
365
  switch (t.type) {
366
366
  case "text":
367
- return I(t, "text");
367
+ return T(t, "text");
368
368
  case "number":
369
- return I(t, "number");
369
+ return T(t, "number");
370
370
  case "date":
371
- return I(t, "date");
371
+ return T(t, "date");
372
372
  case "email":
373
- return I(t, "email");
373
+ return T(t, "email");
374
374
  case "password":
375
- return I(t, "password");
375
+ return T(t, "password");
376
376
  case "url":
377
- return I(t, "url");
377
+ return T(t, "url");
378
378
  case "autodate":
379
379
  return he(t);
380
380
  case "editor":
@@ -394,7 +394,7 @@ function et(t) {
394
394
  return t;
395
395
  }
396
396
  }
397
- function Tt(t) {
397
+ function It(t) {
398
398
  const e = t.options.map(
399
399
  (n) => p`
400
400
  ${JSON.stringify(n.value)}: {
@@ -410,7 +410,7 @@ function Tt(t) {
410
410
  } as const;
411
411
  `;
412
412
  }
413
- function O(t) {
413
+ function L(t) {
414
414
  const e = t.flatMap((n) => ie[n.type]);
415
415
  return [...new Set(e)];
416
416
  }
@@ -582,7 +582,7 @@ function $e(t, e) {
582
582
  </div>
583
583
  `;
584
584
  }
585
- function Fe(t, e) {
585
+ function Ce(t, e) {
586
586
  switch (e.type) {
587
587
  case "text":
588
588
  case "number":
@@ -623,10 +623,10 @@ function Fe(t, e) {
623
623
  return e;
624
624
  }
625
625
  }
626
- const Ce = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), _e = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), Se = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), ke = /[^\p{L}\d]+/giu, dt = "$1\0$2", ft = "";
626
+ const Fe = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), Se = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), _e = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), ke = /[^\p{L}\d]+/giu, dt = "$1\0$2", ft = "";
627
627
  function zt(t) {
628
628
  let e = t.trim();
629
- e = e.replace(Ce, dt).replace(_e, dt), e = e.replace(ke, "\0");
629
+ e = e.replace(Fe, dt).replace(Se, dt), e = e.replace(ke, "\0");
630
630
  let n = 0, r = e.length;
631
631
  for (; e.charAt(n) === "\0"; )
632
632
  n++;
@@ -639,7 +639,7 @@ function zt(t) {
639
639
  function Pe(t) {
640
640
  const e = zt(t);
641
641
  for (let n = 0; n < e.length; n++) {
642
- const r = e[n], o = Se.exec(r);
642
+ const r = e[n], o = _e.exec(r);
643
643
  if (o) {
644
644
  const s = o.index + (o[1] ?? o[2]).length;
645
645
  e.splice(n, 1, r.slice(0, s), r.slice(s));
@@ -647,27 +647,27 @@ function Pe(t) {
647
647
  }
648
648
  return e;
649
649
  }
650
- function It(t, e) {
650
+ function Tt(t, e) {
651
651
  const [n, r, o] = G(t, e);
652
652
  return n + r.map(H(e == null ? void 0 : e.locale)).join((e == null ? void 0 : e.delimiter) ?? " ") + o;
653
653
  }
654
654
  function N(t, e) {
655
- const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), a = At(s, i);
655
+ 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
656
  return n + r.map((c, m) => m === 0 ? s(c) : a(c, m)).join("") + o;
657
657
  }
658
658
  function Me(t, e) {
659
- const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), a = At(s, i);
659
+ 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
660
  return n + r.map(a).join("") + o;
661
661
  }
662
662
  function rt(t, e) {
663
663
  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(Te(s, i)).join(" ") + o;
664
+ return n + r.map(Ie(s, i)).join(" ") + o;
665
665
  }
666
666
  function Re(t, e) {
667
- return It(t, { delimiter: "-", ...e });
667
+ return Tt(t, { delimiter: "-", ...e });
668
668
  }
669
669
  function Ee(t, e) {
670
- return It(t, { delimiter: "_", ...e });
670
+ return Tt(t, { delimiter: "_", ...e });
671
671
  }
672
672
  function H(t) {
673
673
  return t === !1 ? (e) => e.toLowerCase() : (e) => e.toLocaleLowerCase(t);
@@ -675,10 +675,10 @@ function H(t) {
675
675
  function at(t) {
676
676
  return (e) => e.toLocaleUpperCase(t);
677
677
  }
678
- function Te(t, e) {
678
+ function Ie(t, e) {
679
679
  return (n) => `${e(n[0])}${t(n.slice(1))}`;
680
680
  }
681
- function At(t, e) {
681
+ function Dt(t, e) {
682
682
  return (n, r) => {
683
683
  const o = n[0];
684
684
  return (r > 0 && o >= "0" && o <= "9" ? "_" + o : e(o)) + t(n.slice(1));
@@ -708,15 +708,15 @@ function G(t, e = {}) {
708
708
  function ze(t) {
709
709
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
710
710
  }
711
- function Ie(t) {
711
+ function Te(t) {
712
712
  throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
713
713
  }
714
- var V = { exports: {} }, Ae = V.exports, ht;
715
- function De() {
714
+ var V = { exports: {} }, De = V.exports, ht;
715
+ function Ae() {
716
716
  return ht || (ht = 1, (function(t, e) {
717
717
  (function(n, r) {
718
- typeof Ie == "function" ? t.exports = r() : n.pluralize = r();
719
- })(Ae, function() {
718
+ typeof Te == "function" ? t.exports = r() : n.pluralize = r();
719
+ })(De, function() {
720
720
  var n = [], r = [], o = {}, s = {}, i = {};
721
721
  function a(l) {
722
722
  return typeof l == "string" ? new RegExp("^" + l + "$", "i") : l;
@@ -731,29 +731,29 @@ function De() {
731
731
  }
732
732
  function h(l, d) {
733
733
  return l.replace(d[0], function(w, $) {
734
- var F = m(d[1], arguments);
735
- return c(w === "" ? l[$ - 1] : w, F);
734
+ var C = m(d[1], arguments);
735
+ return c(w === "" ? l[$ - 1] : w, C);
736
736
  });
737
737
  }
738
738
  function f(l, d, w) {
739
739
  if (!l.length || o.hasOwnProperty(l))
740
740
  return d;
741
741
  for (var $ = w.length; $--; ) {
742
- var F = w[$];
743
- if (F[0].test(d)) return h(d, F);
742
+ var C = w[$];
743
+ if (C[0].test(d)) return h(d, C);
744
744
  }
745
745
  return d;
746
746
  }
747
747
  function g(l, d, w) {
748
748
  return function($) {
749
- var F = $.toLowerCase();
750
- return d.hasOwnProperty(F) ? c($, F) : l.hasOwnProperty(F) ? c($, l[F]) : f(F, $, w);
749
+ var C = $.toLowerCase();
750
+ return d.hasOwnProperty(C) ? c($, C) : l.hasOwnProperty(C) ? c($, l[C]) : f(C, $, w);
751
751
  };
752
752
  }
753
753
  function x(l, d, w, $) {
754
- return function(F) {
755
- var T = F.toLowerCase();
756
- return d.hasOwnProperty(T) ? !0 : l.hasOwnProperty(T) ? !1 : f(T, T, w) === T;
754
+ return function(C) {
755
+ var I = C.toLowerCase();
756
+ return d.hasOwnProperty(I) ? !0 : l.hasOwnProperty(I) ? !1 : f(I, I, w) === I;
757
757
  };
758
758
  }
759
759
  function u(l, d, w) {
@@ -1011,8 +1011,8 @@ function De() {
1011
1011
  });
1012
1012
  })(V)), V.exports;
1013
1013
  }
1014
- var Ne = De();
1015
- const S = /* @__PURE__ */ ze(Ne), $a = "data", Fa = "migrations", Be = "(app)", je = /* @__PURE__ */ new Set([
1014
+ var Ne = Ae();
1015
+ const _ = /* @__PURE__ */ ze(Ne), Na = "data", Ba = "migrations", Be = "(app)", je = /* @__PURE__ */ new Set([
1016
1016
  "break",
1017
1017
  "case",
1018
1018
  "catch",
@@ -1064,7 +1064,7 @@ const S = /* @__PURE__ */ ze(Ne), $a = "data", Fa = "migrations", Be = "(app)",
1064
1064
  "async",
1065
1065
  "arguments",
1066
1066
  "constructor"
1067
- ]), Le = {
1067
+ ]), Oe = {
1068
1068
  function: "fn",
1069
1069
  interface: "iface",
1070
1070
  type: "type_",
@@ -1114,7 +1114,7 @@ const S = /* @__PURE__ */ ze(Ne), $a = "data", Fa = "migrations", Be = "(app)",
1114
1114
  constructor: "ctor"
1115
1115
  };
1116
1116
  function Z(t) {
1117
- return je.has(t) ? Le[t] ?? `${t}_` : t;
1117
+ return je.has(t) ? Oe[t] ?? `${t}_` : t;
1118
1118
  }
1119
1119
  function K(t) {
1120
1120
  if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(t))
@@ -1122,11 +1122,11 @@ function K(t) {
1122
1122
  "Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore"
1123
1123
  );
1124
1124
  }
1125
- function Oe(t) {
1125
+ function Le(t) {
1126
1126
  return t.features.auth ? `src/routes/${Be}` : "src/routes";
1127
1127
  }
1128
1128
  function E(t, e) {
1129
- const n = t.split("/"), r = n[n.length - 1], o = n.slice(0, -1), s = S.singular(rt(r)), i = S.plural(s), a = N(s), c = Re(i), m = [...o, c].join("/");
1129
+ const n = t.split("/"), r = n[n.length - 1], o = n.slice(0, -1), s = _.singular(rt(r)), i = _.plural(s), a = N(s), c = Re(i), m = [...o, c].join("/");
1130
1130
  return {
1131
1131
  name: Z(a),
1132
1132
  pluralName: Z(N(i)),
@@ -1136,7 +1136,7 @@ function E(t, e) {
1136
1136
  pluralDisplayName: i,
1137
1137
  schemaName: `${Z(a)}Schema`,
1138
1138
  routeSegment: m,
1139
- routesDir: Oe(e)
1139
+ routesDir: Le(e)
1140
1140
  };
1141
1141
  }
1142
1142
  function qe(t) {
@@ -1203,7 +1203,7 @@ function Ge(t) {
1203
1203
  function Ke(t) {
1204
1204
  return Object.fromEntries(t.map((e) => [e.name, e.id]));
1205
1205
  }
1206
- function Dt(t) {
1206
+ function At(t) {
1207
1207
  return Object.fromEntries(
1208
1208
  t.map((e) => [e.name, He(e.fields)])
1209
1209
  );
@@ -1217,7 +1217,7 @@ const We = [
1217
1217
  "account",
1218
1218
  "creator"
1219
1219
  ];
1220
- function A(t) {
1220
+ function D(t) {
1221
1221
  return t.toLowerCase();
1222
1222
  }
1223
1223
  function gt(t) {
@@ -1229,14 +1229,14 @@ function gt(t) {
1229
1229
  };
1230
1230
  }
1231
1231
  function Xe(t, e, n = {}) {
1232
- const r = new Set((n.authCollections ?? ["users"]).map(A)), o = new Set(
1233
- (n.userFieldHints ?? We).map(A)
1232
+ const r = new Set((n.authCollections ?? ["users"]).map(D)), o = new Set(
1233
+ (n.userFieldHints ?? We).map(D)
1234
1234
  ), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
1235
1235
  for (const b of t)
1236
1236
  i.set(b.name, b), a.set(b.id, b);
1237
1237
  if (!i.has(e))
1238
1238
  return gt(e);
1239
- if (r.has(A(e)))
1239
+ if (r.has(D(e)))
1240
1240
  return {
1241
1241
  rule: "@request.auth.id = id",
1242
1242
  ownershipChainCollections: [e],
@@ -1244,17 +1244,17 @@ function Xe(t, e, n = {}) {
1244
1244
  operator: "="
1245
1245
  };
1246
1246
  function c(b) {
1247
- const v = A(b);
1247
+ const v = D(b);
1248
1248
  return v === "user" ? 50 : o.has(v) ? 20 : 0;
1249
1249
  }
1250
1250
  function m(b) {
1251
1251
  const v = i.get(b);
1252
1252
  if (!(v != null && v.fields)) return [];
1253
- const C = [];
1253
+ const F = [];
1254
1254
  for (const y of v.fields) {
1255
1255
  if (y.type !== "relation" || !y.collectionId) continue;
1256
1256
  const z = a.get(y.collectionId);
1257
- z && C.push({
1257
+ z && F.push({
1258
1258
  from: b,
1259
1259
  fieldName: y.name,
1260
1260
  to: z.name,
@@ -1262,10 +1262,10 @@ function Xe(t, e, n = {}) {
1262
1262
  hintScore: c(y.name)
1263
1263
  });
1264
1264
  }
1265
- return C.sort((y, z) => y.fieldName.localeCompare(z.fieldName)), C;
1265
+ return F.sort((y, z) => y.fieldName.localeCompare(z.fieldName)), F;
1266
1266
  }
1267
1267
  function h(b) {
1268
- return r.has(A(b));
1268
+ return r.has(D(b));
1269
1269
  }
1270
1270
  function f(b) {
1271
1271
  if (b.length === 0) return !1;
@@ -1274,33 +1274,33 @@ function Xe(t, e, n = {}) {
1274
1274
  return h(b[b.length - 1].to);
1275
1275
  }
1276
1276
  function g(b) {
1277
- const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, z = b.reduce((Y, Zt) => Y + Zt.hintScore, 0), Jt = A(v.fieldName) === "user" ? 1 : 0;
1278
- return 100 * b.length + 50 * C - 40 * Jt - 15 * y - z;
1277
+ const v = b[b.length - 1], F = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, z = b.reduce((Y, Zt) => Y + Zt.hintScore, 0), Jt = D(v.fieldName) === "user" ? 1 : 0;
1278
+ return 100 * b.length + 50 * F - 40 * Jt - 15 * y - z;
1279
1279
  }
1280
1280
  function x(b) {
1281
1281
  return b.map((v) => `${v.from}.${v.fieldName}->${v.to}`).join("|");
1282
1282
  }
1283
1283
  const u = [], l = /* @__PURE__ */ new Set([e]);
1284
- function d(b, v, C) {
1285
- if (!(C > s)) {
1284
+ function d(b, v, F) {
1285
+ if (!(F > s)) {
1286
1286
  if (v.length > 0 && h(v[v.length - 1].to) && f(v)) {
1287
1287
  u.push([...v]);
1288
1288
  return;
1289
1289
  }
1290
1290
  for (const y of m(b))
1291
- l.has(y.to) || y.isMulti && !h(y.to) || (l.add(y.to), v.push(y), d(y.to, v, C + 1), v.pop(), l.delete(y.to));
1291
+ l.has(y.to) || y.isMulti && !h(y.to) || (l.add(y.to), v.push(y), d(y.to, v, F + 1), v.pop(), l.delete(y.to));
1292
1292
  }
1293
1293
  }
1294
1294
  if (d(e, [], 0), u.length === 0)
1295
1295
  return gt(e);
1296
1296
  u.sort((b, v) => {
1297
- const C = g(b) - g(v);
1298
- return C !== 0 ? C : x(b).localeCompare(x(v));
1297
+ const F = g(b) - g(v);
1298
+ return F !== 0 ? F : x(b).localeCompare(x(v));
1299
1299
  });
1300
- const w = u[0], $ = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)], lt = w[w.length - 1].isMulti ? "?=" : "=", Xt = $.join("."), Yt = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
1300
+ const w = u[0], $ = w.map((b) => b.fieldName), C = [e, ...w.map((b) => b.to)], lt = w[w.length - 1].isMulti ? "?=" : "=", Xt = $.join("."), Yt = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
1301
1301
  return {
1302
1302
  rule: `@request.auth.id ${lt} ${Yt}${Xt}.id`,
1303
- ownershipChainCollections: F,
1303
+ ownershipChainCollections: C,
1304
1304
  ownershipChainFields: $,
1305
1305
  operator: lt
1306
1306
  };
@@ -1428,11 +1428,11 @@ function Ze(t) {
1428
1428
  return n === "files" ? { type: "file", required: e, selectOptions: r } : (n in wt && (n = wt[n]), { type: n, required: e, selectOptions: r });
1429
1429
  }
1430
1430
  function yt(t) {
1431
- const e = S.singular(t), n = S.plural(e);
1431
+ const e = _.singular(t), n = _.plural(e);
1432
1432
  return t === n ? 99 : 1;
1433
1433
  }
1434
1434
  function q(t, e, n, r, o, s) {
1435
- const i = E(e, s), a = S.singular(t), c = S.plural(a);
1435
+ const i = E(e, s), a = _.singular(t), c = _.plural(a);
1436
1436
  return {
1437
1437
  collectionId: r[e],
1438
1438
  displayField: o[e] ?? "id",
@@ -1447,7 +1447,7 @@ function q(t, e, n, r, o, s) {
1447
1447
  };
1448
1448
  }
1449
1449
  function Qe(t, e, n, r, o) {
1450
- const s = rt(t), { type: i, required: a, selectOptions: c } = e, m = Ge(r), h = Ke(r), f = Dt(r), g = m.map((u) => S.singular(u));
1450
+ const s = rt(t), { type: i, required: a, selectOptions: c } = e, m = Ge(r), h = Ke(r), f = At(r), g = m.map((u) => _.singular(u));
1451
1451
  if (o.features.auth && i === "current_user" && h.users) {
1452
1452
  const u = q(
1453
1453
  t,
@@ -1497,7 +1497,7 @@ function Qe(t, e, n, r, o) {
1497
1497
  maxSelect: yt(t)
1498
1498
  };
1499
1499
  if (i === "relation") {
1500
- const u = S.singular(t), l = S.plural(u);
1500
+ const u = _.singular(t), l = _.plural(u);
1501
1501
  if (!m.includes(l))
1502
1502
  throw new Error(
1503
1503
  `Invalid relation field: ${t}. Must be one of ${m.join(", ")} (singular or plural)`
@@ -1538,7 +1538,7 @@ function Qe(t, e, n, r, o) {
1538
1538
  };
1539
1539
  }
1540
1540
  if (g.includes(i)) {
1541
- const u = S.plural(i);
1541
+ const u = _.plural(i);
1542
1542
  if (m.includes(u)) {
1543
1543
  const l = q(
1544
1544
  t,
@@ -1637,7 +1637,7 @@ function tn(t, e, n, r) {
1637
1637
  async function W(t, e, n) {
1638
1638
  let r;
1639
1639
  if (n.env === "runtime") {
1640
- const { getCollections: o } = await import("./env.runtime-C0w1qoWl.js");
1640
+ const { getCollections: o } = await import("./env.runtime-sHetoQ7B.js");
1641
1641
  r = await o();
1642
1642
  } else {
1643
1643
  const { getPreviewCollections: o } = await import("./env.preview-HlXZOEL4.js");
@@ -1695,7 +1695,7 @@ function nn(t) {
1695
1695
  return;
1696
1696
  }
1697
1697
  }
1698
- function D(t, e) {
1698
+ function A(t, e) {
1699
1699
  return t.replace("[id]", `\${${e}}`);
1700
1700
  }
1701
1701
  function Nt(t, e, n) {
@@ -1920,7 +1920,7 @@ function cn(t, e, n, r, o) {
1920
1920
  describe("GET ${e.show}", () => {
1921
1921
  it("should return a 200 status code", async (context) => {
1922
1922
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1923
- const response = await ${a}.get(\`${D(e.show, "id")}\`);
1923
+ const response = await ${a}.get(\`${A(e.show, "id")}\`);
1924
1924
  expect(response.status).toBe(200);
1925
1925
  });
1926
1926
 
@@ -1933,10 +1933,10 @@ function cn(t, e, n, r, o) {
1933
1933
  describe("POST ${e.show}", () => {
1934
1934
  it("should delete a ${t.displayName.toLowerCase()}", async (context) => {
1935
1935
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1936
- const response = await ${a}.post(\`${D(e.show, "id")}\`).type("form");
1936
+ const response = await ${a}.post(\`${A(e.show, "id")}\`).type("form");
1937
1937
  expect(response.body.status).toBe(303);
1938
1938
 
1939
- const response2 = await ${a}.get(\`${D(e.show, "id")}\`);
1939
+ const response2 = await ${a}.get(\`${A(e.show, "id")}\`);
1940
1940
  expect(response2.status).toBe(404);
1941
1941
  });
1942
1942
  });
@@ -1944,7 +1944,7 @@ function cn(t, e, n, r, o) {
1944
1944
  describe("GET ${e.edit}", () => {
1945
1945
  it("should return a 200 status code", async (context) => {
1946
1946
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1947
- const response = await ${a}.get(\`${D(e.edit, "id")}\`);
1947
+ const response = await ${a}.get(\`${A(e.edit, "id")}\`);
1948
1948
  expect(response.status).toBe(200);
1949
1949
  });
1950
1950
  });
@@ -1953,11 +1953,11 @@ function cn(t, e, n, r, o) {
1953
1953
  it("should update a ${t.displayName.toLowerCase()}", async (context) => {
1954
1954
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1955
1955
  const response = await ${a}
1956
- .post(\`${D(e.edit, "id")}\`)
1956
+ .post(\`${A(e.edit, "id")}\`)
1957
1957
  .type("form")
1958
1958
  .send(${m});
1959
1959
  expect(response.body.status).toBe(303);
1960
- expect(response.body.location).toBe(\`${D(e.show, "id")}\`);
1960
+ expect(response.body.location).toBe(\`${A(e.show, "id")}\`);
1961
1961
  });
1962
1962
  });
1963
1963
  });
@@ -1987,20 +1987,18 @@ function mn(t, e, n, r, o) {
1987
1987
  });
1988
1988
  `;
1989
1989
  }
1990
- var $t = Object.freeze, un = Object.defineProperty, pn = (t, e) => $t(un(t, "raw", { value: $t(t.slice()) })), Ft;
1990
+ var $t = Object.freeze, un = Object.defineProperty, pn = (t, e) => $t(un(t, "raw", { value: $t(t.slice()) })), Ct;
1991
1991
  function dn(t, e) {
1992
1992
  const n = t.replace(/^\/+|\/+$/g, ""), r = `${e}/${n}`, o = `/${n}`;
1993
1993
  return {
1994
- pagePath: `${r}/new`,
1995
- pageUrl: `${o}/new`
1994
+ pagePath: r,
1995
+ pageUrl: o
1996
1996
  };
1997
1997
  }
1998
1998
  function fn(t) {
1999
1999
  const [e, ...n] = t;
2000
2000
  if (!e)
2001
- throw new Error(
2002
- "Invalid command arguments. Expected: <model> <fields...>"
2003
- );
2001
+ throw new Error("Invalid command arguments. Expected: <model> <fields...>");
2004
2002
  if (n.length === 0)
2005
2003
  throw new Error("At least one field definition is required.");
2006
2004
  return { modelPath: e, fields: n };
@@ -2011,7 +2009,7 @@ function jt(t) {
2011
2009
  function hn(t) {
2012
2010
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
2013
2011
  }
2014
- function Ct(t) {
2012
+ function Ft(t) {
2015
2013
  const e = t.type === "select" ? `[${t.options.map((o) => JSON.stringify(o.value)).join(", ")}]` : "";
2016
2014
  let n;
2017
2015
  switch (t.type) {
@@ -2073,7 +2071,7 @@ function gn(t) {
2073
2071
  if (n.type === "file" && n.maxSelect > 1) {
2074
2072
  e.push({
2075
2073
  name: n.name,
2076
- schema: Ct({ ...n, required: !1 })
2074
+ schema: Ft({ ...n, required: !1 })
2077
2075
  }), e.push({
2078
2076
  name: `${n.name}+`,
2079
2077
  schema: "z.instanceof(File).array().optional()"
@@ -2083,7 +2081,7 @@ function gn(t) {
2083
2081
  });
2084
2082
  continue;
2085
2083
  }
2086
- e.push({ name: n.name, schema: Ct(n) });
2084
+ e.push({ name: n.name, schema: Ft(n) });
2087
2085
  }
2088
2086
  return e;
2089
2087
  }
@@ -2099,7 +2097,7 @@ function bn(t, e) {
2099
2097
  `;
2100
2098
  }
2101
2099
  function vn(t, e) {
2102
- const n = O(e), r = [
2100
+ const n = L(e), r = [
2103
2101
  'import { untrack } from "svelte";',
2104
2102
  'import { superForm } from "sveltekit-superforms";',
2105
2103
  'import { zodClient } from "sveltekit-superforms/adapters";',
@@ -2111,7 +2109,7 @@ function vn(t, e) {
2111
2109
  function wn(t, e) {
2112
2110
  const r = e.filter(
2113
2111
  (o) => o.type === "select"
2114
- ).map((o) => Tt(o)).join(`
2112
+ ).map((o) => It(o)).join(`
2115
2113
 
2116
2114
  `);
2117
2115
  return p`
@@ -2128,7 +2126,7 @@ function yn(t, e) {
2128
2126
  const n = vn(t, e).join(`
2129
2127
  `), r = wn(t, e), o = e.map((i) => et(i)).join(`
2130
2128
  `), s = jt(e) ? ' enctype="multipart/form-data"' : "";
2131
- return p(Ft || (Ft = pn([`
2129
+ return p(Ct || (Ct = pn([`
2132
2130
  <script lang="ts">
2133
2131
  `, `
2134
2132
 
@@ -2193,15 +2191,23 @@ function U(t, e) {
2193
2191
  async function $n(t) {
2194
2192
  const { modelPath: e, fields: n } = fn(t.argv);
2195
2193
  K(e);
2196
- const r = E(e, t), s = (await W(n, r, t)).fields, { pagePath: i, pageUrl: a } = dn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-C0w1qoWl.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), m = [
2194
+ const r = E(e, t), s = (await W(n, r, t)).fields, { pagePath: i, pageUrl: a } = dn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-sHetoQ7B.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(
2195
+ t
2196
+ ), m = [
2197
2197
  U(`${i}/+page.svelte`, yn(r, s)),
2198
2198
  U(`${i}/+page.server.ts`, xn(r, s)),
2199
2199
  U(
2200
2200
  `${i}/server.test.ts`,
2201
- mn(r, a, s, t, c)
2201
+ mn(
2202
+ r,
2203
+ a,
2204
+ s,
2205
+ t,
2206
+ c
2207
+ )
2202
2208
  ),
2203
2209
  U(`src/lib/schemas/${r.name}.ts`, bn(r, s))
2204
- ], h = O(s);
2210
+ ], h = L(s);
2205
2211
  return {
2206
2212
  creates: m,
2207
2213
  modifies: [],
@@ -2211,16 +2217,20 @@ async function $n(t) {
2211
2217
  collections: []
2212
2218
  };
2213
2219
  }
2214
- const Fn = "generate-form";
2215
- async function Cn(t) {
2220
+ const Cn = "generate-form", Fn = "1.0.7", Sn = "src/patterns/generate/form", _n = "/generate/form";
2221
+ async function kn(t) {
2216
2222
  const e = await $n(t);
2217
2223
  if (t.env !== "runtime")
2218
2224
  return k(e);
2219
2225
  const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
2220
2226
  return n(await k(e), t);
2221
2227
  }
2222
- const _n = {
2223
- slug: Fn,
2228
+ const Pn = {
2229
+ version: Fn,
2230
+ slug: Cn,
2231
+ source: Sn,
2232
+ docs: _n,
2233
+ plan: "open",
2224
2234
  title: "Generate a form",
2225
2235
  summary: "Generates a form.",
2226
2236
  categories: ["forms"],
@@ -2231,8 +2241,8 @@ const _n = {
2231
2241
  argv: ["contact", "name:text", "email:email", "message:editor"]
2232
2242
  },
2233
2243
  baseline: "velastack",
2234
- generate: Cn
2235
- }, Sn = ["text"], kn = {
2244
+ generate: kn
2245
+ }, Mn = ["text"], Rn = {
2236
2246
  string: "text",
2237
2247
  boolean: "bool",
2238
2248
  geopoint: "geoPoint",
@@ -2259,10 +2269,10 @@ const _n = {
2259
2269
  geoPoint: "geoPoint",
2260
2270
  relation: "relation"
2261
2271
  };
2262
- function Pn(t) {
2272
+ function En(t) {
2263
2273
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
2264
2274
  }
2265
- function Mn(t, e) {
2275
+ function In(t, e) {
2266
2276
  const n = t.type === "select" ? `[${(t.options ?? []).map((o) => JSON.stringify(o.value)).join(", ")}]` : "";
2267
2277
  let r;
2268
2278
  switch (t.type) {
@@ -2321,7 +2331,7 @@ function Mn(t, e) {
2321
2331
  default:
2322
2332
  return t.type;
2323
2333
  }
2324
- return Sn.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()`;
2334
+ 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()`;
2325
2335
  }
2326
2336
  function ot(t, e, n) {
2327
2337
  const r = [];
@@ -2333,7 +2343,7 @@ function ot(t, e, n) {
2333
2343
  }
2334
2344
  r.push(a);
2335
2345
  }
2336
- const o = r.map((a) => `${Pn(a.name)}: ${Mn(a, n)}`).join(`,
2346
+ const o = r.map((a) => `${En(a.name)}: ${In(a, n)}`).join(`,
2337
2347
  `), s = n.includeModelFields ? `
2338
2348
  import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
2339
2349
  return p`
@@ -2344,8 +2354,8 @@ import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelField
2344
2354
  })${i};
2345
2355
  `;
2346
2356
  }
2347
- function Rn(t) {
2348
- const e = kn[t];
2357
+ function zn(t) {
2358
+ const e = Rn[t];
2349
2359
  if (!e)
2350
2360
  throw new Error(`Unsupported collection field type "${t}" when generating from collection`);
2351
2361
  return e;
@@ -2354,11 +2364,11 @@ function st(t, e, n) {
2354
2364
  const r = e.find((a) => a.name === t.tableName);
2355
2365
  if (!r)
2356
2366
  throw new Error(`Collection "${t.tableName}" not found`);
2357
- const o = Dt(e), s = new Map(e.map((a) => [a.id, a])), i = [];
2367
+ const o = At(e), s = new Map(e.map((a) => [a.id, a])), i = [];
2358
2368
  for (const a of r.fields) {
2359
2369
  if (a.name === "id" || a.system)
2360
2370
  continue;
2361
- const c = Rn(a.type), m = !!a.required, h = rt(a.name);
2371
+ const c = zn(a.type), m = !!a.required, h = rt(a.name);
2362
2372
  if (c === "relation") {
2363
2373
  const f = a.collectionId ? s.get(a.collectionId) : void 0;
2364
2374
  if (!f)
@@ -2424,17 +2434,17 @@ function st(t, e, n) {
2424
2434
  }
2425
2435
  return i.filter((a) => a.name !== "id");
2426
2436
  }
2427
- function Lt(t) {
2437
+ function Ot(t) {
2428
2438
  const e = t.filter((n) => n.type === "relation").map((n) => n.name);
2429
2439
  return e.length > 0 ? e.join(",") : void 0;
2430
2440
  }
2431
- function Ot(t) {
2441
+ function Lt(t) {
2432
2442
  const e = /* @__PURE__ */ new Set(), n = [];
2433
2443
  for (const r of t)
2434
2444
  r.type === "relation" && (e.has(r.relatedModel.tableName) || (e.add(r.relatedModel.tableName), n.push(r.relatedModel)));
2435
2445
  return n;
2436
2446
  }
2437
- function En(t) {
2447
+ function Tn(t) {
2438
2448
  const e = {
2439
2449
  name: t.name,
2440
2450
  type: t.type,
@@ -2469,10 +2479,10 @@ function qt(t, e, n) {
2469
2479
  name: t.tableName,
2470
2480
  type: "base",
2471
2481
  ...r,
2472
- fields: e.map(En)
2482
+ fields: e.map(Tn)
2473
2483
  };
2474
2484
  }
2475
- function Tn(t) {
2485
+ function Dn(t) {
2476
2486
  const [e, ...n] = t;
2477
2487
  if (!e)
2478
2488
  throw new Error(
@@ -2480,25 +2490,25 @@ function Tn(t) {
2480
2490
  );
2481
2491
  return { modelPath: e, fields: n };
2482
2492
  }
2483
- function zn(t, e) {
2493
+ function An(t, e) {
2484
2494
  return {
2485
2495
  path: t,
2486
2496
  language: j(t),
2487
2497
  content: e
2488
2498
  };
2489
2499
  }
2490
- async function In(t, e, n) {
2500
+ async function Nn(t, e, n) {
2491
2501
  K(e);
2492
2502
  const r = E(e, t);
2493
2503
  if (n.length > 0) {
2494
2504
  const i = await W(n, r, t);
2495
2505
  return { model: r, fields: i.fields, auth: i.auth, shouldCreateCollection: !0 };
2496
2506
  }
2497
- const o = t.env === "runtime" ? await (await import("./env.runtime-C0w1qoWl.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
2507
+ const o = t.env === "runtime" ? await (await import("./env.runtime-sHetoQ7B.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
2498
2508
  return { model: r, fields: s, auth: void 0, shouldCreateCollection: !1 };
2499
2509
  }
2500
- async function An(t) {
2501
- const { modelPath: e, fields: n } = Tn(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i } = await In(
2510
+ async function Bn(t) {
2511
+ const { modelPath: e, fields: n } = Dn(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i } = await Nn(
2502
2512
  t,
2503
2513
  e,
2504
2514
  n
@@ -2507,7 +2517,7 @@ async function An(t) {
2507
2517
  forForm: !0
2508
2518
  });
2509
2519
  return {
2510
- creates: [zn(a, c)],
2520
+ creates: [An(a, c)],
2511
2521
  modifies: [],
2512
2522
  deletes: [],
2513
2523
  components: [],
@@ -2515,19 +2525,26 @@ async function An(t) {
2515
2525
  collections: i ? [qt(r, o, s)] : []
2516
2526
  };
2517
2527
  }
2518
- const Dn = "generate-resource";
2519
- async function Nn(t) {
2520
- const e = await An(t);
2528
+ const jn = "generate-resource", On = "1.0.7", Ln = "src/patterns/generate/resource", qn = "/generate/resource";
2529
+ async function Un(t) {
2530
+ const e = await Bn(t);
2521
2531
  if (t.env !== "runtime")
2522
2532
  return k(e);
2523
- const { createCollections: n } = await import("./collections-BaY_bexm.js"), r = await n(e.collections, t), o = {
2533
+ const { createCollections: n } = await import("./collections-BIx6tDrV.js"), r = await n(
2534
+ e.collections,
2535
+ t
2536
+ ), o = {
2524
2537
  ...e,
2525
2538
  creates: [...e.creates, ...r]
2526
2539
  }, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
2527
2540
  return s(await k(o), t);
2528
2541
  }
2529
- const Bn = {
2530
- slug: Dn,
2542
+ const Vn = {
2543
+ version: On,
2544
+ slug: jn,
2545
+ source: Ln,
2546
+ docs: qn,
2547
+ plan: "open",
2531
2548
  title: "Generate a resource",
2532
2549
  summary: "Generates model schema resources.",
2533
2550
  categories: ["data"],
@@ -2538,10 +2555,10 @@ const Bn = {
2538
2555
  argv: ["contact", "name:text", "email:email"]
2539
2556
  },
2540
2557
  baseline: "velastack",
2541
- generate: Nn
2558
+ generate: Un
2542
2559
  };
2543
- var _t = Object.freeze, jn = Object.defineProperty, X = (t, e) => _t(jn(t, "raw", { value: _t(e || t.slice()) })), St, kt, Pt, Mt;
2544
- function Ln(t) {
2560
+ var St = Object.freeze, Hn = Object.defineProperty, X = (t, e) => St(Hn(t, "raw", { value: St(e || t.slice()) })), _t, kt, Pt, Mt;
2561
+ function Gn(t) {
2545
2562
  const [e, ...n] = t;
2546
2563
  if (!e)
2547
2564
  throw new Error(
@@ -2549,7 +2566,7 @@ function Ln(t) {
2549
2566
  );
2550
2567
  return { modelPath: e, fields: n };
2551
2568
  }
2552
- function _(t, e) {
2569
+ function S(t, e) {
2553
2570
  return {
2554
2571
  path: t,
2555
2572
  language: j(t),
@@ -2565,20 +2582,20 @@ function Vt(t) {
2565
2582
  function it(t) {
2566
2583
  return t.filter(
2567
2584
  (e) => e.type === "select"
2568
- ).map((e) => Tt(e)).join(`
2585
+ ).map((e) => It(e)).join(`
2569
2586
 
2570
2587
  `);
2571
2588
  }
2572
2589
  function Ht(t, e) {
2573
- return Ot(t).map(
2590
+ return Lt(t).map(
2574
2591
  (n) => `const ${n.pluralName} = await ${e}.collection("${n.tableName}").getFullList();`
2575
2592
  ).join(`
2576
2593
  `);
2577
2594
  }
2578
2595
  function Gt(t) {
2579
- return Ot(t).map((e) => e.pluralName).join(", ");
2596
+ return Lt(t).map((e) => e.pluralName).join(", ");
2580
2597
  }
2581
- function On(t) {
2598
+ function Kn(t) {
2582
2599
  return t.features.auth ? "locals.pb" : "locals.admin";
2583
2600
  }
2584
2601
  function Kt(t, e, n = !1) {
@@ -2594,13 +2611,13 @@ function Kt(t, e, n = !1) {
2594
2611
  const { form: formData } = form;
2595
2612
  `;
2596
2613
  }
2597
- function qn(t, e, n) {
2614
+ function Wn(t, e, n) {
2598
2615
  const r = n.some((a) => a.type === "select"), o = Vt([
2599
2616
  'import { untrack } from "svelte";',
2600
2617
  'import { superForm } from "sveltekit-superforms";',
2601
2618
  'import { zodClient } from "sveltekit-superforms/adapters";',
2602
2619
  `import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
2603
- ...nt(O(n)),
2620
+ ...nt(L(n)),
2604
2621
  'import { Button } from "$lib/components/ui/button";',
2605
2622
  'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
2606
2623
  'import * as Form from "$lib/components/ui/form";',
@@ -2608,7 +2625,7 @@ function qn(t, e, n) {
2608
2625
  ]).join(`
2609
2626
  `), s = n.map((a) => et(a)).join(`
2610
2627
  `), i = Ut(n) ? ' enctype="multipart/form-data"' : "";
2611
- return p(St || (St = X([`
2628
+ return p(_t || (_t = X([`
2612
2629
  <script lang="ts">
2613
2630
  `, `
2614
2631
  `, `
@@ -2637,13 +2654,13 @@ function qn(t, e, n) {
2637
2654
  </section>
2638
2655
  `])), o, Kt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
2639
2656
  }
2640
- function Un(t, e, n) {
2657
+ function Xn(t, e, n) {
2641
2658
  const r = n.some((a) => a.type === "select"), o = Vt([
2642
2659
  'import { untrack } from "svelte";',
2643
2660
  'import { superForm } from "sveltekit-superforms";',
2644
2661
  'import { zodClient } from "sveltekit-superforms/adapters";',
2645
2662
  `import { ${t.schemaName} } from "$lib/schemas/${t.name}";`,
2646
- ...nt(O(n)),
2663
+ ...nt(L(n)),
2647
2664
  'import { Button } from "$lib/components/ui/button";',
2648
2665
  'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
2649
2666
  'import * as Form from "$lib/components/ui/form";',
@@ -2707,7 +2724,7 @@ function Un(t, e, n) {
2707
2724
  </section>
2708
2725
  `])), o, Kt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
2709
2726
  }
2710
- function Vn(t, e, n) {
2727
+ function Yn(t, e, n) {
2711
2728
  const r = n.some((a) => a.type === "select"), o = r ? `${it(n)}` : "", s = n.map((a) => {
2712
2729
  let c = "{ getValue }", m = "{ value: getValue() }";
2713
2730
  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 }"), p`
@@ -3097,8 +3114,8 @@ function Vn(t, e, n) {
3097
3114
  </section>
3098
3115
  `])), 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());
3099
3116
  }
3100
- function Hn(t, e, n) {
3101
- const r = Lt(e), o = r ? `{ expand: "${r}" }` : "";
3117
+ function Jn(t, e, n) {
3118
+ const r = Ot(e), o = r ? `{ expand: "${r}" }` : "";
3102
3119
  return p`
3103
3120
  export const load = async ({ locals }) => {
3104
3121
  const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${o});
@@ -3106,7 +3123,7 @@ function Hn(t, e, n) {
3106
3123
  };
3107
3124
  `;
3108
3125
  }
3109
- function Gn(t, e, n, r, o) {
3126
+ function Zn(t, e, n, r, o) {
3110
3127
  const s = Ht(n, r), i = Gt(n), a = i ? `, ${i}` : "", c = n.find(
3111
3128
  (h) => h.type === "relation" && h.isCurrentUser
3112
3129
  ), m = o && c ? p`
@@ -3148,8 +3165,8 @@ function Gn(t, e, n, r, o) {
3148
3165
  };
3149
3166
  `;
3150
3167
  }
3151
- function Kn(t, e, n, r) {
3152
- const o = Lt(n), s = o ? `, { expand: "${o}" }` : "";
3168
+ function Qn(t, e, n, r) {
3169
+ const o = Ot(n), s = o ? `, { expand: "${o}" }` : "";
3153
3170
  return p`
3154
3171
  import { error, redirect } from "@sveltejs/kit";
3155
3172
 
@@ -3170,7 +3187,7 @@ function Kn(t, e, n, r) {
3170
3187
  };
3171
3188
  `;
3172
3189
  }
3173
- function Wn(t, e, n) {
3190
+ function tr(t, e, n) {
3174
3191
  const r = n.some((m) => m.type === "select"), o = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
3175
3192
  'import { Button } from "$lib/components/ui/button";',
3176
3193
  'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
@@ -3178,7 +3195,7 @@ function Wn(t, e, n) {
3178
3195
  o ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
3179
3196
  s ? 'import FileIcon from "@lucide/svelte/icons/file";' : ""
3180
3197
  ].filter(Boolean).join(`
3181
- `), a = it(n), c = n.map((m) => Fe(t, m)).join(`
3198
+ `), a = it(n), c = n.map((m) => Ce(t, m)).join(`
3182
3199
  `);
3183
3200
  return p(Mt || (Mt = X([`
3184
3201
  <script lang="ts">
@@ -3214,7 +3231,7 @@ function Wn(t, e, n) {
3214
3231
  </section>
3215
3232
  `])), i, a, t.displayName, e.list, c, e.list, t.name);
3216
3233
  }
3217
- function Xn(t, e, n, r) {
3234
+ function er(t, e, n, r) {
3218
3235
  const o = Ht(n, r), s = Gt(n), i = s ? `, ${s}` : "";
3219
3236
  return p`
3220
3237
  import { error, fail, redirect } from "@sveltejs/kit";
@@ -3256,9 +3273,9 @@ function Xn(t, e, n, r) {
3256
3273
  };
3257
3274
  `;
3258
3275
  }
3259
- async function Yn(t, e, n) {
3276
+ async function nr(t, e, n) {
3260
3277
  K(e);
3261
- const r = E(e, t), o = t.env === "runtime" ? await (await import("./env.runtime-C0w1qoWl.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t);
3278
+ const r = E(e, t), o = t.env === "runtime" ? await (await import("./env.runtime-sHetoQ7B.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t);
3262
3279
  if (n.length > 0) {
3263
3280
  const i = await W(n, r, t);
3264
3281
  return {
@@ -3278,52 +3295,52 @@ async function Yn(t, e, n) {
3278
3295
  collections: o
3279
3296
  };
3280
3297
  }
3281
- async function Jn(t) {
3282
- const { modelPath: e, fields: n } = Ln(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i, collections: a } = await Yn(t, e, n), c = qe(r), m = Ue(r), h = On(t), f = o.filter(
3298
+ async function rr(t) {
3299
+ 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 = Ue(r), h = Kn(t), f = o.filter(
3283
3300
  (u) => !(u.type === "relation" && u.isCurrentUser)
3284
3301
  ), g = [
3285
- _(
3302
+ S(
3286
3303
  `src/lib/schemas/${r.name}.ts`,
3287
3304
  ot(r, o, {
3288
3305
  includeModelFields: !0,
3289
3306
  forForm: !0
3290
3307
  })
3291
3308
  ),
3292
- _(
3309
+ S(
3293
3310
  `${c.list}/+page.server.ts`,
3294
- Hn(r, f, h)
3311
+ Jn(r, f, h)
3295
3312
  ),
3296
- _(
3313
+ S(
3297
3314
  `${c.list}/+page.svelte`,
3298
- Vn(r, m, f)
3315
+ Yn(r, m, f)
3299
3316
  ),
3300
- _(
3317
+ S(
3301
3318
  `${c.new}/+page.server.ts`,
3302
- Gn(r, m, f, h, t.features.auth)
3319
+ Zn(r, m, f, h, t.features.auth)
3303
3320
  ),
3304
- _(`${c.new}/+page.svelte`, qn(r, m, f)),
3305
- _(
3321
+ S(`${c.new}/+page.svelte`, Wn(r, m, f)),
3322
+ S(
3306
3323
  `${c.show}/+page.server.ts`,
3307
- Kn(r, m, f, h)
3324
+ Qn(r, m, f, h)
3308
3325
  ),
3309
- _(
3326
+ S(
3310
3327
  `${c.show}/+page.svelte`,
3311
- Wn(r, m, f)
3328
+ tr(r, m, f)
3312
3329
  ),
3313
- _(
3330
+ S(
3314
3331
  `${c.edit}/+page.server.ts`,
3315
- Xn(r, m, f, h)
3332
+ er(r, m, f, h)
3316
3333
  ),
3317
- _(
3334
+ S(
3318
3335
  `${c.edit}/+page.svelte`,
3319
- Un(r, m, f)
3336
+ Xn(r, m, f)
3320
3337
  ),
3321
- _(
3338
+ S(
3322
3339
  `${c.list}/server.test.ts`,
3323
3340
  cn(r, m, o, t, a)
3324
3341
  )
3325
3342
  ], x = [
3326
- ...O(f),
3343
+ ...L(f),
3327
3344
  "button",
3328
3345
  "table",
3329
3346
  "data-table",
@@ -3349,19 +3366,26 @@ async function Jn(t) {
3349
3366
  collections: i ? [qt(r, o, s)] : []
3350
3367
  };
3351
3368
  }
3352
- const Zn = "generate-scaffold";
3353
- async function Qn(t) {
3354
- const e = await Jn(t);
3369
+ const ar = "generate-scaffold", or = "1.0.7", sr = "src/patterns/generate/scaffold", ir = "/generate/scaffold";
3370
+ async function lr(t) {
3371
+ const e = await rr(t);
3355
3372
  if (t.env !== "runtime")
3356
3373
  return k(e);
3357
- const { createCollections: n } = await import("./collections-BaY_bexm.js"), r = await n(e.collections, t), o = {
3374
+ const { createCollections: n } = await import("./collections-BIx6tDrV.js"), r = await n(
3375
+ e.collections,
3376
+ t
3377
+ ), o = {
3358
3378
  ...e,
3359
3379
  creates: [...e.creates, ...r]
3360
3380
  }, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
3361
3381
  return s(await k(o), t);
3362
3382
  }
3363
- const tr = {
3364
- slug: Zn,
3383
+ const cr = {
3384
+ version: or,
3385
+ slug: ar,
3386
+ source: sr,
3387
+ docs: ir,
3388
+ plan: "open",
3365
3389
  title: "Generate a scaffold",
3366
3390
  summary: "Generates CRUD routes and schema.",
3367
3391
  categories: ["data", "forms"],
@@ -3372,9 +3396,9 @@ const tr = {
3372
3396
  argv: ["contact", "name:text", "email:email"]
3373
3397
  },
3374
3398
  baseline: "velastack",
3375
- generate: Qn
3399
+ generate: lr
3376
3400
  };
3377
- function er(t) {
3401
+ function mr(t) {
3378
3402
  const [e, ...n] = t;
3379
3403
  if (!e)
3380
3404
  throw new Error(
@@ -3382,25 +3406,25 @@ function er(t) {
3382
3406
  );
3383
3407
  return { modelPath: e, fields: n };
3384
3408
  }
3385
- function nr(t, e) {
3409
+ function ur(t, e) {
3386
3410
  return {
3387
3411
  path: t,
3388
3412
  language: j(t),
3389
3413
  content: e
3390
3414
  };
3391
3415
  }
3392
- async function rr(t, e, n) {
3416
+ async function pr(t, e, n) {
3393
3417
  K(e);
3394
3418
  const r = E(e, t);
3395
3419
  if (n.length > 0) {
3396
3420
  const i = await W(n, r, t);
3397
3421
  return { model: r, fields: i.fields, includeModelFields: !1 };
3398
3422
  }
3399
- const o = t.env === "runtime" ? await (await import("./env.runtime-C0w1qoWl.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
3423
+ const o = t.env === "runtime" ? await (await import("./env.runtime-sHetoQ7B.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
3400
3424
  return { model: r, fields: s, includeModelFields: !0 };
3401
3425
  }
3402
- async function ar(t) {
3403
- const { modelPath: e, fields: n } = er(t.argv), { model: r, fields: o, includeModelFields: s } = await rr(
3426
+ async function dr(t) {
3427
+ const { modelPath: e, fields: n } = mr(t.argv), { model: r, fields: o, includeModelFields: s } = await pr(
3404
3428
  t,
3405
3429
  e,
3406
3430
  n
@@ -3409,7 +3433,7 @@ async function ar(t) {
3409
3433
  forForm: !0
3410
3434
  });
3411
3435
  return {
3412
- creates: [nr(i, a)],
3436
+ creates: [ur(i, a)],
3413
3437
  modifies: [],
3414
3438
  deletes: [],
3415
3439
  components: [],
@@ -3417,16 +3441,20 @@ async function ar(t) {
3417
3441
  collections: []
3418
3442
  };
3419
3443
  }
3420
- const or = "generate-schema";
3421
- async function sr(t) {
3422
- const e = await ar(t);
3444
+ const fr = "generate-schema", hr = "1.0.7", gr = "src/patterns/generate/schema", br = "/generate/schema";
3445
+ async function vr(t) {
3446
+ const e = await dr(t);
3423
3447
  if (t.env !== "runtime")
3424
3448
  return k(e);
3425
3449
  const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
3426
3450
  return n(await k(e), t);
3427
3451
  }
3428
- const ir = {
3429
- slug: or,
3452
+ const wr = {
3453
+ version: hr,
3454
+ slug: fr,
3455
+ source: gr,
3456
+ docs: br,
3457
+ plan: "open",
3430
3458
  title: "Generate a schema",
3431
3459
  summary: "Generates a zod schema.",
3432
3460
  categories: ["data"],
@@ -3437,8 +3465,8 @@ const ir = {
3437
3465
  argv: ["contact", "name:text", "email:email"]
3438
3466
  },
3439
3467
  baseline: "velastack",
3440
- generate: sr
3441
- }, lr = `<script lang="ts" module>
3468
+ generate: vr
3469
+ }, yr = `<script lang="ts" module>
3442
3470
  import HomeIcon from '@lucide/svelte/icons/home';
3443
3471
 
3444
3472
  let data = {
@@ -3494,7 +3522,7 @@ const ir = {
3494
3522
  <NavUser {user} />
3495
3523
  </Sidebar.Footer>
3496
3524
  </Sidebar.Root>
3497
- `, cr = `<script lang="ts">
3525
+ `, xr = `<script lang="ts">
3498
3526
  import type { Component } from 'svelte';
3499
3527
  import * as Sidebar from '$lib/components/ui/sidebar';
3500
3528
  import { page } from '$app/state';
@@ -3534,7 +3562,7 @@ const ir = {
3534
3562
  {/each}
3535
3563
  </Sidebar.Menu>
3536
3564
  </Sidebar.Group>
3537
- `, mr = `<script lang="ts" module>
3565
+ `, $r = `<script lang="ts" module>
3538
3566
  import Settings2Icon from '@lucide/svelte/icons/settings-2';
3539
3567
 
3540
3568
  let data = {
@@ -3653,7 +3681,7 @@ const ir = {
3653
3681
  </DropdownMenu.Root>
3654
3682
  </Sidebar.MenuItem>
3655
3683
  </Sidebar.Menu>
3656
- `, ur = `<script lang="ts">
3684
+ `, Cr = `<script lang="ts">
3657
3685
  import { cn } from '$lib/utils';
3658
3686
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3659
3687
  import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
@@ -3681,7 +3709,7 @@ const ir = {
3681
3709
  {@render children?.()}
3682
3710
  </div>
3683
3711
  {/if}
3684
- `, pr = `<script lang="ts">
3712
+ `, Fr = `<script lang="ts">
3685
3713
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3686
3714
  import { getContext } from 'svelte';
3687
3715
  import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
@@ -3697,7 +3725,7 @@ const ir = {
3697
3725
  {:else}
3698
3726
  {@render children?.()}
3699
3727
  {/if}
3700
- `, dr = `<script lang="ts">
3728
+ `, Sr = `<script lang="ts">
3701
3729
  import { goto } from '$app/navigation';
3702
3730
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
3703
3731
  import { Button } from '$lib/components/ui/button';
@@ -3733,7 +3761,7 @@ const ir = {
3733
3761
  {@render children?.()}
3734
3762
  </Button>
3735
3763
  {/if}
3736
- `, fr = `<script lang="ts">
3764
+ `, _r = `<script lang="ts">
3737
3765
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3738
3766
  import { getContext } from 'svelte';
3739
3767
  import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
@@ -3747,7 +3775,7 @@ const ir = {
3747
3775
  {@render children?.()}
3748
3776
  </DropdownMenu.Label>
3749
3777
  {/if}
3750
- `, hr = `<script lang="ts">
3778
+ `, kr = `<script lang="ts">
3751
3779
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3752
3780
  import { getContext } from 'svelte';
3753
3781
  import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
@@ -3759,7 +3787,7 @@ const ir = {
3759
3787
  {#if isDesktop}
3760
3788
  <DropdownMenu.Separator {...restProps} />
3761
3789
  {/if}
3762
- `, gr = `<script lang="ts">
3790
+ `, Pr = `<script lang="ts">
3763
3791
  import { cn } from '$lib/utils';
3764
3792
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3765
3793
  import { getContext } from 'svelte';
@@ -3773,7 +3801,7 @@ const ir = {
3773
3801
  {#if isDesktop}
3774
3802
  <DropdownMenu.Trigger class={cn('inline-flex', className)} {...restProps} />
3775
3803
  {/if}
3776
- `, br = `<script lang="ts">
3804
+ `, Mr = `<script lang="ts">
3777
3805
  import { page } from '$app/state';
3778
3806
  import { browser } from '$app/environment';
3779
3807
  import { onMount, setContext } from 'svelte';
@@ -3819,12 +3847,12 @@ const ir = {
3819
3847
  {:else}
3820
3848
  {@render guest?.()}
3821
3849
  {/if}
3822
- `, vr = `export type AuthMenuContext = {
3850
+ `, Rr = `export type AuthMenuContext = {
3823
3851
  isDesktop: boolean;
3824
3852
  };
3825
3853
 
3826
3854
  export const AUTH_MENU_CONTEXT_KEY = Symbol('auth-menu-context');
3827
- `, wr = `import Root from './auth-menu.svelte';
3855
+ `, Er = `import Root from './auth-menu.svelte';
3828
3856
  import Content from './auth-menu-content.svelte';
3829
3857
  import Trigger from './auth-menu-trigger.svelte';
3830
3858
  import Group from './auth-menu-group.svelte';
@@ -3833,12 +3861,12 @@ import Separator from './auth-menu-separator.svelte';
3833
3861
  import Item from './auth-menu-item.svelte';
3834
3862
 
3835
3863
  export { Root, Content, Trigger, Group, Label, Separator, Item };
3836
- `, yr = `import { z } from 'zod/v3';
3864
+ `, Ir = `import { z } from 'zod/v3';
3837
3865
 
3838
3866
  export const changeEmailSchema = z.object({
3839
3867
  email: z.string().email()
3840
3868
  });
3841
- `, xr = `import { z } from 'zod/v3';
3869
+ `, zr = `import { z } from 'zod/v3';
3842
3870
 
3843
3871
  export const changePasswordSchema = z
3844
3872
  .object({
@@ -3849,16 +3877,16 @@ export const changePasswordSchema = z
3849
3877
  message: "Passwords don't match",
3850
3878
  path: ['passwordConfirm']
3851
3879
  });
3852
- `, $r = `import { z } from 'zod/v3';
3880
+ `, Tr = `import { z } from 'zod/v3';
3853
3881
  export const confirmEmailChangeSchema = z.object({
3854
3882
  password: z.string()
3855
3883
  });
3856
- `, Fr = `import { z } from 'zod/v3';
3884
+ `, Dr = `import { z } from 'zod/v3';
3857
3885
  export const confirmResetSchema = z.object({
3858
3886
  password: z.string(),
3859
3887
  passwordConfirm: z.string()
3860
3888
  });
3861
- `, Cr = `import { z } from 'zod/v3';
3889
+ `, Ar = `import { z } from 'zod/v3';
3862
3890
 
3863
3891
  const otpSchema = z.object({
3864
3892
  type: z.literal('otp'),
@@ -3877,35 +3905,35 @@ const oAuth2Schema = z.object({
3877
3905
  });
3878
3906
 
3879
3907
  export const loginSchema = z.discriminatedUnion('type', [otpSchema, passwordSchema, oAuth2Schema]);
3880
- `, _r = `import { z } from 'zod/v3';
3908
+ `, Nr = `import { z } from 'zod/v3';
3881
3909
  export const otpSchema = z.object({
3882
3910
  otp: z.string()
3883
3911
  });
3884
- `, Sr = `import { z } from 'zod/v3';
3912
+ `, Br = `import { z } from 'zod/v3';
3885
3913
 
3886
3914
  export const profileSchema = z.object({
3887
3915
  name: z.string().optional(),
3888
3916
  avatar: z.union([z.instanceof(File), z.string()]).optional(),
3889
3917
  emailVisibility: z.boolean().optional()
3890
3918
  });
3891
- `, kr = `import { z } from 'zod/v3';
3919
+ `, jr = `import { z } from 'zod/v3';
3892
3920
  export const resetSchema = z.object({
3893
3921
  email: z.string().email()
3894
3922
  });
3895
- `, Pr = `import { z } from 'zod/v3';
3923
+ `, Or = `import { z } from 'zod/v3';
3896
3924
 
3897
3925
  export const signupSchema = z.object({
3898
3926
  email: z.string().email(),
3899
3927
  password: z.string(),
3900
3928
  passwordConfirm: z.string()
3901
3929
  });
3902
- `, Mr = `export const load = ({ locals }) => {
3930
+ `, Lr = `export const load = ({ locals }) => {
3903
3931
  const user = locals.pb.authStore.record!;
3904
3932
  const breadcrumbs = [{ title: 'Home', url: '/dashboard' }];
3905
3933
 
3906
3934
  return { user, breadcrumbs };
3907
3935
  };
3908
- `, Rr = `<script lang="ts">
3936
+ `, qr = `<script lang="ts">
3909
3937
  import * as Sidebar from '$lib/components/ui/sidebar';
3910
3938
  import { Separator } from '$lib/components/ui/separator';
3911
3939
  import AppSidebar from '$lib/components/app-sidebar.svelte';
@@ -3955,7 +3983,7 @@ export const signupSchema = z.object({
3955
3983
  background-color: var(--color-sidebar);
3956
3984
  }
3957
3985
  </style>
3958
- `, Er = "", Tr = `import { describe, it, expect } from 'vitest';
3986
+ `, Ur = "", Vr = `import { describe, it, expect } from 'vitest';
3959
3987
  import type { Match } from '@velastack/pocketbase';
3960
3988
  import type { RouteId } from './$types';
3961
3989
 
@@ -3972,14 +4000,14 @@ describe('dashboard', () => {
3972
4000
  expect(response.status).toBe(200);
3973
4001
  });
3974
4002
  });
3975
- `, zr = `export const load = async ({ parent }) => {
4003
+ `, Hr = `export const load = async ({ parent }) => {
3976
4004
  const { breadcrumbs } = await parent();
3977
4005
 
3978
4006
  return {
3979
4007
  breadcrumbs: [...breadcrumbs, { title: 'Settings', url: '/settings' }]
3980
4008
  };
3981
4009
  };
3982
- `, Ir = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
4010
+ `, Gr = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
3983
4011
  import { zod } from 'sveltekit-superforms/adapters';
3984
4012
  import { setFlash } from 'sveltekit-flash-message/server';
3985
4013
  import { profileSchema } from '$lib/schemas/profile';
@@ -4048,7 +4076,7 @@ export const actions = {
4048
4076
  return {};
4049
4077
  }
4050
4078
  };
4051
- `, Ar = `<script lang="ts">
4079
+ `, Kr = `<script lang="ts">
4052
4080
  import { untrack } from 'svelte';
4053
4081
  import { superForm } from 'sveltekit-superforms';
4054
4082
  import { zodClient } from 'sveltekit-superforms/adapters';
@@ -4326,7 +4354,7 @@ export const actions = {
4326
4354
  </form>
4327
4355
  </div>
4328
4356
  </div>
4329
- `, Dr = `import { fail, superValidate } from 'sveltekit-superforms';
4357
+ `, Wr = `import { fail, superValidate } from 'sveltekit-superforms';
4330
4358
  import { zod } from 'sveltekit-superforms/adapters';
4331
4359
  import { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';
4332
4360
  import { redirect } from '@sveltejs/kit';
@@ -4353,7 +4381,7 @@ export const actions = {
4353
4381
  return redirect(303, '/login');
4354
4382
  }
4355
4383
  };
4356
- `, Nr = `<script lang="ts">
4384
+ `, Xr = `<script lang="ts">
4357
4385
  import { untrack } from 'svelte';
4358
4386
  import { Button } from '$lib/components/ui/button';
4359
4387
  import * as Card from '$lib/components/ui/card';
@@ -4421,7 +4449,7 @@ export const actions = {
4421
4449
  </div>
4422
4450
  </div>
4423
4451
  </div>
4424
- `, Br = `import { describe, it, expect } from 'vitest';
4452
+ `, Yr = `import { describe, it, expect } from 'vitest';
4425
4453
  import type { Match } from '@velastack/pocketbase';
4426
4454
  import type { RouteId } from './$types';
4427
4455
 
@@ -4433,7 +4461,7 @@ describe('GET /confirm-email-change/[token]', () => {
4433
4461
  expect(response.status).toBe(200);
4434
4462
  });
4435
4463
  });
4436
- `, jr = `import { fail, superValidate } from 'sveltekit-superforms';
4464
+ `, Jr = `import { fail, superValidate } from 'sveltekit-superforms';
4437
4465
  import { zod } from 'sveltekit-superforms/adapters';
4438
4466
  import { confirmResetSchema } from '$lib/schemas/confirmReset';
4439
4467
  import { redirect } from '@sveltejs/kit';
@@ -4462,7 +4490,7 @@ export const actions = {
4462
4490
  return redirect(303, '/login');
4463
4491
  }
4464
4492
  };
4465
- `, Lr = `<script lang="ts">
4493
+ `, Zr = `<script lang="ts">
4466
4494
  import { untrack } from 'svelte';
4467
4495
  import { Button } from '$lib/components/ui/button';
4468
4496
  import * as Card from '$lib/components/ui/card';
@@ -4546,7 +4574,7 @@ export const actions = {
4546
4574
  </div>
4547
4575
  </div>
4548
4576
  </div>
4549
- `, Or = `import { describe, it, expect } from 'vitest';
4577
+ `, Qr = `import { describe, it, expect } from 'vitest';
4550
4578
  import type { Match } from '@velastack/pocketbase';
4551
4579
  import type { RouteId } from './$types';
4552
4580
 
@@ -4556,7 +4584,7 @@ describe('GET /confirm-reset/[token]', () => {
4556
4584
  expect(response.status).toBe(200);
4557
4585
  });
4558
4586
  });
4559
- `, qr = `import { redirect } from '@sveltejs/kit';
4587
+ `, ta = `import { redirect } from '@sveltejs/kit';
4560
4588
  import { setFlash } from 'sveltekit-flash-message/server';
4561
4589
 
4562
4590
  export const GET = async ({ params, locals, cookies }) => {
@@ -4575,7 +4603,7 @@ export const GET = async ({ params, locals, cookies }) => {
4575
4603
  setFlash({ type: 'toast', message }, cookies);
4576
4604
  redirect(303, redirectPath);
4577
4605
  };
4578
- `, Ur = `import { describe, it, expect } from 'vitest';
4606
+ `, ea = `import { describe, it, expect } from 'vitest';
4579
4607
  import type { Match } from '@velastack/pocketbase';
4580
4608
  import type { RouteId } from './$types';
4581
4609
 
@@ -4588,7 +4616,7 @@ describe('GET /confirm-verification/[token]', () => {
4588
4616
  expect(response.headers['location']).toBe('/login');
4589
4617
  });
4590
4618
  });
4591
- `, Vr = `import { fail, superValidate, message } from 'sveltekit-superforms';
4619
+ `, na = `import { fail, superValidate, message } from 'sveltekit-superforms';
4592
4620
  import { zod } from 'sveltekit-superforms/adapters';
4593
4621
  import { loginSchema } from '$lib/schemas/login';
4594
4622
  import { redirect } from '@sveltejs/kit';
@@ -4649,7 +4677,7 @@ export const actions = {
4649
4677
  redirect(303, redirectUrl);
4650
4678
  }
4651
4679
  };
4652
- `, Hr = `<script lang="ts">
4680
+ `, ra = `<script lang="ts">
4653
4681
  import { untrack } from 'svelte';
4654
4682
  import { Button } from '$lib/components/ui/button';
4655
4683
  import * as Card from '$lib/components/ui/card';
@@ -4832,7 +4860,7 @@ export const actions = {
4832
4860
  </div>
4833
4861
  </div>
4834
4862
  </div>
4835
- `, Gr = `import { describe, it, expect } from 'vitest';
4863
+ `, aa = `import { describe, it, expect } from 'vitest';
4836
4864
  import * as devalue from 'devalue';
4837
4865
  import type { Match } from '@velastack/pocketbase';
4838
4866
  import type { RouteId } from './$types';
@@ -4879,14 +4907,14 @@ describe('POST /login', () => {
4879
4907
  expect(data.form.message.text).toBe('Failed to authenticate.');
4880
4908
  });
4881
4909
  });
4882
- `, Kr = `import { redirect } from '@sveltejs/kit';
4910
+ `, oa = `import { redirect } from '@sveltejs/kit';
4883
4911
 
4884
4912
  export const POST = ({ cookies, locals }) => {
4885
4913
  locals.pb.authStore.clear();
4886
4914
  locals.pb.authStore.clearCookie(cookies);
4887
4915
  throw redirect(303, '/');
4888
4916
  };
4889
- `, Wr = `import { describe, it, expect } from 'vitest';
4917
+ `, sa = `import { describe, it, expect } from 'vitest';
4890
4918
  import type { Match } from '@velastack/pocketbase';
4891
4919
  import type { RouteId } from './$types';
4892
4920
 
@@ -4898,7 +4926,7 @@ describe('POST /logout', () => {
4898
4926
  expect(response.headers.location).toBe('/');
4899
4927
  });
4900
4928
  });
4901
- `, Xr = `import { fail, message, superValidate } from 'sveltekit-superforms';
4929
+ `, ia = `import { fail, message, superValidate } from 'sveltekit-superforms';
4902
4930
  import { zod } from 'sveltekit-superforms/adapters';
4903
4931
  import { otpSchema } from '$lib/schemas/otp';
4904
4932
  import { redirect } from '@sveltejs/kit';
@@ -4939,7 +4967,7 @@ export const actions = {
4939
4967
  redirect(303, redirectUrl);
4940
4968
  }
4941
4969
  };
4942
- `, Yr = `<script lang="ts">
4970
+ `, la = `<script lang="ts">
4943
4971
  import { untrack } from 'svelte';
4944
4972
  import { Button } from '$lib/components/ui/button';
4945
4973
  import * as Card from '$lib/components/ui/card';
@@ -5005,7 +5033,7 @@ export const actions = {
5005
5033
  </div>
5006
5034
  </div>
5007
5035
  </div>
5008
- `, Jr = `import { describe, it, expect } from 'vitest';
5036
+ `, ca = `import { describe, it, expect } from 'vitest';
5009
5037
  import type { Match } from '@velastack/pocketbase';
5010
5038
  import type { RouteId } from './$types';
5011
5039
 
@@ -5025,7 +5053,7 @@ describe('POST /otp/[token]', () => {
5025
5053
  expect(response.body.status).toBe(400);
5026
5054
  });
5027
5055
  });
5028
- `, Zr = `import { fail, superValidate } from 'sveltekit-superforms';
5056
+ `, ma = `import { fail, superValidate } from 'sveltekit-superforms';
5029
5057
  import { zod } from 'sveltekit-superforms/adapters';
5030
5058
  import { resetSchema } from '$lib/schemas/reset';
5031
5059
  import { redirect } from '@sveltejs/kit';
@@ -5053,7 +5081,7 @@ export const actions = {
5053
5081
  return { form };
5054
5082
  }
5055
5083
  };
5056
- `, Qr = `<script lang="ts">
5084
+ `, ua = `<script lang="ts">
5057
5085
  import { untrack } from 'svelte';
5058
5086
  import { Button } from '$lib/components/ui/button';
5059
5087
  import * as Card from '$lib/components/ui/card';
@@ -5120,7 +5148,7 @@ export const actions = {
5120
5148
  </div>
5121
5149
  </div>
5122
5150
  </div>
5123
- `, ta = `import { describe, it, expect } from 'vitest';
5151
+ `, pa = `import { describe, it, expect } from 'vitest';
5124
5152
  import type { Match } from '@velastack/pocketbase';
5125
5153
  import type { RouteId } from './$types';
5126
5154
 
@@ -5140,7 +5168,7 @@ describe('POST /reset', () => {
5140
5168
  expect(response.body.status).toBe(200);
5141
5169
  });
5142
5170
  });
5143
- `, ea = `import { redirect } from '@sveltejs/kit';
5171
+ `, da = `import { redirect } from '@sveltejs/kit';
5144
5172
  import { fail, superValidate } from 'sveltekit-superforms';
5145
5173
  import { zod } from 'sveltekit-superforms/adapters';
5146
5174
  import { setFlash } from 'sveltekit-flash-message/server';
@@ -5196,7 +5224,7 @@ export const actions = {
5196
5224
  return redirect(303, redirectUrl);
5197
5225
  }
5198
5226
  };
5199
- `, na = `<script lang="ts">
5227
+ `, fa = `<script lang="ts">
5200
5228
  import { untrack } from 'svelte';
5201
5229
  import { Button } from '$lib/components/ui/button';
5202
5230
  import * as Card from '$lib/components/ui/card';
@@ -5363,7 +5391,7 @@ export const actions = {
5363
5391
  </div>
5364
5392
  </div>
5365
5393
  </div>
5366
- `, ra = `import { describe, it, expect } from 'vitest';
5394
+ `, ha = `import { describe, it, expect } from 'vitest';
5367
5395
  import type { Match } from '@velastack/pocketbase';
5368
5396
  import * as devalue from 'devalue';
5369
5397
  import type { RouteId } from './$types';
@@ -5419,61 +5447,61 @@ describe('POST /signup', () => {
5419
5447
  expect(data.form.errors.email[0]).toBe('Value must be unique.');
5420
5448
  });
5421
5449
  });
5422
- `, aa = /* @__PURE__ */ Object.assign({
5423
- "./creates/src/lib/components/app-sidebar.svelte": lr,
5424
- "./creates/src/lib/components/nav-main.svelte": cr,
5425
- "./creates/src/lib/components/nav-user.svelte": mr,
5426
- "./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte": ur,
5427
- "./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte": pr,
5428
- "./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte": dr,
5429
- "./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte": fr,
5430
- "./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte": hr,
5431
- "./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte": gr,
5432
- "./creates/src/lib/components/ui/auth-menu/auth-menu.svelte": br,
5433
- "./creates/src/lib/components/ui/auth-menu/context.ts": vr,
5434
- "./creates/src/lib/components/ui/auth-menu/index.ts": wr,
5435
- "./creates/src/lib/schemas/changeEmail.ts": yr,
5436
- "./creates/src/lib/schemas/changePassword.ts": xr,
5437
- "./creates/src/lib/schemas/confirmEmailChange.ts": $r,
5438
- "./creates/src/lib/schemas/confirmReset.ts": Fr,
5439
- "./creates/src/lib/schemas/login.ts": Cr,
5440
- "./creates/src/lib/schemas/otp.ts": _r,
5441
- "./creates/src/lib/schemas/profile.ts": Sr,
5442
- "./creates/src/lib/schemas/reset.ts": kr,
5443
- "./creates/src/lib/schemas/signup.ts": Pr,
5444
- "./creates/src/routes/(app)/+layout.server.ts": Mr,
5445
- "./creates/src/routes/(app)/+layout.svelte": Rr,
5446
- "./creates/src/routes/(app)/dashboard/+page.svelte": Er,
5447
- "./creates/src/routes/(app)/dashboard/server.test.ts": Tr,
5448
- "./creates/src/routes/(app)/settings/+layout.server.ts": zr,
5449
- "./creates/src/routes/(app)/settings/+page.server.ts": Ir,
5450
- "./creates/src/routes/(app)/settings/+page.svelte": Ar,
5451
- "./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Dr,
5452
- "./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Nr,
5453
- "./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Br,
5454
- "./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": jr,
5455
- "./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Lr,
5456
- "./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Or,
5457
- "./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": qr,
5458
- "./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Ur,
5459
- "./creates/src/routes/(public)/login/+page.server.ts": Vr,
5460
- "./creates/src/routes/(public)/login/+page.svelte": Hr,
5461
- "./creates/src/routes/(public)/login/server.test.ts": Gr,
5462
- "./creates/src/routes/(public)/logout/+server.ts": Kr,
5463
- "./creates/src/routes/(public)/logout/server.test.ts": Wr,
5464
- "./creates/src/routes/(public)/otp/[token]/+page.server.ts": Xr,
5465
- "./creates/src/routes/(public)/otp/[token]/+page.svelte": Yr,
5466
- "./creates/src/routes/(public)/otp/[token]/server.test.ts": Jr,
5467
- "./creates/src/routes/(public)/reset/+page.server.ts": Zr,
5468
- "./creates/src/routes/(public)/reset/+page.svelte": Qr,
5469
- "./creates/src/routes/(public)/reset/server.test.ts": ta,
5470
- "./creates/src/routes/(public)/signup/+page.server.ts": ea,
5471
- "./creates/src/routes/(public)/signup/+page.svelte": na,
5472
- "./creates/src/routes/(public)/signup/server.test.ts": ra
5473
- }), oa = "./creates/";
5474
- async function sa(t) {
5475
- const e = Object.entries(aa).map(([o, s]) => {
5476
- const i = Et(o, oa);
5450
+ `, ga = /* @__PURE__ */ Object.assign({
5451
+ "./creates/src/lib/components/app-sidebar.svelte": yr,
5452
+ "./creates/src/lib/components/nav-main.svelte": xr,
5453
+ "./creates/src/lib/components/nav-user.svelte": $r,
5454
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte": Cr,
5455
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte": Fr,
5456
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte": Sr,
5457
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte": _r,
5458
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte": kr,
5459
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte": Pr,
5460
+ "./creates/src/lib/components/ui/auth-menu/auth-menu.svelte": Mr,
5461
+ "./creates/src/lib/components/ui/auth-menu/context.ts": Rr,
5462
+ "./creates/src/lib/components/ui/auth-menu/index.ts": Er,
5463
+ "./creates/src/lib/schemas/changeEmail.ts": Ir,
5464
+ "./creates/src/lib/schemas/changePassword.ts": zr,
5465
+ "./creates/src/lib/schemas/confirmEmailChange.ts": Tr,
5466
+ "./creates/src/lib/schemas/confirmReset.ts": Dr,
5467
+ "./creates/src/lib/schemas/login.ts": Ar,
5468
+ "./creates/src/lib/schemas/otp.ts": Nr,
5469
+ "./creates/src/lib/schemas/profile.ts": Br,
5470
+ "./creates/src/lib/schemas/reset.ts": jr,
5471
+ "./creates/src/lib/schemas/signup.ts": Or,
5472
+ "./creates/src/routes/(app)/+layout.server.ts": Lr,
5473
+ "./creates/src/routes/(app)/+layout.svelte": qr,
5474
+ "./creates/src/routes/(app)/dashboard/+page.svelte": Ur,
5475
+ "./creates/src/routes/(app)/dashboard/server.test.ts": Vr,
5476
+ "./creates/src/routes/(app)/settings/+layout.server.ts": Hr,
5477
+ "./creates/src/routes/(app)/settings/+page.server.ts": Gr,
5478
+ "./creates/src/routes/(app)/settings/+page.svelte": Kr,
5479
+ "./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Wr,
5480
+ "./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Xr,
5481
+ "./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Yr,
5482
+ "./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": Jr,
5483
+ "./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Zr,
5484
+ "./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Qr,
5485
+ "./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": ta,
5486
+ "./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": ea,
5487
+ "./creates/src/routes/(public)/login/+page.server.ts": na,
5488
+ "./creates/src/routes/(public)/login/+page.svelte": ra,
5489
+ "./creates/src/routes/(public)/login/server.test.ts": aa,
5490
+ "./creates/src/routes/(public)/logout/+server.ts": oa,
5491
+ "./creates/src/routes/(public)/logout/server.test.ts": sa,
5492
+ "./creates/src/routes/(public)/otp/[token]/+page.server.ts": ia,
5493
+ "./creates/src/routes/(public)/otp/[token]/+page.svelte": la,
5494
+ "./creates/src/routes/(public)/otp/[token]/server.test.ts": ca,
5495
+ "./creates/src/routes/(public)/reset/+page.server.ts": ma,
5496
+ "./creates/src/routes/(public)/reset/+page.svelte": ua,
5497
+ "./creates/src/routes/(public)/reset/server.test.ts": pa,
5498
+ "./creates/src/routes/(public)/signup/+page.server.ts": da,
5499
+ "./creates/src/routes/(public)/signup/+page.svelte": fa,
5500
+ "./creates/src/routes/(public)/signup/server.test.ts": ha
5501
+ }), ba = "./creates/";
5502
+ async function va(t) {
5503
+ const e = Object.entries(ga).map(([o, s]) => {
5504
+ const i = Et(o, ba);
5477
5505
  return {
5478
5506
  path: i,
5479
5507
  language: j(i),
@@ -5564,7 +5592,7 @@ async function sa(t) {
5564
5592
  ]
5565
5593
  };
5566
5594
  }
5567
- const ia = `/// <reference path="../pb_data/types.d.ts" />
5595
+ const wa = `/// <reference path="../pb_data/types.d.ts" />
5568
5596
  migrate(
5569
5597
  (app) => {
5570
5598
  const collection = new Collection({
@@ -5750,7 +5778,7 @@ migrate(
5750
5778
  return app.delete(collection);
5751
5779
  }
5752
5780
  );
5753
- `, la = `/// <reference path="../pb_data/types.d.ts" />
5781
+ `, ya = `/// <reference path="../pb_data/types.d.ts" />
5754
5782
  migrate(
5755
5783
  (app) => {
5756
5784
  const collection = app.findCollectionByNameOrId('_pb_users_auth_');
@@ -5805,7 +5833,7 @@ migrate(
5805
5833
  return app.save(collection);
5806
5834
  }
5807
5835
  );
5808
- `, ca = `import {
5836
+ `, xa = `import {
5809
5837
  POCKETBASE_URL,
5810
5838
  POCKETBASE_SUPERUSER_EMAIL,
5811
5839
  POCKETBASE_SUPERUSER_PASSWORD
@@ -5818,7 +5846,7 @@ export const handle = handlePocketbase({
5818
5846
  superuserPassword: POCKETBASE_SUPERUSER_PASSWORD,
5819
5847
  auth: { protectedRoutes: ['/(app)'] }
5820
5848
  });
5821
- `, ma = `<script lang="ts">
5849
+ `, $a = `<script lang="ts">
5822
5850
  import { toggleMode } from 'mode-watcher';
5823
5851
  import * as Navbar from '$lib/components/ui/navbar';
5824
5852
  import { Button } from '$lib/components/ui/button';
@@ -5920,23 +5948,23 @@ export const handle = handlePocketbase({
5920
5948
  @apply container mx-auto max-w-7xl px-4 py-8 w-full;
5921
5949
  }
5922
5950
  </style>
5923
- `, ua = `import { loadFlash } from "sveltekit-flash-message/server";
5951
+ `, Ca = `import { loadFlash } from "sveltekit-flash-message/server";
5924
5952
 
5925
5953
  export const load = loadFlash(async ({ locals }) => {
5926
5954
  return {
5927
5955
  user: locals.pb.authStore.record,
5928
5956
  };
5929
5957
  });
5930
- `, pa = /* @__PURE__ */ Object.assign({
5931
- "./preview-modifies/migrations/1776099881_created_oauth_accounts.js": ia,
5932
- "./preview-modifies/migrations/1776099881_updated_users.js": la,
5933
- "./preview-modifies/src/hooks.server.ts": ca,
5934
- "./preview-modifies/src/routes/(public)/root-layout.svelte": ma,
5935
- "./preview-modifies/src/routes/+layout.server.ts": ua
5936
- }), da = "./preview-modifies/";
5937
- async function fa(t) {
5938
- const e = Object.entries(pa).map(([n, r]) => {
5939
- const o = Et(n, da);
5958
+ `, Fa = /* @__PURE__ */ Object.assign({
5959
+ "./preview-modifies/migrations/1776099881_created_oauth_accounts.js": wa,
5960
+ "./preview-modifies/migrations/1776099881_updated_users.js": ya,
5961
+ "./preview-modifies/src/hooks.server.ts": xa,
5962
+ "./preview-modifies/src/routes/(public)/root-layout.svelte": $a,
5963
+ "./preview-modifies/src/routes/+layout.server.ts": Ca
5964
+ }), Sa = "./preview-modifies/";
5965
+ async function _a(t) {
5966
+ const e = Object.entries(Fa).map(([n, r]) => {
5967
+ const o = Et(n, Sa);
5940
5968
  return {
5941
5969
  path: o,
5942
5970
  language: j(o),
@@ -5952,18 +5980,25 @@ async function fa(t) {
5952
5980
  collections: []
5953
5981
  };
5954
5982
  }
5955
- const ha = "enable-auth";
5956
- async function ga(t) {
5957
- const e = await sa(t);
5983
+ const ka = "enable-auth", Pa = "1.0.7", Ma = "src/patterns/enable/auth", Ra = "/enable/auth";
5984
+ async function Ea(t) {
5985
+ const e = await va(t);
5958
5986
  if (t.env === "preview") {
5959
- const s = await fa();
5987
+ const s = await _a();
5960
5988
  return k(pt([e, s]));
5961
5989
  }
5962
- const { generate: n } = await import("./generate.runtime-vKonp83V.js"), r = await n(t), { writeResult: o } = await import("./write-result-DG5OAbe1.js");
5963
- return o(await k(pt([e, r])), t);
5990
+ const { generate: n } = await import("./generate.runtime-B5wEl4BS.js"), r = await n(t), { writeResult: o } = await import("./write-result-DG5OAbe1.js");
5991
+ return o(
5992
+ await k(pt([e, r])),
5993
+ t
5994
+ );
5964
5995
  }
5965
- const ba = {
5966
- slug: ha,
5996
+ const Ia = {
5997
+ version: Pa,
5998
+ slug: ka,
5999
+ source: Ma,
6000
+ docs: Ra,
6001
+ plan: "open",
5967
6002
  title: "Enable authentication",
5968
6003
  summary: "Enables authentication.",
5969
6004
  categories: ["authentication"],
@@ -5981,26 +6016,25 @@ const ba = {
5981
6016
  argv: []
5982
6017
  },
5983
6018
  baseline: "velastack",
5984
- generate: ga
6019
+ generate: Ea
5985
6020
  }, Wt = [
5986
- _n,
5987
- ir,
5988
- Bn,
5989
- tr,
5990
- ba
5991
- ], va = Wt.reduce(
5992
- (t, e) => (t[e.slug] = e, t),
5993
- {}
5994
- ), Ca = {
6021
+ Pn,
6022
+ wr,
6023
+ Vn,
6024
+ cr,
6025
+ Ia
6026
+ ], za = Object.fromEntries(
6027
+ Wt.map((t) => [t.slug, t])
6028
+ ), ja = {
5995
6029
  version: "0.1.0",
5996
6030
  patterns: Wt,
5997
- bySlug: va
6031
+ bySlug: za
5998
6032
  };
5999
6033
  export {
6000
- $a as D,
6001
- Fa as M,
6034
+ Na as D,
6035
+ Ba as M,
6002
6036
  p as d,
6003
- Ca as i,
6037
+ ja as i,
6004
6038
  j as l
6005
6039
  };
6006
- //# sourceMappingURL=index-CDgw5XzM.js.map
6040
+ //# sourceMappingURL=index-BP2ybpuw.js.map