{"_id":"@bara-agency/sisu","_rev":"2-eabed3af7d2ce1a2f51ee83f3298fd8c","name":"@bara-agency/sisu","dist-tags":{"latest":"0.3.0"},"versions":{"0.2.0":{"name":"@bara-agency/sisu","version":"0.2.0","keywords":["sisu","sdk","api","typescript"],"license":"UNLICENSED","_id":"@bara-agency/sisu@0.2.0","maintainers":[{"name":"nikomart","email":"niko.martell3@gmail.com"}],"homepage":"https://github.com/baraagency/bara-sisu#readme","bugs":{"url":"https://github.com/baraagency/bara-sisu/issues"},"dist":{"shasum":"14f271bbf1b441b5bbb687c51f2255c9327887cc","tarball":"https://registry.npmjs.org/@bara-agency/sisu/-/sisu-0.2.0.tgz","fileCount":19,"integrity":"sha512-E6lfXAv2gfv6ndYGRdgkM/IcwBBtQD+k1XRErZ3Vs61UQFV+hcuDhBdDUTqrntFjTGxc8GDAHaexr4mVAyvQmQ==","signatures":[{"sig":"MEYCIQCTpZp09/1lZDJwyKIHoMYr/7BBR5Q3ZG+++bez8dGcFQIhAK6DkwOsp0sYB8DFCMhAN1DT37XHflos0KLzMFcA5hxz","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12496449},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./v3":{"types":"./dist/v3.d.ts","import":"./dist/v3.js","require":"./dist/v3.cjs"}},"gitHead":"71aeb989ffd0cdb41240cbcb0810a2f3b30b4ef2","private":false,"scripts":{"lint":"eslint .","test":"vitest run","build":"tsup src/index.ts src/v3.ts --format esm,cjs --dts --sourcemap --clean","check":"tsc --noEmit","generate":"tsx scripts/generate-client.ts","auth:docs":"node scripts/save-docs-auth.mjs","test:live":"SISU_RUN_LIVE_TESTS=1 vitest run test/live.test.ts","test:types":"tsc --noEmit -p tsconfig.type-tests.json","generate:v3":"tsx scripts/generate-client-v3.ts","extract:docs":"node scripts/extract-docs.mjs","test:live:v3":"SISU_RUN_LIVE_V3_TESTS=1 vitest run test/live-v3.test.ts","test:types:v3":"tsc --noEmit -p tsconfig.type-tests-v3.json","extract:docs:v3":"node scripts/extract-docs-v3.mjs"},"_npmUser":{"name":"nikomart","email":"niko.martell3@gmail.com"},"repository":{"url":"git+https://github.com/baraagency/bara-sisu.git","type":"git"},"_npmVersion":"10.8.2","description":"Server-side TypeScript SDK for the SISU API.","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.4","tsup":"^8.4.0","eslint":"^9.27.0","vitest":"^3.1.4","@eslint/js":"^9.27.0","playwright":"^1.52.0","typescript":"^5.8.3","@types/node":"^22.15.21","typescript-eslint":"^8.32.1"},"_npmOperationalInternal":{"tmp":"tmp/sisu_0.2.0_1785358619497_0.47796825404893406","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@bara-agency/sisu","version":"0.3.0","description":"Server-side TypeScript SDK for the SISU API.","license":"UNLICENSED","private":false,"type":"module","repository":{"type":"git","url":"git+https://github.com/baraagency/bara-sisu.git"},"publishConfig":{"registry":"https://registry.npmjs.org","access":"public"},"engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./v3":{"types":"./dist/v3.d.ts","import":"./dist/v3.js","require":"./dist/v3.cjs"}},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsup src/index.ts src/v3.ts --format esm,cjs --dts --sourcemap --clean","check":"tsc --noEmit","auth:docs":"node scripts/save-docs-auth.mjs","extract:docs":"node scripts/extract-docs.mjs","extract:docs:v3":"node scripts/extract-docs-v3.mjs","generate":"tsx scripts/generate-client.ts","generate:v3":"tsx scripts/generate-client-v3.ts","lint":"eslint .","test":"vitest run","test:types":"tsc --noEmit -p tsconfig.type-tests.json","test:types:v3":"tsc --noEmit -p tsconfig.type-tests-v3.json","test:live":"SISU_RUN_LIVE_TESTS=1 vitest run test/live.test.ts","test:live:v3":"SISU_RUN_LIVE_V3_TESTS=1 vitest run test/live-v3.test.ts"},"keywords":["sisu","sdk","api","typescript"],"devDependencies":{"@eslint/js":"^9.27.0","@types/node":"^22.15.21","eslint":"^9.27.0","playwright":"^1.52.0","tsup":"^8.4.0","tsx":"^4.19.4","typescript":"^5.8.3","typescript-eslint":"^8.32.1","vitest":"^3.1.4"},"gitHead":"2c63296beb0bb9d6404e9fbaaa7b8ed7757a5d8c","_id":"@bara-agency/sisu@0.3.0","bugs":{"url":"https://github.com/baraagency/bara-sisu/issues"},"homepage":"https://github.com/baraagency/bara-sisu#readme","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-RkBTzoJv3yk+qeE9wkt7gHyzRfxBaxtuU1tk2kTQDAoImNL0Ap3fNtI2tB06/6MOUHDu8LfE73s6xkrfTIiswg==","shasum":"7f0577c96935cd4e307018cc1d3c922974e76d2b","tarball":"https://registry.npmjs.org/@bara-agency/sisu/-/sisu-0.3.0.tgz","fileCount":19,"unpackedSize":13535574,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCDRl1u6ku+RA7gSbm8EaA4okinfwKuVQj3ieu1y0xjwAIhAJN85N56T8MHM6RS2uwRR6o1b1L0uShUdTkE9Uliilk6"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b0da1b67-e231-4e43-b173-7a462f50313f"}},"directories":{},"maintainers":[{"name":"nikomart","email":"niko.martell3@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sisu_0.3.0_1786409504210_0.02894201149040887"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-29T20:56:59.369Z","modified":"2026-08-11T00:51:44.640Z","0.2.0":"2026-07-29T20:56:59.673Z","0.3.0":"2026-08-11T00:51:44.473Z"},"bugs":{"url":"https://github.com/baraagency/bara-sisu/issues"},"license":"UNLICENSED","homepage":"https://github.com/baraagency/bara-sisu#readme","keywords":["sisu","sdk","api","typescript"],"repository":{"type":"git","url":"git+https://github.com/baraagency/bara-sisu.git"},"description":"Server-side TypeScript SDK for the SISU API.","maintainers":[{"name":"nikomart","email":"niko.martell3@gmail.com"}],"readme":"# @bara-agency/sisu\n\nServer-side TypeScript SDK for the SISU API.\n\n## Install\n\n```sh\nnpm install @bara-agency/sisu\n```\n\n## Usage\n\n```ts\nimport { createSisuClient } from \"@bara-agency/sisu\";\n\nconst sisu = createSisuClient({\n  auth: {\n    type: \"apiKey\",\n    apiKey: process.env.SISU_API_KEY!,\n  },\n});\n```\n\nYou can also use username/password Basic auth when needed:\n\n```ts\nimport { createSisuClient } from \"@bara-agency/sisu\";\n\nconst sisu = createSisuClient({\n  auth: {\n    type: \"basic\",\n    username: process.env.SISU_API_USERNAME!,\n    password: process.env.SISU_API_PASSWORD!,\n  },\n});\n\nconst activities = await sisu.activities.getActivities({\n  path: {\n    agent_id: 123,\n    market_id: 456,\n  },\n});\n```\n\nThe SDK is designed for server-side Node.js usage. Do not call SISU directly from browser code because authorization credentials would be exposed to users.\n\n## Request input shape\n\nPrefer explicit channels:\n\n- `path` — path template values (`/v3/contacts/{contact_id}`)\n- `query` — query-string filters and pagination\n- `body` — typed JSON or multipart field object\n- `formData` — caller-built `FormData` for uploads (wins over `body` when both are set)\n\n```ts\nawait sisuV3.contact.getContacts({\n  query: { page: 1, per_page: 25 },\n});\n\nawait sisuV3.tasks.postTask({\n  body: {\n    name: \"Follow up\",\n    client_id: 42,\n    task_type: \"task\",\n    date_type: \"absolute\",\n  },\n});\n```\n\nConvenience still supported:\n\n- On **GET**, values in `body` are merged into the query string (explicit `query` wins on key conflicts).\n- On **POST/PUT/PATCH/DELETE**, known OpenAPI query param names found in a plain-object `body` are lifted into the query string and removed from the JSON body.\n- Path params may be supplied via `path`, or (for plain-object bodies) lifted from matching `body` fields.\n- An explicit empty plain-object `body: {}` is still sent as `{}` (it is not dropped).\n- Pass uploads via `formData`; it is sent as-is and is never emptied by lifting.\n\n### Multipart uploads\n\nEndpoints marked `requestBodyContentType: \"multipart\"` accept either a plain object on `body` (auto-converted to `FormData`) or a caller-built `FormData` on `formData`:\n\n```ts\nconst form = new FormData();\nform.append(\"files\", fileBlob, \"doc.pdf\");\n\nawait sisuV3.documents.postDocuments({\n  formData: form,\n});\n```\n\nLegacy v1/v2 generated inputs use the same `path` / `query` / `body` / `formData` channels. v2 docs do not currently extract typed query params, so `query` remains the open `SisuQueryParams` bag (GET filters can still be passed via `body` and are merged into the query string).\n## SISU v3 API\n\nThe v3 API uses a separate client surface and authentication model. Every v3 request requires these headers:\n\n- `team-id`\n- `Agent-Authorization`\n\nFor v3-only usage (smaller import surface), use the dedicated subpath:\n\n```ts\nimport { createSisuV3Client } from \"@bara-agency/sisu/v3\";\n```\n\nOr import from the main package:\n\n```ts\nimport { createSisuV3Client } from \"@bara-agency/sisu\";\n\nconst sisuV3 = createSisuV3Client({\n  auth: {\n    teamId: process.env.SISU_V3_TEAM_ID!,\n    agentAuthorization: process.env.SISU_V3_AGENT_AUTHORIZATION!,\n  },\n});\n\nconst contacts = await sisuV3.contact.getContacts({\n  query: {\n    page: 1,\n    per_page: 25,\n  },\n});\n```\n\nUse `createSisuClient` for legacy v1/v2 endpoints and `createSisuV3Client` for v3 endpoints. The two clients are intentionally separate because they use different auth contracts.\n\n## Migrating to 0.3.0 (breaking)\n\nThis release is a **breaking** change from `@bara-agency/sisu@0.2.0`. Bump your dependency to `0.3.0` (do not republish or pin over `0.2.0`).\n\nIf you already consume generated v3 input types:\n\n1. Move list/filter fields from `body` to `query` for GET endpoints (e.g. `getContacts`).\n2. Expect some previously optional body/query fields to be **required** when OpenAPI marks them required; method `input` is required when any path/body/query field is required. Runtime still does not validate required fields — this is a TypeScript-only enforcement.\n3. Move caller-built uploads from `body: formData` to `formData: formData`. Plain objects for multipart endpoints still go on `body`.\n4. `SisuEndpointDefinition` now includes `queryParams` and `requestBodyContentType`.\n5. Empty plain-object bodies (`body: {}`) are sent as `{}` instead of omitting the request body.\n## Regenerating Endpoints\n\nv3 endpoints are extracted from the public SISU PWA API docs (no login required):\n\n```sh\nnpm run extract:docs:v3\nnpm run generate:v3\n```\n\nSource: [sisu-web-api.readme.io](https://sisu-web-api.readme.io/reference/v3caps)\n\nThe extractor caches the docs index at `data/sisu-v3-llms.txt` and per-endpoint markdown under `data/sisu-v3-docs-cache/`, so re-runs work offline and avoid readme.io rate limits. To refresh the remote index once limits clear:\n\n```sh\nSISU_V3_REFRESH_LLMS=1 npm run extract:docs:v3\n```\n\nLegacy v1/v2 endpoints still require a logged-in docs session on `docs.sisu.co`:\n\n```sh\nnpm run auth:docs\nSISU_DOCS_STORAGE_STATE=./storage-state.json npm run extract:docs\nnpm run generate\n```\n\n## Development\n\n```sh\nnpm install\nnpm test\nnpm run check\nnpm run build\n```\n","readmeFilename":"README.md"}