{"_id":"@bskyprism/kysely-d1","name":"@bskyprism/kysely-d1","dist-tags":{"latest":"0.4.7"},"versions":{"0.4.7":{"name":"@bskyprism/kysely-d1","description":"Kysely dialect for Cloudflare D1","main":"./dist/index.js","version":"0.4.7","type":"module","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"lint":"eslint \"./**/*.{ts,js}\"","build":"mkdir -p ./dist && rm -rf ./dist/* && npm run build-cjs && npm run build-esm && npm run build-esm:min && npm run build-cjs:min && tsc --emitDeclarationOnly --project tsconfig.build.json --outDir dist","build-cjs":"esbuild src/*.ts --format=cjs --keep-names --tsconfig=tsconfig.build.json --outdir=./dist --out-extension:.js=.cjs --sourcemap","build-cjs:min":"esbuild src/*.ts --format=cjs --minify --keep-names --tsconfig=tsconfig.build.json --outdir=./dist --out-extension:.js=.min.cjs --sourcemap","build-esm":"esbuild src/*.ts --format=esm --metafile=dist/meta.json --keep-names --tsconfig=tsconfig.build.json --outdir=./dist --sourcemap && tsc --emitDeclarationOnly --project tsconfig.build.json --outDir dist","build-esm:min":"esbuild ./src/*.ts --format=esm --keep-names --bundle --tsconfig=tsconfig.build.json --minify --out-extension:.js=.min.js --outdir=./dist --sourcemap","toc":"markdown-toc --maxdepth 3 -i README.md","preversion":"npm run lint","version":"npm run toc && auto-changelog -p --template keepachangelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md README.md","postversion":"git push --follow-tags && npm publish","prepublishOnly":"npm run build"},"peerDependencies":{"kysely":"^0.28.8"},"devDependencies":{"@cloudflare/workers-types":"^4.20230115.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","auto-changelog":"^2.5.0","eslint":"^8.57.0","eslint-config-standard":"^17.1.0","esbuild":"^0.27.0","markdown-toc":"^1.2.0","typescript":"^5.9.3"},"author":{"name":"Aiden","email":"aiden@aidenwallis.co.uk"},"contributors":[{"name":"nichoth","email":"nichoth@nichoth.com","url":"https://nichoth.com"}],"repository":{"type":"git","url":"git+ssh://git@github.com/bskyprism/kysely-d1.git"},"keywords":["kysely","cloudflare","d1","workers","serverless"],"license":"MIT","gitHead":"26ad07379f4d16df01a28573b943ff61a93f1837","types":"./dist/index.d.ts","_id":"@bskyprism/kysely-d1@0.4.7","bugs":{"url":"https://github.com/bskyprism/kysely-d1/issues"},"homepage":"https://github.com/bskyprism/kysely-d1#readme","_nodeVersion":"22.18.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-IchZwrkeodrFRS8sg6BTVi6s3sEGmN3o7nTtAkX5QbeCA5TTvEOxnGzm2e41TmVL3BnWXaz9axMz7qCS4uZIxA==","shasum":"f1fb07f6304529f22ef978e11e96d70523a7f0fb","tarball":"https://registry.npmjs.org/@bskyprism/kysely-d1/-/kysely-d1-0.4.7.tgz","fileCount":13,"unpackedSize":522025,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCsIt2kvj/em0TAhy423wNgJ5mEwcXYYPhOO7I2yj5vVwIgWVSg9p60r44bQFIO5rSLD0k8WzaOZ9/8bELtd/jAtKo="}]},"_npmUser":{"name":"nichoth","email":"nichoth@gmail.com"},"directories":{},"maintainers":[{"name":"nichoth","email":"nichoth@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/kysely-d1_0.4.7_1764447209125_0.02994961943796115"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-29T20:13:29.030Z","0.4.7":"2025-11-29T20:13:29.314Z","modified":"2025-11-29T20:13:29.647Z"},"maintainers":[{"name":"nichoth","email":"nichoth@gmail.com"}],"description":"Kysely dialect for Cloudflare D1","homepage":"https://github.com/bskyprism/kysely-d1#readme","keywords":["kysely","cloudflare","d1","workers","serverless"],"repository":{"type":"git","url":"git+ssh://git@github.com/bskyprism/kysely-d1.git"},"contributors":[{"name":"nichoth","email":"nichoth@nichoth.com","url":"https://nichoth.com"}],"author":{"name":"Aiden","email":"aiden@aidenwallis.co.uk"},"bugs":{"url":"https://github.com/bskyprism/kysely-d1/issues"},"license":"MIT","readme":"# kysely-d1\n\n[![ci](https://github.com/aidenwallis/kysely-d1/actions/workflows/ci.yaml/badge.svg)](https://github.com/aidenwallis/kysely-d1/actions/workflows/ci.yaml)\n[![npm](https://img.shields.io/npm/v/kysely-d1.svg)](https://www.npmjs.com/package/kysely-d1)\n\n[Kysely](https://github.com/koskimas/kysely) adapter for\n[Cloudflare D1](https://developers.cloudflare.com/d1/).\n\n```sh\nnpm i -S @nichoth/kysely-d1\n```\n\n<details><summary><h2>Contents</h2></summary>\n\n<!-- toc -->\n\n- [Fork](#fork)\n- [Usage](#usage)\n\n<!-- tocstop -->\n\n</details>\n\n## Fork\n\nThis is a fork of [aidenwallis/kysely-d1](https://github.com/aidenwallis/kysely-d1),\nto update some dependencies.\n\n* kysely\n* @cloudflare/workers-types\n* typescript\n\n-------\n\nThis project was largely adapted from [kysely-planetscale](https://github.com/depot/kysely-planetscale).\n\n## Usage\n\nPass your D1 binding into the dialect in order to configure the Kysely client. Follow [these docs](https://developers.cloudflare.com/d1/get-started/#4-bind-your-worker-to-your-d1-database) for instructions on how to do so.\n\n```typescript\nimport { Kysely } from 'kysely';\nimport { D1Dialect } from 'kysely-d1';\n\nexport interface Env {\n  DB: D1Database;\n}\n\ninterface KvTable {\n  key: string;\n  value: string;\n}\n\ninterface Database {\n  kv: KvTable;\n}\n\nexport default {\n  async fetch(request: Request, env: Env): Promise<Response> {\n    const { searchParams } = new URL(request.url);\n    const key = searchParams.get('key');\n    if (!key) {\n      return new Response('No key defined.', { status: 400 });\n    }\n\n    // Create Kysely instance with kysely-d1\n    const db = new Kysely<Database>({ dialect: new D1Dialect({ database: env.DB }) });\n    \n    // Read row from D1 table\n    const result = await db.selectFrom('kv').selectAll().where('key', '=', key).executeTakeFirst();\n    if (!result) {\n      return new Response('No value found', { status: 404 });\n    }\n\n    return new Response(result.value);\n  },\n};\n```\n\nThere is a working [example](example) also included, which implements a K/V style store using D1.\n","readmeFilename":"README.md","_rev":"1-7c645f6aaa4e08387bc83f879327f849"}