pocketbase-zod-schema 0.1.2

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 (94) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +21 -0
  3. package/README.md +167 -0
  4. package/dist/cli/index.cjs +3383 -0
  5. package/dist/cli/index.cjs.map +1 -0
  6. package/dist/cli/index.d.cts +30 -0
  7. package/dist/cli/index.d.ts +30 -0
  8. package/dist/cli/index.js +3331 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/cli/migrate.cjs +3380 -0
  11. package/dist/cli/migrate.cjs.map +1 -0
  12. package/dist/cli/migrate.d.cts +1 -0
  13. package/dist/cli/migrate.d.ts +1 -0
  14. package/dist/cli/migrate.js +3353 -0
  15. package/dist/cli/migrate.js.map +1 -0
  16. package/dist/cli/utils/index.cjs +540 -0
  17. package/dist/cli/utils/index.cjs.map +1 -0
  18. package/dist/cli/utils/index.d.cts +232 -0
  19. package/dist/cli/utils/index.d.ts +232 -0
  20. package/dist/cli/utils/index.js +487 -0
  21. package/dist/cli/utils/index.js.map +1 -0
  22. package/dist/enums.cjs +19 -0
  23. package/dist/enums.cjs.map +1 -0
  24. package/dist/enums.d.cts +6 -0
  25. package/dist/enums.d.ts +6 -0
  26. package/dist/enums.js +17 -0
  27. package/dist/enums.js.map +1 -0
  28. package/dist/index.cjs +4900 -0
  29. package/dist/index.cjs.map +1 -0
  30. package/dist/index.d.cts +18 -0
  31. package/dist/index.d.ts +18 -0
  32. package/dist/index.js +4726 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/migration/analyzer.cjs +1267 -0
  35. package/dist/migration/analyzer.cjs.map +1 -0
  36. package/dist/migration/analyzer.d.cts +186 -0
  37. package/dist/migration/analyzer.d.ts +186 -0
  38. package/dist/migration/analyzer.js +1232 -0
  39. package/dist/migration/analyzer.js.map +1 -0
  40. package/dist/migration/diff.cjs +557 -0
  41. package/dist/migration/diff.cjs.map +1 -0
  42. package/dist/migration/diff.d.cts +291 -0
  43. package/dist/migration/diff.d.ts +291 -0
  44. package/dist/migration/diff.js +534 -0
  45. package/dist/migration/diff.js.map +1 -0
  46. package/dist/migration/generator.cjs +778 -0
  47. package/dist/migration/generator.cjs.map +1 -0
  48. package/dist/migration/generator.d.cts +225 -0
  49. package/dist/migration/generator.d.ts +225 -0
  50. package/dist/migration/generator.js +737 -0
  51. package/dist/migration/generator.js.map +1 -0
  52. package/dist/migration/index.cjs +3390 -0
  53. package/dist/migration/index.cjs.map +1 -0
  54. package/dist/migration/index.d.cts +103 -0
  55. package/dist/migration/index.d.ts +103 -0
  56. package/dist/migration/index.js +3265 -0
  57. package/dist/migration/index.js.map +1 -0
  58. package/dist/migration/snapshot.cjs +609 -0
  59. package/dist/migration/snapshot.cjs.map +1 -0
  60. package/dist/migration/snapshot.d.cts +167 -0
  61. package/dist/migration/snapshot.d.ts +167 -0
  62. package/dist/migration/snapshot.js +575 -0
  63. package/dist/migration/snapshot.js.map +1 -0
  64. package/dist/migration/utils/index.cjs +672 -0
  65. package/dist/migration/utils/index.cjs.map +1 -0
  66. package/dist/migration/utils/index.d.cts +207 -0
  67. package/dist/migration/utils/index.d.ts +207 -0
  68. package/dist/migration/utils/index.js +641 -0
  69. package/dist/migration/utils/index.js.map +1 -0
  70. package/dist/mutator.cjs +427 -0
  71. package/dist/mutator.cjs.map +1 -0
  72. package/dist/mutator.d.cts +190 -0
  73. package/dist/mutator.d.ts +190 -0
  74. package/dist/mutator.js +425 -0
  75. package/dist/mutator.js.map +1 -0
  76. package/dist/permissions-ZHafVSIx.d.cts +71 -0
  77. package/dist/permissions-ZHafVSIx.d.ts +71 -0
  78. package/dist/schema.cjs +430 -0
  79. package/dist/schema.cjs.map +1 -0
  80. package/dist/schema.d.cts +316 -0
  81. package/dist/schema.d.ts +316 -0
  82. package/dist/schema.js +396 -0
  83. package/dist/schema.js.map +1 -0
  84. package/dist/types-BbTgmg6H.d.cts +91 -0
  85. package/dist/types-z1Dkjg8m.d.ts +91 -0
  86. package/dist/types.cjs +4 -0
  87. package/dist/types.cjs.map +1 -0
  88. package/dist/types.d.cts +14 -0
  89. package/dist/types.d.ts +14 -0
  90. package/dist/types.js +3 -0
  91. package/dist/types.js.map +1 -0
  92. package/dist/user-jS1aYoeD.d.cts +123 -0
  93. package/dist/user-jS1aYoeD.d.ts +123 -0
  94. package/package.json +165 -0
