durable-db 0.0.3 → 0.0.4

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 (41) hide show
  1. package/dist/cli/bin.js +6 -6
  2. package/dist/cli/index.d.ts +3 -3
  3. package/dist/cli/index.js +6 -6
  4. package/dist/{cli-Cr9686BF.js → cli-AzoPlqMA.js} +6 -6
  5. package/dist/context/index.d.ts +1 -1
  6. package/dist/context/index.js +2 -2
  7. package/dist/{context-BuIiIQ6K.js → context-BcWMofTp.js} +1 -1
  8. package/dist/db/index.d.ts +2 -2
  9. package/dist/db/index.js +2 -2
  10. package/dist/{defineDatabase-jBv90-Pk.d.ts → defineDatabase-B8do9yYZ.d.ts} +1 -1
  11. package/dist/{defineDatabase-CONf4xFC.js → defineDatabase-C91B-LMQ.js} +1 -1
  12. package/dist/{generator-BUPP9scJ.js → generator-B4yBWHRz.js} +24 -2
  13. package/dist/{index-CU9edk9Q.d.ts → index-nm3-NwUh.d.ts} +1 -1
  14. package/dist/index.d.ts +4 -4
  15. package/dist/index.js +5 -5
  16. package/dist/migrations/generator.d.ts +1 -1
  17. package/dist/migrations/generator.js +2 -2
  18. package/dist/migrations/snapshot.d.ts +1 -1
  19. package/dist/migrations/snapshot.js +1 -1
  20. package/dist/out-CuoxKfaH.js +7446 -0
  21. package/dist/{push-BgQ5cnfH.js → push-BymAOkB9.js} +4 -4
  22. package/dist/push-CT2aX_AM.js +8 -0
  23. package/dist/registry.d.ts +3 -1
  24. package/dist/registry.js +3 -3
  25. package/dist/schema.d.ts +1 -1
  26. package/dist/schema.js +1 -1
  27. package/dist/{state-BCcvNN-M.js → state-BUCIODvB.js} +1 -1
  28. package/dist/transport/protocol.js +1 -1
  29. package/dist/transport/websocket.js +1 -1
  30. package/dist/vite/durableDb.js +7 -7
  31. package/dist/{websocket-Dx1fqwnF.js → websocket-Cwc7933g.js} +1 -1
  32. package/package.json +1 -1
  33. package/dist/push-BkkaslPd.js +0 -8
  34. /package/dist/{index-CqVMaMYY.d.ts → index-DN2vKPw_.d.ts} +0 -0
  35. /package/dist/{parser-CbX54Flt.js → parser-qOiKNcYc.js} +0 -0
  36. /package/dist/{protocol-g_plhPOY.js → protocol-v7B4_9xU.js} +0 -0
  37. /package/dist/{schema-CpzTOfZ6.d.ts → schema-CjGvnsaZ.d.ts} +0 -0
  38. /package/dist/{schema-BOtrGnzM.js → schema-ou5L5I9Y.js} +0 -0
  39. /package/dist/{snapshot-D170nL7i.js → snapshot-CgEvcMZb.js} +0 -0
  40. /package/dist/{snapshot-C162qYoA.d.ts → snapshot-oD3wAJF2.d.ts} +0 -0
  41. /package/dist/{state-FOEjpgJ6.js → state-DDHYOyvD.js} +0 -0
@@ -1,8 +1,8 @@
1
1
  import { i as init_debug, t as debugCli } from "./debug-BZJbKybf.js";
2
- import { d as init_state, f as loadDevMigrations, h as saveDevMigration, n as clearDevMigrations } from "./state-FOEjpgJ6.js";
3
- import { n as generateMigrationStatements, o as snapshotsEqual, r as generateSnapshotFromSchema } from "./snapshot-D170nL7i.js";
4
- import { s as loadSnapshot, t as buildAndLoadSchema } from "./generator-BUPP9scJ.js";
5
- import { a as resolveImportPath, i as readFile, n as parseDatabaseFile, r as discoverDatabaseFiles } from "./parser-CbX54Flt.js";
2
+ import { d as init_state, f as loadDevMigrations, h as saveDevMigration, n as clearDevMigrations } from "./state-DDHYOyvD.js";
3
+ import { n as generateMigrationStatements, o as snapshotsEqual, r as generateSnapshotFromSchema } from "./snapshot-CgEvcMZb.js";
4
+ import { s as loadSnapshot, t as buildAndLoadSchema } from "./generator-B4yBWHRz.js";
5
+ import { a as resolveImportPath, i as readFile, n as parseDatabaseFile, r as discoverDatabaseFiles } from "./parser-qOiKNcYc.js";
6
6
  import * as path from "node:path";
