@velastack/patterns 0.10.1 → 0.12.0

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.
Files changed (119) hide show
  1. package/dist/chunks/{collections-BYcVyY9O.js → collections-DzwWwFUQ.js} +2 -2
  2. package/dist/chunks/{collections-BYcVyY9O.js.map → collections-DzwWwFUQ.js.map} +1 -1
  3. package/dist/chunks/{constants-Bdx8mp7v.js → constants-8cLxGOB0.js} +3 -3
  4. package/dist/chunks/constants-8cLxGOB0.js.map +1 -0
  5. package/dist/chunks/{currency.server-Bb2Ndutg.js → currency.server-CzHS7Svd.js} +3 -3
  6. package/dist/chunks/{currency.server-Bb2Ndutg.js.map → currency.server-CzHS7Svd.js.map} +1 -1
  7. package/dist/chunks/{env-vars-0hvKe55u.js → env-vars-CNH-ItSY.js} +3 -3
  8. package/dist/chunks/{env-vars-0hvKe55u.js.map → env-vars-CNH-ItSY.js.map} +1 -1
  9. package/dist/chunks/{generate-B-cqjI-U.js → generate-BEc_h7OI.js} +2 -2
  10. package/dist/chunks/{generate-B-cqjI-U.js.map → generate-BEc_h7OI.js.map} +1 -1
  11. package/dist/chunks/{generate-DoHn_xJZ.js → generate-C3OaUggX.js} +2 -2
  12. package/dist/chunks/{generate-DoHn_xJZ.js.map → generate-C3OaUggX.js.map} +1 -1
  13. package/dist/chunks/{generate-l2JZTRKb.js → generate-CtQcmjPM.js} +2 -2
  14. package/dist/chunks/{generate-l2JZTRKb.js.map → generate-CtQcmjPM.js.map} +1 -1
  15. package/dist/chunks/{generate-Df7t5Nbk.js → generate-D21dCU-o.js} +3 -3
  16. package/dist/chunks/{generate-Df7t5Nbk.js.map → generate-D21dCU-o.js.map} +1 -1
  17. package/dist/chunks/{generate-CNabcEBx.js → generate-DiwvSC9c.js} +2 -2
  18. package/dist/chunks/{generate-CNabcEBx.js.map → generate-DiwvSC9c.js.map} +1 -1
  19. package/dist/chunks/{generate.runtime-BnqS_Zq8.js → generate.runtime--VeSxyIm.js} +3 -3
  20. package/dist/chunks/{generate.runtime-BnqS_Zq8.js.map → generate.runtime--VeSxyIm.js.map} +1 -1
  21. package/dist/chunks/{generate.runtime-Cv3unKap.js → generate.runtime--yCjGZ6-.js} +3 -3
  22. package/dist/chunks/{generate.runtime-Cv3unKap.js.map → generate.runtime--yCjGZ6-.js.map} +1 -1
  23. package/dist/chunks/{generate.runtime-BoYwV0nt.js → generate.runtime-B3yuIjJD.js} +2 -2
  24. package/dist/chunks/{generate.runtime-BoYwV0nt.js.map → generate.runtime-B3yuIjJD.js.map} +1 -1
  25. package/dist/chunks/{generate.runtime-q17D7QUT.js → generate.runtime-BBfiR_Le.js} +3 -3
  26. package/dist/chunks/{generate.runtime-q17D7QUT.js.map → generate.runtime-BBfiR_Le.js.map} +1 -1
  27. package/dist/chunks/{generate.runtime-Bvjj3zn0.js → generate.runtime-BK7x32md.js} +3 -3
  28. package/dist/chunks/{generate.runtime-Bvjj3zn0.js.map → generate.runtime-BK7x32md.js.map} +1 -1
  29. package/dist/chunks/{generate.runtime-gZ4wfYBP.js → generate.runtime-BL62aRng.js} +6 -6
  30. package/dist/chunks/{generate.runtime-gZ4wfYBP.js.map → generate.runtime-BL62aRng.js.map} +1 -1
  31. package/dist/chunks/{generate.runtime-Du84quuK.js → generate.runtime-BTHuPon9.js} +5 -5
  32. package/dist/chunks/{generate.runtime-Du84quuK.js.map → generate.runtime-BTHuPon9.js.map} +1 -1
  33. package/dist/chunks/{generate.runtime-e_BkDyP0.js → generate.runtime-Brakd35X.js} +2 -2
  34. package/dist/chunks/{generate.runtime-e_BkDyP0.js.map → generate.runtime-Brakd35X.js.map} +1 -1
  35. package/dist/chunks/{generate.runtime-B84ymwlD.js → generate.runtime-Bx_CaBZD.js} +2 -2
  36. package/dist/chunks/{generate.runtime-B84ymwlD.js.map → generate.runtime-Bx_CaBZD.js.map} +1 -1
  37. package/dist/chunks/{generate.runtime-oUJUQRdg.js → generate.runtime-C8-mjcn8.js} +6 -6
  38. package/dist/chunks/{generate.runtime-oUJUQRdg.js.map → generate.runtime-C8-mjcn8.js.map} +1 -1
  39. package/dist/chunks/generate.runtime-CAO_SpsA.js +50 -0
  40. package/dist/chunks/generate.runtime-CAO_SpsA.js.map +1 -0
  41. package/dist/chunks/{generate.runtime-DJ5uF6EN.js → generate.runtime-CCE-9xQV.js} +2 -2
  42. package/dist/chunks/{generate.runtime-DJ5uF6EN.js.map → generate.runtime-CCE-9xQV.js.map} +1 -1
  43. package/dist/chunks/{generate.runtime-C7tlPKH1.js → generate.runtime-CGJ_4VS_.js} +4 -4
  44. package/dist/chunks/{generate.runtime-C7tlPKH1.js.map → generate.runtime-CGJ_4VS_.js.map} +1 -1
  45. package/dist/chunks/{generate.runtime-CVWCUn52.js → generate.runtime-CPDJolef.js} +4 -4
  46. package/dist/chunks/{generate.runtime-CVWCUn52.js.map → generate.runtime-CPDJolef.js.map} +1 -1
  47. package/dist/chunks/{generate.runtime-DG9Lp3vR.js → generate.runtime-CaOO0281.js} +6 -6
  48. package/dist/chunks/{generate.runtime-DG9Lp3vR.js.map → generate.runtime-CaOO0281.js.map} +1 -1
  49. package/dist/chunks/{generate.runtime-Dfz53sSK.js → generate.runtime-Ce2O5uWy.js} +3 -3
  50. package/dist/chunks/{generate.runtime-Dfz53sSK.js.map → generate.runtime-Ce2O5uWy.js.map} +1 -1
  51. package/dist/chunks/{generate.runtime-DERcpgc-.js → generate.runtime-CeoqgxiO.js} +4 -4
  52. package/dist/chunks/{generate.runtime-DERcpgc-.js.map → generate.runtime-CeoqgxiO.js.map} +1 -1
  53. package/dist/chunks/{generate.runtime-T7JLE4Wc.js → generate.runtime-CowdMKQs.js} +3 -3
  54. package/dist/chunks/{generate.runtime-T7JLE4Wc.js.map → generate.runtime-CowdMKQs.js.map} +1 -1
  55. package/dist/chunks/{generate.runtime-J2lLMjDn.js → generate.runtime-CtFCayo8.js} +7 -7
  56. package/dist/chunks/{generate.runtime-J2lLMjDn.js.map → generate.runtime-CtFCayo8.js.map} +1 -1
  57. package/dist/chunks/{generate.runtime-C4LUUuq7.js → generate.runtime-D34lCyet.js} +3 -3
  58. package/dist/chunks/{generate.runtime-C4LUUuq7.js.map → generate.runtime-D34lCyet.js.map} +1 -1
  59. package/dist/chunks/generate.runtime-DOWDoe6B.js +24 -0
  60. package/dist/chunks/generate.runtime-DOWDoe6B.js.map +1 -0
  61. package/dist/chunks/{generate.runtime-D677SB4v.js → generate.runtime-DOv-bhM6.js} +2 -2
  62. package/dist/chunks/{generate.runtime-D677SB4v.js.map → generate.runtime-DOv-bhM6.js.map} +1 -1
  63. package/dist/chunks/{generate.runtime-WPq7bHRA.js → generate.runtime-DRuPb-67.js} +2 -2
  64. package/dist/chunks/{generate.runtime-WPq7bHRA.js.map → generate.runtime-DRuPb-67.js.map} +1 -1
  65. package/dist/chunks/{generate.runtime-ByPcr9vJ.js → generate.runtime-DUBOC6AA.js} +3 -3
  66. package/dist/chunks/{generate.runtime-ByPcr9vJ.js.map → generate.runtime-DUBOC6AA.js.map} +1 -1
  67. package/dist/chunks/{generate.runtime-CHUCMVa2.js → generate.runtime-DVwha8lZ.js} +2 -2
  68. package/dist/chunks/{generate.runtime-CHUCMVa2.js.map → generate.runtime-DVwha8lZ.js.map} +1 -1
  69. package/dist/chunks/{generate.runtime-BP31tAcD.js → generate.runtime-D_HYO-mG.js} +4 -4
  70. package/dist/chunks/{generate.runtime-BP31tAcD.js.map → generate.runtime-D_HYO-mG.js.map} +1 -1
  71. package/dist/chunks/{generate.runtime-nyJ6v56q.js → generate.runtime-DbMDlglD.js} +4 -4
  72. package/dist/chunks/{generate.runtime-nyJ6v56q.js.map → generate.runtime-DbMDlglD.js.map} +1 -1
  73. package/dist/chunks/{generate.runtime-BC6CBKh6.js → generate.runtime-DbSRJF-C.js} +3 -3
  74. package/dist/chunks/{generate.runtime-BC6CBKh6.js.map → generate.runtime-DbSRJF-C.js.map} +1 -1
  75. package/dist/chunks/{generate.runtime-DuDcKDUl.js → generate.runtime-DlPeHx19.js} +2 -2
  76. package/dist/chunks/{generate.runtime-DuDcKDUl.js.map → generate.runtime-DlPeHx19.js.map} +1 -1
  77. package/dist/chunks/{generate.runtime-Cj-5fzbQ.js → generate.runtime-DroVnvQz.js} +4 -4
  78. package/dist/chunks/{generate.runtime-Cj-5fzbQ.js.map → generate.runtime-DroVnvQz.js.map} +1 -1
  79. package/dist/chunks/{generate.runtime-zr6uIHCd.js → generate.runtime-Drpy9sWO.js} +2 -2
  80. package/dist/chunks/{generate.runtime-zr6uIHCd.js.map → generate.runtime-Drpy9sWO.js.map} +1 -1
  81. package/dist/chunks/{generate.runtime-BDbotRNZ.js → generate.runtime-Dy9uuf7M.js} +6 -6
  82. package/dist/chunks/{generate.runtime-BDbotRNZ.js.map → generate.runtime-Dy9uuf7M.js.map} +1 -1
  83. package/dist/chunks/{generate.runtime-B53OTMcE.js → generate.runtime-HkvT9gm6.js} +4 -4
  84. package/dist/chunks/{generate.runtime-B53OTMcE.js.map → generate.runtime-HkvT9gm6.js.map} +1 -1
  85. package/dist/chunks/{generate.runtime-DiqfbDfk.js → generate.runtime-kEHEiLBL.js} +2 -2
  86. package/dist/chunks/{generate.runtime-DiqfbDfk.js.map → generate.runtime-kEHEiLBL.js.map} +1 -1
  87. package/dist/chunks/{generate.runtime-BqCbJ-No.js → generate.runtime-r9Ouwr5B.js} +3 -3
  88. package/dist/chunks/{generate.runtime-BqCbJ-No.js.map → generate.runtime-r9Ouwr5B.js.map} +1 -1
  89. package/dist/chunks/{generate.runtime-rLlDp4R6.js → generate.runtime-sALBNh1T.js} +4 -4
  90. package/dist/chunks/{generate.runtime-rLlDp4R6.js.map → generate.runtime-sALBNh1T.js.map} +1 -1
  91. package/dist/chunks/layout.svelte-Cb12mxua.js +65 -0
  92. package/dist/chunks/layout.svelte-Cb12mxua.js.map +1 -0
  93. package/dist/chunks/{modify-file-B4uJzOEj.js → modify-file-DdXJCMHN.js} +2 -2
  94. package/dist/chunks/{modify-file-B4uJzOEj.js.map → modify-file-DdXJCMHN.js.map} +1 -1
  95. package/dist/chunks/{pocketbase-BtN-wL8f.js → pocketbase-uOpghyT5.js} +2 -2
  96. package/dist/chunks/{pocketbase-BtN-wL8f.js.map → pocketbase-uOpghyT5.js.map} +1 -1
  97. package/dist/chunks/{providers-DRwJnSzb.js → providers-ypCW70Mb.js} +2 -2
  98. package/dist/chunks/{providers-DRwJnSzb.js.map → providers-ypCW70Mb.js.map} +1 -1
  99. package/dist/chunks/{shared-BbxLil4g.js → shared-DIDAkVts.js} +2 -2
  100. package/dist/chunks/{shared-BbxLil4g.js.map → shared-DIDAkVts.js.map} +1 -1
  101. package/dist/chunks/{site-VrqOvuiU.js → site-CVtsbO_S.js} +2 -2
  102. package/dist/chunks/{site-VrqOvuiU.js.map → site-CVtsbO_S.js.map} +1 -1
  103. package/dist/chunks/{table-core-BHFT-uMX.js → table-core-CUGp4Rf2.js} +2 -2
  104. package/dist/chunks/{table-core-BHFT-uMX.js.map → table-core-CUGp4Rf2.js.map} +1 -1
  105. package/dist/chunks/test-setup-B37g3TRn.js +179 -0
  106. package/dist/chunks/test-setup-B37g3TRn.js.map +1 -0
  107. package/dist/chunks/{ui-gG8i_Mzk.js → ui-Ct_9B91R.js} +3 -3
  108. package/dist/chunks/{ui-gG8i_Mzk.js.map → ui-Ct_9B91R.js.map} +1 -1
  109. package/dist/chunks/{whatsapp-DbjOxHaZ.js → whatsapp-Dr29ohbb.js} +2 -2
  110. package/dist/chunks/{whatsapp-DbjOxHaZ.js.map → whatsapp-Dr29ohbb.js.map} +1 -1
  111. package/dist/chunks/{write-result-DcqMefuP.js → write-result-mtVbmDyQ.js} +12 -12
  112. package/dist/chunks/{write-result-DcqMefuP.js.map → write-result-mtVbmDyQ.js.map} +1 -1
  113. package/dist/index.d.ts +124 -0
  114. package/dist/index.js +2114 -1954
  115. package/dist/index.js.map +1 -1
  116. package/package.json +1 -1
  117. package/dist/chunks/constants-Bdx8mp7v.js.map +0 -1
  118. package/dist/chunks/test-setup-BVJwm22s.js +0 -179
  119. package/dist/chunks/test-setup-BVJwm22s.js.map +0 -1
