drizzle-orm 0.43.1-4aa795a → 0.43.1-b08434e
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 +1 -5
- package/aws-data-api/pg/driver.cjs.map +1 -1
- package/aws-data-api/pg/driver.d.cts +0 -1
- package/aws-data-api/pg/driver.d.ts +0 -1
- package/aws-data-api/pg/driver.js +1 -5
- package/aws-data-api/pg/driver.js.map +1 -1
- package/aws-data-api/pg/session.cjs +4 -15
- package/aws-data-api/pg/session.cjs.map +1 -1
- package/aws-data-api/pg/session.d.cts +2 -13
- package/aws-data-api/pg/session.d.ts +2 -13
- package/aws-data-api/pg/session.js +4 -15
- package/aws-data-api/pg/session.js.map +1 -1
- package/better-sqlite3/driver.cjs.map +1 -1
- package/better-sqlite3/driver.js.map +1 -1
- package/better-sqlite3/session.cjs +3 -9
- package/better-sqlite3/session.cjs.map +1 -1
- package/better-sqlite3/session.d.cts +2 -12
- package/better-sqlite3/session.d.ts +2 -12
- package/better-sqlite3/session.js +3 -9
- package/better-sqlite3/session.js.map +1 -1
- package/bun-sql/driver.cjs +1 -5
- package/bun-sql/driver.cjs.map +1 -1
- package/bun-sql/driver.js +1 -5
- package/bun-sql/driver.js.map +1 -1
- package/bun-sql/session.cjs +9 -21
- package/bun-sql/session.cjs.map +1 -1
- package/bun-sql/session.d.cts +2 -12
- package/bun-sql/session.d.ts +2 -12
- package/bun-sql/session.js +9 -21
- package/bun-sql/session.js.map +1 -1
- package/d1/driver.cjs +1 -5
- package/d1/driver.cjs.map +1 -1
- package/d1/driver.js +1 -5
- package/d1/driver.js.map +1 -1
- package/d1/session.cjs +9 -23
- package/d1/session.cjs.map +1 -1
- package/d1/session.d.cts +2 -12
- package/d1/session.d.ts +2 -12
- package/d1/session.js +9 -23
- package/d1/session.js.map +1 -1
- package/durable-sqlite/session.cjs +1 -1
- package/durable-sqlite/session.cjs.map +1 -1
- package/durable-sqlite/session.js +1 -1
- package/durable-sqlite/session.js.map +1 -1
- package/gel/driver.cjs +2 -9
- package/gel/driver.cjs.map +1 -1
- package/gel/driver.d.cts +0 -2
- package/gel/driver.d.ts +0 -2
- package/gel/driver.js +2 -9
- package/gel/driver.js.map +1 -1
- package/gel/session.cjs +10 -25
- package/gel/session.cjs.map +1 -1
- package/gel/session.d.cts +2 -12
- package/gel/session.d.ts +2 -12
- package/gel/session.js +10 -25
- package/gel/session.js.map +1 -1
- package/gel-core/db.cjs +0 -3
- package/gel-core/db.cjs.map +1 -1
- package/gel-core/db.d.cts +0 -4
- package/gel-core/db.d.ts +0 -4
- package/gel-core/db.js +0 -3
- package/gel-core/db.js.map +1 -1
- package/gel-core/query-builders/delete.cjs +1 -5
- package/gel-core/query-builders/delete.cjs.map +1 -1
- package/gel-core/query-builders/delete.js +1 -5
- package/gel-core/query-builders/delete.js.map +1 -1
- package/gel-core/query-builders/insert.cjs +1 -5
- package/gel-core/query-builders/insert.cjs.map +1 -1
- package/gel-core/query-builders/insert.js +1 -5
- package/gel-core/query-builders/insert.js.map +1 -1
- package/gel-core/query-builders/select.cjs +4 -29
- package/gel-core/query-builders/select.cjs.map +1 -1
- package/gel-core/query-builders/select.d.cts +0 -9
- package/gel-core/query-builders/select.d.ts +0 -9
- package/gel-core/query-builders/select.js +4 -29
- package/gel-core/query-builders/select.js.map +1 -1
- package/gel-core/query-builders/update.cjs +1 -5
- package/gel-core/query-builders/update.cjs.map +1 -1
- package/gel-core/query-builders/update.js +1 -5
- package/gel-core/query-builders/update.js.map +1 -1
- package/gel-core/session.cjs +1 -52
- package/gel-core/session.cjs.map +1 -1
- package/gel-core/session.d.cts +3 -14
- package/gel-core/session.d.ts +3 -14
- package/gel-core/session.js +2 -53
- package/gel-core/session.js.map +1 -1
- package/gel-core/utils.cjs +0 -16
- package/gel-core/utils.cjs.map +1 -1
- package/gel-core/utils.d.cts +4 -8
- package/gel-core/utils.d.ts +4 -8
- package/gel-core/utils.js +0 -15
- package/gel-core/utils.js.map +1 -1
- package/libsql/driver-core.cjs +1 -5
- package/libsql/driver-core.cjs.map +1 -1
- package/libsql/driver-core.js +1 -5
- package/libsql/driver-core.js.map +1 -1
- package/libsql/session.cjs +13 -27
- package/libsql/session.cjs.map +1 -1
- package/libsql/session.d.cts +2 -12
- package/libsql/session.d.ts +2 -12
- package/libsql/session.js +13 -27
- package/libsql/session.js.map +1 -1
- package/mysql-core/db.cjs +0 -3
- package/mysql-core/db.cjs.map +1 -1
- package/mysql-core/db.d.cts +0 -4
- package/mysql-core/db.d.ts +0 -4
- package/mysql-core/db.js +0 -3
- package/mysql-core/db.js.map +1 -1
- package/mysql-core/query-builders/delete.cjs +1 -9
- package/mysql-core/query-builders/delete.cjs.map +1 -1
- package/mysql-core/query-builders/delete.js +1 -9
- package/mysql-core/query-builders/delete.js.map +1 -1
- package/mysql-core/query-builders/insert.cjs +1 -8
- package/mysql-core/query-builders/insert.cjs.map +1 -1
- package/mysql-core/query-builders/insert.d.cts +0 -2
- package/mysql-core/query-builders/insert.d.ts +0 -2
- package/mysql-core/query-builders/insert.js +1 -8
- package/mysql-core/query-builders/insert.js.map +1 -1
- package/mysql-core/query-builders/select.cjs +3 -27
- package/mysql-core/query-builders/select.cjs.map +1 -1
- package/mysql-core/query-builders/select.d.cts +0 -9
- package/mysql-core/query-builders/select.d.ts +0 -9
- package/mysql-core/query-builders/select.js +4 -28
- package/mysql-core/query-builders/select.js.map +1 -1
- package/mysql-core/query-builders/update.cjs +1 -11
- package/mysql-core/query-builders/update.cjs.map +1 -1
- package/mysql-core/query-builders/update.d.cts +0 -2
- package/mysql-core/query-builders/update.d.ts +0 -2
- package/mysql-core/query-builders/update.js +1 -11
- package/mysql-core/query-builders/update.js.map +1 -1
- package/mysql-core/session.cjs +0 -53
- package/mysql-core/session.cjs.map +1 -1
- package/mysql-core/session.d.cts +2 -15
- package/mysql-core/session.d.ts +2 -15
- package/mysql-core/session.js +1 -54
- package/mysql-core/session.js.map +1 -1
- package/mysql-core/utils.cjs +0 -16
- package/mysql-core/utils.cjs.map +1 -1
- package/mysql-core/utils.d.cts +2 -6
- package/mysql-core/utils.d.ts +2 -6
- package/mysql-core/utils.js +0 -15
- package/mysql-core/utils.js.map +1 -1
- package/mysql-proxy/session.cjs +5 -15
- package/mysql-proxy/session.cjs.map +1 -1
- package/mysql-proxy/session.d.cts +2 -12
- package/mysql-proxy/session.d.ts +2 -12
- package/mysql-proxy/session.js +5 -15
- package/mysql-proxy/session.js.map +1 -1
- package/mysql2/driver.cjs +2 -10
- package/mysql2/driver.cjs.map +1 -1
- package/mysql2/driver.d.cts +0 -2
- package/mysql2/driver.d.ts +0 -2
- package/mysql2/driver.js +2 -10
- package/mysql2/driver.js.map +1 -1
- package/mysql2/session.cjs +5 -15
- package/mysql2/session.cjs.map +1 -1
- package/mysql2/session.d.cts +2 -12
- package/mysql2/session.d.ts +2 -12
- package/mysql2/session.js +5 -15
- package/mysql2/session.js.map +1 -1
- package/neon-http/driver.cjs +2 -9
- package/neon-http/driver.cjs.map +1 -1
- package/neon-http/driver.d.cts +0 -2
- package/neon-http/driver.d.ts +0 -2
- package/neon-http/driver.js +2 -9
- package/neon-http/driver.js.map +1 -1
- package/neon-http/session.cjs +15 -25
- package/neon-http/session.cjs.map +1 -1
- package/neon-http/session.d.cts +2 -12
- package/neon-http/session.d.ts +2 -12
- package/neon-http/session.js +15 -25
- package/neon-http/session.js.map +1 -1
- package/neon-serverless/driver.cjs +2 -9
- package/neon-serverless/driver.cjs.map +1 -1
- package/neon-serverless/driver.d.cts +0 -2
- package/neon-serverless/driver.d.ts +0 -2
- package/neon-serverless/driver.js +2 -9
- package/neon-serverless/driver.js.map +1 -1
- package/neon-serverless/session.cjs +7 -21
- package/neon-serverless/session.cjs.map +1 -1
- package/neon-serverless/session.d.cts +2 -12
- package/neon-serverless/session.d.ts +2 -12
- package/neon-serverless/session.js +7 -21
- package/neon-serverless/session.js.map +1 -1
- package/node-postgres/driver.cjs +2 -9
- package/node-postgres/driver.cjs.map +1 -1
- package/node-postgres/driver.d.cts +0 -2
- package/node-postgres/driver.d.ts +0 -2
- package/node-postgres/driver.js +2 -9
- package/node-postgres/driver.js.map +1 -1
- package/node-postgres/session.cjs +6 -19
- package/node-postgres/session.cjs.map +1 -1
- package/node-postgres/session.d.cts +2 -13
- package/node-postgres/session.d.ts +2 -13
- package/node-postgres/session.js +6 -19
- package/node-postgres/session.js.map +1 -1
- package/op-sqlite/driver.cjs +1 -5
- package/op-sqlite/driver.cjs.map +1 -1
- package/op-sqlite/driver.js +1 -5
- package/op-sqlite/driver.js.map +1 -1
- package/op-sqlite/session.cjs +9 -23
- package/op-sqlite/session.cjs.map +1 -1
- package/op-sqlite/session.d.cts +2 -12
- package/op-sqlite/session.d.ts +2 -12
- package/op-sqlite/session.js +9 -23
- package/op-sqlite/session.js.map +1 -1
- package/package.json +4 -69
- package/pg-core/db.cjs +0 -3
- package/pg-core/db.cjs.map +1 -1
- package/pg-core/db.d.cts +0 -4
- package/pg-core/db.d.ts +0 -4
- package/pg-core/db.js +0 -3
- package/pg-core/db.js.map +1 -1
- package/pg-core/query-builders/delete.cjs +1 -6
- package/pg-core/query-builders/delete.cjs.map +1 -1
- package/pg-core/query-builders/delete.d.cts +1 -3
- package/pg-core/query-builders/delete.d.ts +1 -3
- package/pg-core/query-builders/delete.js +1 -6
- package/pg-core/query-builders/delete.js.map +1 -1
- package/pg-core/query-builders/insert.cjs +1 -6
- package/pg-core/query-builders/insert.cjs.map +1 -1
- package/pg-core/query-builders/insert.d.cts +0 -2
- package/pg-core/query-builders/insert.d.ts +0 -2
- package/pg-core/query-builders/insert.js +1 -6
- package/pg-core/query-builders/insert.js.map +1 -1
- package/pg-core/query-builders/select.cjs +5 -31
- package/pg-core/query-builders/select.cjs.map +1 -1
- package/pg-core/query-builders/select.d.cts +6 -15
- package/pg-core/query-builders/select.d.ts +6 -15
- package/pg-core/query-builders/select.js +5 -31
- package/pg-core/query-builders/select.js.map +1 -1
- package/pg-core/query-builders/update.cjs +1 -6
- package/pg-core/query-builders/update.cjs.map +1 -1
- package/pg-core/query-builders/update.d.cts +2 -4
- package/pg-core/query-builders/update.d.ts +2 -4
- package/pg-core/query-builders/update.js +1 -6
- package/pg-core/query-builders/update.js.map +1 -1
- package/pg-core/session.cjs +1 -52
- package/pg-core/session.cjs.map +1 -1
- package/pg-core/session.d.cts +3 -14
- package/pg-core/session.d.ts +3 -14
- package/pg-core/session.js +2 -53
- package/pg-core/session.js.map +1 -1
- package/pg-core/utils.cjs +0 -16
- package/pg-core/utils.cjs.map +1 -1
- package/pg-core/utils.d.cts +4 -8
- package/pg-core/utils.d.ts +4 -8
- package/pg-core/utils.js +1 -16
- package/pg-core/utils.js.map +1 -1
- package/pg-proxy/driver.cjs +2 -7
- package/pg-proxy/driver.cjs.map +1 -1
- package/pg-proxy/driver.js +2 -7
- package/pg-proxy/driver.js.map +1 -1
- package/pg-proxy/session.cjs +5 -15
- package/pg-proxy/session.cjs.map +1 -1
- package/pg-proxy/session.d.cts +2 -12
- package/pg-proxy/session.d.ts +2 -12
- package/pg-proxy/session.js +5 -15
- package/pg-proxy/session.js.map +1 -1
- package/pglite/driver.cjs +2 -9
- package/pglite/driver.cjs.map +1 -1
- package/pglite/driver.d.cts +0 -2
- package/pglite/driver.d.ts +0 -2
- package/pglite/driver.js +2 -9
- package/pglite/driver.js.map +1 -1
- package/pglite/session.cjs +7 -19
- package/pglite/session.cjs.map +1 -1
- package/pglite/session.d.cts +2 -12
- package/pglite/session.d.ts +2 -12
- package/pglite/session.js +7 -19
- package/pglite/session.js.map +1 -1
- package/planetscale-serverless/driver.cjs +1 -5
- package/planetscale-serverless/driver.cjs.map +1 -1
- package/planetscale-serverless/driver.d.cts +0 -1
- package/planetscale-serverless/driver.d.ts +0 -1
- package/planetscale-serverless/driver.js +1 -5
- package/planetscale-serverless/driver.js.map +1 -1
- package/planetscale-serverless/session.cjs +5 -15
- package/planetscale-serverless/session.cjs.map +1 -1
- package/planetscale-serverless/session.d.cts +2 -12
- package/planetscale-serverless/session.d.ts +2 -12
- package/planetscale-serverless/session.js +5 -15
- package/planetscale-serverless/session.js.map +1 -1
- package/postgres-js/driver.cjs +1 -5
- package/postgres-js/driver.cjs.map +1 -1
- package/postgres-js/driver.js +1 -5
- package/postgres-js/driver.js.map +1 -1
- package/postgres-js/session.cjs +6 -18
- package/postgres-js/session.cjs.map +1 -1
- package/postgres-js/session.d.cts +2 -12
- package/postgres-js/session.d.ts +2 -12
- package/postgres-js/session.js +6 -18
- package/postgres-js/session.js.map +1 -1
- package/prisma/mysql/session.cjs +1 -1
- package/prisma/mysql/session.cjs.map +1 -1
- package/prisma/mysql/session.js +1 -1
- package/prisma/mysql/session.js.map +1 -1
- package/prisma/pg/session.cjs +1 -1
- package/prisma/pg/session.cjs.map +1 -1
- package/prisma/pg/session.js +1 -1
- package/prisma/pg/session.js.map +1 -1
- package/query-builders/query-builder.cjs.map +1 -1
- package/query-builders/query-builder.d.cts +1 -2
- package/query-builders/query-builder.d.ts +1 -2
- package/query-builders/query-builder.js.map +1 -1
- package/singlestore/driver.cjs +2 -12
- package/singlestore/driver.cjs.map +1 -1
- package/singlestore/driver.d.cts +0 -2
- package/singlestore/driver.d.ts +0 -2
- package/singlestore/driver.js +2 -12
- package/singlestore/driver.js.map +1 -1
- package/singlestore/session.cjs +5 -15
- package/singlestore/session.cjs.map +1 -1
- package/singlestore/session.d.cts +2 -12
- package/singlestore/session.d.ts +2 -12
- package/singlestore/session.js +5 -15
- package/singlestore/session.js.map +1 -1
- package/singlestore-core/db.cjs +0 -3
- package/singlestore-core/db.cjs.map +1 -1
- package/singlestore-core/db.d.cts +0 -4
- package/singlestore-core/db.d.ts +0 -4
- package/singlestore-core/db.js +0 -3
- package/singlestore-core/db.js.map +1 -1
- package/singlestore-core/query-builders/delete.cjs +1 -9
- package/singlestore-core/query-builders/delete.cjs.map +1 -1
- package/singlestore-core/query-builders/delete.js +1 -9
- package/singlestore-core/query-builders/delete.js.map +1 -1
- package/singlestore-core/query-builders/insert.cjs +1 -6
- package/singlestore-core/query-builders/insert.cjs.map +1 -1
- package/singlestore-core/query-builders/insert.js +1 -6
- package/singlestore-core/query-builders/insert.js.map +1 -1
- package/singlestore-core/query-builders/select.cjs +3 -28
- package/singlestore-core/query-builders/select.cjs.map +1 -1
- package/singlestore-core/query-builders/select.d.cts +0 -9
- package/singlestore-core/query-builders/select.d.ts +0 -9
- package/singlestore-core/query-builders/select.js +3 -28
- package/singlestore-core/query-builders/select.js.map +1 -1
- package/singlestore-core/query-builders/update.cjs +1 -9
- package/singlestore-core/query-builders/update.cjs.map +1 -1
- package/singlestore-core/query-builders/update.js +1 -9
- package/singlestore-core/query-builders/update.js.map +1 -1
- package/singlestore-core/session.cjs +0 -53
- package/singlestore-core/session.cjs.map +1 -1
- package/singlestore-core/session.d.cts +2 -14
- package/singlestore-core/session.d.ts +2 -14
- package/singlestore-core/session.js +1 -54
- package/singlestore-core/session.js.map +1 -1
- package/singlestore-core/utils.cjs +0 -16
- package/singlestore-core/utils.cjs.map +1 -1
- package/singlestore-core/utils.d.cts +0 -3
- package/singlestore-core/utils.d.ts +0 -3
- package/singlestore-core/utils.js +0 -15
- package/singlestore-core/utils.js.map +1 -1
- package/sql/sql.cjs +0 -10
- package/sql/sql.cjs.map +1 -1
- package/sql/sql.js +0 -10
- package/sql/sql.js.map +1 -1
- package/sqlite-core/db.cjs +0 -3
- package/sqlite-core/db.cjs.map +1 -1
- package/sqlite-core/db.d.cts +0 -4
- package/sqlite-core/db.d.ts +0 -4
- package/sqlite-core/db.js +0 -3
- package/sqlite-core/db.js.map +1 -1
- package/sqlite-core/query-builders/delete.cjs +1 -7
- package/sqlite-core/query-builders/delete.cjs.map +1 -1
- package/sqlite-core/query-builders/delete.js +1 -7
- package/sqlite-core/query-builders/delete.js.map +1 -1
- package/sqlite-core/query-builders/insert.cjs +1 -7
- package/sqlite-core/query-builders/insert.cjs.map +1 -1
- package/sqlite-core/query-builders/insert.js +1 -7
- package/sqlite-core/query-builders/insert.js.map +1 -1
- package/sqlite-core/query-builders/select.cjs +3 -31
- package/sqlite-core/query-builders/select.cjs.map +1 -1
- package/sqlite-core/query-builders/select.d.cts +0 -9
- package/sqlite-core/query-builders/select.d.ts +0 -9
- package/sqlite-core/query-builders/select.js +3 -31
- package/sqlite-core/query-builders/select.js.map +1 -1
- package/sqlite-core/query-builders/update.cjs +1 -7
- package/sqlite-core/query-builders/update.cjs.map +1 -1
- package/sqlite-core/query-builders/update.js +1 -7
- package/sqlite-core/query-builders/update.js.map +1 -1
- package/sqlite-core/session.cjs +3 -62
- package/sqlite-core/session.cjs.map +1 -1
- package/sqlite-core/session.d.cts +4 -18
- package/sqlite-core/session.d.ts +4 -18
- package/sqlite-core/session.js +4 -63
- package/sqlite-core/session.js.map +1 -1
- package/sqlite-core/utils.cjs +0 -16
- package/sqlite-core/utils.cjs.map +1 -1
- package/sqlite-core/utils.d.cts +2 -6
- package/sqlite-core/utils.d.ts +2 -6
- package/sqlite-core/utils.js +0 -15
- package/sqlite-core/utils.js.map +1 -1
- package/sqlite-proxy/driver.cjs +2 -9
- package/sqlite-proxy/driver.cjs.map +1 -1
- package/sqlite-proxy/driver.js +2 -9
- package/sqlite-proxy/driver.js.map +1 -1
- package/sqlite-proxy/session.cjs +8 -22
- package/sqlite-proxy/session.cjs.map +1 -1
- package/sqlite-proxy/session.d.cts +2 -12
- package/sqlite-proxy/session.d.ts +2 -12
- package/sqlite-proxy/session.js +8 -22
- package/sqlite-proxy/session.js.map +1 -1
- package/subquery.cjs +3 -4
- package/subquery.cjs.map +1 -1
- package/subquery.d.cts +1 -2
- package/subquery.d.ts +1 -2
- package/subquery.js +3 -4
- package/subquery.js.map +1 -1
- package/tidb-serverless/driver.cjs +1 -5
- package/tidb-serverless/driver.cjs.map +1 -1
- package/tidb-serverless/driver.d.cts +0 -1
- package/tidb-serverless/driver.d.ts +0 -1
- package/tidb-serverless/driver.js +1 -5
- package/tidb-serverless/driver.js.map +1 -1
- package/tidb-serverless/session.cjs +5 -15
- package/tidb-serverless/session.cjs.map +1 -1
- package/tidb-serverless/session.d.cts +2 -12
- package/tidb-serverless/session.d.ts +2 -12
- package/tidb-serverless/session.js +5 -15
- package/tidb-serverless/session.js.map +1 -1
- package/utils.cjs +0 -22
- package/utils.cjs.map +1 -1
- package/utils.d.cts +0 -3
- package/utils.d.ts +0 -3
- package/utils.js +0 -11
- package/utils.js.map +1 -1
- package/vercel-postgres/driver.cjs +2 -9
- package/vercel-postgres/driver.cjs.map +1 -1
- package/vercel-postgres/driver.d.cts +0 -2
- package/vercel-postgres/driver.d.ts +0 -2
- package/vercel-postgres/driver.js +2 -9
- package/vercel-postgres/driver.js.map +1 -1
- package/vercel-postgres/session.cjs +7 -21
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.d.cts +2 -12
- package/vercel-postgres/session.d.ts +2 -12
- package/vercel-postgres/session.js +7 -21
- 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 +2 -7
- package/xata-http/driver.cjs.map +1 -1
- package/xata-http/driver.d.cts +0 -2
- package/xata-http/driver.d.ts +0 -2
- package/xata-http/driver.js +2 -7
- package/xata-http/driver.js.map +1 -1
- package/xata-http/session.cjs +7 -21
- package/xata-http/session.cjs.map +1 -1
- package/xata-http/session.d.cts +2 -12
- package/xata-http/session.d.ts +2 -12
- package/xata-http/session.js +7 -21
- package/xata-http/session.js.map +1 -1
- package/cache/core/cache.cjs +0 -47
- package/cache/core/cache.cjs.map +0 -1
- package/cache/core/cache.d.cts +0 -35
- package/cache/core/cache.d.ts +0 -35
- package/cache/core/cache.js +0 -22
- package/cache/core/cache.js.map +0 -1
- package/cache/core/index.cjs +0 -23
- package/cache/core/index.cjs.map +0 -1
- package/cache/core/index.d.cts +0 -1
- package/cache/core/index.d.ts +0 -1
- package/cache/core/index.js +0 -2
- package/cache/core/index.js.map +0 -1
- package/cache/core/types.cjs +0 -17
- package/cache/core/types.cjs.map +0 -1
- package/cache/core/types.d.cts +0 -33
- package/cache/core/types.d.ts +0 -33
- package/cache/core/types.js +0 -1
- package/cache/core/types.js.map +0 -1
- package/cache/upstash/cache.cjs +0 -148
- package/cache/upstash/cache.cjs.map +0 -1
- package/cache/upstash/cache.d.cts +0 -29
- package/cache/upstash/cache.d.ts +0 -29
- package/cache/upstash/cache.js +0 -123
- package/cache/upstash/cache.js.map +0 -1
- package/cache/upstash/index.cjs +0 -23
- package/cache/upstash/index.cjs.map +0 -1
- package/cache/upstash/index.d.cts +0 -1
- package/cache/upstash/index.d.ts +0 -1
- package/cache/upstash/index.js +0 -2
- package/cache/upstash/index.js.map +0 -1
package/cache/core/cache.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cache/core/cache.ts"],"sourcesContent":["import { entityKind } from '~/entity.ts';\nimport type { Table } from '~/index.ts';\nimport type { CacheConfig } from './types.ts';\n\nexport abstract class Cache {\n\tstatic readonly [entityKind]: string = 'Cache';\n\n\tabstract strategy(): 'explicit' | 'all';\n\n\t/**\n\t * Invoked if we should check cache for cached response\n\t * @param sql\n\t * @param tables\n\t */\n\tabstract get(\n\t\tkey: string,\n\t\ttables: string[],\n\t\tisTag: boolean,\n\t): Promise<any[] | undefined>;\n\n\t/**\n\t * Invoked if new query should be inserted to cache\n\t * @param sql\n\t * @param tables\n\t */\n\tabstract put(\n\t\thashedQuery: string,\n\t\tresponse: any,\n\t\ttables: string[],\n\t\tisTag: boolean,\n\t\tconfig?: CacheConfig,\n\t): Promise<void>;\n\n\t/**\n\t * Invoked if insert, update, delete was invoked\n\t * @param tables\n\t */\n\tabstract onMutate(\n\t\tparams: MutationOption,\n\t): Promise<void>;\n}\n\nexport class NoopCache extends Cache {\n\toverride strategy() {\n\t\treturn 'all' as const;\n\t}\n\n\tstatic override readonly [entityKind]: string = 'NoopCache';\n\n\toverride async get(_key: string): Promise<any[] | undefined> {\n\t\treturn undefined;\n\t}\n\toverride async put(\n\t\t_hashedQuery: string,\n\t\t_response: any,\n\t\t_tables: string[],\n\t\t_config?: any,\n\t): Promise<void> {\n\t\t// noop\n\t}\n\toverride async onMutate(_params: MutationOption): Promise<void> {\n\t\t// noop\n\t}\n}\n\nexport type MutationOption = { tags?: string | string[]; tables?: Table<any> | Table<any>[] | string | string[] };\n"],"mappings":"AAAA,SAAS,kBAAkB;AAIpB,MAAe,MAAM;AAAA,EAC3B,QAAiB,UAAU,IAAY;AAmCxC;AAEO,MAAM,kBAAkB,MAAM;AAAA,EAC3B,WAAW;AACnB,WAAO;AAAA,EACR;AAAA,EAEA,QAA0B,UAAU,IAAY;AAAA,EAEhD,MAAe,IAAI,MAA0C;AAC5D,WAAO;AAAA,EACR;AAAA,EACA,MAAe,IACd,cACA,WACA,SACA,SACgB;AAAA,EAEjB;AAAA,EACA,MAAe,SAAS,SAAwC;AAAA,EAEhE;AACD;","names":[]}
|
package/cache/core/index.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var core_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(core_exports);
|
|
18
|
-
__reExport(core_exports, require("./cache.cjs"), module.exports);
|
|
19
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
-
0 && (module.exports = {
|
|
21
|
-
...require("./cache.cjs")
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=index.cjs.map
|
package/cache/core/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cache/core/index.ts"],"sourcesContent":["export * from './cache.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAc,uBAAd;","names":[]}
|
package/cache/core/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./cache.cjs";
|
package/cache/core/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./cache.js";
|
package/cache/core/index.js
DELETED
package/cache/core/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cache/core/index.ts"],"sourcesContent":["export * from './cache.ts';\n"],"mappings":"AAAA,cAAc;","names":[]}
|
package/cache/core/types.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
|
17
|
-
//# sourceMappingURL=types.cjs.map
|
package/cache/core/types.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cache/core/types.ts"],"sourcesContent":["export type CacheConfig = {\n\t/**\n\t * expire time, in seconds (a positive integer)\n\t */\n\tex?: number;\n\t/**\n\t * expire time, in milliseconds (a positive integer).\n\t */\n\tpx?: number;\n\t/**\n\t * Unix time at which the key will expire, in seconds (a positive integer).\n\t */\n\texat?: number;\n\t/**\n\t * Unix time at which the key will expire, in milliseconds (a positive integer)\n\t */\n\tpxat?: number;\n\t/**\n\t * Retain the time to live associated with the key.\n\t */\n\tkeepTtl?: boolean;\n\t/**\n\t * Set an expiration (TTL or time to live) on one or more fields of a given hash key.\n\t * Used for HEXPIRE command\n\t */\n\thexOptions?: 'NX' | 'nx' | 'XX' | 'xx' | 'GT' | 'gt' | 'LT' | 'lt';\n};\n\nexport type WithCacheConfig = { enable: boolean; config?: CacheConfig; tag?: string; autoInvalidate?: boolean };\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/cache/core/types.d.cts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export type CacheConfig = {
|
|
2
|
-
/**
|
|
3
|
-
* expire time, in seconds (a positive integer)
|
|
4
|
-
*/
|
|
5
|
-
ex?: number;
|
|
6
|
-
/**
|
|
7
|
-
* expire time, in milliseconds (a positive integer).
|
|
8
|
-
*/
|
|
9
|
-
px?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Unix time at which the key will expire, in seconds (a positive integer).
|
|
12
|
-
*/
|
|
13
|
-
exat?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Unix time at which the key will expire, in milliseconds (a positive integer)
|
|
16
|
-
*/
|
|
17
|
-
pxat?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Retain the time to live associated with the key.
|
|
20
|
-
*/
|
|
21
|
-
keepTtl?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Set an expiration (TTL or time to live) on one or more fields of a given hash key.
|
|
24
|
-
* Used for HEXPIRE command
|
|
25
|
-
*/
|
|
26
|
-
hexOptions?: 'NX' | 'nx' | 'XX' | 'xx' | 'GT' | 'gt' | 'LT' | 'lt';
|
|
27
|
-
};
|
|
28
|
-
export type WithCacheConfig = {
|
|
29
|
-
enable: boolean;
|
|
30
|
-
config?: CacheConfig;
|
|
31
|
-
tag?: string;
|
|
32
|
-
autoInvalidate?: boolean;
|
|
33
|
-
};
|
package/cache/core/types.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export type CacheConfig = {
|
|
2
|
-
/**
|
|
3
|
-
* expire time, in seconds (a positive integer)
|
|
4
|
-
*/
|
|
5
|
-
ex?: number;
|
|
6
|
-
/**
|
|
7
|
-
* expire time, in milliseconds (a positive integer).
|
|
8
|
-
*/
|
|
9
|
-
px?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Unix time at which the key will expire, in seconds (a positive integer).
|
|
12
|
-
*/
|
|
13
|
-
exat?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Unix time at which the key will expire, in milliseconds (a positive integer)
|
|
16
|
-
*/
|
|
17
|
-
pxat?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Retain the time to live associated with the key.
|
|
20
|
-
*/
|
|
21
|
-
keepTtl?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Set an expiration (TTL or time to live) on one or more fields of a given hash key.
|
|
24
|
-
* Used for HEXPIRE command
|
|
25
|
-
*/
|
|
26
|
-
hexOptions?: 'NX' | 'nx' | 'XX' | 'xx' | 'GT' | 'gt' | 'LT' | 'lt';
|
|
27
|
-
};
|
|
28
|
-
export type WithCacheConfig = {
|
|
29
|
-
enable: boolean;
|
|
30
|
-
config?: CacheConfig;
|
|
31
|
-
tag?: string;
|
|
32
|
-
autoInvalidate?: boolean;
|
|
33
|
-
};
|
package/cache/core/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.js.map
|
package/cache/core/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/cache/upstash/cache.cjs
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
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 cache_exports = {};
|
|
20
|
-
__export(cache_exports, {
|
|
21
|
-
UpstashCache: () => UpstashCache,
|
|
22
|
-
upstashCache: () => upstashCache
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(cache_exports);
|
|
25
|
-
var import_redis = require("@upstash/redis");
|
|
26
|
-
var import_core = require("../core/index.cjs");
|
|
27
|
-
var import_entity = require("../../entity.cjs");
|
|
28
|
-
var import__ = require("../../index.cjs");
|
|
29
|
-
const getByTagScript = `
|
|
30
|
-
local tagsMapKey = KEYS[1] -- tags map key
|
|
31
|
-
local tag = ARGV[1] -- tag
|
|
32
|
-
|
|
33
|
-
local compositeTableName = redis.call('HGET', tagsMapKey, tag)
|
|
34
|
-
if not compositeTableName then
|
|
35
|
-
return nil
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
local value = redis.call('HGET', compositeTableName, tag)
|
|
39
|
-
return value
|
|
40
|
-
`;
|
|
41
|
-
const onMutateScript = `
|
|
42
|
-
local tagsMapKey = KEYS[1] -- tags map key
|
|
43
|
-
local tables = {} -- initialize tables array
|
|
44
|
-
local tags = ARGV -- tags array
|
|
45
|
-
|
|
46
|
-
for i = 2, #KEYS do
|
|
47
|
-
tables[#tables + 1] = KEYS[i] -- add all keys except the first one to tables
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
if #tags > 0 then
|
|
51
|
-
for _, tag in ipairs(tags) do
|
|
52
|
-
if tag ~= nil and tag ~= '' then
|
|
53
|
-
local compositeTableName = redis.call('HGET', tagsMapKey, tag)
|
|
54
|
-
if compositeTableName then
|
|
55
|
-
redis.call('HDEL', compositeTableName, tag)
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
redis.call('HDEL', tagsMapKey, unpack(tags))
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
local keysToDelete = {}
|
|
63
|
-
|
|
64
|
-
if #tables > 0 then
|
|
65
|
-
local compositeTableNames = redis.call('SUNION', unpack(tables))
|
|
66
|
-
for _, compositeTableName in ipairs(compositeTableNames) do
|
|
67
|
-
keysToDelete[#keysToDelete + 1] = compositeTableName
|
|
68
|
-
end
|
|
69
|
-
for _, table in ipairs(tables) do
|
|
70
|
-
keysToDelete[#keysToDelete + 1] = table
|
|
71
|
-
end
|
|
72
|
-
redis.call('DEL', unpack(keysToDelete))
|
|
73
|
-
end
|
|
74
|
-
`;
|
|
75
|
-
class UpstashCache extends import_core.Cache {
|
|
76
|
-
constructor(redis, config, useGlobally) {
|
|
77
|
-
super();
|
|
78
|
-
this.redis = redis;
|
|
79
|
-
this.useGlobally = useGlobally;
|
|
80
|
-
this.internalConfig = this.toInternalConfig(config);
|
|
81
|
-
this.luaScripts = {
|
|
82
|
-
getByTagScript: this.redis.createScript(getByTagScript, { readonly: true }),
|
|
83
|
-
onMutateScript: this.redis.createScript(onMutateScript)
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
static [import_entity.entityKind] = "UpstashCache";
|
|
87
|
-
static compositeTableSetPrefix = "__ct__";
|
|
88
|
-
static tagsMapKey = "__tagsMap__";
|
|
89
|
-
globalTtl = 1;
|
|
90
|
-
luaScripts;
|
|
91
|
-
internalConfig;
|
|
92
|
-
strategy() {
|
|
93
|
-
return this.useGlobally ? "all" : "explicit";
|
|
94
|
-
}
|
|
95
|
-
toInternalConfig(config) {
|
|
96
|
-
return config ? {
|
|
97
|
-
seconds: config.ex,
|
|
98
|
-
hexOptions: config.hexOptions
|
|
99
|
-
} : void 0;
|
|
100
|
-
}
|
|
101
|
-
async get(key, tables, isTag = false) {
|
|
102
|
-
if (isTag) {
|
|
103
|
-
const result2 = await this.luaScripts.getByTagScript.exec([UpstashCache.tagsMapKey], [key]);
|
|
104
|
-
return result2 === null ? void 0 : result2;
|
|
105
|
-
}
|
|
106
|
-
const compositeKey = this.getCompositeKey(tables);
|
|
107
|
-
const result = (await this.redis.hget(compositeKey, key)) ?? void 0;
|
|
108
|
-
return result === null ? void 0 : result;
|
|
109
|
-
}
|
|
110
|
-
async put(key, response, tables, isTag = false, config) {
|
|
111
|
-
const pipeline = this.redis.pipeline();
|
|
112
|
-
const compositeKey = this.getCompositeKey(tables);
|
|
113
|
-
const ttlSeconds = config && config.ex ? config.ex : this.globalTtl;
|
|
114
|
-
const hexOptions = config && config.hexOptions ? config.hexOptions : this.internalConfig?.hexOptions;
|
|
115
|
-
pipeline.hset(compositeKey, { [key]: response });
|
|
116
|
-
pipeline.hexpire(compositeKey, key, ttlSeconds, hexOptions);
|
|
117
|
-
if (isTag) {
|
|
118
|
-
pipeline.hset(UpstashCache.tagsMapKey, { [key]: compositeKey });
|
|
119
|
-
pipeline.hexpire(UpstashCache.tagsMapKey, key, ttlSeconds, hexOptions);
|
|
120
|
-
}
|
|
121
|
-
for (const table of tables) {
|
|
122
|
-
pipeline.sadd(this.addTablePrefix(table), compositeKey);
|
|
123
|
-
}
|
|
124
|
-
await pipeline.exec();
|
|
125
|
-
}
|
|
126
|
-
async onMutate(params) {
|
|
127
|
-
const tags = Array.isArray(params.tags) ? params.tags : params.tags ? [params.tags] : [];
|
|
128
|
-
const tables = Array.isArray(params.tables) ? params.tables : params.tables ? [params.tables] : [];
|
|
129
|
-
const tableNames = tables.map((table) => (0, import_entity.is)(table, import__.Table) ? table[import__.OriginalName] : table);
|
|
130
|
-
const compositeTableSets = tableNames.map((table) => this.addTablePrefix(table));
|
|
131
|
-
await this.luaScripts.onMutateScript.exec([UpstashCache.tagsMapKey, ...compositeTableSets], tags);
|
|
132
|
-
}
|
|
133
|
-
addTablePrefix = (table) => `${UpstashCache.compositeTableSetPrefix}${table}`;
|
|
134
|
-
getCompositeKey = (tables) => tables.sort().join(",");
|
|
135
|
-
}
|
|
136
|
-
function upstashCache({ url, token, config, global = false }) {
|
|
137
|
-
const redis = new import_redis.Redis({
|
|
138
|
-
url,
|
|
139
|
-
token
|
|
140
|
-
});
|
|
141
|
-
return new UpstashCache(redis, config, global);
|
|
142
|
-
}
|
|
143
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
144
|
-
0 && (module.exports = {
|
|
145
|
-
UpstashCache,
|
|
146
|
-
upstashCache
|
|
147
|
-
});
|
|
148
|
-
//# sourceMappingURL=cache.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cache/upstash/cache.ts"],"sourcesContent":["import { Redis } from '@upstash/redis';\nimport type { MutationOption } from '~/cache/core/index.ts';\nimport { Cache } from '~/cache/core/index.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport { OriginalName, Table } from '~/index.ts';\nimport type { CacheConfig } from '../core/types.ts';\n\nconst getByTagScript = `\nlocal tagsMapKey = KEYS[1] -- tags map key\nlocal tag = ARGV[1] -- tag\n\nlocal compositeTableName = redis.call('HGET', tagsMapKey, tag)\nif not compositeTableName then\n return nil\nend\n\nlocal value = redis.call('HGET', compositeTableName, tag)\nreturn value\n`;\n\nconst onMutateScript = `\nlocal tagsMapKey = KEYS[1] -- tags map key\nlocal tables = {} -- initialize tables array\nlocal tags = ARGV -- tags array\n\nfor i = 2, #KEYS do\n tables[#tables + 1] = KEYS[i] -- add all keys except the first one to tables\nend\n\nif #tags > 0 then\n for _, tag in ipairs(tags) do\n if tag ~= nil and tag ~= '' then\n local compositeTableName = redis.call('HGET', tagsMapKey, tag)\n if compositeTableName then\n redis.call('HDEL', compositeTableName, tag)\n end\n end\n end\n redis.call('HDEL', tagsMapKey, unpack(tags))\nend\n\nlocal keysToDelete = {}\n\nif #tables > 0 then\n local compositeTableNames = redis.call('SUNION', unpack(tables))\n for _, compositeTableName in ipairs(compositeTableNames) do\n keysToDelete[#keysToDelete + 1] = compositeTableName\n end\n for _, table in ipairs(tables) do\n keysToDelete[#keysToDelete + 1] = table\n end\n redis.call('DEL', unpack(keysToDelete))\nend\n`;\n\ntype Script = ReturnType<Redis['createScript']>;\n\ntype ExpireOptions = 'NX' | 'nx' | 'XX' | 'xx' | 'GT' | 'gt' | 'LT' | 'lt';\n\nexport class UpstashCache extends Cache {\n\tstatic override readonly [entityKind]: string = 'UpstashCache';\n\tprivate static compositeTableSetPrefix = '__ct__';\n\tprivate static tagsMapKey = '__tagsMap__';\n\n\tprivate globalTtl: number = 1;\n\n\tprivate luaScripts: {\n\t\tgetByTagScript: Script;\n\t\tonMutateScript: Script;\n\t};\n\n\tprivate internalConfig?: { seconds: number; hexOptions: ExpireOptions };\n\n\tconstructor(public redis: Redis, config?: CacheConfig, protected useGlobally?: boolean) {\n\t\tsuper();\n\t\tthis.internalConfig = this.toInternalConfig(config);\n\t\tthis.luaScripts = {\n\t\t\tgetByTagScript: this.redis.createScript(getByTagScript, { readonly: true }),\n\t\t\tonMutateScript: this.redis.createScript(onMutateScript),\n\t\t};\n\t}\n\n\tpublic strategy() {\n\t\treturn this.useGlobally ? 'all' : 'explicit';\n\t}\n\n\tprivate toInternalConfig(config?: CacheConfig) {\n\t\treturn config\n\t\t\t? {\n\t\t\t\tseconds: config.ex,\n\t\t\t\thexOptions: config.hexOptions,\n\t\t\t} as { seconds: number; hexOptions: ExpireOptions }\n\t\t\t: undefined;\n\t}\n\n\toverride async get(key: string, tables: string[], isTag: boolean = false): Promise<any[] | undefined> {\n\t\tif (isTag) {\n\t\t\tconst result = await this.luaScripts.getByTagScript.exec([UpstashCache.tagsMapKey], [key]);\n\t\t\treturn result === null ? undefined : result as any[];\n\t\t}\n\n\t\t// Normal cache lookup for the composite key\n\t\tconst compositeKey = this.getCompositeKey(tables);\n\t\tconst result = await this.redis.hget(compositeKey, key) ?? undefined; // Retrieve result for normal query\n\t\treturn result === null ? undefined : result as any[];\n\t}\n\n\toverride async put(\n\t\tkey: string,\n\t\tresponse: any,\n\t\ttables: string[],\n\t\tisTag: boolean = false,\n\t\tconfig?: CacheConfig,\n\t): Promise<void> {\n\t\tconst pipeline = this.redis.pipeline();\n\t\tconst compositeKey = this.getCompositeKey(tables);\n\t\tconst ttlSeconds = config && config.ex ? config.ex : this.globalTtl;\n\t\tconst hexOptions = config && config.hexOptions ? config.hexOptions : this.internalConfig?.hexOptions;\n\n\t\tpipeline.hset(compositeKey, { [key]: response }); // Store the result with the tag under the composite key\n\t\tpipeline.hexpire(compositeKey, key, ttlSeconds, hexOptions); // Set expiration for the composite key\n\n\t\tif (isTag) {\n\t\t\tpipeline.hset(UpstashCache.tagsMapKey, { [key]: compositeKey }); // Store the tag and its composite key in the map\n\t\t\tpipeline.hexpire(UpstashCache.tagsMapKey, key, ttlSeconds, hexOptions); // Set expiration for the tag\n\t\t}\n\n\t\tfor (const table of tables) {\n\t\t\tpipeline.sadd(this.addTablePrefix(table), compositeKey);\n\t\t}\n\n\t\tawait pipeline.exec();\n\t}\n\n\toverride async onMutate(params: MutationOption) {\n\t\tconst tags = Array.isArray(params.tags) ? params.tags : params.tags ? [params.tags] : [];\n\t\tconst tables = Array.isArray(params.tables) ? params.tables : params.tables ? [params.tables] : [];\n\t\tconst tableNames: string[] = tables.map((table) => is(table, Table) ? table[OriginalName] : table as string);\n\n\t\tconst compositeTableSets = tableNames.map((table) => this.addTablePrefix(table));\n\t\tawait this.luaScripts.onMutateScript.exec([UpstashCache.tagsMapKey, ...compositeTableSets], tags);\n\t}\n\n\tprivate addTablePrefix = (table: string) => `${UpstashCache.compositeTableSetPrefix}${table}`;\n\tprivate getCompositeKey = (tables: string[]) => tables.sort().join(',');\n}\n\nexport function upstashCache(\n\t{ url, token, config, global = false }: { url: string; token: string; config?: CacheConfig; global?: boolean },\n): UpstashCache {\n\tconst redis = new Redis({\n\t\turl,\n\t\ttoken,\n\t});\n\n\treturn new UpstashCache(redis, config, global);\n}\n"],"mappings":"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","names":["result"]}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Redis } from '@upstash/redis';
|
|
2
|
-
import type { MutationOption } from "../core/index.cjs";
|
|
3
|
-
import { Cache } from "../core/index.cjs";
|
|
4
|
-
import { entityKind } from "../../entity.cjs";
|
|
5
|
-
import type { CacheConfig } from "../core/types.cjs";
|
|
6
|
-
export declare class UpstashCache extends Cache {
|
|
7
|
-
redis: Redis;
|
|
8
|
-
protected useGlobally?: boolean | undefined;
|
|
9
|
-
static readonly [entityKind]: string;
|
|
10
|
-
private static compositeTableSetPrefix;
|
|
11
|
-
private static tagsMapKey;
|
|
12
|
-
private globalTtl;
|
|
13
|
-
private luaScripts;
|
|
14
|
-
private internalConfig?;
|
|
15
|
-
constructor(redis: Redis, config?: CacheConfig, useGlobally?: boolean | undefined);
|
|
16
|
-
strategy(): "all" | "explicit";
|
|
17
|
-
private toInternalConfig;
|
|
18
|
-
get(key: string, tables: string[], isTag?: boolean): Promise<any[] | undefined>;
|
|
19
|
-
put(key: string, response: any, tables: string[], isTag?: boolean, config?: CacheConfig): Promise<void>;
|
|
20
|
-
onMutate(params: MutationOption): Promise<void>;
|
|
21
|
-
private addTablePrefix;
|
|
22
|
-
private getCompositeKey;
|
|
23
|
-
}
|
|
24
|
-
export declare function upstashCache({ url, token, config, global }: {
|
|
25
|
-
url: string;
|
|
26
|
-
token: string;
|
|
27
|
-
config?: CacheConfig;
|
|
28
|
-
global?: boolean;
|
|
29
|
-
}): UpstashCache;
|
package/cache/upstash/cache.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Redis } from '@upstash/redis';
|
|
2
|
-
import type { MutationOption } from "../core/index.js";
|
|
3
|
-
import { Cache } from "../core/index.js";
|
|
4
|
-
import { entityKind } from "../../entity.js";
|
|
5
|
-
import type { CacheConfig } from "../core/types.js";
|
|
6
|
-
export declare class UpstashCache extends Cache {
|
|
7
|
-
redis: Redis;
|
|
8
|
-
protected useGlobally?: boolean | undefined;
|
|
9
|
-
static readonly [entityKind]: string;
|
|
10
|
-
private static compositeTableSetPrefix;
|
|
11
|
-
private static tagsMapKey;
|
|
12
|
-
private globalTtl;
|
|
13
|
-
private luaScripts;
|
|
14
|
-
private internalConfig?;
|
|
15
|
-
constructor(redis: Redis, config?: CacheConfig, useGlobally?: boolean | undefined);
|
|
16
|
-
strategy(): "all" | "explicit";
|
|
17
|
-
private toInternalConfig;
|
|
18
|
-
get(key: string, tables: string[], isTag?: boolean): Promise<any[] | undefined>;
|
|
19
|
-
put(key: string, response: any, tables: string[], isTag?: boolean, config?: CacheConfig): Promise<void>;
|
|
20
|
-
onMutate(params: MutationOption): Promise<void>;
|
|
21
|
-
private addTablePrefix;
|
|
22
|
-
private getCompositeKey;
|
|
23
|
-
}
|
|
24
|
-
export declare function upstashCache({ url, token, config, global }: {
|
|
25
|
-
url: string;
|
|
26
|
-
token: string;
|
|
27
|
-
config?: CacheConfig;
|
|
28
|
-
global?: boolean;
|
|
29
|
-
}): UpstashCache;
|
package/cache/upstash/cache.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { Redis } from "@upstash/redis";
|
|
2
|
-
import { Cache } from "../core/index.js";
|
|
3
|
-
import { entityKind, is } from "../../entity.js";
|
|
4
|
-
import { OriginalName, Table } from "../../index.js";
|
|
5
|
-
const getByTagScript = `
|
|
6
|
-
local tagsMapKey = KEYS[1] -- tags map key
|
|
7
|
-
local tag = ARGV[1] -- tag
|
|
8
|
-
|
|
9
|
-
local compositeTableName = redis.call('HGET', tagsMapKey, tag)
|
|
10
|
-
if not compositeTableName then
|
|
11
|
-
return nil
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
local value = redis.call('HGET', compositeTableName, tag)
|
|
15
|
-
return value
|
|
16
|
-
`;
|
|
17
|
-
const onMutateScript = `
|
|
18
|
-
local tagsMapKey = KEYS[1] -- tags map key
|
|
19
|
-
local tables = {} -- initialize tables array
|
|
20
|
-
local tags = ARGV -- tags array
|
|
21
|
-
|
|
22
|
-
for i = 2, #KEYS do
|
|
23
|
-
tables[#tables + 1] = KEYS[i] -- add all keys except the first one to tables
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
if #tags > 0 then
|
|
27
|
-
for _, tag in ipairs(tags) do
|
|
28
|
-
if tag ~= nil and tag ~= '' then
|
|
29
|
-
local compositeTableName = redis.call('HGET', tagsMapKey, tag)
|
|
30
|
-
if compositeTableName then
|
|
31
|
-
redis.call('HDEL', compositeTableName, tag)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
redis.call('HDEL', tagsMapKey, unpack(tags))
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
local keysToDelete = {}
|
|
39
|
-
|
|
40
|
-
if #tables > 0 then
|
|
41
|
-
local compositeTableNames = redis.call('SUNION', unpack(tables))
|
|
42
|
-
for _, compositeTableName in ipairs(compositeTableNames) do
|
|
43
|
-
keysToDelete[#keysToDelete + 1] = compositeTableName
|
|
44
|
-
end
|
|
45
|
-
for _, table in ipairs(tables) do
|
|
46
|
-
keysToDelete[#keysToDelete + 1] = table
|
|
47
|
-
end
|
|
48
|
-
redis.call('DEL', unpack(keysToDelete))
|
|
49
|
-
end
|
|
50
|
-
`;
|
|
51
|
-
class UpstashCache extends Cache {
|
|
52
|
-
constructor(redis, config, useGlobally) {
|
|
53
|
-
super();
|
|
54
|
-
this.redis = redis;
|
|
55
|
-
this.useGlobally = useGlobally;
|
|
56
|
-
this.internalConfig = this.toInternalConfig(config);
|
|
57
|
-
this.luaScripts = {
|
|
58
|
-
getByTagScript: this.redis.createScript(getByTagScript, { readonly: true }),
|
|
59
|
-
onMutateScript: this.redis.createScript(onMutateScript)
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
static [entityKind] = "UpstashCache";
|
|
63
|
-
static compositeTableSetPrefix = "__ct__";
|
|
64
|
-
static tagsMapKey = "__tagsMap__";
|
|
65
|
-
globalTtl = 1;
|
|
66
|
-
luaScripts;
|
|
67
|
-
internalConfig;
|
|
68
|
-
strategy() {
|
|
69
|
-
return this.useGlobally ? "all" : "explicit";
|
|
70
|
-
}
|
|
71
|
-
toInternalConfig(config) {
|
|
72
|
-
return config ? {
|
|
73
|
-
seconds: config.ex,
|
|
74
|
-
hexOptions: config.hexOptions
|
|
75
|
-
} : void 0;
|
|
76
|
-
}
|
|
77
|
-
async get(key, tables, isTag = false) {
|
|
78
|
-
if (isTag) {
|
|
79
|
-
const result2 = await this.luaScripts.getByTagScript.exec([UpstashCache.tagsMapKey], [key]);
|
|
80
|
-
return result2 === null ? void 0 : result2;
|
|
81
|
-
}
|
|
82
|
-
const compositeKey = this.getCompositeKey(tables);
|
|
83
|
-
const result = (await this.redis.hget(compositeKey, key)) ?? void 0;
|
|
84
|
-
return result === null ? void 0 : result;
|
|
85
|
-
}
|
|
86
|
-
async put(key, response, tables, isTag = false, config) {
|
|
87
|
-
const pipeline = this.redis.pipeline();
|
|
88
|
-
const compositeKey = this.getCompositeKey(tables);
|
|
89
|
-
const ttlSeconds = config && config.ex ? config.ex : this.globalTtl;
|
|
90
|
-
const hexOptions = config && config.hexOptions ? config.hexOptions : this.internalConfig?.hexOptions;
|
|
91
|
-
pipeline.hset(compositeKey, { [key]: response });
|
|
92
|
-
pipeline.hexpire(compositeKey, key, ttlSeconds, hexOptions);
|
|
93
|
-
if (isTag) {
|
|
94
|
-
pipeline.hset(UpstashCache.tagsMapKey, { [key]: compositeKey });
|
|
95
|
-
pipeline.hexpire(UpstashCache.tagsMapKey, key, ttlSeconds, hexOptions);
|
|
96
|
-
}
|
|
97
|
-
for (const table of tables) {
|
|
98
|
-
pipeline.sadd(this.addTablePrefix(table), compositeKey);
|
|
99
|
-
}
|
|
100
|
-
await pipeline.exec();
|
|
101
|
-
}
|
|
102
|
-
async onMutate(params) {
|
|
103
|
-
const tags = Array.isArray(params.tags) ? params.tags : params.tags ? [params.tags] : [];
|
|
104
|
-
const tables = Array.isArray(params.tables) ? params.tables : params.tables ? [params.tables] : [];
|
|
105
|
-
const tableNames = tables.map((table) => is(table, Table) ? table[OriginalName] : table);
|
|
106
|
-
const compositeTableSets = tableNames.map((table) => this.addTablePrefix(table));
|
|
107
|
-
await this.luaScripts.onMutateScript.exec([UpstashCache.tagsMapKey, ...compositeTableSets], tags);
|
|
108
|
-
}
|
|
109
|
-
addTablePrefix = (table) => `${UpstashCache.compositeTableSetPrefix}${table}`;
|
|
110
|
-
getCompositeKey = (tables) => tables.sort().join(",");
|
|
111
|
-
}
|
|
112
|
-
function upstashCache({ url, token, config, global = false }) {
|
|
113
|
-
const redis = new Redis({
|
|
114
|
-
url,
|
|
115
|
-
token
|
|
116
|
-
});
|
|
117
|
-
return new UpstashCache(redis, config, global);
|
|
118
|
-
}
|
|
119
|
-
export {
|
|
120
|
-
UpstashCache,
|
|
121
|
-
upstashCache
|
|
122
|
-
};
|
|
123
|
-
//# sourceMappingURL=cache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cache/upstash/cache.ts"],"sourcesContent":["import { Redis } from '@upstash/redis';\nimport type { MutationOption } from '~/cache/core/index.ts';\nimport { Cache } from '~/cache/core/index.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport { OriginalName, Table } from '~/index.ts';\nimport type { CacheConfig } from '../core/types.ts';\n\nconst getByTagScript = `\nlocal tagsMapKey = KEYS[1] -- tags map key\nlocal tag = ARGV[1] -- tag\n\nlocal compositeTableName = redis.call('HGET', tagsMapKey, tag)\nif not compositeTableName then\n return nil\nend\n\nlocal value = redis.call('HGET', compositeTableName, tag)\nreturn value\n`;\n\nconst onMutateScript = `\nlocal tagsMapKey = KEYS[1] -- tags map key\nlocal tables = {} -- initialize tables array\nlocal tags = ARGV -- tags array\n\nfor i = 2, #KEYS do\n tables[#tables + 1] = KEYS[i] -- add all keys except the first one to tables\nend\n\nif #tags > 0 then\n for _, tag in ipairs(tags) do\n if tag ~= nil and tag ~= '' then\n local compositeTableName = redis.call('HGET', tagsMapKey, tag)\n if compositeTableName then\n redis.call('HDEL', compositeTableName, tag)\n end\n end\n end\n redis.call('HDEL', tagsMapKey, unpack(tags))\nend\n\nlocal keysToDelete = {}\n\nif #tables > 0 then\n local compositeTableNames = redis.call('SUNION', unpack(tables))\n for _, compositeTableName in ipairs(compositeTableNames) do\n keysToDelete[#keysToDelete + 1] = compositeTableName\n end\n for _, table in ipairs(tables) do\n keysToDelete[#keysToDelete + 1] = table\n end\n redis.call('DEL', unpack(keysToDelete))\nend\n`;\n\ntype Script = ReturnType<Redis['createScript']>;\n\ntype ExpireOptions = 'NX' | 'nx' | 'XX' | 'xx' | 'GT' | 'gt' | 'LT' | 'lt';\n\nexport class UpstashCache extends Cache {\n\tstatic override readonly [entityKind]: string = 'UpstashCache';\n\tprivate static compositeTableSetPrefix = '__ct__';\n\tprivate static tagsMapKey = '__tagsMap__';\n\n\tprivate globalTtl: number = 1;\n\n\tprivate luaScripts: {\n\t\tgetByTagScript: Script;\n\t\tonMutateScript: Script;\n\t};\n\n\tprivate internalConfig?: { seconds: number; hexOptions: ExpireOptions };\n\n\tconstructor(public redis: Redis, config?: CacheConfig, protected useGlobally?: boolean) {\n\t\tsuper();\n\t\tthis.internalConfig = this.toInternalConfig(config);\n\t\tthis.luaScripts = {\n\t\t\tgetByTagScript: this.redis.createScript(getByTagScript, { readonly: true }),\n\t\t\tonMutateScript: this.redis.createScript(onMutateScript),\n\t\t};\n\t}\n\n\tpublic strategy() {\n\t\treturn this.useGlobally ? 'all' : 'explicit';\n\t}\n\n\tprivate toInternalConfig(config?: CacheConfig) {\n\t\treturn config\n\t\t\t? {\n\t\t\t\tseconds: config.ex,\n\t\t\t\thexOptions: config.hexOptions,\n\t\t\t} as { seconds: number; hexOptions: ExpireOptions }\n\t\t\t: undefined;\n\t}\n\n\toverride async get(key: string, tables: string[], isTag: boolean = false): Promise<any[] | undefined> {\n\t\tif (isTag) {\n\t\t\tconst result = await this.luaScripts.getByTagScript.exec([UpstashCache.tagsMapKey], [key]);\n\t\t\treturn result === null ? undefined : result as any[];\n\t\t}\n\n\t\t// Normal cache lookup for the composite key\n\t\tconst compositeKey = this.getCompositeKey(tables);\n\t\tconst result = await this.redis.hget(compositeKey, key) ?? undefined; // Retrieve result for normal query\n\t\treturn result === null ? undefined : result as any[];\n\t}\n\n\toverride async put(\n\t\tkey: string,\n\t\tresponse: any,\n\t\ttables: string[],\n\t\tisTag: boolean = false,\n\t\tconfig?: CacheConfig,\n\t): Promise<void> {\n\t\tconst pipeline = this.redis.pipeline();\n\t\tconst compositeKey = this.getCompositeKey(tables);\n\t\tconst ttlSeconds = config && config.ex ? config.ex : this.globalTtl;\n\t\tconst hexOptions = config && config.hexOptions ? config.hexOptions : this.internalConfig?.hexOptions;\n\n\t\tpipeline.hset(compositeKey, { [key]: response }); // Store the result with the tag under the composite key\n\t\tpipeline.hexpire(compositeKey, key, ttlSeconds, hexOptions); // Set expiration for the composite key\n\n\t\tif (isTag) {\n\t\t\tpipeline.hset(UpstashCache.tagsMapKey, { [key]: compositeKey }); // Store the tag and its composite key in the map\n\t\t\tpipeline.hexpire(UpstashCache.tagsMapKey, key, ttlSeconds, hexOptions); // Set expiration for the tag\n\t\t}\n\n\t\tfor (const table of tables) {\n\t\t\tpipeline.sadd(this.addTablePrefix(table), compositeKey);\n\t\t}\n\n\t\tawait pipeline.exec();\n\t}\n\n\toverride async onMutate(params: MutationOption) {\n\t\tconst tags = Array.isArray(params.tags) ? params.tags : params.tags ? [params.tags] : [];\n\t\tconst tables = Array.isArray(params.tables) ? params.tables : params.tables ? [params.tables] : [];\n\t\tconst tableNames: string[] = tables.map((table) => is(table, Table) ? table[OriginalName] : table as string);\n\n\t\tconst compositeTableSets = tableNames.map((table) => this.addTablePrefix(table));\n\t\tawait this.luaScripts.onMutateScript.exec([UpstashCache.tagsMapKey, ...compositeTableSets], tags);\n\t}\n\n\tprivate addTablePrefix = (table: string) => `${UpstashCache.compositeTableSetPrefix}${table}`;\n\tprivate getCompositeKey = (tables: string[]) => tables.sort().join(',');\n}\n\nexport function upstashCache(\n\t{ url, token, config, global = false }: { url: string; token: string; config?: CacheConfig; global?: boolean },\n): UpstashCache {\n\tconst redis = new Redis({\n\t\turl,\n\t\ttoken,\n\t});\n\n\treturn new UpstashCache(redis, config, global);\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAEtB,SAAS,aAAa;AACtB,SAAS,YAAY,UAAU;AAC/B,SAAS,cAAc,aAAa;AAGpC,MAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAavB,MAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuChB,MAAM,qBAAqB,MAAM;AAAA,EAcvC,YAAmB,OAAc,QAAgC,aAAuB;AACvF,UAAM;AADY;AAA8C;AAEhE,SAAK,iBAAiB,KAAK,iBAAiB,MAAM;AAClD,SAAK,aAAa;AAAA,MACjB,gBAAgB,KAAK,MAAM,aAAa,gBAAgB,EAAE,UAAU,KAAK,CAAC;AAAA,MAC1E,gBAAgB,KAAK,MAAM,aAAa,cAAc;AAAA,IACvD;AAAA,EACD;AAAA,EApBA,QAA0B,UAAU,IAAY;AAAA,EAChD,OAAe,0BAA0B;AAAA,EACzC,OAAe,aAAa;AAAA,EAEpB,YAAoB;AAAA,EAEpB;AAAA,EAKA;AAAA,EAWD,WAAW;AACjB,WAAO,KAAK,cAAc,QAAQ;AAAA,EACnC;AAAA,EAEQ,iBAAiB,QAAsB;AAC9C,WAAO,SACJ;AAAA,MACD,SAAS,OAAO;AAAA,MAChB,YAAY,OAAO;AAAA,IACpB,IACE;AAAA,EACJ;AAAA,EAEA,MAAe,IAAI,KAAa,QAAkB,QAAiB,OAAmC;AACrG,QAAI,OAAO;AACV,YAAMA,UAAS,MAAM,KAAK,WAAW,eAAe,KAAK,CAAC,aAAa,UAAU,GAAG,CAAC,GAAG,CAAC;AACzF,aAAOA,YAAW,OAAO,SAAYA;AAAA,IACtC;AAGA,UAAM,eAAe,KAAK,gBAAgB,MAAM;AAChD,UAAM,SAAS,MAAM,KAAK,MAAM,KAAK,cAAc,GAAG,KAAK;AAC3D,WAAO,WAAW,OAAO,SAAY;AAAA,EACtC;AAAA,EAEA,MAAe,IACd,KACA,UACA,QACA,QAAiB,OACjB,QACgB;AAChB,UAAM,WAAW,KAAK,MAAM,SAAS;AACrC,UAAM,eAAe,KAAK,gBAAgB,MAAM;AAChD,UAAM,aAAa,UAAU,OAAO,KAAK,OAAO,KAAK,KAAK;AAC1D,UAAM,aAAa,UAAU,OAAO,aAAa,OAAO,aAAa,KAAK,gBAAgB;AAE1F,aAAS,KAAK,cAAc,EAAE,CAAC,GAAG,GAAG,SAAS,CAAC;AAC/C,aAAS,QAAQ,cAAc,KAAK,YAAY,UAAU;AAE1D,QAAI,OAAO;AACV,eAAS,KAAK,aAAa,YAAY,EAAE,CAAC,GAAG,GAAG,aAAa,CAAC;AAC9D,eAAS,QAAQ,aAAa,YAAY,KAAK,YAAY,UAAU;AAAA,IACtE;AAEA,eAAW,SAAS,QAAQ;AAC3B,eAAS,KAAK,KAAK,eAAe,KAAK,GAAG,YAAY;AAAA,IACvD;AAEA,UAAM,SAAS,KAAK;AAAA,EACrB;AAAA,EAEA,MAAe,SAAS,QAAwB;AAC/C,UAAM,OAAO,MAAM,QAAQ,OAAO,IAAI,IAAI,OAAO,OAAO,OAAO,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;AACvF,UAAM,SAAS,MAAM,QAAQ,OAAO,MAAM,IAAI,OAAO,SAAS,OAAO,SAAS,CAAC,OAAO,MAAM,IAAI,CAAC;AACjG,UAAM,aAAuB,OAAO,IAAI,CAAC,UAAU,GAAG,OAAO,KAAK,IAAI,MAAM,YAAY,IAAI,KAAe;AAE3G,UAAM,qBAAqB,WAAW,IAAI,CAAC,UAAU,KAAK,eAAe,KAAK,CAAC;AAC/E,UAAM,KAAK,WAAW,eAAe,KAAK,CAAC,aAAa,YAAY,GAAG,kBAAkB,GAAG,IAAI;AAAA,EACjG;AAAA,EAEQ,iBAAiB,CAAC,UAAkB,GAAG,aAAa,uBAAuB,GAAG,KAAK;AAAA,EACnF,kBAAkB,CAAC,WAAqB,OAAO,KAAK,EAAE,KAAK,GAAG;AACvE;AAEO,SAAS,aACf,EAAE,KAAK,OAAO,QAAQ,SAAS,MAAM,GACtB;AACf,QAAM,QAAQ,IAAI,MAAM;AAAA,IACvB;AAAA,IACA;AAAA,EACD,CAAC;AAED,SAAO,IAAI,aAAa,OAAO,QAAQ,MAAM;AAC9C;","names":["result"]}
|
package/cache/upstash/index.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var upstash_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(upstash_exports);
|
|
18
|
-
__reExport(upstash_exports, require("./cache.cjs"), module.exports);
|
|
19
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
-
0 && (module.exports = {
|
|
21
|
-
...require("./cache.cjs")
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cache/upstash/index.ts"],"sourcesContent":["export * from './cache.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,uBAAd;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./cache.cjs";
|
package/cache/upstash/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./cache.js";
|
package/cache/upstash/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cache/upstash/index.ts"],"sourcesContent":["export * from './cache.ts';\n"],"mappings":"AAAA,cAAc;","names":[]}
|