{"_id":"@amlexiahq/shared","_rev":"3-b39a23983c778a108748602cf7b50732","name":"@amlexiahq/shared","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@amlexiahq/shared","version":"1.0.0","keywords":["amlexia","observability","tracing"],"license":"SEE LICENSE IN LICENSE","_id":"@amlexiahq/shared@1.0.0","maintainers":[{"name":"amlexia","email":"login@amlexia.com"}],"homepage":"https://github.com/amlexiahq/amlexia#readme","bugs":{"url":"https://github.com/amlexiahq/amlexia/issues"},"dist":{"shasum":"59b89ec53d9a0fb78a40d3b474629e91e14cc22c","tarball":"https://registry.npmjs.org/@amlexiahq/shared/-/shared-1.0.0.tgz","fileCount":29,"integrity":"sha512-T5uyj5wIW/7O+aJSeYqRLZkdoCX7IE8o7bTxz0Jz3fKygzH4tpTdnfs2J4euI4qGa5HsB4bKV+bEcrESAyeE+A==","signatures":[{"sig":"MEUCIQDvgar1Q+WOP4x6YOozBuFq8fSZfQeKpWzJjjZEohhuPwIgaDqqlkHB+bWOOrpMpihZXc6ZRXq0HvfXbx9z65IJrmw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":91598},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"4ce89bc24bfe4bcbf4369bb6f1a4d13c5828d2cc","scripts":{"build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"amlexia","email":"login@amlexia.com"},"repository":{"url":"git+https://github.com/amlexiahq/amlexia.git","type":"git","directory":"packages/shared"},"_npmVersion":"11.6.0","description":"Shared types and utilities for Amlexia SDKs","directories":{},"_nodeVersion":"24.8.0","dependencies":{"zod":"^3.24.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3"},"_npmOperationalInternal":{"tmp":"tmp/shared_1.0.0_1779180256009_0.0070742411516036","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@amlexiahq/shared","version":"1.0.1","keywords":["amlexia","observability","tracing","sdk"],"author":{"name":"Amlexia","email":"support@amlexia.com"},"license":"SEE LICENSE IN LICENSE","_id":"@amlexiahq/shared@1.0.1","maintainers":[{"name":"amlexia","email":"login@amlexia.com"}],"homepage":"https://amlexia.com","bugs":{"url":"https://amlexia.com/contact","email":"support@amlexia.com"},"dist":{"shasum":"5ae9b688ab6d1ea841b02f4d3ac49554301c67b2","tarball":"https://registry.npmjs.org/@amlexiahq/shared/-/shared-1.0.1.tgz","fileCount":30,"integrity":"sha512-bPLYXC1d017vAk39p6S3cs5YAR+BpsvFuBDrDmU9bspVjIDUurFbcZfLhYscPV05Z7dJKvHNwKugfxSv8oFeGw==","signatures":[{"sig":"MEYCIQCQjweqeEv9j4nqXzPJDOND5i+E1S2yK94DTL4m5TdYwQIhAOKXXwZIsYgu0E5vnm6jNaFF1BW4/eBH8CTyhCULFcXk","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":92272},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"4ce89bc24bfe4bcbf4369bb6f1a4d13c5828d2cc","scripts":{"build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"amlexia","email":"login@amlexia.com"},"repository":{"url":"git+https://github.com/amlexiahq/amlexia.git","type":"git","directory":"packages/shared"},"_npmVersion":"11.6.0","description":"Shared Amlexia types and utilities for SDKs — trace IDs, provider detection, schemas, and PII helpers.","directories":{},"_nodeVersion":"24.8.0","dependencies":{"zod":"^3.24.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3"},"_npmOperationalInternal":{"tmp":"tmp/shared_1.0.1_1779181434537_0.04532039056891235","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@amlexiahq/shared","version":"1.0.2","description":"Shared Amlexia types and utilities for SDKs — trace IDs, provider detection, schemas, and PII helpers.","author":{"name":"Amlexia","email":"support@amlexia.com"},"maintainers":[{"name":"amlexia","email":"login@amlexia.com"}],"homepage":"https://amlexia.com","bugs":{"url":"https://amlexia.com/contact","email":"support@amlexia.com"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/amlexiahq/amlexia.git","directory":"packages/shared"},"keywords":["amlexia","observability","tracing","sdk"],"license":"SEE LICENSE IN LICENSE","scripts":{"build":"tsc","typecheck":"tsc --noEmit"},"dependencies":{"zod":"^3.24.4"},"devDependencies":{"typescript":"^5.8.3"},"_id":"@amlexiahq/shared@1.0.2","gitHead":"4ce89bc24bfe4bcbf4369bb6f1a4d13c5828d2cc","_nodeVersion":"24.8.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-uKLW7TdMCiu+NGEXGX9PvU3DoKTC/EuBjdCnUDILrvqUXGz0POUjnnYZGmKZTYO1gwRj9EW3m7IG+35snW/49w==","shasum":"d74845a979ebf88c51cd8546332bc76238215626","tarball":"https://registry.npmjs.org/@amlexiahq/shared/-/shared-1.0.2.tgz","fileCount":48,"unpackedSize":117718,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDavPKreDBkkR6bwfH6dCBGcjEmtIScyAwpjrEuEs5wiwIhAJ4iLOeSfhbRXMNQC7pLJqkL63Df2KDv003fuqE7sbr0"}]},"_npmUser":{"name":"amlexia","email":"login@amlexia.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/shared_1.0.2_1779229967058_0.664104725316109"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-19T08:44:15.905Z","modified":"2026-05-19T22:32:47.454Z","1.0.0":"2026-05-19T08:44:16.161Z","1.0.1":"2026-05-19T09:03:54.674Z","1.0.2":"2026-05-19T22:32:47.310Z"},"bugs":{"url":"https://amlexia.com/contact","email":"support@amlexia.com"},"author":{"name":"Amlexia","email":"support@amlexia.com"},"license":"SEE LICENSE IN LICENSE","homepage":"https://amlexia.com","keywords":["amlexia","observability","tracing","sdk"],"repository":{"type":"git","url":"git+https://github.com/amlexiahq/amlexia.git","directory":"packages/shared"},"description":"Shared Amlexia types and utilities for SDKs — trace IDs, provider detection, schemas, and PII helpers.","maintainers":[{"name":"amlexia","email":"login@amlexia.com"}],"readme":"# @amlexiahq/shared\r\n\r\nShared utilities for Amlexia **Node.js** tooling and `@amlexiahq/node`. Most users should install **`@amlexiahq/node`** only; this package is published as a dependency.\r\n\r\n```bash\r\nnpm install @amlexiahq/shared\r\n```\r\n\r\n**License:** Proprietary — not open source. See [LICENSE](./LICENSE).  \r\n**Support:** support@amlexia.com\r\n\r\n---\r\n\r\n## When to use this package\r\n\r\n| Use case | Package |\r\n|----------|---------|\r\n| Monitor your Node API | `@amlexiahq/node` |\r\n| Custom tooling that needs trace IDs or provider detection | `@amlexiahq/shared` |\r\n| Python apps | `amlexia` on PyPI (has built-in detection) |\r\n\r\n---\r\n\r\n## Exports\r\n\r\n### Trace identifiers\r\n\r\n```typescript\r\nimport { newTraceId, newSpanId } from '@amlexiahq/shared';\r\n\r\nconst traceId = newTraceId(); // 32 hex chars\r\nconst spanId = newSpanId();   // 16 hex chars\r\n```\r\n\r\nUsed internally by `@amlexiahq/node/tracing`.\r\n\r\n### Provider detection\r\n\r\n```typescript\r\nimport { detectProviderFromHints } from '@amlexiahq/shared';\r\n\r\nconst detected = detectProviderFromHints({\r\n  endpoint: 'POST /v1/chat/completions',\r\n  host: 'api.openai.com',\r\n  metadata: { model: 'gpt-4o' },\r\n});\r\n\r\n// { name: 'openai', category: 'ai', modelName?: string }\r\n```\r\n\r\n### PII scrubbing\r\n\r\n```typescript\r\nimport { scrubMetadata, scrubString } from '@amlexiahq/shared';\r\n\r\nconst safe = scrubMetadata(\r\n  { email: 'user@example.com', note: 'ok' },\r\n  { piiMaskingEnabled: true, maxMetadataBytes: 8192 },\r\n);\r\n```\r\n\r\n| Option | Default | Description |\r\n|--------|---------|-------------|\r\n| `piiMaskingEnabled` | `true` | Mask emails/phones in strings |\r\n| `maxMetadataBytes` | `8192` | Truncate large metadata JSON |\r\n| `maxStringLength` | `2048` | Per-string cap |\r\n| `additionalPatterns` | `[]` | Extra regexes to redact |\r\n\r\nRedacts sensitive header names and field names matching `password`, `token`, `api_key`, etc.\r\n\r\n### Schemas and types\r\n\r\nZod schemas and TypeScript types for ingest payloads (used by workers and advanced integrations).\r\n\r\n### OpenTelemetry parser\r\n\r\nUtilities to parse OTEL-shaped payloads (`otel/parser` export).\r\n\r\n### Analytics store\r\n\r\n`D1AnalyticsStore` — server-side analytics implementation for the Amlexia platform (not needed in customer apps).\r\n\r\n---\r\n\r\n## Environment variables\r\n\r\nThis package does not read environment variables directly. Use `@amlexiahq/node` or see [ENVIRONMENT_VARIABLES.md](../../docs/ENVIRONMENT_VARIABLES.md).\r\n\r\n---\r\n\r\n## Links\r\n\r\n- [Node.js SDK](../../sdks/node/README.md)\r\n- [Event fields](../../docs/EVENT_FIELDS.md)\r\n","readmeFilename":"README.md"}