drizzle-orm 0.32.0-e7cf338 → 0.32.1-848e136
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/aws-data-api/pg/driver.cjs +3 -4
- package/aws-data-api/pg/driver.cjs.map +1 -1
- package/aws-data-api/pg/driver.js +3 -4
- package/aws-data-api/pg/driver.js.map +1 -1
- package/aws-data-api/pg/session.cjs.map +1 -1
- package/aws-data-api/pg/session.d.cts +2 -2
- package/aws-data-api/pg/session.d.ts +2 -2
- package/aws-data-api/pg/session.js.map +1 -1
- package/column-builder.cjs.map +1 -1
- package/column-builder.d.cts +27 -3
- package/column-builder.d.ts +27 -3
- package/column-builder.js.map +1 -1
- package/column.cjs.map +1 -1
- package/column.d.cts +6 -0
- package/column.d.ts +6 -0
- package/column.js.map +1 -1
- package/d1/session.cjs.map +1 -1
- package/d1/session.d.cts +2 -2
- package/d1/session.d.ts +2 -2
- package/d1/session.js.map +1 -1
- package/libsql/session.d.cts +1 -1
- package/libsql/session.d.ts +1 -1
- package/mysql-core/columns/common.cjs.map +1 -1
- package/mysql-core/columns/common.d.cts +2 -2
- package/mysql-core/columns/common.d.ts +2 -2
- package/mysql-core/columns/common.js.map +1 -1
- package/mysql-core/columns/serial.cjs.map +1 -1
- package/mysql-core/columns/serial.d.cts +3 -3
- package/mysql-core/columns/serial.d.ts +3 -3
- package/mysql-core/columns/serial.js.map +1 -1
- package/mysql-core/db.cjs.map +1 -1
- package/mysql-core/db.d.cts +6 -6
- package/mysql-core/db.d.ts +6 -6
- package/mysql-core/db.js.map +1 -1
- package/mysql-core/dialect.cjs +15 -5
- package/mysql-core/dialect.cjs.map +1 -1
- package/mysql-core/dialect.d.cts +4 -1
- package/mysql-core/dialect.d.ts +4 -1
- package/mysql-core/dialect.js +16 -6
- package/mysql-core/dialect.js.map +1 -1
- package/mysql-core/query-builders/delete.cjs.map +1 -1
- package/mysql-core/query-builders/delete.d.cts +6 -6
- package/mysql-core/query-builders/delete.d.ts +6 -6
- package/mysql-core/query-builders/delete.js.map +1 -1
- package/mysql-core/query-builders/insert.cjs +17 -3
- package/mysql-core/query-builders/insert.cjs.map +1 -1
- package/mysql-core/query-builders/insert.d.cts +27 -11
- package/mysql-core/query-builders/insert.d.ts +27 -11
- package/mysql-core/query-builders/insert.js +18 -4
- package/mysql-core/query-builders/insert.js.map +1 -1
- package/mysql-core/query-builders/query-builder.d.cts +2 -2
- package/mysql-core/query-builders/query-builder.d.ts +2 -2
- package/mysql-core/query-builders/query.cjs.map +1 -1
- package/mysql-core/query-builders/query.d.cts +3 -3
- package/mysql-core/query-builders/query.d.ts +3 -3
- package/mysql-core/query-builders/query.js.map +1 -1
- package/mysql-core/query-builders/select.cjs.map +1 -1
- package/mysql-core/query-builders/select.js.map +1 -1
- package/mysql-core/query-builders/select.types.cjs.map +1 -1
- package/mysql-core/query-builders/select.types.d.cts +2 -2
- package/mysql-core/query-builders/select.types.d.ts +2 -2
- package/mysql-core/query-builders/update.cjs.map +1 -1
- package/mysql-core/query-builders/update.d.cts +7 -7
- package/mysql-core/query-builders/update.d.ts +7 -7
- package/mysql-core/query-builders/update.js.map +1 -1
- package/mysql-core/session.cjs +5 -5
- package/mysql-core/session.cjs.map +1 -1
- package/mysql-core/session.d.cts +14 -14
- package/mysql-core/session.d.ts +14 -14
- package/mysql-core/session.js +3 -3
- package/mysql-core/session.js.map +1 -1
- package/mysql-proxy/driver.cjs.map +1 -1
- package/mysql-proxy/driver.d.cts +2 -0
- package/mysql-proxy/driver.d.ts +2 -0
- package/mysql-proxy/driver.js.map +1 -1
- package/mysql-proxy/session.cjs +33 -7
- package/mysql-proxy/session.cjs.map +1 -1
- package/mysql-proxy/session.d.cts +10 -8
- package/mysql-proxy/session.d.ts +10 -8
- package/mysql-proxy/session.js +34 -8
- package/mysql-proxy/session.js.map +1 -1
- package/mysql2/session.cjs +33 -6
- package/mysql2/session.cjs.map +1 -1
- package/mysql2/session.d.cts +11 -9
- package/mysql2/session.d.ts +11 -9
- package/mysql2/session.js +36 -9
- package/mysql2/session.js.map +1 -1
- package/neon-http/driver.cjs +1 -0
- package/neon-http/driver.cjs.map +1 -1
- package/neon-http/driver.js +1 -0
- package/neon-http/driver.js.map +1 -1
- package/neon-http/session.cjs.map +1 -1
- package/neon-http/session.d.cts +2 -2
- package/neon-http/session.d.ts +2 -2
- package/neon-http/session.js.map +1 -1
- package/neon-serverless/session.cjs.map +1 -1
- package/neon-serverless/session.d.cts +2 -2
- package/neon-serverless/session.d.ts +2 -2
- package/neon-serverless/session.js.map +1 -1
- package/node-postgres/session.cjs.map +1 -1
- package/node-postgres/session.d.cts +2 -2
- package/node-postgres/session.d.ts +2 -2
- package/node-postgres/session.js.map +1 -1
- package/package.json +146 -29
- package/pg-core/db.cjs.map +1 -1
- package/pg-core/db.d.cts +6 -6
- package/pg-core/db.d.ts +6 -6
- package/pg-core/db.js.map +1 -1
- package/pg-core/dialect.cjs +3 -3
- package/pg-core/dialect.cjs.map +1 -1
- package/pg-core/dialect.js +4 -4
- package/pg-core/dialect.js.map +1 -1
- package/pg-core/indexes.cjs.map +1 -1
- package/pg-core/indexes.d.cts +3 -3
- package/pg-core/indexes.d.ts +3 -3
- package/pg-core/indexes.js.map +1 -1
- package/pg-core/query-builders/delete.cjs.map +1 -1
- package/pg-core/query-builders/delete.d.cts +6 -6
- package/pg-core/query-builders/delete.d.ts +6 -6
- package/pg-core/query-builders/delete.js.map +1 -1
- package/pg-core/query-builders/insert.cjs.map +1 -1
- package/pg-core/query-builders/insert.d.cts +7 -7
- package/pg-core/query-builders/insert.d.ts +7 -7
- package/pg-core/query-builders/insert.js.map +1 -1
- package/pg-core/query-builders/query-builder.d.cts +2 -2
- package/pg-core/query-builders/query-builder.d.ts +2 -2
- package/pg-core/query-builders/refresh-materialized-view.cjs.map +1 -1
- package/pg-core/query-builders/refresh-materialized-view.d.cts +5 -5
- package/pg-core/query-builders/refresh-materialized-view.d.ts +5 -5
- package/pg-core/query-builders/refresh-materialized-view.js.map +1 -1
- package/pg-core/query-builders/update.cjs.map +1 -1
- package/pg-core/query-builders/update.d.cts +7 -7
- package/pg-core/query-builders/update.d.ts +7 -7
- package/pg-core/query-builders/update.js.map +1 -1
- package/pg-core/schema.cjs +7 -0
- package/pg-core/schema.cjs.map +1 -1
- package/pg-core/schema.d.cts +4 -1
- package/pg-core/schema.d.ts +4 -1
- package/pg-core/schema.js +7 -0
- package/pg-core/schema.js.map +1 -1
- package/pg-core/sequence.cjs.map +1 -1
- package/pg-core/sequence.d.cts +1 -1
- package/pg-core/sequence.d.ts +1 -1
- package/pg-core/sequence.js.map +1 -1
- package/pg-core/session.cjs.map +1 -1
- package/pg-core/session.d.cts +5 -5
- package/pg-core/session.d.ts +5 -5
- package/pg-core/session.js.map +1 -1
- package/pg-proxy/session.cjs.map +1 -1
- package/pg-proxy/session.d.cts +2 -2
- package/pg-proxy/session.d.ts +2 -2
- package/pg-proxy/session.js.map +1 -1
- package/pglite/session.cjs.map +1 -1
- package/pglite/session.d.cts +2 -2
- package/pglite/session.d.ts +2 -2
- package/pglite/session.js.map +1 -1
- package/planetscale-serverless/session.cjs +50 -6
- package/planetscale-serverless/session.cjs.map +1 -1
- package/planetscale-serverless/session.d.cts +10 -8
- package/planetscale-serverless/session.d.ts +10 -8
- package/planetscale-serverless/session.js +53 -9
- package/planetscale-serverless/session.js.map +1 -1
- package/postgres-js/session.cjs.map +1 -1
- package/postgres-js/session.d.cts +2 -2
- package/postgres-js/session.d.ts +2 -2
- package/postgres-js/session.js.map +1 -1
- package/prisma/mysql/driver.cjs +58 -0
- package/prisma/mysql/driver.cjs.map +1 -0
- package/prisma/mysql/driver.d.cts +23 -0
- package/prisma/mysql/driver.d.ts +23 -0
- package/prisma/mysql/driver.js +33 -0
- package/prisma/mysql/driver.js.map +1 -0
- package/prisma/mysql/index.cjs +25 -0
- package/prisma/mysql/index.cjs.map +1 -0
- package/prisma/mysql/index.d.cts +2 -0
- package/prisma/mysql/index.d.ts +2 -0
- package/prisma/mysql/index.js +3 -0
- package/prisma/mysql/index.js.map +1 -0
- package/prisma/mysql/session.cjs +73 -0
- package/prisma/mysql/session.cjs.map +1 -0
- package/prisma/mysql/session.d.cts +38 -0
- package/prisma/mysql/session.d.ts +38 -0
- package/prisma/mysql/session.js +48 -0
- package/prisma/mysql/session.js.map +1 -0
- package/prisma/pg/driver.cjs +58 -0
- package/prisma/pg/driver.cjs.map +1 -0
- package/prisma/pg/driver.d.cts +23 -0
- package/prisma/pg/driver.d.ts +23 -0
- package/prisma/pg/driver.js +33 -0
- package/prisma/pg/driver.js.map +1 -0
- package/prisma/pg/index.cjs +25 -0
- package/prisma/pg/index.cjs.map +1 -0
- package/prisma/pg/index.d.cts +2 -0
- package/prisma/pg/index.d.ts +2 -0
- package/prisma/pg/index.js +3 -0
- package/prisma/pg/index.js.map +1 -0
- package/prisma/pg/session.cjs +72 -0
- package/prisma/pg/session.cjs.map +1 -0
- package/prisma/pg/session.d.cts +33 -0
- package/prisma/pg/session.d.ts +33 -0
- package/prisma/pg/session.js +47 -0
- package/prisma/pg/session.js.map +1 -0
- package/prisma/sqlite/driver.cjs +50 -0
- package/prisma/sqlite/driver.cjs.map +1 -0
- package/prisma/sqlite/driver.d.cts +16 -0
- package/prisma/sqlite/driver.d.ts +16 -0
- package/prisma/sqlite/driver.js +26 -0
- package/prisma/sqlite/driver.js.map +1 -0
- package/prisma/sqlite/index.cjs +25 -0
- package/prisma/sqlite/index.cjs.map +1 -0
- package/prisma/sqlite/index.d.cts +2 -0
- package/prisma/sqlite/index.d.ts +2 -0
- package/prisma/sqlite/index.js +3 -0
- package/prisma/sqlite/index.js.map +1 -0
- package/prisma/sqlite/session.cjs +76 -0
- package/prisma/sqlite/session.cjs.map +1 -0
- package/prisma/sqlite/session.d.cts +37 -0
- package/prisma/sqlite/session.d.ts +37 -0
- package/prisma/sqlite/session.js +51 -0
- package/prisma/sqlite/session.js.map +1 -0
- package/query-builders/select.types.cjs.map +1 -1
- package/relations.cjs +5 -5
- package/relations.cjs.map +1 -1
- package/relations.d.cts +2 -2
- package/relations.d.ts +2 -2
- package/relations.js +6 -6
- package/relations.js.map +1 -1
- package/sql/expressions/conditions.cjs +2 -2
- package/sql/expressions/conditions.cjs.map +1 -1
- package/sql/expressions/conditions.d.cts +1 -1
- package/sql/expressions/conditions.d.ts +1 -1
- package/sql/expressions/conditions.js +2 -2
- package/sql/expressions/conditions.js.map +1 -1
- package/sql/sql.cjs +7 -4
- package/sql/sql.cjs.map +1 -1
- package/sql/sql.d.cts +1 -0
- package/sql/sql.d.ts +1 -0
- package/sql/sql.js +7 -4
- package/sql/sql.js.map +1 -1
- package/sql-js/session.d.cts +1 -1
- package/sql-js/session.d.ts +1 -1
- package/sqlite-core/columns/integer.cjs.map +1 -1
- package/sqlite-core/columns/integer.d.cts +2 -2
- package/sqlite-core/columns/integer.d.ts +2 -2
- package/sqlite-core/columns/integer.js.map +1 -1
- package/sqlite-core/db.d.cts +2 -2
- package/sqlite-core/db.d.ts +2 -2
- package/sqlite-core/dialect.cjs +3 -3
- package/sqlite-core/dialect.cjs.map +1 -1
- package/sqlite-core/dialect.d.cts +1 -1
- package/sqlite-core/dialect.d.ts +1 -1
- package/sqlite-core/dialect.js +4 -4
- package/sqlite-core/dialect.js.map +1 -1
- package/sqlite-core/query-builders/query-builder.d.cts +2 -2
- package/sqlite-core/query-builders/query-builder.d.ts +2 -2
- package/sqlite-proxy/session.d.cts +1 -1
- package/sqlite-proxy/session.d.ts +1 -1
- package/table.cjs +5 -1
- package/table.cjs.map +1 -1
- package/table.d.cts +1 -3
- package/table.d.ts +1 -3
- package/table.js +4 -1
- package/table.js.map +1 -1
- package/tidb-serverless/session.cjs +33 -6
- package/tidb-serverless/session.cjs.map +1 -1
- package/tidb-serverless/session.d.cts +9 -7
- package/tidb-serverless/session.d.ts +9 -7
- package/tidb-serverless/session.js +36 -9
- package/tidb-serverless/session.js.map +1 -1
- package/utils.cjs.map +1 -1
- package/utils.d.cts +2 -2
- package/utils.d.ts +2 -2
- package/utils.js.map +1 -1
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.d.cts +2 -2
- package/vercel-postgres/session.d.ts +2 -2
- package/vercel-postgres/session.js.map +1 -1
- package/version.cjs +1 -1
- package/version.d.cts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/xata-http/session.cjs.map +1 -1
- package/xata-http/session.d.cts +2 -2
- package/xata-http/session.d.ts +2 -2
- package/xata-http/session.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/postgres-js/session.ts"],"sourcesContent":["import type { Row, RowList, Sql, TransactionSql } from 'postgres';\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { NoopLogger } from '~/logger.ts';\nimport type { PgDialect } from '~/pg-core/dialect.ts';\nimport { PgTransaction } from '~/pg-core/index.ts';\nimport type { SelectedFieldsOrdered } from '~/pg-core/query-builders/select.types.ts';\nimport type { PgTransactionConfig, PreparedQueryConfig
|
|
1
|
+
{"version":3,"sources":["../../src/postgres-js/session.ts"],"sourcesContent":["import type { Row, RowList, Sql, TransactionSql } from 'postgres';\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { NoopLogger } from '~/logger.ts';\nimport type { PgDialect } from '~/pg-core/dialect.ts';\nimport { PgTransaction } from '~/pg-core/index.ts';\nimport type { SelectedFieldsOrdered } from '~/pg-core/query-builders/select.types.ts';\nimport type { PgQueryResultHKT, PgTransactionConfig, PreparedQueryConfig } from '~/pg-core/session.ts';\nimport { PgPreparedQuery, PgSession } from '~/pg-core/session.ts';\nimport type { RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';\nimport { fillPlaceholders, type Query } from '~/sql/sql.ts';\nimport { tracer } from '~/tracing.ts';\nimport { type Assume, mapResultRow } from '~/utils.ts';\n\nexport class PostgresJsPreparedQuery<T extends PreparedQueryConfig> extends PgPreparedQuery<T> {\n\tstatic readonly [entityKind]: string = 'PostgresJsPreparedQuery';\n\n\tconstructor(\n\t\tprivate client: Sql,\n\t\tprivate queryString: string,\n\t\tprivate params: unknown[],\n\t\tprivate logger: Logger,\n\t\tprivate fields: SelectedFieldsOrdered | undefined,\n\t\tprivate _isResponseInArrayMode: boolean,\n\t\tprivate customResultMapper?: (rows: unknown[][]) => T['execute'],\n\t) {\n\t\tsuper({ sql: queryString, params });\n\t}\n\n\tasync execute(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {\n\t\treturn tracer.startActiveSpan('drizzle.execute', async (span) => {\n\t\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\n\t\t\tspan?.setAttributes({\n\t\t\t\t'drizzle.query.text': this.queryString,\n\t\t\t\t'drizzle.query.params': JSON.stringify(params),\n\t\t\t});\n\n\t\t\tthis.logger.logQuery(this.queryString, params);\n\n\t\t\tconst { fields, queryString: query, client, joinsNotNullableMap, customResultMapper } = this;\n\t\t\tif (!fields && !customResultMapper) {\n\t\t\t\treturn tracer.startActiveSpan('drizzle.driver.execute', () => {\n\t\t\t\t\treturn client.unsafe(query, params as any[]);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst rows = await tracer.startActiveSpan('drizzle.driver.execute', () => {\n\t\t\t\tspan?.setAttributes({\n\t\t\t\t\t'drizzle.query.text': query,\n\t\t\t\t\t'drizzle.query.params': JSON.stringify(params),\n\t\t\t\t});\n\n\t\t\t\treturn client.unsafe(query, params as any[]).values();\n\t\t\t});\n\n\t\t\treturn tracer.startActiveSpan('drizzle.mapResponse', () => {\n\t\t\t\treturn customResultMapper\n\t\t\t\t\t? customResultMapper(rows)\n\t\t\t\t\t: rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));\n\t\t\t});\n\t\t});\n\t}\n\n\tall(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['all']> {\n\t\treturn tracer.startActiveSpan('drizzle.execute', async (span) => {\n\t\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\t\t\tspan?.setAttributes({\n\t\t\t\t'drizzle.query.text': this.queryString,\n\t\t\t\t'drizzle.query.params': JSON.stringify(params),\n\t\t\t});\n\t\t\tthis.logger.logQuery(this.queryString, params);\n\t\t\treturn tracer.startActiveSpan('drizzle.driver.execute', () => {\n\t\t\t\tspan?.setAttributes({\n\t\t\t\t\t'drizzle.query.text': this.queryString,\n\t\t\t\t\t'drizzle.query.params': JSON.stringify(params),\n\t\t\t\t});\n\t\t\t\treturn this.client.unsafe(this.queryString, params as any[]);\n\t\t\t});\n\t\t});\n\t}\n\n\t/** @internal */\n\tisResponseInArrayMode(): boolean {\n\t\treturn this._isResponseInArrayMode;\n\t}\n}\n\nexport interface PostgresJsSessionOptions {\n\tlogger?: Logger;\n}\n\nexport class PostgresJsSession<\n\tTSQL extends Sql,\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends PgSession<PostgresJsQueryResultHKT, TFullSchema, TSchema> {\n\tstatic readonly [entityKind]: string = 'PostgresJsSession';\n\n\tlogger: Logger;\n\n\tconstructor(\n\t\tpublic client: TSQL,\n\t\tdialect: PgDialect,\n\t\tprivate schema: RelationalSchemaConfig<TSchema> | undefined,\n\t\t/** @internal */\n\t\treadonly options: PostgresJsSessionOptions = {},\n\t) {\n\t\tsuper(dialect);\n\t\tthis.logger = options.logger ?? new NoopLogger();\n\t}\n\n\tprepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(\n\t\tquery: Query,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\tname: string | undefined,\n\t\tisResponseInArrayMode: boolean,\n\t\tcustomResultMapper?: (rows: unknown[][]) => T['execute'],\n\t): PgPreparedQuery<T> {\n\t\treturn new PostgresJsPreparedQuery(\n\t\t\tthis.client,\n\t\t\tquery.sql,\n\t\t\tquery.params,\n\t\t\tthis.logger,\n\t\t\tfields,\n\t\t\tisResponseInArrayMode,\n\t\t\tcustomResultMapper,\n\t\t);\n\t}\n\n\tquery(query: string, params: unknown[]): Promise<RowList<Row[]>> {\n\t\tthis.logger.logQuery(query, params);\n\t\treturn this.client.unsafe(query, params as any[]).values();\n\t}\n\n\tqueryObjects<T extends Row>(\n\t\tquery: string,\n\t\tparams: unknown[],\n\t): Promise<RowList<T[]>> {\n\t\treturn this.client.unsafe(query, params as any[]);\n\t}\n\n\toverride transaction<T>(\n\t\ttransaction: (tx: PostgresJsTransaction<TFullSchema, TSchema>) => Promise<T>,\n\t\tconfig?: PgTransactionConfig,\n\t): Promise<T> {\n\t\treturn this.client.begin(async (client) => {\n\t\t\tconst session = new PostgresJsSession<TransactionSql, TFullSchema, TSchema>(\n\t\t\t\tclient,\n\t\t\t\tthis.dialect,\n\t\t\t\tthis.schema,\n\t\t\t\tthis.options,\n\t\t\t);\n\t\t\tconst tx = new PostgresJsTransaction(this.dialect, session, this.schema);\n\t\t\tif (config) {\n\t\t\t\tawait tx.setTransaction(config);\n\t\t\t}\n\t\t\treturn transaction(tx);\n\t\t}) as Promise<T>;\n\t}\n}\n\nexport class PostgresJsTransaction<\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends PgTransaction<PostgresJsQueryResultHKT, TFullSchema, TSchema> {\n\tstatic readonly [entityKind]: string = 'PostgresJsTransaction';\n\n\tconstructor(\n\t\tdialect: PgDialect,\n\t\t/** @internal */\n\t\toverride readonly session: PostgresJsSession<TransactionSql, TFullSchema, TSchema>,\n\t\tschema: RelationalSchemaConfig<TSchema> | undefined,\n\t\tnestedIndex = 0,\n\t) {\n\t\tsuper(dialect, session, schema, nestedIndex);\n\t}\n\n\toverride transaction<T>(\n\t\ttransaction: (tx: PostgresJsTransaction<TFullSchema, TSchema>) => Promise<T>,\n\t): Promise<T> {\n\t\treturn this.session.client.savepoint((client) => {\n\t\t\tconst session = new PostgresJsSession<TransactionSql, TFullSchema, TSchema>(\n\t\t\t\tclient,\n\t\t\t\tthis.dialect,\n\t\t\t\tthis.schema,\n\t\t\t\tthis.session.options,\n\t\t\t);\n\t\t\tconst tx = new PostgresJsTransaction<TFullSchema, TSchema>(this.dialect, session, this.schema);\n\t\t\treturn transaction(tx);\n\t\t}) as Promise<T>;\n\t}\n}\n\nexport interface PostgresJsQueryResultHKT extends PgQueryResultHKT {\n\ttype: RowList<Assume<this['row'], Row>[]>;\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var driver_exports = {};
|
|
20
|
+
__export(driver_exports, {
|
|
21
|
+
PrismaMySqlDatabase: () => PrismaMySqlDatabase,
|
|
22
|
+
drizzle: () => drizzle
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(driver_exports);
|
|
25
|
+
var import_client = require("@prisma/client");
|
|
26
|
+
var import_entity = require("../../entity.cjs");
|
|
27
|
+
var import_logger = require("../../logger.cjs");
|
|
28
|
+
var import_mysql_core = require("../../mysql-core/index.cjs");
|
|
29
|
+
var import_session = require("./session.cjs");
|
|
30
|
+
class PrismaMySqlDatabase extends import_mysql_core.MySqlDatabase {
|
|
31
|
+
static [import_entity.entityKind] = "PrismaMySqlDatabase";
|
|
32
|
+
constructor(client, logger) {
|
|
33
|
+
const dialect = new import_mysql_core.MySqlDialect();
|
|
34
|
+
super(dialect, new import_session.PrismaMySqlSession(dialect, client, { logger }), void 0, "default");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function drizzle(config = {}) {
|
|
38
|
+
let logger;
|
|
39
|
+
if (config.logger === true) {
|
|
40
|
+
logger = new import_logger.DefaultLogger();
|
|
41
|
+
} else if (config.logger !== false) {
|
|
42
|
+
logger = config.logger;
|
|
43
|
+
}
|
|
44
|
+
return import_client.Prisma.defineExtension((client) => {
|
|
45
|
+
return client.$extends({
|
|
46
|
+
name: "drizzle",
|
|
47
|
+
client: {
|
|
48
|
+
$drizzle: new PrismaMySqlDatabase(client, logger)
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
PrismaMySqlDatabase,
|
|
56
|
+
drizzle
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=driver.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/prisma/mysql/driver.ts"],"sourcesContent":["import type { PrismaClient } from '@prisma/client/extension';\n\nimport { Prisma } from '@prisma/client';\n\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport { MySqlDatabase, MySqlDialect } from '~/mysql-core/index.ts';\nimport type { DrizzleConfig } from '~/utils.ts';\nimport type { PrismaMySqlPreparedQueryHKT, PrismaMySqlQueryResultHKT } from './session.ts';\nimport { PrismaMySqlSession } from './session.ts';\n\nexport class PrismaMySqlDatabase\n\textends MySqlDatabase<PrismaMySqlQueryResultHKT, PrismaMySqlPreparedQueryHKT, Record<string, never>>\n{\n\tstatic readonly [entityKind]: string = 'PrismaMySqlDatabase';\n\n\tconstructor(client: PrismaClient, logger: Logger | undefined) {\n\t\tconst dialect = new MySqlDialect();\n\t\tsuper(dialect, new PrismaMySqlSession(dialect, client, { logger }), undefined, 'default');\n\t}\n}\n\nexport type PrismaMySqlConfig = Omit<DrizzleConfig, 'schema'>;\n\nexport function drizzle(config: PrismaMySqlConfig = {}) {\n\tlet logger: Logger | undefined;\n\tif (config.logger === true) {\n\t\tlogger = new DefaultLogger();\n\t} else if (config.logger !== false) {\n\t\tlogger = config.logger;\n\t}\n\n\treturn Prisma.defineExtension((client) => {\n\t\treturn client.$extends({\n\t\t\tname: 'drizzle',\n\t\t\tclient: {\n\t\t\t\t$drizzle: new PrismaMySqlDatabase(client, logger),\n\t\t\t},\n\t\t});\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAuB;AAEvB,oBAA2B;AAE3B,oBAA8B;AAC9B,wBAA4C;AAG5C,qBAAmC;AAE5B,MAAM,4BACJ,gCACT;AAAA,EACC,QAAiB,wBAAU,IAAY;AAAA,EAEvC,YAAY,QAAsB,QAA4B;AAC7D,UAAM,UAAU,IAAI,+BAAa;AACjC,UAAM,SAAS,IAAI,kCAAmB,SAAS,QAAQ,EAAE,OAAO,CAAC,GAAG,QAAW,SAAS;AAAA,EACzF;AACD;AAIO,SAAS,QAAQ,SAA4B,CAAC,GAAG;AACvD,MAAI;AACJ,MAAI,OAAO,WAAW,MAAM;AAC3B,aAAS,IAAI,4BAAc;AAAA,EAC5B,WAAW,OAAO,WAAW,OAAO;AACnC,aAAS,OAAO;AAAA,EACjB;AAEA,SAAO,qBAAO,gBAAgB,CAAC,WAAW;AACzC,WAAO,OAAO,SAAS;AAAA,MACtB,MAAM;AAAA,MACN,QAAQ;AAAA,QACP,UAAU,IAAI,oBAAoB,QAAQ,MAAM;AAAA,MACjD;AAAA,IACD,CAAC;AAAA,EACF,CAAC;AACF;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PrismaClient } from '@prisma/client/extension';
|
|
2
|
+
import { entityKind } from "../../entity.cjs";
|
|
3
|
+
import type { Logger } from "../../logger.cjs";
|
|
4
|
+
import { MySqlDatabase } from "../../mysql-core/index.cjs";
|
|
5
|
+
import type { DrizzleConfig } from "../../utils.cjs";
|
|
6
|
+
import type { PrismaMySqlPreparedQueryHKT, PrismaMySqlQueryResultHKT } from "./session.cjs";
|
|
7
|
+
export declare class PrismaMySqlDatabase extends MySqlDatabase<PrismaMySqlQueryResultHKT, PrismaMySqlPreparedQueryHKT, Record<string, never>> {
|
|
8
|
+
static readonly [entityKind]: string;
|
|
9
|
+
constructor(client: PrismaClient, logger: Logger | undefined);
|
|
10
|
+
}
|
|
11
|
+
export type PrismaMySqlConfig = Omit<DrizzleConfig, 'schema'>;
|
|
12
|
+
export declare function drizzle(config?: PrismaMySqlConfig): (client: any) => {
|
|
13
|
+
$extends: {
|
|
14
|
+
extArgs: {
|
|
15
|
+
result: {};
|
|
16
|
+
model: {};
|
|
17
|
+
query: {};
|
|
18
|
+
client: {
|
|
19
|
+
$drizzle: () => PrismaMySqlDatabase;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PrismaClient } from '@prisma/client/extension';
|
|
2
|
+
import { entityKind } from "../../entity.js";
|
|
3
|
+
import type { Logger } from "../../logger.js";
|
|
4
|
+
import { MySqlDatabase } from "../../mysql-core/index.js";
|
|
5
|
+
import type { DrizzleConfig } from "../../utils.js";
|
|
6
|
+
import type { PrismaMySqlPreparedQueryHKT, PrismaMySqlQueryResultHKT } from "./session.js";
|
|
7
|
+
export declare class PrismaMySqlDatabase extends MySqlDatabase<PrismaMySqlQueryResultHKT, PrismaMySqlPreparedQueryHKT, Record<string, never>> {
|
|
8
|
+
static readonly [entityKind]: string;
|
|
9
|
+
constructor(client: PrismaClient, logger: Logger | undefined);
|
|
10
|
+
}
|
|
11
|
+
export type PrismaMySqlConfig = Omit<DrizzleConfig, 'schema'>;
|
|
12
|
+
export declare function drizzle(config?: PrismaMySqlConfig): (client: any) => {
|
|
13
|
+
$extends: {
|
|
14
|
+
extArgs: {
|
|
15
|
+
result: {};
|
|
16
|
+
model: {};
|
|
17
|
+
query: {};
|
|
18
|
+
client: {
|
|
19
|
+
$drizzle: () => PrismaMySqlDatabase;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Prisma } from "@prisma/client";
|
|
2
|
+
import { entityKind } from "../../entity.js";
|
|
3
|
+
import { DefaultLogger } from "../../logger.js";
|
|
4
|
+
import { MySqlDatabase, MySqlDialect } from "../../mysql-core/index.js";
|
|
5
|
+
import { PrismaMySqlSession } from "./session.js";
|
|
6
|
+
class PrismaMySqlDatabase extends MySqlDatabase {
|
|
7
|
+
static [entityKind] = "PrismaMySqlDatabase";
|
|
8
|
+
constructor(client, logger) {
|
|
9
|
+
const dialect = new MySqlDialect();
|
|
10
|
+
super(dialect, new PrismaMySqlSession(dialect, client, { logger }), void 0, "default");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function drizzle(config = {}) {
|
|
14
|
+
let logger;
|
|
15
|
+
if (config.logger === true) {
|
|
16
|
+
logger = new DefaultLogger();
|
|
17
|
+
} else if (config.logger !== false) {
|
|
18
|
+
logger = config.logger;
|
|
19
|
+
}
|
|
20
|
+
return Prisma.defineExtension((client) => {
|
|
21
|
+
return client.$extends({
|
|
22
|
+
name: "drizzle",
|
|
23
|
+
client: {
|
|
24
|
+
$drizzle: new PrismaMySqlDatabase(client, logger)
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
PrismaMySqlDatabase,
|
|
31
|
+
drizzle
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/prisma/mysql/driver.ts"],"sourcesContent":["import type { PrismaClient } from '@prisma/client/extension';\n\nimport { Prisma } from '@prisma/client';\n\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport { MySqlDatabase, MySqlDialect } from '~/mysql-core/index.ts';\nimport type { DrizzleConfig } from '~/utils.ts';\nimport type { PrismaMySqlPreparedQueryHKT, PrismaMySqlQueryResultHKT } from './session.ts';\nimport { PrismaMySqlSession } from './session.ts';\n\nexport class PrismaMySqlDatabase\n\textends MySqlDatabase<PrismaMySqlQueryResultHKT, PrismaMySqlPreparedQueryHKT, Record<string, never>>\n{\n\tstatic readonly [entityKind]: string = 'PrismaMySqlDatabase';\n\n\tconstructor(client: PrismaClient, logger: Logger | undefined) {\n\t\tconst dialect = new MySqlDialect();\n\t\tsuper(dialect, new PrismaMySqlSession(dialect, client, { logger }), undefined, 'default');\n\t}\n}\n\nexport type PrismaMySqlConfig = Omit<DrizzleConfig, 'schema'>;\n\nexport function drizzle(config: PrismaMySqlConfig = {}) {\n\tlet logger: Logger | undefined;\n\tif (config.logger === true) {\n\t\tlogger = new DefaultLogger();\n\t} else if (config.logger !== false) {\n\t\tlogger = config.logger;\n\t}\n\n\treturn Prisma.defineExtension((client) => {\n\t\treturn client.$extends({\n\t\t\tname: 'drizzle',\n\t\t\tclient: {\n\t\t\t\t$drizzle: new PrismaMySqlDatabase(client, logger),\n\t\t\t},\n\t\t});\n\t});\n}\n"],"mappings":"AAEA,SAAS,cAAc;AAEvB,SAAS,kBAAkB;AAE3B,SAAS,qBAAqB;AAC9B,SAAS,eAAe,oBAAoB;AAG5C,SAAS,0BAA0B;AAE5B,MAAM,4BACJ,cACT;AAAA,EACC,QAAiB,UAAU,IAAY;AAAA,EAEvC,YAAY,QAAsB,QAA4B;AAC7D,UAAM,UAAU,IAAI,aAAa;AACjC,UAAM,SAAS,IAAI,mBAAmB,SAAS,QAAQ,EAAE,OAAO,CAAC,GAAG,QAAW,SAAS;AAAA,EACzF;AACD;AAIO,SAAS,QAAQ,SAA4B,CAAC,GAAG;AACvD,MAAI;AACJ,MAAI,OAAO,WAAW,MAAM;AAC3B,aAAS,IAAI,cAAc;AAAA,EAC5B,WAAW,OAAO,WAAW,OAAO;AACnC,aAAS,OAAO;AAAA,EACjB;AAEA,SAAO,OAAO,gBAAgB,CAAC,WAAW;AACzC,WAAO,OAAO,SAAS;AAAA,MACtB,MAAM;AAAA,MACN,QAAQ;AAAA,QACP,UAAU,IAAI,oBAAoB,QAAQ,MAAM;AAAA,MACjD;AAAA,IACD,CAAC;AAAA,EACF,CAAC;AACF;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var mysql_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(mysql_exports);
|
|
18
|
+
__reExport(mysql_exports, require("./driver.cjs"), module.exports);
|
|
19
|
+
__reExport(mysql_exports, require("./session.cjs"), module.exports);
|
|
20
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
+
0 && (module.exports = {
|
|
22
|
+
...require("./driver.cjs"),
|
|
23
|
+
...require("./session.cjs")
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/prisma/mysql/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,wBAAd;AACA,0BAAc,yBADd;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/prisma/mysql/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var session_exports = {};
|
|
20
|
+
__export(session_exports, {
|
|
21
|
+
PrismaMySqlPreparedQuery: () => PrismaMySqlPreparedQuery,
|
|
22
|
+
PrismaMySqlSession: () => PrismaMySqlSession
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(session_exports);
|
|
25
|
+
var import_entity = require("../../entity.cjs");
|
|
26
|
+
var import_logger = require("../../logger.cjs");
|
|
27
|
+
var import_mysql_core = require("../../mysql-core/index.cjs");
|
|
28
|
+
var import_sql = require("../../sql/sql.cjs");
|
|
29
|
+
class PrismaMySqlPreparedQuery extends import_mysql_core.MySqlPreparedQuery {
|
|
30
|
+
constructor(prisma, query, logger) {
|
|
31
|
+
super();
|
|
32
|
+
this.prisma = prisma;
|
|
33
|
+
this.query = query;
|
|
34
|
+
this.logger = logger;
|
|
35
|
+
}
|
|
36
|
+
iterator(_placeholderValues) {
|
|
37
|
+
throw new Error("Method not implemented.");
|
|
38
|
+
}
|
|
39
|
+
static [import_entity.entityKind] = "PrismaMySqlPreparedQuery";
|
|
40
|
+
execute(placeholderValues) {
|
|
41
|
+
const params = (0, import_sql.fillPlaceholders)(this.query.params, placeholderValues ?? {});
|
|
42
|
+
this.logger.logQuery(this.query.sql, params);
|
|
43
|
+
return this.prisma.$queryRawUnsafe(this.query.sql, ...params);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
class PrismaMySqlSession extends import_mysql_core.MySqlSession {
|
|
47
|
+
constructor(dialect, prisma, options) {
|
|
48
|
+
super(dialect);
|
|
49
|
+
this.prisma = prisma;
|
|
50
|
+
this.options = options;
|
|
51
|
+
this.logger = options.logger ?? new import_logger.NoopLogger();
|
|
52
|
+
}
|
|
53
|
+
static [import_entity.entityKind] = "PrismaMySqlSession";
|
|
54
|
+
logger;
|
|
55
|
+
execute(query) {
|
|
56
|
+
return this.prepareQuery(this.dialect.sqlToQuery(query)).execute();
|
|
57
|
+
}
|
|
58
|
+
all(_query) {
|
|
59
|
+
throw new Error("Method not implemented.");
|
|
60
|
+
}
|
|
61
|
+
prepareQuery(query) {
|
|
62
|
+
return new PrismaMySqlPreparedQuery(this.prisma, query, this.logger);
|
|
63
|
+
}
|
|
64
|
+
transaction(_transaction, _config) {
|
|
65
|
+
throw new Error("Method not implemented.");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
PrismaMySqlPreparedQuery,
|
|
71
|
+
PrismaMySqlSession
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=session.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/prisma/mysql/session.ts"],"sourcesContent":["import type { PrismaClient } from '@prisma/client/extension';\n\nimport { entityKind } from '~/entity.ts';\nimport { type Logger, NoopLogger } from '~/logger.ts';\nimport type {\n\tMySqlDialect,\n\tMySqlPreparedQueryConfig,\n\tMySqlPreparedQueryHKT,\n\tMySqlQueryResultHKT,\n\tMySqlTransaction,\n\tMySqlTransactionConfig,\n} from '~/mysql-core/index.ts';\nimport { MySqlPreparedQuery, MySqlSession } from '~/mysql-core/index.ts';\nimport { fillPlaceholders } from '~/sql/sql.ts';\nimport type { Query, SQL } from '~/sql/sql.ts';\nimport type { Assume } from '~/utils.ts';\n\nexport class PrismaMySqlPreparedQuery<T> extends MySqlPreparedQuery<MySqlPreparedQueryConfig & { execute: T }> {\n\toverride iterator(_placeholderValues?: Record<string, unknown> | undefined): AsyncGenerator<unknown, any, unknown> {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tstatic readonly [entityKind]: string = 'PrismaMySqlPreparedQuery';\n\n\tconstructor(\n\t\tprivate readonly prisma: PrismaClient,\n\t\tprivate readonly query: Query,\n\t\tprivate readonly logger: Logger,\n\t) {\n\t\tsuper();\n\t}\n\n\toverride execute(placeholderValues?: Record<string, unknown>): Promise<T> {\n\t\tconst params = fillPlaceholders(this.query.params, placeholderValues ?? {});\n\t\tthis.logger.logQuery(this.query.sql, params);\n\t\treturn this.prisma.$queryRawUnsafe(this.query.sql, ...params);\n\t}\n}\n\nexport interface PrismaMySqlSessionOptions {\n\tlogger?: Logger;\n}\n\nexport class PrismaMySqlSession extends MySqlSession {\n\tstatic readonly [entityKind]: string = 'PrismaMySqlSession';\n\n\tprivate readonly logger: Logger;\n\n\tconstructor(\n\t\tdialect: MySqlDialect,\n\t\tprivate readonly prisma: PrismaClient,\n\t\tprivate readonly options: PrismaMySqlSessionOptions,\n\t) {\n\t\tsuper(dialect);\n\t\tthis.logger = options.logger ?? new NoopLogger();\n\t}\n\n\toverride execute<T>(query: SQL): Promise<T> {\n\t\treturn this.prepareQuery<MySqlPreparedQueryConfig & { execute: T }>(this.dialect.sqlToQuery(query)).execute();\n\t}\n\n\toverride all<T = unknown>(_query: SQL): Promise<T[]> {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\n\toverride prepareQuery<T extends MySqlPreparedQueryConfig = MySqlPreparedQueryConfig>(\n\t\tquery: Query,\n\t): MySqlPreparedQuery<T> {\n\t\treturn new PrismaMySqlPreparedQuery(this.prisma, query, this.logger);\n\t}\n\n\toverride transaction<T>(\n\t\t_transaction: (\n\t\t\ttx: MySqlTransaction<\n\t\t\t\tPrismaMySqlQueryResultHKT,\n\t\t\t\tPrismaMySqlPreparedQueryHKT,\n\t\t\t\tRecord<string, never>,\n\t\t\t\tRecord<string, never>\n\t\t\t>,\n\t\t) => Promise<T>,\n\t\t_config?: MySqlTransactionConfig,\n\t): Promise<T> {\n\t\tthrow new Error('Method not implemented.');\n\t}\n}\n\nexport interface PrismaMySqlQueryResultHKT extends MySqlQueryResultHKT {\n\ttype: [];\n}\n\nexport interface PrismaMySqlPreparedQueryHKT extends MySqlPreparedQueryHKT {\n\ttype: PrismaMySqlPreparedQuery<Assume<this['config'], MySqlPreparedQueryConfig>>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAC3B,oBAAwC;AASxC,wBAAiD;AACjD,iBAAiC;AAI1B,MAAM,iCAAoC,qCAA8D;AAAA,EAM9G,YACkB,QACA,OACA,QAChB;AACD,UAAM;AAJW;AACA;AACA;AAAA,EAGlB;AAAA,EAXS,SAAS,oBAAiG;AAClH,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC1C;AAAA,EACA,QAAiB,wBAAU,IAAY;AAAA,EAU9B,QAAQ,mBAAyD;AACzE,UAAM,aAAS,6BAAiB,KAAK,MAAM,QAAQ,qBAAqB,CAAC,CAAC;AAC1E,SAAK,OAAO,SAAS,KAAK,MAAM,KAAK,MAAM;AAC3C,WAAO,KAAK,OAAO,gBAAgB,KAAK,MAAM,KAAK,GAAG,MAAM;AAAA,EAC7D;AACD;AAMO,MAAM,2BAA2B,+BAAa;AAAA,EAKpD,YACC,SACiB,QACA,SAChB;AACD,UAAM,OAAO;AAHI;AACA;AAGjB,SAAK,SAAS,QAAQ,UAAU,IAAI,yBAAW;AAAA,EAChD;AAAA,EAXA,QAAiB,wBAAU,IAAY;AAAA,EAEtB;AAAA,EAWR,QAAW,OAAwB;AAC3C,WAAO,KAAK,aAAwD,KAAK,QAAQ,WAAW,KAAK,CAAC,EAAE,QAAQ;AAAA,EAC7G;AAAA,EAES,IAAiB,QAA2B;AACpD,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC1C;AAAA,EAES,aACR,OACwB;AACxB,WAAO,IAAI,yBAAyB,KAAK,QAAQ,OAAO,KAAK,MAAM;AAAA,EACpE;AAAA,EAES,YACR,cAQA,SACa;AACb,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC1C;AACD;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PrismaClient } from '@prisma/client/extension';
|
|
2
|
+
import { entityKind } from "../../entity.cjs";
|
|
3
|
+
import { type Logger } from "../../logger.cjs";
|
|
4
|
+
import type { MySqlDialect, MySqlPreparedQueryConfig, MySqlPreparedQueryHKT, MySqlQueryResultHKT, MySqlTransaction, MySqlTransactionConfig } from "../../mysql-core/index.cjs";
|
|
5
|
+
import { MySqlPreparedQuery, MySqlSession } from "../../mysql-core/index.cjs";
|
|
6
|
+
import type { Query, SQL } from "../../sql/sql.cjs";
|
|
7
|
+
import type { Assume } from "../../utils.cjs";
|
|
8
|
+
export declare class PrismaMySqlPreparedQuery<T> extends MySqlPreparedQuery<MySqlPreparedQueryConfig & {
|
|
9
|
+
execute: T;
|
|
10
|
+
}> {
|
|
11
|
+
private readonly prisma;
|
|
12
|
+
private readonly query;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
iterator(_placeholderValues?: Record<string, unknown> | undefined): AsyncGenerator<unknown, any, unknown>;
|
|
15
|
+
static readonly [entityKind]: string;
|
|
16
|
+
constructor(prisma: PrismaClient, query: Query, logger: Logger);
|
|
17
|
+
execute(placeholderValues?: Record<string, unknown>): Promise<T>;
|
|
18
|
+
}
|
|
19
|
+
export interface PrismaMySqlSessionOptions {
|
|
20
|
+
logger?: Logger;
|
|
21
|
+
}
|
|
22
|
+
export declare class PrismaMySqlSession extends MySqlSession {
|
|
23
|
+
private readonly prisma;
|
|
24
|
+
private readonly options;
|
|
25
|
+
static readonly [entityKind]: string;
|
|
26
|
+
private readonly logger;
|
|
27
|
+
constructor(dialect: MySqlDialect, prisma: PrismaClient, options: PrismaMySqlSessionOptions);
|
|
28
|
+
execute<T>(query: SQL): Promise<T>;
|
|
29
|
+
all<T = unknown>(_query: SQL): Promise<T[]>;
|
|
30
|
+
prepareQuery<T extends MySqlPreparedQueryConfig = MySqlPreparedQueryConfig>(query: Query): MySqlPreparedQuery<T>;
|
|
31
|
+
transaction<T>(_transaction: (tx: MySqlTransaction<PrismaMySqlQueryResultHKT, PrismaMySqlPreparedQueryHKT, Record<string, never>, Record<string, never>>) => Promise<T>, _config?: MySqlTransactionConfig): Promise<T>;
|
|
32
|
+
}
|
|
33
|
+
export interface PrismaMySqlQueryResultHKT extends MySqlQueryResultHKT {
|
|
34
|
+
type: [];
|
|
35
|
+
}
|
|
36
|
+
export interface PrismaMySqlPreparedQueryHKT extends MySqlPreparedQueryHKT {
|
|
37
|
+
type: PrismaMySqlPreparedQuery<Assume<this['config'], MySqlPreparedQueryConfig>>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PrismaClient } from '@prisma/client/extension';
|
|
2
|
+
import { entityKind } from "../../entity.js";
|
|
3
|
+
import { type Logger } from "../../logger.js";
|
|
4
|
+
import type { MySqlDialect, MySqlPreparedQueryConfig, MySqlPreparedQueryHKT, MySqlQueryResultHKT, MySqlTransaction, MySqlTransactionConfig } from "../../mysql-core/index.js";
|
|
5
|
+
import { MySqlPreparedQuery, MySqlSession } from "../../mysql-core/index.js";
|
|
6
|
+
import type { Query, SQL } from "../../sql/sql.js";
|
|
7
|
+
import type { Assume } from "../../utils.js";
|
|
8
|
+
export declare class PrismaMySqlPreparedQuery<T> extends MySqlPreparedQuery<MySqlPreparedQueryConfig & {
|
|
9
|
+
execute: T;
|
|
10
|
+
}> {
|
|
11
|
+
private readonly prisma;
|
|
12
|
+
private readonly query;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
iterator(_placeholderValues?: Record<string, unknown> | undefined): AsyncGenerator<unknown, any, unknown>;
|
|
15
|
+
static readonly [entityKind]: string;
|
|
16
|
+
constructor(prisma: PrismaClient, query: Query, logger: Logger);
|
|
17
|
+
execute(placeholderValues?: Record<string, unknown>): Promise<T>;
|
|
18
|
+
}
|
|
19
|
+
export interface PrismaMySqlSessionOptions {
|
|
20
|
+
logger?: Logger;
|
|
21
|
+
}
|
|
22
|
+
export declare class PrismaMySqlSession extends MySqlSession {
|
|
23
|
+
private readonly prisma;
|
|
24
|
+
private readonly options;
|
|
25
|
+
static readonly [entityKind]: string;
|
|
26
|
+
private readonly logger;
|
|
27
|
+
constructor(dialect: MySqlDialect, prisma: PrismaClient, options: PrismaMySqlSessionOptions);
|
|
28
|
+
execute<T>(query: SQL): Promise<T>;
|
|
29
|
+
all<T = unknown>(_query: SQL): Promise<T[]>;
|
|
30
|
+
prepareQuery<T extends MySqlPreparedQueryConfig = MySqlPreparedQueryConfig>(query: Query): MySqlPreparedQuery<T>;
|
|
31
|
+
transaction<T>(_transaction: (tx: MySqlTransaction<PrismaMySqlQueryResultHKT, PrismaMySqlPreparedQueryHKT, Record<string, never>, Record<string, never>>) => Promise<T>, _config?: MySqlTransactionConfig): Promise<T>;
|
|
32
|
+
}
|
|
33
|
+
export interface PrismaMySqlQueryResultHKT extends MySqlQueryResultHKT {
|
|
34
|
+
type: [];
|
|
35
|
+
}
|
|
36
|
+
export interface PrismaMySqlPreparedQueryHKT extends MySqlPreparedQueryHKT {
|
|
37
|
+
type: PrismaMySqlPreparedQuery<Assume<this['config'], MySqlPreparedQueryConfig>>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { entityKind } from "../../entity.js";
|
|
2
|
+
import { NoopLogger } from "../../logger.js";
|
|
3
|
+
import { MySqlPreparedQuery, MySqlSession } from "../../mysql-core/index.js";
|
|
4
|
+
import { fillPlaceholders } from "../../sql/sql.js";
|
|
5
|
+
class PrismaMySqlPreparedQuery extends MySqlPreparedQuery {
|
|
6
|
+
constructor(prisma, query, logger) {
|
|
7
|
+
super();
|
|
8
|
+
this.prisma = prisma;
|
|
9
|
+
this.query = query;
|
|
10
|
+
this.logger = logger;
|
|
11
|
+
}
|
|
12
|
+
iterator(_placeholderValues) {
|
|
13
|
+
throw new Error("Method not implemented.");
|
|
14
|
+
}
|
|
15
|
+
static [entityKind] = "PrismaMySqlPreparedQuery";
|
|
16
|
+
execute(placeholderValues) {
|
|
17
|
+
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
|
|
18
|
+
this.logger.logQuery(this.query.sql, params);
|
|
19
|
+
return this.prisma.$queryRawUnsafe(this.query.sql, ...params);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
class PrismaMySqlSession extends MySqlSession {
|
|
23
|
+
constructor(dialect, prisma, options) {
|
|
24
|
+
super(dialect);
|
|
25
|
+
this.prisma = prisma;
|
|
26
|
+
this.options = options;
|
|
27
|
+
this.logger = options.logger ?? new NoopLogger();
|
|
28
|
+
}
|
|
29
|
+
static [entityKind] = "PrismaMySqlSession";
|
|
30
|
+
logger;
|
|
31
|
+
execute(query) {
|
|
32
|
+
return this.prepareQuery(this.dialect.sqlToQuery(query)).execute();
|
|
33
|
+
}
|
|
34
|
+
all(_query) {
|
|
35
|
+
throw new Error("Method not implemented.");
|
|
36
|
+
}
|
|
37
|
+
prepareQuery(query) {
|
|
38
|
+
return new PrismaMySqlPreparedQuery(this.prisma, query, this.logger);
|
|
39
|
+
}
|
|
40
|
+
transaction(_transaction, _config) {
|
|
41
|
+
throw new Error("Method not implemented.");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
PrismaMySqlPreparedQuery,
|
|
46
|
+
PrismaMySqlSession
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/prisma/mysql/session.ts"],"sourcesContent":["import type { PrismaClient } from '@prisma/client/extension';\n\nimport { entityKind } from '~/entity.ts';\nimport { type Logger, NoopLogger } from '~/logger.ts';\nimport type {\n\tMySqlDialect,\n\tMySqlPreparedQueryConfig,\n\tMySqlPreparedQueryHKT,\n\tMySqlQueryResultHKT,\n\tMySqlTransaction,\n\tMySqlTransactionConfig,\n} from '~/mysql-core/index.ts';\nimport { MySqlPreparedQuery, MySqlSession } from '~/mysql-core/index.ts';\nimport { fillPlaceholders } from '~/sql/sql.ts';\nimport type { Query, SQL } from '~/sql/sql.ts';\nimport type { Assume } from '~/utils.ts';\n\nexport class PrismaMySqlPreparedQuery<T> extends MySqlPreparedQuery<MySqlPreparedQueryConfig & { execute: T }> {\n\toverride iterator(_placeholderValues?: Record<string, unknown> | undefined): AsyncGenerator<unknown, any, unknown> {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tstatic readonly [entityKind]: string = 'PrismaMySqlPreparedQuery';\n\n\tconstructor(\n\t\tprivate readonly prisma: PrismaClient,\n\t\tprivate readonly query: Query,\n\t\tprivate readonly logger: Logger,\n\t) {\n\t\tsuper();\n\t}\n\n\toverride execute(placeholderValues?: Record<string, unknown>): Promise<T> {\n\t\tconst params = fillPlaceholders(this.query.params, placeholderValues ?? {});\n\t\tthis.logger.logQuery(this.query.sql, params);\n\t\treturn this.prisma.$queryRawUnsafe(this.query.sql, ...params);\n\t}\n}\n\nexport interface PrismaMySqlSessionOptions {\n\tlogger?: Logger;\n}\n\nexport class PrismaMySqlSession extends MySqlSession {\n\tstatic readonly [entityKind]: string = 'PrismaMySqlSession';\n\n\tprivate readonly logger: Logger;\n\n\tconstructor(\n\t\tdialect: MySqlDialect,\n\t\tprivate readonly prisma: PrismaClient,\n\t\tprivate readonly options: PrismaMySqlSessionOptions,\n\t) {\n\t\tsuper(dialect);\n\t\tthis.logger = options.logger ?? new NoopLogger();\n\t}\n\n\toverride execute<T>(query: SQL): Promise<T> {\n\t\treturn this.prepareQuery<MySqlPreparedQueryConfig & { execute: T }>(this.dialect.sqlToQuery(query)).execute();\n\t}\n\n\toverride all<T = unknown>(_query: SQL): Promise<T[]> {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\n\toverride prepareQuery<T extends MySqlPreparedQueryConfig = MySqlPreparedQueryConfig>(\n\t\tquery: Query,\n\t): MySqlPreparedQuery<T> {\n\t\treturn new PrismaMySqlPreparedQuery(this.prisma, query, this.logger);\n\t}\n\n\toverride transaction<T>(\n\t\t_transaction: (\n\t\t\ttx: MySqlTransaction<\n\t\t\t\tPrismaMySqlQueryResultHKT,\n\t\t\t\tPrismaMySqlPreparedQueryHKT,\n\t\t\t\tRecord<string, never>,\n\t\t\t\tRecord<string, never>\n\t\t\t>,\n\t\t) => Promise<T>,\n\t\t_config?: MySqlTransactionConfig,\n\t): Promise<T> {\n\t\tthrow new Error('Method not implemented.');\n\t}\n}\n\nexport interface PrismaMySqlQueryResultHKT extends MySqlQueryResultHKT {\n\ttype: [];\n}\n\nexport interface PrismaMySqlPreparedQueryHKT extends MySqlPreparedQueryHKT {\n\ttype: PrismaMySqlPreparedQuery<Assume<this['config'], MySqlPreparedQueryConfig>>;\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAC3B,SAAsB,kBAAkB;AASxC,SAAS,oBAAoB,oBAAoB;AACjD,SAAS,wBAAwB;AAI1B,MAAM,iCAAoC,mBAA8D;AAAA,EAM9G,YACkB,QACA,OACA,QAChB;AACD,UAAM;AAJW;AACA;AACA;AAAA,EAGlB;AAAA,EAXS,SAAS,oBAAiG;AAClH,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC1C;AAAA,EACA,QAAiB,UAAU,IAAY;AAAA,EAU9B,QAAQ,mBAAyD;AACzE,UAAM,SAAS,iBAAiB,KAAK,MAAM,QAAQ,qBAAqB,CAAC,CAAC;AAC1E,SAAK,OAAO,SAAS,KAAK,MAAM,KAAK,MAAM;AAC3C,WAAO,KAAK,OAAO,gBAAgB,KAAK,MAAM,KAAK,GAAG,MAAM;AAAA,EAC7D;AACD;AAMO,MAAM,2BAA2B,aAAa;AAAA,EAKpD,YACC,SACiB,QACA,SAChB;AACD,UAAM,OAAO;AAHI;AACA;AAGjB,SAAK,SAAS,QAAQ,UAAU,IAAI,WAAW;AAAA,EAChD;AAAA,EAXA,QAAiB,UAAU,IAAY;AAAA,EAEtB;AAAA,EAWR,QAAW,OAAwB;AAC3C,WAAO,KAAK,aAAwD,KAAK,QAAQ,WAAW,KAAK,CAAC,EAAE,QAAQ;AAAA,EAC7G;AAAA,EAES,IAAiB,QAA2B;AACpD,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC1C;AAAA,EAES,aACR,OACwB;AACxB,WAAO,IAAI,yBAAyB,KAAK,QAAQ,OAAO,KAAK,MAAM;AAAA,EACpE;AAAA,EAES,YACR,cAQA,SACa;AACb,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC1C;AACD;","names":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var driver_exports = {};
|
|
20
|
+
__export(driver_exports, {
|
|
21
|
+
PrismaPgDatabase: () => PrismaPgDatabase,
|
|
22
|
+
drizzle: () => drizzle
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(driver_exports);
|
|
25
|
+
var import_client = require("@prisma/client");
|
|
26
|
+
var import_entity = require("../../entity.cjs");
|
|
27
|
+
var import_logger = require("../../logger.cjs");
|
|
28
|
+
var import_pg_core = require("../../pg-core/index.cjs");
|
|
29
|
+
var import_session = require("./session.cjs");
|
|
30
|
+
class PrismaPgDatabase extends import_pg_core.PgDatabase {
|
|
31
|
+
static [import_entity.entityKind] = "PrismaPgDatabase";
|
|
32
|
+
constructor(client, logger) {
|
|
33
|
+
const dialect = new import_pg_core.PgDialect();
|
|
34
|
+
super(dialect, new import_session.PrismaPgSession(dialect, client, { logger }), void 0);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function drizzle(config = {}) {
|
|
38
|
+
let logger;
|
|
39
|
+
if (config.logger === true) {
|
|
40
|
+
logger = new import_logger.DefaultLogger();
|
|
41
|
+
} else if (config.logger !== false) {
|
|
42
|
+
logger = config.logger;
|
|
43
|
+
}
|
|
44
|
+
return import_client.Prisma.defineExtension((client) => {
|
|
45
|
+
return client.$extends({
|
|
46
|
+
name: "drizzle",
|
|
47
|
+
client: {
|
|
48
|
+
$drizzle: new PrismaPgDatabase(client, logger)
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
PrismaPgDatabase,
|
|
56
|
+
drizzle
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=driver.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/prisma/pg/driver.ts"],"sourcesContent":["import type { PrismaClient } from '@prisma/client/extension';\n\nimport { Prisma } from '@prisma/client';\n\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport { PgDatabase, PgDialect } from '~/pg-core/index.ts';\nimport type { DrizzleConfig } from '~/utils.ts';\nimport type { PrismaPgQueryResultHKT } from './session.ts';\nimport { PrismaPgSession } from './session.ts';\n\nexport class PrismaPgDatabase extends PgDatabase<PrismaPgQueryResultHKT, Record<string, never>> {\n\tstatic readonly [entityKind]: string = 'PrismaPgDatabase';\n\n\tconstructor(client: PrismaClient, logger: Logger | undefined) {\n\t\tconst dialect = new PgDialect();\n\t\tsuper(dialect, new PrismaPgSession(dialect, client, { logger }), undefined);\n\t}\n}\n\nexport type PrismaPgConfig = Omit<DrizzleConfig, 'schema'>;\n\nexport function drizzle(config: PrismaPgConfig = {}) {\n\tlet logger: Logger | undefined;\n\tif (config.logger === true) {\n\t\tlogger = new DefaultLogger();\n\t} else if (config.logger !== false) {\n\t\tlogger = config.logger;\n\t}\n\n\treturn Prisma.defineExtension((client) => {\n\t\treturn client.$extends({\n\t\t\tname: 'drizzle',\n\t\t\tclient: {\n\t\t\t\t$drizzle: new PrismaPgDatabase(client, logger),\n\t\t\t},\n\t\t});\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAuB;AAEvB,oBAA2B;AAE3B,oBAA8B;AAC9B,qBAAsC;AAGtC,qBAAgC;AAEzB,MAAM,yBAAyB,0BAA0D;AAAA,EAC/F,QAAiB,wBAAU,IAAY;AAAA,EAEvC,YAAY,QAAsB,QAA4B;AAC7D,UAAM,UAAU,IAAI,yBAAU;AAC9B,UAAM,SAAS,IAAI,+BAAgB,SAAS,QAAQ,EAAE,OAAO,CAAC,GAAG,MAAS;AAAA,EAC3E;AACD;AAIO,SAAS,QAAQ,SAAyB,CAAC,GAAG;AACpD,MAAI;AACJ,MAAI,OAAO,WAAW,MAAM;AAC3B,aAAS,IAAI,4BAAc;AAAA,EAC5B,WAAW,OAAO,WAAW,OAAO;AACnC,aAAS,OAAO;AAAA,EACjB;AAEA,SAAO,qBAAO,gBAAgB,CAAC,WAAW;AACzC,WAAO,OAAO,SAAS;AAAA,MACtB,MAAM;AAAA,MACN,QAAQ;AAAA,QACP,UAAU,IAAI,iBAAiB,QAAQ,MAAM;AAAA,MAC9C;AAAA,IACD,CAAC;AAAA,EACF,CAAC;AACF;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PrismaClient } from '@prisma/client/extension';
|
|
2
|
+
import { entityKind } from "../../entity.cjs";
|
|
3
|
+
import type { Logger } from "../../logger.cjs";
|
|
4
|
+
import { PgDatabase } from "../../pg-core/index.cjs";
|
|
5
|
+
import type { DrizzleConfig } from "../../utils.cjs";
|
|
6
|
+
import type { PrismaPgQueryResultHKT } from "./session.cjs";
|
|
7
|
+
export declare class PrismaPgDatabase extends PgDatabase<PrismaPgQueryResultHKT, Record<string, never>> {
|
|
8
|
+
static readonly [entityKind]: string;
|
|
9
|
+
constructor(client: PrismaClient, logger: Logger | undefined);
|
|
10
|
+
}
|
|
11
|
+
export type PrismaPgConfig = Omit<DrizzleConfig, 'schema'>;
|
|
12
|
+
export declare function drizzle(config?: PrismaPgConfig): (client: any) => {
|
|
13
|
+
$extends: {
|
|
14
|
+
extArgs: {
|
|
15
|
+
result: {};
|
|
16
|
+
model: {};
|
|
17
|
+
query: {};
|
|
18
|
+
client: {
|
|
19
|
+
$drizzle: () => PrismaPgDatabase;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PrismaClient } from '@prisma/client/extension';
|
|
2
|
+
import { entityKind } from "../../entity.js";
|
|
3
|
+
import type { Logger } from "../../logger.js";
|
|
4
|
+
import { PgDatabase } from "../../pg-core/index.js";
|
|
5
|
+
import type { DrizzleConfig } from "../../utils.js";
|
|
6
|
+
import type { PrismaPgQueryResultHKT } from "./session.js";
|
|
7
|
+
export declare class PrismaPgDatabase extends PgDatabase<PrismaPgQueryResultHKT, Record<string, never>> {
|
|
8
|
+
static readonly [entityKind]: string;
|
|
9
|
+
constructor(client: PrismaClient, logger: Logger | undefined);
|
|
10
|
+
}
|
|
11
|
+
export type PrismaPgConfig = Omit<DrizzleConfig, 'schema'>;
|
|
12
|
+
export declare function drizzle(config?: PrismaPgConfig): (client: any) => {
|
|
13
|
+
$extends: {
|
|
14
|
+
extArgs: {
|
|
15
|
+
result: {};
|
|
16
|
+
model: {};
|
|
17
|
+
query: {};
|
|
18
|
+
client: {
|
|
19
|
+
$drizzle: () => PrismaPgDatabase;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Prisma } from "@prisma/client";
|
|
2
|
+
import { entityKind } from "../../entity.js";
|
|
3
|
+
import { DefaultLogger } from "../../logger.js";
|
|
4
|
+
import { PgDatabase, PgDialect } from "../../pg-core/index.js";
|
|
5
|
+
import { PrismaPgSession } from "./session.js";
|
|
6
|
+
class PrismaPgDatabase extends PgDatabase {
|
|
7
|
+
static [entityKind] = "PrismaPgDatabase";
|
|
8
|
+
constructor(client, logger) {
|
|
9
|
+
const dialect = new PgDialect();
|
|
10
|
+
super(dialect, new PrismaPgSession(dialect, client, { logger }), void 0);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function drizzle(config = {}) {
|
|
14
|
+
let logger;
|
|
15
|
+
if (config.logger === true) {
|
|
16
|
+
logger = new DefaultLogger();
|
|
17
|
+
} else if (config.logger !== false) {
|
|
18
|
+
logger = config.logger;
|
|
19
|
+
}
|
|
20
|
+
return Prisma.defineExtension((client) => {
|
|
21
|
+
return client.$extends({
|
|
22
|
+
name: "drizzle",
|
|
23
|
+
client: {
|
|
24
|
+
$drizzle: new PrismaPgDatabase(client, logger)
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
PrismaPgDatabase,
|
|
31
|
+
drizzle
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/prisma/pg/driver.ts"],"sourcesContent":["import type { PrismaClient } from '@prisma/client/extension';\n\nimport { Prisma } from '@prisma/client';\n\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport { PgDatabase, PgDialect } from '~/pg-core/index.ts';\nimport type { DrizzleConfig } from '~/utils.ts';\nimport type { PrismaPgQueryResultHKT } from './session.ts';\nimport { PrismaPgSession } from './session.ts';\n\nexport class PrismaPgDatabase extends PgDatabase<PrismaPgQueryResultHKT, Record<string, never>> {\n\tstatic readonly [entityKind]: string = 'PrismaPgDatabase';\n\n\tconstructor(client: PrismaClient, logger: Logger | undefined) {\n\t\tconst dialect = new PgDialect();\n\t\tsuper(dialect, new PrismaPgSession(dialect, client, { logger }), undefined);\n\t}\n}\n\nexport type PrismaPgConfig = Omit<DrizzleConfig, 'schema'>;\n\nexport function drizzle(config: PrismaPgConfig = {}) {\n\tlet logger: Logger | undefined;\n\tif (config.logger === true) {\n\t\tlogger = new DefaultLogger();\n\t} else if (config.logger !== false) {\n\t\tlogger = config.logger;\n\t}\n\n\treturn Prisma.defineExtension((client) => {\n\t\treturn client.$extends({\n\t\t\tname: 'drizzle',\n\t\t\tclient: {\n\t\t\t\t$drizzle: new PrismaPgDatabase(client, logger),\n\t\t\t},\n\t\t});\n\t});\n}\n"],"mappings":"AAEA,SAAS,cAAc;AAEvB,SAAS,kBAAkB;AAE3B,SAAS,qBAAqB;AAC9B,SAAS,YAAY,iBAAiB;AAGtC,SAAS,uBAAuB;AAEzB,MAAM,yBAAyB,WAA0D;AAAA,EAC/F,QAAiB,UAAU,IAAY;AAAA,EAEvC,YAAY,QAAsB,QAA4B;AAC7D,UAAM,UAAU,IAAI,UAAU;AAC9B,UAAM,SAAS,IAAI,gBAAgB,SAAS,QAAQ,EAAE,OAAO,CAAC,GAAG,MAAS;AAAA,EAC3E;AACD;AAIO,SAAS,QAAQ,SAAyB,CAAC,GAAG;AACpD,MAAI;AACJ,MAAI,OAAO,WAAW,MAAM;AAC3B,aAAS,IAAI,cAAc;AAAA,EAC5B,WAAW,OAAO,WAAW,OAAO;AACnC,aAAS,OAAO;AAAA,EACjB;AAEA,SAAO,OAAO,gBAAgB,CAAC,WAAW;AACzC,WAAO,OAAO,SAAS;AAAA,MACtB,MAAM;AAAA,MACN,QAAQ;AAAA,QACP,UAAU,IAAI,iBAAiB,QAAQ,MAAM;AAAA,MAC9C;AAAA,IACD,CAAC;AAAA,EACF,CAAC;AACF;","names":[]}
|