@zodmon/migrate 0.0.9 → 0.1.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.
package/dist/index.cjs CHANGED
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
6
10
  var __copyProps = (to, from, except, desc) => {
7
11
  if (from && typeof from === "object" || typeof from === "function") {
8
12
  for (let key of __getOwnPropNames(from))
@@ -15,5 +19,29 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
15
19
 
16
20
  // src/index.ts
17
21
  var index_exports = {};
22
+ __export(index_exports, {
23
+ ZodmonMigrationError: () => ZodmonMigrationError
24
+ });
18
25
  module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/errors/migration.ts
28
+ var ZodmonMigrationError = class extends Error {
29
+ name = "ZodmonMigrationError";
30
+ /** The migration version identifier that failed. */
31
+ version;
32
+ /** Whether the migration was running `'up'` or `'down'` when it failed. */
33
+ direction;
34
+ /** The underlying error that caused the migration to fail. */
35
+ cause;
36
+ constructor(version, direction, cause) {
37
+ super(`Migration ${version} (${direction}) failed: ${cause.message}`, { cause });
38
+ this.version = version;
39
+ this.direction = direction;
40
+ this.cause = cause;
41
+ }
42
+ };
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ ZodmonMigrationError
46
+ });
19
47
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {} // placeholder will export migration(), runner, etc.\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/errors/migration.ts"],"sourcesContent":["export { ZodmonMigrationError } from './errors'\n","/**\n * Thrown when a migration script fails during execution.\n *\n * Wraps the original error with the migration version and direction so callers\n * can identify which migration failed and in which direction. This error extends\n * `Error` directly (not `ZodmonError`) because migrations are not scoped to a\n * single collection.\n *\n * @example\n * ```ts\n * try {\n * await runMigrations(db, migrations)\n * } catch (err) {\n * if (err instanceof ZodmonMigrationError) {\n * console.log(err.version) // => '002'\n * console.log(err.direction) // => 'up'\n * console.log(err.cause) // => original Error\n * }\n * }\n * ```\n */\nexport class ZodmonMigrationError extends Error {\n\toverride readonly name = 'ZodmonMigrationError'\n\n\t/** The migration version identifier that failed. */\n\treadonly version: string\n\n\t/** Whether the migration was running `'up'` or `'down'` when it failed. */\n\treadonly direction: 'up' | 'down'\n\n\t/** The underlying error that caused the migration to fail. */\n\toverride readonly cause?: Error\n\n\tconstructor(version: string, direction: 'up' | 'down', cause: Error) {\n\t\tsuper(`Migration ${version} (${direction}) failed: ${cause.message}`, { cause })\n\t\tthis.version = version\n\t\tthis.direction = direction\n\t\tthis.cause = cause\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqBO,IAAM,uBAAN,cAAmC,MAAM;AAAA,EAC7B,OAAO;AAAA;AAAA,EAGhB;AAAA;AAAA,EAGA;AAAA;AAAA,EAGS;AAAA,EAElB,YAAY,SAAiB,WAA0B,OAAc;AACpE,UAAM,aAAa,OAAO,KAAK,SAAS,aAAa,MAAM,OAAO,IAAI,EAAE,MAAM,CAAC;AAC/E,SAAK,UAAU;AACf,SAAK,YAAY;AACjB,SAAK,QAAQ;AAAA,EACd;AACD;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,2 +1,33 @@
1
+ /**
2
+ * Thrown when a migration script fails during execution.
3
+ *
4
+ * Wraps the original error with the migration version and direction so callers
5
+ * can identify which migration failed and in which direction. This error extends
6
+ * `Error` directly (not `ZodmonError`) because migrations are not scoped to a
7
+ * single collection.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * try {
12
+ * await runMigrations(db, migrations)
13
+ * } catch (err) {
14
+ * if (err instanceof ZodmonMigrationError) {
15
+ * console.log(err.version) // => '002'
16
+ * console.log(err.direction) // => 'up'
17
+ * console.log(err.cause) // => original Error
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ declare class ZodmonMigrationError extends Error {
23
+ readonly name = "ZodmonMigrationError";
24
+ /** The migration version identifier that failed. */
25
+ readonly version: string;
26
+ /** Whether the migration was running `'up'` or `'down'` when it failed. */
27
+ readonly direction: 'up' | 'down';
28
+ /** The underlying error that caused the migration to fail. */
29
+ readonly cause?: Error;
30
+ constructor(version: string, direction: 'up' | 'down', cause: Error);
31
+ }
1
32
 