7
7
  import * as crypto from "node:crypto";
8
8
 
@@ -0,0 +1,8 @@
1
+ import "./debug-BZJbKybf.js";
2
+ import "./state-DDHYOyvD.js";
3
+ import "./snapshot-CgEvcMZb.js";
4
+ import "./generator-B4yBWHRz.js";
5
+ import "./parser-qOiKNcYc.js";
6
+ import { n as pushOne, t as push } from "./push-BymAOkB9.js";
7
+
8
+ export { push };
@@ -1,3 +1,5 @@
1
+ import { type } from "arktype";
2
+
1
3
  //#region src/registry.d.ts
2
4
  interface ActionDefinition {
3
5
  validator: (args: unknown) => unknown;
@@ -25,4 +27,4 @@ declare function runWithDoContext<T>(store: DoContext, fn: () => T): T;
25
27
  */
26
28
  declare function callAction(db: unknown, targetDb: string, actionName: string, args: unknown, ctx: RpcContext): Promise<unknown>;
27
29
  //#endregion
28
- export { ActionDefinition, DoContext, RpcContext, callAction, getAction, getDoContext, registerAction, runWithDoContext };
30
+ export { ActionDefinition, DoContext, RpcContext, callAction, getAction, getDoContext, registerAction, runWithDoContext, type };
package/dist/registry.js CHANGED
@@ -1,5 +1,5 @@
1
- import { n as WebSocketTransport } from "./websocket-Dx1fqwnF.js";
2
- import { type } from "arktype";
1
+ import { t as type } from "./out-CuoxKfaH.js";
2
+ import { n as WebSocketTransport } from "./websocket-Cwc7933g.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
 
5
5
  //#region src/registry.ts
@@ -69,4 +69,4 @@ async function callAction(db, targetDb, actionName, args, ctx) {
69
69
  }
70
70
 
71
71
  //#endregion
72
- export { callAction, getAction, getDoContext, registerAction, runWithDoContext };
72
+ export { callAction, getAction, getDoContext, registerAction, runWithDoContext, type };
package/dist/schema.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as integer, c as real, d as uniqueIndex, i as index, l as table, n as blob, o as numeric, r as foreignKey, s as primaryKey, t as AnySQLiteColumn, u as text } from "./schema-CpzTOfZ6.js";
1
+ import { a as integer, c as real, d as uniqueIndex, i as index, l as table, n as blob, o as numeric, r as foreignKey, s as primaryKey, t as AnySQLiteColumn, u as text } from "./schema-CjGvnsaZ.js";
2
2
  export { AnySQLiteColumn, blob, foreignKey, index, integer, numeric, primaryKey, real, table, text, uniqueIndex };
package/dist/schema.js CHANGED
@@ -1,3 +1,3 @@
1
- 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-BOtrGnzM.js";
1
+ 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-ou5L5I9Y.js";
2
2
 
3
3
  export { blob, foreignKey, index, integer, numeric, primaryKey, real, table, text, uniqueIndex };
@@ -1,5 +1,5 @@
1
1
  import "./debug-BZJbKybf.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-FOEjpgJ6.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-DDHYOyvD.js";
3
3
 
4
4
  init_state();
5
5
  export { loadDevMigrations };
@@ -1,3 +1,3 @@
1
- import { i as encodeResponse, n as decodeResponse, r as encodeRequest, t as decodeRequest } from "../protocol-g_plhPOY.js";
1
+ import { i as encodeResponse, n as decodeResponse, r as encodeRequest, t as decodeRequest } from "../protocol-v7B4_9xU.js";
2
2
 
3
3
  export { decodeRequest, decodeResponse, encodeRequest, encodeResponse };
