{"_id":"@dhruvknowstocode/switchboard-sdk","_rev":"2-dcf164817d2fa12db0583779ecb1db88","name":"@dhruvknowstocode/switchboard-sdk","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@dhruvknowstocode/switchboard-sdk","version":"0.1.0","keywords":["feature-flags","feature-toggles","switchboard","rollouts","sdk","typescript"],"author":{"name":"dhruvknowstocode"},"license":"MIT","_id":"@dhruvknowstocode/switchboard-sdk@0.1.0","maintainers":[{"name":"dhruvknowstocode","email":"dhruvjain2424@gmail.com"}],"homepage":"https://github.com/dhruvknowstocode/switchboard#readme","bugs":{"url":"https://github.com/dhruvknowstocode/switchboard/issues"},"dist":{"shasum":"4c7571faea32684107ed8fbefb6da0f519c38e2d","tarball":"https://registry.npmjs.org/@dhruvknowstocode/switchboard-sdk/-/switchboard-sdk-0.1.0.tgz","fileCount":9,"integrity":"sha512-jqf93u8ZQYYgkpvzrmJsj9GGY05ScLcIoRea6ramwhPGJMdPlyd777/jY1tCvjdbcFQKgDAs62bfCvWjyMbwXg==","signatures":[{"sig":"MEUCIAIu1MokKK+WNBkkKxpjf+gihf7Mp9K3+AfR9sWeFDnJAiEA5untRduw2Wvw+zD3p4LIgVblL9CjveST47yKHjYzjVw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9776},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"63fced2c709f3f3ee1b8afe582ce3efdf0a3acfd","scripts":{"dev":"tsc -p tsconfig.json --watch","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"dhruvknowstocode","email":"dhruvjain2424@gmail.com"},"repository":{"url":"git+https://github.com/dhruvknowstocode/switchboard.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.9.8","description":"Client SDK for SWITCHBOARD feature flag evaluation","directories":{},"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.2"},"_npmOperationalInternal":{"tmp":"tmp/switchboard-sdk_0.1.0_1786697727002_0.9349224129077267","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@dhruvknowstocode/switchboard-sdk","version":"0.1.1","description":"Client SDK for SWITCHBOARD feature flag evaluation","license":"MIT","author":{"name":"dhruvknowstocode"},"repository":{"type":"git","url":"git+https://github.com/dhruvknowstocode/switchboard.git","directory":"packages/sdk"},"homepage":"https://github.com/dhruvknowstocode/switchboard#readme","bugs":{"url":"https://github.com/dhruvknowstocode/switchboard/issues"},"keywords":["feature-flags","feature-toggles","switchboard","rollouts","sdk","typescript"],"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","dev":"tsc -p tsconfig.json --watch","typecheck":"tsc -p tsconfig.json --noEmit","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"engines":{"node":">=18"},"devDependencies":{"typescript":"^5.8.2"},"_id":"@dhruvknowstocode/switchboard-sdk@0.1.1","gitHead":"63fced2c709f3f3ee1b8afe582ce3efdf0a3acfd","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-YwMBwvKCrUqeFPQMkmYDqHUF1nA1l0pR5eFt0+lxQrb219jDavOFLL7YbtYOfuddc+GroFLlTc4itKs9T/Nffg==","shasum":"33f314b257d41ef9d8f0e8d487a9dad20f2949f6","tarball":"https://registry.npmjs.org/@dhruvknowstocode/switchboard-sdk/-/switchboard-sdk-0.1.1.tgz","fileCount":9,"unpackedSize":9884,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC5HgemhCCPlCZzOUKLxIuvdyein/PbqvJ9bj/JJW7zhAIgBvOf3fxwP1ged+NjQnRfWDnT4i1WL1vc+olLTcn8lPY="}]},"_npmUser":{"name":"dhruvknowstocode","email":"dhruvjain2424@gmail.com"},"directories":{},"maintainers":[{"name":"dhruvknowstocode","email":"dhruvjain2424@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/switchboard-sdk_0.1.1_1786869973361_0.4863252775888198"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-14T08:55:26.860Z","modified":"2026-08-16T08:46:13.653Z","0.1.0":"2026-08-14T08:55:27.160Z","0.1.1":"2026-08-16T08:46:13.490Z"},"bugs":{"url":"https://github.com/dhruvknowstocode/switchboard/issues"},"author":{"name":"dhruvknowstocode"},"license":"MIT","homepage":"https://github.com/dhruvknowstocode/switchboard#readme","keywords":["feature-flags","feature-toggles","switchboard","rollouts","sdk","typescript"],"repository":{"type":"git","url":"git+https://github.com/dhruvknowstocode/switchboard.git","directory":"packages/sdk"},"description":"Client SDK for SWITCHBOARD feature flag evaluation","maintainers":[{"name":"dhruvknowstocode","email":"dhruvjain2424@gmail.com"}],"readme":"# @dhruvknowstocode/switchboard-sdk\n\nClient SDK for **[SWITCHBOARD](https://github.com/dhruvknowstocode/switchboard)** — evaluate feature flags from any app.\n\nApps call your Switchboard API with an API key (not operator JWTs). Operators change rollouts / kill switches in the control plane; this SDK reads the evaluate endpoint.\n\n## Install\n\n```bash\nnpm install @dhruvknowstocode/switchboard-sdk\n```\n\n## Quick start\n\n```ts\nimport { SwitchboardClient } from '@dhruvknowstocode/switchboard-sdk';\n\nconst client = new SwitchboardClient({\n  apiUrl: 'https://switchboard-api-dga7.onrender.com', // host only — no /api/v1 suffix\n  apiKey: 'sb_live_…', // from Switchboard → Settings\n  environment: 'production',\n  cacheTtlMs: 5000, // optional, default 5000\n});\n\nconst on = await client.isEnabled('checkout-v2', {\n  userId: 'user-123',\n  region: 'US',\n});\n\nconst full = await client.evaluate('checkout-v2', {\n  userId: 'user-123',\n  region: 'US',\n});\n// full.enabled, full.variant, full.reason\n```\n\n## API\n\n| Method | Description |\n|--------|-------------|\n| `isEnabled(flagKey, context)` | `boolean` for the user/context |\n| `evaluate(flagKey, context)` | Full result (`enabled`, `variant`, `reason`) |\n| `clearCache()` | Drop in-memory evaluation cache |\n\n**Context:** `{ userId: string, region?: string, attributes?: Record<string, string> }`\n\n**Reasons:** `FLAG_DISABLED` · `KILLED` · `TARGETING` · `ROLLOUT` · `DEFAULT_OFF` · `NOT_FOUND`\n\n## Setup on Switchboard\n\n1. Create the flag in the dashboard (e.g. `doctor-chat-support`)\n2. Create an API key (Settings) — prefix `sb_live_…`\n3. Point `apiUrl` at your API host — production: `https://switchboard-api-dga7.onrender.com` (local: `http://localhost:4000`)\n4. Match `environment` to a Switchboard environment key (`development`, `production`, …)\n\n## Security note\n\nPrefer evaluating from your **server** (Next.js route / backend) so the API key is not exposed in the browser. Client-side use is fine for demos.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}