{"_id":"@augstash/sdk","name":"@augstash/sdk","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@augstash/sdk","version":"0.2.0","description":"Node / TypeScript client for the Augstash messaging API","license":"Apache-2.0","main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","test":"tsc -p tsconfig.test.json && cd dist-test && node --test","prepublishOnly":"npm run build"},"devDependencies":{"typescript":"^5.6.3","@types/node":"^22.9.0"},"gitHead":"8c924256399d52650ac6cb94f6a1f72c44ec49e2","_id":"@augstash/sdk@0.2.0","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-Pm8iVvUxaa45/ukAicE22UmiNe4TFSMjCarwuwZLsp0QGFc8CgsWo02sB0nyStJIZ+xorLoH5Sr4jP7/imasBQ==","shasum":"579ce88a0021b767a3720621b82603d11b352868","tarball":"https://registry.npmjs.org/@augstash/sdk/-/sdk-0.2.0.tgz","fileCount":1875,"unpackedSize":7725459,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDyzqxdgoQV9a/b9UU/OuggucWDQsVRWn50MYZw/ku9FAIgYTRcqyBSeX7CsPQJmLr3jjLItMrU/qhnPOflLHT1ud4="}]},"_npmUser":{"name":"augstash-admin","email":"info@augmentrait.com"},"directories":{},"maintainers":[{"name":"augstash-admin","email":"info@augmentrait.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.2.0_1788787009441_0.885644420133"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-07T13:16:49.286Z","0.2.0":"2026-09-07T13:16:49.624Z","modified":"2026-09-07T13:16:49.815Z"},"maintainers":[{"name":"augstash-admin","email":"info@augmentrait.com"}],"description":"Node / TypeScript client for the Augstash messaging API","license":"Apache-2.0","readme":"# @augstash/sdk\n\nNode / TypeScript client for the Augstash API. Not published yet - see [`../README.md`](../README.md).\n\n```bash\nnpm install            # dev dependencies\npython ../tools/refresh.py --base-url http://localhost:8086 node   # generate the client\nnpm test\nnpm run build\n```\n\n## Using it\n\n```ts\nimport { AugstashClient, AugstashError, ContactApi, SmsApi, WalletApi } from '@augstash/sdk';\n\nconst client = new AugstashClient({\n  baseUrl: process.env.AUGSTASH_BASE_URL!,   // required - there is no default host\n  apiKey: process.env.AUGSTASH_API_KEY!,     // ask_live_<keyId>.<secret>\n});\n\nconst wallet = await client.api(WalletApi).balance();\n\ntry {\n  await client.api(SmsApi).sendSms({ sendSmsRequest: { to: '+919000000000', body: 'hello' } });\n} catch (error) {\n  if (error instanceof AugstashError && error.code === 'WALLET_INSUFFICIENT_FUNDS') {\n    // branch on `code`, never on `message` - message is localized\n    console.error(error.detail, error.traceId);\n  }\n}\n```\n\n`client.api(X)` takes any of the 154 generated API classes and hands back a cached, configured\ninstance. There is no hand-written list of accessors: one would drift the moment an endpoint is\nadded.\n\n### Paging\n\n```ts\nimport { collect, paginateCursor, paginatePages } from '@augstash/sdk';\n\nconst contacts = client.api(ContactApi);\nfor await (const contact of paginatePages((page) => contacts.listContacts({ page, limit: 100 }))) {\n  // ...\n}\n```\n\nUse `paginateCursor` for message, conversation and event history - those endpoints are cursor-paged\nbecause an offset page over a table that grows at the top repeats and skips rows mid-scroll.\n\n### Webhooks\n\n```ts\nimport { verifyWebhookSignature, SIGNATURE_HEADER } from '@augstash/sdk';\n\napp.post('/hooks/augstash', express.raw({ type: 'application/json' }), async (req, res) => {\n  const ok = await verifyWebhookSignature(secret, req.body, req.header(SIGNATURE_HEADER));\n  if (!ok) return res.sendStatus(401);\n  // req.body is the raw Buffer - `express.json()` would re-serialize and the check would fail\n  res.sendStatus(204);\n});\n```\n\n## Options\n\n| Option | Default | |\n|---|---|---|\n| `baseUrl` | - | required |\n| `apiKey` / `bearerToken` | - | one is required; a bearer token reaches endpoints a key cannot |\n| `timeoutMs` | 30000 | per attempt |\n| `retry` | 3 attempts, 0.5s-8s | `{maxAttempts: 1}` disables |\n| `idempotency` | `true` | off also stops mutating calls being retried |\n| `headers`, `fetch`, `middleware` | - | escape hatches |\n\n## Build notes\n\nCompiled to CommonJS so both bundlers and plain Node consumers work without extension-ful imports;\nan ESM build is worth adding before publishing. `src/generated/` is machine-written and gitignored -\nedit `src/*.ts` only.\n","readmeFilename":"README.md","_rev":"1-353a4456797891969aee1a04ec0ca9f5"}