drizzle-orm 0.44.0 → 0.44.2-512acc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/aws-data-api/pg/driver.cjs +14 -6
- package/aws-data-api/pg/driver.cjs.map +1 -1
- package/aws-data-api/pg/driver.d.cts +4 -3
- package/aws-data-api/pg/driver.d.ts +4 -3
- package/aws-data-api/pg/driver.js +14 -6
- package/aws-data-api/pg/driver.js.map +1 -1
- package/aws-data-api/pg/session.cjs +26 -9
- package/aws-data-api/pg/session.cjs.map +1 -1
- package/aws-data-api/pg/session.d.cts +5 -4
- package/aws-data-api/pg/session.d.ts +5 -4
- package/aws-data-api/pg/session.js +26 -9
- package/aws-data-api/pg/session.js.map +1 -1
- package/better-sqlite3/driver.cjs.map +1 -1
- package/better-sqlite3/driver.d.cts +4 -3
- package/better-sqlite3/driver.d.ts +4 -3
- package/better-sqlite3/driver.js.map +1 -1
- package/better-sqlite3/session.cjs +4 -4
- package/better-sqlite3/session.cjs.map +1 -1
- package/better-sqlite3/session.d.cts +4 -4
- package/better-sqlite3/session.d.ts +4 -4
- package/better-sqlite3/session.js +4 -4
- package/better-sqlite3/session.js.map +1 -1
- package/bun-sql/driver.cjs +3 -2
- package/bun-sql/driver.cjs.map +1 -1
- package/bun-sql/driver.d.cts +4 -3
- package/bun-sql/driver.d.ts +4 -3
- package/bun-sql/driver.js +3 -2
- package/bun-sql/driver.js.map +1 -1
- package/bun-sql/session.cjs +20 -11
- package/bun-sql/session.cjs.map +1 -1
- package/bun-sql/session.d.cts +6 -5
- package/bun-sql/session.d.ts +6 -5
- package/bun-sql/session.js +20 -11
- package/bun-sql/session.js.map +1 -1
- package/bun-sqlite/driver.cjs.map +1 -1
- package/bun-sqlite/driver.d.cts +4 -3
- package/bun-sqlite/driver.d.ts +4 -3
- package/bun-sqlite/driver.js.map +1 -1
- package/bun-sqlite/session.cjs +4 -4
- package/bun-sqlite/session.cjs.map +1 -1
- package/bun-sqlite/session.d.cts +4 -4
- package/bun-sqlite/session.d.ts +4 -4
- package/bun-sqlite/session.js +4 -4
- package/bun-sqlite/session.js.map +1 -1
- package/column-builder.cjs.map +1 -1
- package/column-builder.d.cts +7 -2
- package/column-builder.d.ts +7 -2
- package/column-builder.js.map +1 -1
- package/column.cjs +2 -0
- package/column.cjs.map +1 -1
- package/column.d.cts +6 -0
- package/column.d.ts +6 -0
- package/column.js +2 -0
- package/column.js.map +1 -1
- package/d1/driver.cjs +9 -2
- package/d1/driver.cjs.map +1 -1
- package/d1/driver.d.cts +2 -1
- package/d1/driver.d.ts +2 -1
- package/d1/driver.js +9 -2
- package/d1/driver.js.map +1 -1
- package/d1/session.cjs +20 -11
- package/d1/session.cjs.map +1 -1
- package/d1/session.d.cts +8 -7
- package/d1/session.d.ts +8 -7
- package/d1/session.js +20 -11
- package/d1/session.js.map +1 -1
- package/durable-sqlite/driver.cjs.map +1 -1
- package/durable-sqlite/driver.d.cts +2 -1
- package/durable-sqlite/driver.d.ts +2 -1
- package/durable-sqlite/driver.js.map +1 -1
- package/durable-sqlite/session.cjs +5 -5
- package/durable-sqlite/session.cjs.map +1 -1
- package/durable-sqlite/session.d.cts +4 -4
- package/durable-sqlite/session.d.ts +4 -4
- package/durable-sqlite/session.js +5 -5
- package/durable-sqlite/session.js.map +1 -1
- package/expo-sqlite/driver.cjs.map +1 -1
- package/expo-sqlite/driver.d.cts +2 -1
- package/expo-sqlite/driver.d.ts +2 -1
- package/expo-sqlite/driver.js.map +1 -1
- package/expo-sqlite/session.cjs +4 -4
- package/expo-sqlite/session.cjs.map +1 -1
- package/expo-sqlite/session.d.cts +4 -4
- package/expo-sqlite/session.d.ts +4 -4
- package/expo-sqlite/session.js +4 -4
- package/expo-sqlite/session.js.map +1 -1
- package/extension-core/gel/index.cjs +33 -0
- package/extension-core/gel/index.cjs.map +1 -0
- package/extension-core/gel/index.d.cts +67 -0
- package/extension-core/gel/index.d.ts +67 -0
- package/extension-core/gel/index.js +9 -0
- package/extension-core/gel/index.js.map +1 -0
- package/extension-core/index.cjs +42 -0
- package/extension-core/index.cjs.map +1 -0
- package/extension-core/index.d.cts +9 -0
- package/extension-core/index.d.ts +9 -0
- package/extension-core/index.js +15 -0
- package/extension-core/index.js.map +1 -0
- package/extension-core/mysql/index.cjs +33 -0
- package/extension-core/mysql/index.cjs.map +1 -0
- package/extension-core/mysql/index.d.cts +69 -0
- package/extension-core/mysql/index.d.ts +69 -0
- package/extension-core/mysql/index.js +9 -0
- package/extension-core/mysql/index.js.map +1 -0
- package/extension-core/pg/index.cjs +33 -0
- package/extension-core/pg/index.cjs.map +1 -0
- package/extension-core/pg/index.d.cts +67 -0
- package/extension-core/pg/index.d.ts +67 -0
- package/extension-core/pg/index.js +9 -0
- package/extension-core/pg/index.js.map +1 -0
- package/extension-core/singlestore/index.cjs +33 -0
- package/extension-core/singlestore/index.cjs.map +1 -0
- package/extension-core/singlestore/index.d.cts +67 -0
- package/extension-core/singlestore/index.d.ts +67 -0
- package/extension-core/singlestore/index.js +9 -0
- package/extension-core/singlestore/index.js.map +1 -0
- package/extension-core/sqlite/index.cjs +33 -0
- package/extension-core/sqlite/index.cjs.map +1 -0
- package/extension-core/sqlite/index.d.cts +68 -0
- package/extension-core/sqlite/index.d.ts +68 -0
- package/extension-core/sqlite/index.js +9 -0
- package/extension-core/sqlite/index.js.map +1 -0
- package/extensions/hook/gel/index.cjs +47 -0
- package/extensions/hook/gel/index.cjs.map +1 -0
- package/extensions/hook/gel/index.d.cts +11 -0
- package/extensions/hook/gel/index.d.ts +11 -0
- package/extensions/hook/gel/index.js +22 -0
- package/extensions/hook/gel/index.js.map +1 -0
- package/extensions/hook/mysql/index.cjs +47 -0
- package/extensions/hook/mysql/index.cjs.map +1 -0
- package/extensions/hook/mysql/index.d.cts +11 -0
- package/extensions/hook/mysql/index.d.ts +11 -0
- package/extensions/hook/mysql/index.js +22 -0
- package/extensions/hook/mysql/index.js.map +1 -0
- package/extensions/hook/pg/index.cjs +47 -0
- package/extensions/hook/pg/index.cjs.map +1 -0
- package/extensions/hook/pg/index.d.cts +11 -0
- package/extensions/hook/pg/index.d.ts +11 -0
- package/extensions/hook/pg/index.js +22 -0
- package/extensions/hook/pg/index.js.map +1 -0
- package/extensions/hook/singlestore/index.cjs +47 -0
- package/extensions/hook/singlestore/index.cjs.map +1 -0
- package/extensions/hook/singlestore/index.d.cts +11 -0
- package/extensions/hook/singlestore/index.d.ts +11 -0
- package/extensions/hook/singlestore/index.js +22 -0
- package/extensions/hook/singlestore/index.js.map +1 -0
- package/extensions/hook/sqlite/index.cjs +47 -0
- package/extensions/hook/sqlite/index.cjs.map +1 -0
- package/extensions/hook/sqlite/index.d.cts +11 -0
- package/extensions/hook/sqlite/index.d.ts +11 -0
- package/extensions/hook/sqlite/index.js +22 -0
- package/extensions/hook/sqlite/index.js.map +1 -0
- package/extensions/s3-file/common.cjs +313 -0
- package/extensions/s3-file/common.cjs.map +1 -0
- package/extensions/s3-file/common.d.cts +88 -0
- package/extensions/s3-file/common.d.ts +88 -0
- package/extensions/s3-file/common.js +280 -0
- package/extensions/s3-file/common.js.map +1 -0
- package/extensions/s3-file/gel/column.cjs +113 -0
- package/extensions/s3-file/gel/column.cjs.map +1 -0
- package/extensions/s3-file/gel/column.d.cts +105 -0
- package/extensions/s3-file/gel/column.d.ts +105 -0
- package/extensions/s3-file/gel/column.js +92 -0
- package/extensions/s3-file/gel/column.js.map +1 -0
- package/extensions/s3-file/gel/extension.cjs +262 -0
- package/extensions/s3-file/gel/extension.cjs.map +1 -0
- package/extensions/s3-file/gel/extension.d.cts +18 -0
- package/extensions/s3-file/gel/extension.d.ts +18 -0
- package/extensions/s3-file/gel/extension.js +248 -0
- package/extensions/s3-file/gel/extension.js.map +1 -0
- package/extensions/s3-file/gel/index.cjs +25 -0
- package/extensions/s3-file/gel/index.cjs.map +1 -0
- package/extensions/s3-file/gel/index.d.cts +2 -0
- package/extensions/s3-file/gel/index.d.ts +2 -0
- package/extensions/s3-file/gel/index.js +3 -0
- package/extensions/s3-file/gel/index.js.map +1 -0
- package/extensions/s3-file/index.cjs +23 -0
- package/extensions/s3-file/index.cjs.map +1 -0
- package/extensions/s3-file/index.d.cts +1 -0
- package/extensions/s3-file/index.d.ts +1 -0
- package/extensions/s3-file/index.js +2 -0
- package/extensions/s3-file/index.js.map +1 -0
- package/extensions/s3-file/mysql/column.cjs +110 -0
- package/extensions/s3-file/mysql/column.cjs.map +1 -0
- package/extensions/s3-file/mysql/column.d.cts +63 -0
- package/extensions/s3-file/mysql/column.d.ts +63 -0
- package/extensions/s3-file/mysql/column.js +86 -0
- package/extensions/s3-file/mysql/column.js.map +1 -0
- package/extensions/s3-file/mysql/extension.cjs +242 -0
- package/extensions/s3-file/mysql/extension.cjs.map +1 -0
- package/extensions/s3-file/mysql/extension.d.cts +18 -0
- package/extensions/s3-file/mysql/extension.d.ts +18 -0
- package/extensions/s3-file/mysql/extension.js +228 -0
- package/extensions/s3-file/mysql/extension.js.map +1 -0
- package/extensions/s3-file/mysql/index.cjs +25 -0
- package/extensions/s3-file/mysql/index.cjs.map +1 -0
- package/extensions/s3-file/mysql/index.d.cts +2 -0
- package/extensions/s3-file/mysql/index.d.ts +2 -0
- package/extensions/s3-file/mysql/index.js +3 -0
- package/extensions/s3-file/mysql/index.js.map +1 -0
- package/extensions/s3-file/pg/column.cjs +113 -0
- package/extensions/s3-file/pg/column.cjs.map +1 -0
- package/extensions/s3-file/pg/column.d.cts +105 -0
- package/extensions/s3-file/pg/column.d.ts +105 -0
- package/extensions/s3-file/pg/column.js +92 -0
- package/extensions/s3-file/pg/column.js.map +1 -0
- package/extensions/s3-file/pg/extension.cjs +264 -0
- package/extensions/s3-file/pg/extension.cjs.map +1 -0
- package/extensions/s3-file/pg/extension.d.cts +18 -0
- package/extensions/s3-file/pg/extension.d.ts +18 -0
- package/extensions/s3-file/pg/extension.js +250 -0
- package/extensions/s3-file/pg/extension.js.map +1 -0
- package/extensions/s3-file/pg/index.cjs +25 -0
- package/extensions/s3-file/pg/index.cjs.map +1 -0
- package/extensions/s3-file/pg/index.d.cts +2 -0
- package/extensions/s3-file/pg/index.d.ts +2 -0
- package/extensions/s3-file/pg/index.js +3 -0
- package/extensions/s3-file/pg/index.js.map +1 -0
- package/extensions/s3-file/singlestore/column.cjs +110 -0
- package/extensions/s3-file/singlestore/column.cjs.map +1 -0
- package/extensions/s3-file/singlestore/column.d.cts +63 -0
- package/extensions/s3-file/singlestore/column.d.ts +63 -0
- package/extensions/s3-file/singlestore/column.js +86 -0
- package/extensions/s3-file/singlestore/column.js.map +1 -0
- package/extensions/s3-file/singlestore/extension.cjs +239 -0
- package/extensions/s3-file/singlestore/extension.cjs.map +1 -0
- package/extensions/s3-file/singlestore/extension.d.cts +18 -0
- package/extensions/s3-file/singlestore/extension.d.ts +18 -0
- package/extensions/s3-file/singlestore/extension.js +225 -0
- package/extensions/s3-file/singlestore/extension.js.map +1 -0
- package/extensions/s3-file/singlestore/index.cjs +25 -0
- package/extensions/s3-file/singlestore/index.cjs.map +1 -0
- package/extensions/s3-file/singlestore/index.d.cts +2 -0
- package/extensions/s3-file/singlestore/index.d.ts +2 -0
- package/extensions/s3-file/singlestore/index.js +3 -0
- package/extensions/s3-file/singlestore/index.js.map +1 -0
- package/extensions/s3-file/sqlite/column.cjs +110 -0
- package/extensions/s3-file/sqlite/column.cjs.map +1 -0
- package/extensions/s3-file/sqlite/column.d.cts +63 -0
- package/extensions/s3-file/sqlite/column.d.ts +63 -0
- package/extensions/s3-file/sqlite/column.js +86 -0
- package/extensions/s3-file/sqlite/column.js.map +1 -0
- package/extensions/s3-file/sqlite/extension.cjs +242 -0
- package/extensions/s3-file/sqlite/extension.cjs.map +1 -0
- package/extensions/s3-file/sqlite/extension.d.cts +18 -0
- package/extensions/s3-file/sqlite/extension.d.ts +18 -0
- package/extensions/s3-file/sqlite/extension.js +228 -0
- package/extensions/s3-file/sqlite/extension.js.map +1 -0
- package/extensions/s3-file/sqlite/index.cjs +25 -0
- package/extensions/s3-file/sqlite/index.cjs.map +1 -0
- package/extensions/s3-file/sqlite/index.d.cts +2 -0
- package/extensions/s3-file/sqlite/index.d.ts +2 -0
- package/extensions/s3-file/sqlite/index.js +3 -0
- package/extensions/s3-file/sqlite/index.js.map +1 -0
- package/gel/driver.cjs +6 -4
- package/gel/driver.cjs.map +1 -1
- package/gel/driver.d.cts +6 -4
- package/gel/driver.d.ts +6 -4
- package/gel/driver.js +6 -4
- package/gel/driver.js.map +1 -1
- package/gel/session.cjs +12 -9
- package/gel/session.cjs.map +1 -1
- package/gel/session.d.cts +5 -4
- package/gel/session.d.ts +5 -4
- package/gel/session.js +12 -9
- package/gel/session.js.map +1 -1
- package/gel-core/columns/common.cjs +8 -0
- package/gel-core/columns/common.cjs.map +1 -1
- package/gel-core/columns/common.d.cts +2 -0
- package/gel-core/columns/common.d.ts +2 -0
- package/gel-core/columns/common.js +8 -0
- package/gel-core/columns/common.js.map +1 -1
- package/gel-core/db.cjs +5 -3
- package/gel-core/db.cjs.map +1 -1
- package/gel-core/db.d.cts +3 -1
- package/gel-core/db.d.ts +3 -1
- package/gel-core/db.js +5 -3
- package/gel-core/db.js.map +1 -1
- package/gel-core/dialect.cjs +24 -19
- package/gel-core/dialect.cjs.map +1 -1
- package/gel-core/dialect.d.cts +7 -6
- package/gel-core/dialect.d.ts +7 -6
- package/gel-core/dialect.js +25 -20
- package/gel-core/dialect.js.map +1 -1
- package/gel-core/query-builders/delete.cjs +19 -5
- package/gel-core/query-builders/delete.cjs.map +1 -1
- package/gel-core/query-builders/delete.js +19 -5
- package/gel-core/query-builders/delete.js.map +1 -1
- package/gel-core/query-builders/insert.cjs +44 -9
- package/gel-core/query-builders/insert.cjs.map +1 -1
- package/gel-core/query-builders/insert.js +46 -11
- package/gel-core/query-builders/insert.js.map +1 -1
- package/gel-core/query-builders/query.cjs +15 -2
- package/gel-core/query-builders/query.cjs.map +1 -1
- package/gel-core/query-builders/query.js +15 -2
- package/gel-core/query-builders/query.js.map +1 -1
- package/gel-core/query-builders/select.cjs +21 -5
- package/gel-core/query-builders/select.cjs.map +1 -1
- package/gel-core/query-builders/select.d.cts +9 -9
- package/gel-core/query-builders/select.d.ts +9 -9
- package/gel-core/query-builders/select.js +21 -5
- package/gel-core/query-builders/select.js.map +1 -1
- package/gel-core/query-builders/select.types.cjs.map +1 -1
- package/gel-core/query-builders/select.types.d.cts +2 -1
- package/gel-core/query-builders/select.types.d.ts +2 -1
- package/gel-core/query-builders/update.cjs +20 -6
- package/gel-core/query-builders/update.cjs.map +1 -1
- package/gel-core/query-builders/update.js +20 -6
- package/gel-core/query-builders/update.js.map +1 -1
- package/gel-core/session.cjs +47 -4
- package/gel-core/session.cjs.map +1 -1
- package/gel-core/session.d.cts +11 -5
- package/gel-core/session.d.ts +11 -5
- package/gel-core/session.js +47 -4
- package/gel-core/session.js.map +1 -1
- package/libsql/driver-core.cjs +3 -2
- package/libsql/driver-core.cjs.map +1 -1
- package/libsql/driver-core.js +3 -2
- package/libsql/driver-core.js.map +1 -1
- package/libsql/driver.cjs +4 -1
- package/libsql/driver.cjs.map +1 -1
- package/libsql/driver.d.cts +4 -3
- package/libsql/driver.d.ts +4 -3
- package/libsql/driver.js +4 -1
- package/libsql/driver.js.map +1 -1
- package/libsql/http/index.cjs +4 -1
- package/libsql/http/index.cjs.map +1 -1
- package/libsql/http/index.d.cts +4 -3
- package/libsql/http/index.d.ts +4 -3
- package/libsql/http/index.js +4 -1
- package/libsql/http/index.js.map +1 -1
- package/libsql/node/index.cjs +4 -1
- package/libsql/node/index.cjs.map +1 -1
- package/libsql/node/index.d.cts +4 -3
- package/libsql/node/index.d.ts +4 -3
- package/libsql/node/index.js +4 -1
- package/libsql/node/index.js.map +1 -1
- package/libsql/session.cjs +29 -12
- package/libsql/session.cjs.map +1 -1
- package/libsql/session.d.cts +8 -7
- package/libsql/session.d.ts +8 -7
- package/libsql/session.js +29 -12
- package/libsql/session.js.map +1 -1
- package/libsql/sqlite3/index.cjs +4 -1
- package/libsql/sqlite3/index.cjs.map +1 -1
- package/libsql/sqlite3/index.d.cts +4 -3
- package/libsql/sqlite3/index.d.ts +4 -3
- package/libsql/sqlite3/index.js +4 -1
- package/libsql/sqlite3/index.js.map +1 -1
- package/libsql/wasm/index.cjs +4 -1
- package/libsql/wasm/index.cjs.map +1 -1
- package/libsql/wasm/index.d.cts +4 -3
- package/libsql/wasm/index.d.ts +4 -3
- package/libsql/wasm/index.js +4 -1
- package/libsql/wasm/index.js.map +1 -1
- package/libsql/web/index.cjs +4 -1
- package/libsql/web/index.cjs.map +1 -1
- package/libsql/web/index.d.cts +4 -3
- package/libsql/web/index.d.ts +4 -3
- package/libsql/web/index.js +4 -1
- package/libsql/web/index.js.map +1 -1
- package/libsql/ws/index.cjs +4 -1
- package/libsql/ws/index.cjs.map +1 -1
- package/libsql/ws/index.d.cts +4 -3
- package/libsql/ws/index.d.ts +4 -3
- package/libsql/ws/index.js +4 -1
- package/libsql/ws/index.js.map +1 -1
- package/mysql-core/db.cjs +5 -3
- package/mysql-core/db.cjs.map +1 -1
- package/mysql-core/db.d.cts +3 -1
- package/mysql-core/db.d.ts +3 -1
- package/mysql-core/db.js +5 -3
- package/mysql-core/db.js.map +1 -1
- package/mysql-core/dialect.cjs +29 -23
- package/mysql-core/dialect.cjs.map +1 -1
- package/mysql-core/dialect.d.cts +8 -7
- package/mysql-core/dialect.d.ts +8 -7
- package/mysql-core/dialect.js +30 -24
- package/mysql-core/dialect.js.map +1 -1
- package/mysql-core/query-builders/delete.cjs +8 -1
- package/mysql-core/query-builders/delete.cjs.map +1 -1
- package/mysql-core/query-builders/delete.js +8 -1
- package/mysql-core/query-builders/delete.js.map +1 -1
- package/mysql-core/query-builders/insert.cjs +30 -6
- package/mysql-core/query-builders/insert.cjs.map +1 -1
- package/mysql-core/query-builders/insert.js +32 -8
- package/mysql-core/query-builders/insert.js.map +1 -1
- package/mysql-core/query-builders/query.cjs +19 -3
- package/mysql-core/query-builders/query.cjs.map +1 -1
- package/mysql-core/query-builders/query.js +19 -3
- package/mysql-core/query-builders/query.js.map +1 -1
- package/mysql-core/query-builders/select.cjs +23 -6
- package/mysql-core/query-builders/select.cjs.map +1 -1
- package/mysql-core/query-builders/select.d.cts +8 -8
- package/mysql-core/query-builders/select.d.ts +8 -8
- package/mysql-core/query-builders/select.js +23 -6
- package/mysql-core/query-builders/select.js.map +1 -1
- package/mysql-core/query-builders/select.types.cjs.map +1 -1
- package/mysql-core/query-builders/select.types.d.cts +2 -1
- package/mysql-core/query-builders/select.types.d.ts +2 -1
- package/mysql-core/query-builders/update.cjs +15 -3
- package/mysql-core/query-builders/update.cjs.map +1 -1
- package/mysql-core/query-builders/update.js +15 -3
- package/mysql-core/query-builders/update.js.map +1 -1
- package/mysql-core/session.cjs +43 -4
- package/mysql-core/session.cjs.map +1 -1
- package/mysql-core/session.d.cts +14 -7
- package/mysql-core/session.d.ts +14 -7
- package/mysql-core/session.js +43 -4
- package/mysql-core/session.js.map +1 -1
- package/mysql-proxy/driver.cjs +3 -2
- package/mysql-proxy/driver.cjs.map +1 -1
- package/mysql-proxy/driver.d.cts +2 -1
- package/mysql-proxy/driver.d.ts +2 -1
- package/mysql-proxy/driver.js +3 -2
- package/mysql-proxy/driver.js.map +1 -1
- package/mysql-proxy/session.cjs +8 -8
- package/mysql-proxy/session.cjs.map +1 -1
- package/mysql-proxy/session.d.cts +5 -6
- package/mysql-proxy/session.d.ts +5 -6
- package/mysql-proxy/session.js +8 -8
- package/mysql-proxy/session.js.map +1 -1
- package/mysql2/driver.cjs +11 -4
- package/mysql2/driver.cjs.map +1 -1
- package/mysql2/driver.d.cts +4 -2
- package/mysql2/driver.d.ts +4 -2
- package/mysql2/driver.js +11 -4
- package/mysql2/driver.js.map +1 -1
- package/mysql2/session.cjs +14 -10
- package/mysql2/session.cjs.map +1 -1
- package/mysql2/session.d.cts +5 -5
- package/mysql2/session.d.ts +5 -5
- package/mysql2/session.js +14 -10
- package/mysql2/session.js.map +1 -1
- package/neon-http/driver.cjs +5 -3
- package/neon-http/driver.cjs.map +1 -1
- package/neon-http/driver.d.cts +6 -4
- package/neon-http/driver.d.ts +6 -4
- package/neon-http/driver.js +5 -3
- package/neon-http/driver.js.map +1 -1
- package/neon-http/session.cjs +8 -6
- package/neon-http/session.cjs.map +1 -1
- package/neon-http/session.d.cts +5 -4
- package/neon-http/session.d.ts +5 -4
- package/neon-http/session.js +8 -6
- package/neon-http/session.js.map +1 -1
- package/neon-serverless/driver.cjs +6 -4
- package/neon-serverless/driver.cjs.map +1 -1
- package/neon-serverless/driver.d.cts +6 -4
- package/neon-serverless/driver.d.ts +6 -4
- package/neon-serverless/driver.js +6 -4
- package/neon-serverless/driver.js.map +1 -1
- package/neon-serverless/session.cjs +23 -9
- package/neon-serverless/session.cjs.map +1 -1
- package/neon-serverless/session.d.cts +5 -4
- package/neon-serverless/session.d.ts +5 -4
- package/neon-serverless/session.js +23 -9
- package/neon-serverless/session.js.map +1 -1
- package/node-postgres/driver.cjs +6 -4
- package/node-postgres/driver.cjs.map +1 -1
- package/node-postgres/driver.d.cts +6 -4
- package/node-postgres/driver.d.ts +6 -4
- package/node-postgres/driver.js +6 -4
- package/node-postgres/driver.js.map +1 -1
- package/node-postgres/session.cjs +18 -9
- package/node-postgres/session.cjs.map +1 -1
- package/node-postgres/session.d.cts +5 -4
- package/node-postgres/session.d.ts +5 -4
- package/node-postgres/session.js +18 -9
- package/node-postgres/session.js.map +1 -1
- package/op-sqlite/driver.cjs +3 -2
- package/op-sqlite/driver.cjs.map +1 -1
- package/op-sqlite/driver.d.cts +2 -1
- package/op-sqlite/driver.d.ts +2 -1
- package/op-sqlite/driver.js +3 -2
- package/op-sqlite/driver.js.map +1 -1
- package/op-sqlite/session.cjs +20 -11
- package/op-sqlite/session.cjs.map +1 -1
- package/op-sqlite/session.d.cts +8 -7
- package/op-sqlite/session.d.ts +8 -7
- package/op-sqlite/session.js +20 -11
- package/op-sqlite/session.js.map +1 -1
- package/package.json +351 -5
- package/pg-core/columns/common.cjs +2 -0
- package/pg-core/columns/common.cjs.map +1 -1
- package/pg-core/columns/common.js +2 -0
- package/pg-core/columns/common.js.map +1 -1
- package/pg-core/db.cjs +5 -3
- package/pg-core/db.cjs.map +1 -1
- package/pg-core/db.d.cts +3 -1
- package/pg-core/db.d.ts +3 -1
- package/pg-core/db.js +5 -3
- package/pg-core/db.js.map +1 -1
- package/pg-core/dialect.cjs +25 -19
- package/pg-core/dialect.cjs.map +1 -1
- package/pg-core/dialect.d.cts +7 -6
- package/pg-core/dialect.d.ts +7 -6
- package/pg-core/dialect.js +26 -20
- package/pg-core/dialect.js.map +1 -1
- package/pg-core/query-builders/delete.cjs +19 -5
- package/pg-core/query-builders/delete.cjs.map +1 -1
- package/pg-core/query-builders/delete.js +19 -5
- package/pg-core/query-builders/delete.js.map +1 -1
- package/pg-core/query-builders/insert.cjs +49 -9
- package/pg-core/query-builders/insert.cjs.map +1 -1
- package/pg-core/query-builders/insert.js +51 -11
- package/pg-core/query-builders/insert.js.map +1 -1
- package/pg-core/query-builders/query.cjs +15 -2
- package/pg-core/query-builders/query.cjs.map +1 -1
- package/pg-core/query-builders/query.js +15 -2
- package/pg-core/query-builders/query.js.map +1 -1
- package/pg-core/query-builders/select.cjs +23 -7
- package/pg-core/query-builders/select.cjs.map +1 -1
- package/pg-core/query-builders/select.d.cts +9 -9
- package/pg-core/query-builders/select.d.ts +9 -9
- package/pg-core/query-builders/select.js +23 -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 +2 -1
- package/pg-core/query-builders/select.types.d.ts +2 -1
- package/pg-core/query-builders/update.cjs +20 -6
- package/pg-core/query-builders/update.cjs.map +1 -1
- package/pg-core/query-builders/update.js +20 -6
- package/pg-core/query-builders/update.js.map +1 -1
- package/pg-core/session.cjs +48 -4
- package/pg-core/session.cjs.map +1 -1
- package/pg-core/session.d.cts +12 -6
- package/pg-core/session.d.ts +12 -6
- package/pg-core/session.js +48 -4
- package/pg-core/session.js.map +1 -1
- package/pg-proxy/driver.cjs +3 -2
- package/pg-proxy/driver.cjs.map +1 -1
- package/pg-proxy/driver.d.cts +2 -1
- package/pg-proxy/driver.d.ts +2 -1
- package/pg-proxy/driver.js +3 -2
- package/pg-proxy/driver.js.map +1 -1
- package/pg-proxy/session.cjs +8 -6
- package/pg-proxy/session.cjs.map +1 -1
- package/pg-proxy/session.d.cts +5 -4
- package/pg-proxy/session.d.ts +5 -4
- package/pg-proxy/session.js +8 -6
- package/pg-proxy/session.js.map +1 -1
- package/pglite/driver.cjs +6 -4
- package/pglite/driver.cjs.map +1 -1
- package/pglite/driver.d.cts +6 -4
- package/pglite/driver.d.ts +6 -4
- package/pglite/driver.js +6 -4
- package/pglite/driver.js.map +1 -1
- package/pglite/session.cjs +19 -9
- package/pglite/session.cjs.map +1 -1
- package/pglite/session.d.cts +5 -4
- package/pglite/session.d.ts +5 -4
- package/pglite/session.js +19 -9
- package/pglite/session.js.map +1 -1
- package/planetscale-serverless/driver.cjs +10 -2
- package/planetscale-serverless/driver.cjs.map +1 -1
- package/planetscale-serverless/driver.d.cts +4 -3
- package/planetscale-serverless/driver.d.ts +4 -3
- package/planetscale-serverless/driver.js +10 -2
- package/planetscale-serverless/driver.js.map +1 -1
- package/planetscale-serverless/session.cjs +23 -13
- package/planetscale-serverless/session.cjs.map +1 -1
- package/planetscale-serverless/session.d.cts +6 -7
- package/planetscale-serverless/session.d.ts +6 -7
- package/planetscale-serverless/session.js +23 -13
- package/planetscale-serverless/session.js.map +1 -1
- package/postgres-js/driver.cjs +3 -2
- package/postgres-js/driver.cjs.map +1 -1
- package/postgres-js/driver.d.cts +4 -3
- package/postgres-js/driver.d.ts +4 -3
- package/postgres-js/driver.js +3 -2
- package/postgres-js/driver.js.map +1 -1
- package/postgres-js/session.cjs +27 -16
- package/postgres-js/session.cjs.map +1 -1
- package/postgres-js/session.d.cts +6 -5
- package/postgres-js/session.d.ts +6 -5
- package/postgres-js/session.js +27 -16
- package/postgres-js/session.js.map +1 -1
- package/prisma/mysql/driver.cjs +3 -3
- package/prisma/mysql/driver.cjs.map +1 -1
- package/prisma/mysql/driver.d.cts +3 -2
- package/prisma/mysql/driver.d.ts +3 -2
- package/prisma/mysql/driver.js +3 -3
- package/prisma/mysql/driver.js.map +1 -1
- package/prisma/mysql/session.cjs +10 -11
- package/prisma/mysql/session.cjs.map +1 -1
- package/prisma/mysql/session.d.cts +10 -5
- package/prisma/mysql/session.d.ts +10 -5
- package/prisma/mysql/session.js +10 -11
- package/prisma/mysql/session.js.map +1 -1
- package/prisma/pg/driver.cjs +3 -3
- package/prisma/pg/driver.cjs.map +1 -1
- package/prisma/pg/driver.d.cts +2 -1
- package/prisma/pg/driver.d.ts +2 -1
- package/prisma/pg/driver.js +3 -3
- package/prisma/pg/driver.js.map +1 -1
- package/prisma/pg/session.cjs +7 -7
- package/prisma/pg/session.cjs.map +1 -1
- package/prisma/pg/session.d.cts +10 -5
- package/prisma/pg/session.d.ts +10 -5
- package/prisma/pg/session.js +7 -7
- package/prisma/pg/session.js.map +1 -1
- package/prisma/sqlite/driver.cjs +7 -1
- package/prisma/sqlite/driver.cjs.map +1 -1
- package/prisma/sqlite/driver.d.cts +2 -1
- package/prisma/sqlite/driver.d.ts +2 -1
- package/prisma/sqlite/driver.js +7 -1
- package/prisma/sqlite/driver.js.map +1 -1
- package/prisma/sqlite/session.cjs +10 -10
- package/prisma/sqlite/session.cjs.map +1 -1
- package/prisma/sqlite/session.d.cts +12 -7
- package/prisma/sqlite/session.d.ts +12 -7
- package/prisma/sqlite/session.js +10 -10
- package/prisma/sqlite/session.js.map +1 -1
- package/singlestore/driver.cjs +34 -25
- package/singlestore/driver.cjs.map +1 -1
- package/singlestore/driver.d.cts +4 -2
- package/singlestore/driver.d.ts +4 -2
- package/singlestore/driver.js +34 -25
- package/singlestore/driver.js.map +1 -1
- package/singlestore/session.cjs +14 -10
- package/singlestore/session.cjs.map +1 -1
- package/singlestore/session.d.cts +5 -5
- package/singlestore/session.d.ts +5 -5
- package/singlestore/session.js +14 -10
- package/singlestore/session.js.map +1 -1
- package/singlestore-core/db.cjs +5 -3
- package/singlestore-core/db.cjs.map +1 -1
- package/singlestore-core/db.d.cts +3 -1
- package/singlestore-core/db.d.ts +3 -1
- package/singlestore-core/db.js +5 -3
- package/singlestore-core/db.js.map +1 -1
- package/singlestore-core/dialect.cjs +24 -18
- package/singlestore-core/dialect.cjs.map +1 -1
- package/singlestore-core/dialect.d.cts +7 -6
- package/singlestore-core/dialect.d.ts +7 -6
- package/singlestore-core/dialect.js +25 -19
- package/singlestore-core/dialect.js.map +1 -1
- package/singlestore-core/query-builders/delete.cjs +8 -1
- package/singlestore-core/query-builders/delete.cjs.map +1 -1
- package/singlestore-core/query-builders/delete.js +8 -1
- package/singlestore-core/query-builders/delete.js.map +1 -1
- package/singlestore-core/query-builders/insert.cjs +30 -5
- package/singlestore-core/query-builders/insert.cjs.map +1 -1
- package/singlestore-core/query-builders/insert.js +32 -7
- package/singlestore-core/query-builders/insert.js.map +1 -1
- package/singlestore-core/query-builders/query.cjs +17 -2
- package/singlestore-core/query-builders/query.cjs.map +1 -1
- package/singlestore-core/query-builders/query.js +17 -2
- package/singlestore-core/query-builders/query.js.map +1 -1
- package/singlestore-core/query-builders/select.cjs +24 -7
- package/singlestore-core/query-builders/select.cjs.map +1 -1
- package/singlestore-core/query-builders/select.d.cts +9 -9
- package/singlestore-core/query-builders/select.d.ts +9 -9
- package/singlestore-core/query-builders/select.js +24 -7
- package/singlestore-core/query-builders/select.js.map +1 -1
- package/singlestore-core/query-builders/select.types.cjs.map +1 -1
- package/singlestore-core/query-builders/select.types.d.cts +2 -1
- package/singlestore-core/query-builders/select.types.d.ts +2 -1
- package/singlestore-core/query-builders/update.cjs +9 -2
- package/singlestore-core/query-builders/update.cjs.map +1 -1
- package/singlestore-core/query-builders/update.js +9 -2
- package/singlestore-core/query-builders/update.js.map +1 -1
- package/singlestore-core/session.cjs +43 -4
- package/singlestore-core/session.cjs.map +1 -1
- package/singlestore-core/session.d.cts +14 -6
- package/singlestore-core/session.d.ts +14 -6
- package/singlestore-core/session.js +43 -4
- package/singlestore-core/session.js.map +1 -1
- package/singlestore-proxy/driver.cjs +3 -2
- package/singlestore-proxy/driver.cjs.map +1 -1
- package/singlestore-proxy/driver.d.cts +2 -1
- package/singlestore-proxy/driver.d.ts +2 -1
- package/singlestore-proxy/driver.js +3 -2
- package/singlestore-proxy/driver.js.map +1 -1
- package/singlestore-proxy/session.cjs +8 -8
- package/singlestore-proxy/session.cjs.map +1 -1
- package/singlestore-proxy/session.d.cts +9 -6
- package/singlestore-proxy/session.d.ts +9 -6
- package/singlestore-proxy/session.js +8 -8
- package/singlestore-proxy/session.js.map +1 -1
- package/sql/sql.cjs +24 -2
- package/sql/sql.cjs.map +1 -1
- package/sql/sql.d.cts +12 -0
- package/sql/sql.d.ts +12 -0
- package/sql/sql.js +23 -2
- package/sql/sql.js.map +1 -1
- package/sql-js/driver.cjs.map +1 -1
- package/sql-js/driver.d.cts +2 -1
- package/sql-js/driver.d.ts +2 -1
- package/sql-js/driver.js.map +1 -1
- package/sql-js/session.cjs +4 -4
- package/sql-js/session.cjs.map +1 -1
- package/sql-js/session.d.cts +4 -4
- package/sql-js/session.d.ts +4 -4
- package/sql-js/session.js +4 -4
- package/sql-js/session.js.map +1 -1
- package/sqlite-core/db.cjs +5 -3
- package/sqlite-core/db.cjs.map +1 -1
- package/sqlite-core/db.d.cts +3 -1
- package/sqlite-core/db.d.ts +3 -1
- package/sqlite-core/db.js +5 -3
- package/sqlite-core/db.js.map +1 -1
- package/sqlite-core/dialect.cjs +29 -19
- package/sqlite-core/dialect.cjs.map +1 -1
- package/sqlite-core/dialect.d.cts +7 -6
- package/sqlite-core/dialect.d.ts +7 -6
- package/sqlite-core/dialect.js +30 -20
- package/sqlite-core/dialect.js.map +1 -1
- package/sqlite-core/query-builders/delete.cjs +8 -1
- package/sqlite-core/query-builders/delete.cjs.map +1 -1
- package/sqlite-core/query-builders/delete.js +8 -1
- package/sqlite-core/query-builders/delete.js.map +1 -1
- package/sqlite-core/query-builders/insert.cjs +28 -4
- package/sqlite-core/query-builders/insert.cjs.map +1 -1
- package/sqlite-core/query-builders/insert.js +35 -6
- package/sqlite-core/query-builders/insert.js.map +1 -1
- package/sqlite-core/query-builders/query.cjs +15 -2
- package/sqlite-core/query-builders/query.cjs.map +1 -1
- package/sqlite-core/query-builders/query.js +15 -2
- package/sqlite-core/query-builders/query.js.map +1 -1
- package/sqlite-core/query-builders/select.cjs +15 -6
- package/sqlite-core/query-builders/select.cjs.map +1 -1
- package/sqlite-core/query-builders/select.d.cts +6 -6
- package/sqlite-core/query-builders/select.d.ts +6 -6
- package/sqlite-core/query-builders/select.js +15 -6
- package/sqlite-core/query-builders/select.js.map +1 -1
- package/sqlite-core/query-builders/select.types.cjs.map +1 -1
- package/sqlite-core/query-builders/select.types.d.cts +2 -1
- package/sqlite-core/query-builders/select.types.d.ts +2 -1
- package/sqlite-core/query-builders/update.cjs +9 -2
- package/sqlite-core/query-builders/update.cjs.map +1 -1
- package/sqlite-core/query-builders/update.js +9 -2
- package/sqlite-core/query-builders/update.js.map +1 -1
- package/sqlite-core/session.cjs +81 -6
- package/sqlite-core/session.cjs.map +1 -1
- package/sqlite-core/session.d.cts +19 -9
- package/sqlite-core/session.d.ts +19 -9
- package/sqlite-core/session.js +81 -6
- package/sqlite-core/session.js.map +1 -1
- package/sqlite-proxy/driver.cjs +4 -3
- package/sqlite-proxy/driver.cjs.map +1 -1
- package/sqlite-proxy/driver.d.cts +3 -2
- package/sqlite-proxy/driver.d.ts +3 -2
- package/sqlite-proxy/driver.js +4 -3
- package/sqlite-proxy/driver.js.map +1 -1
- package/sqlite-proxy/session.cjs +20 -11
- package/sqlite-proxy/session.cjs.map +1 -1
- package/sqlite-proxy/session.d.cts +8 -7
- package/sqlite-proxy/session.d.ts +8 -7
- package/sqlite-proxy/session.js +20 -11
- package/sqlite-proxy/session.js.map +1 -1
- package/tidb-serverless/driver.cjs +16 -2
- package/tidb-serverless/driver.cjs.map +1 -1
- package/tidb-serverless/driver.d.cts +4 -3
- package/tidb-serverless/driver.d.ts +4 -3
- package/tidb-serverless/driver.js +16 -2
- package/tidb-serverless/driver.js.map +1 -1
- package/tidb-serverless/session.cjs +23 -13
- package/tidb-serverless/session.cjs.map +1 -1
- package/tidb-serverless/session.d.cts +6 -7
- package/tidb-serverless/session.d.ts +6 -7
- package/tidb-serverless/session.js +23 -13
- package/tidb-serverless/session.js.map +1 -1
- package/tracing.cjs.map +1 -1
- package/tracing.js.map +1 -1
- package/utils.cjs +38 -2
- package/utils.cjs.map +1 -1
- package/utils.d.cts +6 -2
- package/utils.d.ts +6 -2
- package/utils.js +39 -4
- package/utils.js.map +1 -1
- package/vercel-postgres/driver.cjs +10 -5
- package/vercel-postgres/driver.cjs.map +1 -1
- package/vercel-postgres/driver.d.cts +6 -4
- package/vercel-postgres/driver.d.ts +6 -4
- package/vercel-postgres/driver.js +10 -5
- package/vercel-postgres/driver.js.map +1 -1
- package/vercel-postgres/session.cjs +18 -9
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.d.cts +5 -4
- package/vercel-postgres/session.d.ts +5 -4
- package/vercel-postgres/session.js +18 -9
- 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 +7 -4
- package/xata-http/driver.cjs.map +1 -1
- package/xata-http/driver.d.cts +4 -2
- package/xata-http/driver.d.ts +4 -2
- package/xata-http/driver.js +7 -4
- package/xata-http/driver.js.map +1 -1
- package/xata-http/session.cjs +8 -6
- package/xata-http/session.cjs.map +1 -1
- package/xata-http/session.d.cts +5 -4
- package/xata-http/session.d.ts +5 -4
- package/xata-http/session.js +8 -6
- package/xata-http/session.js.map +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
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 sqlite_exports = {};
|
|
20
|
+
__export(sqlite_exports, {
|
|
21
|
+
DrizzleSQLiteHookExtension: () => DrizzleSQLiteHookExtension,
|
|
22
|
+
hook: () => hook
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(sqlite_exports);
|
|
25
|
+
var import_entity = require("../../../entity.cjs");
|
|
26
|
+
var import_extension_core = require("../../../extension-core/index.cjs");
|
|
27
|
+
var import_sqlite = require("../../../extension-core/sqlite/index.cjs");
|
|
28
|
+
class DrizzleSQLiteHookExtension extends import_sqlite.DrizzleSQLiteExtension {
|
|
29
|
+
constructor(hookCallback) {
|
|
30
|
+
super();
|
|
31
|
+
this.hookCallback = hookCallback;
|
|
32
|
+
}
|
|
33
|
+
static [import_entity.entityKind] = "DrizzleSQLiteHookExtension";
|
|
34
|
+
static [import_extension_core.extensionName] = "Drizzle SQLite Hook";
|
|
35
|
+
hook(context) {
|
|
36
|
+
return this.hookCallback(context);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function hook(hookCallback) {
|
|
40
|
+
return new DrizzleSQLiteHookExtension(hookCallback);
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
DrizzleSQLiteHookExtension,
|
|
45
|
+
hook
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/extensions/hook/sqlite/index.ts"],"sourcesContent":["import { entityKind } from '~/entity.ts';\nimport { extensionName } from '~/extension-core/index.ts';\nimport { DrizzleSQLiteExtension, type DrizzleSQLiteHookContext } from '~/extension-core/sqlite/index.ts';\n\nexport class DrizzleSQLiteHookExtension<TContextMeta = unknown> extends DrizzleSQLiteExtension<TContextMeta> {\n\tstatic override readonly [entityKind]: string = 'DrizzleSQLiteHookExtension';\n\n\tstatic override readonly [extensionName] = 'Drizzle SQLite Hook';\n\n\tconstructor(private hookCallback: (context: DrizzleSQLiteHookContext<TContextMeta>) => Promise<void> | void) {\n\t\tsuper();\n\t}\n\n\toverride hook(context: DrizzleSQLiteHookContext<TContextMeta>): Promise<void> | void {\n\t\treturn this.hookCallback(context);\n\t}\n}\n\nexport function hook<TContextMeta = unknown>(\n\thookCallback: (context: DrizzleSQLiteHookContext<TContextMeta>) => Promise<void> | void,\n): DrizzleSQLiteHookExtension<TContextMeta> {\n\treturn new DrizzleSQLiteHookExtension(hookCallback);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA2B;AAC3B,4BAA8B;AAC9B,oBAAsE;AAE/D,MAAM,mCAA2D,qCAAqC;AAAA,EAK5G,YAAoB,cAAyF;AAC5G,UAAM;AADa;AAAA,EAEpB;AAAA,EANA,QAA0B,wBAAU,IAAY;AAAA,EAEhD,QAA0B,mCAAa,IAAI;AAAA,EAMlC,KAAK,SAAuE;AACpF,WAAO,KAAK,aAAa,OAAO;AAAA,EACjC;AACD;AAEO,SAAS,KACf,cAC2C;AAC3C,SAAO,IAAI,2BAA2B,YAAY;AACnD;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { entityKind } from "../../../entity.cjs";
|
|
2
|
+
import { extensionName } from "../../../extension-core/index.cjs";
|
|
3
|
+
import { DrizzleSQLiteExtension, type DrizzleSQLiteHookContext } from "../../../extension-core/sqlite/index.cjs";
|
|
4
|
+
export declare class DrizzleSQLiteHookExtension<TContextMeta = unknown> extends DrizzleSQLiteExtension<TContextMeta> {
|
|
5
|
+
private hookCallback;
|
|
6
|
+
static readonly [entityKind]: string;
|
|
7
|
+
static readonly [extensionName] = "Drizzle SQLite Hook";
|
|
8
|
+
constructor(hookCallback: (context: DrizzleSQLiteHookContext<TContextMeta>) => Promise<void> | void);
|
|
9
|
+
hook(context: DrizzleSQLiteHookContext<TContextMeta>): Promise<void> | void;
|
|
10
|
+
}
|
|
11
|
+
export declare function hook<TContextMeta = unknown>(hookCallback: (context: DrizzleSQLiteHookContext<TContextMeta>) => Promise<void> | void): DrizzleSQLiteHookExtension<TContextMeta>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { entityKind } from "../../../entity.js";
|
|
2
|
+
import { extensionName } from "../../../extension-core/index.js";
|
|
3
|
+
import { DrizzleSQLiteExtension, type DrizzleSQLiteHookContext } from "../../../extension-core/sqlite/index.js";
|
|
4
|
+
export declare class DrizzleSQLiteHookExtension<TContextMeta = unknown> extends DrizzleSQLiteExtension<TContextMeta> {
|
|
5
|
+
private hookCallback;
|
|
6
|
+
static readonly [entityKind]: string;
|
|
7
|
+
static readonly [extensionName] = "Drizzle SQLite Hook";
|
|
8
|
+
constructor(hookCallback: (context: DrizzleSQLiteHookContext<TContextMeta>) => Promise<void> | void);
|
|
9
|
+
hook(context: DrizzleSQLiteHookContext<TContextMeta>): Promise<void> | void;
|
|
10
|
+
}
|
|
11
|
+
export declare function hook<TContextMeta = unknown>(hookCallback: (context: DrizzleSQLiteHookContext<TContextMeta>) => Promise<void> | void): DrizzleSQLiteHookExtension<TContextMeta>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { entityKind } from "../../../entity.js";
|
|
2
|
+
import { extensionName } from "../../../extension-core/index.js";
|
|
3
|
+
import { DrizzleSQLiteExtension } from "../../../extension-core/sqlite/index.js";
|
|
4
|
+
class DrizzleSQLiteHookExtension extends DrizzleSQLiteExtension {
|
|
5
|
+
constructor(hookCallback) {
|
|
6
|
+
super();
|
|
7
|
+
this.hookCallback = hookCallback;
|
|
8
|
+
}
|
|
9
|
+
static [entityKind] = "DrizzleSQLiteHookExtension";
|
|
10
|
+
static [extensionName] = "Drizzle SQLite Hook";
|
|
11
|
+
hook(context) {
|
|
12
|
+
return this.hookCallback(context);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function hook(hookCallback) {
|
|
16
|
+
return new DrizzleSQLiteHookExtension(hookCallback);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
DrizzleSQLiteHookExtension,
|
|
20
|
+
hook
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/extensions/hook/sqlite/index.ts"],"sourcesContent":["import { entityKind } from '~/entity.ts';\nimport { extensionName } from '~/extension-core/index.ts';\nimport { DrizzleSQLiteExtension, type DrizzleSQLiteHookContext } from '~/extension-core/sqlite/index.ts';\n\nexport class DrizzleSQLiteHookExtension<TContextMeta = unknown> extends DrizzleSQLiteExtension<TContextMeta> {\n\tstatic override readonly [entityKind]: string = 'DrizzleSQLiteHookExtension';\n\n\tstatic override readonly [extensionName] = 'Drizzle SQLite Hook';\n\n\tconstructor(private hookCallback: (context: DrizzleSQLiteHookContext<TContextMeta>) => Promise<void> | void) {\n\t\tsuper();\n\t}\n\n\toverride hook(context: DrizzleSQLiteHookContext<TContextMeta>): Promise<void> | void {\n\t\treturn this.hookCallback(context);\n\t}\n}\n\nexport function hook<TContextMeta = unknown>(\n\thookCallback: (context: DrizzleSQLiteHookContext<TContextMeta>) => Promise<void> | void,\n): DrizzleSQLiteHookExtension<TContextMeta> {\n\treturn new DrizzleSQLiteHookExtension(hookCallback);\n}\n"],"mappings":"AAAA,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,8BAA6D;AAE/D,MAAM,mCAA2D,uBAAqC;AAAA,EAK5G,YAAoB,cAAyF;AAC5G,UAAM;AADa;AAAA,EAEpB;AAAA,EANA,QAA0B,UAAU,IAAY;AAAA,EAEhD,QAA0B,aAAa,IAAI;AAAA,EAMlC,KAAK,SAAuE;AACpF,WAAO,KAAK,aAAa,OAAO;AAAA,EACjC;AACD;AAEO,SAAS,KACf,cAC2C;AAC3C,SAAO,IAAI,2BAA2B,YAAY;AACnD;","names":[]}
|
|
@@ -0,0 +1,313 @@
|
|
|
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 common_exports = {};
|
|
20
|
+
__export(common_exports, {
|
|
21
|
+
buildDecoder: () => buildDecoder,
|
|
22
|
+
buildDecoderInner: () => buildDecoderInner,
|
|
23
|
+
buildEncoder: () => buildEncoder,
|
|
24
|
+
downloadFile: () => downloadFile,
|
|
25
|
+
mapArrayParam: () => mapArrayParam,
|
|
26
|
+
mapParams: () => mapParams,
|
|
27
|
+
objectIdToText: () => objectIdToText,
|
|
28
|
+
presignDownload: () => presignDownload,
|
|
29
|
+
textToObjectId: () => textToObjectId,
|
|
30
|
+
uploadFile: () => uploadFile
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(common_exports);
|
|
33
|
+
var import_client_s3 = require("@aws-sdk/client-s3");
|
|
34
|
+
var import_errors = require("../../errors.cjs");
|
|
35
|
+
class PresignerImporter {
|
|
36
|
+
static presignerImportSource = ["@aws", "sdk/s3", "request", "presigner"].join("-");
|
|
37
|
+
static presigner = void 0;
|
|
38
|
+
constructor() {
|
|
39
|
+
}
|
|
40
|
+
static async importPresigner() {
|
|
41
|
+
if (this.presigner) return this.presigner;
|
|
42
|
+
this.presigner = await import(this.presignerImportSource).then((e) => e.getSignedUrl);
|
|
43
|
+
return this.presigner;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const AsyncFunction = async function() {
|
|
47
|
+
}.constructor;
|
|
48
|
+
const buildFunctionArrayRecursion = (dimensions, body) => {
|
|
49
|
+
if (dimensions) {
|
|
50
|
+
return buildFunctionArrayRecursion(dimensions - 1, `arr?.forEach((arr, i${dimensions}) => ${body})`);
|
|
51
|
+
}
|
|
52
|
+
return body;
|
|
53
|
+
};
|
|
54
|
+
const buildArrayRecursionIndexAccess = (dimensions) => {
|
|
55
|
+
let idxs = "";
|
|
56
|
+
for (let idx = 1; idx <= dimensions; ++idx) {
|
|
57
|
+
idxs = `${idxs}[i${idx}]`;
|
|
58
|
+
}
|
|
59
|
+
return idxs;
|
|
60
|
+
};
|
|
61
|
+
const formPresignerOptions = (options) => {
|
|
62
|
+
if (!options) return "undefined";
|
|
63
|
+
const fields = Object.entries(options).map(
|
|
64
|
+
([k, v]) => (
|
|
65
|
+
// eslint-disable-next-line no-instanceof/no-instanceof
|
|
66
|
+
(`${JSON.stringify(k)}: ${v instanceof Set ? `new Set(${JSON.stringify([...v])})` : JSON.stringify(v)}`)
|
|
67
|
+
)
|
|
68
|
+
).join(",\n");
|
|
69
|
+
return `{${fields}}`;
|
|
70
|
+
};
|
|
71
|
+
const buildDecoderInner = (mappingInstructions) => {
|
|
72
|
+
return mappingInstructions.map((i) => {
|
|
73
|
+
const path = i.path.join("");
|
|
74
|
+
const optPath = i.path.join("?.");
|
|
75
|
+
return `if(row${optPath}) {
|
|
76
|
+
` + ("subinstructions" in i ? `row${path}.forEach(row => {
|
|
77
|
+
${buildDecoderInner(i.subinstructions)}
|
|
78
|
+
});` : i.arrayDimensions ? `const arr = row${path};
|
|
79
|
+
` + buildFunctionArrayRecursion(
|
|
80
|
+
i.arrayDimensions,
|
|
81
|
+
`p.push((async () => {
|
|
82
|
+
if(!arr || typeof arr !== 'string') return;
|
|
83
|
+
|
|
84
|
+
const { key, bucket } = idGetter(arr);
|
|
85
|
+
row${path}${buildArrayRecursionIndexAccess(i.arrayDimensions)} = await ${i.fetchMode === "file" || i.fetchMode === "data" ? "downloader" : "presigner"}({ key, bucket, s3, mode: ${JSON.stringify(i.fileMode)}, fileOnly: ${i.fetchMode === "data" ? "true" : "false"}, options: ${formPresignerOptions(i.options)}});
|
|
86
|
+
})().catch((e) => errors.push(e)))`
|
|
87
|
+
) : `p.push((async () => {
|
|
88
|
+
const str = row${path};
|
|
89
|
+
if(typeof str !== 'string') return;
|
|
90
|
+
|
|
91
|
+
const { key, bucket } = idGetter(str);
|
|
92
|
+
row${path} = await ${i.fetchMode === "file" || i.fetchMode === "data" ? "downloader" : "presigner"}({ key, bucket, s3, mode: ${JSON.stringify(i.fileMode)}, fileOnly: ${i.fetchMode === "data" ? "true" : "false"}, options: ${formPresignerOptions(i.options)}});
|
|
93
|
+
})().catch((e) => errors.push(e)));`) + `
|
|
94
|
+
}`;
|
|
95
|
+
}).join("\n");
|
|
96
|
+
};
|
|
97
|
+
const buildDecoder = (mappingInstructions, mode = "many") => {
|
|
98
|
+
if (!mappingInstructions.length) return () => void 0;
|
|
99
|
+
return new AsyncFunction(
|
|
100
|
+
"s3",
|
|
101
|
+
"data",
|
|
102
|
+
"errors",
|
|
103
|
+
"downloader",
|
|
104
|
+
"presigner",
|
|
105
|
+
"idGetter",
|
|
106
|
+
mode === "many" ? `
|
|
107
|
+
await Promise.all(data.reduce((p, row) => {
|
|
108
|
+
${buildDecoderInner(mappingInstructions)}
|
|
109
|
+
return p;
|
|
110
|
+
}, []));` : `
|
|
111
|
+
const p = [];
|
|
112
|
+
const row = data;
|
|
113
|
+
${buildDecoderInner(mappingInstructions)}
|
|
114
|
+
await Promise.all(p);
|
|
115
|
+
`
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
const buildEncoder = (mappingInstructions) => {
|
|
119
|
+
if (!mappingInstructions.length) return () => void 0;
|
|
120
|
+
return new AsyncFunction(
|
|
121
|
+
"s3",
|
|
122
|
+
"placeholders",
|
|
123
|
+
"errors",
|
|
124
|
+
"uploader",
|
|
125
|
+
"idBuilder",
|
|
126
|
+
`
|
|
127
|
+
if(!placeholders) return;
|
|
128
|
+
await Promise.all([
|
|
129
|
+
${mappingInstructions.map((i) => {
|
|
130
|
+
const path = `[${JSON.stringify(i.key)}]`;
|
|
131
|
+
return i.arrayDimensions ? `...(() => {
|
|
132
|
+
const arr = placeholders${path};
|
|
133
|
+
const p = [];
|
|
134
|
+
${buildFunctionArrayRecursion(
|
|
135
|
+
i.arrayDimensions,
|
|
136
|
+
`p.push((async () => {
|
|
137
|
+
if(!arr || typeof arr !== 'object') return;
|
|
138
|
+
|
|
139
|
+
const { key, bucket, data } = arr;
|
|
140
|
+
await uploader({ key, bucket, data, s3, mode: ${JSON.stringify(i.mode)} });
|
|
141
|
+
placeholders${path}${buildArrayRecursionIndexAccess(i.arrayDimensions)} = idBuilder(arr);
|
|
142
|
+
})().catch((e) => errors.push(e)))`
|
|
143
|
+
)}
|
|
144
|
+
return p;
|
|
145
|
+
})()` : `(async () => {
|
|
146
|
+
const params = placeholders${path};
|
|
147
|
+
if(!params || typeof params !== 'object') return;
|
|
148
|
+
|
|
149
|
+
const { key, bucket, data } = params;
|
|
150
|
+
await uploader({ key, bucket, data, s3, mode: ${JSON.stringify(i.mode)} });
|
|
151
|
+
placeholders${path} = idBuilder(params);
|
|
152
|
+
})().catch((e) => errors.push(e))`;
|
|
153
|
+
}).join(",\n")}
|
|
154
|
+
]);
|
|
155
|
+
`
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
const separator = ":";
|
|
159
|
+
function objectIdToText({ key, bucket }) {
|
|
160
|
+
return `${bucket}${separator}${key}`;
|
|
161
|
+
}
|
|
162
|
+
function textToObjectId(text) {
|
|
163
|
+
const split = text.split(separator);
|
|
164
|
+
if (split.length < 2) throw new Error(`Invalid S3 object identifier: "${text}". Expected: "bucket${separator}key"`);
|
|
165
|
+
const bucket = split.shift();
|
|
166
|
+
const key = split.join(separator);
|
|
167
|
+
return { key, bucket };
|
|
168
|
+
}
|
|
169
|
+
async function downloadFile({ key, bucket, s3, mode, fileOnly }) {
|
|
170
|
+
const res = await s3.send(
|
|
171
|
+
new import_client_s3.GetObjectCommand({
|
|
172
|
+
Bucket: bucket,
|
|
173
|
+
Key: key
|
|
174
|
+
})
|
|
175
|
+
);
|
|
176
|
+
if (!res.Body) {
|
|
177
|
+
throw new import_errors.DrizzleError({
|
|
178
|
+
message: `No data found in bucket "${bucket}" for key "${key}"`
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
let data;
|
|
182
|
+
switch (mode) {
|
|
183
|
+
case "uint8array": {
|
|
184
|
+
data = await res.Body.transformToByteArray();
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
case "buffer": {
|
|
188
|
+
data = Buffer.from(await res.Body.transformToByteArray());
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
default: {
|
|
192
|
+
data = await res.Body.transformToString(mode);
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return fileOnly ? data : {
|
|
197
|
+
key,
|
|
198
|
+
bucket,
|
|
199
|
+
data
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
async function presignDownload({ key, bucket, options, s3 }) {
|
|
203
|
+
const command = new import_client_s3.GetObjectCommand({
|
|
204
|
+
Bucket: bucket,
|
|
205
|
+
Key: key
|
|
206
|
+
});
|
|
207
|
+
const presigner = await PresignerImporter.importPresigner();
|
|
208
|
+
const url = await presigner(s3, command, options);
|
|
209
|
+
return url;
|
|
210
|
+
}
|
|
211
|
+
async function uploadFile({ key, bucket, data, s3, mode }) {
|
|
212
|
+
let body;
|
|
213
|
+
switch (mode) {
|
|
214
|
+
case "uint8array":
|
|
215
|
+
case "buffer": {
|
|
216
|
+
body = data;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
case "hex": {
|
|
220
|
+
body = Uint8Array.fromHex ? Uint8Array.fromHex(data) : Buffer.from(data, "hex");
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
case "base64": {
|
|
224
|
+
body = Uint8Array.fromBase64 ? Uint8Array.fromBase64(data) : Buffer.from(data, "base64");
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const res = await s3.send(
|
|
229
|
+
new import_client_s3.PutObjectCommand({
|
|
230
|
+
Bucket: bucket,
|
|
231
|
+
Key: key,
|
|
232
|
+
Body: body
|
|
233
|
+
})
|
|
234
|
+
);
|
|
235
|
+
return res;
|
|
236
|
+
}
|
|
237
|
+
function mapArrayParam(s3, item, dimensions, mode, errors, promises) {
|
|
238
|
+
if (dimensions > 1) {
|
|
239
|
+
for (const sub of item) {
|
|
240
|
+
mapArrayParam(s3, sub, dimensions - 1, mode, errors, promises);
|
|
241
|
+
}
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
let i = 0;
|
|
245
|
+
for (const param of item) {
|
|
246
|
+
if (!param || typeof param !== "object") {
|
|
247
|
+
++i;
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
const obj = param;
|
|
251
|
+
promises.push(
|
|
252
|
+
(async (i2) => {
|
|
253
|
+
await uploadFile({
|
|
254
|
+
s3,
|
|
255
|
+
key: obj.key,
|
|
256
|
+
bucket: obj.bucket,
|
|
257
|
+
data: obj.data,
|
|
258
|
+
mode
|
|
259
|
+
});
|
|
260
|
+
const value = objectIdToText(obj);
|
|
261
|
+
item[i2] = value;
|
|
262
|
+
})(i++).catch((e) => errors.push(e))
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async function mapParams(s3, params, indexes, errors) {
|
|
267
|
+
if (!indexes.length) return;
|
|
268
|
+
const arrayIdxs = [];
|
|
269
|
+
await Promise.all(
|
|
270
|
+
indexes.reduce((p, { index, mode, arrayDimensions }) => {
|
|
271
|
+
const { value: param } = params[index];
|
|
272
|
+
if (arrayDimensions) {
|
|
273
|
+
mapArrayParam(s3, param, arrayDimensions, mode, errors, p);
|
|
274
|
+
arrayIdxs.push(index);
|
|
275
|
+
return p;
|
|
276
|
+
}
|
|
277
|
+
if (!param || typeof param !== "object") return p;
|
|
278
|
+
p.push(
|
|
279
|
+
(async (i) => {
|
|
280
|
+
await uploadFile({
|
|
281
|
+
s3,
|
|
282
|
+
key: param.key,
|
|
283
|
+
bucket: param.bucket,
|
|
284
|
+
data: param.data,
|
|
285
|
+
mode
|
|
286
|
+
});
|
|
287
|
+
const value = objectIdToText(param);
|
|
288
|
+
params[i] = value;
|
|
289
|
+
})(index).catch((e) => errors.push(e))
|
|
290
|
+
);
|
|
291
|
+
return p;
|
|
292
|
+
}, [])
|
|
293
|
+
);
|
|
294
|
+
for (const idx of arrayIdxs) {
|
|
295
|
+
params[idx] = params[idx].value ? params[idx].encoder.mapToDriverValue(
|
|
296
|
+
params[idx].value
|
|
297
|
+
) : params[idx];
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
301
|
+
0 && (module.exports = {
|
|
302
|
+
buildDecoder,
|
|
303
|
+
buildDecoderInner,
|
|
304
|
+
buildEncoder,
|
|
305
|
+
downloadFile,
|
|
306
|
+
mapArrayParam,
|
|
307
|
+
mapParams,
|
|
308
|
+
objectIdToText,
|
|
309
|
+
presignDownload,
|
|
310
|
+
textToObjectId,
|
|
311
|
+
uploadFile
|
|
312
|
+
});
|
|
313
|
+
//# sourceMappingURL=common.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/extensions/s3-file/common.ts"],"sourcesContent":["import { GetObjectCommand, PutObjectCommand, type S3Client } from '@aws-sdk/client-s3';\nimport type { getSignedUrl } from '@aws-sdk/s3-request-presigner';\nimport { DrizzleError } from '~/errors.ts';\nimport type { ExtensionParam } from '~/sql/sql.ts';\nimport type { Simplify } from '~/utils.ts';\n\n// Local class, won't be used with `is` nor `instanceof`\n// eslint-disable-next-line drizzle-internal/require-entity-kind\nclass PresignerImporter {\n\tprivate static presignerImportSource: string = ['@aws', 'sdk/s3', 'request', 'presigner'].join('-');\n\tprivate static presigner: typeof getSignedUrl | undefined = undefined;\n\tconstructor() {}\n\n\tstatic async importPresigner(): Promise<typeof getSignedUrl> {\n\t\tif (this.presigner) return this.presigner;\n\n\t\tthis.presigner = await import(this.presignerImportSource).then((e) => e.getSignedUrl);\n\n\t\treturn this.presigner!;\n\t}\n}\n\nconst AsyncFunction = (async function() {}.constructor) as {\n\tnew(...args: string[]): (...args: any[]) => Promise<any>;\n\t(...args: string[]): (...args: any[]) => Promise<any>;\n};\n\nexport interface DecoderFunction {\n\t(\n\t\ts3: S3Client,\n\t\tdata: Record<string, unknown>[] | Record<string, unknown>,\n\t\terrors: unknown[],\n\t\tdownloader: typeof downloadFile,\n\t\tpresigner: typeof presignDownload,\n\t\tidGetter: typeof textToObjectId,\n\t): Promise<void>;\n}\n\nexport interface EncoderFunction {\n\t(\n\t\ts3: S3Client,\n\t\tplaceholders: Record<string, unknown> | undefined,\n\t\terrors: unknown[],\n\t\tuploader: typeof uploadFile,\n\t\tidBuilder: typeof objectIdToText,\n\t): Promise<void>;\n}\n\nconst buildFunctionArrayRecursion = (dimensions: number, body: string): string => {\n\tif (dimensions) {\n\t\treturn buildFunctionArrayRecursion(dimensions - 1, `arr?.forEach((arr, i${dimensions}) => ${body})`);\n\t}\n\n\treturn body;\n};\n\nconst buildArrayRecursionIndexAccess = (dimensions: number) => {\n\tlet idxs = '';\n\tfor (let idx = 1; idx <= dimensions; ++idx) {\n\t\tidxs = `${idxs}[i${idx}]`;\n\t}\n\treturn idxs;\n};\n\nconst formPresignerOptions = (options?: RequestPresigningArguments) => {\n\tif (!options) return 'undefined';\n\n\tconst fields = Object.entries(options).map(([k, v]) =>\n\t\t// eslint-disable-next-line no-instanceof/no-instanceof\n\t\t`${JSON.stringify(k)}: ${v instanceof Set ? `new Set(${JSON.stringify([...v])})` : JSON.stringify(v)}`\n\t).join(',\\n');\n\n\treturn `{${fields}}`;\n};\n\nexport const buildDecoderInner = (mappingInstructions: DrizzleS3FileOutputMappingInstruction[]): string => {\n\treturn mappingInstructions.map((i) => {\n\t\tconst path = i.path.join('');\n\t\tconst optPath = i.path.join('?.');\n\n\t\treturn `if(row${optPath}) {\\n` + (\n\t\t\t'subinstructions' in i\n\t\t\t\t? `row${path}.forEach(row => {\n\t\t\t${buildDecoderInner(i.subinstructions)} \n\t\t\t});`\n\t\t\t\t: i.arrayDimensions\n\t\t\t\t? `const arr = row${path};\n\t\t\t\t` + buildFunctionArrayRecursion(\n\t\t\t\t\ti.arrayDimensions,\n\t\t\t\t\t`p.push((async () => {\n\t\t\t\t\t\t\t\tif(!arr || typeof arr !== 'string') return;\n\n\t\t\t\t\t\t\t\tconst { key, bucket } = idGetter(arr);\n\t\t\t\t\t\t\t\trow${path}${buildArrayRecursionIndexAccess(i.arrayDimensions)} = await ${\n\t\t\t\t\t\ti.fetchMode === 'file' || i.fetchMode === 'data'\n\t\t\t\t\t\t\t? 'downloader'\n\t\t\t\t\t\t\t: 'presigner'\n\t\t\t\t\t}({ key, bucket, s3, mode: ${JSON.stringify(i.fileMode)}, fileOnly: ${\n\t\t\t\t\t\ti.fetchMode === 'data' ? 'true' : 'false'\n\t\t\t\t\t}, options: ${formPresignerOptions(i.options)}});\n\t\t\t\t\t\t})().catch((e) => errors.push(e)))`,\n\t\t\t\t)\n\t\t\t\t: `p.push((async () => {\n\t\t\t\t\t\tconst str = row${path};\n\t\t\t\t\t\tif(typeof str !== 'string') return;\n\n\t\t\t\t\t\tconst { key, bucket } = idGetter(str);\n\t\t\t\t\t\trow${path} = await ${\n\t\t\t\t\ti.fetchMode === 'file' || i.fetchMode === 'data'\n\t\t\t\t\t\t? 'downloader'\n\t\t\t\t\t\t: 'presigner'\n\t\t\t\t}({ key, bucket, s3, mode: ${JSON.stringify(i.fileMode)}, fileOnly: ${\n\t\t\t\t\ti.fetchMode === 'data' ? 'true' : 'false'\n\t\t\t\t}, options: ${formPresignerOptions(i.options)}});\n\t\t\t\t\t\t})().catch((e) => errors.push(e)));`\n\t\t) + `\n\t\t}`;\n\t}).join('\\n');\n};\n\nexport const buildDecoder = (\n\tmappingInstructions: DrizzleS3FileOutputMappingInstruction[],\n\tmode: 'first' | 'many' = 'many',\n): DecoderFunction => {\n\tif (!mappingInstructions.length) return () => undefined as any;\n\n\treturn new AsyncFunction(\n\t\t's3',\n\t\t'data',\n\t\t'errors',\n\t\t'downloader',\n\t\t'presigner',\n\t\t'idGetter',\n\t\tmode === 'many'\n\t\t\t? `\n\t\t\tawait Promise.all(data.reduce((p, row) => {\n\t\t\t${buildDecoderInner(mappingInstructions)}\n\t\t\treturn p;\n\t\t}, []));`\n\t\t\t: `\n\t\t\tconst p = [];\n\t\t\tconst row = data;\n\t\t\t${buildDecoderInner(mappingInstructions)}\n\t\t\tawait Promise.all(p);\n\t\t`,\n\t);\n};\n\nexport const buildEncoder = (mappingInstructions: DrizzleS3FilePlaceholderMappingInstruction[]): EncoderFunction => {\n\tif (!mappingInstructions.length) return () => undefined as any;\n\n\treturn new AsyncFunction(\n\t\t's3',\n\t\t'placeholders',\n\t\t'errors',\n\t\t'uploader',\n\t\t'idBuilder',\n\t\t`\n\t\t\tif(!placeholders) return;\n\t\t\tawait Promise.all([\n\t\t\t\t${\n\t\t\tmappingInstructions.map((i) => {\n\t\t\t\tconst path = `[${JSON.stringify(i.key)}]`;\n\n\t\t\t\treturn i.arrayDimensions\n\t\t\t\t\t? `...(() => {\n\t\t\t\t\t\tconst arr = placeholders${path};\n\t\t\t\t\t\tconst p = [];\n\t\t\t\t\t\t${\n\t\t\t\t\t\tbuildFunctionArrayRecursion(\n\t\t\t\t\t\t\ti.arrayDimensions,\n\t\t\t\t\t\t\t`p.push((async () => {\n\t\t\t\t\t\t\tif(!arr || typeof arr !== 'object') return;\n\n\t\t\t\t\t\t\tconst { key, bucket, data } = arr;\n\t\t\t\t\t\t\tawait uploader({ key, bucket, data, s3, mode: ${JSON.stringify(i.mode)} });\n\t\t\t\t\t\t\tplaceholders${path}${buildArrayRecursionIndexAccess(i.arrayDimensions)} = idBuilder(arr);\n\t\t\t\t\t\t})().catch((e) => errors.push(e)))`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\t\treturn p;\n\t\t\t\t\t})()`\n\t\t\t\t\t: `(async () => {\n\t\t\t\t\t\t\tconst params = placeholders${path};\n\t\t\t\t\t\t\tif(!params || typeof params !== 'object') return;\n\n\t\t\t\t\t\t\tconst { key, bucket, data } = params;\n\t\t\t\t\t\t\tawait uploader({ key, bucket, data, s3, mode: ${JSON.stringify(i.mode)} });\n\t\t\t\t\t\t\tplaceholders${path} = idBuilder(params);\n\t\t\t\t\t\t})().catch((e) => errors.push(e))`;\n\t\t\t}).join(',\\n')\n\t\t}\n\t\t\t]);\n\t\t`,\n\t);\n};\n\nexport type DrizzleS3FileMode = 'buffer' | 'hex' | 'base64' | 'uint8array';\n\nexport type DrizzleS3FileModeToData = {\n\tbuffer: Buffer;\n\thex: string;\n\tbase64: string;\n\tuint8array: Uint8Array;\n};\n\nexport type DrizzleS3FetchMode = 'file' | 'data' | 'presigned';\n\nexport type DrizzleS3FileOutputMappingInstructionNodeCommon = {\n\tpath: string[];\n};\nexport type DrizzleS3FileOutputMappingInstruction =\n\t| DrizzleS3FileOutputMappingInstructionIterableNode\n\t| DrizzleS3FileOutputMappingInstructionTerminalNode;\n\nexport type DrizzleS3FileOutputMappingInstructionTerminalNode =\n\t& DrizzleS3FileOutputMappingInstructionNodeCommon\n\t& {\n\t\tfileMode: DrizzleS3FileMode;\n\t\tfetchMode: DrizzleS3FetchMode;\n\t\toptions?: RequestPresigningArguments;\n\t\tarrayDimensions?: number;\n\t};\n\nexport type DrizzleS3FileOutputMappingInstructionIterableNode =\n\t& DrizzleS3FileOutputMappingInstructionNodeCommon\n\t& {\n\t\tsubinstructions: DrizzleS3FileOutputMappingInstruction[];\n\t};\n\nexport interface DrizzleS3FileInputMappingInstruction {\n\tmode: DrizzleS3FileMode;\n\tindex: number;\n\tarrayDimensions?: number;\n}\n\nexport interface DrizzleS3FilePlaceholderMappingInstruction {\n\tmode: DrizzleS3FileMode;\n\tkey: string;\n\tarrayDimensions?: number;\n}\n\nexport type RequestPresigningArguments = typeof getSignedUrl extends\n\t((client: any, command: any, options?: infer R) => any) ? R\n\t: Record<string, unknown>;\n\nexport interface DrizzleS3ObjectIdentification {\n\tkey: string;\n\tbucket: string;\n}\n\nexport interface S3ExtMeta {\n\tdecoder?: DecoderFunction;\n\tencoder?: EncoderFunction;\n}\n\nexport type DrizzleS3Object<TData extends string | Buffer | Uint8Array = string | Buffer | Uint8Array> = Simplify<\n\t& DrizzleS3ObjectIdentification\n\t& {\n\t\tdata: TData;\n\t}\n>;\n\nexport type DrizzleS3ObjectFile<TData extends string | Buffer | Uint8Array = string | Buffer | Uint8Array> = Simplify<\n\t& DrizzleS3ObjectIdentification\n\t& {\n\t\tdata: TData;\n\t}\n>;\n\n// export type DrizzleS3ObjectMeta = Simplify<\n// \t& DrizzleS3ObjectIdentification\n// \t& {\n// \t\tmeta?: Record<string, unknown>;\n// \t}\n// >;\n\nconst separator = ':';\n\nexport function objectIdToText({ key, bucket }: DrizzleS3ObjectIdentification): string {\n\treturn `${bucket}${separator}${key}`;\n}\n\nexport function textToObjectId(text: string): DrizzleS3ObjectIdentification {\n\tconst split = text.split(separator);\n\n\tif (split.length < 2) throw new Error(`Invalid S3 object identifier: \"${text}\". Expected: \"bucket${separator}key\"`);\n\n\tconst bucket = split.shift()!;\n\tconst key = split.join(separator);\n\n\treturn { key, bucket };\n}\n\nexport async function downloadFile(\n\t{ key, bucket, s3, mode, fileOnly }: {\n\t\tkey: string;\n\t\tbucket: string;\n\t\ts3: S3Client;\n\t\tmode: DrizzleS3FileMode;\n\t\tfileOnly?: boolean;\n\t},\n) {\n\tconst res = await s3.send(\n\t\tnew GetObjectCommand({\n\t\t\tBucket: bucket,\n\t\t\tKey: key,\n\t\t}),\n\t);\n\n\tif (!res.Body) {\n\t\tthrow new DrizzleError({\n\t\t\tmessage: `No data found in bucket \"${bucket}\" for key \"${key}\"`,\n\t\t});\n\t}\n\n\tlet data;\n\tswitch (mode) {\n\t\tcase 'uint8array': {\n\t\t\tdata = await res.Body.transformToByteArray();\n\t\t\tbreak;\n\t\t}\n\t\tcase 'buffer': {\n\t\t\tdata = Buffer.from(await res.Body.transformToByteArray());\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tdata = await res.Body.transformToString(mode);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn fileOnly ? data : {\n\t\tkey,\n\t\tbucket,\n\t\tdata,\n\t};\n}\n\n// export async function downloadFileMeta({ key, bucket, s3 }: { key: string; bucket: string; s3: S3Client }) {\n// \tconst { Metadata: meta } = await s3.send(\n// \t\tnew HeadObjectCommand({\n// \t\t\tBucket: bucket,\n// \t\t\tKey: key,\n// \t\t}),\n// \t);\n\n// \treturn {\n// \t\tkey,\n// \t\tbucket,\n// \t\tmeta,\n// \t};\n// }\n\nexport async function presignDownload(\n\t{ key, bucket, options, s3 }: { key: string; bucket: string; options?: RequestPresigningArguments; s3: S3Client },\n) {\n\tconst command = new GetObjectCommand({\n\t\tBucket: bucket,\n\t\tKey: key,\n\t});\n\n\tconst presigner = await PresignerImporter.importPresigner();\n\t// Types are compatible, errors seem to be caused by internal package or package resolution issues\n\tconst url = await presigner(s3 as any, command as any, options);\n\n\treturn url;\n}\n\nexport async function uploadFile(\n\t{ key, bucket, data, s3, mode }: {\n\t\tkey: string;\n\t\tbucket: string;\n\t\tdata: DrizzleS3Object['data'];\n\t\ts3: S3Client;\n\t\tmode: DrizzleS3FileMode;\n\t},\n) {\n\tlet body: Buffer | Uint8Array;\n\tswitch (mode) {\n\t\tcase 'uint8array':\n\t\tcase 'buffer': {\n\t\t\tbody = data as Buffer | Uint8Array;\n\t\t\tbreak;\n\t\t}\n\t\tcase 'hex': {\n\t\t\tbody = Uint8Array.fromHex ? Uint8Array.fromHex(data as string) : Buffer.from(data as string, 'hex');\n\t\t\tbreak;\n\t\t}\n\t\tcase 'base64': {\n\t\t\tbody = Uint8Array.fromBase64 ? Uint8Array.fromBase64(data as string) : Buffer.from(data as string, 'base64');\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst res = await s3.send(\n\t\tnew PutObjectCommand({\n\t\t\tBucket: bucket,\n\t\t\tKey: key,\n\t\t\tBody: body,\n\t\t}),\n\t);\n\n\treturn res;\n}\n\ntype RecursiveArrayItem = DrizzleS3Object | RecursiveArrayItem[];\n\nexport function mapArrayParam(\n\ts3: S3Client,\n\titem: RecursiveArrayItem,\n\tdimensions: number,\n\tmode: DrizzleS3FileMode,\n\terrors: unknown[],\n\tpromises: Promise<unknown>[],\n) {\n\tif (dimensions > 1) {\n\t\tfor (const sub of item as Exclude<RecursiveArrayItem, DrizzleS3Object>) {\n\t\t\tmapArrayParam(s3, sub, dimensions - 1, mode, errors, promises);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tlet i = 0;\n\tfor (const param of item as (DrizzleS3Object | unknown)[]) {\n\t\tif (!param || typeof param !== 'object') {\n\t\t\t++i;\n\t\t\tcontinue;\n\t\t}\n\t\tconst obj = param as DrizzleS3Object;\n\n\t\tpromises.push(\n\t\t\t(async (i: number) => {\n\t\t\t\tawait uploadFile({\n\t\t\t\t\ts3: s3,\n\t\t\t\t\tkey: obj.key,\n\t\t\t\t\tbucket: obj.bucket,\n\t\t\t\t\tdata: obj.data,\n\t\t\t\t\tmode: mode,\n\t\t\t\t});\n\n\t\t\t\tconst value = objectIdToText(obj);\n\t\t\t\t(item as unknown[])[i] = value;\n\t\t\t})(i++).catch((e) => errors.push(e)),\n\t\t);\n\t}\n}\n\nexport async function mapParams(\n\ts3: S3Client,\n\tparams: unknown[],\n\tindexes: DrizzleS3FileInputMappingInstruction[],\n\terrors: unknown[],\n) {\n\tif (!indexes.length) return;\n\n\tconst arrayIdxs: number[] = [];\n\tawait Promise.all(\n\t\tindexes.reduce((p, { index, mode, arrayDimensions }) => {\n\t\t\tconst { value: param } = params![index]! as ExtensionParam<DrizzleS3Object, string>;\n\n\t\t\tif (arrayDimensions) {\n\t\t\t\tmapArrayParam(s3, param, arrayDimensions, mode, errors, p);\n\t\t\t\tarrayIdxs.push(index);\n\n\t\t\t\treturn p;\n\t\t\t}\n\n\t\t\tif (!param || typeof param !== 'object') return p;\n\n\t\t\tp.push(\n\t\t\t\t(async (i: number) => {\n\t\t\t\t\tawait uploadFile({\n\t\t\t\t\t\ts3: s3,\n\t\t\t\t\t\tkey: param.key,\n\t\t\t\t\t\tbucket: param.bucket,\n\t\t\t\t\t\tdata: param.data,\n\t\t\t\t\t\tmode: mode,\n\t\t\t\t\t});\n\n\t\t\t\t\tconst value = objectIdToText(param);\n\t\t\t\t\tparams![i] = value;\n\t\t\t\t})(index).catch((e) => errors.push(e)),\n\t\t\t);\n\n\t\t\treturn p;\n\t\t}, [] as Promise<unknown>[]),\n\t);\n\n\tfor (const idx of arrayIdxs) {\n\t\tparams[idx] = (<ExtensionParam<any[]>> params[idx]).value\n\t\t\t? (<ExtensionParam> params[idx]).encoder.mapToDriverValue(\n\t\t\t\t(<ExtensionParam<any[]>> params[idx]).value,\n\t\t\t)\n\t\t\t: params[idx];\n\t}\n}\n"],"mappings":"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","names":["i"]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
import type { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
3
|
+
import type { Simplify } from "../../utils.cjs";
|
|
4
|
+
export interface DecoderFunction {
|
|
5
|
+
(s3: S3Client, data: Record<string, unknown>[] | Record<string, unknown>, errors: unknown[], downloader: typeof downloadFile, presigner: typeof presignDownload, idGetter: typeof textToObjectId): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export interface EncoderFunction {
|
|
8
|
+
(s3: S3Client, placeholders: Record<string, unknown> | undefined, errors: unknown[], uploader: typeof uploadFile, idBuilder: typeof objectIdToText): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const buildDecoderInner: (mappingInstructions: DrizzleS3FileOutputMappingInstruction[]) => string;
|
|
11
|
+
export declare const buildDecoder: (mappingInstructions: DrizzleS3FileOutputMappingInstruction[], mode?: "first" | "many") => DecoderFunction;
|
|
12
|
+
export declare const buildEncoder: (mappingInstructions: DrizzleS3FilePlaceholderMappingInstruction[]) => EncoderFunction;
|
|
13
|
+
export type DrizzleS3FileMode = 'buffer' | 'hex' | 'base64' | 'uint8array';
|
|
14
|
+
export type DrizzleS3FileModeToData = {
|
|
15
|
+
buffer: Buffer;
|
|
16
|
+
hex: string;
|
|
17
|
+
base64: string;
|
|
18
|
+
uint8array: Uint8Array;
|
|
19
|
+
};
|
|
20
|
+
export type DrizzleS3FetchMode = 'file' | 'data' | 'presigned';
|
|
21
|
+
export type DrizzleS3FileOutputMappingInstructionNodeCommon = {
|
|
22
|
+
path: string[];
|
|
23
|
+
};
|
|
24
|
+
export type DrizzleS3FileOutputMappingInstruction = DrizzleS3FileOutputMappingInstructionIterableNode | DrizzleS3FileOutputMappingInstructionTerminalNode;
|
|
25
|
+
export type DrizzleS3FileOutputMappingInstructionTerminalNode = DrizzleS3FileOutputMappingInstructionNodeCommon & {
|
|
26
|
+
fileMode: DrizzleS3FileMode;
|
|
27
|
+
fetchMode: DrizzleS3FetchMode;
|
|
28
|
+
options?: RequestPresigningArguments;
|
|
29
|
+
arrayDimensions?: number;
|
|
30
|
+
};
|
|
31
|
+
export type DrizzleS3FileOutputMappingInstructionIterableNode = DrizzleS3FileOutputMappingInstructionNodeCommon & {
|
|
32
|
+
subinstructions: DrizzleS3FileOutputMappingInstruction[];
|
|
33
|
+
};
|
|
34
|
+
export interface DrizzleS3FileInputMappingInstruction {
|
|
35
|
+
mode: DrizzleS3FileMode;
|
|
36
|
+
index: number;
|
|
37
|
+
arrayDimensions?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface DrizzleS3FilePlaceholderMappingInstruction {
|
|
40
|
+
mode: DrizzleS3FileMode;
|
|
41
|
+
key: string;
|
|
42
|
+
arrayDimensions?: number;
|
|
43
|
+
}
|
|
44
|
+
export type RequestPresigningArguments = typeof getSignedUrl extends ((client: any, command: any, options?: infer R) => any) ? R : Record<string, unknown>;
|
|
45
|
+
export interface DrizzleS3ObjectIdentification {
|
|
46
|
+
key: string;
|
|
47
|
+
bucket: string;
|
|
48
|
+
}
|
|
49
|
+
export interface S3ExtMeta {
|
|
50
|
+
decoder?: DecoderFunction;
|
|
51
|
+
encoder?: EncoderFunction;
|
|
52
|
+
}
|
|
53
|
+
export type DrizzleS3Object<TData extends string | Buffer | Uint8Array = string | Buffer | Uint8Array> = Simplify<DrizzleS3ObjectIdentification & {
|
|
54
|
+
data: TData;
|
|
55
|
+
}>;
|
|
56
|
+
export type DrizzleS3ObjectFile<TData extends string | Buffer | Uint8Array = string | Buffer | Uint8Array> = Simplify<DrizzleS3ObjectIdentification & {
|
|
57
|
+
data: TData;
|
|
58
|
+
}>;
|
|
59
|
+
export declare function objectIdToText({ key, bucket }: DrizzleS3ObjectIdentification): string;
|
|
60
|
+
export declare function textToObjectId(text: string): DrizzleS3ObjectIdentification;
|
|
61
|
+
export declare function downloadFile({ key, bucket, s3, mode, fileOnly }: {
|
|
62
|
+
key: string;
|
|
63
|
+
bucket: string;
|
|
64
|
+
s3: S3Client;
|
|
65
|
+
mode: DrizzleS3FileMode;
|
|
66
|
+
fileOnly?: boolean;
|
|
67
|
+
}): Promise<string | Uint8Array | Buffer | {
|
|
68
|
+
key: string;
|
|
69
|
+
bucket: string;
|
|
70
|
+
data: string | Uint8Array | Buffer;
|
|
71
|
+
}>;
|
|
72
|
+
export declare function presignDownload({ key, bucket, options, s3 }: {
|
|
73
|
+
key: string;
|
|
74
|
+
bucket: string;
|
|
75
|
+
options?: RequestPresigningArguments;
|
|
76
|
+
s3: S3Client;
|
|
77
|
+
}): Promise<string>;
|
|
78
|
+
export declare function uploadFile({ key, bucket, data, s3, mode }: {
|
|
79
|
+
key: string;
|
|
80
|
+
bucket: string;
|
|
81
|
+
data: DrizzleS3Object['data'];
|
|
82
|
+
s3: S3Client;
|
|
83
|
+
mode: DrizzleS3FileMode;
|
|
84
|
+
}): Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>;
|
|
85
|
+
type RecursiveArrayItem = DrizzleS3Object | RecursiveArrayItem[];
|
|
86
|
+
export declare function mapArrayParam(s3: S3Client, item: RecursiveArrayItem, dimensions: number, mode: DrizzleS3FileMode, errors: unknown[], promises: Promise<unknown>[]): void;
|
|
87
|
+
export declare function mapParams(s3: S3Client, params: unknown[], indexes: DrizzleS3FileInputMappingInstruction[], errors: unknown[]): Promise<void>;
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
import type { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
3
|
+
import type { Simplify } from "../../utils.js";
|
|
4
|
+
export interface DecoderFunction {
|
|
5
|
+
(s3: S3Client, data: Record<string, unknown>[] | Record<string, unknown>, errors: unknown[], downloader: typeof downloadFile, presigner: typeof presignDownload, idGetter: typeof textToObjectId): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export interface EncoderFunction {
|
|
8
|
+
(s3: S3Client, placeholders: Record<string, unknown> | undefined, errors: unknown[], uploader: typeof uploadFile, idBuilder: typeof objectIdToText): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const buildDecoderInner: (mappingInstructions: DrizzleS3FileOutputMappingInstruction[]) => string;
|
|
11
|
+
export declare const buildDecoder: (mappingInstructions: DrizzleS3FileOutputMappingInstruction[], mode?: "first" | "many") => DecoderFunction;
|
|
12
|
+
export declare const buildEncoder: (mappingInstructions: DrizzleS3FilePlaceholderMappingInstruction[]) => EncoderFunction;
|
|
13
|
+
export type DrizzleS3FileMode = 'buffer' | 'hex' | 'base64' | 'uint8array';
|
|
14
|
+
export type DrizzleS3FileModeToData = {
|
|
15
|
+
buffer: Buffer;
|
|
16
|
+
hex: string;
|
|
17
|
+
base64: string;
|
|
18
|
+
uint8array: Uint8Array;
|
|
19
|
+
};
|
|
20
|
+
export type DrizzleS3FetchMode = 'file' | 'data' | 'presigned';
|
|
21
|
+
export type DrizzleS3FileOutputMappingInstructionNodeCommon = {
|
|
22
|
+
path: string[];
|
|
23
|
+
};
|
|
24
|
+
export type DrizzleS3FileOutputMappingInstruction = DrizzleS3FileOutputMappingInstructionIterableNode | DrizzleS3FileOutputMappingInstructionTerminalNode;
|
|
25
|
+
export type DrizzleS3FileOutputMappingInstructionTerminalNode = DrizzleS3FileOutputMappingInstructionNodeCommon & {
|
|
26
|
+
fileMode: DrizzleS3FileMode;
|
|
27
|
+
fetchMode: DrizzleS3FetchMode;
|
|
28
|
+
options?: RequestPresigningArguments;
|
|
29
|
+
arrayDimensions?: number;
|
|
30
|
+
};
|
|
31
|
+
export type DrizzleS3FileOutputMappingInstructionIterableNode = DrizzleS3FileOutputMappingInstructionNodeCommon & {
|
|
32
|
+
subinstructions: DrizzleS3FileOutputMappingInstruction[];
|
|
33
|
+
};
|
|
34
|
+
export interface DrizzleS3FileInputMappingInstruction {
|
|
35
|
+
mode: DrizzleS3FileMode;
|
|
36
|
+
index: number;
|
|
37
|
+
arrayDimensions?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface DrizzleS3FilePlaceholderMappingInstruction {
|
|
40
|
+
mode: DrizzleS3FileMode;
|
|
41
|
+
key: string;
|
|
42
|
+
arrayDimensions?: number;
|
|
43
|
+
}
|
|
44
|
+
export type RequestPresigningArguments = typeof getSignedUrl extends ((client: any, command: any, options?: infer R) => any) ? R : Record<string, unknown>;
|
|
45
|
+
export interface DrizzleS3ObjectIdentification {
|
|
46
|
+
key: string;
|
|
47
|
+
bucket: string;
|
|
48
|
+
}
|
|
49
|
+
export interface S3ExtMeta {
|
|
50
|
+
decoder?: DecoderFunction;
|
|
51
|
+
encoder?: EncoderFunction;
|
|
52
|
+
}
|
|
53
|
+
export type DrizzleS3Object<TData extends string | Buffer | Uint8Array = string | Buffer | Uint8Array> = Simplify<DrizzleS3ObjectIdentification & {
|
|
54
|
+
data: TData;
|
|
55
|
+
}>;
|
|
56
|
+
export type DrizzleS3ObjectFile<TData extends string | Buffer | Uint8Array = string | Buffer | Uint8Array> = Simplify<DrizzleS3ObjectIdentification & {
|
|
57
|
+
data: TData;
|
|
58
|
+
}>;
|
|
59
|
+
export declare function objectIdToText({ key, bucket }: DrizzleS3ObjectIdentification): string;
|
|
60
|
+
export declare function textToObjectId(text: string): DrizzleS3ObjectIdentification;
|
|
61
|
+
export declare function downloadFile({ key, bucket, s3, mode, fileOnly }: {
|
|
62
|
+
key: string;
|
|
63
|
+
bucket: string;
|
|
64
|
+
s3: S3Client;
|
|
65
|
+
mode: DrizzleS3FileMode;
|
|
66
|
+
fileOnly?: boolean;
|
|
67
|
+
}): Promise<string | Uint8Array | Buffer | {
|
|
68
|
+
key: string;
|
|
69
|
+
bucket: string;
|
|
70
|
+
data: string | Uint8Array | Buffer;
|
|
71
|
+
}>;
|
|
72
|
+
export declare function presignDownload({ key, bucket, options, s3 }: {
|
|
73
|
+
key: string;
|
|
74
|
+
bucket: string;
|
|
75
|
+
options?: RequestPresigningArguments;
|
|
76
|
+
s3: S3Client;
|
|
77
|
+
}): Promise<string>;
|
|
78
|
+
export declare function uploadFile({ key, bucket, data, s3, mode }: {
|
|
79
|
+
key: string;
|
|
80
|
+
bucket: string;
|
|
81
|
+
data: DrizzleS3Object['data'];
|
|
82
|
+
s3: S3Client;
|
|
83
|
+
mode: DrizzleS3FileMode;
|
|
84
|
+
}): Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>;
|
|
85
|
+
type RecursiveArrayItem = DrizzleS3Object | RecursiveArrayItem[];
|
|
86
|
+
export declare function mapArrayParam(s3: S3Client, item: RecursiveArrayItem, dimensions: number, mode: DrizzleS3FileMode, errors: unknown[], promises: Promise<unknown>[]): void;
|
|
87
|
+
export declare function mapParams(s3: S3Client, params: unknown[], indexes: DrizzleS3FileInputMappingInstruction[], errors: unknown[]): Promise<void>;
|
|
88
|
+
export {};
|