{"_id":"db-result","_rev":"7-98f019366719ce713771b66712f4b5b9","name":"db-result","dist-tags":{"latest":"0.3.2"},"versions":{"0.1.0":{"name":"db-result","version":"0.1.0","keywords":["better-result","database","driver","drizzle","error-handling","kysely","mssql","mysql","postgres","prisma","result","retry","sql","sqlite","sqlstate"],"author":{"name":"jokull"},"license":"MIT","_id":"db-result@0.1.0","maintainers":[{"name":"jokullsolberg","email":"jokull@solberg.is"}],"homepage":"https://github.com/jokull/db-result#readme","bugs":{"url":"https://github.com/jokull/db-result/issues"},"dist":{"shasum":"c0fec38ea77345aaa7105488b07694a60fe8ec81","tarball":"https://registry.npmjs.org/db-result/-/db-result-0.1.0.tgz","fileCount":35,"integrity":"sha512-AhgpsR4NfMmhFeuuvt2FrBp6Rx/fII5nuYCiakn5RF+rgzOYG0QEDBJ2pdtgFfSzhpKfES/5bMywxalLutRBMg==","signatures":[{"sig":"MEQCIEHFdE9yzdASYoGLx1Nuy7tdcPc2h/pP+2nE8v91zAUmAiBUWzWiI1DkK75eOMQw0THAH9rp0pSHi1n/j2oT9l6D2w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":187913},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./d1":{"types":"./dist/drivers/d1.d.mts","import":"./dist/drivers/d1.mjs","default":"./dist/drivers/d1.mjs"},"./pg":{"types":"./dist/drivers/pg.d.mts","import":"./dist/drivers/pg.mjs","default":"./dist/drivers/pg.mjs"},"./mssql":{"types":"./dist/drivers/mssql.d.mts","import":"./dist/drivers/mssql.mjs","default":"./dist/drivers/mssql.mjs"},"./kysely":{"types":"./dist/kysely.d.mts","import":"./dist/kysely.mjs","default":"./dist/kysely.mjs"},"./mysql2":{"types":"./dist/drivers/mysql2.d.mts","import":"./dist/drivers/mysql2.mjs","default":"./dist/drivers/mysql2.mjs"},"./prisma":{"types":"./dist/prisma.d.mts","import":"./dist/prisma.mjs","default":"./dist/prisma.mjs"},"./sqlite":{"types":"./dist/drivers/sqlite.d.mts","import":"./dist/drivers/sqlite.mjs","default":"./dist/drivers/sqlite.mjs"},"./drizzle":{"types":"./dist/drizzle.d.mts","import":"./dist/drizzle.mjs","default":"./dist/drizzle.mjs"}},"gitHead":"ae13d1d25471788c4846a7aa72f900ebd0bbd8f8","scripts":{"fmt":"oxfmt .","lint":"oxlint .","test":"bun test","build":"tsdown","check":"tsc --noEmit","fmt:check":"oxfmt --check .","db:generate":"prisma generate","check:exports":"bunx publint && bunx attw --pack --profile esm-only","prepublishOnly":"bun run build","test:integration":"bun test src/integration.test.ts","check:typescript-minimum":"bun run build && bun x --yes --package typescript@5.4.5 tsc -p tsconfig.typescript-minimum.json"},"_npmUser":{"name":"jokullsolberg","email":"jokull@solberg.is"},"deprecated":"superseded by 0.2.0","repository":{"url":"git+https://github.com/jokull/db-result.git","type":"git"},"_npmVersion":"11.16.0","description":"Database failures as better-result tagged errors — Result<T, DbError>, retry-safe, driver-agnostic.","directories":{},"sideEffects":false,"_nodeVersion":"24.18.1","dependencies":{"better-result":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.13.0","mssql":"^12.7.0","oxfmt":"^0.23.0","kysely":"^0.29.4","mysql2":"^3.23.2","oxlint":"^1.38.0","prisma":"6.19.3","tsdown":"^0.22.14","publint":"^0.3.23","postgres":"^3.4.9","@types/pg":"^8.11.0","miniflare":"^5.20260801.0-alpha","@types/bun":"latest","typescript":"^5.6.0","drizzle-orm":"1.0.0-rc.4","@types/mssql":"^12.3.0","@libsql/client":"^0.17.4","@prisma/client":"6.19.3","better-sqlite3":"^13.0.3","@arethetypeswrong/cli":"^0.18.5","@arethetypeswrong/core":"^0.18.5"},"peerDependencies":{"kysely":">=0.29.0","drizzle-orm":">=1.0.0-rc.0","@prisma/client":">=6.0.0"},"peerDependenciesMeta":{"kysely":{"optional":true},"drizzle-orm":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/db-result_0.1.0_1786112341557_0.8409591767565816","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"db-result","version":"0.2.0","keywords":["better-result","database","driver","drizzle","error-handling","kysely","mssql","mysql","postgres","prisma","result","retry","sql","sqlite","sqlstate"],"author":{"name":"jokull"},"license":"MIT","_id":"db-result@0.2.0","maintainers":[{"name":"jokullsolberg","email":"jokull@solberg.is"}],"homepage":"https://github.com/jokull/db-result#readme","bugs":{"url":"https://github.com/jokull/db-result/issues"},"dist":{"shasum":"67bc2c9f9c923a8f3ddcbb7409a5bfa38d3f57f9","tarball":"https://registry.npmjs.org/db-result/-/db-result-0.2.0.tgz","fileCount":35,"integrity":"sha512-g72Dq3TYS9FxnQrIMMbuFxhTdQrp/oMcZbllBQwvKjwa4s//tDZqrz2Xk3fpXomeIESCuzpt1W6Ek+iiuZseOw==","signatures":[{"sig":"MEUCIQDdbSkQlX02Ud2S6Y9QEbOrOIPfq4h7LDZIQ3uIBFoXcwIgIRNzwSykSbb2n7bUyft84Me3XISoNn857NM7iE1zqDo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":238682},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./d1":{"types":"./dist/drivers/d1.d.mts","import":"./dist/drivers/d1.mjs","default":"./dist/drivers/d1.mjs"},"./pg":{"types":"./dist/drivers/pg.d.mts","import":"./dist/drivers/pg.mjs","default":"./dist/drivers/pg.mjs"},"./mssql":{"types":"./dist/drivers/mssql.d.mts","import":"./dist/drivers/mssql.mjs","default":"./dist/drivers/mssql.mjs"},"./kysely":{"types":"./dist/kysely.d.mts","import":"./dist/kysely.mjs","default":"./dist/kysely.mjs"},"./mysql2":{"types":"./dist/drivers/mysql2.d.mts","import":"./dist/drivers/mysql2.mjs","default":"./dist/drivers/mysql2.mjs"},"./prisma":{"types":"./dist/prisma.d.mts","import":"./dist/prisma.mjs","default":"./dist/prisma.mjs"},"./sqlite":{"types":"./dist/drivers/sqlite.d.mts","import":"./dist/drivers/sqlite.mjs","default":"./dist/drivers/sqlite.mjs"},"./drizzle":{"types":"./dist/drizzle.d.mts","import":"./dist/drizzle.mjs","default":"./dist/drizzle.mjs"}},"gitHead":"e69dfeb9e23eae9754e78ee0161cd5e70e57a938","scripts":{"fmt":"oxfmt .","lint":"oxlint .","test":"bun test","build":"tsdown","check":"tsc --noEmit","fmt:check":"oxfmt --check .","db:generate":"prisma generate","check:exports":"bunx publint && bunx attw --pack --profile esm-only","prepublishOnly":"bun run build","test:integration":"bun test src/integration.test.ts","check:typescript-minimum":"bun run build && bun x --yes --package typescript@5.4.5 tsc -p tsconfig.typescript-minimum.json"},"_npmUser":{"name":"jokullsolberg","email":"jokull@solberg.is"},"repository":{"url":"git+https://github.com/jokull/db-result.git","type":"git"},"_npmVersion":"11.16.0","description":"Database failures as better-result tagged errors — Result<T, DbError>, retry-safe, driver-agnostic.","directories":{},"sideEffects":false,"_nodeVersion":"24.18.1","dependencies":{"better-result":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.13.0","mssql":"^12.7.0","oxfmt":"^0.23.0","kysely":"^0.29.4","mysql2":"^3.23.2","oxlint":"^1.38.0","prisma":"6.19.3","tsdown":"^0.22.14","publint":"^0.3.23","postgres":"^3.4.9","@types/pg":"^8.11.0","miniflare":"^5.20260801.0-alpha","@types/bun":"latest","typescript":"7.0.2","drizzle-orm":"1.0.0-rc.4","@types/mssql":"^12.3.0","@libsql/client":"^0.17.4","@prisma/client":"6.19.3","better-sqlite3":"^13.0.3","@arethetypeswrong/cli":"^0.18.5","@arethetypeswrong/core":"^0.18.5"},"peerDependencies":{"kysely":">=0.29.0","drizzle-orm":">=1.0.0-rc.0","@prisma/client":">=6.0.0"},"peerDependenciesMeta":{"kysely":{"optional":true},"drizzle-orm":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/db-result_0.2.0_1786151630028_0.7282504040583817","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"db-result","version":"0.2.1","keywords":["better-result","database","driver","drizzle","error-handling","kysely","mssql","mysql","postgres","prisma","result","retry","sql","sqlite","sqlstate"],"author":{"name":"jokull"},"license":"MIT","_id":"db-result@0.2.1","maintainers":[{"name":"jokullsolberg","email":"jokull@solberg.is"}],"homepage":"https://github.com/jokull/db-result#readme","bugs":{"url":"https://github.com/jokull/db-result/issues"},"dist":{"shasum":"d9054414f6cc573a73498526340c1ebdd5ad25a2","tarball":"https://registry.npmjs.org/db-result/-/db-result-0.2.1.tgz","fileCount":35,"integrity":"sha512-7j2DLGMaUUBNrK2cLJ7CtOB6PZguq5BWDI6B0gEWVt3QAysKO0m0SRx+MoNZiE5gXhFfCSlh4KWExDsL/hnjPA==","signatures":[{"sig":"MEUCIQD6hmtb/6kWMFniAFFSjt6f/AtXvw5N/guLTVNQnW60OwIgK2SXM8woJWo31Whq/m/h5GImsS3UTixwXwDFBBTzbMA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":254721},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./d1":{"types":"./dist/drivers/d1.d.mts","import":"./dist/drivers/d1.mjs","default":"./dist/drivers/d1.mjs"},"./pg":{"types":"./dist/drivers/pg.d.mts","import":"./dist/drivers/pg.mjs","default":"./dist/drivers/pg.mjs"},"./mssql":{"types":"./dist/drivers/mssql.d.mts","import":"./dist/drivers/mssql.mjs","default":"./dist/drivers/mssql.mjs"},"./kysely":{"types":"./dist/kysely.d.mts","import":"./dist/kysely.mjs","default":"./dist/kysely.mjs"},"./mysql2":{"types":"./dist/drivers/mysql2.d.mts","import":"./dist/drivers/mysql2.mjs","default":"./dist/drivers/mysql2.mjs"},"./prisma":{"types":"./dist/prisma.d.mts","import":"./dist/prisma.mjs","default":"./dist/prisma.mjs"},"./sqlite":{"types":"./dist/drivers/sqlite.d.mts","import":"./dist/drivers/sqlite.mjs","default":"./dist/drivers/sqlite.mjs"},"./drizzle":{"types":"./dist/drizzle.d.mts","import":"./dist/drizzle.mjs","default":"./dist/drizzle.mjs"}},"gitHead":"bdd09169d25d397c1a1fce47526667402ff7eaf1","scripts":{"fmt":"oxfmt .","lint":"oxlint .","test":"bun test","build":"tsdown","check":"tsc --noEmit","fmt:check":"oxfmt --check .","db:generate":"prisma generate","check:exports":"bunx publint && bunx attw --pack --profile esm-only","prepublishOnly":"bun run build","test:integration":"bun test src/integration.test.ts","check:typescript-minimum":"bun run build && bun x --yes --package typescript@5.4.5 tsc -p tsconfig.typescript-minimum.json"},"_npmUser":{"name":"jokullsolberg","email":"jokull@solberg.is"},"repository":{"url":"git+https://github.com/jokull/db-result.git","type":"git"},"_npmVersion":"11.16.0","description":"Database failures as better-result tagged errors — Result<T, DbError>, retry-safe, driver-agnostic.","directories":{},"sideEffects":false,"_nodeVersion":"24.18.1","dependencies":{"better-result":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.13.0","mssql":"^12.7.0","oxfmt":"^0.23.0","kysely":"^0.29.4","mysql2":"^3.23.2","oxlint":"^1.38.0","prisma":"6.19.3","tsdown":"^0.22.14","publint":"^0.3.23","postgres":"^3.4.9","@types/pg":"^8.11.0","miniflare":"^5.20260801.0-alpha","@types/bun":"latest","typescript":"7.0.2","drizzle-orm":"1.0.0-rc.4","@types/mssql":"^12.3.0","@libsql/client":"^0.17.4","@prisma/client":"6.19.3","better-sqlite3":"^13.0.3","@arethetypeswrong/cli":"^0.18.5","@arethetypeswrong/core":"^0.18.5"},"peerDependencies":{"kysely":">=0.29.0","drizzle-orm":">=1.0.0-rc.0","@prisma/client":">=6.0.0"},"peerDependenciesMeta":{"kysely":{"optional":true},"drizzle-orm":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/db-result_0.2.1_1786229721256_0.8326157648612003","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"db-result","version":"0.3.0","keywords":["better-result","database","driver","drizzle","error-handling","kysely","mssql","mysql","postgres","result","retry","sql","sqlite","sqlstate"],"author":{"name":"jokull"},"license":"MIT","_id":"db-result@0.3.0","maintainers":[{"name":"jokullsolberg","email":"jokull@solberg.is"}],"homepage":"https://github.com/jokull/db-result#readme","bugs":{"url":"https://github.com/jokull/db-result/issues"},"dist":{"shasum":"5fcc672467895b0ce4dc0aa17f10457b215a11b2","tarball":"https://registry.npmjs.org/db-result/-/db-result-0.3.0.tgz","fileCount":32,"integrity":"sha512-QWYzFO9f7bqncLS3jrdHLwcDJTkKyaZ21FdAPURQ9T0HsV5Vho7praHi8b/JWM1XBxL1rhMadp1z8y7qsp8yNg==","signatures":[{"sig":"MEQCICTyASQ+gQFq+P0UEryN2XzKGy1jvVlJ23BSVXkUrrj2AiB8MmzHgsrAObY18eIIL9bV+LiH2f7ESLJSraVYztevYQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":252651},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./d1":{"types":"./dist/drivers/d1.d.mts","import":"./dist/drivers/d1.mjs","default":"./dist/drivers/d1.mjs"},"./pg":{"types":"./dist/drivers/pg.d.mts","import":"./dist/drivers/pg.mjs","default":"./dist/drivers/pg.mjs"},"./mssql":{"types":"./dist/drivers/mssql.d.mts","import":"./dist/drivers/mssql.mjs","default":"./dist/drivers/mssql.mjs"},"./kysely":{"types":"./dist/kysely.d.mts","import":"./dist/kysely.mjs","default":"./dist/kysely.mjs"},"./mysql2":{"types":"./dist/drivers/mysql2.d.mts","import":"./dist/drivers/mysql2.mjs","default":"./dist/drivers/mysql2.mjs"},"./sqlite":{"types":"./dist/drivers/sqlite.d.mts","import":"./dist/drivers/sqlite.mjs","default":"./dist/drivers/sqlite.mjs"},"./drizzle":{"types":"./dist/drizzle.d.mts","import":"./dist/drizzle.mjs","default":"./dist/drizzle.mjs"}},"gitHead":"6bb98b3e3461439f5ac2b47b979cda687a919c7b","scripts":{"fmt":"oxfmt .","lint":"oxlint .","test":"bun test","build":"tsdown","check":"tsc --noEmit","fmt:check":"oxfmt --check .","check:exports":"bunx publint && bunx attw --pack --profile esm-only","prepublishOnly":"bun run build","test:integration":"bun test src/integration.test.ts","check:typescript-minimum":"bun run build && bun x --yes --package typescript@5.4.5 tsc -p tsconfig.typescript-minimum.json"},"_npmUser":{"name":"jokullsolberg","email":"jokull@solberg.is"},"repository":{"url":"git+https://github.com/jokull/db-result.git","type":"git"},"_npmVersion":"11.6.2","description":"Database failures as better-result tagged errors — Result<T, DbError>, retry-safe, driver-agnostic.","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","dependencies":{"better-result":"^3.0.1"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.13.0","mssql":"^12.7.0","oxfmt":"^0.23.0","kysely":"^0.29.4","mysql2":"^3.23.2","oxlint":"^1.38.0","tsdown":"^0.22.14","publint":"^0.3.23","postgres":"^3.4.9","@types/pg":"^8.11.0","miniflare":"^5.20260801.0-alpha","@types/bun":"latest","typescript":"7.0.2","drizzle-orm":"1.0.0-rc.4","@types/mssql":"^12.3.0","@libsql/client":"^0.17.4","better-sqlite3":"^13.0.3","@arethetypeswrong/cli":"^0.18.5","@arethetypeswrong/core":"^0.18.5"},"peerDependencies":{"kysely":">=0.29.0","drizzle-orm":">=1.0.0-rc.0"},"peerDependenciesMeta":{"kysely":{"optional":true},"drizzle-orm":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/db-result_0.3.0_1786480874468_0.8352204589312218","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"db-result","version":"0.3.1","keywords":["better-result","database","driver","drizzle","error-handling","kysely","mssql","mysql","postgres","result","retry","sql","sqlite","sqlstate"],"author":{"name":"jokull"},"license":"MIT","_id":"db-result@0.3.1","maintainers":[{"name":"jokullsolberg","email":"jokull@solberg.is"}],"homepage":"https://github.com/jokull/db-result#readme","bugs":{"url":"https://github.com/jokull/db-result/issues"},"dist":{"shasum":"5b620f4579bfcce276a3eb490ad10e753844b9f9","tarball":"https://registry.npmjs.org/db-result/-/db-result-0.3.1.tgz","fileCount":32,"integrity":"sha512-7j8OflsIsrllZuK3OmWfinYMid5eUNDU4WJ2nhOeDT9XnO1l1dg5LpKJAWG9o0j3KvcDIuZgLgtgUm6HVWCYKQ==","signatures":[{"sig":"MEQCIEUJ85kcUQxsT6ucVFrC+3ADrxzJdJB6Iv8Pbc57xB1UAiAJY1iu+DVRELz8U9hTQVunQ7O+so1ZyvjYxHCf16+uQA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":255009},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./d1":{"types":"./dist/drivers/d1.d.mts","import":"./dist/drivers/d1.mjs","default":"./dist/drivers/d1.mjs"},"./pg":{"types":"./dist/drivers/pg.d.mts","import":"./dist/drivers/pg.mjs","default":"./dist/drivers/pg.mjs"},"./mssql":{"types":"./dist/drivers/mssql.d.mts","import":"./dist/drivers/mssql.mjs","default":"./dist/drivers/mssql.mjs"},"./kysely":{"types":"./dist/kysely.d.mts","import":"./dist/kysely.mjs","default":"./dist/kysely.mjs"},"./mysql2":{"types":"./dist/drivers/mysql2.d.mts","import":"./dist/drivers/mysql2.mjs","default":"./dist/drivers/mysql2.mjs"},"./sqlite":{"types":"./dist/drivers/sqlite.d.mts","import":"./dist/drivers/sqlite.mjs","default":"./dist/drivers/sqlite.mjs"},"./drizzle":{"types":"./dist/drizzle.d.mts","import":"./dist/drizzle.mjs","default":"./dist/drizzle.mjs"}},"gitHead":"e113b155bc065a4999268417aa7da3c6a5a5d054","scripts":{"fmt":"oxfmt .","lint":"oxlint .","test":"bun test","build":"tsdown","check":"tsc --noEmit","fmt:check":"oxfmt --check .","check:exports":"bunx publint && bunx attw --pack --profile esm-only","prepublishOnly":"bun run build","test:integration":"bun test src/integration.test.ts","check:typescript-minimum":"bun run build && bun x --yes --package typescript@5.4.5 tsc -p tsconfig.typescript-minimum.json"},"_npmUser":{"name":"jokullsolberg","email":"jokull@solberg.is"},"repository":{"url":"git+https://github.com/jokull/db-result.git","type":"git"},"_npmVersion":"11.6.2","description":"Database failures as better-result tagged errors — Result<T, DbError>, retry-safe, driver-agnostic.","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","dependencies":{"better-result":"^3.0.1"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.13.0","mssql":"^12.7.0","oxfmt":"^0.23.0","kysely":"^0.29.4","mysql2":"^3.23.2","oxlint":"^1.38.0","tsdown":"^0.22.14","publint":"^0.3.23","postgres":"^3.4.9","@types/pg":"^8.11.0","miniflare":"^5.20260801.0-alpha","@types/bun":"latest","typescript":"7.0.2","drizzle-orm":"1.0.0-rc.4","@types/mssql":"^12.3.0","@libsql/client":"^0.17.4","better-sqlite3":"^13.0.3","@arethetypeswrong/cli":"^0.18.5","@arethetypeswrong/core":"^0.18.5"},"peerDependencies":{"kysely":">=0.29.0","drizzle-orm":">=1.0.0-rc.0"},"peerDependenciesMeta":{"kysely":{"optional":true},"drizzle-orm":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/db-result_0.3.1_1788444330374_0.2564591176109232","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"db-result","version":"0.3.2","description":"Database failures as better-result tagged errors — Result<T, DbError>, retry-safe, driver-agnostic.","keywords":["better-result","database","driver","drizzle","error-handling","kysely","mssql","mysql","postgres","result","retry","sql","sqlite","sqlstate"],"homepage":"https://github.com/jokull/db-result#readme","bugs":{"url":"https://github.com/jokull/db-result/issues"},"license":"MIT","author":{"name":"jokull"},"repository":{"type":"git","url":"git+https://github.com/jokull/db-result.git"},"type":"module","sideEffects":false,"main":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./pg":{"types":"./dist/drivers/pg.d.mts","import":"./dist/drivers/pg.mjs","default":"./dist/drivers/pg.mjs"},"./sqlite":{"types":"./dist/drivers/sqlite.d.mts","import":"./dist/drivers/sqlite.mjs","default":"./dist/drivers/sqlite.mjs"},"./d1":{"types":"./dist/drivers/d1.d.mts","import":"./dist/drivers/d1.mjs","default":"./dist/drivers/d1.mjs"},"./mysql2":{"types":"./dist/drivers/mysql2.d.mts","import":"./dist/drivers/mysql2.mjs","default":"./dist/drivers/mysql2.mjs"},"./mssql":{"types":"./dist/drivers/mssql.d.mts","import":"./dist/drivers/mssql.mjs","default":"./dist/drivers/mssql.mjs"},"./drizzle":{"types":"./dist/drizzle.d.mts","import":"./dist/drizzle.mjs","default":"./dist/drizzle.mjs"},"./kysely":{"types":"./dist/kysely.d.mts","import":"./dist/kysely.mjs","default":"./dist/kysely.mjs"}},"scripts":{"build":"tsdown","prepublishOnly":"bun run build","test":"bun test","test:integration":"bun test src/integration.test.ts","check":"tsc --noEmit","lint":"oxlint .","fmt":"oxfmt .","fmt:check":"oxfmt --check .","check:exports":"bunx publint && bunx attw --pack --profile esm-only","check:typescript-minimum":"bun run build && bun x --yes --package typescript@5.4.5 tsc -p tsconfig.typescript-minimum.json"},"dependencies":{"better-result":"^3.0.1"},"devDependencies":{"@arethetypeswrong/cli":"^0.18.5","@arethetypeswrong/core":"^0.18.5","@libsql/client":"^0.17.4","@types/bun":"latest","@types/mssql":"^12.3.0","@types/pg":"^8.11.0","better-sqlite3":"^13.0.3","drizzle-orm":"1.0.0-rc.4","kysely":"^0.29.4","miniflare":"^5.20260801.0-alpha","mssql":"^12.7.0","mysql2":"^3.23.2","oxfmt":"^0.23.0","oxlint":"^1.38.0","pg":"^8.13.0","postgres":"^3.4.9","publint":"^0.3.23","tsdown":"^0.22.14","typescript":"7.0.2"},"peerDependencies":{"drizzle-orm":">=1.0.0-rc.0","kysely":">=0.29.0"},"peerDependenciesMeta":{"drizzle-orm":{"optional":true},"kysely":{"optional":true}},"engines":{"node":">=18"},"gitHead":"a4d86131bcc27de6bb7ce7953269683501c62a76","_id":"db-result@0.3.2","_nodeVersion":"26.7.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-fwmRAMEXZ3MC3cHLiyTaV/BwApL840Kp8AGd9ohw6fzXcFfMYDe5t2uJVH9QMXhTy9yflOHt7/IBGfvM6mgVWA==","shasum":"75458272298dd19b700d37d56b9f41e98a07d641","tarball":"https://registry.npmjs.org/db-result/-/db-result-0.3.2.tgz","fileCount":32,"unpackedSize":255826,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDdsgebxwnxb4aj3JnYr/Tfj7pCvodM4PAL4xWKA3ZCSQIgd5ePKWMKEI7C3u2yvjFptlMGZItZl84JlclE4do39FM="}]},"_npmUser":{"name":"jokullsolberg","email":"jokull@solberg.is"},"directories":{},"maintainers":[{"name":"jokullsolberg","email":"jokull@solberg.is"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/db-result_0.3.2_1789123162868_0.6892913869070656"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-07T14:19:01.498Z","modified":"2026-09-11T10:39:23.165Z","0.1.0":"2026-08-07T14:19:01.855Z","0.2.0":"2026-08-08T01:13:50.190Z","0.2.1":"2026-08-08T22:55:21.457Z","0.3.0":"2026-08-11T20:41:14.654Z","0.3.1":"2026-09-03T14:05:30.524Z","0.3.2":"2026-09-11T10:39:22.998Z"},"bugs":{"url":"https://github.com/jokull/db-result/issues"},"author":{"name":"jokull"},"license":"MIT","homepage":"https://github.com/jokull/db-result#readme","keywords":["better-result","database","driver","drizzle","error-handling","kysely","mssql","mysql","postgres","result","retry","sql","sqlite","sqlstate"],"repository":{"type":"git","url":"git+https://github.com/jokull/db-result.git"},"description":"Database failures as better-result tagged errors — Result<T, DbError>, retry-safe, driver-agnostic.","maintainers":[{"name":"jokullsolberg","email":"jokull@solberg.is"}],"readme":"# db-result\n\n> Database failures as better-result tagged errors (`Result<T, DbError>`), retry-safe,\n> driver-agnostic. **Attempt the insert — that _is_ the uniqueness check.** We classify\n> the failure and decide what's worth retrying.\n\n```sh\nbun add better-result db-result\n```\n\nBuilt on [better-result](https://github.com/dmmulroy/better-result). You adopt its\n`Result` model too: `tryDb` returns `Result<T, DbError>`, folds with\n`matchErrorPartial`, composes in `Result.gen`.\n\n- **Classify** every driver failure into one of 14 `db/*` tags, the same across every\n  driver and ORM (pg, SQLite incl. D1, mysql, mssql, Prisma, Kysely, Drizzle):\n\n  ```ts\n  // constraints         data          contention            connection\n  unique-violation       data-error    deadlock              connect-failure\n  foreign-key-violation                lock-timeout          connection-lost\n  not-null-violation                   transaction-aborted\n  check-violation        // identity   // other\n                         authentication-failed   sql-syntax-error\n                         authorization-failed    query-failure\n  ```\n\n  `unique-violation`, `foreign-key-violation`, `not-null-violation` and\n  `check-violation` each carry the driver's `constraint` identifier.\n  `connect-failure` means the channel was never established (DNS, refused,\n  timeout) — safe to retry; `connection-lost` means it died mid-query —\n  ambiguous, never auto-retried. That split is deliberate: connect-phase vs\n  mid-query. `data-error` is a value problem (too long, overflow, bad input);\n  `deadlock` includes serialization failures (`40001`); `lock-timeout` includes\n  SQLite `BUSY`/`LOCKED`; `transaction-aborted` (`25P02`) means the whole\n  transaction is dead; `query-failure` is the known-but-unspecific catch-all.\n\n  No `instanceof`, no `error.code === \"23505\"`.\n\n- **Narrow** the error union from the query's own type: pass the builder value\n  (`db.select().from(users)`) and the impossible tags compile out. Nothing to\n  declare, nothing to sync — the ORM emitted the type, so the evidence is verified.\n- **Retry** only what's provably safe, with per-error backoff; never the deterministic\n  errors, never the ambiguous mid-query connection loss (the write may have committed).\n- **Fold** at your handler boundary: match the tags you care about with\n  `matchErrorPartial` (the better-result fold helper), and its terminal arm handles\n  whatever you don't fold: 500 + observability, with the compiler listing what you're\n  ignoring.\n\n## Example\n\n```ts\nimport { matchErrorPartial } from \"better-result\";\nimport type { UniqueViolation } from \"db-result\";\nimport { tryDb } from \"db-result/pg\"; // or /sqlite /mysql2 /mssql /d1: subpath per driver\n\nconst outcome = await tryDb(db.insert(users).values({ email }).returning());\n\nif (outcome.isErr()) {\n  return matchErrorPartial(\n    outcome.error,\n    {\n      // handlers are annotated with the concrete tag class — the library's\n      // match-error idiom (the key must match the handler's `_tag`)\n      \"db/unique-violation\": (e: UniqueViolation) =>\n        c.json({ error: \"email_taken\", constraint: e.constraint }, 409),\n    },\n    (unhandled) => {\n      reportError(unhandled); // typed as the remainder — the tags the fold didn't claim\n      return c.json({ error: \"internal\" }, 500);\n    },\n  );\n}\n```\n\nThree forms, one retry engine:\n\n- **Builder value** — `tryDb(db.select().from(users))`. The builder is both the\n  shape and the retry unit: the union narrows to what that shape provably cannot\n  raise, and retry re-executes the builder.\n- **Promise-returning thunk** — `tryDb(() => prisma.user.findMany(args))`. Full\n  union, retry re-invokes the thunk. The form for one-shot calls (Prisma, raw SQL,\n  `client.query`) that can't be re-executed.\n- **Settled promise** — `tryDb(promise)`. One-shot: full union, no auto-retry (dev\n  builds warn once; wrap in a thunk to get retry).\n\nOpt in per call site: wrap one endpoint, leave the rest throwing. Transactions:\nwrap the whole `db.transaction()` in `tryTx` (whole-thunk retry). Details:\n[transactions](./skills/db-result/references/transactions.md).\n\n## The retry doctrine, in one breath\n\nDeterministic failures (constraints, auth, authz, syntax, data) never retry; it's\ntheater. The transient set auto-retries with per-error backoff: `db/deadlock`\n(incl. serialization `40001` and Prisma's `P2034`), `db/lock-timeout`,\n`db/connect-failure` (connect-refused, DNS, timeout), `db/query-failure` for\ntoo-many-connections / statement-timeout, plus SQLite `BUSY`/`LOCKED`.\n**Connection lost mid-query never auto-retries** — and neither does\n`db/transaction-aborted`: the write may have committed (or the whole tx is dead),\nretrying could double it. An explicit `retry` config always wins;\n`isRetriedError(e)` tells you a failure survived N attempts. If your ORM has its own\nretry layer underneath (Prisma's pool acquisition), db-result's retries stack on top;\nset `retryTransient: false` to keep only the ORM's, or disable the ORM's to keep only\nours. Details: [retry](./skills/db-result/references/retry.md).\n\n## Guards\n\nEvery tag is a class, and the per-tag check is the class's own static `is` —\n`UniqueViolation.is(e)`, `QueryFailure.is(e)` — the same idiom as\nbetter-result's `TaggedError.is`. Classes are exported as values; construct\nerrors via `tryDb`, never by instantiating them.\nFamily guards group the tags most often folded together:\n`isConnectionFailure` is true for either connection tag (`db/connect-failure`\nor `db/connection-lost`); `isConstraintViolation` is true for any of the four\nconstraint tags (`db/unique-violation`, `db/foreign-key-violation`,\n`db/not-null-violation`, `db/check-violation`) — the canonical \"your input\nbroke a schema rule\" fold. When a fold sends each constraint tag to the same\noutcome, one family guard check beats four `X.is` arms; when the arms\ndiverge or read the error, `matchErrorPartial(error, folds, onUnhandled)` is\nthe fold (handlers that read the error annotate the concrete class, per\nbetter-result's docs).\n\n## Shape-aware types: the union narrows itself\n\nPass the query builder itself. Its type is evidence of what the query can and cannot\ndo, and the impossible tags compile out of the union. No declared types, no matching\nby hand: the ORM emitted the builder type, so the evidence is verified by\nconstruction.\n\n```ts\nimport { tryDb, tryTx } from \"db-result/pg\";\nimport type { Kysely } from \"kysely\";\n\ninterface DB {\n  users: { id: number; email: string; name: string };\n}\ndeclare const db: Kysely<DB>;\n\n// builder value: the shape IS the type — constraints are write-only\nconst rows = await tryDb(db.selectFrom(\"users\").selectAll());\n//   ^? Result<User[], DbError minus { unique | fk | not-null | check }>\n//   deadlock stays (SELECT … FOR UPDATE); data-error stays (read conversions);\n//   transaction-aborted stays (a tx-bound select can raise 25P02)\n\n// write builders: every constraint stays in the union\nawait tryDb(db.insertInto(\"users\").values({ email }).returningAll());\n\n// delete builder: FK is the only constraint a DELETE can hit\nawait tryDb(db.deleteFrom(\"users\").where(\"id\", \"=\", id));\n\n// one-shot calls (Prisma, raw SQL): the thunk form — full union, retry on\nawait tryDb(() => prisma.user.create({ data: { email } })); // P2002 → db/unique-violation\n\n// transactions: wrap the whole thing — BEGIN can fail, so the full union is honest\nawait tryTx(() =>\n  db.transaction().execute(async (tx) => {\n    /* … */\n  }),\n);\n```\n\nThen the fold terminal lists only what's left for the select shape above:\n\n```ts\n(unhandled) => {\n  // db/deadlock | db/lock-timeout | db/data-error | db/connect-failure |\n  // db/connection-lost | db/transaction-aborted | db/authentication-failed |\n  // db/authorization-failed | db/sql-syntax-error | db/query-failure\n  reportError(unhandled);\n  return c.json({ error: \"internal\" }, 500);\n};\n```\n\nChained queries keep the shape: joins, `where`, `orderBy` aren't probe keys, so a\nrealistic select still narrows. A builder that proves no shape (raw SQL, Kysely's\n`mergeInto`) is a compile error — use the thunk form rather than guessing; the\nlattice never silently widens. Narrowing is structural only: no ORM imports, zero\nruntime cost (the probes compile away), and the runtime classifier is never\naffected — it stays honest for every shape, including the reads-that-write\nfootgun. Full lattice, footguns, and per-driver ledgers:\n[shapes](./skills/db-result/references/shapes.md).\n\n## Commit to Result shapes: the `{orm}TryDb` wrappers\n\nIf you want the whole codebase on Result shapes — no `tryDb` at every call site,\nno thunks — wrap the ORM client once. One wrapper per ORM, each on the shared\ncore: `drizzleTryDb` (`db-result/drizzle`), `kyselyTryDb` (`db-result/kysely`).\n\n```ts\nimport { drizzle } from \"drizzle-orm/node-postgres\";\nimport { drizzleTryDb } from \"db-result/drizzle\";\n\nconst db = drizzleTryDb(drizzle({ connection, schema }));\n\nconst outcome = await db.select({ id: users.id }).from(users).execute();\n//            ^? Promise<Result<…, readUnion>> — unwrap with isOk()/isErr()\nif (outcome.isErr()) return outcome; // the fold terminal lists what's left\nconst [user] = outcome.value;\n```\n\nOne config, everywhere: builders re-execute on retry, `transaction` restarts\nwhole, raw `execute` re-invokes — the wrapper owns the re-invocation, so there\nare no thunks at the call site. Per ORM:\n\n- **drizzle** — builder chains E-track; the union narrows per builder shape;\n  relational queries (`db.query.<table>.findMany/findFirst/findOne`) resolve\n  `Result<T, readUnion>` — the constraint tags excluded, retry applied —\n  so the whole surface is on Result shapes; rows degrade to\n  `Record<string, any>`-shaped arrays on wrapped chains (the mapped chain\n  can't preserve Drizzle's generics — drop to `tryDb(builder)` where row\n  literals matter). Pass a **raw** builder there: `tryDb` on an already\n  E-tracked builder would wrap the Result again — keep the unwrapped handle\n  (`rawDb`) around for row-exact writes. `$with` and `refreshMaterializedView`\n  pass through raw.\n- **kysely** — builder chains E-track with the **rows staying precise**\n  (Kysely's chain methods return the same class parameters; the overloaded\n  `where`/`set`/`values`/join forms are re-added explicitly); `with(...)` CTE\n  chains pass through raw; transactions resolve at `transaction().execute(cb)`.\n  The convenience terminals are E-tracked too: `executeTakeFirst` resolves\n  `Result<T | undefined, E>` (no row is `Ok(undefined)`, like Kysely), and\n  `executeTakeFirstOrThrow` resolves `Result<T, E | NoResultError>` — Kysely's\n  only throw becomes a value, custom `errorConstructor` honored. Shape\n  narrowing applies to both.\n- **prisma** — no wrapper: every delegate call is one-shot (a `PrismaPromise`\n  memoizes after its first `then`, so it can never re-execute). Use the thunk\n  form — `tryDb(() => prisma.user.findMany(args))` — full union, retry by\n  re-invocation; Prisma P-codes still classify exactly.\n\nTighten the union per protocol with the explicit generic on any wrapper:\n`drizzleTryDb<typeof db, SqliteDbError>(db)`.\n\n## Drivers\n\nOne package, subpath entry points per protocol: `db-result/pg`, `/sqlite`, `/d1`,\n`/mysql2`, `/mssql`. Every driver Drizzle and Kysely support maps to one of them (the\nclassifier reads protocol signals: SQLSTATE, SQLite codes, mysql errno, mssql number,\nPrisma P-codes). Your ORM name is not an entry point: Kysely-on-Postgres imports from\n`db-result/pg`, Drizzle-on-SQLite from `db-result/sqlite`. Drizzle: classification is\nwrapper-transparent (the cause chain reaches the driver error regardless of version);\nthe narrowing probes are verified against 1.0+ (currently `1.0.0-rc.4`); on ~0.9 use\nthe thunk form. Full map: [adoption](./skills/db-result/references/adoption.md).\n\n## Docs for agents (and humans who want details)\n\nThe skill at [`skills/db-result/SKILL.md`](skills/db-result/SKILL.md) is the map: an\nescalation ladder and a task index into [`references/`](skills/db-result/references/):\n[overview](skills/db-result/references/overview.md) (the idea in one page),\n[vocabulary](skills/db-result/references/vocabulary.md) (the 14 tags, per-driver\nunions), [retry](skills/db-result/references/retry.md), [transactions](skills/db-result/references/transactions.md),\n[patterns](skills/db-result/references/patterns.md) (upsert, idempotency keys, not-found).\n\n## The sharp edges, up front\n\n- **Rethrown, not labeled.** An error that matches no known protocol shape is\n  rethrown as a real exception; your existing try/catch still works (inside\n  `Result.gen` it surfaces as a `Panic`). Never tagged `db/query-failure`. That\n  includes errors you throw inside the thunk: only driver-originated failures are\n  classified. `db/query-failure` is for _known-but-unspecific_ shapes. Unknown shapes\n  are a request for a new mapping, not a catch-all.\n- **Not-found is data, not a tag.** A missing row is `null` / your domain error,\n  never a `db/*` tag. Kysely's `NoResultError` has no protocol shape, so it's\n  rethrown, not labeled. Prisma's `P2025` is a known-but-unspecific shape, so it\n  lands in `db/query-failure`: reachable, but deliberately not\n  tag-distinguished: prefer `findFirst`/`findUnique` and check `null`.\n- **`constraint` is the driver's identifier**, not a normalized key; SQLite gives\n  `table.column`, Postgres gives the constraint name. Match on the tag, disambiguate\n  by `constraint` inside the arm (`users_email_key` vs an unexpected index), and use\n  it for observability.\n- **Fold arms read `_tag`, `constraint`, `potentiallyTransient`, and the driver\n  error on `cause`.** Strip `cause` at wire boundaries: better-result's `toJSON()`\n  spreads it (with stack) by design.\n\n## Verification\n\nRuns on Node ≥ 18 and Bun (D1 targets Workers). ESM only; TypeScript ≥ 5.4.\nReal-driver tests run locally against a Docker suite (pg 16, mysql 8, mssql 2022) and\nembedded engines (bun:sqlite, node:sqlite, better-sqlite3, libsql):\n\n```sh\nbun test                          # everything — unit suites are colocated next to\n                                  # their module (src/**/*.test.ts); integration\n                                  # suites skip without their DSNs\ndocker compose up -d --wait       # + the DSNs (see package.json) →\nbun run test:integration          # the live Docker pass only\n```\n\nStatus: `0.3.2`, MIT. Every release runs the full suite above first.\n\nClassification modeled on [Effect SQL](https://github.com/Effect-TS/effect/blob/main/packages/effect/src/unstable/sql/SqlError.ts),\nfiner on the constraint family (FK/not-null/check stay separate for the fold),\ncorrected where Effect falls short (masks SQLite extended codes, misses transient\n`53300`). Extracted from [result-rpc](https://github.com/jokull/result-rpc/blob/main/src/db.ts).\n","readmeFilename":"README.md"}