@@ -0,0 +1,487 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import chalk from 'chalk';
4
+ import ora from 'ora';
5
+
6
+ // src/cli/utils/config.ts
7
+
8
+ // src/migration/errors.ts
9
+ var MigrationError = class _MigrationError extends Error {
10
+ constructor(message) {
11
+ super(message);
12
+ this.name = "MigrationError";
13
+ Object.setPrototypeOf(this, _MigrationError.prototype);
14
+ }
15
+ };
16
+ var ConfigurationError = class _ConfigurationError extends MigrationError {
17
+ configPath;
18
+ invalidFields;
19
+ originalError;
20
+ constructor(message, configPath, invalidFields, originalError) {
21
+ super(message);
22
+ this.name = "ConfigurationError";
23
+ this.configPath = configPath;
24
+ this.invalidFields = invalidFields;
25
+ this.originalError = originalError;
26
+ Object.setPrototypeOf(this, _ConfigurationError.prototype);
27
+ }
28
+ /**
29
+ * Creates a formatted error message with configuration details
30
+ */
31
+ getDetailedMessage() {
32
+ const parts = [this.message];
33
+ if (this.configPath) {
34
+ parts.push(`
35
+ Configuration File: ${this.configPath}`);
36
+ }
37
+ if (this.invalidFields && this.invalidFields.length > 0) {
38
+ parts.push(`
39
+ Invalid Fields: ${this.invalidFields.join(", ")}`);
40
+ }
41
+ if (this.originalError) {
42
+ parts.push(`
43
+ Cause: ${this.originalError.message}`);
44
+ }
45
+ return parts.join("");
46
+ }
47
+ };
48
+
49
+ // src/cli/utils/config.ts
50
+ var CONFIG_FILE_NAMES = [
51
+ "pocketbase-migrate.config.js",
52
+ "pocketbase-migrate.config.mjs",
53
+ "pocketbase-migrate.config.json",
54
+ "migrate.config.js",
55
+ "migrate.config.mjs",
56
+ "migrate.config.json"
57
+ ];
58
+ var DEFAULT_CONFIG = {
59
+ schema: {
60
+ directory: "src/schema",
61
+ exclude: ["base.ts", "index.ts", "permissions.ts", "permission-templates.ts"]
62
+ },
63
+ migrations: {
64
+ directory: "pocketbase/pb_migrations",
65
+ format: "timestamp_description"
66
+ },
67
+ diff: {
68
+ warnOnDelete: true,
69
+ requireForceForDestructive: true
70
+ }
71
+ };
72
+ function findConfigFile(directory) {
73
+ for (const fileName of CONFIG_FILE_NAMES) {
74
+ const filePath = path.join(directory, fileName);
75
+ if (fs.existsSync(filePath)) {
76
+ return filePath;
77
+ }
78
+ }
79
+ return null;
80
+ }
81
+ function loadJsonConfig(configPath) {
82
+ try {
83
+ const content = fs.readFileSync(configPath, "utf-8");
84
+ return JSON.parse(content);
85
+ } catch (error) {
86
+ if (error instanceof SyntaxError) {
87
+ throw new ConfigurationError("Invalid JSON syntax in configuration file", configPath, void 0, error);
88
+ }
89
+ throw new ConfigurationError(
90
+ "Failed to read configuration file",
91
+ configPath,
92
+ void 0,
93
+ error instanceof Error ? error : void 0
94
+ );
95
+ }
96
+ }
97
+ async function loadJsConfig(configPath) {
98
+ try {
99
+ const fileUrl = `file://${configPath}`;
100
+ const module = await import(fileUrl);
101
+ return module.default || module;
102
+ } catch (error) {
103
+ throw new ConfigurationError(
104
+ "Failed to load JavaScript configuration file",
105
+ configPath,
106
+ void 0,
107
+ error instanceof Error ? error : void 0
108
+ );
109
+ }
110
+ }
111
+ async function loadConfigFile(configPath) {
112
+ if (!fs.existsSync(configPath)) {
113
+ return null;
114
+ }
115
+ const ext = path.extname(configPath).toLowerCase();
116
+ if (ext === ".json") {
117
+ return loadJsonConfig(configPath);
118
+ } else if (ext === ".js" || ext === ".mjs") {
119
+ return loadJsConfig(configPath);
120
+ } else {
121
+ throw new ConfigurationError(`Unsupported configuration file format: ${ext}`, configPath, void 0);
122
+ }
123
+ }
124
+ function mergeConfig(base, override) {
125
+ return {
126
+ schema: { ...base.schema, ...override.schema },
127
+ migrations: { ...base.migrations, ...override.migrations },
128
+ diff: { ...base.diff, ...override.diff }
129
+ };
130
+ }
131
+ function loadConfigFromEnv() {
132
+ const config = {};
133
+ if (process.env.MIGRATION_SCHEMA_DIR) {
134
+ config.schema = { directory: process.env.MIGRATION_SCHEMA_DIR };
135
+ }
136
+ if (process.env.MIGRATION_SCHEMA_EXCLUDE) {
137
+ config.schema = {
138
+ ...config.schema,
139
+ exclude: process.env.MIGRATION_SCHEMA_EXCLUDE.split(",").map((s) => s.trim())
140
+ };
141
+ }
142
+ if (process.env.MIGRATION_OUTPUT_DIR) {
143
+ config.migrations = { directory: process.env.MIGRATION_OUTPUT_DIR };
144
+ }
145
+ if (process.env.MIGRATION_REQUIRE_FORCE !== void 0) {
146
+ config.diff = { requireForceForDestructive: process.env.MIGRATION_REQUIRE_FORCE === "true" };
147
+ }
148
+ return config;
149
+ }
150
+ function loadConfigFromArgs(options) {
151
+ const config = {};
152
+ if (options.output) {
153
+ config.migrations = { directory: options.output };
154
+ }
155
+ if (options.schemaDir) {
156
+ config.schema = { directory: options.schemaDir };
157
+ }
158
+ return config;
159
+ }
160
+ function validateConfig(config, configPath) {
161
+ const invalidFields = [];
162
+ if (typeof config.schema.directory !== "string" || config.schema.directory.trim() === "") {
163
+ invalidFields.push("schema.directory (must be a non-empty string)");
164
+ }
165
+ if (!Array.isArray(config.schema.exclude)) {
166
+ invalidFields.push("schema.exclude (must be an array of strings)");
167
+ }
168
+ if (typeof config.migrations.directory !== "string" || config.migrations.directory.trim() === "") {
169
+ invalidFields.push("migrations.directory (must be a non-empty string)");
170
+ }
171
+ if (typeof config.diff.warnOnDelete !== "boolean") {
172
+ invalidFields.push("diff.warnOnDelete (must be a boolean)");
173
+ }
174
+ if (typeof config.diff.requireForceForDestructive !== "boolean") {
175
+ invalidFields.push("diff.requireForceForDestructive (must be a boolean)");
176
+ }
177
+ if (invalidFields.length > 0) {
178
+ throw new ConfigurationError("Invalid configuration values", configPath, invalidFields);
179
+ }
180
+ const cwd = process.cwd();
181
+ const possiblePaths = [
182
+ path.resolve(cwd, config.schema.directory),
183
+ path.resolve(cwd, "shared", config.schema.directory)
184
+ ];
185
+ const schemaDir = possiblePaths.find((p) => fs.existsSync(p));
186
+ if (!schemaDir) {
187
+ throw new ConfigurationError(`Schema directory not found. Tried: ${possiblePaths.join(", ")}`, configPath, [
188
+ "schema.directory"
189
+ ]);
190
+ }
191
+ }
192
+ async function loadConfig(options = {}) {
193
+ let config = { ...DEFAULT_CONFIG };
194
+ let configFilePath;
195
+ const cwd = process.cwd();
196
+ if (options.config) {
197
+ const explicitPath = path.resolve(cwd, options.config);
198
+ if (!fs.existsSync(explicitPath)) {
199
+ throw new ConfigurationError(`Configuration file not found: ${explicitPath}`, explicitPath);
200
+ }
201
+ configFilePath = explicitPath;
202
+ } else {
203
+ const searchDirs = [cwd, path.join(cwd, "shared")];
204
+ for (const dir of searchDirs) {
205
+ if (fs.existsSync(dir)) {
206
+ const found = findConfigFile(dir);
207
+ if (found) {
208
+ configFilePath = found;
209
+ break;
210
+ }
211
+ }
212
+ }
213
+ }
214
+ if (configFilePath) {
215
+ const fileConfig = await loadConfigFile(configFilePath);
216
+ if (fileConfig) {
217
+ config = mergeConfig(config, fileConfig);
218
+ }
219
+ }
220
+ const envConfig = loadConfigFromEnv();
221
+ if (Object.keys(envConfig).length > 0) {
222
+ config = mergeConfig(config, envConfig);
223
+ }
224
+ const argsConfig = loadConfigFromArgs(options);
225
+ if (Object.keys(argsConfig).length > 0) {
226
+ config = mergeConfig(config, argsConfig);
227
+ }
228
+ validateConfig(config, configFilePath);
229
+ return config;
230
+ }
231
+ function getSchemaDirectory(config) {
232
+ const cwd = process.cwd();
233
+ const possiblePaths = [
234
+ path.resolve(cwd, config.schema.directory),
235
+ path.resolve(cwd, "shared", config.schema.directory)
236
+ ];
237
+ return possiblePaths.find((p) => fs.existsSync(p)) || possiblePaths[0];
238
+ }
239
+ function getMigrationsDirectory(config) {
240
+ const cwd = process.cwd();
241
+ const possiblePaths = [
242
+ path.resolve(cwd, config.migrations.directory),
243
+ path.resolve(cwd, "shared", config.migrations.directory)
244
+ ];
245
+ return possiblePaths.find((p) => fs.existsSync(p)) || possiblePaths[0];
246
+ }
247
+ function getDefaultConfig() {
248
+ return { ...DEFAULT_CONFIG };
249
+ }
250
+ function getSampleConfig(format) {
251
+ if (format === "json") {
252
+ return JSON.stringify(DEFAULT_CONFIG, null, 2);
253
+ }
254
+ return `/**
255
+ * PocketBase Zod Migration Configuration
256
+ * @type {import('pocketbase-zod-schema/cli').MigrationConfig}
257
+ */
258
+ export default {
259
+ schema: {
260
+ directory: "src/schema",
261
+ exclude: ["base.ts", "index.ts", "permissions.ts", "permission-templates.ts"],
262
+ },
263
+ migrations: {
264
+ directory: "pocketbase/pb_migrations",
265
+ format: "timestamp_description",
266
+ },
267
+ diff: {
268
+ warnOnDelete: true,
269
+ requireForceForDestructive: true,
270
+ },
271
+ };
272
+ `;
273
+ }
274
+ var currentVerbosity = "normal";
275
+ function setVerbosity(level) {
276
+ currentVerbosity = level;
277
+ }
278
+ function getVerbosity() {
279
+ return currentVerbosity;
280
+ }
281
+ function shouldLog(requiredLevel) {
282
+ const levels = ["quiet", "normal", "verbose"];
283
+ const currentIndex = levels.indexOf(currentVerbosity);
284
+ const requiredIndex = levels.indexOf(requiredLevel);
285
+ return currentIndex >= requiredIndex;
286
+ }
287
+ function createSpinner(text) {
288
+ if (currentVerbosity === "quiet") {
289
+ return ora({ text, isSilent: true });
290
+ }
291
+ return ora(text);
292
+ }
293
+ function logSuccess(message) {
294
+ if (shouldLog("normal")) {
295
+ console.log(chalk.green("\u2713"), message);
296
+ }
297
+ }
298
+ function logError(message) {
299
+ console.error(chalk.red("\u2717"), message);
300
+ }
301
+ function logWarning(message) {
302
+ if (shouldLog("normal")) {
303
+ console.warn(chalk.yellow("\u26A0"), message);
304
+ }
305
+ }
306
+ function logInfo(message) {
307
+ if (shouldLog("normal")) {
308
+ console.log(chalk.blue("\u2139"), message);
309
+ }
310
+ }
311
+ function logDebug(message) {
312
+ if (shouldLog("verbose")) {
313
+ console.log(chalk.gray("\u2699"), chalk.gray(message));
314
+ }
315
+ }
316
+ function logSection(title) {
317
+ if (shouldLog("normal")) {
318
+ console.log();
319
+ console.log(chalk.bold.cyan(title));
320
+ console.log(chalk.cyan("\u2500".repeat(title.length)));
321
+ }
322
+ }
323
+ function formatFieldChange(change) {
324
+ const oldValue = change.oldValue === null ? "null" : JSON.stringify(change.oldValue);
325
+ const newValue = change.newValue === null ? "null" : JSON.stringify(change.newValue);
326
+ return `${change.property}: ${chalk.red(oldValue)} \u2192 ${chalk.green(newValue)}`;
327
+ }
328
+ function formatChangeSummary(diff) {
329
+ const lines = [];
330
+ const totalCollectionsToCreate = diff.collectionsToCreate.length;
331
+ const totalCollectionsToDelete = diff.collectionsToDelete.length;
332
+ const totalCollectionsToModify = diff.collectionsToModify.length;
333
+ const totalChanges = totalCollectionsToCreate + totalCollectionsToDelete + totalCollectionsToModify;
334
+ if (totalChanges === 0) {
335
+ return chalk.gray("No changes detected");
336
+ }
337
+ lines.push(chalk.bold(`Found ${totalChanges} collection change(s):`));
338
+ lines.push("");
339
+ if (totalCollectionsToCreate > 0) {
340
+ lines.push(chalk.green.bold(`\u2713 ${totalCollectionsToCreate} collection(s) to create:`));
341
+ for (const collection of diff.collectionsToCreate) {
342
+ lines.push(chalk.green(` + ${collection.name} (${collection.type})`));
343
+ lines.push(chalk.gray(` ${collection.fields.length} field(s)`));
344
+ }
345
+ lines.push("");
346
+ }
347
+ if (totalCollectionsToDelete > 0) {
348
+ lines.push(chalk.red.bold(`\u2717 ${totalCollectionsToDelete} collection(s) to delete:`));
349
+ for (const collection of diff.collectionsToDelete) {
350
+ lines.push(chalk.red(` - ${collection.name}`));
351
+ }
352
+ lines.push("");
353
+ }
354
+ if (totalCollectionsToModify > 0) {
355
+ lines.push(chalk.yellow.bold(`\u26A1 ${totalCollectionsToModify} collection(s) to modify:`));
356
+ for (const modification of diff.collectionsToModify) {
357
+ lines.push(chalk.yellow(` ~ ${modification.collection}`));
358
+ if (modification.fieldsToAdd.length > 0) {
359
+ lines.push(chalk.green(` + ${modification.fieldsToAdd.length} field(s) to add:`));
360
+ for (const field of modification.fieldsToAdd) {
361
+ lines.push(chalk.green(` + ${field.name} (${field.type})`));
362
+ }
363
+ }
364
+ if (modification.fieldsToRemove.length > 0) {
365
+ lines.push(chalk.red(` - ${modification.fieldsToRemove.length} field(s) to remove:`));
366
+ for (const field of modification.fieldsToRemove) {
367
+ lines.push(chalk.red(` - ${field.name}`));
368
+ }
369
+ }
370
+ if (modification.fieldsToModify.length > 0) {
371
+ lines.push(chalk.yellow(` ~ ${modification.fieldsToModify.length} field(s) to modify:`));
372
+ for (const fieldMod of modification.fieldsToModify) {
373
+ lines.push(chalk.yellow(` ~ ${fieldMod.fieldName}`));
374
+ for (const change of fieldMod.changes) {
375
+ lines.push(chalk.gray(` ${formatFieldChange(change)}`));
376
+ }
377
+ }
378
+ }
379
+ if (modification.indexesToAdd.length > 0) {
380
+ lines.push(chalk.green(` + ${modification.indexesToAdd.length} index(es) to add`));
381
+ }
382
+ if (modification.indexesToRemove.length > 0) {
383
+ lines.push(chalk.red(` - ${modification.indexesToRemove.length} index(es) to remove`));
384
+ }
385
+ if (modification.rulesToUpdate.length > 0) {
386
+ lines.push(chalk.yellow(` ~ ${modification.rulesToUpdate.length} rule(s) to update`));
387
+ }
388
+ lines.push("");
389
+ }
390
+ }
391
+ return lines.join("\n");
392
+ }
393
+ async function withProgress(message, operation) {
394
+ const spinner = createSpinner(message).start();
395
+ try {
396
+ const result = await operation();
397
+ spinner.succeed();
398
+ return result;
399
+ } catch (error) {
400
+ spinner.fail();
401
+ throw error;
402
+ }
403
+ }
404
+ function logStep(step, total, message) {
405
+ if (shouldLog("normal")) {
406
+ const progress = chalk.gray(`[${step}/${total}]`);
407
+ console.log(progress, message);
408
+ }
409
+ }
410
+ function logList(items, indent = 2) {
411
+ if (shouldLog("normal")) {
412
+ const padding = " ".repeat(indent);
413
+ for (const item of items) {
414
+ console.log(`${padding}\u2022 ${item}`);
415
+ }
416
+ }
417
+ }
418
+ function logKeyValue(key, value, indent = 2) {
419
+ if (shouldLog("normal")) {
420
+ const padding = " ".repeat(indent);
421
+ console.log(`${padding}${chalk.gray(key + ":")} ${value}`);
422
+ }
423
+ }
424
+ function logTable(headers, rows) {
425
+ if (!shouldLog("normal")) return;
426
+ const widths = headers.map((h, i) => {
427
+ const maxRowWidth = Math.max(...rows.map((r) => (r[i] || "").length));
428
+ return Math.max(h.length, maxRowWidth);
429
+ });
430
+ const headerLine = headers.map((h, i) => h.padEnd(widths[i])).join(" ");
431
+ console.log(chalk.bold(headerLine));
432
+ console.log(chalk.gray("\u2500".repeat(headerLine.length)));
433
+ for (const row of rows) {
434
+ const rowLine = row.map((cell, i) => (cell || "").padEnd(widths[i])).join(" ");
435
+ console.log(rowLine);
436
+ }
437
+ }
438
+ function logBox(title, content) {
439
+ if (!shouldLog("normal")) return;
440
+ const maxWidth = Math.max(title.length, ...content.map((c) => c.length));
441
+ const border = "\u2500".repeat(maxWidth + 2);
442
+ console.log();
443
+ console.log(chalk.cyan(`\u250C${border}\u2510`));
444
+ console.log(chalk.cyan("\u2502 ") + chalk.bold(title.padEnd(maxWidth)) + chalk.cyan(" \u2502"));
445
+ console.log(chalk.cyan(`\u251C${border}\u2524`));
446
+ for (const line of content) {
447
+ console.log(chalk.cyan("\u2502 ") + line.padEnd(maxWidth) + chalk.cyan(" \u2502"));
448
+ }
449
+ console.log(chalk.cyan(`\u2514${border}\u2518`));
450
+ }
451
+ function createProgressBar(current, total, width = 20) {
452
+ const percentage = Math.min(100, Math.round(current / total * 100));
453
+ const filled = Math.round(percentage / 100 * width);
454
+ const empty = width - filled;
455
+ const bar = chalk.green("\u2588".repeat(filled)) + chalk.gray("\u2591".repeat(empty));
456
+ return `${bar} ${percentage}%`;
457
+ }
458
+ function logTimestamp(message) {
459
+ if (shouldLog("verbose")) {
460
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
461
+ console.log(chalk.gray(`[${timestamp}]`), message);
462
+ }
463
+ }
464
+ function formatDuration(ms) {
465
+ if (ms < 1e3) {
466
+ return `${ms}ms`;
467
+ } else if (ms < 6e4) {
468
+ return `${(ms / 1e3).toFixed(1)}s`;
469
+ } else {
470
+ const minutes = Math.floor(ms / 6e4);
471
+ const seconds = Math.round(ms % 6e4 / 1e3);
472
+ return `${minutes}m ${seconds}s`;
473
+ }
474
+ }
475
+ function logTimed(message, startTime) {
476
+ if (shouldLog("normal")) {
477
+ const duration = Date.now() - startTime;
478
+ console.log(chalk.green("\u2713"), message, chalk.gray(`(${formatDuration(duration)})`));
479
+ }
480
+ }
481
+ function formatStatusJson(output) {
482
+ return JSON.stringify(output, null, 2);
483
+ }
484
+
485
+ export { createProgressBar, createSpinner, formatChangeSummary, formatDuration, formatStatusJson, getDefaultConfig, getMigrationsDirectory, getSampleConfig, getSchemaDirectory, getVerbosity, loadConfig, loadConfigFromArgs, logBox, logDebug, logError, logInfo, logKeyValue, logList, logSection, logStep, logSuccess, logTable, logTimed, logTimestamp, logWarning, setVerbosity, withProgress };
486
+ //# sourceMappingURL=index.js.map
487
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/migration/errors.ts","../../../src/cli/utils/config.ts","../../../src/cli/utils/logger.ts"],"names":[],"mappings":";;;;;;;;AAQO,IAAM,cAAA,GAAN,MAAM,eAAA,SAAuB,KAAA,CAAM;AAAA,EACxC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AACZ,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,eAAA,CAAe,SAAS,CAAA;AAAA,EACtD;AACF,CAAA;AA2KO,IAAM,kBAAA,GAAN,MAAM,mBAAA,SAA2B,cAAA,CAAe;AAAA,EACrC,U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AA,CAAA;AAAA,EACd,CAAA,MAAA,IAAW,KAAK,GAAA,EAAO;AACrB,IAAA,OAAO,CAAA,EAAA,CAAI,EAAA,GAAK,GAAA,EAAM,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA,CAAA;AAAA,EAClC,CAAA,MAAO;AACL,IAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,EAAA,GAAK,GAAK,CAAA;AACrC,IAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAO,EAAA,GAAK,MAAS,GAAI,CAAA;AAC9C,IAAA,OAAO,CAAA,EAAG,OAAO,CAAA,EAAA,EAAK,OAAO,CAAA,CAAA,CAAA;AAAA,EAC/B;AACF;AAQO,SAAS,QAAA,CAAS,SAAiB,SAAA,EAAyB;AACjE,EAAA,IAAI,SAAA,CAAU,QAAQ,CAAA,EAAG;AACvB,IAAA,MAAM,QAAA,GAAW,IAAA,CAAK,GAAA,EAAI,GAAI,SAAA;AAC9B,IAAA,OAAA,CAAQ,GAAA,CAAI,KAAA,CAAM,KAAA,CAAM,QAAG,CAAA,EAAG,OAAA,EAAS,KAAA,CAAM,IAAA,CAAK,CAAA,CAAA,EAAI,cAAA,CAAe,QAAQ,CAAC,GAAG,CAAC,CAAA;AAAA,EACpF;AACF;AAyBO,SAAS,iBAAiB,MAAA,EAA8B;AAC7D,EAAA,OAAO,IAAA,CAAK,SAAA,CAAU,MAAA,EAAQ,IAAA,EAAM,CAAC,CAAA;AACvC","file":"index.js","sourcesContent":["/**\n * Custom error classes for migration tool\n * Provides specific error types for better error handling and user feedback\n */\n\n/**\n * Base error class for all migration-related errors\n */\nexport class MigrationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"MigrationError\";\n Object.setPrototypeOf(this, MigrationError.prototype);\n }\n}\n\n/**\n * Error thrown when schema parsing fails\n * Used when Zod schemas cannot be parsed or are invalid\n */\nexport class SchemaParsingError extends MigrationError {\n public readonly filePath?: string;\n public readonly originalError?: Error;\n\n constructor(message: string, filePath?: string, originalError?: Error) {\n super(message);\n this.name = \"SchemaParsingError\";\n this.filePath = filePath;\n this.originalError = originalError;\n Object.setPrototypeOf(this, SchemaParsingError.prototype);\n }\n\n /**\n * Creates a formatted error message with file path and original error details\n */\n public getDetailedMessage(): string {\n const parts: string[] = [this.message];\n\n if (this.filePath) {\n parts.push(`\\nFile: ${this.filePath}`);\n }\n\n if (this.originalError) {\n parts.push(`\\nCause: ${this.originalError.message}`);\n }\n\n return parts.join(\"\");\n }\n}\n\n/**\n * Error thrown when snapshot operations fail\n * Used for snapshot file read/write/parse errors\n */\nexport class SnapshotError extends MigrationError {\n public readonly snapshotPath?: string;\n public readonly operation?: \"read\" | \"write\" | \"parse\" | \"validate\";\n public readonly originalError?: Error;\n\n constructor(\n message: string,\n snapshotPath?: string,\n operation?: \"read\" | \"write\" | \"parse\" | \"validate\",\n originalError?: Error\n ) {\n super(message);\n this.name = \"SnapshotError\";\n this.snapshotPath = snapshotPath;\n this.operation = operation;\n this.originalError = originalError;\n Object.setPrototypeOf(this, SnapshotError.prototype);\n }\n\n /**\n * Creates a formatted error message with snapshot path and operation details\n */\n public getDetailedMessage(): string {\n const parts: string[] = [this.message];\n\n if (this.operation) {\n parts.push(`\\nOperation: ${this.operation}`);\n }\n\n if (this.snapshotPath) {\n parts.push(`\\nSnapshot: ${this.snapshotPath}`);\n }\n\n if (this.originalError) {\n parts.push(`\\nCause: ${this.originalError.message}`);\n }\n\n return parts.join(\"\");\n }\n}\n\n/**\n * Error thrown when migration file generation fails\n * Used when migration files cannot be created or written\n */\nexport class MigrationGenerationError extends MigrationError {\n public readonly migrationPath?: string;\n public readonly originalError?: Error;\n\n constructor(message: string, migrationPath?: string, originalError?: Error) {\n super(message);\n this.name = \"MigrationGenerationError\";\n this.migrationPath = migrationPath;\n this.originalError = originalError;\n Object.setPrototypeOf(this, MigrationGenerationError.prototype);\n }\n\n /**\n * Creates a formatted error message with migration path and original error details\n */\n public getDetailedMessage(): string {\n const parts: string[] = [this.message];\n\n if (this.migrationPath) {\n parts.push(`\\nMigration: ${this.migrationPath}`);\n }\n\n if (this.originalError) {\n parts.push(`\\nCause: ${this.originalError.message}`);\n }\n\n return parts.join(\"\");\n }\n}\n\n/**\n * Error thrown when file system operations fail\n * Used for directory creation, file permissions, disk space issues\n */\nexport class FileSystemError extends MigrationError {\n public readonly path?: string;\n public readonly operation?: \"read\" | \"write\" | \"create\" | \"delete\" | \"access\";\n public readonly code?: string;\n public readonly originalError?: Error;\n\n constructor(\n message: string,\n path?: string,\n operation?: \"read\" | \"write\" | \"create\" | \"delete\" | \"access\",\n code?: string,\n originalError?: Error\n ) {\n super(message);\n this.name = \"FileSystemError\";\n this.path = path;\n this.operation = operation;\n this.code = code;\n this.originalError = originalError;\n Object.setPrototypeOf(this, FileSystemError.prototype);\n }\n\n /**\n * Creates a formatted error message with path, operation, and error code details\n */\n public getDetailedMessage(): string {\n const parts: string[] = [this.message];\n\n if (this.operation) {\n parts.push(`\\nOperation: ${this.operation}`);\n }\n\n if (this.path) {\n parts.push(`\\nPath: ${this.path}`);\n }\n\n if (this.code) {\n parts.push(`\\nError Code: ${this.code}`);\n }\n\n if (this.originalError) {\n parts.push(`\\nCause: ${this.originalError.message}`);\n }\n\n return parts.join(\"\");\n }\n}\n\n/**\n * Error thrown when configuration is invalid\n * Used for configuration file parsing, validation, and path resolution errors\n */\nexport class ConfigurationError extends MigrationError {\n public readonly configPath?: string;\n public readonly invalidFields?: string[];\n public readonly originalError?: Error;\n\n constructor(message: string, configPath?: string, invalidFields?: string[], originalError?: Error) {\n super(message);\n this.name = \"ConfigurationError\";\n this.configPath = configPath;\n this.invalidFields = invalidFields;\n this.originalError = originalError;\n Object.setPrototypeOf(this, ConfigurationError.prototype);\n }\n\n /**\n * Creates a formatted error message with configuration details\n */\n public getDetailedMessage(): string {\n const parts: string[] = [this.message];\n\n if (this.configPath) {\n parts.push(`\\nConfiguration File: ${this.configPath}`);\n }\n\n if (this.invalidFields && this.invalidFields.length > 0) {\n parts.push(`\\nInvalid Fields: ${this.invalidFields.join(\", \")}`);\n }\n\n if (this.originalError) {\n parts.push(`\\nCause: ${this.originalError.message}`);\n }\n\n return parts.join(\"\");\n }\n}\n\n/**\n * Error thrown when CLI command usage is incorrect\n * Used for invalid arguments, missing required options, etc.\n */\nexport class CLIUsageError extends MigrationError {\n public readonly command?: string;\n public readonly suggestion?: string;\n\n constructor(message: string, command?: string, suggestion?: string) {\n super(message);\n this.name = \"CLIUsageError\";\n this.command = command;\n this.suggestion = suggestion;\n Object.setPrototypeOf(this, CLIUsageError.prototype);\n }\n\n /**\n * Creates a formatted error message with usage suggestions\n */\n public getDetailedMessage(): string {\n const parts: string[] = [this.message];\n\n if (this.command) {\n parts.push(`\\nCommand: ${this.command}`);\n }\n\n if (this.suggestion) {\n parts.push(`\\nSuggestion: ${this.suggestion}`);\n }\n\n return parts.join(\"\");\n }\n}\n","/**\n * Configuration loader for migration tool\n * Handles loading and merging configuration from various sources\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { ConfigurationError } from \"../../migration/errors.js\";\n\n/**\n * Migration tool configuration\n */\nexport interface MigrationConfig {\n schema: {\n directory: string;\n exclude: string[];\n };\n migrations: {\n directory: string;\n format: string;\n };\n diff: {\n warnOnDelete: boolean;\n requireForceForDestructive: boolean;\n };\n}\n\n/**\n * Partial configuration for merging\n */\nexport type PartialMigrationConfig = {\n schema?: Partial<MigrationConfig[\"schema\"]>;\n migrations?: Partial<MigrationConfig[\"migrations\"]>;\n diff?: Partial<MigrationConfig[\"diff\"]>;\n};\n\n/**\n * Configuration file names to search for\n */\nconst CONFIG_FILE_NAMES = [\n \"pocketbase-migrate.config.js\",\n \"pocketbase-migrate.config.mjs\",\n \"pocketbase-migrate.config.json\",\n \"migrate.config.js\",\n \"migrate.config.mjs\",\n \"migrate.config.json\",\n];\n\n/**\n * Default configuration values\n */\nconst DEFAULT_CONFIG: MigrationConfig = {\n schema: {\n directory: \"src/schema\",\n exclude: [\"base.ts\", \"index.ts\", \"permissions.ts\", \"permission-templates.ts\"],\n },\n migrations: {\n directory: \"pocketbase/pb_migrations\",\n format: \"timestamp_description\",\n },\n diff: {\n warnOnDelete: true,\n requireForceForDestructive: true,\n },\n};\n\n/**\n * Finds a configuration file in the given directory\n */\nfunction findConfigFile(directory: string): string | null {\n for (const fileName of CONFIG_FILE_NAMES) {\n const filePath = path.join(directory, fileName);\n if (fs.existsSync(filePath)) {\n return filePath;\n }\n }\n return null;\n}\n\n/**\n * Loads configuration from a JSON file\n */\nfunction loadJsonConfig(configPath: string): PartialMigrationConfig {\n try {\n const content = fs.readFileSync(configPath, \"utf-8\");\n return JSON.parse(content);\n } catch (error) {\n if (error instanceof SyntaxError) {\n throw new ConfigurationError(\"Invalid JSON syntax in configuration file\", configPath, undefined, error);\n }\n throw new ConfigurationError(\n \"Failed to read configuration file\",\n configPath,\n undefined,\n error instanceof Error ? error : undefined\n );\n }\n}\n\n/**\n * Loads configuration from a JavaScript file\n */\nasync function loadJsConfig(configPath: string): Promise<PartialMigrationConfig> {\n try {\n const fileUrl = `file://${configPath}`;\n const module = await import(fileUrl);\n return module.default || module;\n } catch (error) {\n throw new ConfigurationError(\n \"Failed to load JavaScript configuration file\",\n configPath,\n undefined,\n error instanceof Error ? error : undefined\n );\n }\n}\n\n/**\n * Loads configuration from file if it exists\n */\nasync function loadConfigFile(configPath: string): Promise<PartialMigrationConfig | null> {\n if (!fs.existsSync(configPath)) {\n return null;\n }\n\n const ext = path.extname(configPath).toLowerCase();\n\n if (ext === \".json\") {\n return loadJsonConfig(configPath);\n } else if (ext === \".js\" || ext === \".mjs\") {\n return loadJsConfig(configPath);\n } else {\n throw new ConfigurationError(`Unsupported configuration file format: ${ext}`, configPath, undefined);\n }\n}\n\n/**\n * Merges configuration objects with deep merge\n */\nfunction mergeConfig(base: MigrationConfig, override: PartialMigrationConfig): MigrationConfig {\n return {\n schema: { ...base.schema, ...override.schema },\n migrations: { ...base.migrations, ...override.migrations },\n diff: { ...base.diff, ...override.diff },\n };\n}\n\n/**\n * Loads configuration from environment variables\n */\nfunction loadConfigFromEnv(): PartialMigrationConfig {\n const config: PartialMigrationConfig = {};\n\n if (process.env.MIGRATION_SCHEMA_DIR) {\n config.schema = { directory: process.env.MIGRATION_SCHEMA_DIR };\n }\n\n if (process.env.MIGRATION_SCHEMA_EXCLUDE) {\n config.schema = {\n ...config.schema,\n exclude: process.env.MIGRATION_SCHEMA_EXCLUDE.split(\",\").map((s) => s.trim()),\n };\n }\n\n if (process.env.MIGRATION_OUTPUT_DIR) {\n config.migrations = { directory: process.env.MIGRATION_OUTPUT_DIR };\n }\n\n if (process.env.MIGRATION_REQUIRE_FORCE !== undefined) {\n config.diff = { requireForceForDestructive: process.env.MIGRATION_REQUIRE_FORCE === \"true\" };\n }\n\n return config;\n}\n\n/**\n * Loads configuration from CLI arguments\n */\nexport function loadConfigFromArgs(options: any): PartialMigrationConfig {\n const config: PartialMigrationConfig = {};\n\n if (options.output) {\n config.migrations = { directory: options.output };\n }\n\n if (options.schemaDir) {\n config.schema = { directory: options.schemaDir };\n }\n\n return config;\n}\n\n/**\n * Validates configuration values\n */\nfunction validateConfig(config: MigrationConfig, configPath?: string): void {\n const invalidFields: string[] = [];\n\n if (typeof config.schema.directory !== \"string\" || config.schema.directory.trim() === \"\") {\n invalidFields.push(\"schema.directory (must be a non-empty string)\");\n }\n\n if (!Array.isArray(config.schema.exclude)) {\n invalidFields.push(\"schema.exclude (must be an array of strings)\");\n }\n\n if (typeof config.migrations.directory !== \"string\" || config.migrations.directory.trim() === \"\") {\n invalidFields.push(\"migrations.directory (must be a non-empty string)\");\n }\n\n if (typeof config.diff.warnOnDelete !== \"boolean\") {\n invalidFields.push(\"diff.warnOnDelete (must be a boolean)\");\n }\n\n if (typeof config.diff.requireForceForDestructive !== \"boolean\") {\n invalidFields.push(\"diff.requireForceForDestructive (must be a boolean)\");\n }\n\n if (invalidFields.length > 0) {\n throw new ConfigurationError(\"Invalid configuration values\", configPath, invalidFields);\n }\n\n // Validate schema directory exists - try multiple locations\n const cwd = process.cwd();\n const possiblePaths = [\n path.resolve(cwd, config.schema.directory),\n path.resolve(cwd, \"shared\", config.schema.directory),\n ];\n\n const schemaDir = possiblePaths.find((p) => fs.existsSync(p));\n\n if (!schemaDir) {\n throw new ConfigurationError(`Schema directory not found. Tried: ${possiblePaths.join(\", \")}`, configPath, [\n \"schema.directory\",\n ]);\n }\n}\n\n/**\n * Loads and merges configuration from all sources\n * Priority: CLI args > Environment variables > Config file > Defaults\n */\nexport async function loadConfig(options: any = {}): Promise<MigrationConfig> {\n let config: MigrationConfig = { ...DEFAULT_CONFIG };\n let configFilePath: string | undefined;\n\n const cwd = process.cwd();\n\n // Check for explicit config path from CLI\n if (options.config) {\n const explicitPath = path.resolve(cwd, options.config);\n if (!fs.existsSync(explicitPath)) {\n throw new ConfigurationError(`Configuration file not found: ${explicitPath}`, explicitPath);\n }\n configFilePath = explicitPath;\n } else {\n // Search for config file in current directory and shared directory\n const searchDirs = [cwd, path.join(cwd, \"shared\")];\n\n for (const dir of searchDirs) {\n if (fs.existsSync(dir)) {\n const found = findConfigFile(dir);\n if (found) {\n configFilePath = found;\n break;\n }\n }\n }\n }\n\n // Load config file if found\n if (configFilePath) {\n const fileConfig = await loadConfigFile(configFilePath);\n if (fileConfig) {\n config = mergeConfig(config, fileConfig);\n }\n }\n\n // Merge environment variables\n const envConfig = loadConfigFromEnv();\n if (Object.keys(envConfig).length > 0) {\n config = mergeConfig(config, envConfig);\n }\n\n // Merge CLI arguments (highest priority)\n const argsConfig = loadConfigFromArgs(options);\n if (Object.keys(argsConfig).length > 0) {\n config = mergeConfig(config, argsConfig);\n }\n\n // Validate final configuration\n validateConfig(config, configFilePath);\n\n return config;\n}\n\n/**\n * Gets the absolute path to the schema directory\n */\nexport function getSchemaDirectory(config: MigrationConfig): string {\n const cwd = process.cwd();\n const possiblePaths = [\n path.resolve(cwd, config.schema.directory),\n path.resolve(cwd, \"shared\", config.schema.directory),\n ];\n\n return possiblePaths.find((p) => fs.existsSync(p)) || possiblePaths[0];\n}\n\n/**\n * Gets the absolute path to the migrations directory\n */\nexport function getMigrationsDirectory(config: MigrationConfig): string {\n const cwd = process.cwd();\n const possiblePaths = [\n path.resolve(cwd, config.migrations.directory),\n path.resolve(cwd, \"shared\", config.migrations.directory),\n ];\n\n return possiblePaths.find((p) => fs.existsSync(p)) || possiblePaths[0];\n}\n\n/**\n * Gets the default configuration\n */\nexport function getDefaultConfig(): MigrationConfig {\n return { ...DEFAULT_CONFIG };\n}\n\n/**\n * Creates a sample configuration file content\n */\nexport function getSampleConfig(format: \"json\" | \"js\"): string {\n if (format === \"json\") {\n return JSON.stringify(DEFAULT_CONFIG, null, 2);\n }\n\n return `/**\n * PocketBase Zod Migration Configuration\n * @type {import('pocketbase-zod-schema/cli').MigrationConfig}\n */\nexport default {\n schema: {\n directory: \"src/schema\",\n exclude: [\"base.ts\", \"index.ts\", \"permissions.ts\", \"permission-templates.ts\"],\n },\n migrations: {\n directory: \"pocketbase/pb_migrations\",\n format: \"timestamp_description\",\n },\n diff: {\n warnOnDelete: true,\n requireForceForDestructive: true,\n },\n};\n`;\n}\n","/**\n * Logging utilities for CLI output\n * Provides colored console output and formatting helpers\n */\n\nimport chalk from \"chalk\";\nimport ora, { type Ora } from \"ora\";\nimport type { FieldChange, SchemaDiff } from \"../../migration/types.js\";\n\n/**\n * Verbosity levels for logging\n */\nexport type VerbosityLevel = \"quiet\" | \"normal\" | \"verbose\";\n\n/**\n * Current verbosity level\n */\nlet currentVerbosity: VerbosityLevel = \"normal\";\n\n/**\n * Sets the verbosity level for logging\n *\n * @param level - Verbosity level to set\n */\nexport function setVerbosity(level: VerbosityLevel): void {\n currentVerbosity = level;\n}\n\n/**\n * Gets the current verbosity level\n *\n * @returns Current verbosity level\n */\nexport function getVerbosity(): VerbosityLevel {\n return currentVerbosity;\n}\n\n/**\n * Checks if output should be shown based on verbosity\n *\n * @param requiredLevel - Minimum verbosity level required\n * @returns True if output should be shown\n */\nfunction shouldLog(requiredLevel: VerbosityLevel): boolean {\n const levels: VerbosityLevel[] = [\"quiet\", \"normal\", \"verbose\"];\n const currentIndex = levels.indexOf(currentVerbosity);\n const requiredIndex = levels.indexOf(requiredLevel);\n return currentIndex >= requiredIndex;\n}\n\n/**\n * Creates a spinner for long-running operations\n *\n * @param text - Initial spinner text\n * @returns Ora spinner instance\n */\nexport function createSpinner(text: string): Ora {\n // In quiet mode, create a silent spinner\n if (currentVerbosity === \"quiet\") {\n return ora({ text, isSilent: true });\n }\n return ora(text);\n}\n\n/**\n * Logs a success message in green\n *\n * @param message - Message to log\n */\nexport function logSuccess(message: string): void {\n if (shouldLog(\"normal\")) {\n console.log(chalk.green(\"✓\"), message);\n }\n}\n\n/**\n * Logs an error message in red\n * Always shown regardless of verbosity level\n *\n * @param message - Message to log\n */\nexport function logError(message: string): void {\n console.error(chalk.red(\"✗\"), message);\n}\n\n/**\n * Logs a warning message in yellow\n *\n * @param message - Message to log\n */\nexport function logWarning(message: string): void {\n if (shouldLog(\"normal\")) {\n console.warn(chalk.yellow(\"⚠\"), message);\n }\n}\n\n/**\n * Logs an info message in blue\n *\n * @param message - Message to log\n */\nexport function logInfo(message: string): void {\n if (shouldLog(\"normal\")) {\n console.log(chalk.blue(\"ℹ\"), message);\n }\n}\n\n/**\n * Logs a debug message in gray\n * Only shown in verbose mode\n *\n * @param message - Message to log\n */\nexport function logDebug(message: string): void {\n if (shouldLog(\"verbose\")) {\n console.log(chalk.gray(\"⚙\"), chalk.gray(message));\n }\n}\n\n/**\n * Logs a section header\n *\n * @param title - Section title\n */\nexport function logSection(title: string): void {\n if (shouldLog(\"normal\")) {\n console.log();\n console.log(chalk.bold.cyan(title));\n console.log(chalk.cyan(\"─\".repeat(title.length)));\n }\n}\n\n/**\n * Formats a field change for display\n *\n * @param change - Field change object\n * @returns Formatted string\n */\nfunction formatFieldChange(change: FieldChange): string {\n const oldValue = change.oldValue === null ? \"null\" : JSON.stringify(change.oldValue);\n const newValue = change.newValue === null ? \"null\" : JSON.stringify(change.newValue);\n\n return `${change.property}: ${chalk.red(oldValue)} → ${chalk.green(newValue)}`;\n}\n\n/**\n * Formats a change summary for display\n * Creates a formatted, colored summary of detected changes\n *\n * @param diff - Schema diff containing all changes\n * @returns Formatted summary string\n */\nexport function formatChangeSummary(diff: SchemaDiff): string {\n const lines: string[] = [];\n\n // Count total changes\n const totalCollectionsToCreate = diff.collectionsToCreate.length;\n const totalCollectionsToDelete = diff.collectionsToDelete.length;\n const totalCollectionsToModify = diff.collectionsToModify.length;\n\n const totalChanges = totalCollectionsToCreate + totalCollectionsToDelete + totalCollectionsToModify;\n\n if (totalChanges === 0) {\n return chalk.gray(\"No changes detected\");\n }\n\n lines.push(chalk.bold(`Found ${totalChanges} collection change(s):`));\n lines.push(\"\");\n\n // New collections\n if (totalCollectionsToCreate > 0) {\n lines.push(chalk.green.bold(`✓ ${totalCollectionsToCreate} collection(s) to create:`));\n for (const collection of diff.collectionsToCreate) {\n lines.push(chalk.green(` + ${collection.name} (${collection.type})`));\n lines.push(chalk.gray(` ${collection.fields.length} field(s)`));\n }\n lines.push(\"\");\n }\n\n // Deleted collections\n if (totalCollectionsToDelete > 0) {\n lines.push(chalk.red.bold(`✗ ${totalCollectionsToDelete} collection(s) to delete:`));\n for (const collection of diff.collectionsToDelete) {\n lines.push(chalk.red(` - ${collection.name}`));\n }\n lines.push(\"\");\n }\n\n // Modified collections\n if (totalCollectionsToModify > 0) {\n lines.push(chalk.yellow.bold(`⚡ ${totalCollectionsToModify} collection(s) to modify:`));\n\n for (const modification of diff.collectionsToModify) {\n lines.push(chalk.yellow(` ~ ${modification.collection}`));\n\n // Fields to add\n if (modification.fieldsToAdd.length > 0) {\n lines.push(chalk.green(` + ${modification.fieldsToAdd.length} field(s) to add:`));\n for (const field of modification.fieldsToAdd) {\n lines.push(chalk.green(` + ${field.name} (${field.type})`));\n }\n }\n\n // Fields to remove\n if (modification.fieldsToRemove.length > 0) {\n lines.push(chalk.red(` - ${modification.fieldsToRemove.length} field(s) to remove:`));\n for (const field of modification.fieldsToRemove) {\n lines.push(chalk.red(` - ${field.name}`));\n }\n }\n\n // Fields to modify\n if (modification.fieldsToModify.length > 0) {\n lines.push(chalk.yellow(` ~ ${modification.fieldsToModify.length} field(s) to modify:`));\n for (const fieldMod of modification.fieldsToModify) {\n lines.push(chalk.yellow(` ~ ${fieldMod.fieldName}`));\n for (const change of fieldMod.changes) {\n lines.push(chalk.gray(` ${formatFieldChange(change)}`));\n }\n }\n }\n\n // Indexes\n if (modification.indexesToAdd.length > 0) {\n lines.push(chalk.green(` + ${modification.indexesToAdd.length} index(es) to add`));\n }\n\n if (modification.indexesToRemove.length > 0) {\n lines.push(chalk.red(` - ${modification.indexesToRemove.length} index(es) to remove`));\n }\n\n // Rules\n if (modification.rulesToUpdate.length > 0) {\n lines.push(chalk.yellow(` ~ ${modification.rulesToUpdate.length} rule(s) to update`));\n }\n\n lines.push(\"\");\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Displays a progress indicator for a long operation\n *\n * @param message - Progress message\n * @param operation - Async operation to perform\n * @returns Result of the operation\n */\nexport async function withProgress<T>(message: string, operation: () => Promise<T>): Promise<T> {\n const spinner = createSpinner(message).start();\n\n try {\n const result = await operation();\n spinner.succeed();\n return result;\n } catch (error) {\n spinner.fail();\n throw error;\n }\n}\n\n/**\n * Logs a step in a multi-step process\n *\n * @param step - Current step number\n * @param total - Total number of steps\n * @param message - Step description\n */\nexport function logStep(step: number, total: number, message: string): void {\n if (shouldLog(\"normal\")) {\n const progress = chalk.gray(`[${step}/${total}]`);\n console.log(progress, message);\n }\n}\n\n/**\n * Logs a list of items with bullet points\n *\n * @param items - Items to list\n * @param indent - Indentation level (default: 2)\n */\nexport function logList(items: string[], indent: number = 2): void {\n if (shouldLog(\"normal\")) {\n const padding = \" \".repeat(indent);\n for (const item of items) {\n console.log(`${padding}• ${item}`);\n }\n }\n}\n\n/**\n * Logs a key-value pair\n *\n * @param key - Key name\n * @param value - Value to display\n * @param indent - Indentation level (default: 2)\n */\nexport function logKeyValue(key: string, value: string, indent: number = 2): void {\n if (shouldLog(\"normal\")) {\n const padding = \" \".repeat(indent);\n console.log(`${padding}${chalk.gray(key + \":\")} ${value}`);\n }\n}\n\n/**\n * Logs a table of data\n *\n * @param headers - Column headers\n * @param rows - Data rows\n */\nexport function logTable(headers: string[], rows: string[][]): void {\n if (!shouldLog(\"normal\")) return;\n\n // Calculate column widths\n const widths = headers.map((h, i) => {\n const maxRowWidth = Math.max(...rows.map((r) => (r[i] || \"\").length));\n return Math.max(h.length, maxRowWidth);\n });\n\n // Print header\n const headerLine = headers.map((h, i) => h.padEnd(widths[i])).join(\" \");\n console.log(chalk.bold(headerLine));\n console.log(chalk.gray(\"─\".repeat(headerLine.length)));\n\n // Print rows\n for (const row of rows) {\n const rowLine = row.map((cell, i) => (cell || \"\").padEnd(widths[i])).join(\" \");\n console.log(rowLine);\n }\n}\n\n/**\n * Logs a box with a title and content\n *\n * @param title - Box title\n * @param content - Box content (array of lines)\n */\nexport function logBox(title: string, content: string[]): void {\n if (!shouldLog(\"normal\")) return;\n\n const maxWidth = Math.max(title.length, ...content.map((c) => c.length));\n const border = \"─\".repeat(maxWidth + 2);\n\n console.log();\n console.log(chalk.cyan(`┌${border}┐`));\n console.log(chalk.cyan(\"│ \") + chalk.bold(title.padEnd(maxWidth)) + chalk.cyan(\" │\"));\n console.log(chalk.cyan(`├${border}┤`));\n for (const line of content) {\n console.log(chalk.cyan(\"│ \") + line.padEnd(maxWidth) + chalk.cyan(\" │\"));\n }\n console.log(chalk.cyan(`└${border}┘`));\n}\n\n/**\n * Creates a progress bar string\n *\n * @param current - Current progress value\n * @param total - Total value\n * @param width - Bar width in characters (default: 20)\n * @returns Formatted progress bar string\n */\nexport function createProgressBar(current: number, total: number, width: number = 20): string {\n const percentage = Math.min(100, Math.round((current / total) * 100));\n const filled = Math.round((percentage / 100) * width);\n const empty = width - filled;\n\n const bar = chalk.green(\"█\".repeat(filled)) + chalk.gray(\"░\".repeat(empty));\n return `${bar} ${percentage}%`;\n}\n\n/**\n * Logs a timestamp with a message\n *\n * @param message - Message to log\n */\nexport function logTimestamp(message: string): void {\n if (shouldLog(\"verbose\")) {\n const timestamp = new Date().toISOString();\n console.log(chalk.gray(`[${timestamp}]`), message);\n }\n}\n\n/**\n * Formats a duration in milliseconds to a human-readable string\n *\n * @param ms - Duration in milliseconds\n * @returns Formatted duration string\n */\nexport function formatDuration(ms: number): string {\n if (ms < 1000) {\n return `${ms}ms`;\n } else if (ms < 60000) {\n return `${(ms / 1000).toFixed(1)}s`;\n } else {\n const minutes = Math.floor(ms / 60000);\n const seconds = Math.round((ms % 60000) / 1000);\n return `${minutes}m ${seconds}s`;\n }\n}\n\n/**\n * Logs a timed operation result\n *\n * @param message - Operation description\n * @param startTime - Start time from Date.now()\n */\nexport function logTimed(message: string, startTime: number): void {\n if (shouldLog(\"normal\")) {\n const duration = Date.now() - startTime;\n console.log(chalk.green(\"✓\"), message, chalk.gray(`(${formatDuration(duration)})`));\n }\n}\n\n/**\n * Status output interface for JSON output mode\n */\nexport interface StatusOutput {\n status: \"up-to-date\" | \"changes-pending\" | \"first-time-setup\";\n collections: {\n current: number;\n snapshot: number;\n };\n changes: {\n create: number;\n delete: number;\n modify: number;\n };\n destructive: boolean;\n}\n\n/**\n * Formats status output as JSON\n *\n * @param output - Status output object\n * @returns JSON string\n */\nexport function formatStatusJson(output: StatusOutput): string {\n return JSON.stringify(output, null, 2);\n}\n"]}
package/dist/enums.cjs ADDED
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ // src/enums.ts
6
+ var StatusEnum = zod.z.enum([
7
+ "draft",
8
+ // Initial proposal stage (RequestDraft, ProjectDraft)
9
+ "active",
10
+ // Work in progress
11
+ "complete",
12
+ // Fully completed project
13
+ "fail"
14
+ // Failed project at any stage
15
+ ]);
16
+
17
+ exports.StatusEnum = StatusEnum;
18
+ //# sourceMappingURL=enums.cjs.map
19
+ //# sourceMappingURL=enums.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/enums.ts"],"names":["z"],"mappings":";;;;;AAEO,IAAM,UAAA,GAAaA,MAAE,IAAA,CAAK;AAAA,EAC/B,OAAA;AAAA;AAAA,EACA,QAAA;AAAA;AAAA,EACA,UAAA;AAAA;AAAA,EACA;AAAA;AACF,CAAC","file":"enums.cjs","sourcesContent":["import { z } from \"zod\";\n\nexport const StatusEnum = z.enum([\n \"draft\", // Initial proposal stage (RequestDraft, ProjectDraft)\n \"active\", // Work in progress\n \"complete\", // Fully completed project\n \"fail\", // Failed project at any stage\n]);\nexport type StatusEnumType = z.infer<typeof StatusEnum>;\n"]}
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const StatusEnum: z.ZodEnum<["draft", "active", "complete", "fail"]>;
4
+ type StatusEnumType = z.infer<typeof StatusEnum>;
5
+
6
+ export { StatusEnum, type StatusEnumType };
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const StatusEnum: z.ZodEnum<["draft", "active", "complete", "fail"]>;
4
+ type StatusEnumType = z.infer<typeof StatusEnum>;
5
+
6
+ export { StatusEnum, type StatusEnumType };
package/dist/enums.js ADDED
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/enums.ts
4
+ var StatusEnum = z.enum([
5
+ "draft",
6
+ // Initial proposal stage (RequestDraft, ProjectDraft)
7
+ "active",
8
+ // Work in progress
9
+ "complete",
10
+ // Fully completed project
11
+ "fail"
12
+ // Failed project at any stage
13
+ ]);
14
+
15
+ export { StatusEnum };
16
+ //# sourceMappingURL=enums.js.map
17
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/enums.ts"],"names":[],"mappings":";;;AAEO,IAAM,UAAA,GAAa,EAAE,IAAA,CAAK;AAAA,EAC/B,OAAA;AAAA;AAAA,EACA,QAAA;AAAA;AAAA,EACA,UAAA;AAAA;AAAA,EACA;AAAA;AACF,CAAC","file":"enums.js","sourcesContent":["import { z } from \"zod\";\n\nexport const StatusEnum = z.enum([\n \"draft\", // Initial proposal stage (RequestDraft, ProjectDraft)\n \"active\", // Work in progress\n \"complete\", // Fully completed project\n \"fail\", // Failed project at any stage\n]);\nexport type StatusEnumType = z.infer<typeof StatusEnum>;\n"]}