durable-db 0.1.2 → 0.1.3

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/cli/bin.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import "../debug-DzvNVBs5.js";
3
- import "../state-CMRjqCDw.js";
2
+ import "../debug-DmBrUmwe.js";
3
+ import "../state-B4v8ICj8.js";
4
4
  import "../snapshot-DMW6j2Ix.js";
5
- import "../generator-BVwDQvKA.js";
6
- import "../parser-B05psK1k.js";
7
- import "../push-gXPr9k-l.js";
8
- import { n as registerDbCommands } from "../cli-BtEsZzHF.js";
5
+ import "../generator-DyrLOnPS.js";
6
+ import "../parser-DCZuDQSQ.js";
7
+ import "../push-DbdlGawo.js";
8
+ import { n as registerDbCommands } from "../cli-EPI9dH9A.js";
9
9
  import { Command } from "commander";
10
10
 
11
11
  //#region src/cli/bin.ts
package/dist/cli/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import "../debug-DzvNVBs5.js";
2
- import { _ as saveDevState, a as generateEpoch, c as getDevPaths, f as loadDevMigrations, l as getInstanceKey, m as loadDevState, s as getDevEpoch } from "../state-CMRjqCDw.js";
1
+ import "../debug-DmBrUmwe.js";
2
+ import { _ as saveDevState, a as generateEpoch, c as getDevPaths, f as loadDevMigrations, l as getInstanceKey, m as loadDevState, s as getDevEpoch } from "../state-B4v8ICj8.js";
3
3
  import "../snapshot-DMW6j2Ix.js";
4
- import "../generator-BVwDQvKA.js";
5
- import "../parser-B05psK1k.js";
6
- import { a as loadSchema, i as discoverDatabases, n as pushOne, o as reportCliError, r as diffSchema, t as push } from "../push-gXPr9k-l.js";
7
- import { a as resetAndPush, c as generate, i as reset, l as generateOne, n as registerDbCommands, o as formatStatus, r as validate, s as status, t as createDbCommand } from "../cli-BtEsZzHF.js";
4
+ import "../generator-DyrLOnPS.js";
5
+ import "../parser-DCZuDQSQ.js";
6
+ import { a as loadSchema, i as discoverDatabases, n as pushOne, o as reportCliError, r as diffSchema, t as push } from "../push-DbdlGawo.js";
7
+ import { a as resetAndPush, c as generate, i as reset, l as generateOne, n as registerDbCommands, o as formatStatus, r as validate, s as status, t as createDbCommand } from "../cli-EPI9dH9A.js";
8
8
 
9
9
  export { createDbCommand, diffSchema, discoverDatabases, formatStatus, generate, generateEpoch, generateOne, getDevEpoch, getDevPaths, getInstanceKey, loadDevMigrations, loadDevState, loadSchema, push, pushOne, registerDbCommands, reportCliError, reset, resetAndPush, saveDevState, status, validate };
@@ -1,9 +1,9 @@
1
- import { i as init_debug, t as debugCli } from "./debug-DzvNVBs5.js";
2
- import { _ as saveDevState, a as generateEpoch, c as getDevPaths, d as init_state, f as loadDevMigrations, m as loadDevState, t as clearDatabaseDevState } from "./state-CMRjqCDw.js";
1
+ import { i as init_debug, t as debugCli } from "./debug-DmBrUmwe.js";
2
+ import { _ as saveDevState, a as generateEpoch, c as getDevPaths, d as init_state, f as loadDevMigrations, m as loadDevState, t as clearDatabaseDevState } from "./state-B4v8ICj8.js";
3
3
  import { a as hashSnapshot } from "./snapshot-DMW6j2Ix.js";
4
- import { a as loadMigrationFiles, i as generateMigrationName, l as saveSnapshot, n as generateCreateTableSQL, s as loadSnapshot, t as buildAndLoadSchema } from "./generator-BVwDQvKA.js";
5
- import { a as resolveImportPath, o as loadViteAliases } from "./parser-B05psK1k.js";
6
- import { a as loadSchema, i as discoverDatabases, o as reportCliError, r as diffSchema, t as push } from "./push-gXPr9k-l.js";
4
+ import { a as loadMigrationFiles, i as generateMigrationName, l as saveSnapshot, n as generateCreateTableSQL, s as loadSnapshot, t as buildAndLoadSchema } from "./generator-DyrLOnPS.js";
5
+ import { a as resolveImportPath, o as loadViteAliases } from "./parser-DCZuDQSQ.js";
6
+ import { a as loadSchema, i as discoverDatabases, o as reportCliError, r as diffSchema, t as push } from "./push-DbdlGawo.js";
7
7
  import * as fs from "node:fs";
