nitro-drizzle 0.2.9 → 0.2.11
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/config/defineConfig.d.mts +0 -1
- package/dist/context.d.mts +0 -5
- package/dist/context.mjs.map +1 -1
- package/dist/dialects/index.d.mts +3 -4
- package/dist/dialects/mysql.d.mts +0 -1
- package/dist/dialects/postgresql.d.mts +0 -1
- package/dist/dialects/sqlite.d.mts +0 -1
- package/dist/drivers/d1-http.d.mts +5 -3
- package/dist/drivers/d1.d.mts +2 -2
- package/dist/drivers/db0.d.mts +0 -1
- package/dist/drivers/mysql.d.mts +2 -2
- package/dist/drivers/pglite.d.mts +3 -2
- package/dist/drivers/postgresql.d.mts +2 -2
- package/dist/drivers/sqlite.d.mts +2 -2
- package/dist/meta.d.mts +0 -1
- package/dist/migrations/internal/migrate.d.mts +3 -2
- package/dist/migrations/migrate.d.mts +0 -1
- package/dist/migrations/task.d.mts +0 -1
- package/dist/migrations/useMigrations.d.mts +0 -1
- package/dist/module/internal/resolver.mjs +0 -5
- package/dist/module/internal/resolver.mjs.map +1 -1
- package/dist/module/utils/assets.d.mts +6 -0
- package/dist/module/{internal → utils}/assets.mjs +1 -1
- package/dist/module/utils/assets.mjs.map +1 -0
- package/dist/module/utils/externals.d.mts +6 -0
- package/dist/module/{internal → utils}/externals.mjs +1 -1
- package/dist/module/utils/externals.mjs.map +1 -0
- package/dist/module.d.mts +14 -6
- package/dist/module.mjs +3 -3
- package/dist/module.mjs.map +1 -1
- package/dist/plugins/migrate.d.mts +0 -1
- package/dist/runtime/useDatasource.d.mts +2 -2
- package/dist/runtime.d.mts +5 -6
- package/dist/shared.d.mts +0 -1
- package/dist/utils/usePrimaryKey.d.mts +0 -1
- package/package.json +11 -12
- package/dist/module/internal/assets.mjs.map +0 -1
- package/dist/module/internal/externals.mjs.map +0 -1
package/dist/context.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { Config } from "drizzle-kit";
|
|
|
2
2
|
import { ConsolaInstance } from "consola";
|
|
3
3
|
import { MaybePromise, VirtualModules } from "nitro-drizzle/shared";
|
|
4
4
|
import { ServerAssetDir } from "nitropack/types";
|
|
5
|
-
|
|
6
5
|
//#region src/context/index.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Context interface for managing Drizzle datasource configurations.
|
|
@@ -30,10 +29,6 @@ interface Resolver {
|
|
|
30
29
|
* Resolves a module ID to its full path.
|
|
31
30
|
*/
|
|
32
31
|
resolve(id: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Attempts to resolve a module ID, returns undefined if not found.
|
|
35
|
-
*/
|
|
36
|
-
tryResolve(id: string): string | undefined;
|
|
37
32
|
}
|
|
38
33
|
type ContextHook<TArgs extends readonly any[] = []> = (this: void, ...args: TArgs) => MaybePromise<void>;
|
|
39
34
|
interface MigrationOptions {
|
package/dist/context.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.mjs","names":["#options","#datasources"],"sources":["../src/context/index.ts"],"sourcesContent":["import type { ConsolaInstance } from \"consola\";\nimport { colorize, type ColorName } from \"consola/utils\";\nimport type { Config, Config as DrizzleConfig } from \"drizzle-kit\";\nimport { loadConfig } from \"c12\";\nimport { pkgDir, pkgName } from \"nitro-drizzle/meta\";\n\nimport { mapAsync } from \"./internal/async\";\nimport { accent } from \"./internal/logger\";\nimport { resolveFiles } from \"./internal/fs\";\nimport {\n dialectDeclarations,\n genReference,\n moduleTypeDeclarations,\n runtimeDeclarations,\n} from \"./internal/templates\";\nimport { transformDrizzleConfig } from \"./internal/config\";\nimport {\n dialectVirtualModules,\n migrationsVirtualModule,\n runtimeVirtualModule,\n} from \"./internal/virtual\";\n\nimport type { MaybePromise, VirtualModules } from \"nitro-drizzle/shared\";\nimport type { ServerAssetDir } from \"nitropack/types\";\nimport { join } from \"pathe\";\n\n/**\n * Context interface for managing Drizzle datasource configurations.\n */\nexport interface Context {\n init(): MaybePromise<void>;\n /**\n * Reloads the context, clearing any cached datasource information.\n */\n reload(): MaybePromise<void>;\n /**\n * Returns a list of all resolved datasource information.\n */\n datasources(): MaybePromise<DatasourceInfo[]>;\n}\n\nclass DefaultContext implements Context {\n #datasources: DatasourceInfo[] | null = null;\n readonly #options: ContextOptions;\n\n constructor(options: ContextOptions) {\n this.#options = options;\n }\n\n async init(): Promise<void> {\n const datasources = await this.datasources();\n\n await this.#options.plugins(this.enabledPlugins());\n\n const [virtualModules, virtualTypes, moduleTypes, runtimeTypes] = await Promise.all([\n this.virtualModules(datasources),\n this.virtualTypeDeclarations(datasources),\n this.moduleTypeDeclarations(datasources),\n this.runtimeTypeDeclarations(datasources),\n ]);\n\n await this.#options.virtualModules(virtualModules);\n\n await this.#options.declarations({\n virtual: virtualTypes,\n module: moduleTypes,\n runtime: runtimeTypes,\n });\n\n if (this.#options.migrations) {\n const assets = await this.migrationAssets(datasources);\n if (assets) {\n await this.#options.assets(assets);\n }\n\n await this.#options.tasks?.({\n \"drizzle:migrate\": {\n description: \"Run drizzle migrations for a datasource.\",\n handler: \"nitro-drizzle/migrations/task\",\n },\n });\n }\n\n if (this.#options.inlineExternals) {\n const inlineModuleIds = [\"runtime\", \"plugins\", \"migrations\"].flatMap((id) => {\n return [join(pkgName, id), join(pkgDir, \"dist\", id)];\n });\n\n await this.#options.inlineExternals(inlineModuleIds);\n }\n }\n\n async datasources() {\n const {\n logger,\n baseDir,\n configPattern,\n resolver,\n datasource: datasourceOptions,\n } = this.#options;\n\n if (!this.#datasources) {\n logger?.info(\"Searching drizzle datasources in\", colorize(\"blue\", baseDir));\n\n const drizzleConfigsResolvedPaths = await resolveFiles(\n baseDir,\n [configPattern].flat().map((pattern) => \"*/\" + pattern),\n );\n\n let datasources: DatasourceInfo[] = await mapAsync(\n drizzleConfigsResolvedPaths,\n async (path) => {\n const { config } = await loadConfig<DrizzleConfig>({\n configFile: path,\n });\n const [_, dirName] = path.match(/(.+\\/(.+))\\/.+$/)!.slice(1, 3) as [string, string];\n\n return await transformDrizzleConfig(config, {\n cwd: this.#options.cwd,\n path,\n dirName,\n resolver,\n });\n },\n );\n\n datasources = Object.entries(datasourceOptions).reduce((_datasources, [name, options]) => {\n const datasource = datasources.find(\n (d) => d.name == name && options.connector == (d.driver ? d.driver : d.dialect),\n );\n if (!datasource) {\n return _datasources;\n }\n return [..._datasources, datasource];\n }, [] as DatasourceInfo[]);\n\n logger?.info(\n \"Found drizzle datasources:\",\n datasources\n .toSorted((datasource) => {\n return datasource.enabled ? -1 : 1;\n })\n .map((datasource) => {\n let msg = [datasource.name];\n let color: ColorName;\n if (datasource.enabled) {\n color = \"greenBright\";\n } else {\n color = \"gray\";\n msg.push(\"(disabled)\");\n }\n return colorize(color, msg.join(\" \"));\n })\n .join(\", \"),\n );\n\n const enabledDatasources = datasources.filter((d) => d.enabled);\n\n logger?.info(\n accent`Using ${enabledDatasources.length} of ${datasources.length} resolved datasources` +\n (enabledDatasources.length > 0 ? \":\" : \"\"),\n enabledDatasources\n .map((datasource) => {\n return [\n colorize(\"greenBright\", datasource.name),\n colorize(\"yellow\", \"(\" + (datasource.driver || datasource.dialect) + \")\"),\n ].join(\" \");\n })\n .join(\", \"),\n );\n\n this.#datasources = datasources;\n }\n\n return this.#datasources;\n }\n\n private async migrationAssets(\n datasources: readonly DatasourceInfo[],\n ): Promise<readonly ServerAssetDir[]> {\n const migrationOptions = this.#options.migrations;\n\n if (!migrationOptions) {\n return [];\n }\n\n return datasources.reduce((acc, { name, migrations }) => {\n const dir = migrations.assets;\n if (dir) {\n acc.push({\n baseName: `${migrationOptions.storageBase}:${name}`,\n dir,\n /**\n * @todo Doesn't work in dev mode - 'fs' driver does not support 'pattern'\n * Disabled - include all files to use with meta/_journal.json\n */\n // pattern: '*.sql',\n });\n }\n return acc;\n }, [] as ServerAssetDir[]);\n }\n\n private async virtualTypeDeclarations(\n datasources: readonly DatasourceInfo[],\n ): Promise<Record<string, VirtualModules<`${string}.d.ts`>>> {\n return {\n \"#nitro-drizzle/*\": {\n \"nitro-drizzle/virtual.d.ts\": [dialectDeclarations(datasources)].join(\"\\n\"),\n },\n };\n }\n\n private enabledPlugins(): readonly string[] {\n const plugins: (\"init\" | \"migrate\")[] = [];\n\n const migrationOptions = this.#options.migrations;\n const enableMigrationPlugin = migrationOptions\n ? Array.isArray(migrationOptions)\n ? 0 < migrationOptions.length\n : true == migrationOptions.migrateOnInit\n : false;\n\n if (enableMigrationPlugin) {\n plugins.push(\"migrate\");\n }\n\n plugins.push(\"init\");\n\n const pluginIds = plugins.map((pluginName) => `nitro-drizzle/plugins/${pluginName}`);\n\n return pluginIds;\n }\n\n private async moduleTypeDeclarations(\n datasources: readonly DatasourceInfo[],\n ): Promise<VirtualModules> {\n return moduleTypeDeclarations(datasources);\n }\n\n private async runtimeTypeDeclarations(\n datasources: readonly DatasourceInfo[],\n ): Promise<VirtualModules<`${string}.d.ts`>> {\n const references = new Set([\n { types: \"nitro-drizzle/runtime\" },\n ...this.enabledPlugins().map((pluginId) => {\n return { types: pluginId };\n }),\n ]);\n const content = [\n ...[...references.values()].map((reference) => genReference(reference)),\n runtimeDeclarations(datasources),\n /* ts */ `export {};`,\n ].join(\"\\n\");\n return {\n \"nitro-drizzle/runtime.d.ts\": content,\n };\n }\n\n private async virtualModules(\n datasources: readonly DatasourceInfo[],\n ): Promise<VirtualModules<`#nitro-drizzle/${string}`>> {\n return {\n \"#nitro-drizzle/runtime\": runtimeVirtualModule(datasources),\n ...dialectVirtualModules(datasources),\n ...migrationsVirtualModule(datasources, this.#options.migrations),\n };\n }\n\n reload() {\n this.#datasources = null;\n }\n}\n\n/**\n * Glob pattern or array of patterns to match Drizzle configuration files.\n */\nexport type ConfigPattern = string | readonly string[];\n\n/**\n * Resolver interface for importing modules and resolving paths.\n */\nexport interface Resolver {\n /**\n * Resolves a module ID to its full path.\n */\n resolve(id: string): string;\n /**\n * Attempts to resolve a module ID, returns undefined if not found.\n */\n tryResolve(id: string): string | undefined;\n}\n\nexport type ContextHook<TArgs extends readonly any[] = []> = (\n this: void,\n ...args: TArgs\n) => MaybePromise<void>;\n\nexport interface MigrationOptions {\n /** Base storage key path for migrations. */\n storageBase: string;\n /** Whether and which datasources to migrate on initialization. */\n migrateOnInit: boolean | readonly string[];\n}\n\nexport interface ContextOptions {\n logger?: ConsolaInstance;\n /**\n * Current working directory\n */\n cwd: string;\n /**\n * Base project directory to search drizzle config files\n */\n baseDir: string;\n /**\n * Pattern for drizzle config files\n */\n configPattern: ConfigPattern;\n /**\n * Nuxt Kit resolver\n */\n resolver: Resolver;\n /**\n * Connector options\n */\n datasource: Record<string, { connector: string }>;\n\n migrations: MigrationOptions | undefined;\n\n tasks?: ContextHook<\n [\n tasks: Record<\n string,\n {\n handler: string;\n description: string;\n }\n >,\n ]\n >;\n\n plugins: ContextHook<[plugins: readonly string[]]>;\n\n declarations: ContextHook<\n [\n declarations: {\n module: VirtualModules<`${string}.d.ts`>;\n runtime: VirtualModules<`${string}.d.ts`>;\n virtual: Record<string, VirtualModules<`${string}.d.ts`>>;\n },\n ]\n >;\n\n virtualModules: ContextHook<[modules: VirtualModules]>;\n\n assets: ContextHook<[assets: readonly ServerAssetDir[]]>;\n\n inlineExternals?: ContextHook<[modules: readonly string[]]>;\n}\n\n/**\n * Creates a Context instance for managing Drizzle datasource configurations.\n * @param options - Configuration options for the context\n * @returns A Context instance\n */\nexport function createContext(options: ContextOptions): Context {\n return new DefaultContext(options);\n}\n\n/**\n * Information about a resolved Drizzle datasource.\n */\nexport interface DatasourceInfo {\n /** Directory name of the datasource (derived from config file location). */\n dirName: string;\n /** Unique name identifier for the datasource. */\n name: string;\n /** Whether the datasource is enabled (filtered by connector configuration). */\n enabled: boolean;\n /** Database dialect (e.g., 'sqlite', 'postgresql', 'mysql'). */\n dialect: string;\n /** Driver type if specified in config, otherwise undefined. */\n driver: string | undefined;\n /** Import paths for schema, connector, and helpers. */\n imports: {\n config: string;\n schema: string[];\n connector: string;\n helpers: string;\n };\n /** Migration configuration for this datasource. */\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ACL,0BAA0B,qBAAqB,WAAW;GAC1D,GAAG,sBAAsB,WAAW;GACpC,GAAG,wBAAwB,aAAa,KAAKA,SAAS,UAAU;EAClE;CACF;CAEA,SAAS;EACP,KAAKC,eAAe;CACtB;AACF;;;;;;AA8FA,SAAgB,cAAc,SAAkC;CAC9D,OAAO,IAAI,eAAe,OAAO;AACnC"}
|
|
1
|
+
{"version":3,"file":"context.mjs","names":["#options","#datasources"],"sources":["../src/context/index.ts"],"sourcesContent":["import type { ConsolaInstance } from \"consola\";\nimport { colorize, type ColorName } from \"consola/utils\";\nimport type { Config, Config as DrizzleConfig } from \"drizzle-kit\";\nimport { loadConfig } from \"c12\";\nimport { pkgDir, pkgName } from \"nitro-drizzle/meta\";\n\nimport { mapAsync } from \"./internal/async\";\nimport { accent } from \"./internal/logger\";\nimport { resolveFiles } from \"./internal/fs\";\nimport {\n dialectDeclarations,\n genReference,\n moduleTypeDeclarations,\n runtimeDeclarations,\n} from \"./internal/templates\";\nimport { transformDrizzleConfig } from \"./internal/config\";\nimport {\n dialectVirtualModules,\n migrationsVirtualModule,\n runtimeVirtualModule,\n} from \"./internal/virtual\";\n\nimport type { MaybePromise, VirtualModules } from \"nitro-drizzle/shared\";\nimport type { ServerAssetDir } from \"nitropack/types\";\nimport { join } from \"pathe\";\n\n/**\n * Context interface for managing Drizzle datasource configurations.\n */\nexport interface Context {\n init(): MaybePromise<void>;\n /**\n * Reloads the context, clearing any cached datasource information.\n */\n reload(): MaybePromise<void>;\n /**\n * Returns a list of all resolved datasource information.\n */\n datasources(): MaybePromise<DatasourceInfo[]>;\n}\n\nclass DefaultContext implements Context {\n #datasources: DatasourceInfo[] | null = null;\n readonly #options: ContextOptions;\n\n constructor(options: ContextOptions) {\n this.#options = options;\n }\n\n async init(): Promise<void> {\n const datasources = await this.datasources();\n\n await this.#options.plugins(this.enabledPlugins());\n\n const [virtualModules, virtualTypes, moduleTypes, runtimeTypes] = await Promise.all([\n this.virtualModules(datasources),\n this.virtualTypeDeclarations(datasources),\n this.moduleTypeDeclarations(datasources),\n this.runtimeTypeDeclarations(datasources),\n ]);\n\n await this.#options.virtualModules(virtualModules);\n\n await this.#options.declarations({\n virtual: virtualTypes,\n module: moduleTypes,\n runtime: runtimeTypes,\n });\n\n if (this.#options.migrations) {\n const assets = await this.migrationAssets(datasources);\n if (assets) {\n await this.#options.assets(assets);\n }\n\n await this.#options.tasks?.({\n \"drizzle:migrate\": {\n description: \"Run drizzle migrations for a datasource.\",\n handler: \"nitro-drizzle/migrations/task\",\n },\n });\n }\n\n if (this.#options.inlineExternals) {\n const inlineModuleIds = [\"runtime\", \"plugins\", \"migrations\"].flatMap((id) => {\n return [join(pkgName, id), join(pkgDir, \"dist\", id)];\n });\n\n await this.#options.inlineExternals(inlineModuleIds);\n }\n }\n\n async datasources() {\n const {\n logger,\n baseDir,\n configPattern,\n resolver,\n datasource: datasourceOptions,\n } = this.#options;\n\n if (!this.#datasources) {\n logger?.info(\"Searching drizzle datasources in\", colorize(\"blue\", baseDir));\n\n const drizzleConfigsResolvedPaths = await resolveFiles(\n baseDir,\n [configPattern].flat().map((pattern) => \"*/\" + pattern),\n );\n\n let datasources: DatasourceInfo[] = await mapAsync(\n drizzleConfigsResolvedPaths,\n async (path) => {\n const { config } = await loadConfig<DrizzleConfig>({\n configFile: path,\n });\n const [_, dirName] = path.match(/(.+\\/(.+))\\/.+$/)!.slice(1, 3) as [string, string];\n\n return await transformDrizzleConfig(config, {\n cwd: this.#options.cwd,\n path,\n dirName,\n resolver,\n });\n },\n );\n\n datasources = Object.entries(datasourceOptions).reduce((_datasources, [name, options]) => {\n const datasource = datasources.find(\n (d) => d.name == name && options.connector == (d.driver ? d.driver : d.dialect),\n );\n if (!datasource) {\n return _datasources;\n }\n return [..._datasources, datasource];\n }, [] as DatasourceInfo[]);\n\n logger?.info(\n \"Found drizzle datasources:\",\n datasources\n .toSorted((datasource) => {\n return datasource.enabled ? -1 : 1;\n })\n .map((datasource) => {\n let msg = [datasource.name];\n let color: ColorName;\n if (datasource.enabled) {\n color = \"greenBright\";\n } else {\n color = \"gray\";\n msg.push(\"(disabled)\");\n }\n return colorize(color, msg.join(\" \"));\n })\n .join(\", \"),\n );\n\n const enabledDatasources = datasources.filter((d) => d.enabled);\n\n logger?.info(\n accent`Using ${enabledDatasources.length} of ${datasources.length} resolved datasources` +\n (enabledDatasources.length > 0 ? \":\" : \"\"),\n enabledDatasources\n .map((datasource) => {\n return [\n colorize(\"greenBright\", datasource.name),\n colorize(\"yellow\", \"(\" + (datasource.driver || datasource.dialect) + \")\"),\n ].join(\" \");\n })\n .join(\", \"),\n );\n\n this.#datasources = datasources;\n }\n\n return this.#datasources;\n }\n\n private async migrationAssets(\n datasources: readonly DatasourceInfo[],\n ): Promise<readonly ServerAssetDir[]> {\n const migrationOptions = this.#options.migrations;\n\n if (!migrationOptions) {\n return [];\n }\n\n return datasources.reduce((acc, { name, migrations }) => {\n const dir = migrations.assets;\n if (dir) {\n acc.push({\n baseName: `${migrationOptions.storageBase}:${name}`,\n dir,\n /**\n * @todo Doesn't work in dev mode - 'fs' driver does not support 'pattern'\n * Disabled - include all files to use with meta/_journal.json\n */\n // pattern: '*.sql',\n });\n }\n return acc;\n }, [] as ServerAssetDir[]);\n }\n\n private async virtualTypeDeclarations(\n datasources: readonly DatasourceInfo[],\n ): Promise<Record<string, VirtualModules<`${string}.d.ts`>>> {\n return {\n \"#nitro-drizzle/*\": {\n \"nitro-drizzle/virtual.d.ts\": [dialectDeclarations(datasources)].join(\"\\n\"),\n },\n };\n }\n\n private enabledPlugins(): readonly string[] {\n const plugins: (\"init\" | \"migrate\")[] = [];\n\n const migrationOptions = this.#options.migrations;\n const enableMigrationPlugin = migrationOptions\n ? Array.isArray(migrationOptions)\n ? 0 < migrationOptions.length\n : true == migrationOptions.migrateOnInit\n : false;\n\n if (enableMigrationPlugin) {\n plugins.push(\"migrate\");\n }\n\n plugins.push(\"init\");\n\n const pluginIds = plugins.map((pluginName) => `nitro-drizzle/plugins/${pluginName}`);\n\n return pluginIds;\n }\n\n private async moduleTypeDeclarations(\n datasources: readonly DatasourceInfo[],\n ): Promise<VirtualModules> {\n return moduleTypeDeclarations(datasources);\n }\n\n private async runtimeTypeDeclarations(\n datasources: readonly DatasourceInfo[],\n ): Promise<VirtualModules<`${string}.d.ts`>> {\n const references = new Set([\n { types: \"nitro-drizzle/runtime\" },\n ...this.enabledPlugins().map((pluginId) => {\n return { types: pluginId };\n }),\n ]);\n const content = [\n ...[...references.values()].map((reference) => genReference(reference)),\n runtimeDeclarations(datasources),\n /* ts */ `export {};`,\n ].join(\"\\n\");\n return {\n \"nitro-drizzle/runtime.d.ts\": content,\n };\n }\n\n private async virtualModules(\n datasources: readonly DatasourceInfo[],\n ): Promise<VirtualModules<`#nitro-drizzle/${string}`>> {\n return {\n \"#nitro-drizzle/runtime\": runtimeVirtualModule(datasources),\n ...dialectVirtualModules(datasources),\n ...migrationsVirtualModule(datasources, this.#options.migrations),\n };\n }\n\n reload() {\n this.#datasources = null;\n }\n}\n\n/**\n * Glob pattern or array of patterns to match Drizzle configuration files.\n */\nexport type ConfigPattern = string | readonly string[];\n\n/**\n * Resolver interface for importing modules and resolving paths.\n */\nexport interface Resolver {\n /**\n * Resolves a module ID to its full path.\n */\n resolve(id: string): string;\n}\n\nexport type ContextHook<TArgs extends readonly any[] = []> = (\n this: void,\n ...args: TArgs\n) => MaybePromise<void>;\n\nexport interface MigrationOptions {\n /** Base storage key path for migrations. */\n storageBase: string;\n /** Whether and which datasources to migrate on initialization. */\n migrateOnInit: boolean | readonly string[];\n}\n\nexport interface ContextOptions {\n logger?: ConsolaInstance;\n /**\n * Current working directory\n */\n cwd: string;\n /**\n * Base project directory to search drizzle config files\n */\n baseDir: string;\n /**\n * Pattern for drizzle config files\n */\n configPattern: ConfigPattern;\n /**\n * Nuxt Kit resolver\n */\n resolver: Resolver;\n /**\n * Connector options\n */\n datasource: Record<string, { connector: string }>;\n\n migrations: MigrationOptions | undefined;\n\n tasks?: ContextHook<\n [\n tasks: Record<\n string,\n {\n handler: string;\n description: string;\n }\n >,\n ]\n >;\n\n plugins: ContextHook<[plugins: readonly string[]]>;\n\n declarations: ContextHook<\n [\n declarations: {\n module: VirtualModules<`${string}.d.ts`>;\n runtime: VirtualModules<`${string}.d.ts`>;\n virtual: Record<string, VirtualModules<`${string}.d.ts`>>;\n },\n ]\n >;\n\n virtualModules: ContextHook<[modules: VirtualModules]>;\n\n assets: ContextHook<[assets: readonly ServerAssetDir[]]>;\n\n inlineExternals?: ContextHook<[modules: readonly string[]]>;\n}\n\n/**\n * Creates a Context instance for managing Drizzle datasource configurations.\n * @param options - Configuration options for the context\n * @returns A Context instance\n */\nexport function createContext(options: ContextOptions): Context {\n return new DefaultContext(options);\n}\n\n/**\n * Information about a resolved Drizzle datasource.\n */\nexport interface DatasourceInfo {\n /** Directory name of the datasource (derived from config file location). */\n dirName: string;\n /** Unique name identifier for the datasource. */\n name: string;\n /** Whether the datasource is enabled (filtered by connector configuration). */\n enabled: boolean;\n /** Database dialect (e.g., 'sqlite', 'postgresql', 'mysql'). */\n dialect: string;\n /** Driver type if specified in config, otherwise undefined. */\n driver: string | undefined;\n /** Import paths for schema, connector, and helpers. */\n imports: {\n config: string;\n schema: string[];\n connector: string;\n helpers: string;\n };\n /** Migration configuration for this datasource. */\n migrations: {\n assets?: string;\n config?: Config[\"migrations\"];\n };\n}\n"],"mappings":";;;;;;;;;;;AAyCA,IAAM,iBAAN,MAAwC;CACtC,eAAwC;CACxC;CAEA,YAAY,SAAyB;EACnC,KAAKA,WAAW;CAClB;CAEA,MAAM,OAAsB;EAC1B,MAAM,cAAc,MAAM,KAAK,YAAY;EAE3C,MAAM,KAAKA,SAAS,QAAQ,KAAK,eAAe,CAAC;EAEjD,MAAM,CAAC,gBAAgB,cAAc,aAAa,gBAAgB,MAAM,QAAQ,IAAI;GAClF,KAAK,eAAe,WAAW;GAC/B,KAAK,wBAAwB,WAAW;GACxC,KAAK,uBAAuB,WAAW;GACvC,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oBAAoB,EAClB,8BAA8B,CAAC,oBAAoB,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAC5E,EACF;CACF;CAEA,iBAA4C;EAC1C,MAAM,UAAkC,CAAC;EAEzC,MAAM,mBAAmB,KAAKA,SAAS;EAOvC,IAN8B,mBAC1B,MAAM,QAAQ,gBAAgB,IAC5B,IAAI,iBAAiB,SACrB,QAAQ,iBAAiB,gBAC3B,OAGF,QAAQ,KAAK,SAAS;EAGxB,QAAQ,KAAK,MAAM;EAInB,OAFkB,QAAQ,KAAK,eAAe,yBAAyB,YAExD;CACjB;CAEA,MAAc,uBACZ,aACyB;EACzB,OAAO,uBAAuB,WAAW;CAC3C;CAEA,MAAc,wBACZ,aAC2C;EAY3C,OAAO,EACL,8BANc;GACd,GAAG,CAAC,oBAAG,IAPc,IAAI,CACzB,EAAE,OAAO,wBAAwB,GACjC,GAAG,KAAK,eAAe,CAAC,CAAC,KAAK,aAAa;IACzC,OAAO,EAAE,OAAO,SAAS;GAC3B,CAAC,CACH,CAEkB,EAAA,CAAE,OAAO,CAAC,CAAC,CAAC,KAAK,cAAc,aAAa,SAAS,CAAC;GACtE,oBAAoB,WAAW;GACtB;EACX,CAAC,CAAC,KAAK,IAE+B,EACtC;CACF;CAEA,MAAc,eACZ,aACqD;EACrD,OAAO;GACL,0BAA0B,qBAAqB,WAAW;GAC1D,GAAG,sBAAsB,WAAW;GACpC,GAAG,wBAAwB,aAAa,KAAKA,SAAS,UAAU;EAClE;CACF;CAEA,SAAS;EACP,KAAKC,eAAe;CACtB;AACF;;;;;;AA0FA,SAAgB,cAAc,SAAkC;CAC9D,OAAO,IAAI,eAAe,OAAO;AACnC"}
|
|
@@ -5,7 +5,6 @@ import { Column, SQL, Table } from "drizzle-orm";
|
|
|
5
5
|
import { SQLiteInsertBase } from "drizzle-orm/sqlite-core";
|
|
6
6
|
import { MySqlInsertBase } from "drizzle-orm/mysql-core";
|
|
7
7
|
import { PgInsertBase } from "drizzle-orm/pg-core";
|
|
8
|
-
|
|
9
8
|
//#region src/dialects/index.d.ts
|
|
10
9
|
interface OnConflictOptions<TSet extends Record<string, SQL | undefined>> {
|
|
11
10
|
set: TSet;
|
|
@@ -14,7 +13,7 @@ interface OnConflictOptions<TSet extends Record<string, SQL | undefined>> {
|
|
|
14
13
|
* Options for ON CONFLICT DO UPDATE clause.
|
|
15
14
|
* @template T - The insert type
|
|
16
15
|
*/
|
|
17
|
-
type OnConflictDoUpdateOptions<T extends AnyInsert> = OnConflictOptions<{ [K in keyof InferColumns<InferTable<T>>]?: SQL }>;
|
|
16
|
+
type OnConflictDoUpdateOptions<T extends AnyInsert> = OnConflictOptions<{ [K in keyof InferColumns<InferTable<T>>]?: SQL; }>;
|
|
18
17
|
/**
|
|
19
18
|
* Infers column types from a Drizzle table.
|
|
20
19
|
* @template TTable - The table type
|
|
@@ -26,14 +25,14 @@ type AnyInsert = MySqlInsertBase<any, any, any, any, any, any> | PgInsertBase<an
|
|
|
26
25
|
* @template T - The insert type
|
|
27
26
|
*/
|
|
28
27
|
type InferTable<T extends AnyInsert> = T extends MySqlInsertBase<any, any, any, any, any, any> ? InferMysqlTable<T> : T extends PgInsertBase<any, any, any, any, any, any> ? InferPgTable<T> : T extends SQLiteInsertBase<any, any, any, any, any, any> ? InferSqliteTable<T> : never;
|
|
29
|
-
type RemoveNeverProps<T extends Record<string, any>> = { [K in keyof T as T[K] extends never ? never : K]: T[K] };
|
|
28
|
+
type RemoveNeverProps<T extends Record<string, any>> = { [K in keyof T as T[K] extends never ? never : K]: T[K]; };
|
|
30
29
|
/**
|
|
31
30
|
* Infers primary key columns from a Drizzle table.
|
|
32
31
|
* @template T - The table type
|
|
33
32
|
*/
|
|
34
33
|
type InferPrimaryColumns<T extends Table> = RemoveNeverProps<{ [K in keyof InferColumns<T>]: InferColumns<T>[K] extends Column<infer TColumnConfig> ? Extract<TColumnConfig, {
|
|
35
34
|
isPrimaryKey: true;
|
|
36
|
-
}> extends never ? never : InferColumns<T>[K] : never }>;
|
|
35
|
+
}> extends never ? never : InferColumns<T>[K] : never; }>;
|
|
37
36
|
//#endregion
|
|
38
37
|
export { InferColumns, InferPrimaryColumns, InferTable, OnConflictDoUpdateOptions };
|
|
39
38
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Schema } from "./index.mjs";
|
|
2
2
|
import { DrizzleConfig } from "drizzle-orm";
|
|
3
3
|
import { AsyncBatchRemoteCallback, AsyncRemoteCallback, RemoteCallback, SqliteRemoteDatabase } from "drizzle-orm/sqlite-proxy";
|
|
4
|
-
|
|
5
4
|
//#region src/drivers/d1-http.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Cloudflare D1 HTTP datasource driver for remote connections.
|
|
@@ -18,8 +17,11 @@ declare const driver: <TSchema extends Schema>(options: D1HttpOptions, schema: T
|
|
|
18
17
|
};
|
|
19
18
|
/** Configuration options for the Cloudflare D1 HTTP driver. */
|
|
20
19
|
type D1HttpOptions = {
|
|
21
|
-
/** Cloudflare account ID. */
|
|
22
|
-
|
|
20
|
+
/** Cloudflare account ID. */
|
|
21
|
+
accountId: string;
|
|
22
|
+
/** D1 database ID. */
|
|
23
|
+
databaseId: string;
|
|
24
|
+
/** API token for authentication. */
|
|
23
25
|
token: string;
|
|
24
26
|
};
|
|
25
27
|
/** Internal type for the HTTP driver callback functions. */
|
package/dist/drivers/d1.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DrizzleD1Database } from "drizzle-orm/d1";
|
|
2
2
|
import { D1Database } from "@cloudflare/workers-types";
|
|
3
|
-
|
|
4
3
|
//#region src/drivers/d1.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Cloudflare D1 datasource driver.
|
|
@@ -19,7 +18,8 @@ declare const _default: <TSchema extends Record<string, any>>(options: D1Options
|
|
|
19
18
|
}>;
|
|
20
19
|
/** Configuration options for the Cloudflare D1 driver. */
|
|
21
20
|
type D1Options = {
|
|
22
|
-
/** The binding name for the D1 database in Cloudflare Workers. */
|
|
21
|
+
/** The binding name for the D1 database in Cloudflare Workers. */
|
|
22
|
+
binding: string;
|
|
23
23
|
};
|
|
24
24
|
//#endregion
|
|
25
25
|
export { D1Options, _default as default };
|
package/dist/drivers/db0.d.mts
CHANGED
package/dist/drivers/mysql.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Schema } from "./index.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/drivers/mysql.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* MySQL datasource driver using mysql2.
|
|
@@ -20,7 +19,8 @@ declare const _default: <TSchema extends Schema>(config: Options, schema: TSchem
|
|
|
20
19
|
* Configuration options for the MySQL driver.
|
|
21
20
|
*/
|
|
22
21
|
type Options = {
|
|
23
|
-
/** Database connection URL. */
|
|
22
|
+
/** Database connection URL. */
|
|
23
|
+
url: string;
|
|
24
24
|
};
|
|
25
25
|
//#endregion
|
|
26
26
|
export { Options, _default as default };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Schema } from "./index.mjs";
|
|
2
2
|
import { PGlite, PGliteOptions } from "@electric-sql/pglite";
|
|
3
|
-
|
|
4
3
|
//#region src/drivers/pglite.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* PGlite datasource driver for PostgreSQL in the browser.
|
|
@@ -21,7 +20,9 @@ declare const _default: <TSchema extends Schema>(options: PGliteOptions, schema:
|
|
|
21
20
|
* Configuration options for the PGlite driver.
|
|
22
21
|
*/
|
|
23
22
|
type Config = {
|
|
24
|
-
/** Directory path for storing database data. */
|
|
23
|
+
/** Directory path for storing database data. */
|
|
24
|
+
dataDir?: string;
|
|
25
|
+
/** Additional PGlite options. */
|
|
25
26
|
options?: PGliteOptions;
|
|
26
27
|
};
|
|
27
28
|
//#endregion
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import createPostgres, { Options as Options$1 } from "postgres";
|
|
2
|
-
|
|
3
2
|
//#region src/drivers/postgresql.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* PostgreSQL datasource driver using postgres.js.
|
|
@@ -20,7 +19,8 @@ declare const _default: <TSchema extends Record<string, any>>(options: Options,
|
|
|
20
19
|
* Configuration options for the PostgreSQL driver.
|
|
21
20
|
*/
|
|
22
21
|
type Options = Options$1<Record<string, createPostgres.PostgresType>> & {
|
|
23
|
-
/** Connection URL string (optional if connection config is provided). */
|
|
22
|
+
/** Connection URL string (optional if connection config is provided). */
|
|
23
|
+
url?: string;
|
|
24
24
|
};
|
|
25
25
|
//#endregion
|
|
26
26
|
export { Options, _default as default };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Schema } from "./index.mjs";
|
|
2
2
|
import sqlite3, { Options as Options$1 } from "better-sqlite3";
|
|
3
|
-
|
|
4
3
|
//#region src/drivers/sqlite.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* SQLite datasource driver using better-sqlite3.
|
|
@@ -21,7 +20,8 @@ declare const _default: <TSchema extends Schema>(config: Options, schema: TSchem
|
|
|
21
20
|
* Configuration options for the SQLite driver.
|
|
22
21
|
*/
|
|
23
22
|
type Options = {
|
|
24
|
-
/** Database file path or URL. */
|
|
23
|
+
/** Database file path or URL. */
|
|
24
|
+
url: string;
|
|
25
25
|
} & Options$1;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { Options, _default as default };
|
package/dist/meta.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { MigrationMeta } from "drizzle-orm/migrator";
|
|
2
|
-
|
|
3
2
|
//#region src/migrations/internal/migrate.d.ts
|
|
4
3
|
/** Configuration options for database migrations. */
|
|
5
4
|
type MigrationConfig = Partial<{
|
|
6
|
-
/** Schema name for migrations. */
|
|
5
|
+
/** Schema name for migrations. */
|
|
6
|
+
schema: string;
|
|
7
|
+
/** Table name for storing migration metadata. */
|
|
7
8
|
table: string;
|
|
8
9
|
}>;
|
|
9
10
|
/** Migration information including SQL statements and metadata. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.mjs","names":["#jiti"],"sources":["../../../src/module/internal/resolver.ts"],"sourcesContent":["import { createJiti, type Jiti, type JitiOptions } from \"jiti\";\nimport type { Resolver } from \"nitro-drizzle/context\";\nimport { fileURLToPath } from \"url\";\n\nexport function createResolver(id: string, options?: { alias?: Record<string, string> }): Resolver {\n return new JitiResolver(id, {\n alias: options?.alias,\n });\n}\n\nclass JitiResolver implements Resolver {\n readonly #jiti: Jiti;\n\n constructor(id: string, options?: JitiOptions) {\n this.#jiti = createJiti(id, options);\n }\n\n resolve(id: string): string {\n return fileURLToPath(this.#jiti.esmResolve(id));\n }\n
|
|
1
|
+
{"version":3,"file":"resolver.mjs","names":["#jiti"],"sources":["../../../src/module/internal/resolver.ts"],"sourcesContent":["import { createJiti, type Jiti, type JitiOptions } from \"jiti\";\nimport type { Resolver } from \"nitro-drizzle/context\";\nimport { fileURLToPath } from \"url\";\n\nexport function createResolver(id: string, options?: { alias?: Record<string, string> }): Resolver {\n return new JitiResolver(id, {\n alias: options?.alias,\n });\n}\n\nclass JitiResolver implements Resolver {\n readonly #jiti: Jiti;\n\n constructor(id: string, options?: JitiOptions) {\n this.#jiti = createJiti(id, options);\n }\n\n resolve(id: string): string {\n return fileURLToPath(this.#jiti.esmResolve(id));\n }\n}\n"],"mappings":";;;AAIA,SAAgB,eAAe,IAAY,SAAwD;CACjG,OAAO,IAAI,aAAa,IAAI,EAC1B,OAAO,SAAS,MAClB,CAAC;AACH;AAEA,IAAM,eAAN,MAAuC;CACrC;CAEA,YAAY,IAAY,SAAuB;EAC7C,KAAKA,QAAQ,WAAW,IAAI,OAAO;CACrC;CAEA,QAAQ,IAAoB;EAC1B,OAAO,cAAc,KAAKA,MAAM,WAAW,EAAE,CAAC;CAChD;AACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NitroConfig, ServerAssetDir } from "nitropack/types";
|
|
2
|
+
//#region src/module/utils/assets.d.ts
|
|
3
|
+
declare function updateServerAssets(config: NitroConfig, assets: readonly ServerAssetDir[]): void;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { updateServerAssets };
|
|
6
|
+
//# sourceMappingURL=assets.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.mjs","names":[],"sources":["../../../src/module/utils/assets.ts"],"sourcesContent":["import type { NitroConfig, ServerAssetDir } from \"nitropack/types\";\n\nexport function updateServerAssets(config: NitroConfig, assets: readonly ServerAssetDir[]) {\n config.serverAssets ||= [];\n config.serverAssets = config.serverAssets\n .filter((_assets) => {\n const baseName = _assets?.baseName;\n if (!baseName) {\n return true;\n }\n return assets.some((assets) => baseName == assets.baseName);\n })\n .concat(assets);\n}\n"],"mappings":";AAEA,SAAgB,mBAAmB,QAAqB,QAAmC;CACzF,OAAO,iBAAiB,CAAC;CACzB,OAAO,eAAe,OAAO,aAC1B,QAAQ,YAAY;EACnB,MAAM,WAAW,SAAS;EAC1B,IAAI,CAAC,UACH,OAAO;EAET,OAAO,OAAO,MAAM,WAAW,YAAY,OAAO,QAAQ;CAC5D,CAAC,CAAC,CACD,OAAO,MAAM;AAClB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NitroOptions } from "nitropack/types";
|
|
2
|
+
//#region src/module/utils/externals.d.ts
|
|
3
|
+
declare function addInlineExternals(nitroOptions: NitroOptions, moduleIds: readonly string[]): void;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { addInlineExternals };
|
|
6
|
+
//# sourceMappingURL=externals.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externals.mjs","names":[],"sources":["../../../src/module/utils/externals.ts"],"sourcesContent":["import type { NitroOptions } from \"nitropack/types\";\n\nexport function addInlineExternals(nitroOptions: NitroOptions, moduleIds: readonly string[]) {\n // @ts-expect-error\n nitroOptions.externals ||= {};\n nitroOptions.externals.inline ||= [];\n nitroOptions.externals.inline.push(...moduleIds);\n}\n"],"mappings":";AAEA,SAAgB,mBAAmB,cAA4B,WAA8B;CAE3F,aAAa,cAAc,CAAC;CAC5B,aAAa,UAAU,WAAW,CAAC;CACnC,aAAa,UAAU,OAAO,KAAK,GAAG,SAAS;AACjD"}
|
package/dist/module.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { updateServerAssets } from "./module/utils/assets.mjs";
|
|
2
|
+
import { addInlineExternals } from "./module/utils/externals.mjs";
|
|
1
3
|
import { ConfigPattern, MigrationOptions } from "nitro-drizzle/context";
|
|
2
4
|
import { NitroModule } from "nitropack/types";
|
|
3
|
-
|
|
4
5
|
//#region src/module/index.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* Datasource-specific configuration options.
|
|
@@ -16,19 +17,26 @@ interface ModuleOptions {
|
|
|
16
17
|
/**
|
|
17
18
|
* Directory to search datasources
|
|
18
19
|
*/
|
|
19
|
-
baseDir
|
|
20
|
+
baseDir?: string;
|
|
20
21
|
/**
|
|
21
22
|
* Patterns to search Drizzle configs
|
|
22
23
|
*/
|
|
23
|
-
configPattern
|
|
24
|
+
configPattern?: ConfigPattern;
|
|
24
25
|
datasources?: DatasourceOptions;
|
|
25
26
|
/**
|
|
26
27
|
* Enable migrations storage
|
|
27
28
|
*/
|
|
28
|
-
migrations
|
|
29
|
+
migrations?: false | Partial<MigrationOptions>;
|
|
29
30
|
}
|
|
30
|
-
declare function createDefaultOptions():
|
|
31
|
+
declare function createDefaultOptions(): {
|
|
32
|
+
readonly baseDir: "~/drizzle";
|
|
33
|
+
readonly configPattern: readonly ["drizzle.config.{js,ts}", "drizzle-*.config.{js,ts}"];
|
|
34
|
+
readonly migrations: {
|
|
35
|
+
readonly storageBase: "drizzle:migrations";
|
|
36
|
+
readonly migrateOnInit: false;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
31
39
|
declare const module: NitroModule;
|
|
32
40
|
//#endregion
|
|
33
|
-
export { DatasourceOptions, ModuleOptions, createDefaultOptions, module as default };
|
|
41
|
+
export { DatasourceOptions, ModuleOptions, addInlineExternals, createDefaultOptions, module as default, updateServerAssets };
|
|
34
42
|
//# sourceMappingURL=module.d.mts.map
|
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { updateServerAssets } from "./module/utils/assets.mjs";
|
|
2
|
+
import { addInlineExternals } from "./module/utils/externals.mjs";
|
|
1
3
|
import { addAugmentations, addDeclarations } from "./module/internal/types.mjs";
|
|
2
4
|
import { createResolver } from "./module/internal/resolver.mjs";
|
|
3
|
-
import { updateServerAssets } from "./module/internal/assets.mjs";
|
|
4
|
-
import { addInlineExternals } from "./module/internal/externals.mjs";
|
|
5
5
|
import { reloadPlugin } from "./module/internal/reload.mjs";
|
|
6
6
|
import { addPlugin } from "./module/internal/rollup.mjs";
|
|
7
7
|
import { defu } from "defu";
|
|
@@ -68,6 +68,6 @@ const module = {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
//#endregion
|
|
71
|
-
export { createDefaultOptions, module as default };
|
|
71
|
+
export { addInlineExternals, createDefaultOptions, module as default, updateServerAssets };
|
|
72
72
|
|
|
73
73
|
//# sourceMappingURL=module.mjs.map
|
package/dist/module.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":[],"sources":["../src/module/index.ts"],"sourcesContent":["import type { NitroModule } from \"nitropack/types\";\nimport { defu } from \"defu\";\nimport { resolve } from \"pathe\";\nimport { resolveAlias } from \"pathe/utils\";\n\nimport {\n createContext,\n type ConfigPattern,\n type ContextOptions,\n type MigrationOptions,\n} from \"nitro-drizzle/context\";\nimport type { VirtualModules, MaybePromise } from \"nitro-drizzle/shared\";\nimport { pkgName } from \"nitro-drizzle/meta\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"module.mjs","names":[],"sources":["../src/module/index.ts"],"sourcesContent":["import type { NitroModule } from \"nitropack/types\";\nimport { defu } from \"defu\";\nimport { resolve } from \"pathe\";\nimport { resolveAlias } from \"pathe/utils\";\n\nimport {\n createContext,\n type ConfigPattern,\n type ContextOptions,\n type MigrationOptions,\n} from \"nitro-drizzle/context\";\nimport type { VirtualModules, MaybePromise } from \"nitro-drizzle/shared\";\nimport { pkgName } from \"nitro-drizzle/meta\";\n\nimport { updateServerAssets } from \"./utils/assets\";\nimport { addInlineExternals } from \"./utils/externals\";\n\nimport { addAugmentations, addDeclarations } from \"./internal/types\";\nimport { createResolver } from \"./internal/resolver\";\nimport { reloadPlugin } from \"./internal/reload\";\nimport { addPlugin } from \"./internal/rollup\";\n\n/**\n * Datasource-specific configuration options.\n * This interface is augmented by the module with connector-specific options.\n */\nexport interface DatasourceOptions {\n // augmented by module\n}\n\ndeclare module \"nitropack/types\" {\n interface NitroOptions {\n drizzle: ModuleOptions;\n }\n}\n\nexport interface ModuleOptions {\n /**\n * Directory to search datasources\n */\n baseDir?: string;\n /**\n * Patterns to search Drizzle configs\n */\n configPattern?: ConfigPattern;\n\n datasources?: DatasourceOptions;\n\n /**\n * Enable migrations storage\n */\n migrations?: false | Partial<MigrationOptions>;\n}\n\nexport function createDefaultOptions() {\n return {\n baseDir: \"~/drizzle\",\n configPattern: [\"drizzle.config.{js,ts}\", \"drizzle-*.config.{js,ts}\"],\n migrations: {\n storageBase: \"drizzle:migrations\",\n migrateOnInit: false,\n },\n } as const satisfies ModuleOptions;\n}\n\nconst module: NitroModule = {\n name: pkgName,\n async setup(nitro) {\n const moduleOptions = defu(nitro.options.drizzle, createDefaultOptions());\n\n const resolver = createResolver(nitro.options.rootDir, {\n alias: nitro.options.alias,\n });\n\n const baseDir = resolve(\n nitro.options.srcDir,\n resolveAlias(moduleOptions.baseDir, nitro.options.alias),\n );\n\n const contextOptions: ContextOptions = {\n cwd: process.cwd(),\n resolver: resolver,\n baseDir,\n logger: nitro.logger,\n configPattern: moduleOptions.configPattern,\n datasource: { ...moduleOptions.datasources },\n migrations: moduleOptions.migrations || void 0,\n\n tasks: nitro.options.experimental.tasks\n ? (tasks) => {\n nitro.options.tasks ||= {};\n Object.assign(nitro.options.tasks, tasks);\n }\n : void 0,\n\n plugins(plugins) {\n nitro.options.plugins.push(...plugins);\n },\n\n virtualModules(modules: VirtualModules): MaybePromise<void> {\n Object.assign(nitro.options.virtual, modules);\n },\n\n declarations(declarations): MaybePromise<void> {\n nitro.hooks.hook(\"types:extend\", async (types) => {\n await addAugmentations(nitro.options, types, {\n ...declarations.runtime,\n ...declarations.module,\n });\n\n await addDeclarations(nitro.options, types, declarations.virtual);\n });\n },\n\n assets(assets) {\n updateServerAssets(nitro.options, assets);\n },\n\n inlineExternals(modules: readonly string[]) {\n addInlineExternals(nitro.options, modules);\n },\n };\n\n const context = createContext(contextOptions);\n\n // auto-imports\n if (nitro.options.imports) {\n nitro.options.imports.imports ||= [];\n\n // TODO\n // nitro.options.imports.imports.push({\n // name: 'useMigrations',\n // as: 'useDrizzleMigrations',\n // from: 'nitro-drizzle/runtime',\n // })\n }\n\n nitro.hooks.hook(\"rollup:before\", async (nitro, config) => {\n await addPlugin(config, reloadPlugin(nitro, { baseDir }));\n });\n\n await context.init();\n },\n};\n\nexport default module;\n\nexport { addInlineExternals, updateServerAssets };\n"],"mappings":";;;;;;;;;;;;AAsDA,SAAgB,uBAAuB;CACrC,OAAO;EACL,SAAS;EACT,eAAe,CAAC,0BAA0B,0BAA0B;EACpE,YAAY;GACV,aAAa;GACb,eAAe;EACjB;CACF;AACF;AAEA,MAAM,SAAsB;CAC1B,MAAM;CACN,MAAM,MAAM,OAAO;EACjB,MAAM,gBAAgB,KAAK,MAAM,QAAQ,SAAS,qBAAqB,CAAC;EAExE,MAAM,WAAW,eAAe,MAAM,QAAQ,SAAS,EACrD,OAAO,MAAM,QAAQ,MACvB,CAAC;EAED,MAAM,UAAU,QACd,MAAM,QAAQ,QACd,aAAa,cAAc,SAAS,MAAM,QAAQ,KAAK,CACzD;EA8CA,MAAM,UAAU,cAAc;GA3C5B,KAAK,QAAQ,IAAI;GACP;GACV;GACA,QAAQ,MAAM;GACd,eAAe,cAAc;GAC7B,YAAY,EAAE,GAAG,cAAc,YAAY;GAC3C,YAAY,cAAc,cAAc,KAAK;GAE7C,OAAO,MAAM,QAAQ,aAAa,SAC7B,UAAU;IACT,MAAM,QAAQ,UAAU,CAAC;IACzB,OAAO,OAAO,MAAM,QAAQ,OAAO,KAAK;GAC1C,IACA,KAAK;GAET,QAAQ,SAAS;IACf,MAAM,QAAQ,QAAQ,KAAK,GAAG,OAAO;GACvC;GAEA,eAAe,SAA6C;IAC1D,OAAO,OAAO,MAAM,QAAQ,SAAS,OAAO;GAC9C;GAEA,aAAa,cAAkC;IAC7C,MAAM,MAAM,KAAK,gBAAgB,OAAO,UAAU;KAChD,MAAM,iBAAiB,MAAM,SAAS,OAAO;MAC3C,GAAG,aAAa;MAChB,GAAG,aAAa;KAClB,CAAC;KAED,MAAM,gBAAgB,MAAM,SAAS,OAAO,aAAa,OAAO;IAClE,CAAC;GACH;GAEA,OAAO,QAAQ;IACb,mBAAmB,MAAM,SAAS,MAAM;GAC1C;GAEA,gBAAgB,SAA4B;IAC1C,mBAAmB,MAAM,SAAS,OAAO;GAC3C;EAGyC,CAAC;EAG5C,IAAI,MAAM,QAAQ,SAChB,MAAM,QAAQ,QAAQ,YAAY,CAAC;EAUrC,MAAM,MAAM,KAAK,iBAAiB,OAAO,OAAO,WAAW;GACzD,MAAM,UAAU,QAAQ,aAAa,OAAO,EAAE,QAAQ,CAAC,CAAC;EAC1D,CAAC;EAED,MAAM,QAAQ,KAAK;CACrB;AACF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DatasourceRegistry } from "nitro-drizzle/runtime";
|
|
2
2
|
import { MigrationResult } from "nitro-drizzle/migrations";
|
|
3
3
|
import { NitroAppPlugin } from "nitropack/types";
|
|
4
|
-
|
|
5
4
|
//#region src/plugins/migrate.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Nitro plugin that runs migrations on initialization.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Datasources } from "../runtime.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/runtime/useDatasource.d.ts
|
|
4
3
|
/** Options for datasource creation and lifecycle management. */
|
|
5
4
|
type UseDatasourceOptions = Partial<{
|
|
6
|
-
/** Whether to automatically close the datasource when Nitro app closes. */
|
|
5
|
+
/** Whether to automatically close the datasource when Nitro app closes. */
|
|
6
|
+
autoClose: boolean;
|
|
7
7
|
}>;
|
|
8
8
|
/**
|
|
9
9
|
* Gets or creates a datasource instance by name.
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { UseDatasourceOptions, useDatasource } from "./runtime/useDatasource.mjs";
|
|
2
2
|
import { Datasource, DatasourceDriver, Schema } from "nitro-drizzle/drivers";
|
|
3
|
-
|
|
4
3
|
//#region src/runtime/index.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Provider interface for creating Drizzle datasource instances.
|
|
@@ -38,12 +37,12 @@ interface DatasourceRegistry {}
|
|
|
38
37
|
* Mapped type of all datasources from the registry.
|
|
39
38
|
* Provides access to datasource instances by name.
|
|
40
39
|
*/
|
|
41
|
-
type Datasources = { readonly [K in keyof DatasourceRegistry]: ToDatasource<DatasourceRegistry[K]
|
|
40
|
+
type Datasources = { readonly [K in keyof DatasourceRegistry]: ToDatasource<DatasourceRegistry[K]>; };
|
|
42
41
|
/**
|
|
43
42
|
* Recursively extracts primitive properties from a type.
|
|
44
43
|
* @template T - The type to extract primitive properties from
|
|
45
44
|
*/
|
|
46
|
-
type PrimitiveProps<T> = { [K in keyof T]: T[K] extends Record<string, any> ? PrimitiveProps<T[K]> : T[K] extends ((...args: any[]) => infer R) ? Awaited<R> extends Primitive ? Awaited<R> : never : T[K] extends Primitive ? T[K] : never };
|
|
45
|
+
type PrimitiveProps<T> = { [K in keyof T]: T[K] extends Record<string, any> ? PrimitiveProps<T[K]> : T[K] extends ((...args: any[]) => infer R) ? Awaited<R> extends Primitive ? Awaited<R> : never : T[K] extends Primitive ? T[K] : never; };
|
|
47
46
|
/**
|
|
48
47
|
* Primitive types supported by the runtime configuration.
|
|
49
48
|
*/
|
|
@@ -56,18 +55,18 @@ type DatasourceProviderConfig<T extends DatasourceProvider<any, any>> = T extend
|
|
|
56
55
|
/**
|
|
57
56
|
* Configuration type mapping datasource names to their configurations.
|
|
58
57
|
*/
|
|
59
|
-
type DatasourceConfig = { [K in keyof DatasourceRegistry]: DatasourceProviderConfig<DatasourceRegistry[K]
|
|
58
|
+
type DatasourceConfig = { [K in keyof DatasourceRegistry]: DatasourceProviderConfig<DatasourceRegistry[K]>; };
|
|
60
59
|
/**
|
|
61
60
|
* Runtime configuration type with primitive values for each datasource.
|
|
62
61
|
* Used for Nitro runtime config.
|
|
63
62
|
*/
|
|
64
|
-
type RuntimeConfig = { [K in keyof DatasourceConfig]: PrimitiveProps<DatasourceConfig[K]
|
|
63
|
+
type RuntimeConfig = { [K in keyof DatasourceConfig]: PrimitiveProps<DatasourceConfig[K]>; };
|
|
65
64
|
declare module "nitropack/types" {
|
|
66
65
|
interface NitroRuntimeConfig {
|
|
67
66
|
drizzle?: RuntimeConfig;
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
|
-
type ConfigHookArgs = { [K in keyof DatasourceConfig]: [name: K, config: DatasourceConfig[K]] }[keyof DatasourceConfig];
|
|
69
|
+
type ConfigHookArgs = { [K in keyof DatasourceConfig]: [name: K, config: DatasourceConfig[K]]; }[keyof DatasourceConfig];
|
|
71
70
|
interface ConfigHooks {
|
|
72
71
|
"drizzle:config": (...args: ConfigHookArgs) => void | Promise<void>;
|
|
73
72
|
}
|
package/dist/shared.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-drizzle",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Nitro module to integrate Drizzle ORM with ease.",
|
|
5
5
|
"homepage": "https://github.com/Myshkouski/nitro-drizzle#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -40,10 +40,9 @@
|
|
|
40
40
|
"consola": "^3.4.2",
|
|
41
41
|
"db0": "^0.3.4",
|
|
42
42
|
"defu": "^6.1.7",
|
|
43
|
-
"drizzle-kit": "^0.31.10",
|
|
44
43
|
"jiti": "^2.7.0",
|
|
45
44
|
"knitwork": "^1.3.0",
|
|
46
|
-
"nitropack": "^2",
|
|
45
|
+
"nitropack": "^2.13.4",
|
|
47
46
|
"ohash": "^2.0.11",
|
|
48
47
|
"pathe": "^2.0.3",
|
|
49
48
|
"rollup": "^4.62.2",
|
|
@@ -53,32 +52,32 @@
|
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
54
|
"@arethetypeswrong/core": "^0.18.4",
|
|
56
|
-
"@cloudflare/workers-types": "^4.20260702.1",
|
|
57
55
|
"@testcontainers/mysql": "^12.0.4",
|
|
58
56
|
"@testcontainers/postgresql": "^12.0.4",
|
|
59
|
-
"@types/node": "^25.9.
|
|
57
|
+
"@types/node": "^25.9.5",
|
|
60
58
|
"@vitest/coverage-v8": "^4.1.10",
|
|
61
59
|
"@vitest/ui": "^4.1.10",
|
|
62
60
|
"changelogen": "^0.6.2",
|
|
63
|
-
"lefthook": "^2.1.
|
|
61
|
+
"lefthook": "^2.1.10",
|
|
64
62
|
"listhen": "^1.10.0",
|
|
65
|
-
"oxfmt": "^0.
|
|
66
|
-
"oxlint": "^1.
|
|
63
|
+
"oxfmt": "^0.58.0",
|
|
64
|
+
"oxlint": "^1.73.0",
|
|
67
65
|
"oxlint-tsgolint": "^0.24.0",
|
|
68
66
|
"publint": "^0.3.21",
|
|
69
67
|
"testcontainers": "^12.0.4",
|
|
70
|
-
"tsdown": "^0.22.
|
|
68
|
+
"tsdown": "^0.22.4",
|
|
71
69
|
"typescript": "^6.0.3",
|
|
72
70
|
"unplugin-unused": "^0.5.7",
|
|
73
71
|
"vitest": "^4.1.10"
|
|
74
72
|
},
|
|
75
73
|
"peerDependencies": {
|
|
76
|
-
"@cloudflare/workers-types": "^4.
|
|
74
|
+
"@cloudflare/workers-types": "^4.20260702.1",
|
|
77
75
|
"@electric-sql/pglite": "^0.5.4",
|
|
78
76
|
"better-sqlite3": "^12.11.1",
|
|
77
|
+
"drizzle-kit": "^0.31.10",
|
|
79
78
|
"drizzle-orm": "^0.45.2",
|
|
80
|
-
"h3": "^1",
|
|
81
|
-
"mysql2": "^3.22.
|
|
79
|
+
"h3": "^1.15.11",
|
|
80
|
+
"mysql2": "^3.22.6",
|
|
82
81
|
"postgres": "^3.4.9"
|
|
83
82
|
},
|
|
84
83
|
"peerDependenciesMeta": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assets.mjs","names":[],"sources":["../../../src/module/internal/assets.ts"],"sourcesContent":["import type { NitroConfig, ServerAssetDir } from \"nitropack/types\";\n\nexport function updateServerAssets(config: NitroConfig, assets: readonly ServerAssetDir[]) {\n config.serverAssets ||= [];\n config.serverAssets = config.serverAssets\n .filter((_assets) => {\n const baseName = _assets?.baseName;\n if (!baseName) {\n return true;\n }\n return assets.some((assets) => baseName == assets.baseName);\n })\n .concat(assets);\n}\n"],"mappings":";AAEA,SAAgB,mBAAmB,QAAqB,QAAmC;CACzF,OAAO,iBAAiB,CAAC;CACzB,OAAO,eAAe,OAAO,aAC1B,QAAQ,YAAY;EACnB,MAAM,WAAW,SAAS;EAC1B,IAAI,CAAC,UACH,OAAO;EAET,OAAO,OAAO,MAAM,WAAW,YAAY,OAAO,QAAQ;CAC5D,CAAC,CAAC,CACD,OAAO,MAAM;AAClB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"externals.mjs","names":[],"sources":["../../../src/module/internal/externals.ts"],"sourcesContent":["import type { NitroOptions } from \"nitropack/types\";\n\nexport function addInlineExternals(nitroOptions: NitroOptions, moduleIds: readonly string[]) {\n // @ts-expect-error\n nitroOptions.externals ||= {};\n nitroOptions.externals.inline ||= [];\n nitroOptions.externals.inline.push(...moduleIds);\n}\n"],"mappings":";AAEA,SAAgB,mBAAmB,cAA4B,WAA8B;CAE3F,aAAa,cAAc,CAAC;CAC5B,aAAa,UAAU,WAAW,CAAC;CACnC,aAAa,UAAU,OAAO,KAAK,GAAG,SAAS;AACjD"}
|