{"_id":"@autotix/sdk","_rev":"4-7c64c1d2d2810a948fb2aa7bc05eec77","name":"@autotix/sdk","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"@autotix/sdk","version":"0.1.0","keywords":["autotix","error-tracking","sentry","monitoring","jira","github"],"license":"MIT","_id":"@autotix/sdk@0.1.0","maintainers":[{"name":"danlinn","email":"dan@helloworlddevs.com"}],"homepage":"https://autotix.io","bugs":{"url":"https://github.com/HelloWorldDevs/autotickets/issues"},"dist":{"shasum":"5829c6a59419be17f4f215cdad3d3b06fa9df63d","tarball":"https://registry.npmjs.org/@autotix/sdk/-/sdk-0.1.0.tgz","fileCount":16,"integrity":"sha512-yTpHyJtW6rI2+4YgKzm0en5tBEFzTPlk+Qn25uOKiuVZee8N3/xndBzDzCXwrjYZgkWbJJGrazHHOaFLrP/w4g==","signatures":[{"sig":"MEUCIQCfLtl8WGG0+AH4Iy2EZ27x392TDF/xJ9IAwcCAUKh/NAIgQ9L8ZTZKa1sCCo8Ayhhlpkvv319/3GSdFkgyG5F/g3A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":89028},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.cjs"},"./package.json":"./package.json"},"gitHead":"0965712a6a29cef82a0a64a5c45dcddd15a938b4","scripts":{"dev":"tsup --watch","size":"size-limit","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"danlinn","email":"dan@helloworlddevs.com"},"repository":{"url":"git+https://github.com/HelloWorldDevs/autotickets.git","type":"git","directory":"packages/sdk"},"size-limit":[{"name":"browser bundle (with auto-capture)","path":"dist/browser.js","limit":"4 KB"},{"name":"core bundle (manual API only)","path":"dist/index.js","limit":"2 KB"}],"_npmVersion":"10.9.3","description":"Ship JS errors from any browser, Node, or edge runtime to Autotix.","directories":{},"sideEffects":false,"_nodeVersion":"22.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","vitest":"^4.1.0","size-limit":"^11.1.0","typescript":"^5.6.0","@size-limit/preset-small-lib":"^11.1.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1777997786768_0.8601240610162957","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@autotix/sdk","version":"0.2.0","keywords":["autotix","error-tracking","sentry","monitoring","jira","github"],"license":"MIT","_id":"@autotix/sdk@0.2.0","maintainers":[{"name":"danlinn","email":"dan@helloworlddevs.com"}],"homepage":"https://autotix.io","bugs":{"url":"https://github.com/HelloWorldDevs/autotickets/issues"},"dist":{"shasum":"467c23290e76e9e45f088e51ddad4a99734761d2","tarball":"https://registry.npmjs.org/@autotix/sdk/-/sdk-0.2.0.tgz","fileCount":30,"integrity":"sha512-W0fcZzb6qQIO4GMlPZe8MLWt+77fYddEAw2kRsMCcTKz+qJ3klc2pJM7LchZymVFyE+TrX/IbBRHJEIG/GK9xQ==","signatures":[{"sig":"MEUCIQDbIU4NffY1ro08wuCJ1OKNHs5+LNSCOREOyibqPrYfsAIgBjAvDI9LWIt1GoKd0GB+zNlgGO+n/IqBcLE9JWoDl7c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":152978},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./nextjs":{"types":"./dist/nextjs/server.d.ts","import":"./dist/nextjs/server.js","require":"./dist/nextjs/server.cjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.cjs"},"./package.json":"./package.json","./nextjs/client":{"types":"./dist/nextjs/client.d.ts","import":"./dist/nextjs/client.js","require":"./dist/nextjs/client.cjs"}},"gitHead":"fa02cbc89d81e7d9e37194b6bd5451d1e44f4950","scripts":{"dev":"tsup --watch","size":"size-limit","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"danlinn","email":"dan@helloworlddevs.com"},"repository":{"url":"git+https://github.com/HelloWorldDevs/autotickets.git","type":"git","directory":"packages/sdk"},"size-limit":[{"name":"browser bundle (with auto-capture)","path":"dist/browser.js","limit":"4 KB"},{"name":"core bundle (manual API only)","path":"dist/index.js","limit":"2 KB"}],"_npmVersion":"10.9.3","description":"Ship JS errors from any browser, Node, or edge runtime to Autotix.","directories":{},"sideEffects":false,"_nodeVersion":"22.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","react":"^18.3.0","vitest":"^4.1.0","react-dom":"^18.3.0","size-limit":"^11.1.0","typescript":"^5.6.0","@types/react":"^18.3.0","@testing-library/react":"^16.0.0","@size-limit/preset-small-lib":"^11.1.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0"},"peerDependenciesMeta":{"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.0_1778008622488_0.3898927611117191","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@autotix/sdk","version":"0.2.1","keywords":["autotix","error-tracking","sentry","monitoring","jira","github"],"license":"MIT","_id":"@autotix/sdk@0.2.1","maintainers":[{"name":"danlinn","email":"dan@helloworlddevs.com"}],"homepage":"https://autotix.io","bugs":{"url":"https://github.com/HelloWorldDevs/autotickets/issues"},"dist":{"shasum":"d549cfad7d868d3198a6c8840a0f7d996fde5579","tarball":"https://registry.npmjs.org/@autotix/sdk/-/sdk-0.2.1.tgz","fileCount":32,"integrity":"sha512-9XFA4PvpQfYniQwO7YuPaW6m+KDIsTk9W5dbVMezgWNVBhQLwiAqVsd6/RwWKnznC2zegOMvD22twhRb7zOUnA==","signatures":[{"sig":"MEUCIQCOwAdeldD2KXoMPa40mzP7Qga93WLDYiQNq3kbUYxh5AIgfOUjWCaJJ6lUa2qh4Zs/0t6lh0nGlx+GeOdSVkF5obA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":160992},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./nextjs":{"types":"./dist/nextjs/server.d.ts","import":"./dist/nextjs/server.js","require":"./dist/nextjs/server.cjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.cjs"},"./package.json":"./package.json","./nextjs/client":{"types":"./dist/nextjs/client.d.ts","import":"./dist/nextjs/client.js","require":"./dist/nextjs/client.cjs"}},"gitHead":"43bfe8ce54a9991b194ea8686dbf92e2afec0c38","scripts":{"dev":"tsup --watch","size":"size-limit","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"danlinn","email":"dan@helloworlddevs.com"},"repository":{"url":"git+https://github.com/HelloWorldDevs/autotickets.git","type":"git","directory":"packages/sdk"},"size-limit":[{"name":"browser bundle (with auto-capture)","path":"dist/browser.js","limit":"4 KB"},{"name":"core bundle (manual API only)","path":"dist/index.js","limit":"2 KB"}],"_npmVersion":"10.9.3","description":"Ship JS errors from any browser, Node, or edge runtime to Autotix.","directories":{},"sideEffects":false,"_nodeVersion":"22.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","react":"^18.3.0","vitest":"^4.1.0","react-dom":"^18.3.0","size-limit":"^11.1.0","typescript":"^5.6.0","@types/react":"^18.3.0","@testing-library/react":"^16.0.0","@size-limit/preset-small-lib":"^11.1.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0"},"peerDependenciesMeta":{"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.1_1778021681042_0.6553578863170109","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"_id":"@autotix/sdk@0.5.0","bugs":{"url":"https://github.com/HelloWorldDevs/autotix-js-sdk/issues"},"dist":{"shasum":"930e80e6fcb454db06166f01a72a157a9a151e5d","tarball":"https://registry.npmjs.org/@autotix/sdk/-/sdk-0.5.0.tgz","fileCount":39,"integrity":"sha512-a1Jy8IkZk3zHiRpI5JiBSNuEeKZ4cTPdNXVSOFdNS+I3MIbnmxYdzNg3+VnxX/dpPlIgSuGOEzBB0X4FXMkzAw==","signatures":[{"sig":"MEUCIDS0VZnKaEaRQg6KCB4u/7R1Irt8wsvVc1n6CWUybCfhAiEA78GFvHGbUpO0pscrT8vSjeroATtNu0oXllYbLlv1Dm8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIA5Xt/qSo+FfclQXTqSVRcKQNc4meY8mg0SaM/EosBf5AiEApH11Hy7UvHQ9WDd5dF2aS26vlxA10Ra/rR/SmE0rsK8="}],"unpackedSize":219274},"main":"./dist/index.cjs","name":"@autotix/sdk","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./nextjs":{"types":"./dist/nextjs/server.d.ts","import":"./dist/nextjs/server.js","require":"./dist/nextjs/server.cjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.cjs"},"./environment":{"types":"./dist/environment.d.ts","import":"./dist/environment.js","require":"./dist/environment.cjs"},"./package.json":"./package.json","./nextjs/client":{"types":"./dist/nextjs/client.d.ts","import":"./dist/nextjs/client.js","require":"./dist/nextjs/client.cjs"}},"gitHead":"d90323ab8c3ff28af7645668f870ddb346e15a89","license":"MIT","scripts":{"dev":"tsup --watch","size":"size-limit","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build && npm test"},"version":"0.5.0","_npmUser":{"name":"danlinn","email":"dan@helloworlddevs.com"},"homepage":"https://autotix.io","keywords":["autotix","error-tracking","sentry","monitoring","jira","github"],"repository":{"url":"git+https://github.com/HelloWorldDevs/autotix-js-sdk.git","type":"git"},"size-limit":[{"name":"browser bundle (with auto-capture)","path":"dist/browser.js","limit":"4 KB"},{"name":"core bundle (manual API only)","path":"dist/index.js","limit":"2 KB"}],"_npmVersion":"10.9.3","description":"Ship JS errors from any browser, Node, or edge runtime to Autotix.","directories":{},"maintainers":[{"name":"danlinn","email":"dan@helloworlddevs.com"}],"sideEffects":false,"_nodeVersion":"22.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","react":"^18.3.0","vitest":"^4.1.0","react-dom":"^18.3.0","size-limit":"^11.1.0","typescript":"^5.6.0","@types/react":"^18.3.0","@testing-library/react":"^16.0.0","@size-limit/preset-small-lib":"^11.1.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0"},"peerDependenciesMeta":{"react":{"optional":true}},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.5.0_1790698522516_0.7604450974290429"}}},"time":{"created":"2026-05-05T16:16:26.612Z","modified":"2026-09-29T16:15:22.827Z","0.1.0":"2026-05-05T16:16:26.926Z","0.2.0":"2026-05-05T19:17:02.617Z","0.2.1":"2026-05-05T22:54:41.199Z","0.5.0":"2026-09-29T16:15:22.650Z"},"bugs":{"url":"https://github.com/HelloWorldDevs/autotix-js-sdk/issues"},"license":"MIT","homepage":"https://autotix.io","keywords":["autotix","error-tracking","sentry","monitoring","jira","github"],"repository":{"url":"git+https://github.com/HelloWorldDevs/autotix-js-sdk.git","type":"git"},"description":"Ship JS errors from any browser, Node, or edge runtime to Autotix.","maintainers":[{"name":"danlinn","email":"dan@helloworlddevs.com"}],"readme":"# @autotix/sdk\n\nShip JS errors from any browser, Node, or edge runtime to [Autotix](https://autotix.io). Autotix turns the errors into Jira/GitHub tickets and (when enabled) opens auto-fix PRs.\n\n- **Universal** — browsers, Node 18+, Lambdas, Vercel/Cloudflare/Deno workers\n- **Tiny** — < 4 KB gzipped browser bundle, zero dependencies\n- **Drop-in auto-capture** in browsers (`window.onerror`, `unhandledrejection`)\n- **Manual API** for Node scripts, server components, CLI tools, etc.\n- **TypeScript-first** with full type definitions\n\n## Install\n\n```bash\nnpm install @autotix/sdk\n# or\npnpm add @autotix/sdk\nyarn add @autotix/sdk\n```\n\n## Quick start\n\n### Browsers (with auto-capture)\n\n```ts\nimport { init } from \"@autotix/sdk/browser\";\n\ninit({\n  token: \"iat_xxxxxxxxxxxxxxxxxxxx\",\n  environment: \"production\",\n  release: \"v1.4.2\",\n});\n// Done. Uncaught errors and unhandled promise rejections now ship to Autotix.\n```\n\n### Node, Lambdas, edge (no auto-capture)\n\n```ts\nimport { init, capture } from \"@autotix/sdk\";\n\ninit({\n  token: process.env.AUTOTIX_INGEST_TOKEN!,\n  environment: process.env.NODE_ENV,\n});\n\ntry {\n  await doRiskyThing();\n} catch (err) {\n  capture(err, { tags: { module: \"billing\" } });\n  throw err;\n}\n```\n\n### Manual capture (works in both)\n\n```ts\nimport { capture, captureMessage, setUser, setContext } from \"@autotix/sdk\";\n\nsetUser({ id: user.id, email: user.email });\nsetContext(\"page\", { path: location.pathname });\n\ntry {\n  await checkout();\n} catch (err) {\n  capture(err);\n}\n\n// Non-error messages too:\ncaptureMessage(\"user requested account deletion\", { level: \"warning\" });\n```\n\n## Where do I get a token?\n\nIn your Autotix dashboard, go to **Settings → JS Errors** and click **Create Token**. You'll get a string like `iat_2a1b…`. Treat it like a public-write API key — anyone with it can submit events to your org. Revoke compromised tokens with one click; existing client deployments using the old token stop working immediately.\n\n## Verify your setup\n\nOnce you've called `init()`, fire a one-off test error to confirm the whole\npipeline works:\n\n```ts\nimport { triggerTestError } from \"@autotix/sdk/browser\"; // browser: auto-fills page URL\n// or: import { triggerTestError } from \"@autotix/sdk\";   // pass { url } yourself\n\ntriggerTestError();\n// → ships an \"AutotixTestError: …\" event tagged { autotix_test: true }\n```\n\nWire it to a dev-only button or route so you have a permanent one-click check:\n\n```tsx\n{process.env.NODE_ENV !== \"production\" && (\n  <button onClick={() => triggerTestError()}>Send Autotix test error</button>\n)}\n```\n\n`triggerTestError(options?)` accepts `{ message?, url?, tags? }`. It **bypasses\n`sampleRate`** (a test should always arrive) and tags the event\n`autotix_test: true` so it's easy to filter. It returns `true` if dispatched,\nor `false` (with a console warning) if `init()` hasn't run yet. Import it from\n`@autotix/sdk/browser` to get the current page URL attached automatically;\nfrom `@autotix/sdk` pass `{ url }` so the error routes to a project.\n\n## Configuration\n\n```ts\ninit({\n  token: \"iat_…\",                    // required\n  endpoint: \"https://app.autotix.io/api/client-errors\", // override for self-hosted\n  environment: \"production\",          // tag every event\n  release: \"v1.2.3\",                  // tag every event\n  sampleRate: 1.0,                    // 0..1 — fraction of events to ship\n\n  // Browser-only auto-capture (ignored in Node/edge):\n  captureUnhandledErrors: true,       // window.addEventListener(\"error\")\n  captureUnhandledRejections: true,   // unhandledrejection\n  captureConsoleError: false,         // wrap console.error (noisy — opt-in)\n\n  // Hooks:\n  beforeSend: (event) => {\n    if (event.message.includes(\"ResizeObserver\")) return null; // drop\n    return event;\n  },\n\n  // Inject a custom fetch (testing, custom retry/timeout, etc.):\n  fetch: customFetch,\n});\n```\n\n## API\n\n| Function                      | What it does                                                          |\n| ----------------------------- | --------------------------------------------------------------------- |\n| `init(options)`               | Initialize the SDK. Required before any other call.                   |\n| `capture(error, options?)`    | Ship an Error / thrown value.                                         |\n| `captureMessage(msg, opts?)`  | Ship a non-error message (defaults to `level: \"info\"`).               |\n| `triggerTestError(opts?)`     | Fire a labeled test error (bypasses sampling). Returns `false` if not initialized. |\n| `setUser(user \\| null)`       | Tag every subsequent event with this user.                            |\n| `setContext(key, value)`      | Attach key/value extra data to every subsequent event.                |\n| `setTag(key, value)`          | Attach a searchable tag to every subsequent event.                    |\n| `flush(timeoutMs = 2000)`     | Wait for in-flight requests. Returns `false` on timeout.              |\n| `close()`                     | Stop processing future events (in-flight requests still complete).    |\n| `getClient()`                 | Get the singleton client, or `null` if `init()` wasn't called yet.    |\n\n`capture()` and `captureMessage()` accept an options object:\n\n```ts\ncapture(err, {\n  level: \"fatal\",                       // fatal | error | warning | info | debug\n  tags: { module: \"auth\", retried: 1 }, // searchable\n  extra: { requestId: \"abc-123\" },      // non-searchable detail\n  user: { id: \"u_42\" },                 // override setUser\n  url: \"/checkout/payment\",             // override default URL\n});\n```\n\n## Frameworks\n\n### Next.js (App Router) — drop-in subpaths\n\nThe package ships pre-wired entry points for Next.js. Three lines of code total:\n\n```ts\n// instrumentation.ts (project root) — server errors + init\nexport { register, onRequestError } from \"@autotix/sdk/nextjs\";\n```\n\n```tsx\n// app/layout.tsx — browser auto-capture\nimport { AutotixProvider } from \"@autotix/sdk/nextjs/client\";\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <body>\n        <AutotixProvider />\n        {children}\n      </body>\n    </html>\n  );\n}\n```\n\n```bash\n# .env (or Vercel project env)\nNEXT_PUBLIC_AUTOTIX_INGEST_TOKEN=iat_xxx\n```\n\nThat's it. You now get:\n- Uncaught browser errors + unhandled promise rejections\n- Server component / route handler / server action errors (via Next 15's `onRequestError`)\n- Auto-tagged `environment` (from `VERCEL_ENV`) and `release` (from `VERCEL_GIT_COMMIT_SHA`) on every event\n\nTo tag events with the signed-in user, call `setUser()` from your auth context:\n\n```ts\nimport { setUser } from \"@autotix/sdk\";\nsetUser({ id: user.id, email: user.email });\n```\n\n### React error boundaries\n\n```tsx\nimport { Component } from \"react\";\nimport { capture } from \"@autotix/sdk\";\n\nexport class ErrorBoundary extends Component<{ children: React.ReactNode }> {\n  componentDidCatch(error: Error, info: React.ErrorInfo) {\n    capture(error, { extra: { componentStack: info.componentStack } });\n  }\n  render() { return this.props.children; }\n}\n```\n\n### AWS Lambda\n\n```ts\nimport { init, capture, flush } from \"@autotix/sdk\";\n\ninit({ token: process.env.AUTOTIX_INGEST_TOKEN! });\n\nexport const handler = async (event) => {\n  try {\n    return await doWork(event);\n  } catch (err) {\n    capture(err, { extra: { awsRequestId: event.requestContext?.requestId } });\n    // IMPORTANT: flush before Lambda freezes the runtime, or your event is lost.\n    await flush();\n    throw err;\n  }\n};\n```\n\n## What gets sent\n\nEvery event is a small JSON object — no PII unless you provide it via `setUser()` / `extra`:\n\n```json\n{\n  \"message\": \"TypeError: Cannot read properties of undefined\",\n  \"stack\": \"TypeError: …\\n    at handleClick (app.js:42:7)\\n    …\",\n  \"level\": \"error\",\n  \"url\": \"https://app.example.com/checkout\",\n  \"userAgent\": \"Mozilla/5.0 …\",\n  \"release\": \"v1.4.2\",\n  \"environment\": \"production\",\n  \"timestamp\": 1735603200000,\n  \"tags\": { \"module\": \"auth\" },\n  \"extra\": { \"requestId\": \"abc-123\" },\n  \"user\": { \"id\": \"u_42\" }\n}\n```\n\n## Privacy / safety\n\n- **Failures don't break your app.** A network error or 500 from Autotix returns silently — never throws into your code.\n- **`keepalive: true`** so events fire during page navigation aren't dropped.\n- **Body cap: 64 KB.** Larger payloads are rejected by the server with 413.\n- **Rate limit: 600 req/min/token.** Use `sampleRate` if you exceed this.\n- **No third-party deps.** Just the platform `fetch`.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}