@@ -2,7 +2,7 @@ import { n as e } from "./rolldown-runtime-5HNE8Q1r.js";
2
2
  import { t } from "./errors-DR3gF_7a.js";
3
3
  import { a as n } from "./util-BLYliuUK.js";
4
4
  import { n as r, t as i } from "./logger-CQONztPm.js";
5
- import { i as a, n as o, t as s } from "./pocketbase-BtN-wL8f.js";
5
+ import { i as a, n as o, t as s } from "./pocketbase-uOpghyT5.js";
6
6
  import { readFileSync as c } from "node:fs";
7
7
  //#region src/runtime/collections.ts
8
8
  var l = /* @__PURE__ */ e({
@@ -204,4 +204,4 @@ async function S(e, t) {
204
204
  //#endregion
205
205
  export { _ as i, l as n, f as r, m as t };
206
206
 
207
- //# sourceMappingURL=collections-BYcVyY9O.js.map
207
+ //# sourceMappingURL=collections-DzwWwFUQ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collections-BYcVyY9O.js","names":["__exportAll","languageFromPath","getLogger","NOOP_LOGGER","withPocketbase","migrationDelay","getMigrationFile","collections_exports","applyCollectionFieldsPatches","applyCollectionRulePatches","createCollectionIdempotent","createCollections","dropCollectionIdempotent","dropCollections","ensureCollectionFields","getCollectionStats","planCollectionDrops","isCollectionAlreadyExistsError","error","message","resolveRelationTargets","fields","spec","relations","field","existing","pb","ids","c","byName","id","name","logger","rulePayloadFromPatch","payload","patch","migrations","patches","escaped","col","options","migrationFile","readFileSync","applyFieldChanges","change","f","InvalidArgumentError","index","collection","newFields","have","missing","plans","names","stats","specs","dropped","collections","created"],"sources":["../../src/runtime/collections.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport type PocketBase from \"pocketbase\";\nimport type { CollectionModel } from \"pocketbase\";\nimport type {\n CollectionDropSpec,\n CollectionFieldSpec,\n CollectionFieldsPatch,\n CollectionRulesPatch,\n CollectionSpec,\n File,\n Options,\n} from \"../core/types\";\nimport { InvalidArgumentError } from \"../core/errors\";\nimport { getLogger, NOOP_LOGGER, type Logger } from \"../core/logger\";\nimport { languageFromPath } from \"../core/util\";\nimport { getMigrationFile, migrationDelay, withPocketbase } from \"./pocketbase\";\n\ninterface PocketBaseCollectionCreateError {\n response?: {\n data?: {\n name?: {\n code?: string;\n };\n };\n };\n message?: string;\n}\n\nfunction isCollectionAlreadyExistsError(\n error: PocketBaseCollectionCreateError,\n): boolean {\n if (\n error.response?.data?.name?.code === \"validation_collection_name_exists\"\n ) {\n return true;\n }\n\n const message = error.message?.toLowerCase() ?? \"\";\n return (\n message.includes(\"already exists\") || message.includes(\"must be unique\")\n );\n}\n\ntype CollectionCreateInput = Parameters<PocketBase[\"collections\"][\"create\"]>[0];\n\ninterface RelationFieldLike {\n type?: string;\n collectionId?: string;\n}\n\n/**\n * A spec may name the collection a relation points at (`stripe_customers`)\n * where PocketBase wants its id; specs read better by name, and the id is\n * only known once the target exists. Names are swapped for ids here, and a\n * value that already is an id (`_pb_users_auth_`) is left alone.\n */\nasync function resolveRelationTargets(\n pb: PocketBase,\n spec: CollectionCreateInput,\n): Promise<CollectionCreateInput> {\n const fields = (spec as { fields?: RelationFieldLike[] }).fields;\n const relations = (fields ?? []).filter(\n (field) => field.type === \"relation\" && field.collectionId,\n );\n if (relations.length === 0) return spec;\n\n const existing = await pb.collections.getFullList();\n const ids = new Set(existing.map((c) => c.id));\n const byName = new Map(existing.map((c) => [c.name, c.id]));\n if (relations.every((field) => ids.has(field.collectionId!))) return spec;\n\n return {\n ...spec,\n fields: fields!.map((field) => {\n if (field.type !== \"relation\" || !field.collectionId) return field;\n const id = byName.get(field.collectionId);\n return id && !ids.has(field.collectionId)\n ? { ...field, collectionId: id }\n : field;\n }),\n } as CollectionCreateInput;\n}\n\nexport interface CreateCollectionResult {\n collection: CollectionModel;\n created: boolean;\n}\n\n/**\n * Idempotent wrapper around `pb.collections.create`. If the collection already\n * exists, logs and returns the existing model with `created: false` so callers\n * can skip work tied to a fresh create (e.g. appending a newly-generated\n * migration file to the result).\n */\nexport async function createCollectionIdempotent(\n pb: PocketBase,\n spec: CollectionCreateInput,\n logger: Logger = NOOP_LOGGER,\n): Promise<CreateCollectionResult> {\n const name = (spec as { name: string }).name;\n try {\n const collection = await pb.collections.create(\n await resolveRelationTargets(pb, spec),\n );\n return { collection, created: true };\n } catch (error) {\n if (\n !isCollectionAlreadyExistsError(error as PocketBaseCollectionCreateError)\n ) {\n throw error;\n }\n logger.info(`Collection \"${name}\" already exists, skipping`);\n const collection = await pb.collections.getOne(name);\n return { collection, created: false };\n }\n}\n\nfunction rulePayloadFromPatch(\n patch: CollectionRulesPatch,\n): Record<string, unknown> {\n const payload: Record<string, unknown> = {};\n if (patch.listRule !== undefined) payload.listRule = patch.listRule;\n if (patch.viewRule !== undefined) payload.viewRule = patch.viewRule;\n if (patch.createRule !== undefined) payload.createRule = patch.createRule;\n if (patch.updateRule !== undefined) payload.updateRule = patch.updateRule;\n if (patch.deleteRule !== undefined) payload.deleteRule = patch.deleteRule;\n return payload;\n}\n\n/**\n * Applies API rule updates in array order. Call after all referenced collections exist.\n * Collects migration files produced by each update when `options` is provided.\n */\nexport async function applyCollectionRulePatches(\n pb: {\n collections: {\n getFirstListItem: (filter: string) => Promise<{ id: string }>;\n update: (id: string, body: Record<string, unknown>) => Promise<unknown>;\n };\n },\n patches: CollectionRulesPatch[],\n options?: Options,\n logger: Logger = NOOP_LOGGER,\n): Promise<File[]> {\n const migrations: File[] = [];\n\n for (const patch of patches) {\n const escaped = patch.collectionName.replace(/'/g, \"''\");\n const col = await pb.collections.getFirstListItem(`name='${escaped}'`);\n logger.info(`Updating rules on collection \"${patch.collectionName}\"`);\n await pb.collections.update(col.id, rulePayloadFromPatch(patch));\n await migrationDelay();\n\n if (options) {\n const migrationFile = getMigrationFile(\n patch.collectionName,\n \"updated\",\n options,\n );\n if (migrationFile) {\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n }\n }\n\n return migrations;\n}\n\nfunction applyFieldChanges(\n existing: CollectionFieldSpec[],\n patch: CollectionFieldsPatch,\n): CollectionFieldSpec[] {\n const fields = existing.map((field) => ({ ...field }));\n\n for (const change of patch.changes) {\n if (change.op === \"add\") {\n if (fields.some((f) => f.name === change.field.name)) {\n throw new InvalidArgumentError(\n `Field \"${change.field.name}\" already exists on collection \"${patch.collectionName}\"`,\n );\n }\n fields.push(change.field);\n continue;\n }\n if (change.op === \"remove\") {\n const index = fields.findIndex((f) => f.name === change.fieldName);\n if (index === -1) {\n throw new InvalidArgumentError(\n `Field \"${change.fieldName}\" does not exist on collection \"${patch.collectionName}\"`,\n );\n }\n fields.splice(index, 1);\n continue;\n }\n if (change.op === \"rename\") {\n const field = fields.find((f) => f.name === change.from);\n if (!field) {\n throw new InvalidArgumentError(\n `Field \"${change.from}\" does not exist on collection \"${patch.collectionName}\"`,\n );\n }\n if (fields.some((f) => f.name === change.to)) {\n throw new InvalidArgumentError(\n `Field \"${change.to}\" already exists on collection \"${patch.collectionName}\"`,\n );\n }\n field.name = change.to;\n continue;\n }\n }\n\n return fields;\n}\n\nexport async function applyCollectionFieldsPatches(\n pb: {\n collections: {\n getOne: (\n name: string,\n ) => Promise<{ id: string; fields: CollectionFieldSpec[] }>;\n update: (id: string, body: Record<string, unknown>) => Promise<unknown>;\n };\n },\n patches: CollectionFieldsPatch[],\n options: Options,\n logger: Logger = NOOP_LOGGER,\n): Promise<File[]> {\n const migrations: File[] = [];\n\n for (const patch of patches) {\n const collection = await pb.collections.getOne(patch.collectionName);\n const newFields = applyFieldChanges(collection.fields, patch);\n logger.info(`Updating fields on collection \"${patch.collectionName}\"`);\n await pb.collections.update(collection.id, { fields: newFields });\n await migrationDelay();\n\n const migrationFile = getMigrationFile(\n patch.collectionName,\n \"updated\",\n options,\n );\n if (!migrationFile) continue;\n\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n\n return migrations;\n}\n\n/**\n * Adds to an existing collection every field of `spec` it lacks, by name, so a\n * project that created it under an older spec gets the new fields. Fields are\n * only added, never changed or removed. Returns the migration files written.\n */\nexport async function ensureCollectionFields(\n pb: PocketBase,\n spec: CollectionSpec,\n options: Options,\n logger: Logger = NOOP_LOGGER,\n): Promise<File[]> {\n const existing = await pb.collections.getOne(spec.name);\n const have = new Set(\n (existing.fields as { name: string }[]).map((field) => field.name),\n );\n const missing = spec.fields.filter((field) => !have.has(field.name));\n if (missing.length === 0) return [];\n logger.info(\n `Adding ${missing.map((field) => field.name).join(\", \")} to collection \"${spec.name}\"`,\n );\n return applyCollectionFieldsPatches(\n pb,\n [\n {\n collectionName: spec.name,\n changes: missing.map((field) => ({ op: \"add\" as const, field })),\n },\n ],\n options,\n logger,\n );\n}\n\nexport interface DropCollectionResult {\n dropped: boolean;\n existed: boolean;\n}\n\n/**\n * Idempotent collection drop. Returns `{ existed: false, dropped: false }` if\n * the collection is already gone, matching the idempotency contract of\n * `createCollectionIdempotent`.\n */\nexport async function dropCollectionIdempotent(\n pb: PocketBase,\n name: string,\n logger: Logger = NOOP_LOGGER,\n): Promise<DropCollectionResult> {\n try {\n await pb.collections.getOne(name);\n } catch (error) {\n const status = (error as { status?: number }).status;\n if (status === 404) {\n logger.info(`Collection \"${name}\" does not exist, skipping drop`);\n return { dropped: false, existed: false };\n }\n throw error;\n }\n await pb.collections.delete(name);\n return { dropped: true, existed: true };\n}\n\nexport interface CollectionStats {\n exists: boolean;\n rowCount: number;\n}\n\nexport async function getCollectionStats(\n pb: PocketBase,\n name: string,\n): Promise<CollectionStats> {\n try {\n await pb.collections.getOne(name);\n } catch (error) {\n const status = (error as { status?: number }).status;\n if (status === 404) {\n return { exists: false, rowCount: 0 };\n }\n throw error;\n }\n\n try {\n const result = await pb\n .collection(name)\n .getList(1, 1, { skipTotal: false });\n return { exists: true, rowCount: result.totalItems };\n } catch {\n return { exists: true, rowCount: 0 };\n }\n}\n\n/**\n * Resolve the set of collections to drop, with current row counts. Missing\n * collections are included with `exists: false, rowCount: 0` so callers can\n * display the full reversal plan even when some collections were already gone.\n */\nexport async function planCollectionDrops(\n pb: PocketBase,\n names: string[],\n): Promise<CollectionDropSpec[]> {\n const plans: CollectionDropSpec[] = [];\n for (const name of names) {\n const stats = await getCollectionStats(pb, name);\n plans.push({ name, exists: stats.exists, rowCount: stats.rowCount });\n }\n return plans;\n}\n\n/**\n * Drop each of the given collections (skipping those that are already gone)\n * and collect the `_deleted_<name>.js` migration file PocketBase emits for\n * each successful drop. Symmetric to `createCollections`.\n */\nexport async function dropCollections(\n specs: CollectionDropSpec[],\n options: Options,\n): Promise<File[]> {\n if (specs.length === 0) {\n return [];\n }\n\n const migrations: File[] = [];\n const logger = getLogger(options);\n\n await withPocketbase(options.root, async (pb) => {\n for (const spec of specs) {\n logger.info(`Dropping collection \"${spec.name}\"`);\n const { dropped } = await dropCollectionIdempotent(pb, spec.name, logger);\n if (!dropped) continue;\n await migrationDelay();\n\n const migrationFile = getMigrationFile(spec.name, \"deleted\", options);\n if (!migrationFile) continue;\n\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n });\n\n return migrations;\n}\n\nexport async function createCollections(\n collections: CollectionSpec[],\n options: Options,\n): Promise<File[]> {\n if (collections.length === 0) {\n return [];\n }\n\n const migrations: File[] = [];\n const logger = getLogger(options);\n\n await withPocketbase(options.root, async (pb) => {\n for (const collection of collections) {\n logger.info(`Creating collection \"${collection.name}\"`);\n const { created } = await createCollectionIdempotent(\n pb,\n collection,\n logger,\n );\n if (!created) continue;\n await migrationDelay();\n\n const migrationFile = getMigrationFile(\n collection.name,\n \"created\",\n options,\n );\n if (!migrationFile) {\n continue;\n }\n\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n });\n\n return migrations;\n}\n"],"mappings":";;;;;;;;;;;;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EAAE,eAAY,MAAMtC,EACxBgB,GACAsB,GACAhB,CACF;GACA,IAAI,CAAC0B,GAAS;GACd,MAAMrD,EAAe;GAErB,IAAMoC,IAAgBnC,EACpB0C,EAAW,MACX,WACAR,CACF;GACA,AAAKC,KAILL,EAAW,KAAK;IACd,MAAMK;IACN,UAAUxC,EAAiBwC,CAAa;IACxC,SAASC,EAAaD,GAAe,MAAM;IAC3C,QAAQ;GACV,CAAC;EACH;CACF,CAAC,GAEML;AACT"}
1
+ {"version":3,"file":"collections-DzwWwFUQ.js","names":["__exportAll","languageFromPath","getLogger","NOOP_LOGGER","withPocketbase","migrationDelay","getMigrationFile","collections_exports","applyCollectionFieldsPatches","applyCollectionRulePatches","createCollectionIdempotent","createCollections","dropCollectionIdempotent","dropCollections","ensureCollectionFields","getCollectionStats","planCollectionDrops","isCollectionAlreadyExistsError","error","message","resolveRelationTargets","fields","spec","relations","field","existing","pb","ids","c","byName","id","name","logger","rulePayloadFromPatch","payload","patch","migrations","patches","escaped","col","options","migrationFile","readFileSync","applyFieldChanges","change","f","InvalidArgumentError","index","collection","newFields","have","missing","plans","names","stats","specs","dropped","collections","created"],"sources":["../../src/runtime/collections.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport type PocketBase from \"pocketbase\";\nimport type { CollectionModel } from \"pocketbase\";\nimport type {\n CollectionDropSpec,\n CollectionFieldSpec,\n CollectionFieldsPatch,\n CollectionRulesPatch,\n CollectionSpec,\n File,\n Options,\n} from \"../core/types\";\nimport { InvalidArgumentError } from \"../core/errors\";\nimport { getLogger, NOOP_LOGGER, type Logger } from \"../core/logger\";\nimport { languageFromPath } from \"../core/util\";\nimport { getMigrationFile, migrationDelay, withPocketbase } from \"./pocketbase\";\n\ninterface PocketBaseCollectionCreateError {\n response?: {\n data?: {\n name?: {\n code?: string;\n };\n };\n };\n message?: string;\n}\n\nfunction isCollectionAlreadyExistsError(\n error: PocketBaseCollectionCreateError,\n): boolean {\n if (\n error.response?.data?.name?.code === \"validation_collection_name_exists\"\n ) {\n return true;\n }\n\n const message = error.message?.toLowerCase() ?? \"\";\n return (\n message.includes(\"already exists\") || message.includes(\"must be unique\")\n );\n}\n\ntype CollectionCreateInput = Parameters<PocketBase[\"collections\"][\"create\"]>[0];\n\ninterface RelationFieldLike {\n type?: string;\n collectionId?: string;\n}\n\n/**\n * A spec may name the collection a relation points at (`stripe_customers`)\n * where PocketBase wants its id; specs read better by name, and the id is\n * only known once the target exists. Names are swapped for ids here, and a\n * value that already is an id (`_pb_users_auth_`) is left alone.\n */\nasync function resolveRelationTargets(\n pb: PocketBase,\n spec: CollectionCreateInput,\n): Promise<CollectionCreateInput> {\n const fields = (spec as { fields?: RelationFieldLike[] }).fields;\n const relations = (fields ?? []).filter(\n (field) => field.type === \"relation\" && field.collectionId,\n );\n if (relations.length === 0) return spec;\n\n const existing = await pb.collections.getFullList();\n const ids = new Set(existing.map((c) => c.id));\n const byName = new Map(existing.map((c) => [c.name, c.id]));\n if (relations.every((field) => ids.has(field.collectionId!))) return spec;\n\n return {\n ...spec,\n fields: fields!.map((field) => {\n if (field.type !== \"relation\" || !field.collectionId) return field;\n const id = byName.get(field.collectionId);\n return id && !ids.has(field.collectionId)\n ? { ...field, collectionId: id }\n : field;\n }),\n } as CollectionCreateInput;\n}\n\nexport interface CreateCollectionResult {\n collection: CollectionModel;\n created: boolean;\n}\n\n/**\n * Idempotent wrapper around `pb.collections.create`. If the collection already\n * exists, logs and returns the existing model with `created: false` so callers\n * can skip work tied to a fresh create (e.g. appending a newly-generated\n * migration file to the result).\n */\nexport async function createCollectionIdempotent(\n pb: PocketBase,\n spec: CollectionCreateInput,\n logger: Logger = NOOP_LOGGER,\n): Promise<CreateCollectionResult> {\n const name = (spec as { name: string }).name;\n try {\n const collection = await pb.collections.create(\n await resolveRelationTargets(pb, spec),\n );\n return { collection, created: true };\n } catch (error) {\n if (\n !isCollectionAlreadyExistsError(error as PocketBaseCollectionCreateError)\n ) {\n throw error;\n }\n logger.info(`Collection \"${name}\" already exists, skipping`);\n const collection = await pb.collections.getOne(name);\n return { collection, created: false };\n }\n}\n\nfunction rulePayloadFromPatch(\n patch: CollectionRulesPatch,\n): Record<string, unknown> {\n const payload: Record<string, unknown> = {};\n if (patch.listRule !== undefined) payload.listRule = patch.listRule;\n if (patch.viewRule !== undefined) payload.viewRule = patch.viewRule;\n if (patch.createRule !== undefined) payload.createRule = patch.createRule;\n if (patch.updateRule !== undefined) payload.updateRule = patch.updateRule;\n if (patch.deleteRule !== undefined) payload.deleteRule = patch.deleteRule;\n return payload;\n}\n\n/**\n * Applies API rule updates in array order. Call after all referenced collections exist.\n * Collects migration files produced by each update when `options` is provided.\n */\nexport async function applyCollectionRulePatches(\n pb: {\n collections: {\n getFirstListItem: (filter: string) => Promise<{ id: string }>;\n update: (id: string, body: Record<string, unknown>) => Promise<unknown>;\n };\n },\n patches: CollectionRulesPatch[],\n options?: Options,\n logger: Logger = NOOP_LOGGER,\n): Promise<File[]> {\n const migrations: File[] = [];\n\n for (const patch of patches) {\n const escaped = patch.collectionName.replace(/'/g, \"''\");\n const col = await pb.collections.getFirstListItem(`name='${escaped}'`);\n logger.info(`Updating rules on collection \"${patch.collectionName}\"`);\n await pb.collections.update(col.id, rulePayloadFromPatch(patch));\n await migrationDelay();\n\n if (options) {\n const migrationFile = getMigrationFile(\n patch.collectionName,\n \"updated\",\n options,\n );\n if (migrationFile) {\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n }\n }\n\n return migrations;\n}\n\nfunction applyFieldChanges(\n existing: CollectionFieldSpec[],\n patch: CollectionFieldsPatch,\n): CollectionFieldSpec[] {\n const fields = existing.map((field) => ({ ...field }));\n\n for (const change of patch.changes) {\n if (change.op === \"add\") {\n if (fields.some((f) => f.name === change.field.name)) {\n throw new InvalidArgumentError(\n `Field \"${change.field.name}\" already exists on collection \"${patch.collectionName}\"`,\n );\n }\n fields.push(change.field);\n continue;\n }\n if (change.op === \"remove\") {\n const index = fields.findIndex((f) => f.name === change.fieldName);\n if (index === -1) {\n throw new InvalidArgumentError(\n `Field \"${change.fieldName}\" does not exist on collection \"${patch.collectionName}\"`,\n );\n }\n fields.splice(index, 1);\n continue;\n }\n if (change.op === \"rename\") {\n const field = fields.find((f) => f.name === change.from);\n if (!field) {\n throw new InvalidArgumentError(\n `Field \"${change.from}\" does not exist on collection \"${patch.collectionName}\"`,\n );\n }\n if (fields.some((f) => f.name === change.to)) {\n throw new InvalidArgumentError(\n `Field \"${change.to}\" already exists on collection \"${patch.collectionName}\"`,\n );\n }\n field.name = change.to;\n continue;\n }\n }\n\n return fields;\n}\n\nexport async function applyCollectionFieldsPatches(\n pb: {\n collections: {\n getOne: (\n name: string,\n ) => Promise<{ id: string; fields: CollectionFieldSpec[] }>;\n update: (id: string, body: Record<string, unknown>) => Promise<unknown>;\n };\n },\n patches: CollectionFieldsPatch[],\n options: Options,\n logger: Logger = NOOP_LOGGER,\n): Promise<File[]> {\n const migrations: File[] = [];\n\n for (const patch of patches) {\n const collection = await pb.collections.getOne(patch.collectionName);\n const newFields = applyFieldChanges(collection.fields, patch);\n logger.info(`Updating fields on collection \"${patch.collectionName}\"`);\n await pb.collections.update(collection.id, { fields: newFields });\n await migrationDelay();\n\n const migrationFile = getMigrationFile(\n patch.collectionName,\n \"updated\",\n options,\n );\n if (!migrationFile) continue;\n\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n\n return migrations;\n}\n\n/**\n * Adds to an existing collection every field of `spec` it lacks, by name, so a\n * project that created it under an older spec gets the new fields. Fields are\n * only added, never changed or removed. Returns the migration files written.\n */\nexport async function ensureCollectionFields(\n pb: PocketBase,\n spec: CollectionSpec,\n options: Options,\n logger: Logger = NOOP_LOGGER,\n): Promise<File[]> {\n const existing = await pb.collections.getOne(spec.name);\n const have = new Set(\n (existing.fields as { name: string }[]).map((field) => field.name),\n );\n const missing = spec.fields.filter((field) => !have.has(field.name));\n if (missing.length === 0) return [];\n logger.info(\n `Adding ${missing.map((field) => field.name).join(\", \")} to collection \"${spec.name}\"`,\n );\n return applyCollectionFieldsPatches(\n pb,\n [\n {\n collectionName: spec.name,\n changes: missing.map((field) => ({ op: \"add\" as const, field })),\n },\n ],\n options,\n logger,\n );\n}\n\nexport interface DropCollectionResult {\n dropped: boolean;\n existed: boolean;\n}\n\n/**\n * Idempotent collection drop. Returns `{ existed: false, dropped: false }` if\n * the collection is already gone, matching the idempotency contract of\n * `createCollectionIdempotent`.\n */\nexport async function dropCollectionIdempotent(\n pb: PocketBase,\n name: string,\n logger: Logger = NOOP_LOGGER,\n): Promise<DropCollectionResult> {\n try {\n await pb.collections.getOne(name);\n } catch (error) {\n const status = (error as { status?: number }).status;\n if (status === 404) {\n logger.info(`Collection \"${name}\" does not exist, skipping drop`);\n return { dropped: false, existed: false };\n }\n throw error;\n }\n await pb.collections.delete(name);\n return { dropped: true, existed: true };\n}\n\nexport interface CollectionStats {\n exists: boolean;\n rowCount: number;\n}\n\nexport async function getCollectionStats(\n pb: PocketBase,\n name: string,\n): Promise<CollectionStats> {\n try {\n await pb.collections.getOne(name);\n } catch (error) {\n const status = (error as { status?: number }).status;\n if (status === 404) {\n return { exists: false, rowCount: 0 };\n }\n throw error;\n }\n\n try {\n const result = await pb\n .collection(name)\n .getList(1, 1, { skipTotal: false });\n return { exists: true, rowCount: result.totalItems };\n } catch {\n return { exists: true, rowCount: 0 };\n }\n}\n\n/**\n * Resolve the set of collections to drop, with current row counts. Missing\n * collections are included with `exists: false, rowCount: 0` so callers can\n * display the full reversal plan even when some collections were already gone.\n */\nexport async function planCollectionDrops(\n pb: PocketBase,\n names: string[],\n): Promise<CollectionDropSpec[]> {\n const plans: CollectionDropSpec[] = [];\n for (const name of names) {\n const stats = await getCollectionStats(pb, name);\n plans.push({ name, exists: stats.exists, rowCount: stats.rowCount });\n }\n return plans;\n}\n\n/**\n * Drop each of the given collections (skipping those that are already gone)\n * and collect the `_deleted_<name>.js` migration file PocketBase emits for\n * each successful drop. Symmetric to `createCollections`.\n */\nexport async function dropCollections(\n specs: CollectionDropSpec[],\n options: Options,\n): Promise<File[]> {\n if (specs.length === 0) {\n return [];\n }\n\n const migrations: File[] = [];\n const logger = getLogger(options);\n\n await withPocketbase(options.root, async (pb) => {\n for (const spec of specs) {\n logger.info(`Dropping collection \"${spec.name}\"`);\n const { dropped } = await dropCollectionIdempotent(pb, spec.name, logger);\n if (!dropped) continue;\n await migrationDelay();\n\n const migrationFile = getMigrationFile(spec.name, \"deleted\", options);\n if (!migrationFile) continue;\n\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n });\n\n return migrations;\n}\n\nexport async function createCollections(\n collections: CollectionSpec[],\n options: Options,\n): Promise<File[]> {\n if (collections.length === 0) {\n return [];\n }\n\n const migrations: File[] = [];\n const logger = getLogger(options);\n\n await withPocketbase(options.root, async (pb) => {\n for (const collection of collections) {\n logger.info(`Creating collection \"${collection.name}\"`);\n const { created } = await createCollectionIdempotent(\n pb,\n collection,\n logger,\n );\n if (!created) continue;\n await migrationDelay();\n\n const migrationFile = getMigrationFile(\n collection.name,\n \"created\",\n options,\n );\n if (!migrationFile) {\n continue;\n }\n\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n });\n\n return migrations;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAASiB,EACP,GACS;CACT,IACEC,EAAM,UAAU,MAAM,MAAM,SAAS,qCAErC,OAAO;CAGT,IAAMC,IAAUD,EAAM,SAAS,YAAY,KAAK;CAChD,OACEC,EAAQ,SAAS,gBAAgB,KAAKA,EAAQ,SAAS,gBAAgB;AAE3E;AAeA,eAAeC,EACb,GACA,GACgC;CAChC,IAAMC,IAAUC,EAA0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C,QAAQ;GACV,CAAC;EACH;CACF,CAAC,GAEML;AACT"}
@@ -1,6 +1,6 @@
1
1
  //#region src/core/constants.ts
2
- var e = "data", t = "migrations", n = "(public)", r = "(app)", i = "@tanstack/table-core@^9.2.4", a = "formsnap@^2.1.0", o = "3.0.0", s = `sveltekit-superforms@${o}`, c = "sveltekit-flash-message@3.0.0", l = "@sveltejs/adapter-node@^6.0.0", u = "@sveltejs/adapter-static@^4.0.0", d = "@velastack/kit@^0.4.0", f = "@velastack/pocketbase@^0.4.2", p = "@velastack/cms@^0.6.0", m = "@velastack/whatsapp@^0.1.0", h = "sveltekit-negotiate@^0.3.0", g = "zod@^4.1.11", _ = "wuchale@^0.26.3", v = "@wuchale/svelte@^0.21.1";
2
+ var e = "data", t = "migrations", n = "(public)", r = "(app)", i = "@tanstack/table-core@^9.2.4", a = "formsnap@^2.1.0", o = "3.0.0", s = `sveltekit-superforms@${o}`, c = "sveltekit-flash-message@3.0.0", l = "@sveltejs/adapter-node@^6.0.0", u = "@sveltejs/adapter-static@^4.0.0", d = "@velastack/kit@^0.4.0", f = "@velastack/pocketbase@^0.4.2", p = "@velastack/cms@^0.6.0", m = "@velastack/whatsapp@^0.1.0", h = "sveltekit-negotiate@^0.3.0", g = "zod@^4.1.11", _ = "@takumi-rs/core@^2.20.0", v = "wuchale@^0.26.3", y = "@wuchale/svelte@^0.21.1";
3
3
  //#endregion
4
- export { _, c as a, h as c, o as d, i as f, m as g, f as h, e as i, n as l, d as m, u as n, a as o, p, r, t as s, l as t, s as u, v, g as y };
4
+ export { m as _, c as a, g as b, h as c, o as d, _ as f, f as g, d as h, e as i, n as l, p as m, u as n, a as o, i as p, r, t as s, l as t, s as u, v, y };
5
5
 
6
- //# sourceMappingURL=constants-Bdx8mp7v.js.map
6
+ //# sourceMappingURL=constants-8cLxGOB0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-8cLxGOB0.js","names":["DATA_DIR","MIGRATIONS_DIR","PUBLIC_DIR","APP_DIR","TANSTACK_TABLE_CORE","FORMSNAP","SUPERFORMS_VERSION","SUPERFORMS","FLASH","ADAPTER_NODE","ADAPTER_STATIC","VELASTACK_KIT","VELASTACK_POCKETBASE","VELASTACK_CMS","VELASTACK_WHATSAPP","NEGOTIATE","ZOD","TAKUMI","WUCHALE","WUCHALE_SVELTE"],"sources":["../../src/core/constants.ts"],"sourcesContent":["export const DATA_DIR = \"data\";\nexport const MIGRATIONS_DIR = \"migrations\";\nexport const FIXTURE_PREFIX = \"vela\";\nexport const PUBLIC_DIR = \"(public)\";\nexport const APP_DIR = \"(app)\";\nexport const AUTHED_REDIRECT_PATH = \"/dashboard\";\nexport const API_URL = \"http://localhost:5173\";\n\n/**\n * The table helpers this repo ships (`data-table`, `column-header`,\n * `faceted-filter`, `pagination`) and the pages the scaffold generators emit\n * target TanStack Table v9, whose API and types are incompatible with v8; see\n * `assertTableCoreV9` for projects that still have the v8 helpers.\n */\nexport const TANSTACK_TABLE_CORE = \"@tanstack/table-core@^9.2.4\";\n\n/** The major `TANSTACK_TABLE_CORE` pins. */\nexport const TANSTACK_TABLE_CORE_MAJOR = 9;\n\n/**\n * `file-form` and `multiselect` build on formsnap's field context. 2.1.0 is\n * the first release whose superforms peer admits 3.x; 2.0 needed an npm\n * override, which `writeResult` now removes (`reconcileFormsnap`).\n */\nexport const FORMSNAP = \"formsnap@^2.1.0\";\n\n/**\n * The superforms release that supports SvelteKit 3. Installed exactly, as the\n * `next` builds before it were (`FLASH` too): `vela migrate` and `vela bless`\n * move projects from those prerelease pins onto the releases, and formsnap's\n * `^3.0.0` peer admits the release only.\n */\nexport const SUPERFORMS_VERSION = \"3.0.0\";\n\n/**\n * What a generated superforms page needs. Vela's templates already carry\n * both; a project vela did not create may have neither.\n */\nexport const SUPERFORMS = `sveltekit-superforms@${SUPERFORMS_VERSION}`;\n\n/** The flash-message release that supports SvelteKit 3; installed exactly, like superforms. */\nexport const FLASH = \"sveltekit-flash-message@3.0.0\";\n\n/** The adapter `vela enable backend` moves a project to. */\nexport const ADAPTER_NODE = \"@sveltejs/adapter-node@^6.0.0\";\n\n/** The adapter a static project builds with (`vela disable backend`). */\nexport const ADAPTER_STATIC = \"@sveltejs/adapter-static@^4.0.0\";\n\n/** The VelaStack libraries' SvelteKit 3 releases. */\nexport const VELASTACK_KIT = \"@velastack/kit@^0.4.0\";\n/** 0.4.2 proxies plugin webhooks (pocketbase-whatsapp) to PocketBase. */\nexport const VELASTACK_POCKETBASE = \"@velastack/pocketbase@^0.4.2\";\nexport const VELASTACK_CMS = \"@velastack/cms@^0.6.0\";\n/** wa.me links, order messages and hosted order recording, for payments on WhatsApp. */\nexport const VELASTACK_WHATSAPP = \"@velastack/whatsapp@^0.1.0\";\nexport const NEGOTIATE = \"sveltekit-negotiate@^0.3.0\";\nexport const ZOD = \"zod@^4.1.11\";\n/** Renders HTML and CSS to an image; a native module, so it must be a dependency. */\nexport const TAKUMI = \"@takumi-rs/core@^2.20.0\";\n\n/** What `vela enable i18n` installs: wuchale and its Svelte adapter. */\nexport const WUCHALE = \"wuchale@^0.26.3\";\nexport const WUCHALE_SVELTE = \"@wuchale/svelte@^0.21.1\";\n"],"mappings":";AAAA,IAAaA,IAAW,QACXC,IAAiB,cAEjBC,IAAa,YACbC,IAAU,SAUVC,IAAsB,+BAUtBC,IAAW,mBAQXC,IAAqB,SAMrBC,IAAa,wBAAwBD,KAGrCE,IAAQ,iCAGRC,IAAe,iCAGfC,IAAiB,mCAGjBC,IAAgB,yBAEhBC,IAAuB,gCACvBC,IAAgB,yBAEhBC,IAAqB,8BACrBC,IAAY,8BACZC,IAAM,eAENC,IAAS,2BAGTC,IAAU,mBACVC,IAAiB"}