drizzle-orm 0.36.4-14e59f4 → 0.36.4-3c69a1f
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/_relations.cjs +328 -0
- package/_relations.cjs.map +1 -0
- package/_relations.d.cts +215 -0
- package/_relations.d.ts +215 -0
- package/_relations.js +316 -0
- package/_relations.js.map +1 -0
- package/alias.cjs.map +1 -1
- package/alias.d.cts +3 -3
- package/alias.d.ts +3 -3
- package/alias.js.map +1 -1
- package/aws-data-api/pg/driver.cjs +19 -5
- package/aws-data-api/pg/driver.cjs.map +1 -1
- package/aws-data-api/pg/driver.d.cts +9 -8
- package/aws-data-api/pg/driver.d.ts +9 -8
- package/aws-data-api/pg/driver.js +9 -8
- package/aws-data-api/pg/driver.js.map +1 -1
- package/aws-data-api/pg/migrator.cjs.map +1 -1
- package/aws-data-api/pg/migrator.d.cts +2 -1
- package/aws-data-api/pg/migrator.d.ts +2 -1
- package/aws-data-api/pg/migrator.js.map +1 -1
- package/aws-data-api/pg/session.cjs +67 -4
- package/aws-data-api/pg/session.cjs.map +1 -1
- package/aws-data-api/pg/session.d.cts +13 -8
- package/aws-data-api/pg/session.d.ts +13 -8
- package/aws-data-api/pg/session.js +67 -4
- package/aws-data-api/pg/session.js.map +1 -1
- package/better-sqlite3/driver.cjs +12 -5
- package/better-sqlite3/driver.cjs.map +1 -1
- package/better-sqlite3/driver.d.cts +7 -6
- package/better-sqlite3/driver.d.ts +7 -6
- package/better-sqlite3/driver.js +12 -8
- package/better-sqlite3/driver.js.map +1 -1
- package/better-sqlite3/migrator.cjs.map +1 -1
- package/better-sqlite3/migrator.d.cts +2 -1
- package/better-sqlite3/migrator.d.ts +2 -1
- package/better-sqlite3/migrator.js.map +1 -1
- package/better-sqlite3/session.cjs +49 -4
- package/better-sqlite3/session.cjs.map +1 -1
- package/better-sqlite3/session.d.cts +14 -8
- package/better-sqlite3/session.d.ts +14 -8
- package/better-sqlite3/session.js +49 -4
- package/better-sqlite3/session.js.map +1 -1
- package/bun-sqlite/driver.cjs +22 -5
- package/bun-sqlite/driver.cjs.map +1 -1
- package/bun-sqlite/driver.d.cts +7 -6
- package/bun-sqlite/driver.d.ts +7 -6
- package/bun-sqlite/driver.js +12 -8
- package/bun-sqlite/driver.js.map +1 -1
- package/bun-sqlite/migrator.cjs.map +1 -1
- package/bun-sqlite/migrator.d.cts +2 -1
- package/bun-sqlite/migrator.d.ts +2 -1
- package/bun-sqlite/migrator.js.map +1 -1
- package/bun-sqlite/session.cjs +49 -4
- package/bun-sqlite/session.cjs.map +1 -1
- package/bun-sqlite/session.d.cts +14 -8
- package/bun-sqlite/session.d.ts +14 -8
- package/bun-sqlite/session.js +49 -4
- package/bun-sqlite/session.js.map +1 -1
- package/column-builder.cjs.map +1 -1
- package/column-builder.d.cts +3 -4
- package/column-builder.d.ts +3 -4
- package/column-builder.js.map +1 -1
- package/d1/driver.cjs +22 -5
- package/d1/driver.cjs.map +1 -1
- package/d1/driver.d.cts +3 -2
- package/d1/driver.d.ts +3 -2
- package/d1/driver.js +12 -8
- package/d1/driver.js.map +1 -1
- package/d1/migrator.cjs.map +1 -1
- package/d1/migrator.d.cts +2 -1
- package/d1/migrator.d.ts +2 -1
- package/d1/migrator.js.map +1 -1
- package/d1/session.cjs +48 -6
- package/d1/session.cjs.map +1 -1
- package/d1/session.d.cts +15 -8
- package/d1/session.d.ts +15 -8
- package/d1/session.js +48 -6
- package/d1/session.js.map +1 -1
- package/expo-sqlite/driver.cjs +22 -5
- package/expo-sqlite/driver.cjs.map +1 -1
- package/expo-sqlite/driver.d.cts +3 -2
- package/expo-sqlite/driver.d.ts +3 -2
- package/expo-sqlite/driver.js +12 -8
- package/expo-sqlite/driver.js.map +1 -1
- package/expo-sqlite/migrator.cjs.map +1 -1
- package/expo-sqlite/migrator.d.cts +3 -2
- package/expo-sqlite/migrator.d.ts +3 -2
- package/expo-sqlite/migrator.js.map +1 -1
- package/expo-sqlite/query.cjs +13 -2
- package/expo-sqlite/query.cjs.map +1 -1
- package/expo-sqlite/query.d.cts +2 -1
- package/expo-sqlite/query.d.ts +2 -1
- package/expo-sqlite/query.js +3 -2
- package/expo-sqlite/query.js.map +1 -1
- package/expo-sqlite/session.cjs +47 -4
- package/expo-sqlite/session.cjs.map +1 -1
- package/expo-sqlite/session.d.cts +14 -8
- package/expo-sqlite/session.d.ts +14 -8
- package/expo-sqlite/session.js +47 -4
- package/expo-sqlite/session.js.map +1 -1
- package/libsql/driver-core.cjs +22 -5
- package/libsql/driver-core.cjs.map +1 -1
- package/libsql/driver-core.d.cts +2 -1
- package/libsql/driver-core.d.ts +2 -1
- package/libsql/driver-core.js +12 -8
- package/libsql/driver-core.js.map +1 -1
- package/libsql/driver.cjs.map +1 -1
- package/libsql/driver.d.cts +6 -5
- package/libsql/driver.d.ts +6 -5
- package/libsql/driver.js.map +1 -1
- package/libsql/http/index.cjs.map +1 -1
- package/libsql/http/index.d.cts +6 -5
- package/libsql/http/index.d.ts +6 -5
- package/libsql/http/index.js.map +1 -1
- package/libsql/migrator.cjs.map +1 -1
- package/libsql/migrator.d.cts +2 -1
- package/libsql/migrator.d.ts +2 -1
- package/libsql/migrator.js.map +1 -1
- package/libsql/node/index.cjs.map +1 -1
- package/libsql/node/index.d.cts +6 -5
- package/libsql/node/index.d.ts +6 -5
- package/libsql/node/index.js.map +1 -1
- package/libsql/session.cjs +60 -4
- package/libsql/session.cjs.map +1 -1
- package/libsql/session.d.cts +15 -9
- package/libsql/session.d.ts +15 -9
- package/libsql/session.js +60 -4
- package/libsql/session.js.map +1 -1
- package/libsql/sqlite3/index.cjs.map +1 -1
- package/libsql/sqlite3/index.d.cts +6 -5
- package/libsql/sqlite3/index.d.ts +6 -5
- package/libsql/sqlite3/index.js.map +1 -1
- package/libsql/wasm/index.cjs.map +1 -1
- package/libsql/wasm/index.d.cts +6 -5
- package/libsql/wasm/index.d.ts +6 -5
- package/libsql/wasm/index.js.map +1 -1
- package/libsql/web/index.cjs.map +1 -1
- package/libsql/web/index.d.cts +6 -5
- package/libsql/web/index.d.ts +6 -5
- package/libsql/web/index.js.map +1 -1
- package/libsql/ws/index.cjs.map +1 -1
- package/libsql/ws/index.d.cts +6 -5
- package/libsql/ws/index.d.ts +6 -5
- package/libsql/ws/index.js.map +1 -1
- package/mysql-core/db.cjs +29 -8
- package/mysql-core/db.cjs.map +1 -1
- package/mysql-core/db.d.cts +15 -8
- package/mysql-core/db.d.ts +15 -8
- package/mysql-core/db.js +28 -7
- package/mysql-core/db.js.map +1 -1
- package/mysql-core/dialect.cjs +170 -15
- package/mysql-core/dialect.cjs.map +1 -1
- package/mysql-core/dialect.d.cts +29 -13
- package/mysql-core/dialect.d.ts +29 -13
- package/mysql-core/dialect.js +167 -21
- package/mysql-core/dialect.js.map +1 -1
- package/{singlestore-core/query-builders/query.cjs → mysql-core/query-builders/_query.cjs} +41 -18
- package/mysql-core/query-builders/_query.cjs.map +1 -0
- package/mysql-core/query-builders/_query.d.cts +44 -0
- package/mysql-core/query-builders/_query.d.ts +44 -0
- package/{singlestore-core/query-builders/query.js → mysql-core/query-builders/_query.js} +29 -18
- package/mysql-core/query-builders/_query.js.map +1 -0
- package/mysql-core/query-builders/count.cjs.map +1 -1
- package/mysql-core/query-builders/count.d.cts +1 -1
- package/mysql-core/query-builders/count.d.ts +1 -1
- package/mysql-core/query-builders/count.js.map +1 -1
- package/mysql-core/query-builders/query.cjs +18 -31
- package/mysql-core/query-builders/query.cjs.map +1 -1
- package/mysql-core/query-builders/query.d.cts +8 -10
- package/mysql-core/query-builders/query.d.ts +8 -10
- package/mysql-core/query-builders/query.js +18 -31
- package/mysql-core/query-builders/query.js.map +1 -1
- package/mysql-core/session.cjs +3 -2
- package/mysql-core/session.cjs.map +1 -1
- package/mysql-core/session.d.cts +10 -7
- package/mysql-core/session.d.ts +10 -7
- package/mysql-core/session.js +3 -2
- package/mysql-core/session.js.map +1 -1
- package/mysql-proxy/driver.cjs +22 -5
- package/mysql-proxy/driver.cjs.map +1 -1
- package/mysql-proxy/driver.d.cts +3 -2
- package/mysql-proxy/driver.d.ts +3 -2
- package/mysql-proxy/driver.js +12 -8
- package/mysql-proxy/driver.js.map +1 -1
- package/mysql-proxy/migrator.cjs.map +1 -1
- package/mysql-proxy/migrator.d.cts +2 -1
- package/mysql-proxy/migrator.d.ts +2 -1
- package/mysql-proxy/migrator.js.map +1 -1
- package/mysql-proxy/session.cjs +47 -2
- package/mysql-proxy/session.cjs.map +1 -1
- package/mysql-proxy/session.d.cts +13 -8
- package/mysql-proxy/session.d.ts +13 -8
- package/mysql-proxy/session.js +47 -2
- package/mysql-proxy/session.js.map +1 -1
- package/mysql2/driver.cjs +24 -7
- package/mysql2/driver.cjs.map +1 -1
- package/mysql2/driver.d.cts +10 -9
- package/mysql2/driver.d.ts +10 -9
- package/mysql2/driver.js +14 -10
- package/mysql2/driver.js.map +1 -1
- package/mysql2/migrator.cjs.map +1 -1
- package/mysql2/migrator.d.cts +2 -1
- package/mysql2/migrator.d.ts +2 -1
- package/mysql2/migrator.js.map +1 -1
- package/mysql2/session.cjs +51 -2
- package/mysql2/session.cjs.map +1 -1
- package/mysql2/session.d.cts +13 -8
- package/mysql2/session.d.ts +13 -8
- package/mysql2/session.js +51 -2
- package/mysql2/session.js.map +1 -1
- package/neon-http/driver.cjs +22 -8
- package/neon-http/driver.cjs.map +1 -1
- package/neon-http/driver.d.cts +11 -10
- package/neon-http/driver.d.ts +11 -10
- package/neon-http/driver.js +12 -8
- package/neon-http/driver.js.map +1 -1
- package/neon-http/migrator.cjs.map +1 -1
- package/neon-http/migrator.d.cts +2 -1
- package/neon-http/migrator.d.ts +2 -1
- package/neon-http/migrator.js.map +1 -1
- package/neon-http/session.cjs +32 -2
- package/neon-http/session.cjs.map +1 -1
- package/neon-http/session.d.cts +13 -8
- package/neon-http/session.d.ts +13 -8
- package/neon-http/session.js +32 -2
- package/neon-http/session.js.map +1 -1
- package/neon-serverless/driver.cjs +18 -7
- package/neon-serverless/driver.cjs.map +1 -1
- package/neon-serverless/driver.d.cts +9 -8
- package/neon-serverless/driver.d.ts +9 -8
- package/neon-serverless/driver.js +8 -10
- package/neon-serverless/driver.js.map +1 -1
- package/neon-serverless/migrator.cjs.map +1 -1
- package/neon-serverless/migrator.d.cts +2 -1
- package/neon-serverless/migrator.d.ts +2 -1
- package/neon-serverless/migrator.js.map +1 -1
- package/neon-serverless/session.cjs +40 -5
- package/neon-serverless/session.cjs.map +1 -1
- package/neon-serverless/session.d.cts +13 -8
- package/neon-serverless/session.d.ts +13 -8
- package/neon-serverless/session.js +40 -5
- package/neon-serverless/session.js.map +1 -1
- package/node-postgres/driver.cjs +13 -7
- package/node-postgres/driver.cjs.map +1 -1
- package/node-postgres/driver.d.cts +9 -8
- package/node-postgres/driver.d.ts +9 -8
- package/node-postgres/driver.js +13 -10
- package/node-postgres/driver.js.map +1 -1
- package/node-postgres/migrator.cjs.map +1 -1
- package/node-postgres/migrator.d.cts +2 -1
- package/node-postgres/migrator.d.ts +2 -1
- package/node-postgres/migrator.js.map +1 -1
- package/node-postgres/session.cjs +45 -4
- package/node-postgres/session.cjs.map +1 -1
- package/node-postgres/session.d.cts +13 -8
- package/node-postgres/session.d.ts +13 -8
- package/node-postgres/session.js +45 -4
- package/node-postgres/session.js.map +1 -1
- package/op-sqlite/driver.cjs +22 -5
- package/op-sqlite/driver.cjs.map +1 -1
- package/op-sqlite/driver.d.cts +3 -2
- package/op-sqlite/driver.d.ts +3 -2
- package/op-sqlite/driver.js +12 -8
- package/op-sqlite/driver.js.map +1 -1
- package/op-sqlite/migrator.cjs.map +1 -1
- package/op-sqlite/migrator.d.cts +3 -2
- package/op-sqlite/migrator.d.ts +3 -2
- package/op-sqlite/migrator.js.map +1 -1
- package/op-sqlite/session.cjs +47 -4
- package/op-sqlite/session.cjs.map +1 -1
- package/op-sqlite/session.d.cts +14 -8
- package/op-sqlite/session.d.ts +14 -8
- package/op-sqlite/session.js +47 -4
- package/op-sqlite/session.js.map +1 -1
- package/package.json +65 -798
- package/pg-core/db.cjs +31 -7
- package/pg-core/db.cjs.map +1 -1
- package/pg-core/db.d.cts +18 -11
- package/pg-core/db.d.ts +18 -11
- package/pg-core/db.js +30 -6
- package/pg-core/db.js.map +1 -1
- package/pg-core/dialect.cjs +146 -488
- package/pg-core/dialect.cjs.map +1 -1
- package/pg-core/dialect.d.cts +21 -7
- package/pg-core/dialect.d.ts +21 -7
- package/pg-core/dialect.js +143 -494
- package/pg-core/dialect.js.map +1 -1
- package/pg-core/query-builders/_query.cjs +155 -0
- package/pg-core/query-builders/_query.cjs.map +1 -0
- package/pg-core/query-builders/_query.d.cts +47 -0
- package/pg-core/query-builders/_query.d.ts +47 -0
- package/pg-core/query-builders/_query.js +120 -0
- package/pg-core/query-builders/_query.js.map +1 -0
- package/pg-core/query-builders/count.cjs +0 -1
- package/pg-core/query-builders/count.cjs.map +1 -1
- package/pg-core/query-builders/count.d.cts +2 -3
- package/pg-core/query-builders/count.d.ts +2 -3
- package/pg-core/query-builders/count.js +0 -1
- package/pg-core/query-builders/count.js.map +1 -1
- package/pg-core/query-builders/delete.cjs.map +1 -1
- package/pg-core/query-builders/delete.js.map +1 -1
- package/pg-core/query-builders/insert.cjs +9 -1
- package/pg-core/query-builders/insert.cjs.map +1 -1
- package/pg-core/query-builders/insert.js +9 -1
- package/pg-core/query-builders/insert.js.map +1 -1
- package/pg-core/query-builders/query.cjs +15 -18
- package/pg-core/query-builders/query.cjs.map +1 -1
- package/pg-core/query-builders/query.d.cts +6 -6
- package/pg-core/query-builders/query.d.ts +6 -6
- package/pg-core/query-builders/query.js +15 -18
- package/pg-core/query-builders/query.js.map +1 -1
- package/pg-core/query-builders/refresh-materialized-view.cjs.map +1 -1
- package/pg-core/query-builders/refresh-materialized-view.js.map +1 -1
- package/pg-core/query-builders/select.cjs +10 -2
- package/pg-core/query-builders/select.cjs.map +1 -1
- package/pg-core/query-builders/select.js +11 -8
- package/pg-core/query-builders/select.js.map +1 -1
- package/pg-core/query-builders/update.cjs +7 -1
- package/pg-core/query-builders/update.cjs.map +1 -1
- package/pg-core/query-builders/update.d.cts +2 -2
- package/pg-core/query-builders/update.d.ts +2 -2
- package/pg-core/query-builders/update.js +8 -6
- package/pg-core/query-builders/update.js.map +1 -1
- package/pg-core/session.cjs +3 -2
- package/pg-core/session.cjs.map +1 -1
- package/pg-core/session.d.cts +10 -8
- package/pg-core/session.d.ts +10 -8
- package/pg-core/session.js +3 -2
- package/pg-core/session.js.map +1 -1
- package/pg-proxy/driver.cjs +21 -5
- package/pg-proxy/driver.cjs.map +1 -1
- package/pg-proxy/driver.d.cts +3 -2
- package/pg-proxy/driver.d.ts +3 -2
- package/pg-proxy/driver.js +11 -8
- package/pg-proxy/driver.js.map +1 -1
- package/pg-proxy/migrator.cjs.map +1 -1
- package/pg-proxy/migrator.d.cts +2 -1
- package/pg-proxy/migrator.d.ts +2 -1
- package/pg-proxy/migrator.js.map +1 -1
- package/pg-proxy/session.cjs +37 -2
- package/pg-proxy/session.cjs.map +1 -1
- package/pg-proxy/session.d.cts +13 -8
- package/pg-proxy/session.d.ts +13 -8
- package/pg-proxy/session.js +37 -2
- package/pg-proxy/session.js.map +1 -1
- package/pglite/driver.cjs +23 -7
- package/pglite/driver.cjs.map +1 -1
- package/pglite/driver.d.cts +9 -8
- package/pglite/driver.d.ts +9 -8
- package/pglite/driver.js +13 -10
- package/pglite/driver.js.map +1 -1
- package/pglite/migrator.cjs.map +1 -1
- package/pglite/migrator.d.cts +2 -1
- package/pglite/migrator.d.ts +2 -1
- package/pglite/migrator.js.map +1 -1
- package/pglite/session.cjs +34 -3
- package/pglite/session.cjs.map +1 -1
- package/pglite/session.d.cts +13 -8
- package/pglite/session.d.ts +13 -8
- package/pglite/session.js +34 -3
- package/pglite/session.js.map +1 -1
- package/planetscale-serverless/driver.cjs +22 -5
- package/planetscale-serverless/driver.cjs.map +1 -1
- package/planetscale-serverless/driver.d.cts +7 -6
- package/planetscale-serverless/driver.d.ts +7 -6
- package/planetscale-serverless/driver.js +12 -8
- package/planetscale-serverless/driver.js.map +1 -1
- package/planetscale-serverless/migrator.cjs.map +1 -1
- package/planetscale-serverless/migrator.d.cts +2 -1
- package/planetscale-serverless/migrator.d.ts +2 -1
- package/planetscale-serverless/migrator.js.map +1 -1
- package/planetscale-serverless/session.cjs +68 -5
- package/planetscale-serverless/session.cjs.map +1 -1
- package/planetscale-serverless/session.d.cts +14 -9
- package/planetscale-serverless/session.d.ts +14 -9
- package/planetscale-serverless/session.js +68 -5
- package/planetscale-serverless/session.js.map +1 -1
- package/postgres-js/driver.cjs +12 -6
- package/postgres-js/driver.cjs.map +1 -1
- package/postgres-js/driver.d.cts +7 -6
- package/postgres-js/driver.d.ts +7 -6
- package/postgres-js/driver.js +12 -9
- package/postgres-js/driver.js.map +1 -1
- package/postgres-js/migrator.cjs.map +1 -1
- package/postgres-js/migrator.d.cts +2 -1
- package/postgres-js/migrator.d.ts +2 -1
- package/postgres-js/migrator.js.map +1 -1
- package/postgres-js/session.cjs +51 -6
- package/postgres-js/session.cjs.map +1 -1
- package/postgres-js/session.d.cts +15 -9
- package/postgres-js/session.d.ts +15 -9
- package/postgres-js/session.js +51 -6
- package/postgres-js/session.js.map +1 -1
- package/prisma/mysql/driver.cjs +1 -1
- package/prisma/mysql/driver.cjs.map +1 -1
- package/prisma/mysql/driver.js +1 -1
- package/prisma/mysql/driver.js.map +1 -1
- package/prisma/mysql/session.cjs +3 -0
- package/prisma/mysql/session.cjs.map +1 -1
- package/prisma/mysql/session.d.cts +3 -1
- package/prisma/mysql/session.d.ts +3 -1
- package/prisma/mysql/session.js +3 -0
- package/prisma/mysql/session.js.map +1 -1
- package/prisma/pg/driver.cjs +1 -1
- package/prisma/pg/driver.cjs.map +1 -1
- package/prisma/pg/driver.js +1 -1
- package/prisma/pg/driver.js.map +1 -1
- package/prisma/pg/session.cjs +3 -0
- package/prisma/pg/session.cjs.map +1 -1
- package/prisma/pg/session.d.cts +3 -1
- package/prisma/pg/session.d.ts +3 -1
- package/prisma/pg/session.js +3 -0
- package/prisma/pg/session.js.map +1 -1
- package/prisma/sqlite/driver.cjs +1 -1
- package/prisma/sqlite/driver.cjs.map +1 -1
- package/prisma/sqlite/driver.js +1 -1
- package/prisma/sqlite/driver.js.map +1 -1
- package/prisma/sqlite/session.cjs +3 -0
- package/prisma/sqlite/session.cjs.map +1 -1
- package/prisma/sqlite/session.d.cts +4 -2
- package/prisma/sqlite/session.d.ts +4 -2
- package/prisma/sqlite/session.js +3 -0
- package/prisma/sqlite/session.js.map +1 -1
- package/relations.cjs +468 -245
- package/relations.cjs.map +1 -1
- package/relations.d.cts +264 -125
- package/relations.d.ts +264 -125
- package/relations.js +455 -238
- package/relations.js.map +1 -1
- package/sql/sql.cjs.map +1 -1
- package/sql/sql.d.cts +4 -4
- package/sql/sql.d.ts +4 -4
- package/sql/sql.js.map +1 -1
- package/sql-js/driver.cjs +16 -5
- package/sql-js/driver.cjs.map +1 -1
- package/sql-js/driver.d.cts +3 -2
- package/sql-js/driver.d.ts +3 -2
- package/sql-js/driver.js +6 -8
- package/sql-js/driver.js.map +1 -1
- package/sql-js/migrator.cjs.map +1 -1
- package/sql-js/migrator.d.cts +2 -1
- package/sql-js/migrator.d.ts +2 -1
- package/sql-js/migrator.js.map +1 -1
- package/sql-js/session.cjs +58 -4
- package/sql-js/session.cjs.map +1 -1
- package/sql-js/session.d.cts +14 -8
- package/sql-js/session.d.ts +14 -8
- package/sql-js/session.js +58 -4
- package/sql-js/session.js.map +1 -1
- package/sqlite-core/columns/blob.cjs +2 -16
- package/sqlite-core/columns/blob.cjs.map +1 -1
- package/sqlite-core/columns/blob.d.cts +2 -2
- package/sqlite-core/columns/blob.d.ts +2 -2
- package/sqlite-core/columns/blob.js +2 -16
- package/sqlite-core/columns/blob.js.map +1 -1
- package/sqlite-core/db.cjs +35 -14
- package/sqlite-core/db.cjs.map +1 -1
- package/sqlite-core/db.d.cts +15 -8
- package/sqlite-core/db.d.ts +15 -8
- package/sqlite-core/db.js +34 -13
- package/sqlite-core/db.js.map +1 -1
- package/sqlite-core/dialect.cjs +164 -7
- package/sqlite-core/dialect.cjs.map +1 -1
- package/sqlite-core/dialect.d.cts +25 -9
- package/sqlite-core/dialect.d.ts +25 -9
- package/sqlite-core/dialect.js +161 -13
- package/sqlite-core/dialect.js.map +1 -1
- package/sqlite-core/query-builders/_query.cjs +187 -0
- package/sqlite-core/query-builders/_query.cjs.map +1 -0
- package/sqlite-core/query-builders/_query.d.cts +55 -0
- package/sqlite-core/query-builders/_query.d.ts +55 -0
- package/sqlite-core/query-builders/_query.js +151 -0
- package/sqlite-core/query-builders/_query.js.map +1 -0
- package/sqlite-core/query-builders/count.cjs.map +1 -1
- package/sqlite-core/query-builders/count.d.cts +1 -1
- package/sqlite-core/query-builders/count.d.ts +1 -1
- package/sqlite-core/query-builders/count.js.map +1 -1
- package/sqlite-core/query-builders/delete.cjs.map +1 -1
- package/sqlite-core/query-builders/delete.d.cts +1 -1
- package/sqlite-core/query-builders/delete.d.ts +1 -1
- package/sqlite-core/query-builders/delete.js.map +1 -1
- package/sqlite-core/query-builders/insert.cjs.map +1 -1
- package/sqlite-core/query-builders/insert.d.cts +3 -3
- package/sqlite-core/query-builders/insert.d.ts +3 -3
- package/sqlite-core/query-builders/insert.js.map +1 -1
- package/sqlite-core/query-builders/query.cjs +30 -48
- package/sqlite-core/query-builders/query.cjs.map +1 -1
- package/sqlite-core/query-builders/query.d.cts +14 -16
- package/sqlite-core/query-builders/query.d.ts +14 -16
- package/sqlite-core/query-builders/query.js +30 -48
- package/sqlite-core/query-builders/query.js.map +1 -1
- package/sqlite-core/query-builders/select.cjs.map +1 -1
- package/sqlite-core/query-builders/select.d.cts +3 -3
- package/sqlite-core/query-builders/select.d.ts +3 -3
- package/sqlite-core/query-builders/select.js.map +1 -1
- package/sqlite-core/query-builders/update.cjs.map +1 -1
- package/sqlite-core/query-builders/update.d.cts +3 -3
- package/sqlite-core/query-builders/update.d.ts +3 -3
- package/sqlite-core/query-builders/update.js.map +1 -1
- package/sqlite-core/session.cjs +6 -2
- package/sqlite-core/session.cjs.map +1 -1
- package/sqlite-core/session.d.cts +14 -6
- package/sqlite-core/session.d.ts +14 -6
- package/sqlite-core/session.js +6 -2
- package/sqlite-core/session.js.map +1 -1
- package/sqlite-proxy/driver.cjs +22 -5
- package/sqlite-proxy/driver.cjs.map +1 -1
- package/sqlite-proxy/driver.d.cts +4 -3
- package/sqlite-proxy/driver.d.ts +4 -3
- package/sqlite-proxy/driver.js +12 -5
- package/sqlite-proxy/driver.js.map +1 -1
- package/sqlite-proxy/migrator.cjs.map +1 -1
- package/sqlite-proxy/migrator.d.cts +2 -1
- package/sqlite-proxy/migrator.d.ts +2 -1
- package/sqlite-proxy/migrator.js.map +1 -1
- package/sqlite-proxy/session.cjs +47 -4
- package/sqlite-proxy/session.cjs.map +1 -1
- package/sqlite-proxy/session.d.cts +14 -8
- package/sqlite-proxy/session.d.ts +14 -8
- package/sqlite-proxy/session.js +47 -4
- package/sqlite-proxy/session.js.map +1 -1
- package/table.cjs.map +1 -1
- package/table.d.cts +1 -1
- package/table.d.ts +1 -1
- package/table.js.map +1 -1
- package/tidb-serverless/driver.cjs +22 -5
- package/tidb-serverless/driver.cjs.map +1 -1
- package/tidb-serverless/driver.d.cts +7 -6
- package/tidb-serverless/driver.d.ts +7 -6
- package/tidb-serverless/driver.js +12 -8
- package/tidb-serverless/driver.js.map +1 -1
- package/tidb-serverless/migrator.cjs.map +1 -1
- package/tidb-serverless/migrator.d.cts +2 -1
- package/tidb-serverless/migrator.d.ts +2 -1
- package/tidb-serverless/migrator.js.map +1 -1
- package/tidb-serverless/session.cjs +62 -5
- package/tidb-serverless/session.cjs.map +1 -1
- package/tidb-serverless/session.d.cts +14 -9
- package/tidb-serverless/session.d.ts +14 -9
- package/tidb-serverless/session.js +62 -5
- package/tidb-serverless/session.js.map +1 -1
- package/utils.cjs +2 -2
- package/utils.cjs.map +1 -1
- package/utils.d.cts +3 -2
- package/utils.d.ts +3 -2
- package/utils.js +2 -2
- package/utils.js.map +1 -1
- package/vercel-postgres/driver.cjs +23 -7
- package/vercel-postgres/driver.cjs.map +1 -1
- package/vercel-postgres/driver.d.cts +9 -8
- package/vercel-postgres/driver.d.ts +9 -8
- package/vercel-postgres/driver.js +13 -10
- package/vercel-postgres/driver.js.map +1 -1
- package/vercel-postgres/migrator.cjs.map +1 -1
- package/vercel-postgres/migrator.d.cts +2 -1
- package/vercel-postgres/migrator.d.ts +2 -1
- package/vercel-postgres/migrator.js.map +1 -1
- package/vercel-postgres/session.cjs +34 -4
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.d.cts +13 -8
- package/vercel-postgres/session.d.ts +13 -8
- package/vercel-postgres/session.js +34 -4
- 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/driver.cjs +17 -5
- package/xata-http/driver.cjs.map +1 -1
- package/xata-http/driver.d.cts +5 -4
- package/xata-http/driver.d.ts +5 -4
- package/xata-http/driver.js +7 -5
- package/xata-http/driver.js.map +1 -1
- package/xata-http/migrator.cjs.map +1 -1
- package/xata-http/migrator.d.cts +2 -1
- package/xata-http/migrator.d.ts +2 -1
- package/xata-http/migrator.js.map +1 -1
- package/xata-http/session.cjs +30 -2
- package/xata-http/session.cjs.map +1 -1
- package/xata-http/session.d.cts +13 -8
- package/xata-http/session.d.ts +13 -8
- package/xata-http/session.js +30 -2
- package/xata-http/session.js.map +1 -1
- package/durable-sqlite/driver.cjs +0 -64
- package/durable-sqlite/driver.cjs.map +0 -1
- package/durable-sqlite/driver.d.cts +0 -9
- package/durable-sqlite/driver.d.ts +0 -9
- package/durable-sqlite/driver.js +0 -42
- package/durable-sqlite/driver.js.map +0 -1
- package/durable-sqlite/index.cjs +0 -25
- package/durable-sqlite/index.cjs.map +0 -1
- package/durable-sqlite/index.d.cts +0 -2
- package/durable-sqlite/index.d.ts +0 -2
- package/durable-sqlite/index.js +0 -3
- package/durable-sqlite/index.js.map +0 -1
- package/durable-sqlite/migrator.cjs +0 -85
- package/durable-sqlite/migrator.cjs.map +0 -1
- package/durable-sqlite/migrator.d.cts +0 -14
- package/durable-sqlite/migrator.d.ts +0 -14
- package/durable-sqlite/migrator.js +0 -61
- package/durable-sqlite/migrator.js.map +0 -1
- package/durable-sqlite/session.cjs +0 -131
- package/durable-sqlite/session.cjs.map +0 -1
- package/durable-sqlite/session.d.cts +0 -46
- package/durable-sqlite/session.d.ts +0 -46
- package/durable-sqlite/session.js +0 -107
- package/durable-sqlite/session.js.map +0 -1
- package/singlestore/driver.cjs +0 -113
- package/singlestore/driver.cjs.map +0 -1
- package/singlestore/driver.d.cts +0 -52
- package/singlestore/driver.d.ts +0 -52
- package/singlestore/driver.js +0 -89
- package/singlestore/driver.js.map +0 -1
- package/singlestore/index.cjs +0 -25
- package/singlestore/index.cjs.map +0 -1
- package/singlestore/index.d.cts +0 -2
- package/singlestore/index.d.ts +0 -2
- package/singlestore/index.js +0 -3
- package/singlestore/index.js.map +0 -1
- package/singlestore/migrator.cjs +0 -33
- package/singlestore/migrator.cjs.map +0 -1
- package/singlestore/migrator.d.cts +0 -3
- package/singlestore/migrator.d.ts +0 -3
- package/singlestore/migrator.js +0 -9
- package/singlestore/migrator.js.map +0 -1
- package/singlestore/session.cjs +0 -258
- package/singlestore/session.cjs.map +0 -1
- package/singlestore/session.d.cts +0 -52
- package/singlestore/session.d.ts +0 -52
- package/singlestore/session.js +0 -236
- package/singlestore/session.js.map +0 -1
- package/singlestore-core/alias.cjs +0 -32
- package/singlestore-core/alias.cjs.map +0 -1
- package/singlestore-core/alias.d.cts +0 -4
- package/singlestore-core/alias.d.ts +0 -4
- package/singlestore-core/alias.js +0 -8
- package/singlestore-core/alias.js.map +0 -1
- package/singlestore-core/columns/all.cjs +0 -80
- package/singlestore-core/columns/all.cjs.map +0 -1
- package/singlestore-core/columns/all.d.cts +0 -51
- package/singlestore-core/columns/all.d.ts +0 -51
- package/singlestore-core/columns/all.js +0 -56
- package/singlestore-core/columns/all.js.map +0 -1
- package/singlestore-core/columns/bigint.cjs +0 -96
- package/singlestore-core/columns/bigint.cjs.map +0 -1
- package/singlestore-core/columns/bigint.d.cts +0 -54
- package/singlestore-core/columns/bigint.d.ts +0 -54
- package/singlestore-core/columns/bigint.js +0 -68
- package/singlestore-core/columns/bigint.js.map +0 -1
- package/singlestore-core/columns/binary.cjs +0 -60
- package/singlestore-core/columns/binary.cjs.map +0 -1
- package/singlestore-core/columns/binary.d.cts +0 -28
- package/singlestore-core/columns/binary.d.ts +0 -28
- package/singlestore-core/columns/binary.js +0 -34
- package/singlestore-core/columns/binary.js.map +0 -1
- package/singlestore-core/columns/boolean.cjs +0 -62
- package/singlestore-core/columns/boolean.cjs.map +0 -1
- package/singlestore-core/columns/boolean.d.cts +0 -24
- package/singlestore-core/columns/boolean.d.ts +0 -24
- package/singlestore-core/columns/boolean.js +0 -36
- package/singlestore-core/columns/boolean.js.map +0 -1
- package/singlestore-core/columns/char.cjs +0 -62
- package/singlestore-core/columns/char.cjs.map +0 -1
- package/singlestore-core/columns/char.d.cts +0 -31
- package/singlestore-core/columns/char.d.ts +0 -31
- package/singlestore-core/columns/char.js +0 -36
- package/singlestore-core/columns/char.js.map +0 -1
- package/singlestore-core/columns/common.cjs +0 -82
- package/singlestore-core/columns/common.cjs.map +0 -1
- package/singlestore-core/columns/common.d.cts +0 -42
- package/singlestore-core/columns/common.d.ts +0 -42
- package/singlestore-core/columns/common.js +0 -55
- package/singlestore-core/columns/common.js.map +0 -1
- package/singlestore-core/columns/custom.cjs +0 -77
- package/singlestore-core/columns/custom.cjs.map +0 -1
- package/singlestore-core/columns/custom.d.cts +0 -156
- package/singlestore-core/columns/custom.d.ts +0 -156
- package/singlestore-core/columns/custom.js +0 -51
- package/singlestore-core/columns/custom.js.map +0 -1
- package/singlestore-core/columns/date.cjs +0 -93
- package/singlestore-core/columns/date.cjs.map +0 -1
- package/singlestore-core/columns/date.common.cjs +0 -48
- package/singlestore-core/columns/date.common.cjs.map +0 -1
- package/singlestore-core/columns/date.common.d.cts +0 -16
- package/singlestore-core/columns/date.common.d.ts +0 -16
- package/singlestore-core/columns/date.common.js +0 -23
- package/singlestore-core/columns/date.common.js.map +0 -1
- package/singlestore-core/columns/date.d.cts +0 -53
- package/singlestore-core/columns/date.d.ts +0 -53
- package/singlestore-core/columns/date.js +0 -65
- package/singlestore-core/columns/date.js.map +0 -1
- package/singlestore-core/columns/datetime.cjs +0 -106
- package/singlestore-core/columns/datetime.cjs.map +0 -1
- package/singlestore-core/columns/datetime.d.cts +0 -54
- package/singlestore-core/columns/datetime.d.ts +0 -54
- package/singlestore-core/columns/datetime.js +0 -78
- package/singlestore-core/columns/datetime.js.map +0 -1
- package/singlestore-core/columns/decimal.cjs +0 -76
- package/singlestore-core/columns/decimal.cjs.map +0 -1
- package/singlestore-core/columns/decimal.d.cts +0 -32
- package/singlestore-core/columns/decimal.d.ts +0 -32
- package/singlestore-core/columns/decimal.js +0 -50
- package/singlestore-core/columns/decimal.js.map +0 -1
- package/singlestore-core/columns/double.cjs +0 -72
- package/singlestore-core/columns/double.cjs.map +0 -1
- package/singlestore-core/columns/double.d.cts +0 -32
- package/singlestore-core/columns/double.d.ts +0 -32
- package/singlestore-core/columns/double.js +0 -46
- package/singlestore-core/columns/double.js.map +0 -1
- package/singlestore-core/columns/enum.cjs +0 -67
- package/singlestore-core/columns/enum.cjs.map +0 -1
- package/singlestore-core/columns/enum.d.cts +0 -31
- package/singlestore-core/columns/enum.d.ts +0 -31
- package/singlestore-core/columns/enum.js +0 -41
- package/singlestore-core/columns/enum.js.map +0 -1
- package/singlestore-core/columns/float.cjs +0 -72
- package/singlestore-core/columns/float.cjs.map +0 -1
- package/singlestore-core/columns/float.d.cts +0 -32
- package/singlestore-core/columns/float.d.ts +0 -32
- package/singlestore-core/columns/float.js +0 -46
- package/singlestore-core/columns/float.js.map +0 -1
- package/singlestore-core/columns/index.cjs +0 -71
- package/singlestore-core/columns/index.cjs.map +0 -1
- package/singlestore-core/columns/index.d.cts +0 -25
- package/singlestore-core/columns/index.d.ts +0 -25
- package/singlestore-core/columns/index.js +0 -26
- package/singlestore-core/columns/index.js.map +0 -1
- package/singlestore-core/columns/int.cjs +0 -65
- package/singlestore-core/columns/int.cjs.map +0 -1
- package/singlestore-core/columns/int.d.cts +0 -28
- package/singlestore-core/columns/int.d.ts +0 -28
- package/singlestore-core/columns/int.js +0 -39
- package/singlestore-core/columns/int.js.map +0 -1
- package/singlestore-core/columns/json.cjs +0 -59
- package/singlestore-core/columns/json.cjs.map +0 -1
- package/singlestore-core/columns/json.d.cts +0 -24
- package/singlestore-core/columns/json.d.ts +0 -24
- package/singlestore-core/columns/json.js +0 -33
- package/singlestore-core/columns/json.js.map +0 -1
- package/singlestore-core/columns/mediumint.cjs +0 -65
- package/singlestore-core/columns/mediumint.cjs.map +0 -1
- package/singlestore-core/columns/mediumint.d.cts +0 -26
- package/singlestore-core/columns/mediumint.d.ts +0 -26
- package/singlestore-core/columns/mediumint.js +0 -39
- package/singlestore-core/columns/mediumint.js.map +0 -1
- package/singlestore-core/columns/real.cjs +0 -68
- package/singlestore-core/columns/real.cjs.map +0 -1
- package/singlestore-core/columns/real.d.cts +0 -30
- package/singlestore-core/columns/real.d.ts +0 -30
- package/singlestore-core/columns/real.js +0 -42
- package/singlestore-core/columns/real.js.map +0 -1
- package/singlestore-core/columns/serial.cjs +0 -64
- package/singlestore-core/columns/serial.cjs.map +0 -1
- package/singlestore-core/columns/serial.d.cts +0 -24
- package/singlestore-core/columns/serial.d.ts +0 -24
- package/singlestore-core/columns/serial.js +0 -38
- package/singlestore-core/columns/serial.js.map +0 -1
- package/singlestore-core/columns/smallint.cjs +0 -65
- package/singlestore-core/columns/smallint.cjs.map +0 -1
- package/singlestore-core/columns/smallint.d.cts +0 -26
- package/singlestore-core/columns/smallint.d.ts +0 -26
- package/singlestore-core/columns/smallint.js +0 -39
- package/singlestore-core/columns/smallint.js.map +0 -1
- package/singlestore-core/columns/text.cjs +0 -80
- package/singlestore-core/columns/text.cjs.map +0 -1
- package/singlestore-core/columns/text.d.cts +0 -46
- package/singlestore-core/columns/text.d.ts +0 -46
- package/singlestore-core/columns/text.js +0 -51
- package/singlestore-core/columns/text.js.map +0 -1
- package/singlestore-core/columns/time.cjs +0 -56
- package/singlestore-core/columns/time.cjs.map +0 -1
- package/singlestore-core/columns/time.d.cts +0 -23
- package/singlestore-core/columns/time.d.ts +0 -23
- package/singlestore-core/columns/time.js +0 -30
- package/singlestore-core/columns/time.js.map +0 -1
- package/singlestore-core/columns/timestamp.cjs +0 -97
- package/singlestore-core/columns/timestamp.cjs.map +0 -1
- package/singlestore-core/columns/timestamp.d.cts +0 -49
- package/singlestore-core/columns/timestamp.d.ts +0 -49
- package/singlestore-core/columns/timestamp.js +0 -69
- package/singlestore-core/columns/timestamp.js.map +0 -1
- package/singlestore-core/columns/tinyint.cjs +0 -65
- package/singlestore-core/columns/tinyint.cjs.map +0 -1
- package/singlestore-core/columns/tinyint.d.cts +0 -26
- package/singlestore-core/columns/tinyint.d.ts +0 -26
- package/singlestore-core/columns/tinyint.js +0 -39
- package/singlestore-core/columns/tinyint.js.map +0 -1
- package/singlestore-core/columns/varbinary.cjs +0 -61
- package/singlestore-core/columns/varbinary.cjs.map +0 -1
- package/singlestore-core/columns/varbinary.d.cts +0 -26
- package/singlestore-core/columns/varbinary.d.ts +0 -26
- package/singlestore-core/columns/varbinary.js +0 -35
- package/singlestore-core/columns/varbinary.js.map +0 -1
- package/singlestore-core/columns/varchar.cjs +0 -63
- package/singlestore-core/columns/varchar.cjs.map +0 -1
- package/singlestore-core/columns/varchar.d.cts +0 -29
- package/singlestore-core/columns/varchar.d.ts +0 -29
- package/singlestore-core/columns/varchar.js +0 -37
- package/singlestore-core/columns/varchar.js.map +0 -1
- package/singlestore-core/columns/year.cjs +0 -56
- package/singlestore-core/columns/year.cjs.map +0 -1
- package/singlestore-core/columns/year.d.cts +0 -23
- package/singlestore-core/columns/year.d.ts +0 -23
- package/singlestore-core/columns/year.js +0 -30
- package/singlestore-core/columns/year.js.map +0 -1
- package/singlestore-core/db.cjs +0 -261
- package/singlestore-core/db.cjs.map +0 -1
- package/singlestore-core/db.d.cts +0 -231
- package/singlestore-core/db.d.ts +0 -231
- package/singlestore-core/db.js +0 -242
- package/singlestore-core/db.js.map +0 -1
- package/singlestore-core/dialect.cjs +0 -607
- package/singlestore-core/dialect.cjs.map +0 -1
- package/singlestore-core/dialect.d.cts +0 -64
- package/singlestore-core/dialect.d.ts +0 -64
- package/singlestore-core/dialect.js +0 -589
- package/singlestore-core/dialect.js.map +0 -1
- package/singlestore-core/expressions.cjs +0 -49
- package/singlestore-core/expressions.cjs.map +0 -1
- package/singlestore-core/expressions.d.cts +0 -8
- package/singlestore-core/expressions.d.ts +0 -8
- package/singlestore-core/expressions.js +0 -22
- package/singlestore-core/expressions.js.map +0 -1
- package/singlestore-core/index.cjs +0 -47
- package/singlestore-core/index.cjs.map +0 -1
- package/singlestore-core/index.d.cts +0 -13
- package/singlestore-core/index.d.ts +0 -13
- package/singlestore-core/index.js +0 -14
- package/singlestore-core/index.js.map +0 -1
- package/singlestore-core/indexes.cjs +0 -88
- package/singlestore-core/indexes.cjs.map +0 -1
- package/singlestore-core/indexes.d.cts +0 -62
- package/singlestore-core/indexes.d.ts +0 -62
- package/singlestore-core/indexes.js +0 -60
- package/singlestore-core/indexes.js.map +0 -1
- package/singlestore-core/primary-keys.cjs +0 -68
- package/singlestore-core/primary-keys.cjs.map +0 -1
- package/singlestore-core/primary-keys.d.cts +0 -30
- package/singlestore-core/primary-keys.d.ts +0 -30
- package/singlestore-core/primary-keys.js +0 -42
- package/singlestore-core/primary-keys.js.map +0 -1
- package/singlestore-core/query-builders/count.cjs +0 -73
- package/singlestore-core/query-builders/count.cjs.map +0 -1
- package/singlestore-core/query-builders/count.d.cts +0 -25
- package/singlestore-core/query-builders/count.d.ts +0 -25
- package/singlestore-core/query-builders/count.js +0 -49
- package/singlestore-core/query-builders/count.js.map +0 -1
- package/singlestore-core/query-builders/delete.cjs +0 -123
- package/singlestore-core/query-builders/delete.cjs.map +0 -1
- package/singlestore-core/query-builders/delete.d.cts +0 -83
- package/singlestore-core/query-builders/delete.d.ts +0 -83
- package/singlestore-core/query-builders/delete.js +0 -99
- package/singlestore-core/query-builders/delete.js.map +0 -1
- package/singlestore-core/query-builders/index.cjs +0 -33
- package/singlestore-core/query-builders/index.cjs.map +0 -1
- package/singlestore-core/query-builders/index.d.cts +0 -6
- package/singlestore-core/query-builders/index.d.ts +0 -6
- package/singlestore-core/query-builders/index.js +0 -7
- package/singlestore-core/query-builders/index.js.map +0 -1
- package/singlestore-core/query-builders/insert.cjs +0 -146
- package/singlestore-core/query-builders/insert.cjs.map +0 -1
- package/singlestore-core/query-builders/insert.d.cts +0 -106
- package/singlestore-core/query-builders/insert.d.ts +0 -106
- package/singlestore-core/query-builders/insert.js +0 -121
- package/singlestore-core/query-builders/insert.js.map +0 -1
- package/singlestore-core/query-builders/query-builder.cjs +0 -99
- package/singlestore-core/query-builders/query-builder.cjs.map +0 -1
- package/singlestore-core/query-builders/query-builder.d.cts +0 -33
- package/singlestore-core/query-builders/query-builder.d.ts +0 -33
- package/singlestore-core/query-builders/query-builder.js +0 -75
- package/singlestore-core/query-builders/query-builder.js.map +0 -1
- package/singlestore-core/query-builders/query.cjs.map +0 -1
- package/singlestore-core/query-builders/query.d.cts +0 -42
- package/singlestore-core/query-builders/query.d.ts +0 -42
- package/singlestore-core/query-builders/query.js.map +0 -1
- package/singlestore-core/query-builders/select.cjs +0 -687
- package/singlestore-core/query-builders/select.cjs.map +0 -1
- package/singlestore-core/query-builders/select.d.cts +0 -585
- package/singlestore-core/query-builders/select.d.ts +0 -585
- package/singlestore-core/query-builders/select.js +0 -662
- package/singlestore-core/query-builders/select.js.map +0 -1
- package/singlestore-core/query-builders/select.types.cjs +0 -17
- package/singlestore-core/query-builders/select.types.cjs.map +0 -1
- package/singlestore-core/query-builders/select.types.d.cts +0 -137
- package/singlestore-core/query-builders/select.types.d.ts +0 -137
- package/singlestore-core/query-builders/select.types.js +0 -1
- package/singlestore-core/query-builders/select.types.js.map +0 -1
- package/singlestore-core/query-builders/update.cjs +0 -147
- package/singlestore-core/query-builders/update.cjs.map +0 -1
- package/singlestore-core/query-builders/update.d.cts +0 -102
- package/singlestore-core/query-builders/update.d.ts +0 -102
- package/singlestore-core/query-builders/update.js +0 -122
- package/singlestore-core/query-builders/update.js.map +0 -1
- package/singlestore-core/schema.cjs +0 -56
- package/singlestore-core/schema.cjs.map +0 -1
- package/singlestore-core/schema.d.cts +0 -22
- package/singlestore-core/schema.d.ts +0 -22
- package/singlestore-core/schema.js +0 -29
- package/singlestore-core/schema.js.map +0 -1
- package/singlestore-core/session.cjs +0 -87
- package/singlestore-core/session.cjs.map +0 -1
- package/singlestore-core/session.d.cts +0 -66
- package/singlestore-core/session.d.ts +0 -66
- package/singlestore-core/session.js +0 -61
- package/singlestore-core/session.js.map +0 -1
- package/singlestore-core/subquery.cjs +0 -17
- package/singlestore-core/subquery.cjs.map +0 -1
- package/singlestore-core/subquery.d.cts +0 -5
- package/singlestore-core/subquery.d.ts +0 -5
- package/singlestore-core/subquery.js +0 -1
- package/singlestore-core/subquery.js.map +0 -1
- package/singlestore-core/table.cjs +0 -73
- package/singlestore-core/table.cjs.map +0 -1
- package/singlestore-core/table.d.cts +0 -40
- package/singlestore-core/table.d.ts +0 -40
- package/singlestore-core/table.js +0 -46
- package/singlestore-core/table.js.map +0 -1
- package/singlestore-core/unique-constraint.cjs +0 -82
- package/singlestore-core/unique-constraint.cjs.map +0 -1
- package/singlestore-core/unique-constraint.d.cts +0 -24
- package/singlestore-core/unique-constraint.d.ts +0 -24
- package/singlestore-core/unique-constraint.js +0 -54
- package/singlestore-core/unique-constraint.js.map +0 -1
- package/singlestore-core/utils.cjs +0 -65
- package/singlestore-core/utils.cjs.map +0 -1
- package/singlestore-core/utils.d.cts +0 -13
- package/singlestore-core/utils.d.ts +0 -13
- package/singlestore-core/utils.js +0 -41
- package/singlestore-core/utils.js.map +0 -1
- package/singlestore-core/view-base.cjs +0 -33
- package/singlestore-core/view-base.cjs.map +0 -1
- package/singlestore-core/view-base.d.cts +0 -9
- package/singlestore-core/view-base.d.ts +0 -9
- package/singlestore-core/view-base.js +0 -9
- package/singlestore-core/view-base.js.map +0 -1
- package/singlestore-core/view-common.cjs +0 -29
- package/singlestore-core/view-common.cjs.map +0 -1
- package/singlestore-core/view-common.d.cts +0 -1
- package/singlestore-core/view-common.d.ts +0 -1
- package/singlestore-core/view-common.js +0 -5
- package/singlestore-core/view-common.js.map +0 -1
- package/singlestore-core/view.cjs +0 -146
- package/singlestore-core/view.cjs.map +0 -1
- package/singlestore-core/view.d.cts +0 -65
- package/singlestore-core/view.d.ts +0 -65
- package/singlestore-core/view.js +0 -119
- package/singlestore-core/view.js.map +0 -1
- package/singlestore-proxy/driver.cjs +0 -62
- package/singlestore-proxy/driver.cjs.map +0 -1
- package/singlestore-proxy/driver.d.cts +0 -13
- package/singlestore-proxy/driver.d.ts +0 -13
- package/singlestore-proxy/driver.js +0 -42
- package/singlestore-proxy/driver.js.map +0 -1
- package/singlestore-proxy/index.cjs +0 -25
- package/singlestore-proxy/index.cjs.map +0 -1
- package/singlestore-proxy/index.d.cts +0 -2
- package/singlestore-proxy/index.d.ts +0 -2
- package/singlestore-proxy/index.js +0 -3
- package/singlestore-proxy/index.js.map +0 -1
- package/singlestore-proxy/migrator.cjs +0 -60
- package/singlestore-proxy/migrator.cjs.map +0 -1
- package/singlestore-proxy/migrator.d.cts +0 -4
- package/singlestore-proxy/migrator.d.ts +0 -4
- package/singlestore-proxy/migrator.js +0 -36
- package/singlestore-proxy/migrator.js.map +0 -1
- package/singlestore-proxy/session.cjs +0 -127
- package/singlestore-proxy/session.cjs.map +0 -1
- package/singlestore-proxy/session.d.cts +0 -50
- package/singlestore-proxy/session.d.ts +0 -50
- package/singlestore-proxy/session.js +0 -101
- package/singlestore-proxy/session.js.map +0 -1
package/pglite/session.js
CHANGED
|
@@ -6,7 +6,7 @@ import { fillPlaceholders, sql } from "../sql/sql.js";
|
|
|
6
6
|
import { mapResultRow } from "../utils.js";
|
|
7
7
|
import { types } from "@electric-sql/pglite";
|
|
8
8
|
class PglitePreparedQuery extends PgPreparedQuery {
|
|
9
|
-
constructor(client, queryString, params, logger, fields, name, _isResponseInArrayMode, customResultMapper) {
|
|
9
|
+
constructor(client, queryString, params, logger, fields, name, _isResponseInArrayMode, customResultMapper, isRqbV2Query) {
|
|
10
10
|
super({ sql: queryString, params });
|
|
11
11
|
this.client = client;
|
|
12
12
|
this.queryString = queryString;
|
|
@@ -15,6 +15,7 @@ class PglitePreparedQuery extends PgPreparedQuery {
|
|
|
15
15
|
this.fields = fields;
|
|
16
16
|
this._isResponseInArrayMode = _isResponseInArrayMode;
|
|
17
17
|
this.customResultMapper = customResultMapper;
|
|
18
|
+
this.isRqbV2Query = isRqbV2Query;
|
|
18
19
|
this.rawQueryConfig = {
|
|
19
20
|
rowMode: "object",
|
|
20
21
|
parsers: {
|
|
@@ -38,6 +39,8 @@ class PglitePreparedQuery extends PgPreparedQuery {
|
|
|
38
39
|
rawQueryConfig;
|
|
39
40
|
queryConfig;
|
|
40
41
|
async execute(placeholderValues = {}) {
|
|
42
|
+
if (this.isRqbV2Query)
|
|
43
|
+
return this.executeRqbV2(placeholderValues);
|
|
41
44
|
const params = fillPlaceholders(this.params, placeholderValues);
|
|
42
45
|
this.logger.logQuery(this.queryString, params);
|
|
43
46
|
const { fields, rawQueryConfig, client, queryConfig, joinsNotNullableMap, customResultMapper, queryString } = this;
|
|
@@ -47,6 +50,13 @@ class PglitePreparedQuery extends PgPreparedQuery {
|
|
|
47
50
|
const result = await client.query(queryString, params, queryConfig);
|
|
48
51
|
return customResultMapper ? customResultMapper(result.rows) : result.rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
|
|
49
52
|
}
|
|
53
|
+
async executeRqbV2(placeholderValues = {}) {
|
|
54
|
+
const params = fillPlaceholders(this.params, placeholderValues);
|
|
55
|
+
this.logger.logQuery(this.queryString, params);
|
|
56
|
+
const { rawQueryConfig, client, customResultMapper, queryString } = this;
|
|
57
|
+
const result = await client.query(queryString, params, rawQueryConfig);
|
|
58
|
+
return customResultMapper(result.rows);
|
|
59
|
+
}
|
|
50
60
|
all(placeholderValues = {}) {
|
|
51
61
|
const params = fillPlaceholders(this.params, placeholderValues);
|
|
52
62
|
this.logger.logQuery(this.queryString, params);
|
|
@@ -58,9 +68,10 @@ class PglitePreparedQuery extends PgPreparedQuery {
|
|
|
58
68
|
}
|
|
59
69
|
}
|
|
60
70
|
class PgliteSession extends PgSession {
|
|
61
|
-
constructor(client, dialect, schema, options = {}) {
|
|
71
|
+
constructor(client, dialect, relations, schema, options = {}) {
|
|
62
72
|
super(dialect);
|
|
63
73
|
this.client = client;
|
|
74
|
+
this.relations = relations;
|
|
64
75
|
this.schema = schema;
|
|
65
76
|
this.options = options;
|
|
66
77
|
this.logger = options.logger ?? new NoopLogger();
|
|
@@ -79,15 +90,34 @@ class PgliteSession extends PgSession {
|
|
|
79
90
|
customResultMapper
|
|
80
91
|
);
|
|
81
92
|
}
|
|
93
|
+
prepareRelationalQuery(query, fields, name, customResultMapper) {
|
|
94
|
+
return new PglitePreparedQuery(
|
|
95
|
+
this.client,
|
|
96
|
+
query.sql,
|
|
97
|
+
query.params,
|
|
98
|
+
this.logger,
|
|
99
|
+
fields,
|
|
100
|
+
name,
|
|
101
|
+
false,
|
|
102
|
+
customResultMapper,
|
|
103
|
+
true
|
|
104
|
+
);
|
|
105
|
+
}
|
|
82
106
|
async transaction(transaction, config) {
|
|
83
107
|
return this.client.transaction(async (client) => {
|
|
84
108
|
const session = new PgliteSession(
|
|
85
109
|
client,
|
|
86
110
|
this.dialect,
|
|
111
|
+
this.relations,
|
|
87
112
|
this.schema,
|
|
88
113
|
this.options
|
|
89
114
|
);
|
|
90
|
-
const tx = new PgliteTransaction(
|
|
115
|
+
const tx = new PgliteTransaction(
|
|
116
|
+
this.dialect,
|
|
117
|
+
session,
|
|
118
|
+
this.relations,
|
|
119
|
+
this.schema
|
|
120
|
+
);
|
|
91
121
|
if (config) {
|
|
92
122
|
await tx.setTransaction(config);
|
|
93
123
|
}
|
|
@@ -108,6 +138,7 @@ class PgliteTransaction extends PgTransaction {
|
|
|
108
138
|
const tx = new PgliteTransaction(
|
|
109
139
|
this.dialect,
|
|
110
140
|
this.session,
|
|
141
|
+
this.relations,
|
|
111
142
|
this.schema,
|
|
112
143
|
this.nestedIndex + 1
|
|
113
144
|
);
|
package/pglite/session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pglite/session.ts"],"sourcesContent":["import type { PGlite, QueryOptions, Results, Row, Transaction } from '@electric-sql/pglite';\nimport { entityKind } from '~/entity.ts';\nimport { type Logger, 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, type SQL, sql } from '~/sql/sql.ts';\nimport { type Assume, mapResultRow } from '~/utils.ts';\n\nimport { types } from '@electric-sql/pglite';\n\nexport type PgliteClient = PGlite;\n\nexport class PglitePreparedQuery<T extends PreparedQueryConfig> extends PgPreparedQuery<T> {\n\tstatic override readonly [entityKind]: string = 'PglitePreparedQuery';\n\n\tprivate rawQueryConfig: QueryOptions;\n\tprivate queryConfig: QueryOptions;\n\n\tconstructor(\n\t\tprivate client: PgliteClient | Transaction,\n\t\tprivate queryString: string,\n\t\tprivate params: unknown[],\n\t\tprivate logger: Logger,\n\t\tprivate fields: SelectedFieldsOrdered | undefined,\n\t\tname: string | undefined,\n\t\tprivate _isResponseInArrayMode: boolean,\n\t\tprivate customResultMapper?: (rows: unknown[][]) => T['execute'],\n\t) {\n\t\tsuper({ sql: queryString, params });\n\t\tthis.rawQueryConfig = {\n\t\t\trowMode: 'object',\n\t\t\tparsers: {\n\t\t\t\t[types.TIMESTAMP]: (value) => value,\n\t\t\t\t[types.TIMESTAMPTZ]: (value) => value,\n\t\t\t\t[types.INTERVAL]: (value) => value,\n\t\t\t\t[types.DATE]: (value) => value,\n\t\t\t},\n\t\t};\n\t\tthis.queryConfig = {\n\t\t\trowMode: 'array',\n\t\t\tparsers: {\n\t\t\t\t[types.TIMESTAMP]: (value) => value,\n\t\t\t\t[types.TIMESTAMPTZ]: (value) => value,\n\t\t\t\t[types.INTERVAL]: (value) => value,\n\t\t\t\t[types.DATE]: (value) => value,\n\t\t\t},\n\t\t};\n\t}\n\n\tasync execute(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\n\t\tthis.logger.logQuery(this.queryString, params);\n\n\t\tconst { fields, rawQueryConfig, client, queryConfig, joinsNotNullableMap, customResultMapper, queryString } = this;\n\n\t\tif (!fields && !customResultMapper) {\n\t\t\treturn client.query<any[]>(queryString, params, rawQueryConfig);\n\t\t}\n\n\t\tconst result = await client.query<any[][]>(queryString, params, queryConfig);\n\n\t\treturn customResultMapper\n\t\t\t? customResultMapper(result.rows)\n\t\t\t: result.rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));\n\t}\n\n\tall(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['all']> {\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\t\tthis.logger.logQuery(this.queryString, params);\n\t\treturn this.client.query(this.queryString, params, this.rawQueryConfig).then((result) => result.rows);\n\t}\n\n\t/** @internal */\n\tisResponseInArrayMode(): boolean {\n\t\treturn this._isResponseInArrayMode;\n\t}\n}\n\nexport interface PgliteSessionOptions {\n\tlogger?: Logger;\n}\n\nexport class PgliteSession<\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends PgSession<PgliteQueryResultHKT, TFullSchema, TSchema> {\n\tstatic override readonly [entityKind]: string = 'PgliteSession';\n\n\tprivate logger: Logger;\n\n\tconstructor(\n\t\tprivate client: PgliteClient | Transaction,\n\t\tdialect: PgDialect,\n\t\tprivate schema: RelationalSchemaConfig<TSchema> | undefined,\n\t\tprivate options: PgliteSessionOptions = {},\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 PglitePreparedQuery(\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\tname,\n\t\t\tisResponseInArrayMode,\n\t\t\tcustomResultMapper,\n\t\t);\n\t}\n\n\toverride async transaction<T>(\n\t\ttransaction: (tx: PgliteTransaction<TFullSchema, TSchema>) => Promise<T>,\n\t\tconfig?: PgTransactionConfig | undefined,\n\t): Promise<T> {\n\t\treturn (this.client as PgliteClient).transaction(async (client) => {\n\t\t\tconst session = new PgliteSession<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 PgliteTransaction<TFullSchema, TSchema>(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\toverride async count(sql: SQL): Promise<number> {\n\t\tconst res = await this.execute<{ rows: [{ count: string }] }>(sql);\n\t\treturn Number(\n\t\t\tres['rows'][0]['count'],\n\t\t);\n\t}\n}\n\nexport class PgliteTransaction<\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends PgTransaction<PgliteQueryResultHKT, TFullSchema, TSchema> {\n\tstatic override readonly [entityKind]: string = 'PgliteTransaction';\n\n\toverride async transaction<T>(transaction: (tx: PgliteTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T> {\n\t\tconst savepointName = `sp${this.nestedIndex + 1}`;\n\t\tconst tx = new PgliteTransaction<TFullSchema, TSchema>(\n\t\t\tthis.dialect,\n\t\t\tthis.session,\n\t\t\tthis.schema,\n\t\t\tthis.nestedIndex + 1,\n\t\t);\n\t\tawait tx.execute(sql.raw(`savepoint ${savepointName}`));\n\t\ttry {\n\t\t\tconst result = await transaction(tx);\n\t\t\tawait tx.execute(sql.raw(`release savepoint ${savepointName}`));\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tawait tx.execute(sql.raw(`rollback to savepoint ${savepointName}`));\n\t\t\tthrow err;\n\t\t}\n\t}\n}\n\nexport interface PgliteQueryResultHKT extends PgQueryResultHKT {\n\ttype: Results<Assume<this['row'], Row>>;\n}\n"],"mappings":"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","names":["sql"]}
|
|
1
|
+
{"version":3,"sources":["../../src/pglite/session.ts"],"sourcesContent":["import type { PGlite, QueryOptions, Results, Row, Transaction } from '@electric-sql/pglite';\nimport type * as V1 from '~/_relations.ts';\nimport { entityKind } from '~/entity.ts';\nimport { type Logger, 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 { fillPlaceholders, type Query, type SQL, sql } from '~/sql/sql.ts';\nimport { type Assume, mapResultRow } from '~/utils.ts';\n\nimport { types } from '@electric-sql/pglite';\nimport type { AnyRelations, TablesRelationalConfig } from '~/relations.ts';\n\nexport type PgliteClient = PGlite;\n\nexport class PglitePreparedQuery<T extends PreparedQueryConfig, TIsRqbV2 extends boolean = false>\n\textends PgPreparedQuery<T>\n{\n\tstatic override readonly [entityKind]: string = 'PglitePreparedQuery';\n\n\tprivate rawQueryConfig: QueryOptions;\n\tprivate queryConfig: QueryOptions;\n\n\tconstructor(\n\t\tprivate client: PgliteClient | Transaction,\n\t\tprivate queryString: string,\n\t\tprivate params: unknown[],\n\t\tprivate logger: Logger,\n\t\tprivate fields: SelectedFieldsOrdered | undefined,\n\t\tname: string | undefined,\n\t\tprivate _isResponseInArrayMode: boolean,\n\t\tprivate customResultMapper?: (\n\t\t\trows: TIsRqbV2 extends true ? Record<string, unknown>[] : unknown[][],\n\t\t) => T['execute'],\n\t\tprivate isRqbV2Query?: TIsRqbV2,\n\t) {\n\t\tsuper({ sql: queryString, params });\n\t\tthis.rawQueryConfig = {\n\t\t\trowMode: 'object',\n\t\t\tparsers: {\n\t\t\t\t[types.TIMESTAMP]: (value) => value,\n\t\t\t\t[types.TIMESTAMPTZ]: (value) => value,\n\t\t\t\t[types.INTERVAL]: (value) => value,\n\t\t\t\t[types.DATE]: (value) => value,\n\t\t\t},\n\t\t};\n\t\tthis.queryConfig = {\n\t\t\trowMode: 'array',\n\t\t\tparsers: {\n\t\t\t\t[types.TIMESTAMP]: (value) => value,\n\t\t\t\t[types.TIMESTAMPTZ]: (value) => value,\n\t\t\t\t[types.INTERVAL]: (value) => value,\n\t\t\t\t[types.DATE]: (value) => value,\n\t\t\t},\n\t\t};\n\t}\n\n\tasync execute(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {\n\t\tif (this.isRqbV2Query) return this.executeRqbV2(placeholderValues);\n\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\n\t\tthis.logger.logQuery(this.queryString, params);\n\n\t\tconst { fields, rawQueryConfig, client, queryConfig, joinsNotNullableMap, customResultMapper, queryString } = this;\n\n\t\tif (!fields && !customResultMapper) {\n\t\t\treturn client.query<any[]>(queryString, params, rawQueryConfig);\n\t\t}\n\n\t\tconst result = await client.query<any[]>(queryString, params, queryConfig);\n\n\t\treturn customResultMapper\n\t\t\t? (customResultMapper as (rows: unknown[][]) => T['execute'])(result.rows)\n\t\t\t: result.rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));\n\t}\n\n\tprivate async executeRqbV2(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\n\t\tthis.logger.logQuery(this.queryString, params);\n\n\t\tconst { rawQueryConfig, client, customResultMapper, queryString } = this;\n\n\t\tconst result = await client.query<Record<string, unknown>>(queryString, params, rawQueryConfig);\n\n\t\treturn (customResultMapper as (rows: Record<string, unknown>[]) => T['execute'])(result.rows);\n\t}\n\n\tall(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['all']> {\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\t\tthis.logger.logQuery(this.queryString, params);\n\t\treturn this.client.query(this.queryString, params, this.rawQueryConfig).then((result) => result.rows);\n\t}\n\n\t/** @internal */\n\tisResponseInArrayMode(): boolean {\n\t\treturn this._isResponseInArrayMode;\n\t}\n}\n\nexport interface PgliteSessionOptions {\n\tlogger?: Logger;\n}\n\nexport class PgliteSession<\n\tTFullSchema extends Record<string, unknown>,\n\tTRelations extends AnyRelations,\n\tTTablesConfig extends TablesRelationalConfig,\n\tTSchema extends V1.TablesRelationalConfig,\n> extends PgSession<PgliteQueryResultHKT, TFullSchema, TRelations, TTablesConfig, TSchema> {\n\tstatic override readonly [entityKind]: string = 'PgliteSession';\n\n\tprivate logger: Logger;\n\n\tconstructor(\n\t\tprivate client: PgliteClient | Transaction,\n\t\tdialect: PgDialect,\n\t\tprivate relations: AnyRelations | undefined,\n\t\tprivate schema: V1.RelationalSchemaConfig<TSchema> | undefined,\n\t\tprivate options: PgliteSessionOptions = {},\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 PglitePreparedQuery(\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\tname,\n\t\t\tisResponseInArrayMode,\n\t\t\tcustomResultMapper,\n\t\t);\n\t}\n\n\tprepareRelationalQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(\n\t\tquery: Query,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\tname: string | undefined,\n\t\tcustomResultMapper: (rows: Record<string, unknown>[]) => T['execute'],\n\t): PgPreparedQuery<T> {\n\t\treturn new PglitePreparedQuery(\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\tname,\n\t\t\tfalse,\n\t\t\tcustomResultMapper,\n\t\t\ttrue,\n\t\t);\n\t}\n\n\toverride async transaction<T>(\n\t\ttransaction: (tx: PgliteTransaction<TFullSchema, TRelations, TTablesConfig, TSchema>) => Promise<T>,\n\t\tconfig?: PgTransactionConfig | undefined,\n\t): Promise<T> {\n\t\treturn (this.client as PgliteClient).transaction(async (client) => {\n\t\t\tconst session = new PgliteSession<TFullSchema, TRelations, TTablesConfig, TSchema>(\n\t\t\t\tclient,\n\t\t\t\tthis.dialect,\n\t\t\t\tthis.relations,\n\t\t\t\tthis.schema,\n\t\t\t\tthis.options,\n\t\t\t);\n\t\t\tconst tx = new PgliteTransaction<TFullSchema, TRelations, TTablesConfig, TSchema>(\n\t\t\t\tthis.dialect,\n\t\t\t\tsession,\n\t\t\t\tthis.relations,\n\t\t\t\tthis.schema,\n\t\t\t);\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\toverride async count(sql: SQL): Promise<number> {\n\t\tconst res = await this.execute<{ rows: [{ count: string }] }>(sql);\n\t\treturn Number(\n\t\t\tres['rows'][0]['count'],\n\t\t);\n\t}\n}\n\nexport class PgliteTransaction<\n\tTFullSchema extends Record<string, unknown>,\n\tTRelations extends AnyRelations,\n\tTTablesConfig extends TablesRelationalConfig,\n\tTSchema extends V1.TablesRelationalConfig,\n> extends PgTransaction<PgliteQueryResultHKT, TFullSchema, TRelations, TTablesConfig, TSchema> {\n\tstatic override readonly [entityKind]: string = 'PgliteTransaction';\n\n\toverride async transaction<T>(\n\t\ttransaction: (tx: PgliteTransaction<TFullSchema, TRelations, TTablesConfig, TSchema>) => Promise<T>,\n\t): Promise<T> {\n\t\tconst savepointName = `sp${this.nestedIndex + 1}`;\n\t\tconst tx = new PgliteTransaction<TFullSchema, TRelations, TTablesConfig, TSchema>(\n\t\t\tthis.dialect,\n\t\t\tthis.session,\n\t\t\tthis.relations,\n\t\t\tthis.schema,\n\t\t\tthis.nestedIndex + 1,\n\t\t);\n\t\tawait tx.execute(sql.raw(`savepoint ${savepointName}`));\n\t\ttry {\n\t\t\tconst result = await transaction(tx);\n\t\t\tawait tx.execute(sql.raw(`release savepoint ${savepointName}`));\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tawait tx.execute(sql.raw(`rollback to savepoint ${savepointName}`));\n\t\t\tthrow err;\n\t\t}\n\t}\n}\n\nexport interface PgliteQueryResultHKT extends PgQueryResultHKT {\n\ttype: Results<Assume<this['row'], Row>>;\n}\n"],"mappings":"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","names":["sql"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var driver_exports = {};
|
|
20
30
|
__export(driver_exports, {
|
|
@@ -23,11 +33,11 @@ __export(driver_exports, {
|
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(driver_exports);
|
|
25
35
|
var import_database = require("@planetscale/database");
|
|
36
|
+
var V1 = __toESM(require("../_relations.cjs"), 1);
|
|
26
37
|
var import_entity = require("../entity.cjs");
|
|
27
38
|
var import_logger = require("../logger.cjs");
|
|
28
39
|
var import_db = require("../mysql-core/db.cjs");
|
|
29
40
|
var import_dialect = require("../mysql-core/dialect.cjs");
|
|
30
|
-
var import_relations = require("../relations.cjs");
|
|
31
41
|
var import_utils = require("../utils.cjs");
|
|
32
42
|
var import_session = require("./session.cjs");
|
|
33
43
|
class PlanetScaleDatabase extends import_db.MySqlDatabase {
|
|
@@ -57,9 +67,9 @@ const db = drizzle(client);
|
|
|
57
67
|
}
|
|
58
68
|
let schema;
|
|
59
69
|
if (config.schema) {
|
|
60
|
-
const tablesConfig =
|
|
70
|
+
const tablesConfig = V1.extractTablesRelationalConfig(
|
|
61
71
|
config.schema,
|
|
62
|
-
|
|
72
|
+
V1.createTableRelationsHelpers
|
|
63
73
|
);
|
|
64
74
|
schema = {
|
|
65
75
|
fullSchema: config.schema,
|
|
@@ -67,8 +77,15 @@ const db = drizzle(client);
|
|
|
67
77
|
tableNamesMap: tablesConfig.tableNamesMap
|
|
68
78
|
};
|
|
69
79
|
}
|
|
70
|
-
const
|
|
71
|
-
const
|
|
80
|
+
const relations = config.relations;
|
|
81
|
+
const session = new import_session.PlanetscaleSession(client, dialect, void 0, relations, schema, { logger });
|
|
82
|
+
const db = new PlanetScaleDatabase(
|
|
83
|
+
dialect,
|
|
84
|
+
session,
|
|
85
|
+
relations,
|
|
86
|
+
schema,
|
|
87
|
+
"planetscale"
|
|
88
|
+
);
|
|
72
89
|
db.$client = client;
|
|
73
90
|
return db;
|
|
74
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/planetscale-serverless/driver.ts"],"sourcesContent":["import type { Config } from '@planetscale/database';\nimport { Client } from '@planetscale/database';\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport { MySqlDatabase } from '~/mysql-core/db.ts';\nimport { MySqlDialect } from '~/mysql-core/dialect.ts';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/planetscale-serverless/driver.ts"],"sourcesContent":["import type { Config } from '@planetscale/database';\nimport { Client } from '@planetscale/database';\nimport * as V1 from '~/_relations.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport { MySqlDatabase } from '~/mysql-core/db.ts';\nimport { MySqlDialect } from '~/mysql-core/dialect.ts';\nimport type { AnyRelations, EmptyRelations } from '~/relations.ts';\nimport { type DrizzleConfig, isConfig } from '~/utils.ts';\nimport type { PlanetScalePreparedQueryHKT, PlanetscaleQueryResultHKT } from './session.ts';\nimport { PlanetscaleSession } from './session.ts';\n\nexport interface PlanetscaleSDriverOptions {\n\tlogger?: Logger;\n}\n\nexport class PlanetScaleDatabase<\n\tTSchema extends Record<string, unknown> = Record<string, never>,\n\tTRelations extends AnyRelations = EmptyRelations,\n> extends MySqlDatabase<PlanetscaleQueryResultHKT, PlanetScalePreparedQueryHKT, TSchema, TRelations> {\n\tstatic override readonly [entityKind]: string = 'PlanetScaleDatabase';\n}\n\nfunction construct<\n\tTSchema extends Record<string, unknown> = Record<string, never>,\n\tTRelations extends AnyRelations = EmptyRelations,\n\tTClient extends Client = Client,\n>(\n\tclient: TClient,\n\tconfig: DrizzleConfig<TSchema, TRelations> = {},\n): PlanetScaleDatabase<TSchema, TRelations> & {\n\t$client: TClient;\n} {\n\t// Client is not Drizzle Object, so we can ignore this rule here\n\t// eslint-disable-next-line no-instanceof/no-instanceof\n\tif (!(client instanceof Client)) {\n\t\tthrow new Error(`Warning: You need to pass an instance of Client:\n\nimport { Client } from \"@planetscale/database\";\n\nconst client = new Client({\n host: process.env[\"DATABASE_HOST\"],\n username: process.env[\"DATABASE_USERNAME\"],\n password: process.env[\"DATABASE_PASSWORD\"],\n});\n\nconst db = drizzle(client);\n\t\t`);\n\t}\n\n\tconst dialect = new MySqlDialect({ casing: config.casing });\n\tlet logger;\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\tlet schema: V1.RelationalSchemaConfig<V1.TablesRelationalConfig> | undefined;\n\tif (config.schema) {\n\t\tconst tablesConfig = V1.extractTablesRelationalConfig(\n\t\t\tconfig.schema,\n\t\t\tV1.createTableRelationsHelpers,\n\t\t);\n\t\tschema = {\n\t\t\tfullSchema: config.schema,\n\t\t\tschema: tablesConfig.tables,\n\t\t\ttableNamesMap: tablesConfig.tableNamesMap,\n\t\t};\n\t}\n\n\tconst relations = config.relations;\n\tconst session = new PlanetscaleSession(client, dialect, undefined, relations, schema, { logger });\n\tconst db = new PlanetScaleDatabase(\n\t\tdialect,\n\t\tsession,\n\t\trelations,\n\t\tschema as V1.RelationalSchemaConfig<any>,\n\t\t'planetscale',\n\t) as PlanetScaleDatabase<TSchema, TRelations>;\n\t(<any> db).$client = client;\n\n\treturn db as any;\n}\n\nexport function drizzle<\n\tTSchema extends Record<string, unknown> = Record<string, never>,\n\tTRelations extends AnyRelations = EmptyRelations,\n\tTClient extends Client = Client,\n>(\n\t...params: [\n\t\tTClient | string,\n\t] | [\n\t\tTClient | string,\n\t\tDrizzleConfig<TSchema, TRelations>,\n\t] | [\n\t\t(\n\t\t\t& DrizzleConfig<TSchema, TRelations>\n\t\t\t& ({\n\t\t\t\tconnection: string | Config;\n\t\t\t} | {\n\t\t\t\tclient: TClient;\n\t\t\t})\n\t\t),\n\t]\n): PlanetScaleDatabase<TSchema, TRelations> & {\n\t$client: TClient;\n} {\n\tif (typeof params[0] === 'string') {\n\t\tconst instance = new Client({\n\t\t\turl: params[0],\n\t\t});\n\n\t\treturn construct(instance, params[1]) as any;\n\t}\n\n\tif (isConfig(params[0])) {\n\t\tconst { connection, client, ...drizzleConfig } = params[0] as\n\t\t\t& { connection?: Config | string; client?: TClient }\n\t\t\t& DrizzleConfig;\n\n\t\tif (client) return construct(client, drizzleConfig) as any;\n\n\t\tconst instance = typeof connection === 'string'\n\t\t\t? new Client({\n\t\t\t\turl: connection,\n\t\t\t})\n\t\t\t: new Client(\n\t\t\t\tconnection!,\n\t\t\t);\n\n\t\treturn construct(instance, drizzleConfig) as any;\n\t}\n\n\treturn construct(params[0] as TClient, params[1] as DrizzleConfig<TSchema, TRelations> | undefined) as any;\n}\n\nexport namespace drizzle {\n\texport function mock<\n\t\tTSchema extends Record<string, unknown> = Record<string, never>,\n\t\tTRelations extends AnyRelations = EmptyRelations,\n\t>(\n\t\tconfig?: DrizzleConfig<TSchema, TRelations>,\n\t): PlanetScaleDatabase<TSchema, TRelations> & {\n\t\t$client: '$client is not available on drizzle.mock()';\n\t} {\n\t\treturn construct({} as any, config) as any;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAuB;AACvB,SAAoB;AACpB,oBAA2B;AAE3B,oBAA8B;AAC9B,gBAA8B;AAC9B,qBAA6B;AAE7B,mBAA6C;AAE7C,qBAAmC;AAM5B,MAAM,4BAGH,wBAA2F;AAAA,EACpG,QAA0B,wBAAU,IAAY;AACjD;AAEA,SAAS,UAKR,QACA,SAA6C,CAAC,GAG7C;AAGD,MAAI,EAAE,kBAAkB,yBAAS;AAChC,UAAM,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAWf;AAAA,EACF;AAEA,QAAM,UAAU,IAAI,4BAAa,EAAE,QAAQ,OAAO,OAAO,CAAC;AAC1D,MAAI;AACJ,MAAI,OAAO,WAAW,MAAM;AAC3B,aAAS,IAAI,4BAAc;AAAA,EAC5B,WAAW,OAAO,WAAW,OAAO;AACnC,aAAS,OAAO;AAAA,EACjB;AAEA,MAAI;AACJ,MAAI,OAAO,QAAQ;AAClB,UAAM,eAAe,GAAG;AAAA,MACvB,OAAO;AAAA,MACP,GAAG;AAAA,IACJ;AACA,aAAS;AAAA,MACR,YAAY,OAAO;AAAA,MACnB,QAAQ,aAAa;AAAA,MACrB,eAAe,aAAa;AAAA,IAC7B;AAAA,EACD;AAEA,QAAM,YAAY,OAAO;AACzB,QAAM,UAAU,IAAI,kCAAmB,QAAQ,SAAS,QAAW,WAAW,QAAQ,EAAE,OAAO,CAAC;AAChG,QAAM,KAAK,IAAI;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,EAAO,GAAI,UAAU;AAErB,SAAO;AACR;AAEO,SAAS,WAKZ,QAiBF;AACD,MAAI,OAAO,OAAO,CAAC,MAAM,UAAU;AAClC,UAAM,WAAW,IAAI,uBAAO;AAAA,MAC3B,KAAK,OAAO,CAAC;AAAA,IACd,CAAC;AAED,WAAO,UAAU,UAAU,OAAO,CAAC,CAAC;AAAA,EACrC;AAEA,UAAI,uBAAS,OAAO,CAAC,CAAC,GAAG;AACxB,UAAM,EAAE,YAAY,QAAQ,GAAG,cAAc,IAAI,OAAO,CAAC;AAIzD,QAAI;AAAQ,aAAO,UAAU,QAAQ,aAAa;AAElD,UAAM,WAAW,OAAO,eAAe,WACpC,IAAI,uBAAO;AAAA,MACZ,KAAK;AAAA,IACN,CAAC,IACC,IAAI;AAAA,MACL;AAAA,IACD;AAED,WAAO,UAAU,UAAU,aAAa;AAAA,EACzC;AAEA,SAAO,UAAU,OAAO,CAAC,GAAc,OAAO,CAAC,CAAmD;AACnG;AAAA,CAEO,CAAUA,aAAV;AACC,WAAS,KAIf,QAGC;AACD,WAAO,UAAU,CAAC,GAAU,MAAM;AAAA,EACnC;AATO,EAAAA,SAAS;AAAA,GADA;","names":["drizzle"]}
|
|
@@ -3,30 +3,31 @@ import { Client } from '@planetscale/database';
|
|
|
3
3
|
import { entityKind } from "../entity.cjs";
|
|
4
4
|
import type { Logger } from "../logger.cjs";
|
|
5
5
|
import { MySqlDatabase } from "../mysql-core/db.cjs";
|
|
6
|
+
import type { AnyRelations, EmptyRelations } from "../relations.cjs";
|
|
6
7
|
import { type DrizzleConfig } from "../utils.cjs";
|
|
7
8
|
import type { PlanetScalePreparedQueryHKT, PlanetscaleQueryResultHKT } from "./session.cjs";
|
|
8
9
|
export interface PlanetscaleSDriverOptions {
|
|
9
10
|
logger?: Logger;
|
|
10
11
|
}
|
|
11
|
-
export declare class PlanetScaleDatabase<TSchema extends Record<string, unknown> = Record<string, never
|
|
12
|
+
export declare class PlanetScaleDatabase<TSchema extends Record<string, unknown> = Record<string, never>, TRelations extends AnyRelations = EmptyRelations> extends MySqlDatabase<PlanetscaleQueryResultHKT, PlanetScalePreparedQueryHKT, TSchema, TRelations> {
|
|
12
13
|
static readonly [entityKind]: string;
|
|
13
14
|
}
|
|
14
|
-
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends Client = Client>(...params: [
|
|
15
|
+
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TRelations extends AnyRelations = EmptyRelations, TClient extends Client = Client>(...params: [
|
|
15
16
|
TClient | string
|
|
16
17
|
] | [
|
|
17
18
|
TClient | string,
|
|
18
|
-
DrizzleConfig<TSchema>
|
|
19
|
+
DrizzleConfig<TSchema, TRelations>
|
|
19
20
|
] | [
|
|
20
|
-
(DrizzleConfig<TSchema> & ({
|
|
21
|
+
(DrizzleConfig<TSchema, TRelations> & ({
|
|
21
22
|
connection: string | Config;
|
|
22
23
|
} | {
|
|
23
24
|
client: TClient;
|
|
24
25
|
}))
|
|
25
|
-
]): PlanetScaleDatabase<TSchema> & {
|
|
26
|
+
]): PlanetScaleDatabase<TSchema, TRelations> & {
|
|
26
27
|
$client: TClient;
|
|
27
28
|
};
|
|
28
29
|
export declare namespace drizzle {
|
|
29
|
-
function mock<TSchema extends Record<string, unknown> = Record<string, never
|
|
30
|
+
function mock<TSchema extends Record<string, unknown> = Record<string, never>, TRelations extends AnyRelations = EmptyRelations>(config?: DrizzleConfig<TSchema, TRelations>): PlanetScaleDatabase<TSchema, TRelations> & {
|
|
30
31
|
$client: '$client is not available on drizzle.mock()';
|
|
31
32
|
};
|
|
32
33
|
}
|
|
@@ -3,30 +3,31 @@ import { Client } from '@planetscale/database';
|
|
|
3
3
|
import { entityKind } from "../entity.js";
|
|
4
4
|
import type { Logger } from "../logger.js";
|
|
5
5
|
import { MySqlDatabase } from "../mysql-core/db.js";
|
|
6
|
+
import type { AnyRelations, EmptyRelations } from "../relations.js";
|
|
6
7
|
import { type DrizzleConfig } from "../utils.js";
|
|
7
8
|
import type { PlanetScalePreparedQueryHKT, PlanetscaleQueryResultHKT } from "./session.js";
|
|
8
9
|
export interface PlanetscaleSDriverOptions {
|
|
9
10
|
logger?: Logger;
|
|
10
11
|
}
|
|
11
|
-
export declare class PlanetScaleDatabase<TSchema extends Record<string, unknown> = Record<string, never
|
|
12
|
+
export declare class PlanetScaleDatabase<TSchema extends Record<string, unknown> = Record<string, never>, TRelations extends AnyRelations = EmptyRelations> extends MySqlDatabase<PlanetscaleQueryResultHKT, PlanetScalePreparedQueryHKT, TSchema, TRelations> {
|
|
12
13
|
static readonly [entityKind]: string;
|
|
13
14
|
}
|
|
14
|
-
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends Client = Client>(...params: [
|
|
15
|
+
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TRelations extends AnyRelations = EmptyRelations, TClient extends Client = Client>(...params: [
|
|
15
16
|
TClient | string
|
|
16
17
|
] | [
|
|
17
18
|
TClient | string,
|
|
18
|
-
DrizzleConfig<TSchema>
|
|
19
|
+
DrizzleConfig<TSchema, TRelations>
|
|
19
20
|
] | [
|
|
20
|
-
(DrizzleConfig<TSchema> & ({
|
|
21
|
+
(DrizzleConfig<TSchema, TRelations> & ({
|
|
21
22
|
connection: string | Config;
|
|
22
23
|
} | {
|
|
23
24
|
client: TClient;
|
|
24
25
|
}))
|
|
25
|
-
]): PlanetScaleDatabase<TSchema> & {
|
|
26
|
+
]): PlanetScaleDatabase<TSchema, TRelations> & {
|
|
26
27
|
$client: TClient;
|
|
27
28
|
};
|
|
28
29
|
export declare namespace drizzle {
|
|
29
|
-
function mock<TSchema extends Record<string, unknown> = Record<string, never
|
|
30
|
+
function mock<TSchema extends Record<string, unknown> = Record<string, never>, TRelations extends AnyRelations = EmptyRelations>(config?: DrizzleConfig<TSchema, TRelations>): PlanetScaleDatabase<TSchema, TRelations> & {
|
|
30
31
|
$client: '$client is not available on drizzle.mock()';
|
|
31
32
|
};
|
|
32
33
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { Client } from "@planetscale/database";
|
|
2
|
+
import * as V1 from "../_relations.js";
|
|
2
3
|
import { entityKind } from "../entity.js";
|
|
3
4
|
import { DefaultLogger } from "../logger.js";
|
|
4
5
|
import { MySqlDatabase } from "../mysql-core/db.js";
|
|
5
6
|
import { MySqlDialect } from "../mysql-core/dialect.js";
|
|
6
|
-
import {
|
|
7
|
-
createTableRelationsHelpers,
|
|
8
|
-
extractTablesRelationalConfig
|
|
9
|
-
} from "../relations.js";
|
|
10
7
|
import { isConfig } from "../utils.js";
|
|
11
8
|
import { PlanetscaleSession } from "./session.js";
|
|
12
9
|
class PlanetScaleDatabase extends MySqlDatabase {
|
|
@@ -36,9 +33,9 @@ const db = drizzle(client);
|
|
|
36
33
|
}
|
|
37
34
|
let schema;
|
|
38
35
|
if (config.schema) {
|
|
39
|
-
const tablesConfig = extractTablesRelationalConfig(
|
|
36
|
+
const tablesConfig = V1.extractTablesRelationalConfig(
|
|
40
37
|
config.schema,
|
|
41
|
-
createTableRelationsHelpers
|
|
38
|
+
V1.createTableRelationsHelpers
|
|
42
39
|
);
|
|
43
40
|
schema = {
|
|
44
41
|
fullSchema: config.schema,
|
|
@@ -46,8 +43,15 @@ const db = drizzle(client);
|
|
|
46
43
|
tableNamesMap: tablesConfig.tableNamesMap
|
|
47
44
|
};
|
|
48
45
|
}
|
|
49
|
-
const
|
|
50
|
-
const
|
|
46
|
+
const relations = config.relations;
|
|
47
|
+
const session = new PlanetscaleSession(client, dialect, void 0, relations, schema, { logger });
|
|
48
|
+
const db = new PlanetScaleDatabase(
|
|
49
|
+
dialect,
|
|
50
|
+
session,
|
|
51
|
+
relations,
|
|
52
|
+
schema,
|
|
53
|
+
"planetscale"
|
|
54
|
+
);
|
|
51
55
|
db.$client = client;
|
|
52
56
|
return db;
|
|
53
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/planetscale-serverless/driver.ts"],"sourcesContent":["import type { Config } from '@planetscale/database';\nimport { Client } from '@planetscale/database';\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport { MySqlDatabase } from '~/mysql-core/db.ts';\nimport { MySqlDialect } from '~/mysql-core/dialect.ts';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/planetscale-serverless/driver.ts"],"sourcesContent":["import type { Config } from '@planetscale/database';\nimport { Client } from '@planetscale/database';\nimport * as V1 from '~/_relations.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport { MySqlDatabase } from '~/mysql-core/db.ts';\nimport { MySqlDialect } from '~/mysql-core/dialect.ts';\nimport type { AnyRelations, EmptyRelations } from '~/relations.ts';\nimport { type DrizzleConfig, isConfig } from '~/utils.ts';\nimport type { PlanetScalePreparedQueryHKT, PlanetscaleQueryResultHKT } from './session.ts';\nimport { PlanetscaleSession } from './session.ts';\n\nexport interface PlanetscaleSDriverOptions {\n\tlogger?: Logger;\n}\n\nexport class PlanetScaleDatabase<\n\tTSchema extends Record<string, unknown> = Record<string, never>,\n\tTRelations extends AnyRelations = EmptyRelations,\n> extends MySqlDatabase<PlanetscaleQueryResultHKT, PlanetScalePreparedQueryHKT, TSchema, TRelations> {\n\tstatic override readonly [entityKind]: string = 'PlanetScaleDatabase';\n}\n\nfunction construct<\n\tTSchema extends Record<string, unknown> = Record<string, never>,\n\tTRelations extends AnyRelations = EmptyRelations,\n\tTClient extends Client = Client,\n>(\n\tclient: TClient,\n\tconfig: DrizzleConfig<TSchema, TRelations> = {},\n): PlanetScaleDatabase<TSchema, TRelations> & {\n\t$client: TClient;\n} {\n\t// Client is not Drizzle Object, so we can ignore this rule here\n\t// eslint-disable-next-line no-instanceof/no-instanceof\n\tif (!(client instanceof Client)) {\n\t\tthrow new Error(`Warning: You need to pass an instance of Client:\n\nimport { Client } from \"@planetscale/database\";\n\nconst client = new Client({\n host: process.env[\"DATABASE_HOST\"],\n username: process.env[\"DATABASE_USERNAME\"],\n password: process.env[\"DATABASE_PASSWORD\"],\n});\n\nconst db = drizzle(client);\n\t\t`);\n\t}\n\n\tconst dialect = new MySqlDialect({ casing: config.casing });\n\tlet logger;\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\tlet schema: V1.RelationalSchemaConfig<V1.TablesRelationalConfig> | undefined;\n\tif (config.schema) {\n\t\tconst tablesConfig = V1.extractTablesRelationalConfig(\n\t\t\tconfig.schema,\n\t\t\tV1.createTableRelationsHelpers,\n\t\t);\n\t\tschema = {\n\t\t\tfullSchema: config.schema,\n\t\t\tschema: tablesConfig.tables,\n\t\t\ttableNamesMap: tablesConfig.tableNamesMap,\n\t\t};\n\t}\n\n\tconst relations = config.relations;\n\tconst session = new PlanetscaleSession(client, dialect, undefined, relations, schema, { logger });\n\tconst db = new PlanetScaleDatabase(\n\t\tdialect,\n\t\tsession,\n\t\trelations,\n\t\tschema as V1.RelationalSchemaConfig<any>,\n\t\t'planetscale',\n\t) as PlanetScaleDatabase<TSchema, TRelations>;\n\t(<any> db).$client = client;\n\n\treturn db as any;\n}\n\nexport function drizzle<\n\tTSchema extends Record<string, unknown> = Record<string, never>,\n\tTRelations extends AnyRelations = EmptyRelations,\n\tTClient extends Client = Client,\n>(\n\t...params: [\n\t\tTClient | string,\n\t] | [\n\t\tTClient | string,\n\t\tDrizzleConfig<TSchema, TRelations>,\n\t] | [\n\t\t(\n\t\t\t& DrizzleConfig<TSchema, TRelations>\n\t\t\t& ({\n\t\t\t\tconnection: string | Config;\n\t\t\t} | {\n\t\t\t\tclient: TClient;\n\t\t\t})\n\t\t),\n\t]\n): PlanetScaleDatabase<TSchema, TRelations> & {\n\t$client: TClient;\n} {\n\tif (typeof params[0] === 'string') {\n\t\tconst instance = new Client({\n\t\t\turl: params[0],\n\t\t});\n\n\t\treturn construct(instance, params[1]) as any;\n\t}\n\n\tif (isConfig(params[0])) {\n\t\tconst { connection, client, ...drizzleConfig } = params[0] as\n\t\t\t& { connection?: Config | string; client?: TClient }\n\t\t\t& DrizzleConfig;\n\n\t\tif (client) return construct(client, drizzleConfig) as any;\n\n\t\tconst instance = typeof connection === 'string'\n\t\t\t? new Client({\n\t\t\t\turl: connection,\n\t\t\t})\n\t\t\t: new Client(\n\t\t\t\tconnection!,\n\t\t\t);\n\n\t\treturn construct(instance, drizzleConfig) as any;\n\t}\n\n\treturn construct(params[0] as TClient, params[1] as DrizzleConfig<TSchema, TRelations> | undefined) as any;\n}\n\nexport namespace drizzle {\n\texport function mock<\n\t\tTSchema extends Record<string, unknown> = Record<string, never>,\n\t\tTRelations extends AnyRelations = EmptyRelations,\n\t>(\n\t\tconfig?: DrizzleConfig<TSchema, TRelations>,\n\t): PlanetScaleDatabase<TSchema, TRelations> & {\n\t\t$client: '$client is not available on drizzle.mock()';\n\t} {\n\t\treturn construct({} as any, config) as any;\n\t}\n}\n"],"mappings":"AACA,SAAS,cAAc;AACvB,YAAY,QAAQ;AACpB,SAAS,kBAAkB;AAE3B,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAE7B,SAA6B,gBAAgB;AAE7C,SAAS,0BAA0B;AAM5B,MAAM,4BAGH,cAA2F;AAAA,EACpG,QAA0B,UAAU,IAAY;AACjD;AAEA,SAAS,UAKR,QACA,SAA6C,CAAC,GAG7C;AAGD,MAAI,EAAE,kBAAkB,SAAS;AAChC,UAAM,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAWf;AAAA,EACF;AAEA,QAAM,UAAU,IAAI,aAAa,EAAE,QAAQ,OAAO,OAAO,CAAC;AAC1D,MAAI;AACJ,MAAI,OAAO,WAAW,MAAM;AAC3B,aAAS,IAAI,cAAc;AAAA,EAC5B,WAAW,OAAO,WAAW,OAAO;AACnC,aAAS,OAAO;AAAA,EACjB;AAEA,MAAI;AACJ,MAAI,OAAO,QAAQ;AAClB,UAAM,eAAe,GAAG;AAAA,MACvB,OAAO;AAAA,MACP,GAAG;AAAA,IACJ;AACA,aAAS;AAAA,MACR,YAAY,OAAO;AAAA,MACnB,QAAQ,aAAa;AAAA,MACrB,eAAe,aAAa;AAAA,IAC7B;AAAA,EACD;AAEA,QAAM,YAAY,OAAO;AACzB,QAAM,UAAU,IAAI,mBAAmB,QAAQ,SAAS,QAAW,WAAW,QAAQ,EAAE,OAAO,CAAC;AAChG,QAAM,KAAK,IAAI;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,EAAO,GAAI,UAAU;AAErB,SAAO;AACR;AAEO,SAAS,WAKZ,QAiBF;AACD,MAAI,OAAO,OAAO,CAAC,MAAM,UAAU;AAClC,UAAM,WAAW,IAAI,OAAO;AAAA,MAC3B,KAAK,OAAO,CAAC;AAAA,IACd,CAAC;AAED,WAAO,UAAU,UAAU,OAAO,CAAC,CAAC;AAAA,EACrC;AAEA,MAAI,SAAS,OAAO,CAAC,CAAC,GAAG;AACxB,UAAM,EAAE,YAAY,QAAQ,GAAG,cAAc,IAAI,OAAO,CAAC;AAIzD,QAAI;AAAQ,aAAO,UAAU,QAAQ,aAAa;AAElD,UAAM,WAAW,OAAO,eAAe,WACpC,IAAI,OAAO;AAAA,MACZ,KAAK;AAAA,IACN,CAAC,IACC,IAAI;AAAA,MACL;AAAA,IACD;AAED,WAAO,UAAU,UAAU,aAAa;AAAA,EACzC;AAEA,SAAO,UAAU,OAAO,CAAC,GAAc,OAAO,CAAC,CAAmD;AACnG;AAAA,CAEO,CAAUA,aAAV;AACC,WAAS,KAIf,QAGC;AACD,WAAO,UAAU,CAAC,GAAU,MAAM;AAAA,EACnC;AATO,EAAAA,SAAS;AAAA,GADA;","names":["drizzle"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/planetscale-serverless/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { PlanetScaleDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown
|
|
1
|
+
{"version":3,"sources":["../../src/planetscale-serverless/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { AnyRelations } from '~/relations.ts';\nimport type { PlanetScaleDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown>, TRelations extends AnyRelations>(\n\tdb: PlanetScaleDatabase<TSchema, TRelations>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\n\tawait db.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAmC;AAInC,eAAsB,QACrB,IACA,QACC;AACD,QAAM,iBAAa,oCAAmB,MAAM;AAE5C,QAAM,GAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AACxD;","names":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { MigrationConfig } from "../migrator.cjs";
|
|
2
|
+
import type { AnyRelations } from "../relations.cjs";
|
|
2
3
|
import type { PlanetScaleDatabase } from "./driver.cjs";
|
|
3
|
-
export declare function migrate<TSchema extends Record<string, unknown
|
|
4
|
+
export declare function migrate<TSchema extends Record<string, unknown>, TRelations extends AnyRelations>(db: PlanetScaleDatabase<TSchema, TRelations>, config: MigrationConfig): Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { MigrationConfig } from "../migrator.js";
|
|
2
|
+
import type { AnyRelations } from "../relations.js";
|
|
2
3
|
import type { PlanetScaleDatabase } from "./driver.js";
|
|
3
|
-
export declare function migrate<TSchema extends Record<string, unknown
|
|
4
|
+
export declare function migrate<TSchema extends Record<string, unknown>, TRelations extends AnyRelations>(db: PlanetScaleDatabase<TSchema, TRelations>, config: MigrationConfig): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/planetscale-serverless/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { PlanetScaleDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown
|
|
1
|
+
{"version":3,"sources":["../../src/planetscale-serverless/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { AnyRelations } from '~/relations.ts';\nimport type { PlanetScaleDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown>, TRelations extends AnyRelations>(\n\tdb: PlanetScaleDatabase<TSchema, TRelations>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\n\tawait db.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":"AACA,SAAS,0BAA0B;AAInC,eAAsB,QACrB,IACA,QACC;AACD,QAAM,aAAa,mBAAmB,MAAM;AAE5C,QAAM,GAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AACxD;","names":[]}
|
|
@@ -30,7 +30,7 @@ var import_session = require("../mysql-core/session.cjs");
|
|
|
30
30
|
var import_sql = require("../sql/sql.cjs");
|
|
31
31
|
var import_utils = require("../utils.cjs");
|
|
32
32
|
class PlanetScalePreparedQuery extends import_session.MySqlPreparedQuery {
|
|
33
|
-
constructor(client, queryString, params, logger, fields, customResultMapper, generatedIds, returningIds) {
|
|
33
|
+
constructor(client, queryString, params, logger, fields, customResultMapper, generatedIds, returningIds, isRqbV2Query) {
|
|
34
34
|
super();
|
|
35
35
|
this.client = client;
|
|
36
36
|
this.queryString = queryString;
|
|
@@ -40,11 +40,14 @@ class PlanetScalePreparedQuery extends import_session.MySqlPreparedQuery {
|
|
|
40
40
|
this.customResultMapper = customResultMapper;
|
|
41
41
|
this.generatedIds = generatedIds;
|
|
42
42
|
this.returningIds = returningIds;
|
|
43
|
+
this.isRqbV2Query = isRqbV2Query;
|
|
43
44
|
}
|
|
44
45
|
static [import_entity.entityKind] = "PlanetScalePreparedQuery";
|
|
45
46
|
rawQuery = { as: "object" };
|
|
46
47
|
query = { as: "array" };
|
|
47
48
|
async execute(placeholderValues = {}) {
|
|
49
|
+
if (this.isRqbV2Query)
|
|
50
|
+
return this.executeRqbV2(placeholderValues);
|
|
48
51
|
const params = (0, import_sql.fillPlaceholders)(this.params, placeholderValues);
|
|
49
52
|
this.logger.logQuery(this.queryString, params);
|
|
50
53
|
const {
|
|
@@ -89,14 +92,52 @@ class PlanetScalePreparedQuery extends import_session.MySqlPreparedQuery {
|
|
|
89
92
|
}
|
|
90
93
|
return rows.map((row) => (0, import_utils.mapResultRow)(fields, row, joinsNotNullableMap));
|
|
91
94
|
}
|
|
95
|
+
async executeRqbV2(placeholderValues = {}) {
|
|
96
|
+
const params = (0, import_sql.fillPlaceholders)(this.params, placeholderValues);
|
|
97
|
+
this.logger.logQuery(this.queryString, params);
|
|
98
|
+
const {
|
|
99
|
+
client,
|
|
100
|
+
queryString,
|
|
101
|
+
rawQuery,
|
|
102
|
+
customResultMapper,
|
|
103
|
+
returningIds,
|
|
104
|
+
generatedIds
|
|
105
|
+
} = this;
|
|
106
|
+
const res = await client.execute(queryString, params, rawQuery);
|
|
107
|
+
const insertId = Number.parseFloat(res.insertId);
|
|
108
|
+
const affectedRows = res.rowsAffected;
|
|
109
|
+
if (returningIds) {
|
|
110
|
+
const returningResponse = [];
|
|
111
|
+
let j = 0;
|
|
112
|
+
for (let i = insertId; i < insertId + affectedRows; i++) {
|
|
113
|
+
for (const column of returningIds) {
|
|
114
|
+
const key = returningIds[0].path[0];
|
|
115
|
+
if ((0, import_entity.is)(column.field, import_column.Column)) {
|
|
116
|
+
if (column.field.primary && column.field.autoIncrement) {
|
|
117
|
+
returningResponse.push({ [key]: i });
|
|
118
|
+
}
|
|
119
|
+
if (column.field.defaultFn && generatedIds) {
|
|
120
|
+
returningResponse.push({ [key]: generatedIds[j][key] });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
j++;
|
|
125
|
+
}
|
|
126
|
+
return customResultMapper(returningResponse);
|
|
127
|
+
}
|
|
128
|
+
return customResultMapper(
|
|
129
|
+
res.rows
|
|
130
|
+
);
|
|
131
|
+
}
|
|
92
132
|
iterator(_placeholderValues) {
|
|
93
133
|
throw new Error("Streaming is not supported by the PlanetScale Serverless driver");
|
|
94
134
|
}
|
|
95
135
|
}
|
|
96
136
|
class PlanetscaleSession extends import_session.MySqlSession {
|
|
97
|
-
constructor(baseClient, dialect, tx, schema, options = {}) {
|
|
137
|
+
constructor(baseClient, dialect, tx, relations, schema, options = {}) {
|
|
98
138
|
super(dialect);
|
|
99
139
|
this.baseClient = baseClient;
|
|
140
|
+
this.relations = relations;
|
|
100
141
|
this.schema = schema;
|
|
101
142
|
this.options = options;
|
|
102
143
|
this.client = tx ?? baseClient;
|
|
@@ -117,6 +158,19 @@ class PlanetscaleSession extends import_session.MySqlSession {
|
|
|
117
158
|
returningIds
|
|
118
159
|
);
|
|
119
160
|
}
|
|
161
|
+
prepareRelationalQuery(query, fields, customResultMapper, generatedIds, returningIds) {
|
|
162
|
+
return new PlanetScalePreparedQuery(
|
|
163
|
+
this.client,
|
|
164
|
+
query.sql,
|
|
165
|
+
query.params,
|
|
166
|
+
this.logger,
|
|
167
|
+
fields,
|
|
168
|
+
customResultMapper,
|
|
169
|
+
generatedIds,
|
|
170
|
+
returningIds,
|
|
171
|
+
true
|
|
172
|
+
);
|
|
173
|
+
}
|
|
120
174
|
async query(query, params) {
|
|
121
175
|
this.logger.logQuery(query, params);
|
|
122
176
|
return await this.client.execute(query, params, { as: "array" });
|
|
@@ -137,10 +191,18 @@ class PlanetscaleSession extends import_session.MySqlSession {
|
|
|
137
191
|
}
|
|
138
192
|
transaction(transaction) {
|
|
139
193
|
return this.baseClient.transaction((pstx) => {
|
|
140
|
-
const session = new PlanetscaleSession(
|
|
194
|
+
const session = new PlanetscaleSession(
|
|
195
|
+
this.baseClient,
|
|
196
|
+
this.dialect,
|
|
197
|
+
pstx,
|
|
198
|
+
this.relations,
|
|
199
|
+
this.schema,
|
|
200
|
+
this.options
|
|
201
|
+
);
|
|
141
202
|
const tx = new PlanetScaleTransaction(
|
|
142
203
|
this.dialect,
|
|
143
204
|
session,
|
|
205
|
+
this.relations,
|
|
144
206
|
this.schema
|
|
145
207
|
);
|
|
146
208
|
return transaction(tx);
|
|
@@ -149,14 +211,15 @@ class PlanetscaleSession extends import_session.MySqlSession {
|
|
|
149
211
|
}
|
|
150
212
|
class PlanetScaleTransaction extends import_session.MySqlTransaction {
|
|
151
213
|
static [import_entity.entityKind] = "PlanetScaleTransaction";
|
|
152
|
-
constructor(dialect, session, schema, nestedIndex = 0) {
|
|
153
|
-
super(dialect, session, schema, nestedIndex, "planetscale");
|
|
214
|
+
constructor(dialect, session, relations, schema, nestedIndex = 0) {
|
|
215
|
+
super(dialect, session, relations, schema, nestedIndex, "planetscale");
|
|
154
216
|
}
|
|
155
217
|
async transaction(transaction) {
|
|
156
218
|
const savepointName = `sp${this.nestedIndex + 1}`;
|
|
157
219
|
const tx = new PlanetScaleTransaction(
|
|
158
220
|
this.dialect,
|
|
159
221
|
this.session,
|
|
222
|
+
this.relations,
|
|
160
223
|
this.schema,
|
|
161
224
|
this.nestedIndex + 1
|
|
162
225
|
);
|