drizzle-orm 0.39.2-aaa57ff → 0.39.2-dc3b366
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 +5 -16
- package/bun-sql/driver.cjs.map +1 -1
- package/bun-sql/driver.d.cts +6 -7
- package/bun-sql/driver.d.ts +6 -7
- package/bun-sql/driver.js +8 -6
- package/bun-sql/driver.js.map +1 -1
- package/bun-sql/migrator.cjs.map +1 -1
- package/bun-sql/migrator.d.cts +1 -2
- package/bun-sql/migrator.d.ts +1 -2
- package/bun-sql/migrator.js.map +1 -1
- package/bun-sql/session.cjs +6 -50
- package/bun-sql/session.cjs.map +1 -1
- package/bun-sql/session.d.cts +9 -14
- package/bun-sql/session.d.ts +9 -14
- package/bun-sql/session.js +6 -50
- package/bun-sql/session.js.map +1 -1
- 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 +8 -14
- package/bun-sqlite/session.d.ts +8 -14
- 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 +8 -50
- 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 +8 -50
- 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 +6 -30
- package/mysql-core/db.cjs.map +1 -1
- package/mysql-core/db.d.cts +8 -15
- package/mysql-core/db.d.ts +8 -15
- package/mysql-core/db.js +5 -29
- package/mysql-core/db.js.map +1 -1
- package/mysql-core/dialect.cjs +15 -197
- package/mysql-core/dialect.cjs.map +1 -1
- package/mysql-core/dialect.d.cts +13 -36
- package/mysql-core/dialect.d.ts +13 -36
- package/mysql-core/dialect.js +22 -196
- 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.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-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-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 +51 -99
- package/pg-core/db.cjs +5 -32
- package/pg-core/db.cjs.map +1 -1
- package/pg-core/db.d.cts +9 -16
- package/pg-core/db.d.ts +9 -16
- package/pg-core/db.js +4 -31
- package/pg-core/db.js.map +1 -1
- package/pg-core/dialect.cjs +488 -173
- package/pg-core/dialect.cjs.map +1 -1
- package/pg-core/dialect.d.cts +8 -27
- package/pg-core/dialect.d.ts +8 -27
- package/pg-core/dialect.js +495 -172
- 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/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/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-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/relations.cjs +245 -596
- package/relations.cjs.map +1 -1
- package/relations.d.cts +140 -292
- package/relations.d.ts +140 -292
- package/relations.js +240 -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.map +1 -1
- package/singlestore-core/db.d.cts +3 -3
- package/singlestore-core/db.d.ts +3 -3
- 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.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-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/expressions/conditions.cjs.map +1 -1
- package/sql/expressions/conditions.d.cts +4 -4
- package/sql/expressions/conditions.d.ts +4 -4
- package/sql/expressions/conditions.js.map +1 -1
- package/sql/sql.cjs +0 -21
- package/sql/sql.cjs.map +1 -1
- package/sql/sql.d.cts +8 -8
- package/sql/sql.d.ts +8 -8
- package/sql/sql.js +1 -22
- 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 +36 -71
- package/sql-js/session.cjs.map +1 -1
- package/sql-js/session.d.cts +13 -16
- package/sql-js/session.d.ts +13 -16
- package/sql-js/session.js +36 -71
- package/sql-js/session.js.map +1 -1
- package/sqlite-core/db.cjs +12 -39
- package/sqlite-core/db.cjs.map +1 -1
- package/sqlite-core/db.d.cts +8 -16
- package/sqlite-core/db.d.ts +8 -16
- package/sqlite-core/db.js +11 -38
- package/sqlite-core/db.js.map +1 -1
- package/sqlite-core/dialect.cjs +7 -186
- package/sqlite-core/dialect.cjs.map +1 -1
- package/sqlite-core/dialect.d.cts +9 -31
- package/sqlite-core/dialect.d.ts +9 -31
- package/sqlite-core/dialect.js +14 -185
- 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.cjs +35 -56
- 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 +35 -56
- 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-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/table.cjs.map +1 -1
- package/table.d.cts +2 -2
- package/table.d.ts +2 -2
- 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 +4 -34
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.d.cts +8 -13
- package/vercel-postgres/session.d.ts +8 -13
- package/vercel-postgres/session.js +4 -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/relations.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getTableUniqueName,
|
|
3
|
-
IsAlias,
|
|
4
|
-
OriginalName,
|
|
5
|
-
Schema,
|
|
6
|
-
Table
|
|
7
|
-
} from "./table.js";
|
|
8
|
-
import { Columns } from "./table.js";
|
|
1
|
+
import { getTableUniqueName, Table } from "./table.js";
|
|
9
2
|
import { Column } from "./column.js";
|
|
10
3
|
import { entityKind, is } from "./entity.js";
|
|
4
|
+
import { PrimaryKeyBuilder } from "./pg-core/primary-keys.js";
|
|
11
5
|
import {
|
|
12
6
|
and,
|
|
13
7
|
asc,
|
|
@@ -33,633 +27,290 @@ import {
|
|
|
33
27
|
notLike,
|
|
34
28
|
or
|
|
35
29
|
} from "./sql/expressions/index.js";
|
|
36
|
-
import { SQL, sql
|
|
37
|
-
class Relations {
|
|
38
|
-
constructor(schema, tables, config) {
|
|
39
|
-
this.schema = schema;
|
|
40
|
-
this.tables = tables;
|
|
41
|
-
this.config = config;
|
|
42
|
-
for (const [tsName, table] of Object.entries(tables)) {
|
|
43
|
-
if (config[tsName]?.$drizzleTypeError)
|
|
44
|
-
continue;
|
|
45
|
-
const isTable = is(table, Table);
|
|
46
|
-
const isView = is(table, View);
|
|
47
|
-
if (!(isTable || isView))
|
|
48
|
-
continue;
|
|
49
|
-
this.tableNamesMap[getTableUniqueName(table)] = tsName;
|
|
50
|
-
this.tablesConfig[tsName] = {
|
|
51
|
-
table,
|
|
52
|
-
tsName,
|
|
53
|
-
dbName: table[Table.Symbol.Name],
|
|
54
|
-
schema: table[Table.Symbol.Schema],
|
|
55
|
-
columns: table[Table.Symbol.Columns],
|
|
56
|
-
relations: config[tsName] || {}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
for (const tableConfig of Object.values(this.tablesConfig)) {
|
|
60
|
-
for (const [relationFieldName, relation] of Object.entries(tableConfig.relations)) {
|
|
61
|
-
if (!is(relation, Relation)) {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
relation.sourceTable = tableConfig.table;
|
|
65
|
-
relation.fieldName = relationFieldName;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
for (const tableConfig of Object.values(this.tablesConfig)) {
|
|
69
|
-
for (const [relationFieldName, relation] of Object.entries(tableConfig.relations)) {
|
|
70
|
-
const relationPrintName = `relations -> ${tableConfig.tsName}.${relationFieldName}`;
|
|
71
|
-
if (!is(relation, Relation)) {
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
if (typeof relation.alias === "string" && !relation.alias) {
|
|
75
|
-
throw new Error(`${relationPrintName}: "alias" cannot be an empty string - omit it if you don't need it`);
|
|
76
|
-
}
|
|
77
|
-
if (relation.sourceColumns?.length === 0) {
|
|
78
|
-
throw new Error(`${relationPrintName}: "from" cannot be an empty array`);
|
|
79
|
-
}
|
|
80
|
-
if (relation.targetColumns?.length === 0) {
|
|
81
|
-
throw new Error(`${relationPrintName}: "to" cannot be an empty array`);
|
|
82
|
-
}
|
|
83
|
-
if (relation.sourceColumns && relation.targetColumns) {
|
|
84
|
-
if (relation.sourceColumns.length !== relation.targetColumns.length) {
|
|
85
|
-
throw new Error(
|
|
86
|
-
`${relationPrintName}: "from" and "to" fields must have the same length`
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
if (relation.through) {
|
|
90
|
-
if (relation.through.source.length !== relation.through.target.length || relation.through.source.length !== relation.sourceColumns.length || relation.through.target.length !== relation.targetColumns.length) {
|
|
91
|
-
throw new Error(
|
|
92
|
-
`${relationPrintName}: ".through(column)" must be used either on all columns in "from" and "to" or not defined on any of them`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
for (const column of relation.through.source) {
|
|
96
|
-
if (tables[column._.tableName] !== relation.throughTable) {
|
|
97
|
-
throw new Error(
|
|
98
|
-
`${relationPrintName}: ".through(column)" must be used on the same table by all columns of the relation`
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
for (const column of relation.through.target) {
|
|
103
|
-
if (tables[column._.tableName] !== relation.throughTable) {
|
|
104
|
-
throw new Error(
|
|
105
|
-
`${relationPrintName}: ".through(column)" must be used on the same table by all columns of the relation`
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
if (relation.sourceColumns || relation.targetColumns) {
|
|
113
|
-
throw new Error(
|
|
114
|
-
`${relationPrintName}: relation must have either both "from" and "to" defined, or none of them`
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
let reverseRelation;
|
|
118
|
-
const targetTableTsName = this.tableNamesMap[getTableUniqueName(relation.targetTable)];
|
|
119
|
-
if (!targetTableTsName) {
|
|
120
|
-
throw new Error(
|
|
121
|
-
`Table "${getTableUniqueName(relation.targetTable)}" not found in provided TS schema`
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
const reverseTableConfig = this.tablesConfig[targetTableTsName];
|
|
125
|
-
if (!reverseTableConfig) {
|
|
126
|
-
throw new Error(
|
|
127
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relations of table "${targetTableTsName}" were found"`
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
if (relation.alias) {
|
|
131
|
-
const reverseRelations = Object.values(reverseTableConfig.relations).filter(
|
|
132
|
-
(it) => is(it, Relation) && it.alias === relation.alias
|
|
133
|
-
);
|
|
134
|
-
if (reverseRelations.length > 1) {
|
|
135
|
-
throw new Error(
|
|
136
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations with alias "${relation.alias}" found in table "${targetTableTsName}": ${reverseRelations.map((it) => `"${it.fieldName}"`).join(", ")}`
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
reverseRelation = reverseRelations[0];
|
|
140
|
-
if (!reverseRelation) {
|
|
141
|
-
throw new Error(
|
|
142
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and there is no reverse relation of table "${targetTableTsName}" with alias "${relation.alias}"`
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
} else {
|
|
146
|
-
const reverseRelations = Object.values(reverseTableConfig.relations).filter(
|
|
147
|
-
(it) => is(it, Relation) && it.targetTable === relation.sourceTable && !it.alias
|
|
148
|
-
);
|
|
149
|
-
if (reverseRelations.length > 1) {
|
|
150
|
-
throw new Error(
|
|
151
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${targetTableTsName}" and "${getTableUniqueName(relation.sourceTable)}" were found.
|
|
152
|
-
Hint: you can specify "alias" on both sides of the relation with the same value`
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
reverseRelation = reverseRelations[0];
|
|
156
|
-
if (!reverseRelation) {
|
|
157
|
-
throw new Error(
|
|
158
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${targetTableTsName}" with target table "${getTableUniqueName(relation.sourceTable)}" was found`
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (!reverseRelation.sourceColumns || !reverseRelation.targetColumns) {
|
|
163
|
-
throw new Error(
|
|
164
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and reverse relation "${targetTableTsName}.${reverseRelation.fieldName}" does not have "from"/"to" defined`
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
relation.sourceColumns = reverseRelation.targetColumns;
|
|
168
|
-
relation.targetColumns = reverseRelation.sourceColumns;
|
|
169
|
-
relation.through = reverseRelation.through ? {
|
|
170
|
-
source: reverseRelation.through.target,
|
|
171
|
-
target: reverseRelation.through.source
|
|
172
|
-
} : void 0;
|
|
173
|
-
relation.throughTable = reverseRelation.throughTable;
|
|
174
|
-
relation.isReversed = !relation.where;
|
|
175
|
-
relation.where = relation.where ?? reverseRelation.where;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
static [entityKind] = "RelationsV2";
|
|
180
|
-
/** table DB name -> schema table key */
|
|
181
|
-
tableNamesMap = {};
|
|
182
|
-
tablesConfig = {};
|
|
183
|
-
}
|
|
30
|
+
import { SQL, sql } from "./sql/sql.js";
|
|
184
31
|
class Relation {
|
|
185
|
-
constructor(
|
|
186
|
-
this.
|
|
32
|
+
constructor(sourceTable, referencedTable, relationName) {
|
|
33
|
+
this.sourceTable = sourceTable;
|
|
34
|
+
this.referencedTable = referencedTable;
|
|
35
|
+
this.relationName = relationName;
|
|
36
|
+
this.referencedTableName = referencedTable[Table.Symbol.Name];
|
|
187
37
|
}
|
|
188
|
-
static [entityKind] = "
|
|
38
|
+
static [entityKind] = "Relation";
|
|
39
|
+
referencedTableName;
|
|
189
40
|
fieldName;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
isReversed;
|
|
41
|
+
}
|
|
42
|
+
class Relations {
|
|
43
|
+
constructor(table, config) {
|
|
44
|
+
this.table = table;
|
|
45
|
+
this.config = config;
|
|
46
|
+
}
|
|
47
|
+
static [entityKind] = "Relations";
|
|
198
48
|
}
|
|
199
49
|
class One extends Relation {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return it._.column;
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
if (this.throughTable) {
|
|
219
|
-
this.through = Array.isArray(config?.from) ? {
|
|
220
|
-
source: config.from.map((c) => c._.through),
|
|
221
|
-
target: (config.to ?? []).map((c) => c._.through)
|
|
222
|
-
} : {
|
|
223
|
-
source: (config?.from ? [config.from] : []).map((c) => c._.through),
|
|
224
|
-
target: (config?.to ? [config.to] : []).map((c) => c._.through)
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
this.optional = config?.optional ?? true;
|
|
50
|
+
constructor(sourceTable, referencedTable, config, isNullable) {
|
|
51
|
+
super(sourceTable, referencedTable, config?.relationName);
|
|
52
|
+
this.config = config;
|
|
53
|
+
this.isNullable = isNullable;
|
|
54
|
+
}
|
|
55
|
+
static [entityKind] = "One";
|
|
56
|
+
withFieldName(fieldName) {
|
|
57
|
+
const relation = new One(
|
|
58
|
+
this.sourceTable,
|
|
59
|
+
this.referencedTable,
|
|
60
|
+
this.config,
|
|
61
|
+
this.isNullable
|
|
62
|
+
);
|
|
63
|
+
relation.fieldName = fieldName;
|
|
64
|
+
return relation;
|
|
228
65
|
}
|
|
229
66
|
}
|
|
230
67
|
class Many extends Relation {
|
|
231
|
-
constructor(
|
|
232
|
-
super(
|
|
68
|
+
constructor(sourceTable, referencedTable, config) {
|
|
69
|
+
super(sourceTable, referencedTable, config?.relationName);
|
|
233
70
|
this.config = config;
|
|
234
|
-
this.alias = config?.alias;
|
|
235
|
-
this.where = config?.where;
|
|
236
|
-
if (config?.from) {
|
|
237
|
-
this.sourceColumns = (Array.isArray(config.from) ? config.from : [config.from]).map((it) => {
|
|
238
|
-
this.throughTable ??= it._.through ? tables[it._.through._.tableName] : void 0;
|
|
239
|
-
return it._.column;
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
if (config?.to) {
|
|
243
|
-
this.targetColumns = (Array.isArray(config.to) ? config.to : [config.to]).map((it) => {
|
|
244
|
-
this.throughTable ??= it._.through ? tables[it._.through._.tableName] : void 0;
|
|
245
|
-
return it._.column;
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
if (this.throughTable) {
|
|
249
|
-
this.through = Array.isArray(config?.from) ? {
|
|
250
|
-
source: config.from.map((c) => c._.through),
|
|
251
|
-
target: (config.to ?? []).map((c) => c._.through)
|
|
252
|
-
} : {
|
|
253
|
-
source: (config?.from ? [config.from] : []).map((c) => c._.through),
|
|
254
|
-
target: (config?.to ? [config.to] : []).map((c) => c._.through)
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
71
|
}
|
|
258
|
-
static [entityKind] = "
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
72
|
+
static [entityKind] = "Many";
|
|
73
|
+
withFieldName(fieldName) {
|
|
74
|
+
const relation = new Many(
|
|
75
|
+
this.sourceTable,
|
|
76
|
+
this.referencedTable,
|
|
77
|
+
this.config
|
|
78
|
+
);
|
|
79
|
+
relation.fieldName = fieldName;
|
|
80
|
+
return relation;
|
|
266
81
|
}
|
|
267
82
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
83
|
+
function getOperators() {
|
|
84
|
+
return {
|
|
85
|
+
and,
|
|
86
|
+
between,
|
|
87
|
+
eq,
|
|
88
|
+
exists,
|
|
89
|
+
gt,
|
|
90
|
+
gte,
|
|
91
|
+
ilike,
|
|
92
|
+
inArray,
|
|
93
|
+
isNull,
|
|
94
|
+
isNotNull,
|
|
95
|
+
like,
|
|
96
|
+
lt,
|
|
97
|
+
lte,
|
|
98
|
+
ne,
|
|
99
|
+
not,
|
|
100
|
+
notBetween,
|
|
101
|
+
notExists,
|
|
102
|
+
notLike,
|
|
103
|
+
notIlike,
|
|
104
|
+
notInArray,
|
|
105
|
+
or,
|
|
106
|
+
sql
|
|
107
|
+
};
|
|
279
108
|
}
|
|
280
|
-
const operators = {
|
|
281
|
-
and,
|
|
282
|
-
between,
|
|
283
|
-
eq,
|
|
284
|
-
exists,
|
|
285
|
-
gt,
|
|
286
|
-
gte,
|
|
287
|
-
ilike,
|
|
288
|
-
inArray,
|
|
289
|
-
isNull,
|
|
290
|
-
isNotNull,
|
|
291
|
-
like,
|
|
292
|
-
lt,
|
|
293
|
-
lte,
|
|
294
|
-
ne,
|
|
295
|
-
not,
|
|
296
|
-
notBetween,
|
|
297
|
-
notExists,
|
|
298
|
-
notLike,
|
|
299
|
-
notIlike,
|
|
300
|
-
notInArray,
|
|
301
|
-
or,
|
|
302
|
-
sql
|
|
303
|
-
};
|
|
304
|
-
const orderByOperators = {
|
|
305
|
-
sql,
|
|
306
|
-
asc,
|
|
307
|
-
desc
|
|
308
|
-
};
|
|
309
109
|
function getOrderByOperators() {
|
|
310
|
-
return
|
|
110
|
+
return {
|
|
111
|
+
sql,
|
|
112
|
+
asc,
|
|
113
|
+
desc
|
|
114
|
+
};
|
|
311
115
|
}
|
|
312
|
-
function
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
116
|
+
function extractTablesRelationalConfig(schema, configHelpers) {
|
|
117
|
+
if (Object.keys(schema).length === 1 && "default" in schema && !is(schema["default"], Table)) {
|
|
118
|
+
schema = schema["default"];
|
|
119
|
+
}
|
|
120
|
+
const tableNamesMap = {};
|
|
121
|
+
const relationsBuffer = {};
|
|
122
|
+
const tablesConfig = {};
|
|
123
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
124
|
+
if (is(value, Table)) {
|
|
125
|
+
const dbName = getTableUniqueName(value);
|
|
126
|
+
const bufferedRelations = relationsBuffer[dbName];
|
|
127
|
+
tableNamesMap[dbName] = key;
|
|
128
|
+
tablesConfig[key] = {
|
|
129
|
+
tsName: key,
|
|
130
|
+
dbName: value[Table.Symbol.Name],
|
|
131
|
+
schema: value[Table.Symbol.Schema],
|
|
132
|
+
columns: value[Table.Symbol.Columns],
|
|
133
|
+
relations: bufferedRelations?.relations ?? {},
|
|
134
|
+
primaryKey: bufferedRelations?.primaryKey ?? []
|
|
135
|
+
};
|
|
136
|
+
for (const column of Object.values(
|
|
137
|
+
value[Table.Symbol.Columns]
|
|
138
|
+
)) {
|
|
139
|
+
if (column.primary) {
|
|
140
|
+
tablesConfig[key].primaryKey.push(column);
|
|
329
141
|
}
|
|
330
|
-
continue;
|
|
331
142
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
143
|
+
const extraConfig = value[Table.Symbol.ExtraConfigBuilder]?.(value[Table.Symbol.ExtraConfigColumns]);
|
|
144
|
+
if (extraConfig) {
|
|
145
|
+
for (const configEntry of Object.values(extraConfig)) {
|
|
146
|
+
if (is(configEntry, PrimaryKeyBuilder)) {
|
|
147
|
+
tablesConfig[key].primaryKey.push(...configEntry.columns);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
} else if (is(value, Relations)) {
|
|
152
|
+
const dbName = getTableUniqueName(value.table);
|
|
153
|
+
const tableName = tableNamesMap[dbName];
|
|
154
|
+
const relations2 = value.config(
|
|
155
|
+
configHelpers(value.table)
|
|
338
156
|
);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
157
|
+
let primaryKey;
|
|
158
|
+
for (const [relationName, relation] of Object.entries(relations2)) {
|
|
159
|
+
if (tableName) {
|
|
160
|
+
const tableConfig = tablesConfig[tableName];
|
|
161
|
+
tableConfig.relations[relationName] = relation;
|
|
162
|
+
if (primaryKey) {
|
|
163
|
+
tableConfig.primaryKey.push(...primaryKey);
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
if (!(dbName in relationsBuffer)) {
|
|
167
|
+
relationsBuffer[dbName] = {
|
|
168
|
+
relations: {},
|
|
169
|
+
primaryKey
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
relationsBuffer[dbName].relations[relationName] = relation;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
354
175
|
}
|
|
355
|
-
row[selectionItem.key] = decoder.mapFromDriverValue(value);
|
|
356
176
|
}
|
|
357
|
-
return
|
|
177
|
+
return { tables: tablesConfig, tableNamesMap };
|
|
358
178
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
179
|
+
function relations(table, relations2) {
|
|
180
|
+
return new Relations(
|
|
181
|
+
table,
|
|
182
|
+
(helpers) => Object.fromEntries(
|
|
183
|
+
Object.entries(relations2(helpers)).map(([key, value]) => [
|
|
184
|
+
key,
|
|
185
|
+
value.withFieldName(key)
|
|
186
|
+
])
|
|
187
|
+
)
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
function createOne(sourceTable) {
|
|
191
|
+
return function one(table, config) {
|
|
192
|
+
return new One(
|
|
193
|
+
sourceTable,
|
|
194
|
+
table,
|
|
195
|
+
config,
|
|
196
|
+
config?.fields.reduce((res, f) => res && f.notNull, true) ?? false
|
|
197
|
+
);
|
|
198
|
+
};
|
|
371
199
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
200
|
+
function createMany(sourceTable) {
|
|
201
|
+
return function many(referencedTable, config) {
|
|
202
|
+
return new Many(sourceTable, referencedTable, config);
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function normalizeRelation(schema, tableNamesMap, relation) {
|
|
206
|
+
if (is(relation, One) && relation.config) {
|
|
207
|
+
return {
|
|
208
|
+
fields: relation.config.fields,
|
|
209
|
+
references: relation.config.references
|
|
382
210
|
};
|
|
383
211
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
this._.key,
|
|
389
|
-
column
|
|
212
|
+
const referencedTableTsName = tableNamesMap[getTableUniqueName(relation.referencedTable)];
|
|
213
|
+
if (!referencedTableTsName) {
|
|
214
|
+
throw new Error(
|
|
215
|
+
`Table "${relation.referencedTable[Table.Symbol.Name]}" not found in schema`
|
|
390
216
|
);
|
|
391
217
|
}
|
|
392
|
-
|
|
393
|
-
|
|
218
|
+
const referencedTableConfig = schema[referencedTableTsName];
|
|
219
|
+
if (!referencedTableConfig) {
|
|
220
|
+
throw new Error(`Table "${referencedTableTsName}" not found in schema`);
|
|
394
221
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
tables
|
|
402
|
-
};
|
|
403
|
-
const one = {};
|
|
404
|
-
const many = {};
|
|
405
|
-
for (const [tableName, table] of Object.entries(tables)) {
|
|
406
|
-
one[tableName] = (config) => {
|
|
407
|
-
return new One(tables, table, config);
|
|
408
|
-
};
|
|
409
|
-
many[tableName] = (config) => {
|
|
410
|
-
return new Many(tables, table, config);
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
this.one = one;
|
|
414
|
-
this.many = many;
|
|
222
|
+
const sourceTable = relation.sourceTable;
|
|
223
|
+
const sourceTableTsName = tableNamesMap[getTableUniqueName(sourceTable)];
|
|
224
|
+
if (!sourceTableTsName) {
|
|
225
|
+
throw new Error(
|
|
226
|
+
`Table "${sourceTable[Table.Symbol.Name]}" not found in schema`
|
|
227
|
+
);
|
|
415
228
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
function createRelationsHelper(schema) {
|
|
426
|
-
const schemaTables = Object.fromEntries(
|
|
427
|
-
Object.entries(schema).filter((e) => is(e[1], Table) || is(e[1], View))
|
|
428
|
-
);
|
|
429
|
-
const helperStatic = new RelationsHelperStatic(schemaTables);
|
|
430
|
-
const tables = Object.entries(schema).reduce((acc, [tKey, value]) => {
|
|
431
|
-
if (is(value, Table) || is(value, View)) {
|
|
432
|
-
const rTable = new RelationsBuilderTable(value, tKey);
|
|
433
|
-
const columns = Object.entries(value[Columns]).reduce(
|
|
434
|
-
(acc2, [cKey, column]) => {
|
|
435
|
-
const rbColumn = new RelationsBuilderColumn(column, tKey, cKey);
|
|
436
|
-
acc2[cKey] = rbColumn;
|
|
437
|
-
return acc2;
|
|
438
|
-
},
|
|
439
|
-
{}
|
|
440
|
-
);
|
|
441
|
-
acc[tKey] = Object.assign(rTable, columns);
|
|
442
|
-
}
|
|
443
|
-
return acc;
|
|
444
|
-
}, {});
|
|
445
|
-
return Object.assign(helperStatic, tables);
|
|
446
|
-
}
|
|
447
|
-
function defineRelations(schema, relations) {
|
|
448
|
-
return new Relations(
|
|
449
|
-
schema,
|
|
450
|
-
schema,
|
|
451
|
-
relations(createRelationsHelper(schema))
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
|
-
function fieldSelectionToSQL(table, target) {
|
|
455
|
-
const field = table[Columns][target];
|
|
456
|
-
return field ? is(field, Column) ? field : is(field, SQL.Aliased) ? sql`${table}.${sql.identifier(field.fieldAlias)}` : sql`${table}.${sql.identifier(target)}` : sql`${table}.${sql.identifier(target)}`;
|
|
457
|
-
}
|
|
458
|
-
function relationsFieldFilterToSQL(column, filter) {
|
|
459
|
-
if (typeof filter !== "object")
|
|
460
|
-
return eq(column, filter);
|
|
461
|
-
const entries = Object.entries(filter);
|
|
462
|
-
if (!entries.length)
|
|
463
|
-
return void 0;
|
|
464
|
-
const parts = [];
|
|
465
|
-
for (const [target, value] of entries) {
|
|
466
|
-
if (value === void 0)
|
|
467
|
-
continue;
|
|
468
|
-
switch (target) {
|
|
469
|
-
case "NOT": {
|
|
470
|
-
const res = relationsFieldFilterToSQL(column, value);
|
|
471
|
-
if (!res)
|
|
472
|
-
continue;
|
|
473
|
-
parts.push(not(res));
|
|
474
|
-
continue;
|
|
475
|
-
}
|
|
476
|
-
case "OR": {
|
|
477
|
-
if (!value.length)
|
|
478
|
-
continue;
|
|
479
|
-
parts.push(
|
|
480
|
-
or(
|
|
481
|
-
...value.map((subFilter) => relationsFieldFilterToSQL(column, subFilter))
|
|
482
|
-
)
|
|
483
|
-
);
|
|
484
|
-
continue;
|
|
485
|
-
}
|
|
486
|
-
case "isNotNull":
|
|
487
|
-
case "isNull": {
|
|
488
|
-
if (!value)
|
|
489
|
-
continue;
|
|
490
|
-
parts.push(operators[target](column));
|
|
491
|
-
continue;
|
|
492
|
-
}
|
|
493
|
-
case "in": {
|
|
494
|
-
parts.push(operators.inArray(column, value));
|
|
495
|
-
continue;
|
|
496
|
-
}
|
|
497
|
-
case "notIn": {
|
|
498
|
-
parts.push(operators.notInArray(column, value));
|
|
499
|
-
continue;
|
|
500
|
-
}
|
|
501
|
-
default: {
|
|
502
|
-
parts.push(
|
|
503
|
-
operators[target](
|
|
504
|
-
column,
|
|
505
|
-
value
|
|
506
|
-
)
|
|
507
|
-
);
|
|
508
|
-
continue;
|
|
509
|
-
}
|
|
229
|
+
const reverseRelations = [];
|
|
230
|
+
for (const referencedTableRelation of Object.values(
|
|
231
|
+
referencedTableConfig.relations
|
|
232
|
+
)) {
|
|
233
|
+
if (relation.relationName && relation !== referencedTableRelation && referencedTableRelation.relationName === relation.relationName || !relation.relationName && referencedTableRelation.referencedTable === relation.sourceTable) {
|
|
234
|
+
reverseRelations.push(referencedTableRelation);
|
|
510
235
|
}
|
|
511
236
|
}
|
|
512
|
-
if (
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
if (!entries.length)
|
|
519
|
-
return void 0;
|
|
520
|
-
const parts = [];
|
|
521
|
-
for (const [target, value] of entries) {
|
|
522
|
-
if (value === void 0)
|
|
523
|
-
continue;
|
|
524
|
-
switch (target) {
|
|
525
|
-
case "RAW": {
|
|
526
|
-
if (value) {
|
|
527
|
-
parts.push(
|
|
528
|
-
value(table, operators)
|
|
529
|
-
);
|
|
530
|
-
}
|
|
531
|
-
continue;
|
|
532
|
-
}
|
|
533
|
-
case "OR": {
|
|
534
|
-
if (!value?.length)
|
|
535
|
-
continue;
|
|
536
|
-
parts.push(
|
|
537
|
-
or(
|
|
538
|
-
...value.map((subFilter) => relationsFilterToSQL(table, subFilter))
|
|
539
|
-
)
|
|
540
|
-
);
|
|
541
|
-
continue;
|
|
542
|
-
}
|
|
543
|
-
case "NOT": {
|
|
544
|
-
if (value === void 0)
|
|
545
|
-
continue;
|
|
546
|
-
const built = relationsFilterToSQL(table, value);
|
|
547
|
-
if (!built)
|
|
548
|
-
continue;
|
|
549
|
-
parts.push(not(built));
|
|
550
|
-
continue;
|
|
551
|
-
}
|
|
552
|
-
default: {
|
|
553
|
-
const column = fieldSelectionToSQL(table, target);
|
|
554
|
-
const colFilter = relationsFieldFilterToSQL(
|
|
555
|
-
column,
|
|
556
|
-
value
|
|
557
|
-
);
|
|
558
|
-
if (colFilter)
|
|
559
|
-
parts.push(colFilter);
|
|
560
|
-
continue;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
237
|
+
if (reverseRelations.length > 1) {
|
|
238
|
+
throw relation.relationName ? new Error(
|
|
239
|
+
`There are multiple relations with name "${relation.relationName}" in table "${referencedTableTsName}"`
|
|
240
|
+
) : new Error(
|
|
241
|
+
`There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table.Symbol.Name]}". Please specify relation name`
|
|
242
|
+
);
|
|
563
243
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
return is(data, SQL) ? data : Array.isArray(data) ? data.length ? sql.join(data.map((o) => is(o, SQL) ? o : asc(o)), sql`, `) : void 0 : is(data, Column) ? asc(data) : void 0;
|
|
244
|
+
if (reverseRelations[0] && is(reverseRelations[0], One) && reverseRelations[0].config) {
|
|
245
|
+
return {
|
|
246
|
+
fields: reverseRelations[0].config.references,
|
|
247
|
+
references: reverseRelations[0].config.fields
|
|
248
|
+
};
|
|
570
249
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
return void 0;
|
|
574
|
-
return sql.join(
|
|
575
|
-
entries.map(([target, value]) => (value === "asc" ? asc : desc)(fieldSelectionToSQL(table, target))),
|
|
576
|
-
sql`, `
|
|
250
|
+
throw new Error(
|
|
251
|
+
`There is not enough information to infer relation "${sourceTableTsName}.${relation.fieldName}"`
|
|
577
252
|
);
|
|
578
253
|
}
|
|
579
|
-
function
|
|
580
|
-
const subqueries = [];
|
|
581
|
-
const selection = [];
|
|
582
|
-
for (const [key, extra] of Object.entries(
|
|
583
|
-
typeof extras === "function" ? extras(table, { sql: operators.sql }) : extras
|
|
584
|
-
)) {
|
|
585
|
-
if (!extra)
|
|
586
|
-
continue;
|
|
587
|
-
const query = sql`(${extra.getSQL()}) as ${sql.identifier(key)}`;
|
|
588
|
-
query.decoder = extra.getSQL().decoder;
|
|
589
|
-
subqueries.push(query);
|
|
590
|
-
selection.push({
|
|
591
|
-
key,
|
|
592
|
-
field: query
|
|
593
|
-
});
|
|
594
|
-
}
|
|
254
|
+
function createTableRelationsHelpers(sourceTable) {
|
|
595
255
|
return {
|
|
596
|
-
|
|
597
|
-
|
|
256
|
+
one: createOne(sourceTable),
|
|
257
|
+
many: createMany(sourceTable)
|
|
598
258
|
};
|
|
599
259
|
}
|
|
600
|
-
function
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
260
|
+
function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelection, mapColumnValue = (value) => value) {
|
|
261
|
+
const result = {};
|
|
262
|
+
for (const [
|
|
263
|
+
selectionItemIndex,
|
|
264
|
+
selectionItem
|
|
265
|
+
] of buildQueryResultSelection.entries()) {
|
|
266
|
+
if (selectionItem.isJson) {
|
|
267
|
+
const relation = tableConfig.relations[selectionItem.tsKey];
|
|
268
|
+
const rawSubRows = row[selectionItemIndex];
|
|
269
|
+
const subRows = typeof rawSubRows === "string" ? JSON.parse(rawSubRows) : rawSubRows;
|
|
270
|
+
result[selectionItem.tsKey] = is(relation, One) ? subRows && mapRelationalRow(
|
|
271
|
+
tablesConfig,
|
|
272
|
+
tablesConfig[selectionItem.relationTableTsKey],
|
|
273
|
+
subRows,
|
|
274
|
+
selectionItem.selection,
|
|
275
|
+
mapColumnValue
|
|
276
|
+
) : subRows.map(
|
|
277
|
+
(subRow) => mapRelationalRow(
|
|
278
|
+
tablesConfig,
|
|
279
|
+
tablesConfig[selectionItem.relationTableTsKey],
|
|
280
|
+
subRow,
|
|
281
|
+
selectionItem.selection,
|
|
282
|
+
mapColumnValue
|
|
283
|
+
)
|
|
614
284
|
);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
)
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
285
|
+
} else {
|
|
286
|
+
const value = mapColumnValue(row[selectionItemIndex]);
|
|
287
|
+
const field = selectionItem.field;
|
|
288
|
+
let decoder;
|
|
289
|
+
if (is(field, Column)) {
|
|
290
|
+
decoder = field;
|
|
291
|
+
} else if (is(field, SQL)) {
|
|
292
|
+
decoder = field.decoder;
|
|
293
|
+
} else {
|
|
294
|
+
decoder = field.sql.decoder;
|
|
295
|
+
}
|
|
296
|
+
result[selectionItem.tsKey] = value === null ? null : decoder.mapFromDriverValue(value);
|
|
297
|
+
}
|
|
625
298
|
}
|
|
626
|
-
|
|
627
|
-
const t = relation.targetColumns[i];
|
|
628
|
-
return eq(
|
|
629
|
-
sql`${sourceTable}.${sql.identifier(s.name)}`,
|
|
630
|
-
sql`${targetTable}.${sql.identifier(t.name)}`
|
|
631
|
-
);
|
|
632
|
-
});
|
|
633
|
-
const fullWhere = and(
|
|
634
|
-
...columnWhere,
|
|
635
|
-
relation.where ? relationsFilterToSQL(relation.isReversed ? targetTable : sourceTable, relation.where) : void 0
|
|
636
|
-
);
|
|
637
|
-
return { filter: fullWhere };
|
|
638
|
-
}
|
|
639
|
-
function getTableAsAliasSQL(table) {
|
|
640
|
-
return sql`${table[IsAlias] ? sql`${sql`${sql.identifier(table[Schema] ?? "")}.`.if(table[Schema])}${sql.identifier(table[OriginalName])} as ${table}` : table}`;
|
|
299
|
+
return result;
|
|
641
300
|
}
|
|
642
301
|
export {
|
|
643
|
-
AggregatedField,
|
|
644
|
-
Count,
|
|
645
302
|
Many,
|
|
646
303
|
One,
|
|
647
304
|
Relation,
|
|
648
305
|
Relations,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
fieldSelectionToSQL,
|
|
306
|
+
createMany,
|
|
307
|
+
createOne,
|
|
308
|
+
createTableRelationsHelpers,
|
|
309
|
+
extractTablesRelationalConfig,
|
|
310
|
+
getOperators,
|
|
655
311
|
getOrderByOperators,
|
|
656
|
-
getTableAsAliasSQL,
|
|
657
312
|
mapRelationalRow,
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
relationExtrasToSQL,
|
|
661
|
-
relationToSQL,
|
|
662
|
-
relationsFilterToSQL,
|
|
663
|
-
relationsOrderToSQL
|
|
313
|
+
normalizeRelation,
|
|
314
|
+
relations
|
|
664
315
|
};
|
|
665
316
|
//# sourceMappingURL=relations.js.map
|