@@ -1,3 +1,3 @@
1
- import { n as WebSocketTransport, t as DEFAULT_WS_REQUEST_TIMEOUT_MS } from "../websocket-Dx1fqwnF.js";
1
+ import { n as WebSocketTransport, t as DEFAULT_WS_REQUEST_TIMEOUT_MS } from "../websocket-Cwc7933g.js";
2
2
 
3
3
  export { DEFAULT_WS_REQUEST_TIMEOUT_MS, WebSocketTransport };
@@ -1,8 +1,8 @@
1
1
  import { i as init_debug, r as debugVite } from "../debug-BZJbKybf.js";
2
- import { _ as saveDevState, c as getDevPaths, d as init_state, m as loadDevState } from "../state-FOEjpgJ6.js";
3
- import "../snapshot-D170nL7i.js";
4
- import { a as loadMigrationFiles } from "../generator-BUPP9scJ.js";
5
- import { i as readFile, n as parseDatabaseFile, r as discoverDatabaseFiles, t as BABEL_PARSER_PLUGINS } from "../parser-CbX54Flt.js";
2
+ import { _ as saveDevState, c as getDevPaths, d as init_state, m as loadDevState } from "../state-DDHYOyvD.js";
3
+ import "../snapshot-CgEvcMZb.js";
4
+ import { a as loadMigrationFiles } from "../generator-B4yBWHRz.js";
5
+ import { i as readFile, n as parseDatabaseFile, r as discoverDatabaseFiles, t as BABEL_PARSER_PLUGINS } from "../parser-qOiKNcYc.js";
6
6
  import * as fs from "node:fs";
7
7
  import * as path from "node:path";
8
8
  import { parse } from "@babel/parser";
@@ -597,13 +597,13 @@ function buildStubBodyStatements(config) {
597
597
  function applyActionTransforms(body, ctx) {
598
598
  const { dbName, database, actionsInFile, contextImport, registryImport } = ctx;
599
599
  if (actionsInFile.length === 0) return false;
600
- ensureNamedImports(body, "arktype", ["type"]);
601
600
  ensureNamedImports(body, contextImport, ["getTenantId"]);
602
601
  ensureNamedImports(body, "cloudflare:workers", ["env"]);
603
602
  ensureNamedImports(body, registryImport, [
604
603
  "registerAction",
605
604
  "getDoContext",
606
- "callAction"
605
+ "callAction",
606
+ "type"
607
607
  ]);
608
608
  ensureNamedImports(body, DEV_EPOCH_IMPORT, ["applyDevEpoch"]);
609
609
  if (database.transport === "websocket") ensureNamedImports(body, "durable-db/transport/websocket", ["WebSocketTransport"]);
@@ -837,7 +837,7 @@ var PluginState = class {
837
837
  const isDev = this.config.command === "serve";
838
838
  db.migrations = loadMigrationFiles(migrationsDir);
839
839
  if (isDev) try {
840
- const { loadDevMigrations } = await import("../state-BCcvNN-M.js");
840
+ const { loadDevMigrations } = await import("../state-BUCIODvB.js");
841
841
  const devMigrations = loadDevMigrations(this.projectRoot, db.name);
842
842
  for (const [name, chunks] of devMigrations) db.migrations.set(`_dev_${name}`, chunks);
843
843
  if (devMigrations.size > 0) debugVite("Loaded %d dev migration(s) for %s", devMigrations.size, db.name);
@@ -1,4 +1,4 @@
1
- import { n as decodeResponse, r as encodeRequest } from "./protocol-g_plhPOY.js";
1
+ import { n as decodeResponse, r as encodeRequest } from "./protocol-v7B4_9xU.js";
2
2
 
3
3
  //#region src/transport/websocket.ts
4
4
  /** Default timeout (ms) after which a pending WebSocket request rejects. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "durable-db",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/eagerpatch/durable-db.git"
@@ -1,8 +0,0 @@
1
- import "./debug-BZJbKybf.js";
2
- import "./state-FOEjpgJ6.js";
3
- import "./snapshot-D170nL7i.js";
4
- import "./generator-BUPP9scJ.js";
5
- import "./parser-CbX54Flt.js";
6
- import { n as pushOne, t as push } from "./push-BgQ5cnfH.js";
7
-
8
- export { push };
File without changes
File without changes
File without changes