{"_id":"@alitycs/core","name":"@alitycs/core","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.3":{"name":"@alitycs/core","version":"1.0.3","description":"Universal analytics SDK core — event tracking, batching, sessions, HTTP transport","main":"dist/index.js","module":"dist/index.esm.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.esm.js","require":"./dist/index.js"}},"sideEffects":false,"scripts":{"build":"bun build src/index.ts --outfile=dist/index.esm.js --target=node --format=esm","build:cjs":"bun build src/index.ts --outfile=dist/index.js --target=node --format=cjs","build:types":"tsc -p tsconfig.build.json","build:all":"bun run build && bun run build:cjs && bun run build:types","test":"bun test","test:coverage":"bun test --coverage","test:unit":"bun test tests/unit","test:integration":"bun test tests/integration","dev":"bun run --hot src/index.ts","type-check":"tsc --noEmit","lint":"eslint src/**/*.ts tests/**/*.ts","lint:fix":"eslint src/**/*.ts tests/**/*.ts --fix","format":"prettier --write src/**/*.ts tests/**/*.ts","format:check":"prettier --check src/**/*.ts tests/**/*.ts"},"devDependencies":{"@eslint/js":"^10.0.1","@types/node":"^26.2.0","bun-types":"^1.3.10","eslint":"^10.8.1","globals":"^17.11.0","prettier":"^3.9.6","typescript-eslint":"^8.67.0","typescript":"^5.9.3"},"repository":{"type":"git","url":"git+https://github.com/alitycs/alitycs-sdk-js.git","directory":"sdks/core"},"homepage":"https://github.com/alitycs/alitycs-sdk-js/tree/main/sdks/core#readme","bugs":{"url":"https://github.com/alitycs/alitycs-sdk-js/issues"},"publishConfig":{"access":"public","provenance":true},"keywords":["analytics","tracking","typescript","javascript","sdk","events","universal"],"license":"MIT","engines":{"node":">=18.0.0","bun":">=1.0.0"},"_id":"@alitycs/core@1.0.3","_integrity":"sha512-9/8n70xsDnM0jzCdUTZDmJODL8UxCPyr3Jqu+0lvYjZfoNMm4IpQX/LhB7HRLOMF2fa9N5WBiMGY5GQs4quEZg==","_resolved":"/Volumes/External/alitycs/.codex-tmp/npm-release-v1.0.3/alitycs-core-1.0.3.tgz","_from":"file:/Volumes/External/alitycs/.codex-tmp/npm-release-v1.0.3/alitycs-core-1.0.3.tgz","_nodeVersion":"24.14.0","_npmVersion":"11.18.0","dist":{"integrity":"sha512-9/8n70xsDnM0jzCdUTZDmJODL8UxCPyr3Jqu+0lvYjZfoNMm4IpQX/LhB7HRLOMF2fa9N5WBiMGY5GQs4quEZg==","shasum":"2cc0c33c4708026282549d0ea18a1417d83e6ba8","tarball":"https://registry.npmjs.org/@alitycs/core/-/core-1.0.3.tgz","fileCount":14,"unpackedSize":57215,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDBckTsw2aFyWj7nr4vhyPMzg70IlpJmIqU6LhRO/jQzQIgeW3etJ2wrcCkZU9tFBAlECAIufNSy3YQz4rY8mGZyDs="}]},"_npmUser":{"name":"alitycs","email":"traivy.tech@gmail.com"},"directories":{},"maintainers":[{"name":"alitycs","email":"traivy.tech@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_1.0.3_1788087407278_0.11358254839129889"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-30T10:56:47.134Z","1.0.3":"2026-08-30T10:56:47.419Z","modified":"2026-08-30T10:56:47.633Z"},"maintainers":[{"name":"alitycs","email":"traivy.tech@gmail.com"}],"description":"Universal analytics SDK core — event tracking, batching, sessions, HTTP transport","homepage":"https://github.com/alitycs/alitycs-sdk-js/tree/main/sdks/core#readme","keywords":["analytics","tracking","typescript","javascript","sdk","events","universal"],"repository":{"type":"git","url":"git+https://github.com/alitycs/alitycs-sdk-js.git","directory":"sdks/core"},"bugs":{"url":"https://github.com/alitycs/alitycs-sdk-js/issues"},"license":"MIT","readme":"# `@alitycs/core`\n\nUniversal TypeScript SDK for sending product-analytics events to Alitycs from trusted server and\nJavaScript runtimes. It provides batching, bounded queues, sessions, retry, global properties, and\nexplicit lifecycle control without browser-only autocapture.\n\n## Installation\n\nInstall the package from npm:\n\n```bash\nbun add @alitycs/core\n# or: npm install @alitycs/core\n```\n\nFor archive-based installation, use the archive attached to the matching\n[GitHub Release](https://github.com/alitycs/alitycs-sdk-js/releases):\n\n```bash\nbun add https://github.com/alitycs/alitycs-sdk-js/releases/download/v1.0.3/alitycs-core-1.0.3.tgz\n```\n\n## Usage\n\n```ts\nimport { Alitycs } from '@alitycs/core';\n\nconst analytics = Alitycs.init({\n  apiKey: process.env.ALITYCS_API_KEY!,\n});\n\nanalytics.identify('usr_123', { plan: 'pro' });\nanalytics.track('button_clicked', { label: 'Start trial' });\nanalytics.page('Dashboard');\nanalytics.captureError('checkout_failed', { provider: 'stripe' });\n\nawait analytics.shutdown();\n```\n\n`reset()` clears the user identity and rotates both the anonymous and session IDs. Global\nproperties persist until they are explicitly removed or cleared:\n\n```ts\nanalytics.setGlobalProperties({ appVersion: '1.4.0' });\nanalytics.track('feature_used', { feature: 'ask_data' });\nanalytics.reset();\n```\n\n### Trusted revenue events\n\nRevenue ingestion is server-only. Use a secret key with `revenue:write`; never expose that key in a\nbrowser application.\n\n```ts\nanalytics.trackRevenue({\n  version: 1,\n  kind: 'transaction',\n  factId: 'order_123',\n  amount: '19.99',\n  currency: 'USD',\n});\n```\n\n## Configuration\n\n| Option           | Default                          | Description                                                                        |\n| ---------------- | -------------------------------- | ---------------------------------------------------------------------------------- |\n| `apiKey`         | required                         | Publishable key for ordinary ingest, or a secret key for trusted server operations |\n| `endpoint`       | `https://api.alitycs.com/events` | Worker ingestion endpoint                                                          |\n| `flushInterval`  | `10000`                          | Batch flush interval in milliseconds                                               |\n| `flushSize`      | `25`                             | Queue size that triggers a flush                                                   |\n| `maxQueueSize`   | `1000`                           | Maximum queued events                                                              |\n| `maxRetries`     | `3`                              | Retry attempts for retryable transport failures                                    |\n| `sessionTimeout` | `1800000`                        | Inactivity timeout in milliseconds                                                 |\n| `batching`       | `true`                           | Send queued batches or one event per request                                       |\n| `debug`          | `false`                          | Enable SDK diagnostics                                                             |\n\nRequests use `Authorization: Bearer <apiKey>` and `Content-Type: application/json`. Event payloads\nconform to [schema v0.4.0](../../specs/event-schema.json).\n\n## API surface\n\n- `track(eventName, properties?, options?)`\n- `trackRevenue(payload, properties?)`\n- `identify(userId, traits?, options?)`\n- `reset()`\n- `page(name?, properties?, options?)`\n- `captureError(errorName, properties?, options?)`\n- `setGlobalProperties`, `getGlobalProperties`, `removeGlobalProperties`, `clearGlobalProperties`\n- `flush()` and `shutdown()`\n- `pending`\n\nThe same surface is available through module-level convenience functions after `init()`.\n\n## Development\n\n```bash\nbun install --frozen-lockfile\nbun run type-check\nbun run lint\nbun run format:check\nbun test\nbun run build:all\n```\n\nThe committed test configuration enforces at least 90% line and 85% function coverage.\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","_rev":"1-846e8f13daec858ca6ed0ba6c2d1bfe6"}