2
- export { }
33
+ export { ZodmonMigrationError };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,33 @@
1
+ /**
2
+ * Thrown when a migration script fails during execution.
3
+ *
4
+ * Wraps the original error with the migration version and direction so callers
5
+ * can identify which migration failed and in which direction. This error extends
6
+ * `Error` directly (not `ZodmonError`) because migrations are not scoped to a
7
+ * single collection.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * try {
12
+ * await runMigrations(db, migrations)
13
+ * } catch (err) {
14
+ * if (err instanceof ZodmonMigrationError) {
15
+ * console.log(err.version) // => '002'
16
+ * console.log(err.direction) // => 'up'
17
+ * console.log(err.cause) // => original Error
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ declare class ZodmonMigrationError extends Error {
23
+ readonly name = "ZodmonMigrationError";
24
+ /** The migration version identifier that failed. */
25
+ readonly version: string;
26
+ /** Whether the migration was running `'up'` or `'down'` when it failed. */
27
+ readonly direction: 'up' | 'down';
28
+ /** The underlying error that caused the migration to fail. */
29
+ readonly cause?: Error;
30
+ constructor(version: string, direction: 'up' | 'down', cause: Error);
31
+ }
1
32
 
2
- export { }
33
+ export { ZodmonMigrationError };
package/dist/index.js CHANGED
@@ -1 +1,20 @@
1
+ // src/errors/migration.ts
2
+ var ZodmonMigrationError = class extends Error {
3
+ name = "ZodmonMigrationError";
4
+ /** The migration version identifier that failed. */
5
+ version;
6
+ /** Whether the migration was running `'up'` or `'down'` when it failed. */
7
+ direction;
8
+ /** The underlying error that caused the migration to fail. */
9
+ cause;
10
+ constructor(version, direction, cause) {
11
+ super(`Migration ${version} (${direction}) failed: ${cause.message}`, { cause });
12
+ this.version = version;
13
+ this.direction = direction;
14
+ this.cause = cause;
15
+ }
16
+ };
17
+ export {
18
+ ZodmonMigrationError
19
+ };
1
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../src/errors/migration.ts"],"sourcesContent":["/**\n * Thrown when a migration script fails during execution.\n *\n * Wraps the original error with the migration version and direction so callers\n * can identify which migration failed and in which direction. This error extends\n * `Error` directly (not `ZodmonError`) because migrations are not scoped to a\n * single collection.\n *\n * @example\n * ```ts\n * try {\n * await runMigrations(db, migrations)\n * } catch (err) {\n * if (err instanceof ZodmonMigrationError) {\n * console.log(err.version) // => '002'\n * console.log(err.direction) // => 'up'\n * console.log(err.cause) // => original Error\n * }\n * }\n * ```\n */\nexport class ZodmonMigrationError extends Error {\n\toverride readonly name = 'ZodmonMigrationError'\n\n\t/** The migration version identifier that failed. */\n\treadonly version: string\n\n\t/** Whether the migration was running `'up'` or `'down'` when it failed. */\n\treadonly direction: 'up' | 'down'\n\n\t/** The underlying error that caused the migration to fail. */\n\toverride readonly cause?: Error\n\n\tconstructor(version: string, direction: 'up' | 'down', cause: Error) {\n\t\tsuper(`Migration ${version} (${direction}) failed: ${cause.message}`, { cause })\n\t\tthis.version = version\n\t\tthis.direction = direction\n\t\tthis.cause = cause\n\t}\n}\n"],"mappings":";AAqBO,IAAM,uBAAN,cAAmC,MAAM;AAAA,EAC7B,OAAO;AAAA;AAAA,EAGhB;AAAA;AAAA,EAGA;AAAA;AAAA,EAGS;AAAA,EAElB,YAAY,SAAiB,WAA0B,OAAc;AACpE,UAAM,aAAa,OAAO,KAAK,SAAS,aAAa,MAAM,OAAO,IAAI,EAAE,MAAM,CAAC;AAC/E,SAAK,UAAU;AACf,SAAK,YAAY;AACjB,SAAK,QAAQ;AAAA,EACd;AACD;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodmon/migrate",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "description": "Migration runner for Zodmon — eager and lazy migration strategies",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,7 +17,7 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@zodmon/core": "0.9.0"
20
+ "@zodmon/core": "0.10.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@testcontainers/mongodb": "^10.0.0",