durable-db 0.1.5 → 0.1.7
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/arktypeConfig--4OgOv4U.d.ts +6 -0
- package/dist/{out-on886o85.js → arktypeConfig-CTCJm4vA.js} +5 -1
- package/dist/cli/bin.js +3 -3
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +3 -3
- package/dist/{cli-EPI9dH9A.js → cli-CjxrMYk5.js} +3 -3
- package/dist/context/index.d.ts +1 -1
- package/dist/db/index.d.ts +3 -2
- package/dist/db/index.js +2 -2
- package/dist/{defineDatabase-DXA53pG3.js → defineDatabase-BD3k1L7d.js} +1 -1
- package/dist/{defineDatabase-B8KJ1xYJ.d.ts → defineDatabase-Bjws1Jkd.d.ts} +2 -3
- package/dist/{index-C5C4vaBs.d.ts → index-NJ7kT_a5.d.ts} +1 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/{parser-DCZuDQSQ.js → parser-CzKUWwk1.js} +40 -1
- package/dist/{push-DbdlGawo.js → push-CAgrAjKM.js} +1 -1
- package/dist/{push-BqFhNoP2.js → push-D0zsn0Ge.js} +2 -2
- package/dist/registry.d.ts +1 -1
- package/dist/registry.js +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/testing/index.js +2 -2
- package/dist/vite/durableDb.js +17 -4
- package/package.json +1 -1
- /package/dist/{index-DaDdJ_cg.d.ts → index-D9LHeBx2.d.ts} +0 -0
- /package/dist/{schema-suxWBY7-.d.ts → schema-BCjqTRvV.d.ts} +0 -0
|
@@ -7434,7 +7434,7 @@ $arkTypeRegistry.typeAttachments = {
|
|
|
7434
7434
|
Array: keywords.Array.root,
|
|
7435
7435
|
Date: keywords.Date
|
|
7436
7436
|
};
|
|
7437
|
-
const type = Object.assign(ark.type, $arkTypeRegistry.typeAttachments);
|
|
7437
|
+
const type$1 = Object.assign(ark.type, $arkTypeRegistry.typeAttachments);
|
|
7438
7438
|
const match = ark.match;
|
|
7439
7439
|
const fn = ark.fn;
|
|
7440
7440
|
const generic = ark.generic;
|
|
@@ -7442,5 +7442,9 @@ const schema = ark.schema;
|
|
|
7442
7442
|
const define = ark.define;
|
|
7443
7443
|
const declare = ark.declare;
|
|
7444
7444
|
|
|
7445
|
+
//#endregion
|
|
7446
|
+
//#region src/arktypeConfig.ts
|
|
7447
|
+
const type = scope({}, { jitless: true }).type;
|
|
7448
|
+
|
|
7445
7449
|
//#endregion
|
|
7446
7450
|
export { type as t };
|
package/dist/cli/bin.js
CHANGED
|
@@ -3,9 +3,9 @@ import "../debug-DmBrUmwe.js";
|
|
|
3
3
|
import "../state-B4v8ICj8.js";
|
|
4
4
|
import "../snapshot-DMW6j2Ix.js";
|
|
5
5
|
import "../generator-DyrLOnPS.js";
|
|
6
|
-
import "../parser-
|
|
7
|
-
import "../push-
|
|
8
|
-
import { n as registerDbCommands } from "../cli-
|
|
6
|
+
import "../parser-CzKUWwk1.js";
|
|
7
|
+
import "../push-CAgrAjKM.js";
|
|
8
|
+
import { n as registerDbCommands } from "../cli-CjxrMYk5.js";
|
|
9
9
|
import { Command } from "commander";
|
|
10
10
|
|
|
11
11
|
//#region src/cli/bin.ts
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as Snapshot } from "../snapshot-DOerumb7.js";
|
|
2
|
-
import { l as DatabaseInfo } from "../defineDatabase-
|
|
3
|
-
import "../index-
|
|
2
|
+
import { l as DatabaseInfo } from "../defineDatabase-Bjws1Jkd.js";
|
|
3
|
+
import "../index-NJ7kT_a5.js";
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
|
|
6
6
|
//#region src/cli/command.d.ts
|
package/dist/cli/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import "../debug-DmBrUmwe.js";
|
|
|
2
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
4
|
import "../generator-DyrLOnPS.js";
|
|
5
|
-
import "../parser-
|
|
6
|
-
import { a as loadSchema, i as discoverDatabases, n as pushOne, o as reportCliError, r as diffSchema, t as push } from "../push-
|
|
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-
|
|
5
|
+
import "../parser-CzKUWwk1.js";
|
|
6
|
+
import { a as loadSchema, i as discoverDatabases, n as pushOne, o as reportCliError, r as diffSchema, t as push } from "../push-CAgrAjKM.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-CjxrMYk5.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 };
|
|
@@ -2,8 +2,8 @@ import { i as init_debug, t as debugCli } from "./debug-DmBrUmwe.js";
|
|
|
2
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
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 {
|
|
6
|
-
import { a as loadSchema, i as discoverDatabases, o as reportCliError, r as diffSchema, t as push } from "./push-
|
|
5
|
+
import { o as resolveImportPath, s as loadViteAliases } from "./parser-CzKUWwk1.js";
|
|
6
|
+
import { a as loadSchema, i as discoverDatabases, o as reportCliError, r as diffSchema, t as push } from "./push-CAgrAjKM.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-
|
|
325
|
+
const { push: push$1 } = await import("./push-D0zsn0Ge.js");
|
|
326
326
|
return {
|
|
327
327
|
reset: await reset(ctx, options),
|
|
328
328
|
push: await push$1(ctx)
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as setTenantIdResolver, i as hasTenantId, n as getInstanceKey, r as getTenantId, t as getDevInstanceKeySuffix } from "../index-
|
|
1
|
+
import { a as setTenantIdResolver, i as hasTenantId, n as getInstanceKey, r as getTenantId, t as getDevInstanceKeySuffix } from "../index-D9LHeBx2.js";
|
|
2
2
|
export { getDevInstanceKeySuffix, getInstanceKey, getTenantId, hasTenantId, setTenantIdResolver };
|
package/dist/db/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as type } from "../arktypeConfig--4OgOv4U.js";
|
|
2
|
+
import { a as ActionInfo, c as DatabaseDefinition, d as InferArgs, f as ParsedDatabaseFile, i as ActionContext, l as DatabaseInfo, n as Action, o as ArgsSchema, r as ActionConfig, s as DatabaseConfig, t as defineDatabase, u as DrizzleToKysely } from "../defineDatabase-Bjws1Jkd.js";
|
|
3
|
+
import { _ as CreateKyselyOptions, a as QueryResult, c as DrizzleDefaultsPlugin, d as dateSerializers, f as Migration, g as SqliteDurableObject, h as Migrations, i as KyselyPlugin, l as SchemaPlugin, m as MigrationSchemaConflictError, n as CompiledQuery, o as studio, p as MigrationAttemptInfo, r as Kysely, s as DateSerializePlugin, t as CamelCasePlugin, u as createDrizzlePlugins, v as SqlExecutor, y as createKyselyFromSql } from "../index-NJ7kT_a5.js";
|
|
3
4
|
export { Action, ActionConfig, ActionContext, ActionInfo, ArgsSchema, CamelCasePlugin, CompiledQuery, CreateKyselyOptions, DatabaseConfig, DatabaseDefinition, DatabaseInfo, DateSerializePlugin, DrizzleDefaultsPlugin, DrizzleToKysely, InferArgs, Kysely, KyselyPlugin, Migration, MigrationAttemptInfo, MigrationSchemaConflictError, Migrations, ParsedDatabaseFile, QueryResult, SchemaPlugin, SqlExecutor, SqliteDurableObject, createDrizzlePlugins, createKyselyFromSql, dateSerializers, defineDatabase, studio, type };
|
package/dist/db/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as init_debug, n as debugMigrations } from "../debug-DmBrUmwe.js";
|
|
2
|
-
import { t as type } from "../
|
|
3
|
-
import { n as defineDatabase } from "../defineDatabase-
|
|
2
|
+
import { t as type } from "../arktypeConfig-CTCJm4vA.js";
|
|
3
|
+
import { n as defineDatabase } from "../defineDatabase-BD3k1L7d.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";
|
|
5
5
|
import { DurableObject } from "cloudflare:workers";
|
|
6
6
|
import { CamelCasePlugin } from "kysely";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SQLiteTableWithColumns } from "drizzle-orm/sqlite-core";
|
|
2
2
|
import { Kysely } from "kysely";
|
|
3
|
-
import { type } from "arktype";
|
|
4
3
|
import { Kyselify } from "drizzle-orm/kysely";
|
|
5
4
|
|
|
6
5
|
//#region src/db/types.d.ts
|
|
@@ -36,8 +35,8 @@ type DrizzleToKysely<TSchema extends Record<string, SQLiteTableWithColumns<any>>
|
|
|
36
35
|
* - arkType.validate<Def> → definition shape with DSL validation/autocomplete
|
|
37
36
|
* - arkType.infer<Def> → inferred output type
|
|
38
37
|
*/
|
|
39
|
-
type ArkDef<Def> =
|
|
40
|
-
type InferArgs<Def> =
|
|
38
|
+
type ArkDef<Def> = arkType.validate<Def>;
|
|
39
|
+
type InferArgs<Def> = arkType.infer<Def>;
|
|
41
40
|
/**
|
|
42
41
|
* Context passed to action handlers
|
|
43
42
|
*/
|
|
@@ -3,7 +3,6 @@ import { DurableObject } from "cloudflare:workers";
|
|
|
3
3
|
import { CamelCasePlugin, CamelCasePlugin as CamelCasePlugin$1, CompiledQuery, Kysely, Kysely as Kysely$1, KyselyPlugin, KyselyPlugin as KyselyPlugin$1, PluginTransformQueryArgs, PluginTransformResultArgs, QueryResult, QueryResult as QueryResult$1, RootOperationNode, UnknownRow } from "kysely";
|
|
4
4
|
import { Table } from "drizzle-orm";
|
|
5
5
|
import { studio } from "@outerbase/browsable-durable-object";
|
|
6
|
-
import { type as type$1 } from "arktype";
|
|
7
6
|
|
|
8
7
|
//#region src/db/kysely.d.ts
|
|
9
8
|
/**
|
|
@@ -348,4 +347,4 @@ declare class DateSerializePlugin implements KyselyPlugin {
|
|
|
348
347
|
*/
|
|
349
348
|
declare function createDrizzlePlugins(schema: Record<string, SQLiteTableWithColumns<any>>, camelCase?: boolean): KyselyPlugin[];
|
|
350
349
|
//#endregion
|
|
351
|
-
export {
|
|
350
|
+
export { CreateKyselyOptions as _, QueryResult$1 as a, DrizzleDefaultsPlugin as c, dateSerializers as d, Migration as f, SqliteDurableObject as g, Migrations as h, KyselyPlugin$1 as i, SchemaPlugin as l, MigrationSchemaConflictError as m, CompiledQuery as n, studio as o, MigrationAttemptInfo as p, Kysely$1 as r, DateSerializePlugin as s, CamelCasePlugin$1 as t, createDrizzlePlugins as u, SqlExecutor as v, createKyselyFromSql as y };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
1
|
+
import { t as type } from "./arktypeConfig--4OgOv4U.js";
|
|
2
|
+
import { c as DatabaseDefinition, d as InferArgs, i as ActionContext, n as Action, r as ActionConfig, s as DatabaseConfig, t as defineDatabase, u as DrizzleToKysely } from "./defineDatabase-Bjws1Jkd.js";
|
|
3
|
+
import { a as setTenantIdResolver, i as hasTenantId, r as getTenantId } from "./index-D9LHeBx2.js";
|
|
4
|
+
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-BCjqTRvV.js";
|
|
4
5
|
import { Kysely } from "kysely";
|
|
5
|
-
import { type } from "arktype";
|
|
6
6
|
export { type Action, type ActionConfig, type ActionContext, type AnySQLiteColumn, type DatabaseConfig, type DatabaseDefinition, type DrizzleToKysely, type InferArgs, type Kysely, blob, defineDatabase, foreignKey, getTenantId, hasTenantId, index, integer, numeric, primaryKey, real, setTenantIdResolver, table, text, type, uniqueIndex };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./debug-DmBrUmwe.js";
|
|
2
|
-
import { t as type } from "./
|
|
3
|
-
import { n as defineDatabase } from "./defineDatabase-
|
|
2
|
+
import { t as type } from "./arktypeConfig-CTCJm4vA.js";
|
|
3
|
+
import { n as defineDatabase } from "./defineDatabase-BD3k1L7d.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
5
|
import "./state-B4v8ICj8.js";
|
|
6
6
|
import { a as setTenantIdResolver, i as hasTenantId, r as getTenantId } from "./context-Cwe1IsnH.js";
|
|
@@ -159,6 +159,45 @@ function discoverDatabaseFiles(options) {
|
|
|
159
159
|
return results;
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
|
+
* Recursively find action-defining files under the databases directory.
|
|
163
|
+
*
|
|
164
|
+
* The generated Durable Object module side-effect-imports these so every
|
|
165
|
+
* `action()` runs its `registerAction(...)` at DO startup — populating the
|
|
166
|
+
* action registry in the DO's isolate. Without this the registry is only
|
|
167
|
+
* populated by whatever the request path imported, which works in dev (one
|
|
168
|
+
* shared isolate) and via in-app navigation, but a Durable Object is a separate
|
|
169
|
+
* persistent isolate in production: a freshly deep-linked route whose action the
|
|
170
|
+
* DO never loaded throws `Unknown action "X" (was it imported?)`.
|
|
171
|
+
*
|
|
172
|
+
* Returns absolute paths of `.ts`/`.tsx` files that call `action(` (the factory
|
|
173
|
+
* invocation), excluding tests, declarations, and `_`-prefixed helpers. Helper
|
|
174
|
+
* modules without their own actions are pulled in transitively by the action
|
|
175
|
+
* files that import them, so they don't need to be listed here.
|
|
176
|
+
*/
|
|
177
|
+
function discoverActionFiles(options) {
|
|
178
|
+
const { projectRoot, databasesDir } = options;
|
|
179
|
+
const absoluteDir = path.join(projectRoot, databasesDir);
|
|
180
|
+
if (!fs.existsSync(absoluteDir)) return [];
|
|
181
|
+
const results = [];
|
|
182
|
+
const walk = (dir) => {
|
|
183
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
184
|
+
if (entry.name.startsWith("_") || entry.name === "node_modules") continue;
|
|
185
|
+
const full = path.join(dir, entry.name);
|
|
186
|
+
if (entry.isDirectory()) {
|
|
187
|
+
walk(full);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if (!/\.tsx?$/.test(entry.name)) continue;
|
|
191
|
+
if (/\.d\.ts$/.test(entry.name) || /\.(test|spec)\.tsx?$/.test(entry.name)) continue;
|
|
192
|
+
try {
|
|
193
|
+
if (/\baction\s*\(/.test(fs.readFileSync(full, "utf-8"))) results.push(full);
|
|
194
|
+
} catch {}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
walk(absoluteDir);
|
|
198
|
+
return results;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
162
201
|
* Resolve an import path to an absolute path.
|
|
163
202
|
*
|
|
164
203
|
* Relative imports (starting with `.`) are the fast path — resolved directly
|
|
@@ -390,4 +429,4 @@ function toScreamingSnakeCase(str) {
|
|
|
390
429
|
}
|
|
391
430
|
|
|
392
431
|
//#endregion
|
|
393
|
-
export {
|
|
432
|
+
export { readFile as a, discoverDatabaseFiles as i, parseDatabaseFile as n, resolveImportPath as o, discoverActionFiles as r, loadViteAliases as s, BABEL_PARSER_PLUGINS as t };
|
|
@@ -2,7 +2,7 @@ import { i as init_debug, t as debugCli } from "./debug-DmBrUmwe.js";
|
|
|
2
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
4
|
import { s as loadSnapshot, t as buildAndLoadSchema } from "./generator-DyrLOnPS.js";
|
|
5
|
-
import { a as
|
|
5
|
+
import { a as readFile, i as discoverDatabaseFiles, n as parseDatabaseFile, o as resolveImportPath, s as loadViteAliases } from "./parser-CzKUWwk1.js";
|
|
6
6
|
import * as path from "node:path";
|
|
7
7
|
import * as crypto from "node:crypto";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "./debug-DmBrUmwe.js";
|
|
|
2
2
|
import "./state-B4v8ICj8.js";
|
|
3
3
|
import "./snapshot-DMW6j2Ix.js";
|
|
4
4
|
import "./generator-DyrLOnPS.js";
|
|
5
|
-
import "./parser-
|
|
6
|
-
import { n as pushOne, t as push } from "./push-
|
|
5
|
+
import "./parser-CzKUWwk1.js";
|
|
6
|
+
import { n as pushOne, t as push } from "./push-CAgrAjKM.js";
|
|
7
7
|
|
|
8
8
|
export { push };
|
package/dist/registry.d.ts
CHANGED
package/dist/registry.js
CHANGED
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-
|
|
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-BCjqTRvV.js";
|
|
2
2
|
export { AnySQLiteColumn, blob, foreignKey, index, integer, numeric, primaryKey, real, table, text, uniqueIndex };
|
package/dist/testing/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../debug-DmBrUmwe.js";
|
|
2
|
-
import { t as type } from "../
|
|
3
|
-
import { t as ACTION_TEST_META } from "../defineDatabase-
|
|
2
|
+
import { t as type } from "../arktypeConfig-CTCJm4vA.js";
|
|
3
|
+
import { t as ACTION_TEST_META } from "../defineDatabase-BD3k1L7d.js";
|
|
4
4
|
import "../state-B4v8ICj8.js";
|
|
5
5
|
import { a as setTenantIdResolver } from "../context-Cwe1IsnH.js";
|
|
6
6
|
import { t as createKyselyFromSql } from "../kysely-yPsCWEvR.js";
|
package/dist/vite/durableDb.js
CHANGED
|
@@ -2,7 +2,7 @@ import { i as init_debug, r as debugVite } from "../debug-DmBrUmwe.js";
|
|
|
2
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
4
|
import { a as loadMigrationFiles } from "../generator-DyrLOnPS.js";
|
|
5
|
-
import {
|
|
5
|
+
import { a as readFile, i as discoverDatabaseFiles, n as parseDatabaseFile, r as discoverActionFiles, t as BABEL_PARSER_PLUGINS } from "../parser-CzKUWwk1.js";
|
|
6
6
|
import * as fs from "node:fs";
|
|
7
7
|
import * as path from "node:path";
|
|
8
8
|
import { parse } from "@babel/parser";
|
|
@@ -340,12 +340,16 @@ function generateWithMap(ast, sourceFileName) {
|
|
|
340
340
|
comments: true
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
|
-
function generateDurableObjectsModule(databases, registryImport, isDev = false) {
|
|
343
|
+
function generateDurableObjectsModule(databases, registryImport, isDev = false, actionFiles = []) {
|
|
344
344
|
const bindingNamesExpr = buildBindingNamesObject(databases);
|
|
345
345
|
const dbTransportsExpr = buildDbTransportsObject(databases);
|
|
346
346
|
const anyBrowsable = databases.some((db) => db.browsable === true || db.browsable === "development" && isDev);
|
|
347
347
|
const anyWebSocket = databases.some((db) => db.transport === "websocket");
|
|
348
|
-
const imports = [
|
|
348
|
+
const imports = [
|
|
349
|
+
createNamedImport(["SqliteDurableObject", "type"], "durable-db/db"),
|
|
350
|
+
createNamedImport(["getAction", "runWithDoContext"], registryImport),
|
|
351
|
+
...actionFiles.map((file) => t.importDeclaration([], t.stringLiteral(file)))
|
|
352
|
+
];
|
|
349
353
|
if (anyBrowsable) imports.push(createNamedImport(["Browsable"], "@outerbase/browsable-durable-object"));
|
|
350
354
|
if (anyWebSocket) imports.push(createNamedImport(["decodeRequest", "encodeResponse"], "durable-db/transport/protocol"));
|
|
351
355
|
const statements = [...imports];
|
|
@@ -993,9 +997,18 @@ function durableDb(options = {}) {
|
|
|
993
997
|
if (id !== VIRTUAL_DO_MODULE_ID) return null;
|
|
994
998
|
await state.initialize();
|
|
995
999
|
const isDev = state.config.command === "serve";
|
|
996
|
-
|
|
1000
|
+
const actionFiles = discoverActionFiles({
|
|
1001
|
+
projectRoot: state.projectRoot,
|
|
1002
|
+
databasesDir: state.options.databasesDir
|
|
1003
|
+
});
|
|
1004
|
+
return { code: generateDurableObjectsModule(Array.from(state.databases.values()), state.options.registryImport, isDev, actionFiles) };
|
|
997
1005
|
},
|
|
998
1006
|
async transform(code, id) {
|
|
1007
|
+
if (/[\\/]drizzle-orm[\\/]/.test(id)) return {
|
|
1008
|
+
code,
|
|
1009
|
+
map: null,
|
|
1010
|
+
moduleSideEffects: true
|
|
1011
|
+
};
|
|
999
1012
|
if (id.startsWith("\0") || id.includes("node_modules")) return null;
|
|
1000
1013
|
if (!/\.tsx?$/.test(id)) return null;
|
|
1001
1014
|
await state.initialize();
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|