{"_id":"@empa-electronics/tiremo-sdk-client-js","_rev":"5-e1c0cbf263b4a24a4cc6126e9dfabde0","name":"@empa-electronics/tiremo-sdk-client-js","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.0":{"name":"@empa-electronics/tiremo-sdk-client-js","version":"0.1.0","license":"ISC","_id":"@empa-electronics/tiremo-sdk-client-js@0.1.0","maintainers":[{"name":"teknoloji","email":"teknoloji@empa.com"}],"homepage":"https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT#readme","bugs":{"url":"https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT/issues"},"dist":{"shasum":"1c7b67ade592b57e4a1c1d5ee109cfa041946eb8","tarball":"https://registry.npmjs.org/@empa-electronics/tiremo-sdk-client-js/-/tiremo-sdk-client-js-0.1.0.tgz","fileCount":10,"integrity":"sha512-IydSSnDAZu3C/xZmdyEXhZq8wuc4roAgmLpapCjXOIKDp/Mchh95ZMMXvQrxlCnA+eRYIEXWaqWfXiXr6GsOSQ==","signatures":[{"sig":"MEUCIFWy9BN5BsT36CQCFAIIRKekC4Zqzb/oRzMwWZHbpM1UAiEArARJXbBjC3e3GYbNY9dDA6q5kuIAe467cqRfUaDYNxo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19572},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"c89fda84a4bd3da9b9721fa86cb4ed1ff040561f","scripts":{"lint":"eslint ./src","build":"tsc -p tsconfig.json","clean":"rm -rf dist","lint:fix":"eslint --fix ./src","check:build":"tsc -p tsconfig.json --noEmit","new-version":"npm version patch && git push && git push --tags"},"_npmUser":{"name":"teknoloji","email":"teknoloji@empa.com"},"repository":{"url":"git+https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT.git","type":"git","directory":"packages/client-js"},"_npmVersion":"10.9.0","description":"Browser JavaScript client for the TIREMO SDK REST and live WebSocket APIs","directories":{},"_nodeVersion":"22.12.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.35.0","@eslint/js":"^9.35.0","typescript":"^5.9.2","typescript-eslint":"^8.42.0"},"_npmOperationalInternal":{"tmp":"tmp/tiremo-sdk-client-js_0.1.0_1779584487396_0.10042104036246235","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@empa-electronics/tiremo-sdk-client-js","version":"0.1.2","keywords":["tiremo","iot","websocket","telemetry","sdk","live-data"],"license":"ISC","_id":"@empa-electronics/tiremo-sdk-client-js@0.1.2","maintainers":[{"name":"teknoloji","email":"teknoloji@empa.com"}],"homepage":"https://docs.tiremo.ai/developer-guide/sdk-live-data","bugs":{"url":"https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT/issues"},"dist":{"shasum":"ca694fc5597bde9e4bd6f164c1c4c9b468a640bf","tarball":"https://registry.npmjs.org/@empa-electronics/tiremo-sdk-client-js/-/tiremo-sdk-client-js-0.1.2.tgz","fileCount":10,"integrity":"sha512-EiTRu7Li8+OUptOhVHycga1r2ZgV2OpSpJwl2gVkLS9wQzaJYSb/5M3aX/crym8gspksH3Y2u5o/MdvVnk33Og==","signatures":[{"sig":"MEQCIG6QihBCBJvIUXPPNSJm537MRYr0tU2jafYIkjqimyf9AiB5k/NgIcFwO1/AvFZJwqwJSZmJ5ldPzhPTjSsPsUOcDw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22876},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"955e07513b39a914ea55c02bb9adad302d9df7fc","scripts":{"lint":"eslint ./src","build":"tsc -p tsconfig.json","clean":"rm -rf dist","lint:fix":"eslint --fix ./src","check:build":"tsc -p tsconfig.json --noEmit","new-version":"npm version patch && git push && git push --tags"},"_npmUser":{"name":"teknoloji","email":"teknoloji@empa.com"},"repository":{"url":"git+https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT.git","type":"git","directory":"packages/client-js"},"_npmVersion":"10.9.0","description":"Browser JavaScript client for the TIREMO SDK REST and live WebSocket APIs","directories":{},"_nodeVersion":"22.12.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.35.0","@eslint/js":"^9.35.0","typescript":"^5.9.2","typescript-eslint":"^8.42.0"},"_npmOperationalInternal":{"tmp":"tmp/tiremo-sdk-client-js_0.1.2_1779585109522_0.18507925827868732","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@empa-electronics/tiremo-sdk-client-js","version":"0.1.3","keywords":["tiremo","iot","websocket","telemetry","sdk","live-data"],"license":"ISC","_id":"@empa-electronics/tiremo-sdk-client-js@0.1.3","maintainers":[{"name":"teknoloji","email":"teknoloji@empa.com"}],"homepage":"https://docs.tiremo.ai/developer-guide/sdk-live-data","bugs":{"url":"https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT/issues"},"dist":{"shasum":"af7ee7c4ffa198d11f62a76da424862c19ac8daf","tarball":"https://registry.npmjs.org/@empa-electronics/tiremo-sdk-client-js/-/tiremo-sdk-client-js-0.1.3.tgz","fileCount":10,"integrity":"sha512-jbIcwjpsbSdeaVd6XAK64L6CHzJzKGdtNk2nzAx/C3O12LDzAWoidjzXr1NMO22Vwcb9+PzYAvoKGcw/x+4Abg==","signatures":[{"sig":"MEYCIQCa2rpU04L1ShaVakYmlcl0fkRpO3uKMkzF7d4oh1PIzAIhALbM9eAl/M9eXvPoXzaRYUOf9Mz030+OhZ4Ee6rmhT/Y","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22876},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"955e07513b39a914ea55c02bb9adad302d9df7fc","scripts":{"lint":"eslint ./src","build":"tsc -p tsconfig.json","clean":"rm -rf dist","lint:fix":"eslint --fix ./src","check:build":"tsc -p tsconfig.json --noEmit","new-version":"npm version patch && git push && git push --tags"},"_npmUser":{"name":"teknoloji","email":"teknoloji@empa.com"},"repository":{"url":"git+https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT.git","type":"git","directory":"packages/client-js"},"_npmVersion":"10.9.0","description":"Browser JavaScript client for the TIREMO SDK REST and live WebSocket APIs","directories":{},"_nodeVersion":"22.12.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.35.0","@eslint/js":"^9.35.0","typescript":"^5.9.2","typescript-eslint":"^8.42.0"},"_npmOperationalInternal":{"tmp":"tmp/tiremo-sdk-client-js_0.1.3_1780174455553_0.05941533786602626","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@empa-electronics/tiremo-sdk-client-js","version":"0.1.5","keywords":["tiremo","iot","websocket","telemetry","sdk","live-data"],"license":"ISC","_id":"@empa-electronics/tiremo-sdk-client-js@0.1.5","maintainers":[{"name":"teknoloji","email":"teknoloji@empa.com"}],"homepage":"https://docs.tiremo.ai/developer-guide/sdk-live-data","bugs":{"url":"https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT/issues"},"dist":{"shasum":"05f7722e310083a1cc1ea1767bc3b0631c21c795","tarball":"https://registry.npmjs.org/@empa-electronics/tiremo-sdk-client-js/-/tiremo-sdk-client-js-0.1.5.tgz","fileCount":10,"integrity":"sha512-XaBMVBsq4Bt4FI4Y6M92FyS7S8JGnPAQol5eHWnVtu673/sMOjvEmfkxFP5/0h8SfcfDLeNW2iP6wYcQvEYpNw==","signatures":[{"sig":"MEUCIFwFVmJUrCvfGEyRKWqBZwM8bP6v2o7ppBXKxT5fwWqPAiEArrFS4w1ox+yp9W/hFSv1KwZwnzc/n/jJSP33mcV2Mic=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23121},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"955e07513b39a914ea55c02bb9adad302d9df7fc","scripts":{"lint":"eslint ./src","build":"tsc -p tsconfig.json","clean":"rm -rf dist","lint:fix":"eslint --fix ./src","check:build":"tsc -p tsconfig.json --noEmit","release:publish":"npm run lint && npm run build && npm version patch && npm publish --access public"},"_npmUser":{"name":"teknoloji","email":"teknoloji@empa.com"},"repository":{"url":"git+https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT.git","type":"git","directory":"client-js"},"_npmVersion":"10.9.0","description":"Browser JavaScript client for the TIREMO SDK REST and live WebSocket APIs","directories":{},"_nodeVersion":"22.12.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.35.0","@eslint/js":"^9.35.0","typescript":"^5.9.2","typescript-eslint":"^8.42.0"},"_npmOperationalInternal":{"tmp":"tmp/tiremo-sdk-client-js_0.1.5_1780175773170_0.6576542172196942","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@empa-electronics/tiremo-sdk-client-js","version":"0.1.6","description":"Browser JavaScript client for the TIREMO SDK REST and live WebSocket APIs","homepage":"https://docs.tiremo.ai/developer-guide/sdk-live-data","bugs":{"url":"https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT/issues"},"keywords":["tiremo","iot","websocket","telemetry","sdk","live-data"],"type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"repository":{"type":"git","url":"git+https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT.git","directory":"client-js"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist","check:build":"tsc -p tsconfig.json --noEmit","lint":"eslint ./src","lint:fix":"eslint --fix ./src","release:publish":"npm run lint && npm run build && npm version patch && npm publish --access public"},"license":"ISC","devDependencies":{"@eslint/js":"^9.35.0","eslint":"^9.35.0","typescript":"^5.9.2","typescript-eslint":"^8.42.0"},"_id":"@empa-electronics/tiremo-sdk-client-js@0.1.6","gitHead":"955e07513b39a914ea55c02bb9adad302d9df7fc","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-VlXKqBxTFRoXn5r4hT7pjZuX6ipV6Hpd9MoMqGx2t79kRrRbxQxcIsyO6+01H8usi27jMOvQQAHgjSZ697u6rw==","shasum":"a48aff991bf6f1c3272d5112ac5162d2722da91d","tarball":"https://registry.npmjs.org/@empa-electronics/tiremo-sdk-client-js/-/tiremo-sdk-client-js-0.1.6.tgz","fileCount":10,"unpackedSize":24899,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCW3JpPItlmrecVygv31a8M7wK2DzM+gB0HbILYBWGoIQIhAPEi8k542mqCB3RZqlbd36QlKvDXdMM1L9jhlmWqTv7b"}]},"_npmUser":{"name":"teknoloji","email":"teknoloji@empa.com"},"directories":{},"maintainers":[{"name":"teknoloji","email":"teknoloji@empa.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tiremo-sdk-client-js_0.1.6_1780176655579_0.6388361540674945"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-24T01:01:27.279Z","modified":"2026-05-30T21:30:55.864Z","0.1.0":"2026-05-24T01:01:27.539Z","0.1.2":"2026-05-24T01:11:49.671Z","0.1.3":"2026-05-30T20:54:15.693Z","0.1.5":"2026-05-30T21:16:13.302Z","0.1.6":"2026-05-30T21:30:55.744Z"},"bugs":{"url":"https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT/issues"},"license":"ISC","homepage":"https://docs.tiremo.ai/developer-guide/sdk-live-data","keywords":["tiremo","iot","websocket","telemetry","sdk","live-data"],"repository":{"type":"git","url":"git+https://github.com/Empa-Electronics/TIREMO-SDK-CLIENT.git","directory":"client-js"},"description":"Browser JavaScript client for the TIREMO SDK REST and live WebSocket APIs","maintainers":[{"name":"teknoloji","email":"teknoloji@empa.com"}],"readme":"# @empa-electronics/tiremo-sdk-client-js\n\nBrowser / bundler client for the [TIREMO SDK](https://github.com/Empa-Electronics/TIREMO-SDK). Uses native `fetch` and `WebSocket` with no runtime dependencies.\n\nWorks with React, Vue, Svelte, Vite, or plain ES modules.\n\n## Documentation\n\n| Topic | Link |\n| --- | --- |\n| SDK Live Data | [docs.tiremo.ai/developer-guide/sdk-live-data](https://docs.tiremo.ai/developer-guide/sdk-live-data) |\n| API Key Security | [docs.tiremo.ai/developer-guide/sdk-api-key-security](https://docs.tiremo.ai/developer-guide/sdk-api-key-security) |\n| HTML examples | [TIREMO-SDK/examples](https://github.com/Empa-Electronics/TIREMO-SDK/tree/main/examples) |\n\n## Getting started\n\n### 1. Install\n\n```bash\nnpm install @empa-electronics/tiremo-sdk-client-js\n```\n\n### 2. Get an API key\n\nCreate a product-scoped API key in the Tiremo Platform **Administration → API Credentials** UI.\n\nFor browser apps use a **public** key with origin restrictions. Public keys cannot open WebSocket connections directly — mint a short-lived token on your backend first.\n\n### 3. Create a client\n\n```typescript\nimport { TiremoClient } from \"@empa-electronics/tiremo-sdk-client-js\";\n\nconst client = new TiremoClient({\n  baseUrl: \"https://sdk.tiremo.ai\",\n  apiKey: process.env.TIREMO_API_KEY!,\n});\n```\n\n`baseUrl` is your SDK host without a trailing slash. `apiKey` is sent as the `X-API-Key` header on REST calls.\n\n### 4. Typical browser flow\n\n1. Load the latest stored telemetry over REST (bootstrap gauges/charts).\n2. On your **backend**, call `createToken()` with a secret key.\n3. Pass the token to the browser and connect with `connectWithToken()`.\n4. Subscribe to live channels after the `connected` event.\n\n## Usage examples\n\n### `TiremoClient` — REST\n\n#### `devices.getTelemetryLatest(deviceIdentifier, options?)`\n\nFetch the most recent stored telemetry point for a device.\n\n```typescript\nconst latest = await client.devices.getTelemetryLatest(\"cameradevice9\", {\n  keys: [\"temperature\", \"humidity\"],\n});\n\nconsole.log(latest.timestamp);\nconsole.log(latest.data.temperature);\n// { deviceIdentifier, timestamp, data: { temperature: 21.4, ... } }\n```\n\nOmit `keys` to receive all keys for the latest point.\n\n#### `live.createToken()`\n\nExchange your API key for a short-lived WebSocket token. Call this from a **server** route, not from browser code with a secret key.\n\n```typescript\nconst { token, expiresAt } = await client.live.createToken();\n// Pass `token` to the browser (e.g. JSON API response)\n```\n\n#### `live.connectWithToken(token)`\n\nCreate a live client authenticated with a short-lived token (browser-safe).\n\n```typescript\nconst live = client.live.connectWithToken(token);\n```\n\n#### `live.connectWithSecretKey()`\n\nConnect with the secret API key directly. **Do not use in browser code** — only for trusted server-side scripts.\n\n```typescript\nconst live = client.live.connectWithSecretKey();\n```\n\n### `TiremoLiveClient` — WebSocket\n\n#### `connect()` / `disconnect()`\n\n```typescript\nlive.connect();\n// ...\nlive.disconnect();\n```\n\n#### `on(event, handler)`\n\nRegister event handlers. Returns an unsubscribe function.\n\n```typescript\nconst off = live.on(\"telemetry\", (event) => {\n  console.log(event.subscriptionId, event.data);\n});\n\noff(); // remove handler\n```\n\nEvents: `connected`, `telemetry`, `presence`, `alarm`, `error`, `message`.\n\n```typescript\nlive.on(\"connected\", (event) => {\n  console.log(event.productIdentifier, event.protocolVersion);\n});\n\nlive.on(\"presence\", (event) => {\n  console.log(event.deviceIdentifier, event.isOnline);\n});\n\nlive.on(\"alarm\", (event) => {\n  console.log(event.alarmType, event.severity, event.code);\n});\n\nlive.on(\"error\", (event) => {\n  console.error(event.code, event.message);\n});\n```\n\n#### `subscribeTelemetry({ id, deviceIdentifier, keys? })`\n\n```typescript\nlive.on(\"connected\", () => {\n  live.subscribeTelemetry({\n    id: \"temp-sub\",\n    deviceIdentifier: \"cameradevice9\",\n    keys: [\"temperature\"],\n  });\n});\n```\n\n#### `subscribePresence({ id, deviceIdentifier })`\n\n```typescript\nlive.subscribePresence({\n  id: \"presence-sub\",\n  deviceIdentifier: \"cameradevice9\",\n});\n```\n\n#### `subscribeAlarm({ id, deviceIdentifier })`\n\n```typescript\nlive.subscribeAlarm({\n  id: \"alarm-sub\",\n  deviceIdentifier: \"cameradevice9\",\n});\n```\n\n#### `unsubscribe(subscriptionId)`\n\n```typescript\nlive.unsubscribe(\"temp-sub\");\n```\n\nPing/pong heartbeats are handled automatically.\n\n## Full example\n\n```typescript\nimport { TiremoClient } from \"@empa-electronics/tiremo-sdk-client-js\";\n\nconst client = new TiremoClient({\n  baseUrl: \"https://sdk.tiremo.ai\",\n  apiKey: process.env.TIREMO_API_KEY!,\n});\n\nconst latest = await client.devices.getTelemetryLatest(\"cameradevice9\", {\n  keys: [\"temperature\"],\n});\n\nconst { token } = await client.live.createToken();\nconst live = client.live.connectWithToken(token);\n\nlive.on(\"connected\", () => {\n  live.subscribeTelemetry({\n    id: \"temp\",\n    deviceIdentifier: \"cameradevice9\",\n    keys: [\"temperature\"],\n  });\n});\n\nlive.on(\"telemetry\", (event) => {\n  console.log(latest.data, \"→\", event.data);\n});\n\nlive.connect();\n```\n\n## Related packages\n\n| Package | Use case |\n| --- | --- |\n| [`@empa-electronics/tiremo-sdk-client-node`](https://www.npmjs.com/package/@empa-electronics/tiremo-sdk-client-node) | Node.js 18+ |\n| [`tiremo-sdk-client`](https://pypi.org/project/tiremo-sdk-client/) | Python |\n\n## License\n\nISC — [Empa Electronics](https://github.com/Empa-Electronics)\n","readmeFilename":"README.md"}