@velastack/patterns 0.0.15 → 0.0.17

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.
@@ -5,7 +5,7 @@ import { detect as y } from "package-manager-detector";
5
5
  import { resolveCommand as k } from "package-manager-detector/commands";
6
6
  import _ from "cross-spawn";
7
7
  import R from "node:net";
8
- import { D as A, M as u } from "./index-Dav9F9Qf.js";
8
+ import { D as A, M as u } from "./index-ZTxLoBuU.js";
9
9
  function b() {
10
10
  return Math.floor(Math.random() * 1e4) + 1e4;
11
11
  }
@@ -132,4 +132,4 @@ export {
132
132
  I as g,
133
133
  W as w
134
134
  };
135
- //# sourceMappingURL=pocketbase-nb-YtqiX.js.map
135
+ //# sourceMappingURL=pocketbase-CtWkx70o.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pocketbase-nb-YtqiX.js","sources":["../../src/runtime/net.ts","../../src/runtime/pocketbase.ts"],"sourcesContent":["import net from \"node:net\";\n\n// Generate a random port\nexport function randomPort() {\n return Math.floor(Math.random() * 10000) + 10000;\n}\n\n// Wait for the port to be available\nexport function waitForPort(\n port: number,\n host: string,\n maxAttempts = 10,\n): Promise<void> {\n return new Promise((resolve, reject) => {\n let attempts = 0;\n\n const tryConnect = () => {\n attempts++;\n\n const socket = new net.Socket();\n\n const onError = () => {\n socket.destroy();\n\n if (attempts === maxAttempts) {\n reject(\n new Error(`Timed out waiting for port ${port} to be available`),\n );\n return;\n }\n\n setTimeout(tryConnect, 500);\n };\n\n socket.once(\"error\", onError);\n\n socket.connect(port, host, () => {\n socket.destroy();\n resolve();\n });\n };\n\n tryConnect();\n });\n}\n\n// Wait for the health check to be successful\nexport function waitForHealth(url: string, maxAttempts = 10): Promise<void> {\n return new Promise((resolve, reject) => {\n let attempts = 0;\n\n const tryHealth = async () => {\n attempts++;\n\n try {\n const response = await fetch(`${url}/api/health`);\n if (response.status === 200) {\n resolve();\n return;\n }\n } catch {\n // Ignore fetch errors and continue retrying\n }\n\n if (attempts === maxAttempts) {\n reject(\n new Error(`Timed out waiting for health check at ${url}/api/health`),\n );\n return;\n }\n\n setTimeout(tryHealth, 500);\n };\n\n tryHealth();\n });\n}\n","import { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport PocketBase from \"pocketbase\";\nimport { detect } from \"package-manager-detector\";\nimport { resolveCommand } from \"package-manager-detector/commands\";\nimport spawn from \"cross-spawn\";\nimport { randomPort, waitForPort, waitForHealth } from \"./net\";\nimport type { Options } from \"../core/types\";\nimport { DATA_DIR, MIGRATIONS_DIR } from \"../core/constants\";\n\nexport function getMigrationFile(\n collectionName: string,\n action: \"created\" | \"deleted\" | \"updated\",\n options: Options,\n): string | undefined {\n const ending = `${action}_${collectionName}.js`;\n\n // find last file with ending in migrations dir\n const migrationFiles = readdirSync(\n path.join(options.root, MIGRATIONS_DIR),\n ).filter((file) => file.endsWith(ending));\n\n const migrationFile = migrationFiles.sort().pop();\n\n if (!migrationFile) {\n return undefined;\n }\n\n return path.join(options.root, MIGRATIONS_DIR, migrationFile);\n}\n\nexport function getPocketbaseMetadata(cwd: string): {\n pocketbaseUrl: string;\n vitePort: number;\n} | null {\n const metadataPath = path.join(\n cwd,\n \"node_modules\",\n \".vite\",\n \"_pocketbase_metadata.json\",\n );\n if (existsSync(metadataPath)) {\n return JSON.parse(readFileSync(metadataPath, \"utf8\"));\n }\n return null;\n}\n\nexport async function authWithRetries(\n pb: PocketBase,\n email: string,\n password: string,\n) {\n // Retry authentication up to 3 times with 100ms backoff\n let authSuccess = false;\n for (let attempt = 1; attempt <= 3; attempt++) {\n try {\n await pb.collection(\"_superusers\").authWithPassword(email, password);\n authSuccess = true;\n break;\n } catch {\n if (attempt < 3) {\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n }\n }\n\n if (!authSuccess) {\n throw new Error(\n \"Failed to authenticate with PocketBase. Check your superuser credentials.\",\n );\n }\n}\n\nexport async function withPocketbase(\n cwd: string,\n fn: (pb: PocketBase) => Promise<void>,\n) {\n const dir = path.join(cwd, DATA_DIR);\n const migrationsDir = path.join(cwd, MIGRATIONS_DIR);\n const host = \"localhost\";\n\n if (!existsSync(dir)) {\n throw new Error(\"PocketBase data directory does not exist\");\n }\n\n // First check if the server is already running by reading node_modules/.vite/_pocketbase_metadata.json\n const metadata = getPocketbaseMetadata(cwd);\n if (metadata) {\n if (metadata.pocketbaseUrl) {\n const pb = new PocketBase(metadata.pocketbaseUrl);\n await authWithRetries(\n pb,\n process.env.POCKETBASE_SUPERUSER_EMAIL!,\n process.env.POCKETBASE_SUPERUSER_PASSWORD!,\n );\n await fn(pb);\n return;\n }\n }\n\n const port = randomPort();\n const commandArgs = [\n \"pocketbase-server\",\n \"serve\",\n \"--dir\",\n dir,\n \"--migrationsDir\",\n migrationsDir,\n \"--http\",\n `${host}:${port}`,\n ];\n\n const packageManager = (await detect({ cwd }))?.name ?? \"npm\";\n const { command, args } = resolveCommand(\n packageManager,\n \"execute\",\n commandArgs,\n )!;\n\n // adding --yes as the first parameter helps avoiding the \"Need to install the following packages:\" message\n if (packageManager === \"npm\") args.unshift(\"--yes\");\n\n // Start the PocketBase server process\n const serverProcess = spawn(command, args, {\n stdio: \"ignore\",\n });\n\n try {\n // Wait for the server to be ready\n await waitForPort(port, host);\n await waitForHealth(`http://${host}:${port}`);\n\n const pb = new PocketBase(`http://${host}:${port}`);\n await authWithRetries(\n pb,\n process.env.POCKETBASE_SUPERUSER_EMAIL!,\n process.env.POCKETBASE_SUPERUSER_PASSWORD!,\n );\n await fn(pb);\n } finally {\n // Ensure we always clean up the process\n serverProcess.kill();\n }\n}\n"],"names":["randomPort","waitForPort","port","host","maxAttempts","resolve","reject","attempts","tryConnect","socket","net","onError","waitForHealth","url","tryHealth","getMigrationFile","collectionName","action","options","ending","migrationFile","readdirSync","path","MIGRATIONS_DIR","file","getPocketbaseMetadata","cwd","metadataPath","existsSync","readFileSync","authWithRetries","pb","email","password","authSuccess","attempt","withPocketbase","fn","dir","DATA_DIR","migrationsDir","metadata","PocketBase","commandArgs","packageManager","_a","detect","command","args","resolveCommand","serverProcess","spawn"],"mappings":";;;;;;;;AAGO,SAASA,IAAa;AAC3B,SAAO,KAAK,MAAM,KAAK,OAAA,IAAW,GAAK,IAAI;AAC7C;AAGO,SAASC,EACdC,GACAC,GACAC,IAAc,IACC;AACf,SAAO,IAAI,QAAQ,CAACC,GAASC,MAAW;AACtC,QAAIC,IAAW;AAEf,UAAMC,IAAa,MAAM;AACvB,MAAAD;AAEA,YAAME,IAAS,IAAIC,EAAI,OAAA,GAEjBC,IAAU,MAAM;AAGpB,YAFAF,EAAO,QAAA,GAEHF,MAAaH,GAAa;AAC5B,UAAAE;AAAA,YACE,IAAI,MAAM,8BAA8BJ,CAAI,kBAAkB;AAAA,UAAA;AAEhE;AAAA,QACF;AAEA,mBAAWM,GAAY,GAAG;AAAA,MAC5B;AAEA,MAAAC,EAAO,KAAK,SAASE,CAAO,GAE5BF,EAAO,QAAQP,GAAMC,GAAM,MAAM;AAC/B,QAAAM,EAAO,QAAA,GACPJ,EAAA;AAAA,MACF,CAAC;AAAA,IACH;AAEA,IAAAG,EAAA;AAAA,EACF,CAAC;AACH;AAGO,SAASI,EAAcC,GAAaT,IAAc,IAAmB;AAC1E,SAAO,IAAI,QAAQ,CAACC,GAASC,MAAW;AACtC,QAAIC,IAAW;AAEf,UAAMO,IAAY,YAAY;AAC5B,MAAAP;AAEA,UAAI;AAEF,aADiB,MAAM,MAAM,GAAGM,CAAG,aAAa,GACnC,WAAW,KAAK;AAC3B,UAAAR,EAAA;AACA;AAAA,QACF;AAAA,MACF,QAAQ;AAAA,MAER;AAEA,UAAIE,MAAaH,GAAa;AAC5B,QAAAE;AAAA,UACE,IAAI,MAAM,yCAAyCO,CAAG,aAAa;AAAA,QAAA;AAErE;AAAA,MACF;AAEA,iBAAWC,GAAW,GAAG;AAAA,IAC3B;AAEA,IAAAA,EAAA;AAAA,EACF,CAAC;AACH;AClEO,SAASC,EACdC,GACA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QAAQ,IAAI;AAAA,IAAA,GAEd,MAAMM,EAAGN,CAAE;AACX;AAAA,EACF;AAGF,QAAM7B,IAAOF,EAAA,GACP2C,IAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACAL;AAAA,IACA;AAAA,IACAE;AAAA,IACA;AAAA,IACA,GAAGrC,CAAI,IAAID,CAAI;AAAA,EAAA,GAGX0C,MAAkBC,IAAA,MAAMC,EAAO,EAAE,KAAApB,EAAA,CAAK,MAApB,gBAAAmB,EAAwB,SAAQ,OAClD,EAAE,SAAAE,GAAS,MAAAC,EAAA,IAASC;AAAA,IACxBL;AAAA,IACA;AAAA,IACAD;AAAA,EAAA;AAIF,EAAIC,MAAmB,SAAOI,EAAK,QAAQ,OAAO;AAGlD,QAAME,IAAgBC,EAAMJ,GAASC,GAAM;AAAA,IACzC,OAAO;AAAA,EAAA,CACR;AAED,MAAI;AAEF,UAAM/C,EAAYC,GAAMC,CAAI,GAC5B,MAAMS,EAAc,UAAUT,CAAI,IAAID,CAAI,EAAE;AAE5C,UAAM6B,IAAK,IAAIW,EAAW,UAAUvC,CAAI,IAAID,CAAI,EAAE;AAClD,UAAM4B;AAAA,MACJC;AAAA,MACA,QAAQ,IAAI;AAAA,MACZ,QAAQ,IAAI;AAAA,IAAA,GAEd,MAAMM,EAAGN,CAAE;AAAA,EACb,UAAA;AAEE,IAAAmB,EAAc,KAAA;AAAA,EAChB;AACF;"}
1
+ {"version":3,"file":"pocketbase-CtWkx70o.js","sources":["../../src/runtime/net.ts","../../src/runtime/pocketbase.ts"],"sourcesContent":["import net from \"node:net\";\n\n// Generate a random port\nexport function randomPort() {\n return Math.floor(Math.random() * 10000) + 10000;\n}\n\n// Wait for the port to be available\nexport function waitForPort(\n port: number,\n host: string,\n maxAttempts = 10,\n): Promise<void> {\n return new Promise((resolve, reject) => {\n let attempts = 0;\n\n const tryConnect = () => {\n attempts++;\n\n const socket = new net.Socket();\n\n const onError = () => {\n socket.destroy();\n\n if (attempts === maxAttempts) {\n reject(\n new Error(`Timed out waiting for port ${port} to be available`),\n );\n return;\n }\n\n setTimeout(tryConnect, 500);\n };\n\n socket.once(\"error\", onError);\n\n socket.connect(port, host, () => {\n socket.destroy();\n resolve();\n });\n };\n\n tryConnect();\n });\n}\n\n// Wait for the health check to be successful\nexport function waitForHealth(url: string, maxAttempts = 10): Promise<void> {\n return new Promise((resolve, reject) => {\n let attempts = 0;\n\n const tryHealth = async () => {\n attempts++;\n\n try {\n const response = await fetch(`${url}/api/health`);\n if (response.status === 200) {\n resolve();\n return;\n }\n } catch {\n // Ignore fetch errors and continue retrying\n }\n\n if (attempts === maxAttempts) {\n reject(\n new Error(`Timed out waiting for health check at ${url}/api/health`),\n );\n return;\n }\n\n setTimeout(tryHealth, 500);\n };\n\n tryHealth();\n });\n}\n","import { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport PocketBase from \"pocketbase\";\nimport { detect } from \"package-manager-detector\";\nimport { resolveCommand } from \"package-manager-detector/commands\";\nimport spawn from \"cross-spawn\";\nimport { randomPort, waitForPort, waitForHealth } from \"./net\";\nimport type { Options } from \"../core/types\";\nimport { DATA_DIR, MIGRATIONS_DIR } from \"../core/constants\";\n\nexport function getMigrationFile(\n collectionName: string,\n action: \"created\" | \"deleted\" | \"updated\",\n options: Options,\n): string | undefined {\n const ending = `${action}_${collectionName}.js`;\n\n // find last file with ending in migrations dir\n const migrationFiles = readdirSync(\n path.join(options.root, MIGRATIONS_DIR),\n ).filter((file) => file.endsWith(ending));\n\n const migrationFile = migrationFiles.sort().pop();\n\n if (!migrationFile) {\n return undefined;\n }\n\n return path.join(options.root, MIGRATIONS_DIR, migrationFile);\n}\n\nexport function getPocketbaseMetadata(cwd: string): {\n pocketbaseUrl: string;\n vitePort: number;\n} | null {\n const metadataPath = path.join(\n cwd,\n \"node_modules\",\n \".vite\",\n \"_pocketbase_metadata.json\",\n );\n if (existsSync(metadataPath)) {\n return JSON.parse(readFileSync(metadataPath, \"utf8\"));\n }\n return null;\n}\n\nexport async function authWithRetries(\n pb: PocketBase,\n email: string,\n password: string,\n) {\n // Retry authentication up to 3 times with 100ms backoff\n let authSuccess = false;\n for (let attempt = 1; attempt <= 3; attempt++) {\n try {\n await pb.collection(\"_superusers\").authWithPassword(email, password);\n authSuccess = true;\n break;\n } catch {\n if (attempt < 3) {\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n }\n }\n\n if (!authSuccess) {\n throw new Error(\n \"Failed to authenticate with PocketBase. Check your superuser credentials.\",\n );\n }\n}\n\nexport async function withPocketbase(\n cwd: string,\n fn: (pb: PocketBase) => Promise<void>,\n) {\n const dir = path.join(cwd, DATA_DIR);\n const migrationsDir = path.join(cwd, MIGRATIONS_DIR);\n const host = \"localhost\";\n\n if (!existsSync(dir)) {\n throw new Error(\"PocketBase data directory does not exist\");\n }\n\n // First check if the server is already running by reading node_modules/.vite/_pocketbase_metadata.json\n const metadata = getPocketbaseMetadata(cwd);\n if (metadata) {\n if (metadata.pocketbaseUrl) {\n const pb = new PocketBase(metadata.pocketbaseUrl);\n await authWithRetries(\n pb,\n process.env.POCKETBASE_SUPERUSER_EMAIL!,\n process.env.POCKETBASE_SUPERUSER_PASSWORD!,\n );\n await fn(pb);\n return;\n }\n }\n\n const port = randomPort();\n const commandArgs = [\n \"pocketbase-server\",\n \"serve\",\n \"--dir\",\n dir,\n \"--migrationsDir\",\n migrationsDir,\n \"--http\",\n `${host}:${port}`,\n ];\n\n const packageManager = (await detect({ cwd }))?.name ?? \"npm\";\n const { command, args } = resolveCommand(\n packageManager,\n \"execute\",\n commandArgs,\n )!;\n\n // adding --yes as the first parameter helps avoiding the \"Need to install the following packages:\" message\n if (packageManager === \"npm\") args.unshift(\"--yes\");\n\n // Start the PocketBase server process\n const serverProcess = spawn(command, args, {\n stdio: \"ignore\",\n });\n\n try {\n // Wait for the server to be ready\n await waitForPort(port, host);\n await waitForHealth(`http://${host}:${port}`);\n\n const pb = new PocketBase(`http://${host}:${port}`);\n await authWithRetries(\n pb,\n process.env.POCKETBASE_SUPERUSER_EMAIL!,\n process.env.POCKETBASE_SUPERUSER_PASSWORD!,\n );\n await fn(pb);\n } finally {\n // Ensure we always clean up the process\n serverProcess.kill();\n }\n}\n"],"names":["randomPort","waitForPort","port","host","maxAttempts","resolve","reject","attempts","tryConnect","socket","net","onError","waitForHealth","url","tryHealth","getMigrationFile","collectionName","action","options","ending","migrationFile","readdirSync","path","MIGRATIONS_DIR","file","getPocketbaseMetadata","cwd","metadataPath","existsSync","readFileSync","authWithRetries","pb","email","password","authSuccess","attempt","withPocketbase","fn","dir","DATA_DIR","migrationsDir","metadata","PocketBase","commandArgs","packageManager","_a","detect","command","args","resolveCommand","serverProcess","spawn"],"mappings":";;;;;;;;AAGO,SAASA,IAAa;AAC3B,SAAO,KAAK,MAAM,KAAK,OAAA,IAAW,GAAK,IAAI;AAC7C;AAGO,SAASC,EACdC,GACAC,GACAC,IAAc,IACC;AACf,SAAO,IAAI,QAAQ,CAACC,GAASC,MAAW;AACtC,QAAIC,IAAW;AAEf,UAAMC,IAAa,MAAM;AACvB,MAAAD;AAEA,YAAME,IAAS,IAAIC,EAAI,OAAA,GAEjBC,IAAU,MAAM;AAGpB,YAFAF,EAAO,QAAA,GAEHF,MAAaH,GAAa;AAC5B,UAAAE;AAAA,YACE,IAAI,MAAM,8BAA8BJ,CAAI,kBAAkB;AAAA,UAAA;AAEhE;AAAA,QACF;AAEA,mBAAWM,GAAY,GAAG;AAAA,MAC5B;AAEA,MAAAC,EAAO,KAAK,SAASE,CAAO,GAE5BF,EAAO,QAAQP,GAAMC,GAAM,MAAM;AAC/B,QAAAM,EAAO,QAAA,GACPJ,EAAA;AAAA,MACF,CAAC;AAAA,IACH;AAEA,IAAAG,EAAA;AAAA,EACF,CAAC;AACH;AAGO,SAASI,EAAcC,GAAaT,IAAc,IAAmB;AAC1E,SAAO,IAAI,QAAQ,CAACC,GAASC,MAAW;AACtC,QAAIC,IAAW;AAEf,UAAMO,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AmB,EAAc,KAAA;AAAA,EAChB;AACF;"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const byCategory: Record<"auth" | "generators" | "api", ({
1
+ export declare const byCategory: Record<"auth" | "generators" | "api" | "i18n", ({
2
2
  version: string;
3
3
  slug: "generate-form";
4
4
  source: string;
@@ -8,6 +8,7 @@ export declare const byCategory: Record<"auth" | "generators" | "api", ({
8
8
  summary: string;
9
9
  requires: {
10
10
  auth: false;
11
+ api: false;
11
12
  payments: false;
12
13
  };
13
14
  category: "generators";
@@ -29,6 +30,7 @@ export declare const byCategory: Record<"auth" | "generators" | "api", ({
29
30
  summary: string;
30
31
  requires: {
31
32
  auth: false;
33
+ api: false;
32
34
  payments: false;
33
35
  };
34
36
  category: "generators";
@@ -50,6 +52,7 @@ export declare const byCategory: Record<"auth" | "generators" | "api", ({
50
52
  summary: string;
51
53
  requires: {
52
54
  auth: false;
55
+ api: false;
53
56
  payments: false;
54
57
  };
55
58
  category: "generators";
@@ -71,6 +74,7 @@ export declare const byCategory: Record<"auth" | "generators" | "api", ({
71
74
  summary: string;
72
75
  requires: {
73
76
  auth: false;
77
+ api: false;
74
78
  payments: false;
75
79
  };
76
80
  category: "generators";
@@ -92,6 +96,7 @@ export declare const byCategory: Record<"auth" | "generators" | "api", ({
92
96
  summary: string;
93
97
  requires: {
94
98
  auth: false;
99
+ api: false;
95
100
  payments: false;
96
101
  };
97
102
  category: "auth";
@@ -113,6 +118,7 @@ export declare const byCategory: Record<"auth" | "generators" | "api", ({
113
118
  summary: string;
114
119
  requires: {
115
120
  auth: false;
121
+ api: false;
116
122
  payments: false;
117
123
  };
118
124
  category: "api";
@@ -124,6 +130,50 @@ export declare const byCategory: Record<"auth" | "generators" | "api", ({
124
130
  };
125
131
  baseline: "velastack";
126
132
  generate: generate_6;
133
+ } | {
134
+ version: string;
135
+ slug: "enable-api-keys";
136
+ source: string;
137
+ docs: string;
138
+ plan: "open";
139
+ title: string;
140
+ summary: string;
141
+ requires: {
142
+ auth: true;
143
+ api: true;
144
+ payments: false;
145
+ };
146
+ category: "api";
147
+ tags: string[];
148
+ command: {
149
+ raw: string;
150
+ base: string;
151
+ argv: never[];
152
+ };
153
+ baseline: "velastack";
154
+ generate: generate_7;
155
+ } | {
156
+ version: string;
157
+ slug: "enable-i18n";
158
+ source: string;
159
+ docs: string;
160
+ plan: "open";
161
+ title: string;
162
+ summary: string;
163
+ requires: {
164
+ auth: false;
165
+ api: false;
166
+ payments: false;
167
+ };
168
+ category: "i18n";
169
+ tags: string[];
170
+ command: {
171
+ raw: string;
172
+ base: string;
173
+ argv: never[];
174
+ };
175
+ baseline: "velastack";
176
+ generate: generate_8;
127
177
  })[]>;
128
178
 
129
179
  export declare const bySlug: Record<Slug, PatternEntry>;
@@ -156,6 +206,7 @@ declare type Component = string;
156
206
 
157
207
  declare interface Features {
158
208
  auth: boolean;
209
+ api: boolean;
159
210
  payments: boolean;
160
211
  }
161
212
 
@@ -177,6 +228,10 @@ declare function generate_5(options: Options): Promise<Result>;
177
228
 
178
229
  declare function generate_6(options: Options): Promise<Result>;
179
230
 
231
+ declare function generate_7(options: Options): Promise<Result>;
232
+
233
+ declare function generate_8(options: Options): Promise<Result>;
234
+
180
235
  declare interface Options {
181
236
  argv: string[];
182
237
  env: "runtime" | "preview";
@@ -199,6 +254,7 @@ export declare const patterns: ({
199
254
  summary: string;
200
255
  requires: {
201
256
  auth: false;
257
+ api: false;
202
258
  payments: false;
203
259
  };
204
260
  category: "generators";
@@ -220,6 +276,7 @@ export declare const patterns: ({
220
276
  summary: string;
221
277
  requires: {
222
278
  auth: false;
279
+ api: false;
223
280
  payments: false;
224
281
  };
225
282
  category: "generators";
@@ -241,6 +298,7 @@ export declare const patterns: ({
241
298
  summary: string;
242
299
  requires: {
243
300
  auth: false;
301
+ api: false;
244
302
  payments: false;
245
303
  };
246
304
  category: "generators";
@@ -262,6 +320,7 @@ export declare const patterns: ({
262
320
  summary: string;
263
321
  requires: {
264
322
  auth: false;
323
+ api: false;
265
324
  payments: false;
266
325
  };
267
326
  category: "generators";
@@ -283,6 +342,7 @@ export declare const patterns: ({
283
342
  summary: string;
284
343
  requires: {
285
344
  auth: false;
345
+ api: false;
286
346
  payments: false;
287
347
  };
288
348
  category: "auth";
@@ -304,6 +364,7 @@ export declare const patterns: ({
304
364
  summary: string;
305
365
  requires: {
306
366
  auth: false;
367
+ api: false;
307
368
  payments: false;
308
369
  };
309
370
  category: "api";
@@ -315,6 +376,50 @@ export declare const patterns: ({
315
376
  };
316
377
  baseline: "velastack";
317
378
  generate: generate_6;
379
+ } | {
380
+ version: string;
381
+ slug: "enable-api-keys";
382
+ source: string;
383
+ docs: string;
384
+ plan: "open";
385
+ title: string;
386
+ summary: string;
387
+ requires: {
388
+ auth: true;
389
+ api: true;
390
+ payments: false;
391
+ };
392
+ category: "api";
393
+ tags: string[];
394
+ command: {
395
+ raw: string;
396
+ base: string;
397
+ argv: never[];
398
+ };
399
+ baseline: "velastack";
400
+ generate: generate_7;
401
+ } | {
402
+ version: string;
403
+ slug: "enable-i18n";
404
+ source: string;
405
+ docs: string;
406
+ plan: "open";
407
+ title: string;
408
+ summary: string;
409
+ requires: {
410
+ auth: false;
411
+ api: false;
412
+ payments: false;
413
+ };
414
+ category: "i18n";
415
+ tags: string[];
416
+ command: {
417
+ raw: string;
418
+ base: string;
419
+ argv: never[];
420
+ };
421
+ baseline: "velastack";
422
+ generate: generate_8;
318
423
  })[];
319
424
 
320
425
  declare interface Result {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b as r, a as e, p as o, v as t } from "./chunks/index-Dav9F9Qf.js";
1
+ import { b as r, a as e, p as o, v as t } from "./chunks/index-ZTxLoBuU.js";
2
2
  export {
3
3
  r as byCategory,
4
4
  e as bySlug,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velastack/patterns",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",