{"_id":"@ah-monica/cloudflare","_rev":"8-5909635808673474efc6e3c3483bd35c","name":"@ah-monica/cloudflare","dist-tags":{"latest":"0.4.1"},"versions":{"0.1.0":{"name":"@ah-monica/cloudflare","version":"0.1.0","license":"Apache-2.0","_id":"@ah-monica/cloudflare@0.1.0","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica#readme","bugs":{"url":"https://github.com/Accel-Hack/monica/issues"},"dist":{"shasum":"a2ff8cb183472e74940b57cb4e496b3b1e9e603b","tarball":"https://registry.npmjs.org/@ah-monica/cloudflare/-/cloudflare-0.1.0.tgz","fileCount":9,"integrity":"sha512-uTIf84ImlgJB9X2N6Ital+ItXTedzpR81uNxPwwRL6h6CtGdOMdlcR7nQwaZjDn4C8uzPsMgZHrA8sPH4A6KzQ==","signatures":[{"sig":"MEUCIGBZPWCHrT5vur1yCrLRbJk9FRpNZvNY8tgU+1vFOqSNAiEAj6qPIBvxOXMmpYvitGYjZeOBkcOWeyN/C3ZOrItM+zc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23706},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"bun run build:core && bun test","build":"bun run build:core && tsc -p tsconfig.build.json","typecheck":"bun run build:core && tsc --noEmit","build:core":"bun run --filter @ah-monica/core build","pack:check":"bun run build && bun pm pack --dry-run","test:runtime":"bun run build && bun run test/runtime-smoke.ts"},"_npmUser":{"name":"kkyosuke","email":"kawamura@accelhack.com"},"repository":{"url":"git+https://github.com/Accel-Hack/monica.git","type":"git","directory":"sdk/typescript/cloudflare"},"_npmVersion":"11.19.1","description":"Cloudflare Workers adapter for sending application errors to MONICA","directories":{},"sideEffects":false,"_nodeVersion":"22.23.0","dependencies":{"@ah-monica/core":"0.1.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"wrangler":"4.127.0","@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/cloudflare_0.1.0_1788011526292_0.467045755875243","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@ah-monica/cloudflare","version":"0.1.2","license":"Apache-2.0","_id":"@ah-monica/cloudflare@0.1.2","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"3e33b02789ac5437feff4052c7d08cf424eb4ed0","tarball":"https://registry.npmjs.org/@ah-monica/cloudflare/-/cloudflare-0.1.2.tgz","fileCount":11,"integrity":"sha512-ppWlsmcvsRQzwMvUI/pmJMrY8zlI8VHRiH68H1YuzIT3f4H0LytcRN49fBpPF7IwgFyqI8kdUgSV74qq4jylFg==","signatures":[{"sig":"MEQCIAkegVTURRMFCb4lF+GXwxKoKT9MAaSTLleSiwrljV+dAiBUUGgIrQqTEHovbHZGT+YKsk5YJLArLUrJGgM7rlpTcg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcloudflare@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":24010},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"fef6c6301fc29c3d036ec980c2c562c7b5f6af5d","scripts":{"test":"bun run build:core && bun test","build":"bun run build:core && tsc -p tsconfig.build.json","typecheck":"bun run build:core && tsc --noEmit","build:core":"bun run --filter @ah-monica/core build","pack:check":"bun run build && bun pm pack --dry-run","test:runtime":"bun run build && bun run test/runtime-smoke.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:43c89b8e-0f85-433c-a498-fabde6bd2329"}},"repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"cloudflare"},"_npmVersion":"11.19.1","description":"Cloudflare Workers adapter for sending application errors to MONICA","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","dependencies":{"@ah-monica/core":"0.1.2"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"wrangler":"4.127.0","@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/cloudflare_0.1.2_1789004422920_0.47251290436801274","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@ah-monica/cloudflare","version":"0.2.0","license":"Apache-2.0","_id":"@ah-monica/cloudflare@0.2.0","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"25e9bdfed8d05916b9a106dcd2b2e32483d5c864","tarball":"https://registry.npmjs.org/@ah-monica/cloudflare/-/cloudflare-0.2.0.tgz","fileCount":11,"integrity":"sha512-Nm27gGi+N5SRXYnsglq5/TJLfQbZZpMf/5jBchPEQ2alRMCbu57P56GM9+3nsfjaPoJGCTDrqqmmjYd6+dgepA==","signatures":[{"sig":"MEYCIQDo9i27pZ/FZ7eAo2YCgn/IEhTw45Hpq17vkAjWR9TidQIhAJq2GmeciWypF4iH/eNR4zl7Wb5o2ThD3ZYF8/3OmuKr","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcloudflare@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":25169},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"710a43a9849dba9f1c2ce98a45652d0d59f3a91a","scripts":{"test":"bun run build:core && bun test","build":"bun run build:core && tsc -p tsconfig.build.json","typecheck":"bun run build:core && tsc --noEmit","build:core":"bun run --filter @ah-monica/core build","pack:check":"bun run build && bun pm pack --dry-run","test:runtime":"bun run build && bun run test/runtime-smoke.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:43c89b8e-0f85-433c-a498-fabde6bd2329"}},"repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"cloudflare"},"_npmVersion":"11.19.1","description":"Cloudflare Workers adapter for sending application errors to MONICA","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","dependencies":{"@ah-monica/core":"0.2.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"wrangler":"4.127.0","@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/cloudflare_0.2.0_1789034593832_0.5716667083744438","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@ah-monica/cloudflare","version":"0.2.1","license":"Apache-2.0","_id":"@ah-monica/cloudflare@0.2.1","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"73edd9b4c76d531c1775f243d15133c87be970c1","tarball":"https://registry.npmjs.org/@ah-monica/cloudflare/-/cloudflare-0.2.1.tgz","fileCount":11,"integrity":"sha512-OPOR+UCm27dnYkXBYtMbIyBsfL04SjNpP1uRsP+ZwUiQDfhUMgJRNm3PRx9n4StY3/KRcQ2zlIzW9A96hOaoxg==","signatures":[{"sig":"MEYCIQCHy7qShueFuSPZPKCqFgcOAxAP9PNL9Actl7AghltEJQIhAOWs6UuKHJgOiKN8/eqXbLroeP6AkcsprDWZ8aGWMTRT","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIAOv5O3SLCW+tF6mYHQGuVx+mORecxEjlk/JvMGsHvsKAiAjMIflam1o8h5DeQJsb7Gxiry7SFhPJO1AhH9r5ihd7g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcloudflare@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":25717},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"6ccb8fc3a6ed26a1cee976602bba04f0d5891db1","scripts":{"test":"bun run build:core && bun test","build":"bun run build:core && tsc -p tsconfig.build.json","typecheck":"bun run build:core && tsc --noEmit","build:core":"bun run --filter @ah-monica/core build","pack:check":"bun run build && bun pm pack --dry-run","test:runtime":"bun run build && bun run test/runtime-smoke.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:43c89b8e-0f85-433c-a498-fabde6bd2329"}},"repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"cloudflare"},"_npmVersion":"11.19.1","description":"Cloudflare Workers adapter for sending application errors to MONICA","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","dependencies":{"@ah-monica/core":"0.2.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"wrangler":"4.127.0","@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/cloudflare_0.2.1_1789097658568_0.5836632738369734","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@ah-monica/cloudflare","version":"0.3.0","license":"Apache-2.0","_id":"@ah-monica/cloudflare@0.3.0","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"ec34fda74b48f47ad6c1f99515a856af6631fd2e","tarball":"https://registry.npmjs.org/@ah-monica/cloudflare/-/cloudflare-0.3.0.tgz","fileCount":11,"integrity":"sha512-fmyPOgyh+qaqtve63Q0jT50ehxvITZTBDdADFrSH/r7OrjHwTN/z6T9Q/TJNC4v+Etch0ZuH8EruZwsvDD0h4A==","signatures":[{"sig":"MEQCICFFk8DJLUcKLaUmCoQ1ustDgA2ib4wfhgl8S0huFZh5AiAEyJ/NiGKXaWh+QQ87T1s8O2XaRx6YbzVTCK7zTaP26g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCcIVS+1UJq3LokwRE1RXqMZDsbIDyroSaNyhzI5NKcoAIgMq9c0KcwONtdhshu9ix7dtzlJ6sHRZoAZSjXhS0CbDw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcloudflare@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":27668},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"ff961deaf85cd3e52d04e6857044944f841bba46","scripts":{"test":"bun run build:core && bun test","build":"bun run build:core && tsc -p tsconfig.build.json","typecheck":"bun run build:core && tsc --noEmit","build:core":"bun run --filter @ah-monica/core build","pack:check":"bun run build && bun pm pack --dry-run","test:runtime":"bun run build && bun run test/runtime-smoke.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:43c89b8e-0f85-433c-a498-fabde6bd2329"}},"repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"cloudflare"},"_npmVersion":"11.19.1","description":"Cloudflare Workers adapter for sending application errors to MONICA","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","dependencies":{"@ah-monica/core":"0.3.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"wrangler":"4.127.0","@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/cloudflare_0.3.0_1790226275905_0.05758176131848791","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@ah-monica/cloudflare","version":"0.4.0","license":"Apache-2.0","_id":"@ah-monica/cloudflare@0.4.0","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"0443a93babbb28434c8ec85a37800bb585f8cb23","tarball":"https://registry.npmjs.org/@ah-monica/cloudflare/-/cloudflare-0.4.0.tgz","fileCount":11,"integrity":"sha512-Sm3011rwz679IzdB2Ixj5F3+/fTPI0ja6c4tC3WXRyIyMsBFSaBPXqNxX0m8OKRyaGpqSaYgxA9vDuYvG7QT5g==","signatures":[{"sig":"MEUCIQCUaXgGu3TzR7Nv08MfshW5aVDmZsACE1fi+pVoHutnGwIgKD8c+UuFMkGyOQ9In4n+v0IX9jldnAd8rZFjEDjybwg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIDRd9Z+Q2a7plSf+cwAOIEvsfRpfA5pOkEF+pYuP8maNAiAETqi980ijIkcOqtw1PFpLSj/nY/mEpoZRQY4hGOqBmw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcloudflare@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":29625},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"5302bc5a3a31ba74743de4015f3bc91fa66f07ce","scripts":{"test":"bun run build:core && bun test","build":"bun run build:core && tsc -p tsconfig.build.json","typecheck":"bun run build:core && tsc --noEmit","build:core":"bun run --filter @ah-monica/core build","pack:check":"bun run build && bun pm pack --dry-run","test:runtime":"bun run build && bun run test/runtime-smoke.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"43c89b8e-0f85-433c-a498-fabde6bd2329"}},"repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"cloudflare"},"_npmVersion":"11.19.1","description":"Cloudflare Workers adapter for sending application errors to MONICA","directories":{},"sideEffects":false,"_nodeVersion":"24.21.0","dependencies":{"@ah-monica/core":"0.4.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"wrangler":"4.127.0","@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/cloudflare_0.4.0_1790667496623_0.9582998568346512","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"_id":"@ah-monica/cloudflare@0.4.1","bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"dist":{"shasum":"4a62f9a3b029c4076ae8567cbb99068bcf229b13","tarball":"https://registry.npmjs.org/@ah-monica/cloudflare/-/cloudflare-0.4.1.tgz","fileCount":11,"integrity":"sha512-Kw/S2eKQ4UW+m3V3PsJOnn5ezHhr5LLwIDxeztOyzWuccluKqINFppW0NdtnKHD1reoVqnsCrNnetRYG6FzztQ==","signatures":[{"sig":"MEUCIByGCkIC/uHBIU+miuAgnG3LQ36ZJ1gSgCSKOCbqEBccAiEAlX+jagQzoaY5loMnf6dv6nZ4MYEyt72CmN6gMYeIn4E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHjBliyVgMPEaYlhw+30ux+H4BfEoDpYqvisT+e5FjCdAiEA9bF2IRVLU2m2NiE+Xy7NipJx6JTOq31Eiui6eM+q7hM="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ah-monica%2fcloudflare@0.4.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":29625},"main":"./dist/index.js","name":"@ah-monica/cloudflare","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"cc26fcc5068f2643df9a53ca42fca233bad62f87","license":"Apache-2.0","scripts":{"test":"bun run build:core && bun test","build":"bun run build:core && tsc -p tsconfig.build.json","typecheck":"bun run build:core && tsc --noEmit","build:core":"bun run --filter @ah-monica/core build","pack:check":"bun run build && bun pm pack --dry-run","test:runtime":"bun run build && bun run test/runtime-smoke.ts"},"version":"0.4.1","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"43c89b8e-0f85-433c-a498-fabde6bd2329"}},"homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"cloudflare"},"_npmVersion":"11.19.1","description":"Cloudflare Workers adapter for sending application errors to MONICA","directories":{},"maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"sideEffects":false,"_nodeVersion":"24.21.0","dependencies":{"@ah-monica/core":"0.4.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"wrangler":"4.127.0","@types/bun":"^1.2.21","typescript":"^5.9.2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cloudflare_0.4.1_1790669734153_0.6799471485172646"}}},"time":{"created":"2026-08-29T13:52:05.972Z","modified":"2026-09-29T08:15:34.621Z","0.1.0":"2026-08-29T13:52:06.423Z","0.1.2":"2026-09-10T01:40:23.049Z","0.2.0":"2026-09-10T10:03:13.962Z","0.2.1":"2026-09-11T03:34:18.647Z","0.3.0":"2026-09-24T05:04:35.982Z","0.4.0":"2026-09-29T07:38:16.700Z","0.4.1":"2026-09-29T08:15:34.246Z"},"bugs":{"url":"https://github.com/Accel-Hack/monica-sdk-js/issues"},"license":"Apache-2.0","homepage":"https://github.com/Accel-Hack/monica-sdk-js#readme","repository":{"url":"git+https://github.com/Accel-Hack/monica-sdk-js.git","type":"git","directory":"cloudflare"},"description":"Cloudflare Workers adapter for sending application errors to MONICA","maintainers":[{"name":"kkyosuke","email":"kawamura@accelhack.com"},{"name":"namnam34","email":"namba_ryota@accelhack.com"}],"readme":"# @ah-monica/cloudflare\n\nCloudflare Workers から MONICA へ、捕捉した例外を送る adapter。\nNode.js API に依存しないので `nodejs_compat` フラグは要らない。\n\n共通の使い方・オプション・制約は [ルートの README](../README.md) にある。\n\n## インストール\n\n```bash\nnpm install @ah-monica/cloudflare\n```\n\n## 初期化\n\nDSN には secret key（`msk_...`）を使い、Cloudflare の secret に保存する（`vars` には置かない）。\nstaging と production では project・鍵・`environment` を分ける。\n\n```ts\nimport { createCloudflareClient } from \"@ah-monica/cloudflare\";\n\ninterface Env {\n  MONICA_DSN: string;\n  MONICA_ENVIRONMENT: string;\n  MONICA_RELEASE?: string;\n}\n\nfunction createClient(env: Env) {\n  return createCloudflareClient({\n    dsn: env.MONICA_DSN,\n    environment: env.MONICA_ENVIRONMENT,\n    release: env.MONICA_RELEASE,\n    beforeSend(item) {\n      // どの値が個人情報かはアプリケーション固有。送ってよい値だけを残す。\n      delete item.user;\n      if (item.request) delete item.request.headers;\n      return item;\n    },\n  });\n}\n```\n\n`MONICA_RELEASE` には deploy する git の commit sha を入れる（例: `wrangler deploy --var MONICA_RELEASE:$(git rev-parse HEAD)`）。\nブラウザ側の SDK にも同じ値を渡すと、Worker とブラウザの event が同じ release に揃う。\n\nDSN を Secrets Store に置く場合、binding の値は `get()` で非同期に読むので、client は\nrequest の入口で作る（[制約](#制約) のとおり request ごとに作ってよい）。`get()` は secret が\n無いと例外を投げるので、`undefined` に落として何も送らない client にする。\n\n```ts\ninterface Env {\n  MONICA_DSN: SecretsStoreSecret;\n  MONICA_ENVIRONMENT: string;\n  MONICA_RELEASE?: string;\n}\n\nexport default {\n  async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {\n    const monica = createCloudflareClient({\n      dsn: await env.MONICA_DSN.get().catch(() => undefined),\n      environment: env.MONICA_ENVIRONMENT,\n      release: env.MONICA_RELEASE,\n    });\n    ctx.waitUntil(monica.flush());\n    try {\n      return await handleRequest(request, env);\n    } catch (error) {\n      monica.captureExceptionInBackground(ctx, error);\n      return new Response(\"Internal Server Error\", { status: 500 });\n    }\n  },\n};\n```\n\n## 使い方\n\nrequest の入口で client を作り、`ctx.waitUntil(monica.flush())` を呼ぶ（[稼働確認](#稼働確認)）。\n\n`captureException()` は capture と flush の両方を終えてから解決する Promise を返す。\nhandler の応答を待たせたくない場合は `captureExceptionInBackground(ctx, ...)` で\n`ExecutionContext.waitUntil()` に載せる。\n\n```ts\nexport default {\n  async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {\n    const monica = createClient(env);\n    ctx.waitUntil(monica.flush());\n    try {\n      return await handleRequest(request, env);\n    } catch (error) {\n      monica.captureExceptionInBackground(ctx, error, {\n        tags: { operation: \"handle-request\" },\n        // URL の path にも個人情報が入り得るので、安全と判断した値だけを渡す。\n        request: { method: request.method, url: new URL(request.url).origin },\n      });\n      return new Response(\"Internal Server Error\", { status: 500 });\n    }\n  },\n};\n```\n\nCron や Queue の handler のように送信完了を処理結果に含めたい場合は、直接 `await` する。\n\n```ts\nconst monica = createClient(env);\nawait monica.captureException(error, { tags: { trigger: \"scheduled\" } });\n```\n\n`captureMessage()` も同じく capture と flush を終えてから解決するので、`flush()` を\n別途呼ぶ必要は無い。scope（`setUser` / `addBreadcrumb` / `withScope`）は持たず、\n文脈は capture の第 2 引数で渡す。\n\nWorker の外側で起きた未捕捉例外まで集めたい場合は Tail Worker も検討する。この adapter は、\nアプリケーションが捕捉して業務上の文脈を選んで送る例外を対象にする。\n\n## 稼働確認\n\n共通の仕組みは [ルートの README](../README.md#稼働確認) にある。\n\n- isolate で最初の `flush()` / `captureException()` / `captureMessage()` の呼び出しが\n  `trigger: \"start\"` を 1 通送る。client を作っただけでは送らない。`dsn` と `environment` の組ごとに数える\n- request の入口で `ctx.waitUntil(monica.flush())` を呼ぶ。`waitUntil` が無いと handler の終了で送信が打ち切られる\n- Workers にはタイマーが無いので `trigger: \"interval\"` は送らない。isolate が作り直されるたびに `start` を送る\n- 状態は isolate のメモリに持ち、ストレージには書かない\n\n## オプション\n\n| option | 型 | default | 説明 |\n| --- | --- | --- | --- |\n| `dsn` | `string \\| null` | なし | `https://msk_...@<ingest-host>`。未指定・空文字なら何も送らない |\n| `environment` | `string` | 必須 | 1〜128 文字 |\n| `release` | `string` | なし | item の `release` に載る |\n| `sampleRate` | `number` | `1` | 0〜1 |\n| `requestTimeoutMs` | `number` | `2000` | 1 回の HTTP request の上限 |\n| `flushTimeoutMs` | `number` | `2000` | `captureException` / `captureMessage` が内部で待つ flush の上限 |\n| `maxRetries` | `number` | `0` | `429` / `5xx` / network 障害の再送回数 |\n| `maxCauseDepth` | `number` | `10` | 辿る `cause` の段数 |\n| `maxStackFrames` | `number` | `200` | 送る stack frame 数 |\n| `onDiagnostic` | `(diagnostic) => void \\| null` | `console.warn` に 1 行 | 拒否されたときの診断の受け取り先。`null` で無効 |\n| `beforeSend` | `(item, hint) => item \\| null \\| Promise<...>` | なし | `null` を返すと破棄 |\n| `fetch` | `typeof fetch` | `globalThis.fetch` | 送信に使う fetch |\n\n## 送信結果と診断\n\n拒否されたときは既定で `console.warn` に 1 行出る（Workers のログに出る。`422` / `401` / `413`）。\n`flush()` の戻り値の `status` / `issues` / `error` / `stopped` からも取れる。\n詳しくは [TROUBLESHOOTING.md](../TROUBLESHOOTING.md)。\n\n## 制約\n\n- `captureExceptionInBackground` を使わず、`waitUntil()` にも載せずに handler を返すと、\n  送信は途中で打ち切られる。\n- client は request ごとに作ってよい。`401` で止まるのはその client だけなので、\n  鍵が失効しても次の request で再び 1 回 POST する。\n\n## ライセンス\n\n[Apache-2.0](LICENSE)\n","readmeFilename":"README.md"}