drizzle-orm 0.39.0-b06bbcd → 0.39.0
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/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 +5 -19
- package/aws-data-api/pg/driver.cjs.map +1 -1
- package/aws-data-api/pg/driver.d.cts +8 -9
- package/aws-data-api/pg/driver.d.ts +8 -9
- package/aws-data-api/pg/driver.js +8 -9
- 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 +1 -2
- package/aws-data-api/pg/migrator.d.ts +1 -2
- package/aws-data-api/pg/migrator.js.map +1 -1
- package/aws-data-api/pg/session.cjs +4 -67
- package/aws-data-api/pg/session.cjs.map +1 -1
- package/aws-data-api/pg/session.d.cts +8 -13
- package/aws-data-api/pg/session.d.ts +8 -13
- package/aws-data-api/pg/session.js +4 -67
- package/aws-data-api/pg/session.js.map +1 -1
- package/better-sqlite3/driver.cjs +5 -12
- package/better-sqlite3/driver.cjs.map +1 -1
- package/better-sqlite3/driver.d.cts +6 -7
- package/better-sqlite3/driver.d.ts +6 -7
- package/better-sqlite3/driver.js +8 -12
- package/better-sqlite3/driver.js.map +1 -1
- package/better-sqlite3/migrator.cjs.map +1 -1
- package/better-sqlite3/migrator.d.cts +1 -2
- package/better-sqlite3/migrator.d.ts +1 -2
- package/better-sqlite3/migrator.js.map +1 -1
- package/better-sqlite3/session.cjs +4 -49
- package/better-sqlite3/session.cjs.map +1 -1
- package/better-sqlite3/session.d.cts +8 -14
- package/better-sqlite3/session.d.ts +8 -14
- package/better-sqlite3/session.js +4 -49
- package/better-sqlite3/session.js.map +1 -1
- package/bun-sql/driver.cjs +96 -0
- package/bun-sql/driver.cjs.map +1 -0
- package/bun-sql/driver.d.cts +30 -0
- package/bun-sql/driver.d.ts +30 -0
- package/bun-sql/driver.js +74 -0
- package/bun-sql/driver.js.map +1 -0
- package/bun-sql/index.cjs +25 -0
- package/bun-sql/index.cjs.map +1 -0
- package/bun-sql/index.d.cts +2 -0
- package/bun-sql/index.d.ts +2 -0
- package/bun-sql/index.js +3 -0
- package/bun-sql/index.js.map +1 -0
- package/bun-sql/migrator.cjs +33 -0
- package/bun-sql/migrator.cjs.map +1 -0
- package/bun-sql/migrator.d.cts +3 -0
- package/bun-sql/migrator.d.ts +3 -0
- package/bun-sql/migrator.js +9 -0
- package/bun-sql/migrator.js.map +1 -0
- package/bun-sql/session.cjs +162 -0
- package/bun-sql/session.cjs.map +1 -0
- package/bun-sql/session.d.cts +50 -0
- package/bun-sql/session.d.ts +50 -0
- package/bun-sql/session.js +136 -0
- package/bun-sql/session.js.map +1 -0
- package/bun-sqlite/driver.cjs +5 -22
- package/bun-sqlite/driver.cjs.map +1 -1
- package/bun-sqlite/driver.d.cts +6 -7
- package/bun-sqlite/driver.d.ts +6 -7
- package/bun-sqlite/driver.js +8 -12
- package/bun-sqlite/driver.js.map +1 -1
- package/bun-sqlite/migrator.cjs.map +1 -1
- package/bun-sqlite/migrator.d.cts +1 -2
- package/bun-sqlite/migrator.d.ts +1 -2
- package/bun-sqlite/migrator.js.map +1 -1
- package/bun-sqlite/session.cjs +4 -49
- package/bun-sqlite/session.cjs.map +1 -1
- package/bun-sqlite/session.d.cts +9 -15
- package/bun-sqlite/session.d.ts +9 -15
- package/bun-sqlite/session.js +4 -49
- package/bun-sqlite/session.js.map +1 -1
- package/d1/driver.cjs +5 -22
- package/d1/driver.cjs.map +1 -1
- package/d1/driver.d.cts +2 -3
- package/d1/driver.d.ts +2 -3
- package/d1/driver.js +8 -12
- package/d1/driver.js.map +1 -1
- package/d1/migrator.cjs.map +1 -1
- package/d1/migrator.d.cts +1 -2
- package/d1/migrator.d.ts +1 -2
- package/d1/migrator.js.map +1 -1
- package/d1/session.cjs +6 -48
- package/d1/session.cjs.map +1 -1
- package/d1/session.d.cts +8 -15
- package/d1/session.d.ts +8 -15
- package/d1/session.js +6 -48
- package/d1/session.js.map +1 -1
- package/durable-sqlite/driver.cjs +5 -16
- package/durable-sqlite/driver.cjs.map +1 -1
- package/durable-sqlite/driver.d.cts +2 -3
- package/durable-sqlite/driver.d.ts +2 -3
- package/durable-sqlite/driver.js +8 -6
- package/durable-sqlite/driver.js.map +1 -1
- package/durable-sqlite/migrator.cjs.map +1 -1
- package/durable-sqlite/migrator.d.cts +1 -2
- package/durable-sqlite/migrator.d.ts +1 -2
- package/durable-sqlite/migrator.js.map +1 -1
- package/durable-sqlite/session.cjs +4 -46
- package/durable-sqlite/session.cjs.map +1 -1
- package/durable-sqlite/session.d.cts +8 -14
- package/durable-sqlite/session.d.ts +8 -14
- package/durable-sqlite/session.js +4 -46
- package/durable-sqlite/session.js.map +1 -1
- package/expo-sqlite/driver.cjs +5 -22
- package/expo-sqlite/driver.cjs.map +1 -1
- package/expo-sqlite/driver.d.cts +2 -3
- package/expo-sqlite/driver.d.ts +2 -3
- package/expo-sqlite/driver.js +8 -12
- package/expo-sqlite/driver.js.map +1 -1
- package/expo-sqlite/migrator.cjs.map +1 -1
- package/expo-sqlite/migrator.d.cts +2 -3
- package/expo-sqlite/migrator.d.ts +2 -3
- package/expo-sqlite/migrator.js.map +1 -1
- package/expo-sqlite/query.cjs +2 -13
- package/expo-sqlite/query.cjs.map +1 -1
- package/expo-sqlite/query.d.cts +1 -2
- package/expo-sqlite/query.d.ts +1 -2
- package/expo-sqlite/query.js +2 -3
- package/expo-sqlite/query.js.map +1 -1
- package/expo-sqlite/session.cjs +4 -47
- package/expo-sqlite/session.cjs.map +1 -1
- package/expo-sqlite/session.d.cts +8 -14
- package/expo-sqlite/session.d.ts +8 -14
- package/expo-sqlite/session.js +4 -47
- package/expo-sqlite/session.js.map +1 -1
- package/libsql/driver-core.cjs +5 -22
- package/libsql/driver-core.cjs.map +1 -1
- package/libsql/driver-core.d.cts +1 -2
- package/libsql/driver-core.d.ts +1 -2
- package/libsql/driver-core.js +8 -12
- package/libsql/driver-core.js.map +1 -1
- package/libsql/driver.cjs.map +1 -1
- package/libsql/driver.d.cts +5 -6
- package/libsql/driver.d.ts +5 -6
- package/libsql/driver.js.map +1 -1
- package/libsql/http/index.cjs.map +1 -1
- package/libsql/http/index.d.cts +5 -6
- package/libsql/http/index.d.ts +5 -6
- package/libsql/http/index.js.map +1 -1
- package/libsql/migrator.cjs.map +1 -1
- package/libsql/migrator.d.cts +1 -2
- package/libsql/migrator.d.ts +1 -2
- package/libsql/migrator.js.map +1 -1
- package/libsql/node/index.cjs.map +1 -1
- package/libsql/node/index.d.cts +5 -6
- package/libsql/node/index.d.ts +5 -6
- package/libsql/node/index.js.map +1 -1
- package/libsql/session.cjs +4 -56
- package/libsql/session.cjs.map +1 -1
- package/libsql/session.d.cts +9 -15
- package/libsql/session.d.ts +9 -15
- package/libsql/session.js +4 -56
- package/libsql/session.js.map +1 -1
- package/libsql/sqlite3/index.cjs.map +1 -1
- package/libsql/sqlite3/index.d.cts +5 -6
- package/libsql/sqlite3/index.d.ts +5 -6
- package/libsql/sqlite3/index.js.map +1 -1
- package/libsql/wasm/index.cjs.map +1 -1
- package/libsql/wasm/index.d.cts +5 -6
- package/libsql/wasm/index.d.ts +5 -6
- package/libsql/wasm/index.js.map +1 -1
- package/libsql/web/index.cjs.map +1 -1
- package/libsql/web/index.d.cts +5 -6
- package/libsql/web/index.d.ts +5 -6
- package/libsql/web/index.js.map +1 -1
- package/libsql/ws/index.cjs.map +1 -1
- package/libsql/ws/index.d.cts +5 -6
- package/libsql/ws/index.d.ts +5 -6
- package/libsql/ws/index.js.map +1 -1
- package/mysql-core/db.cjs +25 -40
- package/mysql-core/db.cjs.map +1 -1
- package/mysql-core/db.d.cts +12 -22
- package/mysql-core/db.d.ts +12 -22
- package/mysql-core/db.js +24 -39
- package/mysql-core/db.js.map +1 -1
- package/mysql-core/dialect.cjs +15 -194
- package/mysql-core/dialect.cjs.map +1 -1
- package/mysql-core/dialect.d.cts +13 -33
- package/mysql-core/dialect.d.ts +13 -33
- package/mysql-core/dialect.js +21 -191
- package/mysql-core/dialect.js.map +1 -1
- 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-builder.cjs +15 -11
- package/mysql-core/query-builders/query-builder.cjs.map +1 -1
- package/mysql-core/query-builders/query-builder.d.cts +2 -6
- package/mysql-core/query-builders/query-builder.d.ts +2 -6
- package/mysql-core/query-builders/query-builder.js +15 -11
- package/mysql-core/query-builders/query-builder.js.map +1 -1
- package/mysql-core/query-builders/query.cjs +31 -18
- package/mysql-core/query-builders/query.cjs.map +1 -1
- package/mysql-core/query-builders/query.d.cts +10 -8
- package/mysql-core/query-builders/query.d.ts +10 -8
- package/mysql-core/query-builders/query.js +31 -18
- package/mysql-core/query-builders/query.js.map +1 -1
- package/mysql-core/session.cjs +2 -3
- package/mysql-core/session.cjs.map +1 -1
- package/mysql-core/session.d.cts +7 -10
- package/mysql-core/session.d.ts +7 -10
- package/mysql-core/session.js +2 -3
- package/mysql-core/session.js.map +1 -1
- package/mysql-core/subquery.cjs.map +1 -1
- package/mysql-core/subquery.d.cts +15 -2
- package/mysql-core/subquery.d.ts +15 -2
- package/mysql-proxy/driver.cjs +5 -22
- package/mysql-proxy/driver.cjs.map +1 -1
- package/mysql-proxy/driver.d.cts +2 -3
- package/mysql-proxy/driver.d.ts +2 -3
- package/mysql-proxy/driver.js +8 -12
- package/mysql-proxy/driver.js.map +1 -1
- package/mysql-proxy/migrator.cjs.map +1 -1
- package/mysql-proxy/migrator.d.cts +1 -2
- package/mysql-proxy/migrator.d.ts +1 -2
- package/mysql-proxy/migrator.js.map +1 -1
- package/mysql-proxy/session.cjs +2 -27
- package/mysql-proxy/session.cjs.map +1 -1
- package/mysql-proxy/session.d.cts +8 -13
- package/mysql-proxy/session.d.ts +8 -13
- package/mysql-proxy/session.js +2 -27
- package/mysql-proxy/session.js.map +1 -1
- package/mysql2/driver.cjs +7 -24
- package/mysql2/driver.cjs.map +1 -1
- package/mysql2/driver.d.cts +9 -10
- package/mysql2/driver.d.ts +9 -10
- package/mysql2/driver.js +10 -14
- package/mysql2/driver.js.map +1 -1
- package/mysql2/migrator.cjs.map +1 -1
- package/mysql2/migrator.d.cts +1 -2
- package/mysql2/migrator.d.ts +1 -2
- package/mysql2/migrator.js.map +1 -1
- package/mysql2/session.cjs +2 -30
- package/mysql2/session.cjs.map +1 -1
- package/mysql2/session.d.cts +8 -13
- package/mysql2/session.d.ts +8 -13
- package/mysql2/session.js +2 -30
- package/mysql2/session.js.map +1 -1
- package/neon/index.cjs +2 -0
- package/neon/index.cjs.map +1 -1
- package/neon/index.d.cts +1 -0
- package/neon/index.d.ts +1 -0
- package/neon/index.js +1 -0
- package/neon/index.js.map +1 -1
- package/neon/neon-identity.cjs +38 -0
- package/neon/neon-identity.cjs.map +1 -0
- package/neon/neon-identity.d.cts +116 -0
- package/neon/neon-identity.d.ts +116 -0
- package/neon/neon-identity.js +14 -0
- package/neon/neon-identity.js.map +1 -0
- package/neon-http/driver.cjs +7 -21
- package/neon-http/driver.cjs.map +1 -1
- package/neon-http/driver.d.cts +9 -10
- package/neon-http/driver.d.ts +9 -10
- package/neon-http/driver.js +7 -11
- package/neon-http/driver.js.map +1 -1
- package/neon-http/migrator.cjs.map +1 -1
- package/neon-http/migrator.d.cts +1 -2
- package/neon-http/migrator.d.ts +1 -2
- package/neon-http/migrator.js.map +1 -1
- package/neon-http/session.cjs +2 -32
- package/neon-http/session.cjs.map +1 -1
- package/neon-http/session.d.cts +8 -13
- package/neon-http/session.d.ts +8 -13
- package/neon-http/session.js +2 -32
- package/neon-http/session.js.map +1 -1
- package/neon-serverless/driver.cjs +7 -18
- package/neon-serverless/driver.cjs.map +1 -1
- package/neon-serverless/driver.d.cts +8 -9
- package/neon-serverless/driver.d.ts +8 -9
- package/neon-serverless/driver.js +10 -8
- package/neon-serverless/driver.js.map +1 -1
- package/neon-serverless/migrator.cjs.map +1 -1
- package/neon-serverless/migrator.d.cts +1 -2
- package/neon-serverless/migrator.d.ts +1 -2
- package/neon-serverless/migrator.js.map +1 -1
- package/neon-serverless/session.cjs +5 -40
- package/neon-serverless/session.cjs.map +1 -1
- package/neon-serverless/session.d.cts +8 -13
- package/neon-serverless/session.d.ts +8 -13
- package/neon-serverless/session.js +5 -40
- package/neon-serverless/session.js.map +1 -1
- package/node-postgres/driver.cjs +7 -13
- package/node-postgres/driver.cjs.map +1 -1
- package/node-postgres/driver.d.cts +8 -9
- package/node-postgres/driver.d.ts +8 -9
- package/node-postgres/driver.js +10 -13
- package/node-postgres/driver.js.map +1 -1
- package/node-postgres/migrator.cjs.map +1 -1
- package/node-postgres/migrator.d.cts +1 -2
- package/node-postgres/migrator.d.ts +1 -2
- package/node-postgres/migrator.js.map +1 -1
- package/node-postgres/session.cjs +4 -45
- package/node-postgres/session.cjs.map +1 -1
- package/node-postgres/session.d.cts +8 -13
- package/node-postgres/session.d.ts +8 -13
- package/node-postgres/session.js +4 -45
- package/node-postgres/session.js.map +1 -1
- package/op-sqlite/driver.cjs +5 -22
- package/op-sqlite/driver.cjs.map +1 -1
- package/op-sqlite/driver.d.cts +2 -3
- package/op-sqlite/driver.d.ts +2 -3
- package/op-sqlite/driver.js +8 -12
- package/op-sqlite/driver.js.map +1 -1
- package/op-sqlite/migrator.cjs.map +1 -1
- package/op-sqlite/migrator.d.cts +2 -3
- package/op-sqlite/migrator.d.ts +2 -3
- package/op-sqlite/migrator.js.map +1 -1
- package/op-sqlite/session.cjs +4 -47
- package/op-sqlite/session.cjs.map +1 -1
- package/op-sqlite/session.d.cts +8 -14
- package/op-sqlite/session.d.ts +8 -14
- package/op-sqlite/session.js +4 -47
- package/op-sqlite/session.js.map +1 -1
- package/package.json +64 -52
- package/pg-core/db.cjs +24 -42
- package/pg-core/db.cjs.map +1 -1
- package/pg-core/db.d.cts +13 -23
- package/pg-core/db.d.ts +13 -23
- package/pg-core/db.js +23 -41
- package/pg-core/db.js.map +1 -1
- package/pg-core/dialect.cjs +488 -161
- package/pg-core/dialect.cjs.map +1 -1
- package/pg-core/dialect.d.cts +7 -24
- package/pg-core/dialect.d.ts +7 -24
- package/pg-core/dialect.js +494 -158
- package/pg-core/dialect.js.map +1 -1
- package/pg-core/query-builders/count.cjs.map +1 -1
- package/pg-core/query-builders/count.d.cts +1 -1
- package/pg-core/query-builders/count.d.ts +1 -1
- package/pg-core/query-builders/count.js.map +1 -1
- package/pg-core/query-builders/delete.cjs +13 -0
- package/pg-core/query-builders/delete.cjs.map +1 -1
- package/pg-core/query-builders/delete.d.cts +13 -10
- package/pg-core/query-builders/delete.d.ts +13 -10
- package/pg-core/query-builders/delete.js +14 -1
- package/pg-core/query-builders/delete.js.map +1 -1
- package/pg-core/query-builders/insert.cjs +13 -0
- package/pg-core/query-builders/insert.cjs.map +1 -1
- package/pg-core/query-builders/insert.d.cts +10 -8
- package/pg-core/query-builders/insert.d.ts +10 -8
- package/pg-core/query-builders/insert.js +14 -1
- package/pg-core/query-builders/insert.js.map +1 -1
- package/pg-core/query-builders/query-builder.cjs +15 -11
- package/pg-core/query-builders/query-builder.cjs.map +1 -1
- package/pg-core/query-builders/query-builder.d.cts +3 -6
- package/pg-core/query-builders/query-builder.d.ts +3 -6
- package/pg-core/query-builders/query-builder.js +15 -11
- package/pg-core/query-builders/query-builder.js.map +1 -1
- package/pg-core/query-builders/query.cjs +18 -15
- 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 +18 -15
- package/pg-core/query-builders/query.js.map +1 -1
- package/pg-core/query-builders/select.cjs +8 -7
- package/pg-core/query-builders/select.cjs.map +1 -1
- package/pg-core/query-builders/select.d.cts +3 -3
- package/pg-core/query-builders/select.d.ts +3 -3
- package/pg-core/query-builders/select.js +8 -7
- package/pg-core/query-builders/select.js.map +1 -1
- package/pg-core/query-builders/select.types.cjs.map +1 -1
- package/pg-core/query-builders/select.types.d.cts +3 -2
- package/pg-core/query-builders/select.types.d.ts +3 -2
- package/pg-core/query-builders/update.cjs +15 -2
- package/pg-core/query-builders/update.cjs.map +1 -1
- package/pg-core/query-builders/update.d.cts +18 -13
- package/pg-core/query-builders/update.d.ts +18 -13
- package/pg-core/query-builders/update.js +16 -3
- package/pg-core/query-builders/update.js.map +1 -1
- package/pg-core/session.cjs +2 -3
- package/pg-core/session.cjs.map +1 -1
- package/pg-core/session.d.cts +6 -9
- package/pg-core/session.d.ts +6 -9
- package/pg-core/session.js +2 -3
- package/pg-core/session.js.map +1 -1
- package/pg-core/subquery.cjs.map +1 -1
- package/pg-core/subquery.d.cts +15 -2
- package/pg-core/subquery.d.ts +15 -2
- package/pg-proxy/driver.cjs +5 -21
- package/pg-proxy/driver.cjs.map +1 -1
- package/pg-proxy/driver.d.cts +2 -3
- package/pg-proxy/driver.d.ts +2 -3
- package/pg-proxy/driver.js +8 -11
- package/pg-proxy/driver.js.map +1 -1
- package/pg-proxy/migrator.cjs.map +1 -1
- package/pg-proxy/migrator.d.cts +1 -2
- package/pg-proxy/migrator.d.ts +1 -2
- package/pg-proxy/migrator.js.map +1 -1
- package/pg-proxy/session.cjs +2 -37
- package/pg-proxy/session.cjs.map +1 -1
- package/pg-proxy/session.d.cts +8 -13
- package/pg-proxy/session.d.ts +8 -13
- package/pg-proxy/session.js +2 -37
- package/pg-proxy/session.js.map +1 -1
- package/pglite/driver.cjs +7 -23
- package/pglite/driver.cjs.map +1 -1
- package/pglite/driver.d.cts +8 -9
- package/pglite/driver.d.ts +8 -9
- package/pglite/driver.js +10 -13
- package/pglite/driver.js.map +1 -1
- package/pglite/migrator.cjs.map +1 -1
- package/pglite/migrator.d.cts +1 -2
- package/pglite/migrator.d.ts +1 -2
- package/pglite/migrator.js.map +1 -1
- package/pglite/session.cjs +3 -34
- package/pglite/session.cjs.map +1 -1
- package/pglite/session.d.cts +8 -13
- package/pglite/session.d.ts +8 -13
- package/pglite/session.js +3 -34
- package/pglite/session.js.map +1 -1
- package/planetscale-serverless/driver.cjs +5 -22
- package/planetscale-serverless/driver.cjs.map +1 -1
- package/planetscale-serverless/driver.d.cts +6 -7
- package/planetscale-serverless/driver.d.ts +6 -7
- package/planetscale-serverless/driver.js +8 -12
- package/planetscale-serverless/driver.js.map +1 -1
- package/planetscale-serverless/migrator.cjs.map +1 -1
- package/planetscale-serverless/migrator.d.cts +1 -2
- package/planetscale-serverless/migrator.d.ts +1 -2
- package/planetscale-serverless/migrator.js.map +1 -1
- package/planetscale-serverless/session.cjs +5 -45
- package/planetscale-serverless/session.cjs.map +1 -1
- package/planetscale-serverless/session.d.cts +9 -14
- package/planetscale-serverless/session.d.ts +9 -14
- package/planetscale-serverless/session.js +5 -45
- package/planetscale-serverless/session.js.map +1 -1
- package/postgres-js/driver.cjs +5 -6
- package/postgres-js/driver.cjs.map +1 -1
- package/postgres-js/driver.d.cts +6 -7
- package/postgres-js/driver.d.ts +6 -7
- package/postgres-js/driver.js +8 -6
- package/postgres-js/driver.js.map +1 -1
- package/postgres-js/migrator.cjs.map +1 -1
- package/postgres-js/migrator.d.cts +1 -2
- package/postgres-js/migrator.d.ts +1 -2
- package/postgres-js/migrator.js.map +1 -1
- package/postgres-js/session.cjs +6 -51
- package/postgres-js/session.cjs.map +1 -1
- package/postgres-js/session.d.cts +9 -15
- package/postgres-js/session.d.ts +9 -15
- package/postgres-js/session.js +6 -51
- 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 +0 -3
- package/prisma/mysql/session.cjs.map +1 -1
- package/prisma/mysql/session.d.cts +1 -3
- package/prisma/mysql/session.d.ts +1 -3
- package/prisma/mysql/session.js +0 -3
- 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 +0 -3
- package/prisma/pg/session.cjs.map +1 -1
- package/prisma/pg/session.d.cts +1 -3
- package/prisma/pg/session.d.ts +1 -3
- package/prisma/pg/session.js +0 -3
- 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 +0 -3
- package/prisma/sqlite/session.cjs.map +1 -1
- package/prisma/sqlite/session.d.cts +2 -4
- package/prisma/sqlite/session.d.ts +2 -4
- package/prisma/sqlite/session.js +0 -3
- package/prisma/sqlite/session.js.map +1 -1
- package/query-builders/select.types.cjs.map +1 -1
- package/query-builders/select.types.d.cts +1 -1
- package/query-builders/select.types.d.ts +1 -1
- package/relations.cjs +245 -595
- package/relations.cjs.map +1 -1
- package/relations.d.cts +131 -276
- package/relations.d.ts +131 -276
- package/relations.js +239 -589
- package/relations.js.map +1 -1
- package/singlestore/driver.cjs +1 -1
- package/singlestore/driver.cjs.map +1 -1
- package/singlestore/driver.d.cts +1 -1
- package/singlestore/driver.d.ts +1 -1
- package/singlestore/driver.js +3 -3
- package/singlestore/driver.js.map +1 -1
- package/singlestore/session.cjs.map +1 -1
- package/singlestore/session.d.cts +4 -4
- package/singlestore/session.d.ts +4 -4
- package/singlestore/session.js.map +1 -1
- package/singlestore-core/db.cjs +17 -11
- package/singlestore-core/db.cjs.map +1 -1
- package/singlestore-core/db.d.cts +7 -10
- package/singlestore-core/db.d.ts +7 -10
- package/singlestore-core/db.js +17 -11
- package/singlestore-core/db.js.map +1 -1
- package/singlestore-core/dialect.cjs +6 -16
- package/singlestore-core/dialect.cjs.map +1 -1
- package/singlestore-core/dialect.d.cts +6 -6
- package/singlestore-core/dialect.d.ts +6 -6
- package/singlestore-core/dialect.js +12 -6
- package/singlestore-core/dialect.js.map +1 -1
- package/singlestore-core/query-builders/query-builder.cjs +15 -11
- package/singlestore-core/query-builders/query-builder.cjs.map +1 -1
- package/singlestore-core/query-builders/query-builder.d.cts +2 -6
- package/singlestore-core/query-builders/query-builder.d.ts +2 -6
- package/singlestore-core/query-builders/query-builder.js +15 -11
- package/singlestore-core/query-builders/query-builder.js.map +1 -1
- package/singlestore-core/query-builders/query.cjs +2 -12
- package/singlestore-core/query-builders/query.cjs.map +1 -1
- package/singlestore-core/query-builders/query.d.cts +6 -6
- package/singlestore-core/query-builders/query.d.ts +6 -6
- package/singlestore-core/query-builders/query.js +4 -2
- package/singlestore-core/query-builders/query.js.map +1 -1
- package/singlestore-core/session.cjs.map +1 -1
- package/singlestore-core/session.d.cts +5 -5
- package/singlestore-core/session.d.ts +5 -5
- package/singlestore-core/session.js.map +1 -1
- package/singlestore-core/subquery.cjs.map +1 -1
- package/singlestore-core/subquery.d.cts +15 -2
- package/singlestore-core/subquery.d.ts +15 -2
- package/singlestore-core/table.cjs.map +1 -1
- package/singlestore-core/table.d.cts +12 -12
- package/singlestore-core/table.d.ts +12 -12
- package/singlestore-core/table.js.map +1 -1
- package/singlestore-proxy/driver.cjs +1 -1
- package/singlestore-proxy/driver.cjs.map +1 -1
- package/singlestore-proxy/driver.js +3 -3
- package/singlestore-proxy/driver.js.map +1 -1
- package/singlestore-proxy/session.cjs.map +1 -1
- package/singlestore-proxy/session.d.cts +4 -4
- package/singlestore-proxy/session.d.ts +4 -4
- package/singlestore-proxy/session.js.map +1 -1
- package/sql/sql.cjs +6 -1
- package/sql/sql.cjs.map +1 -1
- package/sql/sql.d.cts +9 -8
- package/sql/sql.d.ts +9 -8
- package/sql/sql.js +5 -1
- package/sql/sql.js.map +1 -1
- package/sql-js/driver.cjs +5 -16
- package/sql-js/driver.cjs.map +1 -1
- package/sql-js/driver.d.cts +2 -3
- package/sql-js/driver.d.ts +2 -3
- package/sql-js/driver.js +8 -6
- package/sql-js/driver.js.map +1 -1
- package/sql-js/migrator.cjs.map +1 -1
- package/sql-js/migrator.d.cts +1 -2
- package/sql-js/migrator.d.ts +1 -2
- package/sql-js/migrator.js.map +1 -1
- package/sql-js/session.cjs +4 -76
- package/sql-js/session.cjs.map +1 -1
- package/sql-js/session.d.cts +8 -15
- package/sql-js/session.d.ts +8 -15
- package/sql-js/session.js +4 -76
- package/sql-js/session.js.map +1 -1
- package/sqlite-core/db.cjs +31 -49
- package/sqlite-core/db.cjs.map +1 -1
- package/sqlite-core/db.d.cts +12 -23
- package/sqlite-core/db.d.ts +12 -23
- package/sqlite-core/db.js +30 -48
- package/sqlite-core/db.js.map +1 -1
- package/sqlite-core/dialect.cjs +7 -183
- package/sqlite-core/dialect.cjs.map +1 -1
- package/sqlite-core/dialect.d.cts +9 -28
- package/sqlite-core/dialect.d.ts +9 -28
- package/sqlite-core/dialect.js +13 -180
- package/sqlite-core/dialect.js.map +1 -1
- 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-builder.cjs +15 -11
- package/sqlite-core/query-builders/query-builder.cjs.map +1 -1
- package/sqlite-core/query-builders/query-builder.d.cts +2 -6
- package/sqlite-core/query-builders/query-builder.d.ts +2 -6
- package/sqlite-core/query-builders/query-builder.js +15 -11
- package/sqlite-core/query-builders/query-builder.js.map +1 -1
- package/sqlite-core/query-builders/query.cjs +32 -53
- package/sqlite-core/query-builders/query.cjs.map +1 -1
- package/sqlite-core/query-builders/query.d.cts +17 -18
- package/sqlite-core/query-builders/query.d.ts +17 -18
- package/sqlite-core/query-builders/query.js +32 -53
- 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 +2 -6
- package/sqlite-core/session.cjs.map +1 -1
- package/sqlite-core/session.d.cts +7 -15
- package/sqlite-core/session.d.ts +7 -15
- package/sqlite-core/session.js +2 -6
- package/sqlite-core/session.js.map +1 -1
- package/sqlite-core/subquery.cjs.map +1 -1
- package/sqlite-core/subquery.d.cts +15 -2
- package/sqlite-core/subquery.d.ts +15 -2
- package/sqlite-proxy/driver.cjs +5 -23
- package/sqlite-proxy/driver.cjs.map +1 -1
- package/sqlite-proxy/driver.d.cts +3 -4
- package/sqlite-proxy/driver.d.ts +3 -4
- package/sqlite-proxy/driver.js +5 -13
- package/sqlite-proxy/driver.js.map +1 -1
- package/sqlite-proxy/migrator.cjs.map +1 -1
- package/sqlite-proxy/migrator.d.cts +1 -2
- package/sqlite-proxy/migrator.d.ts +1 -2
- package/sqlite-proxy/migrator.js.map +1 -1
- package/sqlite-proxy/session.cjs +6 -50
- package/sqlite-proxy/session.cjs.map +1 -1
- package/sqlite-proxy/session.d.cts +8 -14
- package/sqlite-proxy/session.d.ts +8 -14
- package/sqlite-proxy/session.js +6 -50
- package/sqlite-proxy/session.js.map +1 -1
- package/subquery.cjs.map +1 -1
- package/subquery.d.cts +1 -0
- package/subquery.d.ts +1 -0
- package/subquery.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 +5 -22
- package/tidb-serverless/driver.cjs.map +1 -1
- package/tidb-serverless/driver.d.cts +6 -7
- package/tidb-serverless/driver.d.ts +6 -7
- package/tidb-serverless/driver.js +8 -12
- package/tidb-serverless/driver.js.map +1 -1
- package/tidb-serverless/migrator.cjs.map +1 -1
- package/tidb-serverless/migrator.d.cts +1 -2
- package/tidb-serverless/migrator.d.ts +1 -2
- package/tidb-serverless/migrator.js.map +1 -1
- package/tidb-serverless/session.cjs +5 -62
- package/tidb-serverless/session.cjs.map +1 -1
- package/tidb-serverless/session.d.cts +9 -14
- package/tidb-serverless/session.d.ts +9 -14
- package/tidb-serverless/session.js +5 -62
- package/tidb-serverless/session.js.map +1 -1
- package/utils.cjs +2 -2
- package/utils.cjs.map +1 -1
- package/utils.d.cts +1 -3
- package/utils.d.ts +1 -3
- package/utils.js +2 -2
- package/utils.js.map +1 -1
- package/vercel-postgres/driver.cjs +7 -23
- package/vercel-postgres/driver.cjs.map +1 -1
- package/vercel-postgres/driver.d.cts +8 -9
- package/vercel-postgres/driver.d.ts +8 -9
- package/vercel-postgres/driver.js +10 -13
- package/vercel-postgres/driver.js.map +1 -1
- package/vercel-postgres/migrator.cjs.map +1 -1
- package/vercel-postgres/migrator.d.cts +1 -2
- package/vercel-postgres/migrator.d.ts +1 -2
- package/vercel-postgres/migrator.js.map +1 -1
- package/vercel-postgres/session.cjs +8 -34
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.d.cts +10 -14
- package/vercel-postgres/session.d.ts +10 -14
- package/vercel-postgres/session.js +8 -34
- 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 +5 -17
- package/xata-http/driver.cjs.map +1 -1
- package/xata-http/driver.d.cts +4 -5
- package/xata-http/driver.d.ts +4 -5
- package/xata-http/driver.js +5 -7
- package/xata-http/driver.js.map +1 -1
- package/xata-http/migrator.cjs.map +1 -1
- package/xata-http/migrator.d.cts +1 -2
- package/xata-http/migrator.d.ts +1 -2
- package/xata-http/migrator.js.map +1 -1
- package/xata-http/session.cjs +2 -30
- package/xata-http/session.cjs.map +1 -1
- package/xata-http/session.d.cts +8 -13
- package/xata-http/session.d.ts +8 -13
- package/xata-http/session.js +2 -30
- package/xata-http/session.js.map +1 -1
- package/_relations.cjs +0 -328
- package/_relations.cjs.map +0 -1
- package/_relations.d.cts +0 -215
- package/_relations.d.ts +0 -215
- package/_relations.js +0 -316
- package/_relations.js.map +0 -1
- package/mysql-core/query-builders/_query.cjs +0 -149
- package/mysql-core/query-builders/_query.cjs.map +0 -1
- package/mysql-core/query-builders/_query.d.cts +0 -44
- package/mysql-core/query-builders/_query.d.ts +0 -44
- package/mysql-core/query-builders/_query.js +0 -114
- package/mysql-core/query-builders/_query.js.map +0 -1
- package/pg-core/query-builders/_query.cjs +0 -155
- package/pg-core/query-builders/_query.cjs.map +0 -1
- package/pg-core/query-builders/_query.d.cts +0 -47
- package/pg-core/query-builders/_query.d.ts +0 -47
- package/pg-core/query-builders/_query.js +0 -120
- package/pg-core/query-builders/_query.js.map +0 -1
- package/sqlite-core/query-builders/_query.cjs +0 -187
- package/sqlite-core/query-builders/_query.cjs.map +0 -1
- package/sqlite-core/query-builders/_query.d.cts +0 -55
- package/sqlite-core/query-builders/_query.d.ts +0 -55
- package/sqlite-core/query-builders/_query.js +0 -151
- package/sqlite-core/query-builders/_query.js.map +0 -1
package/mysql2/session.d.cts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import type { Connection, FieldPacket, OkPacket, Pool, ResultSetHeader, RowDataPacket } from 'mysql2/promise';
|
|
2
|
-
import type * as V1 from "../_relations.cjs";
|
|
3
2
|
import { entityKind } from "../entity.cjs";
|
|
4
3
|
import type { Logger } from "../logger.cjs";
|
|
5
4
|
import type { MySqlDialect } from "../mysql-core/dialect.cjs";
|
|
6
5
|
import type { SelectedFieldsOrdered } from "../mysql-core/query-builders/select.types.cjs";
|
|
7
6
|
import { type Mode, MySqlPreparedQuery, type MySqlPreparedQueryConfig, type MySqlPreparedQueryHKT, type MySqlQueryResultHKT, MySqlSession, MySqlTransaction, type MySqlTransactionConfig, type PreparedQueryKind } from "../mysql-core/session.cjs";
|
|
8
|
-
import type {
|
|
7
|
+
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.cjs";
|
|
9
8
|
import type { Query, SQL } from "../sql/sql.cjs";
|
|
10
9
|
import { type Assume } from "../utils.cjs";
|
|
11
10
|
export type MySql2Client = Pool | Connection;
|
|
12
11
|
export type MySqlRawQueryResult = [ResultSetHeader, FieldPacket[]];
|
|
13
12
|
export type MySqlQueryResultType = RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader;
|
|
14
13
|
export type MySqlQueryResult<T = any> = [T extends ResultSetHeader ? T : T[], FieldPacket[]];
|
|
15
|
-
export declare class MySql2PreparedQuery<T extends MySqlPreparedQueryConfig
|
|
14
|
+
export declare class MySql2PreparedQuery<T extends MySqlPreparedQueryConfig> extends MySqlPreparedQuery<T> {
|
|
16
15
|
private client;
|
|
17
16
|
private params;
|
|
18
17
|
private logger;
|
|
@@ -20,36 +19,32 @@ export declare class MySql2PreparedQuery<T extends MySqlPreparedQueryConfig, TIs
|
|
|
20
19
|
private customResultMapper?;
|
|
21
20
|
private generatedIds?;
|
|
22
21
|
private returningIds?;
|
|
23
|
-
private isRqbV2Query?;
|
|
24
22
|
static readonly [entityKind]: string;
|
|
25
23
|
private rawQuery;
|
|
26
24
|
private query;
|
|
27
|
-
constructor(client: MySql2Client, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, customResultMapper?: ((rows:
|
|
25
|
+
constructor(client: MySql2Client, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, customResultMapper?: ((rows: unknown[][]) => T["execute"]) | undefined, generatedIds?: Record<string, unknown>[] | undefined, returningIds?: SelectedFieldsOrdered | undefined);
|
|
28
26
|
execute(placeholderValues?: Record<string, unknown>): Promise<T['execute']>;
|
|
29
|
-
private executeRqbV2;
|
|
30
27
|
iterator(placeholderValues?: Record<string, unknown>): AsyncGenerator<T['execute'] extends any[] ? T['execute'][number] : T['execute']>;
|
|
31
28
|
}
|
|
32
29
|
export interface MySql2SessionOptions {
|
|
33
30
|
logger?: Logger;
|
|
34
31
|
mode: Mode;
|
|
35
32
|
}
|
|
36
|
-
export declare class MySql2Session<TFullSchema extends Record<string, unknown>,
|
|
33
|
+
export declare class MySql2Session<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MySqlSession<MySqlQueryResultHKT, MySql2PreparedQueryHKT, TFullSchema, TSchema> {
|
|
37
34
|
private client;
|
|
38
|
-
private relations;
|
|
39
35
|
private schema;
|
|
40
36
|
private options;
|
|
41
37
|
static readonly [entityKind]: string;
|
|
42
38
|
private logger;
|
|
43
39
|
private mode;
|
|
44
|
-
constructor(client: MySql2Client, dialect: MySqlDialect,
|
|
40
|
+
constructor(client: MySql2Client, dialect: MySqlDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options: MySql2SessionOptions);
|
|
45
41
|
prepareQuery<T extends MySqlPreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, customResultMapper?: (rows: unknown[][]) => T['execute'], generatedIds?: Record<string, unknown>[], returningIds?: SelectedFieldsOrdered): PreparedQueryKind<MySql2PreparedQueryHKT, T>;
|
|
46
|
-
prepareRelationalQuery<T extends MySqlPreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, customResultMapper: (rows: Record<string, unknown>[]) => T['execute'], generatedIds?: Record<string, unknown>[], returningIds?: SelectedFieldsOrdered): PreparedQueryKind<MySql2PreparedQueryHKT, T>;
|
|
47
42
|
all<T = unknown>(query: SQL): Promise<T[]>;
|
|
48
|
-
transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema,
|
|
43
|
+
transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema, TSchema>) => Promise<T>, config?: MySqlTransactionConfig): Promise<T>;
|
|
49
44
|
}
|
|
50
|
-
export declare class MySql2Transaction<TFullSchema extends Record<string, unknown>,
|
|
45
|
+
export declare class MySql2Transaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MySqlTransaction<MySql2QueryResultHKT, MySql2PreparedQueryHKT, TFullSchema, TSchema> {
|
|
51
46
|
static readonly [entityKind]: string;
|
|
52
|
-
transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema,
|
|
47
|
+
transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
53
48
|
}
|
|
54
49
|
export interface MySql2QueryResultHKT extends MySqlQueryResultHKT {
|
|
55
50
|
type: MySqlRawQueryResult;
|
package/mysql2/session.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import type { Connection, FieldPacket, OkPacket, Pool, ResultSetHeader, RowDataPacket } from 'mysql2/promise';
|
|
2
|
-
import type * as V1 from "../_relations.js";
|
|
3
2
|
import { entityKind } from "../entity.js";
|
|
4
3
|
import type { Logger } from "../logger.js";
|
|
5
4
|
import type { MySqlDialect } from "../mysql-core/dialect.js";
|
|
6
5
|
import type { SelectedFieldsOrdered } from "../mysql-core/query-builders/select.types.js";
|
|
7
6
|
import { type Mode, MySqlPreparedQuery, type MySqlPreparedQueryConfig, type MySqlPreparedQueryHKT, type MySqlQueryResultHKT, MySqlSession, MySqlTransaction, type MySqlTransactionConfig, type PreparedQueryKind } from "../mysql-core/session.js";
|
|
8
|
-
import type {
|
|
7
|
+
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.js";
|
|
9
8
|
import type { Query, SQL } from "../sql/sql.js";
|
|
10
9
|
import { type Assume } from "../utils.js";
|
|
11
10
|
export type MySql2Client = Pool | Connection;
|
|
12
11
|
export type MySqlRawQueryResult = [ResultSetHeader, FieldPacket[]];
|
|
13
12
|
export type MySqlQueryResultType = RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader;
|
|
14
13
|
export type MySqlQueryResult<T = any> = [T extends ResultSetHeader ? T : T[], FieldPacket[]];
|
|
15
|
-
export declare class MySql2PreparedQuery<T extends MySqlPreparedQueryConfig
|
|
14
|
+
export declare class MySql2PreparedQuery<T extends MySqlPreparedQueryConfig> extends MySqlPreparedQuery<T> {
|
|
16
15
|
private client;
|
|
17
16
|
private params;
|
|
18
17
|
private logger;
|
|
@@ -20,36 +19,32 @@ export declare class MySql2PreparedQuery<T extends MySqlPreparedQueryConfig, TIs
|
|
|
20
19
|
private customResultMapper?;
|
|
21
20
|
private generatedIds?;
|
|
22
21
|
private returningIds?;
|
|
23
|
-
private isRqbV2Query?;
|
|
24
22
|
static readonly [entityKind]: string;
|
|
25
23
|
private rawQuery;
|
|
26
24
|
private query;
|
|
27
|
-
constructor(client: MySql2Client, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, customResultMapper?: ((rows:
|
|
25
|
+
constructor(client: MySql2Client, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, customResultMapper?: ((rows: unknown[][]) => T["execute"]) | undefined, generatedIds?: Record<string, unknown>[] | undefined, returningIds?: SelectedFieldsOrdered | undefined);
|
|
28
26
|
execute(placeholderValues?: Record<string, unknown>): Promise<T['execute']>;
|
|
29
|
-
private executeRqbV2;
|
|
30
27
|
iterator(placeholderValues?: Record<string, unknown>): AsyncGenerator<T['execute'] extends any[] ? T['execute'][number] : T['execute']>;
|
|
31
28
|
}
|
|
32
29
|
export interface MySql2SessionOptions {
|
|
33
30
|
logger?: Logger;
|
|
34
31
|
mode: Mode;
|
|
35
32
|
}
|
|
36
|
-
export declare class MySql2Session<TFullSchema extends Record<string, unknown>,
|
|
33
|
+
export declare class MySql2Session<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MySqlSession<MySqlQueryResultHKT, MySql2PreparedQueryHKT, TFullSchema, TSchema> {
|
|
37
34
|
private client;
|
|
38
|
-
private relations;
|
|
39
35
|
private schema;
|
|
40
36
|
private options;
|
|
41
37
|
static readonly [entityKind]: string;
|
|
42
38
|
private logger;
|
|
43
39
|
private mode;
|
|
44
|
-
constructor(client: MySql2Client, dialect: MySqlDialect,
|
|
40
|
+
constructor(client: MySql2Client, dialect: MySqlDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options: MySql2SessionOptions);
|
|
45
41
|
prepareQuery<T extends MySqlPreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, customResultMapper?: (rows: unknown[][]) => T['execute'], generatedIds?: Record<string, unknown>[], returningIds?: SelectedFieldsOrdered): PreparedQueryKind<MySql2PreparedQueryHKT, T>;
|
|
46
|
-
prepareRelationalQuery<T extends MySqlPreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, customResultMapper: (rows: Record<string, unknown>[]) => T['execute'], generatedIds?: Record<string, unknown>[], returningIds?: SelectedFieldsOrdered): PreparedQueryKind<MySql2PreparedQueryHKT, T>;
|
|
47
42
|
all<T = unknown>(query: SQL): Promise<T[]>;
|
|
48
|
-
transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema,
|
|
43
|
+
transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema, TSchema>) => Promise<T>, config?: MySqlTransactionConfig): Promise<T>;
|
|
49
44
|
}
|
|
50
|
-
export declare class MySql2Transaction<TFullSchema extends Record<string, unknown>,
|
|
45
|
+
export declare class MySql2Transaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MySqlTransaction<MySql2QueryResultHKT, MySql2PreparedQueryHKT, TFullSchema, TSchema> {
|
|
51
46
|
static readonly [entityKind]: string;
|
|
52
|
-
transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema,
|
|
47
|
+
transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
53
48
|
}
|
|
54
49
|
export interface MySql2QueryResultHKT extends MySqlQueryResultHKT {
|
|
55
50
|
type: MySqlRawQueryResult;
|
package/mysql2/session.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { fillPlaceholders, sql } from "../sql/sql.js";
|
|
11
11
|
import { mapResultRow } from "../utils.js";
|
|
12
12
|
class MySql2PreparedQuery extends MySqlPreparedQuery {
|
|
13
|
-
constructor(client, queryString, params, logger, fields, customResultMapper, generatedIds, returningIds
|
|
13
|
+
constructor(client, queryString, params, logger, fields, customResultMapper, generatedIds, returningIds) {
|
|
14
14
|
super();
|
|
15
15
|
this.client = client;
|
|
16
16
|
this.params = params;
|
|
@@ -19,7 +19,6 @@ class MySql2PreparedQuery extends MySqlPreparedQuery {
|
|
|
19
19
|
this.customResultMapper = customResultMapper;
|
|
20
20
|
this.generatedIds = generatedIds;
|
|
21
21
|
this.returningIds = returningIds;
|
|
22
|
-
this.isRqbV2Query = isRqbV2Query;
|
|
23
22
|
this.rawQuery = {
|
|
24
23
|
sql: queryString,
|
|
25
24
|
// rowsAsArray: true,
|
|
@@ -45,8 +44,6 @@ class MySql2PreparedQuery extends MySqlPreparedQuery {
|
|
|
45
44
|
rawQuery;
|
|
46
45
|
query;
|
|
47
46
|
async execute(placeholderValues = {}) {
|
|
48
|
-
if (this.isRqbV2Query)
|
|
49
|
-
return this.executeRqbV2(placeholderValues);
|
|
50
47
|
const params = fillPlaceholders(this.params, placeholderValues);
|
|
51
48
|
this.logger.logQuery(this.rawQuery.sql, params);
|
|
52
49
|
const { fields, client, rawQuery, query, joinsNotNullableMap, customResultMapper, returningIds, generatedIds } = this;
|
|
@@ -82,14 +79,6 @@ class MySql2PreparedQuery extends MySqlPreparedQuery {
|
|
|
82
79
|
}
|
|
83
80
|
return rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
|
|
84
81
|
}
|
|
85
|
-
async executeRqbV2(placeholderValues = {}) {
|
|
86
|
-
const params = fillPlaceholders(this.params, placeholderValues);
|
|
87
|
-
this.logger.logQuery(this.rawQuery.sql, params);
|
|
88
|
-
const { client, rawQuery, customResultMapper } = this;
|
|
89
|
-
const res = await client.query(rawQuery, params);
|
|
90
|
-
const rows = res[0];
|
|
91
|
-
return customResultMapper(rows);
|
|
92
|
-
}
|
|
93
82
|
async *iterator(placeholderValues = {}) {
|
|
94
83
|
const params = fillPlaceholders(this.params, placeholderValues);
|
|
95
84
|
const conn = (isPool(this.client) ? await this.client.getConnection() : this.client).connection;
|
|
@@ -133,10 +122,9 @@ class MySql2PreparedQuery extends MySqlPreparedQuery {
|
|
|
133
122
|
}
|
|
134
123
|
}
|
|
135
124
|
class MySql2Session extends MySqlSession {
|
|
136
|
-
constructor(client, dialect,
|
|
125
|
+
constructor(client, dialect, schema, options) {
|
|
137
126
|
super(dialect);
|
|
138
127
|
this.client = client;
|
|
139
|
-
this.relations = relations;
|
|
140
128
|
this.schema = schema;
|
|
141
129
|
this.options = options;
|
|
142
130
|
this.logger = options.logger ?? new NoopLogger();
|
|
@@ -157,19 +145,6 @@ class MySql2Session extends MySqlSession {
|
|
|
157
145
|
returningIds
|
|
158
146
|
);
|
|
159
147
|
}
|
|
160
|
-
prepareRelationalQuery(query, fields, customResultMapper, generatedIds, returningIds) {
|
|
161
|
-
return new MySql2PreparedQuery(
|
|
162
|
-
this.client,
|
|
163
|
-
query.sql,
|
|
164
|
-
query.params,
|
|
165
|
-
this.logger,
|
|
166
|
-
fields,
|
|
167
|
-
customResultMapper,
|
|
168
|
-
generatedIds,
|
|
169
|
-
returningIds,
|
|
170
|
-
true
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
148
|
/**
|
|
174
149
|
* @internal
|
|
175
150
|
* What is its purpose?
|
|
@@ -198,14 +173,12 @@ class MySql2Session extends MySqlSession {
|
|
|
198
173
|
const session = isPool(this.client) ? new MySql2Session(
|
|
199
174
|
await this.client.getConnection(),
|
|
200
175
|
this.dialect,
|
|
201
|
-
this.relations,
|
|
202
176
|
this.schema,
|
|
203
177
|
this.options
|
|
204
178
|
) : this;
|
|
205
179
|
const tx = new MySql2Transaction(
|
|
206
180
|
this.dialect,
|
|
207
181
|
session,
|
|
208
|
-
this.relations,
|
|
209
182
|
this.schema,
|
|
210
183
|
0,
|
|
211
184
|
this.mode
|
|
@@ -241,7 +214,6 @@ class MySql2Transaction extends MySqlTransaction {
|
|
|
241
214
|
const tx = new MySql2Transaction(
|
|
242
215
|
this.dialect,
|
|
243
216
|
this.session,
|
|
244
|
-
this.relations,
|
|
245
217
|
this.schema,
|
|
246
218
|
this.nestedIndex + 1,
|
|
247
219
|
this.mode
|
package/mysql2/session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mysql2/session.ts"],"sourcesContent":["import type { Connection as CallbackConnection } from 'mysql2';\nimport type {\n\tConnection,\n\tFieldPacket,\n\tOkPacket,\n\tPool,\n\tPoolConnection,\n\tQueryOptions,\n\tResultSetHeader,\n\tRowDataPacket,\n} from 'mysql2/promise';\nimport { once } from 'node:events';\nimport type * as V1 from '~/_relations.ts';\nimport { Column } from '~/column.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { NoopLogger } from '~/logger.ts';\nimport type { MySqlDialect } from '~/mysql-core/dialect.ts';\nimport type { SelectedFieldsOrdered } from '~/mysql-core/query-builders/select.types.ts';\nimport {\n\ttype Mode,\n\tMySqlPreparedQuery,\n\ttype MySqlPreparedQueryConfig,\n\ttype MySqlPreparedQueryHKT,\n\ttype MySqlQueryResultHKT,\n\tMySqlSession,\n\tMySqlTransaction,\n\ttype MySqlTransactionConfig,\n\ttype PreparedQueryKind,\n} from '~/mysql-core/session.ts';\nimport type { AnyRelations, TablesRelationalConfig } from '~/relations.ts';\nimport { fillPlaceholders, sql } from '~/sql/sql.ts';\nimport type { Query, SQL } from '~/sql/sql.ts';\nimport { type Assume, mapResultRow } from '~/utils.ts';\n\nexport type MySql2Client = Pool | Connection;\n\nexport type MySqlRawQueryResult = [ResultSetHeader, FieldPacket[]];\nexport type MySqlQueryResultType = RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader;\nexport type MySqlQueryResult<\n\tT = any,\n> = [T extends ResultSetHeader ? T : T[], FieldPacket[]];\n\nexport class MySql2PreparedQuery<T extends MySqlPreparedQueryConfig, TIsRqbV2 extends boolean = false>\n\textends MySqlPreparedQuery<T>\n{\n\tstatic override readonly [entityKind]: string = 'MySql2PreparedQuery';\n\n\tprivate rawQuery: QueryOptions;\n\tprivate query: QueryOptions;\n\n\tconstructor(\n\t\tprivate client: MySql2Client,\n\t\tqueryString: string,\n\t\tprivate params: unknown[],\n\t\tprivate logger: Logger,\n\t\tprivate fields: SelectedFieldsOrdered | undefined,\n\t\tprivate customResultMapper?: (\n\t\t\trows: TIsRqbV2 extends true ? Record<string, unknown>[] : unknown[][],\n\t\t) => T['execute'],\n\t\t// Keys that were used in $default and the value that was generated for them\n\t\tprivate generatedIds?: Record<string, unknown>[],\n\t\t// Keys that should be returned, it has the column with all properries + key from object\n\t\tprivate returningIds?: SelectedFieldsOrdered,\n\t\tprivate isRqbV2Query?: TIsRqbV2,\n\t) {\n\t\tsuper();\n\t\tthis.rawQuery = {\n\t\t\tsql: queryString,\n\t\t\t// rowsAsArray: true,\n\t\t\ttypeCast: function(field: any, next: any) {\n\t\t\t\tif (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {\n\t\t\t\t\treturn field.string();\n\t\t\t\t}\n\t\t\t\treturn next();\n\t\t\t},\n\t\t};\n\t\tthis.query = {\n\t\t\tsql: queryString,\n\t\t\trowsAsArray: true,\n\t\t\ttypeCast: function(field: any, next: any) {\n\t\t\t\tif (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {\n\t\t\t\t\treturn field.string();\n\t\t\t\t}\n\t\t\t\treturn next();\n\t\t\t},\n\t\t};\n\t}\n\n\tasync execute(placeholderValues: Record<string, unknown> = {}): 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.rawQuery.sql, params);\n\n\t\tconst { fields, client, rawQuery, query, joinsNotNullableMap, customResultMapper, returningIds, generatedIds } =\n\t\t\tthis;\n\t\tif (!fields && !customResultMapper) {\n\t\t\tconst res = await client.query<any>(rawQuery, params);\n\t\t\tconst insertId = res[0].insertId;\n\t\t\tconst affectedRows = res[0].affectedRows;\n\t\t\t// for each row, I need to check keys from\n\t\t\tif (returningIds) {\n\t\t\t\tconst returningResponse = [];\n\t\t\t\tlet j = 0;\n\t\t\t\tfor (let i = insertId; i < insertId + affectedRows; i++) {\n\t\t\t\t\tfor (const column of returningIds) {\n\t\t\t\t\t\tconst key = returningIds[0]!.path[0]!;\n\t\t\t\t\t\tif (is(column.field, Column)) {\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\tif (column.field.primary && column.field.autoIncrement) {\n\t\t\t\t\t\t\t\treturningResponse.push({ [key]: i });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (column.field.defaultFn && generatedIds) {\n\t\t\t\t\t\t\t\t// generatedIds[rowIdx][key]\n\t\t\t\t\t\t\t\treturningResponse.push({ [key]: generatedIds[j]![key] });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tj++;\n\t\t\t\t}\n\n\t\t\t\treturn returningResponse;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tconst result = await client.query<any[]>(query, params);\n\t\tconst rows = result[0];\n\n\t\tif (customResultMapper) {\n\t\t\treturn customResultMapper(rows);\n\t\t}\n\n\t\treturn rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));\n\t}\n\n\tprivate async executeRqbV2(placeholderValues: Record<string, unknown> = {}): Promise<T['execute']> {\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\n\t\tthis.logger.logQuery(this.rawQuery.sql, params);\n\n\t\tconst { client, rawQuery, customResultMapper } = this;\n\t\tconst res = await client.query<any>(rawQuery, params);\n\n\t\tconst rows = res[0];\n\n\t\treturn (customResultMapper as (rows: Record<string, unknown>[]) => T['execute'])(rows);\n\t}\n\n\tasync *iterator(\n\t\tplaceholderValues: Record<string, unknown> = {},\n\t): AsyncGenerator<T['execute'] extends any[] ? T['execute'][number] : T['execute']> {\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\t\tconst conn = ((isPool(this.client) ? await this.client.getConnection() : this.client) as {} as {\n\t\t\tconnection: CallbackConnection;\n\t\t}).connection;\n\n\t\tconst { fields, query, rawQuery, joinsNotNullableMap, client, customResultMapper } = this;\n\t\tconst hasRowsMapper = Boolean(fields || customResultMapper);\n\t\tconst driverQuery = hasRowsMapper ? conn.query(query, params) : conn.query(rawQuery, params);\n\n\t\tconst stream = driverQuery.stream();\n\n\t\tfunction dataListener() {\n\t\t\tstream.pause();\n\t\t}\n\n\t\tstream.on('data', dataListener);\n\n\t\ttry {\n\t\t\tconst onEnd = once(stream, 'end');\n\t\t\tconst onError = once(stream, 'error');\n\n\t\t\twhile (true) {\n\t\t\t\tstream.resume();\n\t\t\t\tconst row = await Promise.race([onEnd, onError, new Promise((resolve) => stream.once('data', resolve))]);\n\t\t\t\tif (row === undefined || (Array.isArray(row) && row.length === 0)) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (row instanceof Error) { // eslint-disable-line no-instanceof/no-instanceof\n\t\t\t\t\tthrow row;\n\t\t\t\t} else {\n\t\t\t\t\tif (hasRowsMapper) {\n\t\t\t\t\t\tif (customResultMapper) {\n\t\t\t\t\t\t\tconst mappedRow = (customResultMapper as (rows: unknown[][]) => T['execute'])([row as unknown[]]);\n\t\t\t\t\t\t\tyield (Array.isArray(mappedRow) ? mappedRow[0] : mappedRow);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tyield mapResultRow(fields!, row as unknown[], joinsNotNullableMap);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tyield row as T['execute'];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tstream.off('data', dataListener);\n\t\t\tif (isPool(client)) {\n\t\t\t\tconn.end();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport interface MySql2SessionOptions {\n\tlogger?: Logger;\n\tmode: Mode;\n}\n\nexport class MySql2Session<\n\tTFullSchema extends Record<string, unknown>,\n\tTRelations extends AnyRelations,\n\tTTablesConfig extends TablesRelationalConfig,\n\tTSchema extends V1.TablesRelationalConfig,\n> extends MySqlSession<MySqlQueryResultHKT, MySql2PreparedQueryHKT, TFullSchema, TRelations, TTablesConfig, TSchema> {\n\tstatic override readonly [entityKind]: string = 'MySql2Session';\n\n\tprivate logger: Logger;\n\tprivate mode: Mode;\n\n\tconstructor(\n\t\tprivate client: MySql2Client,\n\t\tdialect: MySqlDialect,\n\t\tprivate relations: AnyRelations | undefined,\n\t\tprivate schema: V1.RelationalSchemaConfig<TSchema> | undefined,\n\t\tprivate options: MySql2SessionOptions,\n\t) {\n\t\tsuper(dialect);\n\t\tthis.logger = options.logger ?? new NoopLogger();\n\t\tthis.mode = options.mode;\n\t}\n\n\tprepareQuery<T extends MySqlPreparedQueryConfig>(\n\t\tquery: Query,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\tcustomResultMapper?: (rows: unknown[][]) => T['execute'],\n\t\tgeneratedIds?: Record<string, unknown>[],\n\t\treturningIds?: SelectedFieldsOrdered,\n\t): PreparedQueryKind<MySql2PreparedQueryHKT, T> {\n\t\t// Add returningId fields\n\t\t// Each driver gets them from response from database\n\t\treturn new MySql2PreparedQuery(\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\tcustomResultMapper,\n\t\t\tgeneratedIds,\n\t\t\treturningIds,\n\t\t) as PreparedQueryKind<MySql2PreparedQueryHKT, T>;\n\t}\n\n\tprepareRelationalQuery<T extends MySqlPreparedQueryConfig>(\n\t\tquery: Query,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\tcustomResultMapper: (rows: Record<string, unknown>[]) => T['execute'],\n\t\tgeneratedIds?: Record<string, unknown>[],\n\t\treturningIds?: SelectedFieldsOrdered,\n\t): PreparedQueryKind<MySql2PreparedQueryHKT, T> {\n\t\t// Add returningId fields\n\t\t// Each driver gets them from response from database\n\t\treturn new MySql2PreparedQuery(\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\tcustomResultMapper,\n\t\t\tgeneratedIds,\n\t\t\treturningIds,\n\t\t\ttrue,\n\t\t) as any;\n\t}\n\n\t/**\n\t * @internal\n\t * What is its purpose?\n\t */\n\tasync query(query: string, params: unknown[]): Promise<MySqlQueryResult> {\n\t\tthis.logger.logQuery(query, params);\n\t\tconst result = await this.client.query({\n\t\t\tsql: query,\n\t\t\tvalues: params,\n\t\t\trowsAsArray: true,\n\t\t\ttypeCast: function(field: any, next: any) {\n\t\t\t\tif (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {\n\t\t\t\t\treturn field.string();\n\t\t\t\t}\n\t\t\t\treturn next();\n\t\t\t},\n\t\t});\n\t\treturn result;\n\t}\n\n\toverride all<T = unknown>(query: SQL): Promise<T[]> {\n\t\tconst querySql = this.dialect.sqlToQuery(query);\n\t\tthis.logger.logQuery(querySql.sql, querySql.params);\n\t\treturn this.client.execute(querySql.sql, querySql.params).then((result) => result[0]) as Promise<T[]>;\n\t}\n\n\toverride async transaction<T>(\n\t\ttransaction: (tx: MySql2Transaction<TFullSchema, TRelations, TTablesConfig, TSchema>) => Promise<T>,\n\t\tconfig?: MySqlTransactionConfig,\n\t): Promise<T> {\n\t\tconst session = isPool(this.client)\n\t\t\t? new MySql2Session(\n\t\t\t\tawait this.client.getConnection(),\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\t: this;\n\t\tconst tx = new MySql2Transaction<TFullSchema, TRelations, TTablesConfig, TSchema>(\n\t\t\tthis.dialect,\n\t\t\tsession as MySqlSession<any, any, any, any, any, any>,\n\t\t\tthis.relations,\n\t\t\tthis.schema,\n\t\t\t0,\n\t\t\tthis.mode,\n\t\t);\n\t\tif (config) {\n\t\t\tconst setTransactionConfigSql = this.getSetTransactionSQL(config);\n\t\t\tif (setTransactionConfigSql) {\n\t\t\t\tawait tx.execute(setTransactionConfigSql);\n\t\t\t}\n\t\t\tconst startTransactionSql = this.getStartTransactionSQL(config);\n\t\t\tawait (startTransactionSql ? tx.execute(startTransactionSql) : tx.execute(sql`begin`));\n\t\t} else {\n\t\t\tawait tx.execute(sql`begin`);\n\t\t}\n\t\ttry {\n\t\t\tconst result = await transaction(tx);\n\t\t\tawait tx.execute(sql`commit`);\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tawait tx.execute(sql`rollback`);\n\t\t\tthrow err;\n\t\t} finally {\n\t\t\tif (isPool(this.client)) {\n\t\t\t\t(session.client as PoolConnection).release();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class MySql2Transaction<\n\tTFullSchema extends Record<string, unknown>,\n\tTRelations extends AnyRelations,\n\tTTablesConfig extends TablesRelationalConfig,\n\tTSchema extends V1.TablesRelationalConfig,\n> extends MySqlTransaction<\n\tMySql2QueryResultHKT,\n\tMySql2PreparedQueryHKT,\n\tTFullSchema,\n\tTRelations,\n\tTTablesConfig,\n\tTSchema\n> {\n\tstatic override readonly [entityKind]: string = 'MySql2Transaction';\n\n\toverride async transaction<T>(\n\t\ttransaction: (tx: MySql2Transaction<TFullSchema, TRelations, TTablesConfig, TSchema>) => Promise<T>,\n\t): Promise<T> {\n\t\tconst savepointName = `sp${this.nestedIndex + 1}`;\n\t\tconst tx = new MySql2Transaction<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\tthis.mode,\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\nfunction isPool(client: MySql2Client): client is Pool {\n\treturn 'getConnection' in client;\n}\n\nexport interface MySql2QueryResultHKT extends MySqlQueryResultHKT {\n\ttype: MySqlRawQueryResult;\n}\n\nexport interface MySql2PreparedQueryHKT extends MySqlPreparedQueryHKT {\n\ttype: MySql2PreparedQuery<Assume<this['config'], MySqlPreparedQueryConfig>>;\n}\n"],"mappings":"AAWA,SAAS,YAAY;AAErB,SAAS,cAAc;AACvB,SAAS,YAAY,UAAU;AAE/B,SAAS,kBAAkB;AAG3B;AAAA,EAEC;AAAA,EAIA;AAAA,EACA;AAAA,OAGM;AAEP,SAAS,kBAAkB,WAAW;AAEtC,SAAsB,oBAAoB;AAUnC,MAAM,4BACJ,mBACT;AAAA,EAMC,YACS,QACR,aACQ,QACA,QACA,QACA,oBAIA,cAEA,cACA,cACP;AACD,UAAM;AAdE;AAEA;AACA;AACA;AACA;AAIA;AAEA;AACA;AAGR,SAAK,WAAW;AAAA,MACf,KAAK;AAAA;AAAA,MAEL,UAAU,SAAS,OAAY,MAAW;AACzC,YAAI,MAAM,SAAS,eAAe,MAAM,SAAS,cAAc,MAAM,SAAS,QAAQ;AACrF,iBAAO,MAAM,OAAO;AAAA,QACrB;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BAAmB,IAAI,GAAG,QAAQ,UAAU;AAAA,IACrF,OAAO;AACN,YAAM,GAAG,QAAQ,UAAU;AAAA,IAC5B;AACA,QAAI;AACH,YAAM,SAAS,MAAM,YAAY,EAAE;AACnC,YAAM,GAAG,QAAQ,WAAW;AAC5B,aAAO;AAAA,IACR,SAAS,KAAK;AACb,YAAM,GAAG,QAAQ,aAAa;AAC9B,YAAM;AAAA,IACP,UAAE;AACD,UAAI,OAAO,KAAK,MAAM,GAAG;AACxB,QAAC,QAAQ,OAA0B,QAAQ;AAAA,MAC5C;AAAA,IACD;AAAA,EACD;AACD;AAEO,MAAM,0BAKH,iBAOR;AAAA,EACD,QAA0B,UAAU,IAAY;AAAA,EAEhD,MAAe,YACd,aACa;AACb,UAAM,gBAAgB,KAAK,KAAK,cAAc,CAAC;AAC/C,UAAM,KAAK,IAAI;AAAA,MACd,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK,cAAc;AAAA,MACnB,KAAK;AAAA,IACN;AACA,UAAM,GAAG,QAAQ,IAAI,IAAI,aAAa,aAAa,EAAE,CAAC;AACtD,QAAI;AACH,YAAM,SAAS,MAAM,YAAY,EAAE;AACnC,YAAM,GAAG,QAAQ,IAAI,IAAI,qBAAqB,aAAa,EAAE,CAAC;AAC9D,aAAO;AAAA,IACR,SAAS,KAAK;AACb,YAAM,GAAG,QAAQ,IAAI,IAAI,yBAAyB,aAAa,EAAE,CAAC;AAClE,YAAM;AAAA,IACP;AAAA,EACD;AACD;AAEA,SAAS,OAAO,QAAsC;AACrD,SAAO,mBAAmB;AAC3B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/mysql2/session.ts"],"sourcesContent":["import type { Connection as CallbackConnection } from 'mysql2';\nimport type {\n\tConnection,\n\tFieldPacket,\n\tOkPacket,\n\tPool,\n\tPoolConnection,\n\tQueryOptions,\n\tResultSetHeader,\n\tRowDataPacket,\n} from 'mysql2/promise';\nimport { once } from 'node:events';\nimport { Column } from '~/column.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { NoopLogger } from '~/logger.ts';\nimport type { MySqlDialect } from '~/mysql-core/dialect.ts';\nimport type { SelectedFieldsOrdered } from '~/mysql-core/query-builders/select.types.ts';\nimport {\n\ttype Mode,\n\tMySqlPreparedQuery,\n\ttype MySqlPreparedQueryConfig,\n\ttype MySqlPreparedQueryHKT,\n\ttype MySqlQueryResultHKT,\n\tMySqlSession,\n\tMySqlTransaction,\n\ttype MySqlTransactionConfig,\n\ttype PreparedQueryKind,\n} from '~/mysql-core/session.ts';\nimport type { RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';\nimport { fillPlaceholders, sql } from '~/sql/sql.ts';\nimport type { Query, SQL } from '~/sql/sql.ts';\nimport { type Assume, mapResultRow } from '~/utils.ts';\n\nexport type MySql2Client = Pool | Connection;\n\nexport type MySqlRawQueryResult = [ResultSetHeader, FieldPacket[]];\nexport type MySqlQueryResultType = RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader;\nexport type MySqlQueryResult<\n\tT = any,\n> = [T extends ResultSetHeader ? T : T[], FieldPacket[]];\n\nexport class MySql2PreparedQuery<T extends MySqlPreparedQueryConfig> extends MySqlPreparedQuery<T> {\n\tstatic override readonly [entityKind]: string = 'MySql2PreparedQuery';\n\n\tprivate rawQuery: QueryOptions;\n\tprivate query: QueryOptions;\n\n\tconstructor(\n\t\tprivate client: MySql2Client,\n\t\tqueryString: string,\n\t\tprivate params: unknown[],\n\t\tprivate logger: Logger,\n\t\tprivate fields: SelectedFieldsOrdered | undefined,\n\t\tprivate customResultMapper?: (rows: unknown[][]) => T['execute'],\n\t\t// Keys that were used in $default and the value that was generated for them\n\t\tprivate generatedIds?: Record<string, unknown>[],\n\t\t// Keys that should be returned, it has the column with all properries + key from object\n\t\tprivate returningIds?: SelectedFieldsOrdered,\n\t) {\n\t\tsuper();\n\t\tthis.rawQuery = {\n\t\t\tsql: queryString,\n\t\t\t// rowsAsArray: true,\n\t\t\ttypeCast: function(field: any, next: any) {\n\t\t\t\tif (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {\n\t\t\t\t\treturn field.string();\n\t\t\t\t}\n\t\t\t\treturn next();\n\t\t\t},\n\t\t};\n\t\tthis.query = {\n\t\t\tsql: queryString,\n\t\t\trowsAsArray: true,\n\t\t\ttypeCast: function(field: any, next: any) {\n\t\t\t\tif (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {\n\t\t\t\t\treturn field.string();\n\t\t\t\t}\n\t\t\t\treturn next();\n\t\t\t},\n\t\t};\n\t}\n\n\tasync execute(placeholderValues: Record<string, unknown> = {}): Promise<T['execute']> {\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\n\t\tthis.logger.logQuery(this.rawQuery.sql, params);\n\n\t\tconst { fields, client, rawQuery, query, joinsNotNullableMap, customResultMapper, returningIds, generatedIds } =\n\t\t\tthis;\n\t\tif (!fields && !customResultMapper) {\n\t\t\tconst res = await client.query<any>(rawQuery, params);\n\t\t\tconst insertId = res[0].insertId;\n\t\t\tconst affectedRows = res[0].affectedRows;\n\t\t\t// for each row, I need to check keys from\n\t\t\tif (returningIds) {\n\t\t\t\tconst returningResponse = [];\n\t\t\t\tlet j = 0;\n\t\t\t\tfor (let i = insertId; i < insertId + affectedRows; i++) {\n\t\t\t\t\tfor (const column of returningIds) {\n\t\t\t\t\t\tconst key = returningIds[0]!.path[0]!;\n\t\t\t\t\t\tif (is(column.field, Column)) {\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\tif (column.field.primary && column.field.autoIncrement) {\n\t\t\t\t\t\t\t\treturningResponse.push({ [key]: i });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (column.field.defaultFn && generatedIds) {\n\t\t\t\t\t\t\t\t// generatedIds[rowIdx][key]\n\t\t\t\t\t\t\t\treturningResponse.push({ [key]: generatedIds[j]![key] });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tj++;\n\t\t\t\t}\n\n\t\t\t\treturn returningResponse;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tconst result = await client.query<any[]>(query, params);\n\t\tconst rows = result[0];\n\n\t\tif (customResultMapper) {\n\t\t\treturn customResultMapper(rows);\n\t\t}\n\n\t\treturn rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));\n\t}\n\n\tasync *iterator(\n\t\tplaceholderValues: Record<string, unknown> = {},\n\t): AsyncGenerator<T['execute'] extends any[] ? T['execute'][number] : T['execute']> {\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\t\tconst conn = ((isPool(this.client) ? await this.client.getConnection() : this.client) as {} as {\n\t\t\tconnection: CallbackConnection;\n\t\t}).connection;\n\n\t\tconst { fields, query, rawQuery, joinsNotNullableMap, client, customResultMapper } = this;\n\t\tconst hasRowsMapper = Boolean(fields || customResultMapper);\n\t\tconst driverQuery = hasRowsMapper ? conn.query(query, params) : conn.query(rawQuery, params);\n\n\t\tconst stream = driverQuery.stream();\n\n\t\tfunction dataListener() {\n\t\t\tstream.pause();\n\t\t}\n\n\t\tstream.on('data', dataListener);\n\n\t\ttry {\n\t\t\tconst onEnd = once(stream, 'end');\n\t\t\tconst onError = once(stream, 'error');\n\n\t\t\twhile (true) {\n\t\t\t\tstream.resume();\n\t\t\t\tconst row = await Promise.race([onEnd, onError, new Promise((resolve) => stream.once('data', resolve))]);\n\t\t\t\tif (row === undefined || (Array.isArray(row) && row.length === 0)) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (row instanceof Error) { // eslint-disable-line no-instanceof/no-instanceof\n\t\t\t\t\tthrow row;\n\t\t\t\t} else {\n\t\t\t\t\tif (hasRowsMapper) {\n\t\t\t\t\t\tif (customResultMapper) {\n\t\t\t\t\t\t\tconst mappedRow = customResultMapper([row as unknown[]]);\n\t\t\t\t\t\t\tyield (Array.isArray(mappedRow) ? mappedRow[0] : mappedRow);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tyield mapResultRow(fields!, row as unknown[], joinsNotNullableMap);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tyield row as T['execute'];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tstream.off('data', dataListener);\n\t\t\tif (isPool(client)) {\n\t\t\t\tconn.end();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport interface MySql2SessionOptions {\n\tlogger?: Logger;\n\tmode: Mode;\n}\n\nexport class MySql2Session<\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends MySqlSession<MySqlQueryResultHKT, MySql2PreparedQueryHKT, TFullSchema, TSchema> {\n\tstatic override readonly [entityKind]: string = 'MySql2Session';\n\n\tprivate logger: Logger;\n\tprivate mode: Mode;\n\n\tconstructor(\n\t\tprivate client: MySql2Client,\n\t\tdialect: MySqlDialect,\n\t\tprivate schema: RelationalSchemaConfig<TSchema> | undefined,\n\t\tprivate options: MySql2SessionOptions,\n\t) {\n\t\tsuper(dialect);\n\t\tthis.logger = options.logger ?? new NoopLogger();\n\t\tthis.mode = options.mode;\n\t}\n\n\tprepareQuery<T extends MySqlPreparedQueryConfig>(\n\t\tquery: Query,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\tcustomResultMapper?: (rows: unknown[][]) => T['execute'],\n\t\tgeneratedIds?: Record<string, unknown>[],\n\t\treturningIds?: SelectedFieldsOrdered,\n\t): PreparedQueryKind<MySql2PreparedQueryHKT, T> {\n\t\t// Add returningId fields\n\t\t// Each driver gets them from response from database\n\t\treturn new MySql2PreparedQuery(\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\tcustomResultMapper,\n\t\t\tgeneratedIds,\n\t\t\treturningIds,\n\t\t) as PreparedQueryKind<MySql2PreparedQueryHKT, T>;\n\t}\n\n\t/**\n\t * @internal\n\t * What is its purpose?\n\t */\n\tasync query(query: string, params: unknown[]): Promise<MySqlQueryResult> {\n\t\tthis.logger.logQuery(query, params);\n\t\tconst result = await this.client.query({\n\t\t\tsql: query,\n\t\t\tvalues: params,\n\t\t\trowsAsArray: true,\n\t\t\ttypeCast: function(field: any, next: any) {\n\t\t\t\tif (field.type === 'TIMESTAMP' || field.type === 'DATETIME' || field.type === 'DATE') {\n\t\t\t\t\treturn field.string();\n\t\t\t\t}\n\t\t\t\treturn next();\n\t\t\t},\n\t\t});\n\t\treturn result;\n\t}\n\n\toverride all<T = unknown>(query: SQL): Promise<T[]> {\n\t\tconst querySql = this.dialect.sqlToQuery(query);\n\t\tthis.logger.logQuery(querySql.sql, querySql.params);\n\t\treturn this.client.execute(querySql.sql, querySql.params).then((result) => result[0]) as Promise<T[]>;\n\t}\n\n\toverride async transaction<T>(\n\t\ttransaction: (tx: MySql2Transaction<TFullSchema, TSchema>) => Promise<T>,\n\t\tconfig?: MySqlTransactionConfig,\n\t): Promise<T> {\n\t\tconst session = isPool(this.client)\n\t\t\t? new MySql2Session(\n\t\t\t\tawait this.client.getConnection(),\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\t: this;\n\t\tconst tx = new MySql2Transaction<TFullSchema, TSchema>(\n\t\t\tthis.dialect,\n\t\t\tsession as MySqlSession<any, any, any, any>,\n\t\t\tthis.schema,\n\t\t\t0,\n\t\t\tthis.mode,\n\t\t);\n\t\tif (config) {\n\t\t\tconst setTransactionConfigSql = this.getSetTransactionSQL(config);\n\t\t\tif (setTransactionConfigSql) {\n\t\t\t\tawait tx.execute(setTransactionConfigSql);\n\t\t\t}\n\t\t\tconst startTransactionSql = this.getStartTransactionSQL(config);\n\t\t\tawait (startTransactionSql ? tx.execute(startTransactionSql) : tx.execute(sql`begin`));\n\t\t} else {\n\t\t\tawait tx.execute(sql`begin`);\n\t\t}\n\t\ttry {\n\t\t\tconst result = await transaction(tx);\n\t\t\tawait tx.execute(sql`commit`);\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tawait tx.execute(sql`rollback`);\n\t\t\tthrow err;\n\t\t} finally {\n\t\t\tif (isPool(this.client)) {\n\t\t\t\t(session.client as PoolConnection).release();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class MySql2Transaction<\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends MySqlTransaction<MySql2QueryResultHKT, MySql2PreparedQueryHKT, TFullSchema, TSchema> {\n\tstatic override readonly [entityKind]: string = 'MySql2Transaction';\n\n\toverride async transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema, TSchema>) => Promise<T>): Promise<T> {\n\t\tconst savepointName = `sp${this.nestedIndex + 1}`;\n\t\tconst tx = new MySql2Transaction<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\tthis.mode,\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\nfunction isPool(client: MySql2Client): client is Pool {\n\treturn 'getConnection' in client;\n}\n\nexport interface MySql2QueryResultHKT extends MySqlQueryResultHKT {\n\ttype: MySqlRawQueryResult;\n}\n\nexport interface MySql2PreparedQueryHKT extends MySqlPreparedQueryHKT {\n\ttype: MySql2PreparedQuery<Assume<this['config'], MySqlPreparedQueryConfig>>;\n}\n"],"mappings":"AAWA,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,YAAY,UAAU;AAE/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;AAC5B,aAAO;AAAA,IACR,SAAS,KAAK;AACb,YAAM,GAAG,QAAQ,aAAa;AAC9B,YAAM;AAAA,IACP,UAAE;AACD,UAAI,OAAO,KAAK,MAAM,GAAG;AACxB,QAAC,QAAQ,OAA0B,QAAQ;AAAA,MAC5C;AAAA,IACD;AAAA,EACD;AACD;AAEO,MAAM,0BAGH,iBAAqF;AAAA,EAC9F,QAA0B,UAAU,IAAY;AAAA,EAEhD,MAAe,YAAe,aAAsF;AACnH,UAAM,gBAAgB,KAAK,KAAK,cAAc,CAAC;AAC/C,UAAM,KAAK,IAAI;AAAA,MACd,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK,cAAc;AAAA,MACnB,KAAK;AAAA,IACN;AACA,UAAM,GAAG,QAAQ,IAAI,IAAI,aAAa,aAAa,EAAE,CAAC;AACtD,QAAI;AACH,YAAM,SAAS,MAAM,YAAY,EAAE;AACnC,YAAM,GAAG,QAAQ,IAAI,IAAI,qBAAqB,aAAa,EAAE,CAAC;AAC9D,aAAO;AAAA,IACR,SAAS,KAAK;AACb,YAAM,GAAG,QAAQ,IAAI,IAAI,yBAAyB,aAAa,EAAE,CAAC;AAClE,YAAM;AAAA,IACP;AAAA,EACD;AACD;AAEA,SAAS,OAAO,QAAsC;AACrD,SAAO,mBAAmB;AAC3B;","names":[]}
|
package/neon/index.cjs
CHANGED
|
@@ -15,9 +15,11 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
16
|
var neon_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(neon_exports);
|
|
18
|
+
__reExport(neon_exports, require("./neon-identity.cjs"), module.exports);
|
|
18
19
|
__reExport(neon_exports, require("./rls.cjs"), module.exports);
|
|
19
20
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20
21
|
0 && (module.exports = {
|
|
22
|
+
...require("./neon-identity.cjs"),
|
|
21
23
|
...require("./rls.cjs")
|
|
22
24
|
});
|
|
23
25
|
//# sourceMappingURL=index.cjs.map
|
package/neon/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/neon/index.ts"],"sourcesContent":["export * from './rls.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAc,
|
|
1
|
+
{"version":3,"sources":["../../src/neon/index.ts"],"sourcesContent":["export * from './neon-identity.ts';\nexport * from './rls.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAc,+BAAd;AACA,yBAAc,qBADd;","names":[]}
|
package/neon/index.d.cts
CHANGED
package/neon/index.d.ts
CHANGED
package/neon/index.js
CHANGED
package/neon/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/neon/index.ts"],"sourcesContent":["export * from './rls.ts';\n"],"mappings":"AAAA,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/neon/index.ts"],"sourcesContent":["export * from './neon-identity.ts';\nexport * from './rls.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var neon_identity_exports = {};
|
|
20
|
+
__export(neon_identity_exports, {
|
|
21
|
+
usersSync: () => usersSync
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(neon_identity_exports);
|
|
24
|
+
var import_pg_core = require("../pg-core/index.cjs");
|
|
25
|
+
const neonIdentitySchema = (0, import_pg_core.pgSchema)("neon_identity");
|
|
26
|
+
const usersSync = neonIdentitySchema.table("users_sync", {
|
|
27
|
+
rawJson: (0, import_pg_core.jsonb)("raw_json").notNull(),
|
|
28
|
+
id: (0, import_pg_core.text)().primaryKey().notNull(),
|
|
29
|
+
name: (0, import_pg_core.text)(),
|
|
30
|
+
email: (0, import_pg_core.text)(),
|
|
31
|
+
createdAt: (0, import_pg_core.timestamp)("created_at", { withTimezone: true, mode: "string" }),
|
|
32
|
+
deletedAt: (0, import_pg_core.timestamp)("deleted_at", { withTimezone: true, mode: "string" })
|
|
33
|
+
});
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
usersSync
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=neon-identity.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/neon/neon-identity.ts"],"sourcesContent":["import { jsonb, pgSchema, text, timestamp } from '~/pg-core/index.ts';\n\nconst neonIdentitySchema = pgSchema('neon_identity');\n\n/**\n * Table schema of the `users_sync` table used by Neon Identity.\n * This table automatically synchronizes and stores user data from external authentication providers.\n *\n * @schema neon_identity\n * @table users_sync\n */\nexport const usersSync = neonIdentitySchema.table('users_sync', {\n\trawJson: jsonb('raw_json').notNull(),\n\tid: text().primaryKey().notNull(),\n\tname: text(),\n\temail: text(),\n\tcreatedAt: timestamp('created_at', { withTimezone: true, mode: 'string' }),\n\tdeletedAt: timestamp('deleted_at', { withTimezone: true, mode: 'string' }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiD;AAEjD,MAAM,yBAAqB,yBAAS,eAAe;AAS5C,MAAM,YAAY,mBAAmB,MAAM,cAAc;AAAA,EAC/D,aAAS,sBAAM,UAAU,EAAE,QAAQ;AAAA,EACnC,QAAI,qBAAK,EAAE,WAAW,EAAE,QAAQ;AAAA,EAChC,UAAM,qBAAK;AAAA,EACX,WAAO,qBAAK;AAAA,EACZ,eAAW,0BAAU,cAAc,EAAE,cAAc,MAAM,MAAM,SAAS,CAAC;AAAA,EACzE,eAAW,0BAAU,cAAc,EAAE,cAAc,MAAM,MAAM,SAAS,CAAC;AAC1E,CAAC;","names":[]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table schema of the `users_sync` table used by Neon Identity.
|
|
3
|
+
* This table automatically synchronizes and stores user data from external authentication providers.
|
|
4
|
+
*
|
|
5
|
+
* @schema neon_identity
|
|
6
|
+
* @table users_sync
|
|
7
|
+
*/
|
|
8
|
+
export declare const usersSync: import("../pg-core/index.ts").PgTableWithColumns<{
|
|
9
|
+
name: "users_sync";
|
|
10
|
+
schema: "neon_identity";
|
|
11
|
+
columns: {
|
|
12
|
+
rawJson: import("../pg-core/index.ts").PgColumn<{
|
|
13
|
+
name: "raw_json";
|
|
14
|
+
tableName: "users_sync";
|
|
15
|
+
dataType: "json";
|
|
16
|
+
columnType: "PgJsonb";
|
|
17
|
+
data: unknown;
|
|
18
|
+
driverParam: unknown;
|
|
19
|
+
notNull: true;
|
|
20
|
+
hasDefault: false;
|
|
21
|
+
isPrimaryKey: false;
|
|
22
|
+
isAutoincrement: false;
|
|
23
|
+
hasRuntimeDefault: false;
|
|
24
|
+
enumValues: undefined;
|
|
25
|
+
baseColumn: never;
|
|
26
|
+
identity: undefined;
|
|
27
|
+
generated: undefined;
|
|
28
|
+
}, {}, {}>;
|
|
29
|
+
id: import("../pg-core/index.ts").PgColumn<{
|
|
30
|
+
name: "id";
|
|
31
|
+
tableName: "users_sync";
|
|
32
|
+
dataType: "string";
|
|
33
|
+
columnType: "PgText";
|
|
34
|
+
data: string;
|
|
35
|
+
driverParam: string;
|
|
36
|
+
notNull: true;
|
|
37
|
+
hasDefault: false;
|
|
38
|
+
isPrimaryKey: true;
|
|
39
|
+
isAutoincrement: false;
|
|
40
|
+
hasRuntimeDefault: false;
|
|
41
|
+
enumValues: [string, ...string[]];
|
|
42
|
+
baseColumn: never;
|
|
43
|
+
identity: undefined;
|
|
44
|
+
generated: undefined;
|
|
45
|
+
}, {}, {}>;
|
|
46
|
+
name: import("../pg-core/index.ts").PgColumn<{
|
|
47
|
+
name: "name";
|
|
48
|
+
tableName: "users_sync";
|
|
49
|
+
dataType: "string";
|
|
50
|
+
columnType: "PgText";
|
|
51
|
+
data: string;
|
|
52
|
+
driverParam: string;
|
|
53
|
+
notNull: false;
|
|
54
|
+
hasDefault: false;
|
|
55
|
+
isPrimaryKey: false;
|
|
56
|
+
isAutoincrement: false;
|
|
57
|
+
hasRuntimeDefault: false;
|
|
58
|
+
enumValues: [string, ...string[]];
|
|
59
|
+
baseColumn: never;
|
|
60
|
+
identity: undefined;
|
|
61
|
+
generated: undefined;
|
|
62
|
+
}, {}, {}>;
|
|
63
|
+
email: import("../pg-core/index.ts").PgColumn<{
|
|
64
|
+
name: "email";
|
|
65
|
+
tableName: "users_sync";
|
|
66
|
+
dataType: "string";
|
|
67
|
+
columnType: "PgText";
|
|
68
|
+
data: string;
|
|
69
|
+
driverParam: string;
|
|
70
|
+
notNull: false;
|
|
71
|
+
hasDefault: false;
|
|
72
|
+
isPrimaryKey: false;
|
|
73
|
+
isAutoincrement: false;
|
|
74
|
+
hasRuntimeDefault: false;
|
|
75
|
+
enumValues: [string, ...string[]];
|
|
76
|
+
baseColumn: never;
|
|
77
|
+
identity: undefined;
|
|
78
|
+
generated: undefined;
|
|
79
|
+
}, {}, {}>;
|
|
80
|
+
createdAt: import("../pg-core/index.ts").PgColumn<{
|
|
81
|
+
name: "created_at";
|
|
82
|
+
tableName: "users_sync";
|
|
83
|
+
dataType: "string";
|
|
84
|
+
columnType: "PgTimestampString";
|
|
85
|
+
data: string;
|
|
86
|
+
driverParam: string;
|
|
87
|
+
notNull: false;
|
|
88
|
+
hasDefault: false;
|
|
89
|
+
isPrimaryKey: false;
|
|
90
|
+
isAutoincrement: false;
|
|
91
|
+
hasRuntimeDefault: false;
|
|
92
|
+
enumValues: undefined;
|
|
93
|
+
baseColumn: never;
|
|
94
|
+
identity: undefined;
|
|
95
|
+
generated: undefined;
|
|
96
|
+
}, {}, {}>;
|
|
97
|
+
deletedAt: import("../pg-core/index.ts").PgColumn<{
|
|
98
|
+
name: "deleted_at";
|
|
99
|
+
tableName: "users_sync";
|
|
100
|
+
dataType: "string";
|
|
101
|
+
columnType: "PgTimestampString";
|
|
102
|
+
data: string;
|
|
103
|
+
driverParam: string;
|
|
104
|
+
notNull: false;
|
|
105
|
+
hasDefault: false;
|
|
106
|
+
isPrimaryKey: false;
|
|
107
|
+
isAutoincrement: false;
|
|
108
|
+
hasRuntimeDefault: false;
|
|
109
|
+
enumValues: undefined;
|
|
110
|
+
baseColumn: never;
|
|
111
|
+
identity: undefined;
|
|
112
|
+
generated: undefined;
|
|
113
|
+
}, {}, {}>;
|
|
114
|
+
};
|
|
115
|
+
dialect: "pg";
|
|
116
|
+
}>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table schema of the `users_sync` table used by Neon Identity.
|
|
3
|
+
* This table automatically synchronizes and stores user data from external authentication providers.
|
|
4
|
+
*
|
|
5
|
+
* @schema neon_identity
|
|
6
|
+
* @table users_sync
|
|
7
|
+
*/
|
|
8
|
+
export declare const usersSync: import("../pg-core/index.js").PgTableWithColumns<{
|
|
9
|
+
name: "users_sync";
|
|
10
|
+
schema: "neon_identity";
|
|
11
|
+
columns: {
|
|
12
|
+
rawJson: import("../pg-core/index.js").PgColumn<{
|
|
13
|
+
name: "raw_json";
|
|
14
|
+
tableName: "users_sync";
|
|
15
|
+
dataType: "json";
|
|
16
|
+
columnType: "PgJsonb";
|
|
17
|
+
data: unknown;
|
|
18
|
+
driverParam: unknown;
|
|
19
|
+
notNull: true;
|
|
20
|
+
hasDefault: false;
|
|
21
|
+
isPrimaryKey: false;
|
|
22
|
+
isAutoincrement: false;
|
|
23
|
+
hasRuntimeDefault: false;
|
|
24
|
+
enumValues: undefined;
|
|
25
|
+
baseColumn: never;
|
|
26
|
+
identity: undefined;
|
|
27
|
+
generated: undefined;
|
|
28
|
+
}, {}, {}>;
|
|
29
|
+
id: import("../pg-core/index.js").PgColumn<{
|
|
30
|
+
name: "id";
|
|
31
|
+
tableName: "users_sync";
|
|
32
|
+
dataType: "string";
|
|
33
|
+
columnType: "PgText";
|
|
34
|
+
data: string;
|
|
35
|
+
driverParam: string;
|
|
36
|
+
notNull: true;
|
|
37
|
+
hasDefault: false;
|
|
38
|
+
isPrimaryKey: true;
|
|
39
|
+
isAutoincrement: false;
|
|
40
|
+
hasRuntimeDefault: false;
|
|
41
|
+
enumValues: [string, ...string[]];
|
|
42
|
+
baseColumn: never;
|
|
43
|
+
identity: undefined;
|
|
44
|
+
generated: undefined;
|
|
45
|
+
}, {}, {}>;
|
|
46
|
+
name: import("../pg-core/index.js").PgColumn<{
|
|
47
|
+
name: "name";
|
|
48
|
+
tableName: "users_sync";
|
|
49
|
+
dataType: "string";
|
|
50
|
+
columnType: "PgText";
|
|
51
|
+
data: string;
|
|
52
|
+
driverParam: string;
|
|
53
|
+
notNull: false;
|
|
54
|
+
hasDefault: false;
|
|
55
|
+
isPrimaryKey: false;
|
|
56
|
+
isAutoincrement: false;
|
|
57
|
+
hasRuntimeDefault: false;
|
|
58
|
+
enumValues: [string, ...string[]];
|
|
59
|
+
baseColumn: never;
|
|
60
|
+
identity: undefined;
|
|
61
|
+
generated: undefined;
|
|
62
|
+
}, {}, {}>;
|
|
63
|
+
email: import("../pg-core/index.js").PgColumn<{
|
|
64
|
+
name: "email";
|
|
65
|
+
tableName: "users_sync";
|
|
66
|
+
dataType: "string";
|
|
67
|
+
columnType: "PgText";
|
|
68
|
+
data: string;
|
|
69
|
+
driverParam: string;
|
|
70
|
+
notNull: false;
|
|
71
|
+
hasDefault: false;
|
|
72
|
+
isPrimaryKey: false;
|
|
73
|
+
isAutoincrement: false;
|
|
74
|
+
hasRuntimeDefault: false;
|
|
75
|
+
enumValues: [string, ...string[]];
|
|
76
|
+
baseColumn: never;
|
|
77
|
+
identity: undefined;
|
|
78
|
+
generated: undefined;
|
|
79
|
+
}, {}, {}>;
|
|
80
|
+
createdAt: import("../pg-core/index.js").PgColumn<{
|
|
81
|
+
name: "created_at";
|
|
82
|
+
tableName: "users_sync";
|
|
83
|
+
dataType: "string";
|
|
84
|
+
columnType: "PgTimestampString";
|
|
85
|
+
data: string;
|
|
86
|
+
driverParam: string;
|
|
87
|
+
notNull: false;
|
|
88
|
+
hasDefault: false;
|
|
89
|
+
isPrimaryKey: false;
|
|
90
|
+
isAutoincrement: false;
|
|
91
|
+
hasRuntimeDefault: false;
|
|
92
|
+
enumValues: undefined;
|
|
93
|
+
baseColumn: never;
|
|
94
|
+
identity: undefined;
|
|
95
|
+
generated: undefined;
|
|
96
|
+
}, {}, {}>;
|
|
97
|
+
deletedAt: import("../pg-core/index.js").PgColumn<{
|
|
98
|
+
name: "deleted_at";
|
|
99
|
+
tableName: "users_sync";
|
|
100
|
+
dataType: "string";
|
|
101
|
+
columnType: "PgTimestampString";
|
|
102
|
+
data: string;
|
|
103
|
+
driverParam: string;
|
|
104
|
+
notNull: false;
|
|
105
|
+
hasDefault: false;
|
|
106
|
+
isPrimaryKey: false;
|
|
107
|
+
isAutoincrement: false;
|
|
108
|
+
hasRuntimeDefault: false;
|
|
109
|
+
enumValues: undefined;
|
|
110
|
+
baseColumn: never;
|
|
111
|
+
identity: undefined;
|
|
112
|
+
generated: undefined;
|
|
113
|
+
}, {}, {}>;
|
|
114
|
+
};
|
|
115
|
+
dialect: "pg";
|
|
116
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsonb, pgSchema, text, timestamp } from "../pg-core/index.js";
|
|
2
|
+
const neonIdentitySchema = pgSchema("neon_identity");
|
|
3
|
+
const usersSync = neonIdentitySchema.table("users_sync", {
|
|
4
|
+
rawJson: jsonb("raw_json").notNull(),
|
|
5
|
+
id: text().primaryKey().notNull(),
|
|
6
|
+
name: text(),
|
|
7
|
+
email: text(),
|
|
8
|
+
createdAt: timestamp("created_at", { withTimezone: true, mode: "string" }),
|
|
9
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true, mode: "string" })
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
usersSync
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=neon-identity.js.map
|