8
8
  import * as path from "node:path";
9
9
  import { Command } from "commander";
@@ -322,7 +322,7 @@ async function reset(ctx = {}, options = {}) {
322
322
  * Convenience function that combines reset + push
323
323
  */
324
324
  async function resetAndPush(ctx = {}, options = {}) {
325
- const { push: push$1 } = await import("./push-BW7sodiO.js");
325
+ const { push: push$1 } = await import("./push-BqFhNoP2.js");
326
326
  return {
327
327
  reset: await reset(ctx, options),
328
328
  push: await push$1(ctx)
@@ -1,5 +1,5 @@
1
- import "../debug-DzvNVBs5.js";
2
- import "../state-CMRjqCDw.js";
3
- import { a as setTenantIdResolver, i as hasTenantId, n as getInstanceKey, r as getTenantId, t as getDevInstanceKeySuffix } from "../context-NjS9iv2J.js";
1
+ import "../debug-DmBrUmwe.js";
2
+ import "../state-B4v8ICj8.js";
3
+ import { a as setTenantIdResolver, i as hasTenantId, n as getInstanceKey, r as getTenantId, t as getDevInstanceKeySuffix } from "../context-Cwe1IsnH.js";
4
4
 
5
5
  export { getDevInstanceKeySuffix, getInstanceKey, getTenantId, hasTenantId, setTenantIdResolver };
@@ -1,5 +1,5 @@
1
- import { s as __toCommonJS } from "./debug-DzvNVBs5.js";
2
- import { d as init_state, v as state_exports } from "./state-CMRjqCDw.js";
1
+ import { s as __toCommonJS } from "./debug-DmBrUmwe.js";
2
+ import { d as init_state, v as state_exports } from "./state-B4v8ICj8.js";
3
3
 
4
4
  //#region src/context/index.ts
5
5
  /**
package/dist/db/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as init_debug, n as debugMigrations } from "../debug-DzvNVBs5.js";
1
+ import { i as init_debug, n as debugMigrations } from "../debug-DmBrUmwe.js";
2
2
  import { t as type } from "../out-on886o85.js";
3
3
  import { n as defineDatabase } from "../defineDatabase-DXA53pG3.js";
4
4
  import { a as createDrizzlePlugins, i as SchemaPlugin, n as DateSerializePlugin, o as dateSerializers, r as DrizzleDefaultsPlugin, t as createKyselyFromSql } from "../kysely-yPsCWEvR.js";
@@ -0,0 +1,98 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region rolldown:runtime
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
9
+ var __export = (all, symbols) => {
10
+ let target = {};
11
+ for (var name in all) {
12
+ __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ }
17
+ if (symbols) {
18
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
19
+ }
20
+ return target;
21
+ };
22
+ var __copyProps = (to, from, except, desc) => {
23
+ if (from && typeof from === "object" || typeof from === "function") {
24
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
25
+ key = keys[i];
26
+ if (!__hasOwnProp.call(to, key) && key !== except) {
27
+ __defProp(to, key, {
28
+ get: ((k) => from[k]).bind(null, key),
29
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
30
+ });
31
+ }
32
+ }
33
+ }
34
+ return to;
35
+ };
36
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+
38
+ //#endregion
39
+ //#region src/utils/debug.ts
40
+ function readDebugEnv() {
41
+ if (typeof process !== "undefined" && process.env && process.env.DEBUG) return process.env.DEBUG;
42
+ return "";
43
+ }
44
+ function namespaceEnabled(namespace) {
45
+ const spec = readDebugEnv();
46
+ if (!spec) return false;
47
+ let enabled = false;
48
+ for (const raw of spec.split(/[\s,]+/)) {
49
+ if (!raw) continue;
50
+ const negated = raw[0] === "-";
51
+ const pattern = negated ? raw.slice(1) : raw;
52
+ if (!(pattern.endsWith("*") ? namespace.startsWith(pattern.slice(0, -1)) : pattern === namespace)) continue;
53
+ if (negated) return false;
54
+ enabled = true;
55
+ }
56
+ return enabled;
57
+ }
58
+ function stringify(value) {
59
+ if (typeof value === "string") return value;
60
+ try {
61
+ return JSON.stringify(value);
62
+ } catch {
63
+ return String(value);
64
+ }
65
+ }
66
+ function format(formatter, args) {
67
+ if (typeof formatter !== "string") return [formatter, ...args].map(stringify).join(" ");
68
+ let index = 0;
69
+ const formatted = formatter.replace(/%([%sdjoO])/g, (match, spec) => {
70
+ if (spec === "%") return "%";
71
+ if (index >= args.length) return match;
72
+ const arg = args[index++];
73
+ if (spec === "s") return String(arg);
74
+ if (spec === "d") return String(Number(arg));
75
+ return stringify(arg);
76
+ });
77
+ const extra = args.slice(index);
78
+ return extra.length ? `${formatted} ${extra.map(stringify).join(" ")}` : formatted;
79
+ }
80
+ function createDebug(namespace) {
81
+ const debug = ((formatter, ...args) => {
82
+ if (!debug.enabled) return;
83
+ console.error(`${namespace} ${format(formatter, args)}`);
84
+ });
85
+ debug.namespace = namespace;
86
+ debug.enabled = namespaceEnabled(namespace);
87
+ debug.extend = (subNamespace, delimiter = ":") => createDebug(`${namespace}${delimiter}${subNamespace}`);
88
+ return debug;
89
+ }
90
+ var debugVite, debugCli, debugMigrations;
91
+ var init_debug = __esmMin((() => {
92
+ debugVite = createDebug("database:vite");
93
+ debugCli = createDebug("database:cli");
94
+ debugMigrations = createDebug("database:migrations");
95
+ }));
96
+
97
+ //#endregion
98
+ export { __esmMin as a, init_debug as i, debugMigrations as n, __export as o, debugVite as r, __toCommonJS as s, debugCli as t };
@@ -1,4 +1,4 @@
1
- import { i as init_debug, n as debugMigrations } from "./debug-DzvNVBs5.js";
1
+ import { i as init_debug, n as debugMigrations } from "./debug-DmBrUmwe.js";
2
2
  import { i as generateSnapshotId, n as generateMigrationStatements, o as snapshotsEqual, r as generateSnapshotFromSchema, t as createEmptySnapshot } from "./snapshot-DMW6j2Ix.js";
3
3
  import * as fs from "node:fs";
4
4
  import * as path from "node:path";
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import "./debug-DzvNVBs5.js";
1
+ import "./debug-DmBrUmwe.js";
2
2
  import { t as type } from "./out-on886o85.js";
3
3
  import { n as defineDatabase } from "./defineDatabase-DXA53pG3.js";
4
4
  import { a as numeric, c as table, i as integer, l as text, n as foreignKey, o as primaryKey, r as index, s as real, t as blob, u as uniqueIndex } from "./schema-IFq7ovQq.js";
5
- import "./state-CMRjqCDw.js";
6
- import { a as setTenantIdResolver, i as hasTenantId, r as getTenantId } from "./context-NjS9iv2J.js";
5
+ import "./state-B4v8ICj8.js";
6
+ import { a as setTenantIdResolver, i as hasTenantId, r as getTenantId } from "./context-Cwe1IsnH.js";
7
7
 
8
8
  export { blob, defineDatabase, foreignKey, getTenantId, hasTenantId, index, integer, numeric, primaryKey, real, setTenantIdResolver, table, text, type, uniqueIndex };
@@ -1,5 +1,5 @@
1
- import "../debug-DzvNVBs5.js";
1
+ import "../debug-DmBrUmwe.js";
2
2
  import "../snapshot-DMW6j2Ix.js";
3
- import { a as loadMigrationFiles, c as parseSqlMigration, i as generateMigrationName, l as saveSnapshot, n as generateCreateTableSQL, o as loadSchemaModule, r as generateMigration, s as loadSnapshot, t as buildAndLoadSchema } from "../generator-BVwDQvKA.js";
3
+ import { a as loadMigrationFiles, c as parseSqlMigration, i as generateMigrationName, l as saveSnapshot, n as generateCreateTableSQL, o as loadSchemaModule, r as generateMigration, s as loadSnapshot, t as buildAndLoadSchema } from "../generator-DyrLOnPS.js";
4
4
 
5
5
  export { buildAndLoadSchema, generateCreateTableSQL, generateMigration, generateMigrationName, loadMigrationFiles, loadSchemaModule, loadSnapshot, parseSqlMigration, saveSnapshot };
@@ -1,4 +1,4 @@
1
- import { i as init_debug, t as debugCli } from "./debug-DzvNVBs5.js";
1
+ import { i as init_debug, t as debugCli } from "./debug-DmBrUmwe.js";
2
2
  import * as fs from "node:fs";
3
3
  import * as path from "node:path";
4
4
  import { parse } from "@babel/parser";
@@ -0,0 +1,8 @@
1
+ import "./debug-DmBrUmwe.js";
2
+ import "./state-B4v8ICj8.js";
3
+ import "./snapshot-DMW6j2Ix.js";
4
+ import "./generator-DyrLOnPS.js";
5
+ import "./parser-DCZuDQSQ.js";
6
+ import { n as pushOne, t as push } from "./push-DbdlGawo.js";
7
+
8
+ export { push };
@@ -1,8 +1,8 @@
1
- import { i as init_debug, t as debugCli } from "./debug-DzvNVBs5.js";
2
- import { d as init_state, f as loadDevMigrations, h as saveDevMigration, n as clearDevMigrations } from "./state-CMRjqCDw.js";
1
+ import { i as init_debug, t as debugCli } from "./debug-DmBrUmwe.js";
2
+ import { d as init_state, f as loadDevMigrations, h as saveDevMigration, n as clearDevMigrations } from "./state-B4v8ICj8.js";
3
3
  import { n as generateMigrationStatements, o as snapshotsEqual, r as generateSnapshotFromSchema } from "./snapshot-DMW6j2Ix.js";
4
- import { s as loadSnapshot, t as buildAndLoadSchema } from "./generator-BVwDQvKA.js";
5
- import { a as resolveImportPath, i as readFile, n as parseDatabaseFile, o as loadViteAliases, r as discoverDatabaseFiles } from "./parser-B05psK1k.js";
4
+ import { s as loadSnapshot, t as buildAndLoadSchema } from "./generator-DyrLOnPS.js";
5
+ import { a as resolveImportPath, i as readFile, n as parseDatabaseFile, o as loadViteAliases, r as discoverDatabaseFiles } from "./parser-DCZuDQSQ.js";
6
6
  import * as path from "node:path";
7
7
  import * as crypto from "node:crypto";
8
8
 
@@ -1,4 +1,4 @@
1
- import { a as __esmMin, i as init_debug, o as __export, t as debugCli } from "./debug-DzvNVBs5.js";
1
+ import { a as __esmMin, i as init_debug, o as __export, t as debugCli } from "./debug-DmBrUmwe.js";
2
2
  import * as fs from "node:fs";
3
3
  import * as path from "node:path";
4
4
 
@@ -1,5 +1,5 @@
1
- import "./debug-DzvNVBs5.js";
2
- import { _ as saveDevState, a as generateEpoch, c as getDevPaths, d as init_state, f as loadDevMigrations, g as saveDevSnapshot, h as saveDevMigration, i as findNodeModules, l as getInstanceKey, m as loadDevState, n as clearDevMigrations, o as getDatabaseDevState, p as loadDevSnapshot, r as createEmptyDevState, s as getDevEpoch, t as clearDatabaseDevState, u as hasProdSnapshotChanged } from "./state-CMRjqCDw.js";
1
+ import "./debug-DmBrUmwe.js";
2
+ import { _ as saveDevState, a as generateEpoch, c as getDevPaths, d as init_state, f as loadDevMigrations, g as saveDevSnapshot, h as saveDevMigration, i as findNodeModules, l as getInstanceKey, m as loadDevState, n as clearDevMigrations, o as getDatabaseDevState, p as loadDevSnapshot, r as createEmptyDevState, s as getDevEpoch, t as clearDatabaseDevState, u as hasProdSnapshotChanged } from "./state-B4v8ICj8.js";
3
3
 
4
4
  init_state();
5
5
  export { loadDevMigrations };
@@ -1,8 +1,8 @@
1
- import "../debug-DzvNVBs5.js";
1
+ import "../debug-DmBrUmwe.js";
2
2
  import { t as type } from "../out-on886o85.js";
3
3
  import { t as ACTION_TEST_META } from "../defineDatabase-DXA53pG3.js";
4
- import "../state-CMRjqCDw.js";
5
- import { a as setTenantIdResolver } from "../context-NjS9iv2J.js";
4
+ import "../state-B4v8ICj8.js";
5
+ import { a as setTenantIdResolver } from "../context-Cwe1IsnH.js";
6
6
  import { t as createKyselyFromSql } from "../kysely-yPsCWEvR.js";
7
7
  import { n as generateMigrationStatements, r as generateSnapshotFromSchema, t as createEmptySnapshot } from "../snapshot-DMW6j2Ix.js";
8
8
  import { createRequire } from "node:module";
@@ -1,8 +1,8 @@
1
- import { i as init_debug, r as debugVite } from "../debug-DzvNVBs5.js";
2
- import { _ as saveDevState, c as getDevPaths, d as init_state, m as loadDevState } from "../state-CMRjqCDw.js";
1
+ import { i as init_debug, r as debugVite } from "../debug-DmBrUmwe.js";
2
+ import { _ as saveDevState, c as getDevPaths, d as init_state, m as loadDevState } from "../state-B4v8ICj8.js";
3
3
  import "../snapshot-DMW6j2Ix.js";
4
- import { a as loadMigrationFiles } from "../generator-BVwDQvKA.js";
5
- import { i as readFile, n as parseDatabaseFile, r as discoverDatabaseFiles, t as BABEL_PARSER_PLUGINS } from "../parser-B05psK1k.js";
4
+ import { a as loadMigrationFiles } from "../generator-DyrLOnPS.js";
5
+ import { i as readFile, n as parseDatabaseFile, r as discoverDatabaseFiles, t as BABEL_PARSER_PLUGINS } from "../parser-DCZuDQSQ.js";
6
6
  import * as fs from "node:fs";
7
7
  import * as path from "node:path";
8
8
  import { parse } from "@babel/parser";
@@ -861,7 +861,7 @@ var PluginState = class {
861
861
  const isDev = this.config.command === "serve";
862
862
  db.migrations = loadMigrationFiles(migrationsDir);
863
863
  if (isDev) try {
864
- const { loadDevMigrations } = await import("../state-DCXcGtiu.js");
864
+ const { loadDevMigrations } = await import("../state-BfYEMzuB.js");
865
865
  const devMigrations = loadDevMigrations(this.projectRoot, db.name);
866
866
  for (const [name, chunks] of devMigrations) db.migrations.set(`_dev_${name}`, chunks);
867
867
  if (devMigrations.size > 0) debugVite("Loaded %d dev migration(s) for %s", devMigrations.size, db.name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "durable-db",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/eagerpatch/durable-db.git"
@@ -77,7 +77,6 @@
77
77
  "@outerbase/browsable-durable-object": "^0.1.0",
78
78
  "arktype": "^2.1.28",
79
79
  "commander": "^13.1.0",
80
- "debug": "^4.4.3",
81
80
  "drizzle-kit": "^0.30.0",
82
81
  "drizzle-orm": "^0.38.0",
83
82
  "esbuild": "^0.27.1",
@@ -98,7 +97,6 @@
98
97
  "@cloudflare/workers-types": "^4.20241127.0",
99
98
  "@types/babel__generator": "^7.6.8",
100
99
  "@types/babel__traverse": "^7.20.6",
101
- "@types/debug": "^4.1.12",
102
100
  "@types/node": "^24.0.0",
103
101
  "drizzle-kit": "^0.30.0",
104
102
  "esbuild": "^0.27.1",
@@ -1,49 +0,0 @@
1
- import { createRequire } from "node:module";
2
- import createDebug from "debug";
3
-
4
- //#region rolldown:runtime
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
10
- var __export = (all, symbols) => {
11
- let target = {};
12
- for (var name in all) {
13
- __defProp(target, name, {
14
- get: all[name],
15
- enumerable: true
16
- });
17
- }
18
- if (symbols) {
19
- __defProp(target, Symbol.toStringTag, { value: "Module" });
20
- }
21
- return target;
22
- };
23
- var __copyProps = (to, from, except, desc) => {
24
- if (from && typeof from === "object" || typeof from === "function") {
25
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
26
- key = keys[i];
27
- if (!__hasOwnProp.call(to, key) && key !== except) {
28
- __defProp(to, key, {
29
- get: ((k) => from[k]).bind(null, key),
30
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
31
- });
32
- }
33
- }
34
- }
35
- return to;
36
- };
37
- var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
-
39
- //#endregion
40
- //#region src/utils/debug.ts
41
- var debugVite, debugCli, debugMigrations;
42
- var init_debug = __esmMin((() => {
43
- debugVite = createDebug("database:vite");
44
- debugCli = createDebug("database:cli");
45
- debugMigrations = createDebug("database:migrations");
46
- }));
47
-
48
- //#endregion
49
- export { __esmMin as a, init_debug as i, debugMigrations as n, __export as o, debugVite as r, __toCommonJS as s, debugCli as t };
@@ -1,8 +0,0 @@
1
- import "./debug-DzvNVBs5.js";
2
- import "./state-CMRjqCDw.js";
3
- import "./snapshot-DMW6j2Ix.js";
4
- import "./generator-BVwDQvKA.js";
5
- import "./parser-B05psK1k.js";
6
- import { n as pushOne, t as push } from "./push-gXPr9k-l.js";
7
-
8
- export { push };