{"_id":"@bx93tn/core-sdk","_rev":"3-75be22eb28f485f7f0987c5561c82ea2","name":"@bx93tn/core-sdk","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@bx93tn/core-sdk","version":"0.1.0","keywords":["entitycore","neuroscience","brain"],"license":"MIT","_id":"@bx93tn/core-sdk@0.1.0","maintainers":[{"name":"bx93tn","email":"bx93tn@gmail.com"}],"homepage":"https://github.com/bilalesi/entity-sdk#readme","bugs":{"url":"https://github.com/bilalesi/entity-sdk/issues"},"dist":{"shasum":"43158721cf6bca565e78abbefc7c9e485e91efae","tarball":"https://registry.npmjs.org/@bx93tn/core-sdk/-/core-sdk-0.1.0.tgz","fileCount":516,"integrity":"sha512-/nT7+q6XKLJ7251b/5d+4qFarDg72X+fqZwAf/jTXPKUofBvT3KuBFqGypdjtupNntjbW2m+yCfaxNg+Midv9w==","signatures":[{"sig":"MEQCIFqUwoWaCcAfOPWBQV79w0EkSTClkCbuJlJVzqZxZvvMAiAKMyQ8V7DFpQU1TfBmz2Y7QyK21OGDFHXyKWIXl71XRQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1172581},"main":"./dist/commonjs/index.js","tshy":{"exclude":["src/test.ts"],"exports":{".":"./src/index.ts","./*":"./src/*.ts","./sdk":"./src/sdk/index.ts","./*.js":"./src/*.ts","./client":"./src/client/index.ts","./logger":"./src/client/logger.ts","./filters":"./src/filters/index.ts","./functions":"./src/functions/index.ts","./package.json":"./package.json","./models/common":"./src/models/common.ts","./models/entities":"./src/models/index.ts"}},"type":"module","_from":"file:bx93tn-core-sdk-0.1.0.tgz","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=22.14.0","pnpm":">=10.0.0"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./*":{"import":{"types":"./dist/esm/*.d.ts","default":"./dist/esm/*.js"},"require":{"types":"./dist/commonjs/*.d.ts","default":"./dist/commonjs/*.js"}},"./sdk":{"import":{"types":"./dist/esm/sdk/index.d.ts","default":"./dist/esm/sdk/index.js"},"require":{"types":"./dist/commonjs/sdk/index.d.ts","default":"./dist/commonjs/sdk/index.js"}},"./*.js":{"import":{"types":"./dist/esm/*.d.ts","default":"./dist/esm/*.js"},"require":{"types":"./dist/commonjs/*.d.ts","default":"./dist/commonjs/*.js"}},"./client":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js"}},"./logger":{"import":{"types":"./dist/esm/client/logger.d.ts","default":"./dist/esm/client/logger.js"},"require":{"types":"./dist/commonjs/client/logger.d.ts","default":"./dist/commonjs/client/logger.js"}},"./filters":{"import":{"types":"./dist/esm/filters/index.d.ts","default":"./dist/esm/filters/index.js"},"require":{"types":"./dist/commonjs/filters/index.d.ts","default":"./dist/commonjs/filters/index.js"}},"./functions":{"import":{"types":"./dist/esm/functions/index.d.ts","default":"./dist/esm/functions/index.js"},"require":{"types":"./dist/commonjs/functions/index.d.ts","default":"./dist/commonjs/functions/index.js"}},"./package.json":"./package.json","./models/common":{"import":{"types":"./dist/esm/models/common.d.ts","default":"./dist/esm/models/common.js"},"require":{"types":"./dist/commonjs/models/common.d.ts","default":"./dist/commonjs/models/common.js"}},"./models/entities":{"import":{"types":"./dist/esm/models/index.d.ts","default":"./dist/esm/models/index.js"},"require":{"types":"./dist/commonjs/models/index.d.ts","default":"./dist/commonjs/models/index.js"}}},"scripts":{"ci":"pnpm run check && pnpm run build","dev":"bun run ./src/test.ts","lint":"biome lint . --diagnostic-level=warn","build":"tshy","check":"biome check --write .","format":"biome format . --write","lint:fix":"biome lint --fix --unsafe","check-format":"biome format .","prep-release":"npx changeset","check-exports":"attw --pack  . --profile node16 --summary","local-release":"changeset version && changeset publish"},"_npmUser":{"name":"bx93tn","email":"bx93tn@gmail.com"},"_resolved":"/private/var/folders/pk/h__lwc697sb08553nxppgsmh0000gn/T/4a248b0f96ef3be54064971d6b9cbc5f/bx93tn-core-sdk-0.1.0.tgz","_integrity":"sha512-/nT7+q6XKLJ7251b/5d+4qFarDg72X+fqZwAf/jTXPKUofBvT3KuBFqGypdjtupNntjbW2m+yCfaxNg+Midv9w==","repository":{"url":"git+https://github.com/bilalesi/entity-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"SDK for entitycore API","directories":{},"nano-staged":{"*.{js,ts}":["biome check --write"],"package.json":["pnpm run check-dependency-version","biome format . --write"],"pnpm-lock.yaml":"pnpm dedupe --check"},"sideEffects":false,"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.3","tshy":"^3.0.2","lru-cache":"^11.1.0","typescript":"^5.8.3","@types/node":"^22.8.1","nano-staged":"^0.8.0","@biomejs/biome":"^1.9.4","@changesets/cli":"^2.29.2","simple-git-hooks":"^2.12.1","@arethetypeswrong/cli":"^0.17.4"},"peerDependencies":{"zod":"^3.24.3"},"simple-git-hooks":{"pre-commit":"npx nano-staged"},"_npmOperationalInternal":{"tmp":"tmp/core-sdk_0.1.0_1745323886973_0.42245363084858556","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@bx93tn/core-sdk","version":"0.2.0","keywords":["entitycore","neuroscience","brain"],"license":"MIT","_id":"@bx93tn/core-sdk@0.2.0","maintainers":[{"name":"bx93tn","email":"bx93tn@gmail.com"}],"homepage":"https://github.com/bilalesi/entity-sdk#readme","bugs":{"url":"https://github.com/bilalesi/entity-sdk/issues"},"dist":{"shasum":"45d80e34c626e228b4a3c2be7bb1f488bb2ebb82","tarball":"https://registry.npmjs.org/@bx93tn/core-sdk/-/core-sdk-0.2.0.tgz","fileCount":516,"integrity":"sha512-vQ8oWgD77Zc7NWUB457IGL7dZEy3THZ/g2Uosx1tXdRh2wQwTj8OMHxmceE4az1TWGIcqIHaVngcl+FvQELnNg==","signatures":[{"sig":"MEYCIQD7WwL+0VfzW4luaeJLggDajg/fyUAN+TTeXdPE25AyvAIhAN6c1eN/eu4sw/wXYa52D6QDykjBk1rxkvi7DXyykMsD","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1172491},"main":"./dist/commonjs/index.js","tshy":{"exclude":["src/test.ts"],"exports":{".":"./src/index.ts","./*":"./src/*.ts","./sdk":"./src/sdk/index.ts","./*.js":"./src/*.ts","./client":"./src/client/index.ts","./logger":"./src/client/logger.ts","./filters":"./src/filters/index.ts","./functions":"./src/functions/index.ts","./package.json":"./package.json","./models/common":"./src/models/common.ts","./models/entities":"./src/models/index.ts"}},"type":"module","_from":"file:bx93tn-core-sdk-0.2.0.tgz","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=22.14.0","pnpm":">=10.0.0"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./*":{"import":{"types":"./dist/esm/*.d.ts","default":"./dist/esm/*.js"},"require":{"types":"./dist/commonjs/*.d.ts","default":"./dist/commonjs/*.js"}},"./sdk":{"import":{"types":"./dist/esm/sdk/index.d.ts","default":"./dist/esm/sdk/index.js"},"require":{"types":"./dist/commonjs/sdk/index.d.ts","default":"./dist/commonjs/sdk/index.js"}},"./*.js":{"import":{"types":"./dist/esm/*.d.ts","default":"./dist/esm/*.js"},"require":{"types":"./dist/commonjs/*.d.ts","default":"./dist/commonjs/*.js"}},"./client":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js"}},"./logger":{"import":{"types":"./dist/esm/client/logger.d.ts","default":"./dist/esm/client/logger.js"},"require":{"types":"./dist/commonjs/client/logger.d.ts","default":"./dist/commonjs/client/logger.js"}},"./filters":{"import":{"types":"./dist/esm/filters/index.d.ts","default":"./dist/esm/filters/index.js"},"require":{"types":"./dist/commonjs/filters/index.d.ts","default":"./dist/commonjs/filters/index.js"}},"./functions":{"import":{"types":"./dist/esm/functions/index.d.ts","default":"./dist/esm/functions/index.js"},"require":{"types":"./dist/commonjs/functions/index.d.ts","default":"./dist/commonjs/functions/index.js"}},"./package.json":"./package.json","./models/common":{"import":{"types":"./dist/esm/models/common.d.ts","default":"./dist/esm/models/common.js"},"require":{"types":"./dist/commonjs/models/common.d.ts","default":"./dist/commonjs/models/common.js"}},"./models/entities":{"import":{"types":"./dist/esm/models/index.d.ts","default":"./dist/esm/models/index.js"},"require":{"types":"./dist/commonjs/models/index.d.ts","default":"./dist/commonjs/models/index.js"}}},"scripts":{"ci":"pnpm run check && pnpm run build","dev":"bun run ./src/test.ts","lint":"biome lint . --diagnostic-level=warn","build":"tshy","check":"biome check --write .","format":"biome format . --write","lint:fix":"biome lint --fix --unsafe","check-format":"biome format .","prep-release":"npx changeset","check-exports":"attw --pack  . --profile node16 --summary","local-release":"changeset version && changeset publish"},"_npmUser":{"name":"bx93tn","email":"bx93tn@gmail.com"},"_resolved":"/private/var/folders/pk/h__lwc697sb08553nxppgsmh0000gn/T/bd850a9b9fdf00f0d0a82ad33f80e637/bx93tn-core-sdk-0.2.0.tgz","_integrity":"sha512-vQ8oWgD77Zc7NWUB457IGL7dZEy3THZ/g2Uosx1tXdRh2wQwTj8OMHxmceE4az1TWGIcqIHaVngcl+FvQELnNg==","repository":{"url":"git+https://github.com/bilalesi/entity-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"SDK for entitycore API","directories":{},"nano-staged":{"*.{js,ts}":["biome check --write"],"package.json":["pnpm run check-dependency-version","biome format . --write"],"pnpm-lock.yaml":"pnpm dedupe --check"},"sideEffects":false,"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.3","tshy":"^3.0.2","lru-cache":"^11.1.0","typescript":"^5.8.3","@types/node":"^22.8.1","nano-staged":"^0.8.0","@biomejs/biome":"^1.9.4","@changesets/cli":"^2.29.2","simple-git-hooks":"^2.12.1","@arethetypeswrong/cli":"^0.17.4"},"peerDependencies":{"zod":"^3.24.3"},"simple-git-hooks":{"pre-commit":"npx nano-staged"},"_npmOperationalInternal":{"tmp":"tmp/core-sdk_0.2.0_1745405845032_0.9379344593937364","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@bx93tn/core-sdk","version":"0.2.1","description":"SDK for entitycore API","type":"module","license":"MIT","sideEffects":false,"tshy":{"exclude":["src/test.ts"],"exports":{".":"./src/index.ts","./package.json":"./package.json","./client":"./src/client/index.ts","./sdk":"./src/sdk/index.ts","./functions":"./src/functions/index.ts","./filters":"./src/filters/index.ts","./logger":"./src/client/logger.ts","./models/entities":"./src/models/index.ts","./models/common":"./src/models/common.ts","./*.js":"./src/*.ts","./*":"./src/*.ts"}},"keywords":["entitycore","neuroscience","brain"],"repository":{"type":"git","url":"git+https://github.com/bilalesi/entity-sdk.git"},"engines":{"node":">=22.14.0","pnpm":">=10.0.0"},"simple-git-hooks":{"pre-commit":"npx nano-staged"},"nano-staged":{"*.{js,ts}":["biome check --write"],"package.json":["pnpm run check-dependency-version","biome format . --write"],"pnpm-lock.yaml":"pnpm dedupe --check"},"peerDependencies":{"zod":"^3.24.3"},"devDependencies":{"@arethetypeswrong/cli":"^0.17.4","@biomejs/biome":"^1.9.4","@changesets/cli":"^2.29.2","@types/node":"^22.8.1","lru-cache":"^11.1.0","nano-staged":"^0.8.0","simple-git-hooks":"^2.12.1","tshy":"^3.0.2","typescript":"^5.8.3","zod":"^3.24.3"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json","./client":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js"}},"./sdk":{"import":{"types":"./dist/esm/sdk/index.d.ts","default":"./dist/esm/sdk/index.js"},"require":{"types":"./dist/commonjs/sdk/index.d.ts","default":"./dist/commonjs/sdk/index.js"}},"./functions":{"import":{"types":"./dist/esm/functions/index.d.ts","default":"./dist/esm/functions/index.js"},"require":{"types":"./dist/commonjs/functions/index.d.ts","default":"./dist/commonjs/functions/index.js"}},"./filters":{"import":{"types":"./dist/esm/filters/index.d.ts","default":"./dist/esm/filters/index.js"},"require":{"types":"./dist/commonjs/filters/index.d.ts","default":"./dist/commonjs/filters/index.js"}},"./logger":{"import":{"types":"./dist/esm/client/logger.d.ts","default":"./dist/esm/client/logger.js"},"require":{"types":"./dist/commonjs/client/logger.d.ts","default":"./dist/commonjs/client/logger.js"}},"./models/entities":{"import":{"types":"./dist/esm/models/index.d.ts","default":"./dist/esm/models/index.js"},"require":{"types":"./dist/commonjs/models/index.d.ts","default":"./dist/commonjs/models/index.js"}},"./models/common":{"import":{"types":"./dist/esm/models/common.d.ts","default":"./dist/esm/models/common.js"},"require":{"types":"./dist/commonjs/models/common.d.ts","default":"./dist/commonjs/models/common.js"}},"./*.js":{"import":{"types":"./dist/esm/*.d.ts","default":"./dist/esm/*.js"},"require":{"types":"./dist/commonjs/*.d.ts","default":"./dist/commonjs/*.js"}},"./*":{"import":{"types":"./dist/esm/*.d.ts","default":"./dist/esm/*.js"},"require":{"types":"./dist/commonjs/*.d.ts","default":"./dist/commonjs/*.js"}}},"main":"./dist/commonjs/index.js","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","scripts":{"dev":"bun run ./src/test.ts","build":"tshy","lint":"biome lint . --diagnostic-level=warn","lint:fix":"biome lint --fix --unsafe","format":"biome format . --write","check-format":"biome format .","check-exports":"attw --pack  . --profile node16 --summary","check":"biome check --write .","ci":"pnpm run check && pnpm run build","prep-release":"npx changeset","local-release":"changeset version && changeset publish"},"_id":"@bx93tn/core-sdk@0.2.1","bugs":{"url":"https://github.com/bilalesi/entity-sdk/issues"},"homepage":"https://github.com/bilalesi/entity-sdk#readme","_integrity":"sha512-4l/f4kjiLOJSr3pwmGTkxpUn75d8ybSvLJ+Z1NA0nscSv23nNAr58KkivjDrU7732P3o5gL57PRRZR+oLL1bKg==","_resolved":"/private/var/folders/pk/h__lwc697sb08553nxppgsmh0000gn/T/a7a032d7b6a71cd20a08c90b2f44953f/bx93tn-core-sdk-0.2.1.tgz","_from":"file:bx93tn-core-sdk-0.2.1.tgz","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-4l/f4kjiLOJSr3pwmGTkxpUn75d8ybSvLJ+Z1NA0nscSv23nNAr58KkivjDrU7732P3o5gL57PRRZR+oLL1bKg==","shasum":"5c011b51bedf3ebe91516d46f4ca9226f159f595","tarball":"https://registry.npmjs.org/@bx93tn/core-sdk/-/core-sdk-0.2.1.tgz","fileCount":516,"unpackedSize":1172478,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDk1Df9J9JTrq2dMoUgKRHQWVUFob99Hp/5GUXxgqdglgIgW7epQum7EGF+n8f++DrLmfaRK6PQPzl8PTaHkRd+S4A="}]},"_npmUser":{"name":"bx93tn","email":"bx93tn@gmail.com"},"directories":{},"maintainers":[{"name":"bx93tn","email":"bx93tn@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core-sdk_0.2.1_1745405960859_0.10518142007788533"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-22T12:11:26.879Z","modified":"2025-04-23T10:59:21.238Z","0.1.0":"2025-04-22T12:11:27.247Z","0.2.0":"2025-04-23T10:57:25.235Z","0.2.1":"2025-04-23T10:59:21.074Z"},"bugs":{"url":"https://github.com/bilalesi/entity-sdk/issues"},"license":"MIT","homepage":"https://github.com/bilalesi/entity-sdk#readme","keywords":["entitycore","neuroscience","brain"],"repository":{"type":"git","url":"git+https://github.com/bilalesi/entity-sdk.git"},"description":"SDK for entitycore API","maintainers":[{"name":"bx93tn","email":"bx93tn@gmail.com"}],"readme":"# @bx93tn/core-sdk\n\nSDK for the Entity Core API, providing tools for interacting with neuroscience data and models.\n\n![npm](https://img.shields.io/npm/v/@bx93tn/core-sdk?label=@bx93tn/core-sdk&color=blue&logo=npm)\n\n## Installation\n\n```bash\npnpm add @bx93tn/core-sdk zod\n# or\nbun add @bx93tn/core-sdk zod\n# or\nnpm install @bx93tn/core-sdk zod\n# or\nyarn add @bx93tn/core-sdk zod\n```\n\n**Note:**\n\n- `zod` are listed as peer dependencies.\n- `lru-cache` is meant to be used in node environment (future releases will allow different external cache services).\n- in the browser, the client use the cache api.\n\n## Design Philosophy\n\nThis SDK is built with the following principles in mind:\n\n1.  **Modular Architecture**: The codebase is organized into distinct modules:\n    - `client`: Handles the core API communication (`ApiClient`, `RequestBuilder`).\n    - `functions`: Contains individual, standalone functions for each API endpoint.\n    - `sdk`: Provides a structured, class-based SDK interface that groups related functions.\n    - `models`: Defines TypeScript types and Zod schemas for API request/response validation.\n    - `filters`: Defines TypeScript types for API query parameters.\n2.  **Type Safety**: Leverages TypeScript and Zod for strong typing of function arguments, return values, and API schemas, ensuring data integrity and improving developer experience.\n3.  **Flexible Access Patterns**: Offers two primary ways to interact with the API:\n    - A **full SDK object** (`EntityCoreSDK`) with grouped endpoints.\n    - **Standalone functions** that can be imported individually.\n4.  **Robust Error Handling**: API call results are wrapped in a `Result<T, E>` type, making error handling explicit and preventing unexpected runtime errors. An `unwrap()` method is provided for convenience when direct access to the successful value is desired.\n\n## Core Components\n\n### `ApiClient`\n\nThe `ApiClient` (imported from `@bx93tn/core-sdk/client`) is the foundation for all API interactions. It manages:\n\n- The base URL of the API.\n- Default request configurations (e.g., headers for authentication).\n- Optional features like caching, request retries, and lifecycle hooks.\n\nYou need to instantiate `ApiClient` before using either the SDK or standalone functions.\n\n```typescript\nimport { ApiClient } from \"@bx93tn/core-sdk/client\";\n\nconst apiClient = new ApiClient(\"https://your-api-base-url.com\", {\n  fetchOptions: {\n    headers: {\n      Authorization: \"Bearer YOUR_API_TOKEN\",\n      \"Content-Type\": \"application/json\",\n    },\n  },\n  // Optional configuration:\n  // cache: { enabled: true, ttl: 60000, maxSize: 100 },\n  // retry: { attempts: 3, delay: 1000 },\n  // debug: true,\n});\n```\n\n### `EntityCoreSDK`\n\nThe SDK (imported from `@bx93tn/core-sdk/sdk`) provides a convenient, object-oriented wrapper around the `ApiClient` and standalone functions.\n\n```typescript\nimport { EntityCoreSDK } from \"@bx93tn/core-sdk/sdk\";\nimport { ApiClient } from \"@bx93tn/core-sdk/client\";\n\nconst apiClient = new ApiClient(/* ... */);\nconst sdk = new EntityCoreSDK(apiClient);\n\nconst morphology = await sdk.reconstructionMorphology.get(\"some-uuid\").unwrap();\n```\n\n### Standalone Functions\n\nFor more granular control or potentially better tree-shaking, you can import and use functions directly (imported from `@bx93tn/core-sdk/functions`).\nEach function requires an `ApiClient` instance as its first argument.\n\n```typescript\nimport { listReconstructionMorphologies } from \"@bx93tn/core-sdk/functions\";\nimport { ApiClient } from \"@bx93tn/core-sdk/client\";\n\nconst apiClient = new ApiClient(/* ... */);\n\nconst result = await listReconstructionMorphologies(apiClient, {\n  /* query parameters */\n});\n\nif (result.ok) {\n  console.log(\"Morphologies:\", result.value);\n} else {\n  console.error(\"API Error:\", result.error);\n}\n```\n\n## Why Offer Both SDK and Functions?\n\nProviding both interfaces offers flexibility:\n\n- **SDK (`EntityCoreSDK`)**:\n  - **Pros**: Good discoverability of endpoints, convenient for applications using many related API calls, provides a structured, object-oriented feel.\n  - **Cons**: Might import more code than strictly necessary if only a few endpoints are used.\n- **Standalone Functions**:\n  - **Pros**: Allows importing only the specific functions needed, potentially leading to smaller bundle sizes (better tree-shaking), aligns well with functional programming patterns.\n  - **Cons**: Requires manually passing the `ApiClient` to each call, less discoverability compared to the SDK structure.\n\nChoose the approach that best suits your project's needs and coding style.\n\n## Usage Examples\n\n### Setup\n\n```typescript\nimport { ApiClient } from \"@bx93tn/core-sdk/client\";\nimport { EntityCoreSDK } from \"@bx93tn/core-sdk/sdk\";\nimport {\n  listReconstructionMorphologies,\n  getReconstructionMorphology,\n  createReconstructionMorphology,\n} from \"@bx93tn/core-sdk/functions\";\n\n// 1. Use client for other purposes\nconst apiClient = new ApiClient(\"http://localhost:8000\", {\n  fetchOptions: {\n    headers: { Authorization: \"Bearer TOKEN\" },\n  },\n});\n\n// 2. Instantiate the SDK with same parameters as the ApiClient\nconst sdk = new EntityCoreSDK(\"http://localhost:8000\", {\n  debug: true,\n  cache: { server: true },\n  retry: { attempts: 5, backoff: \"exponential\", shouldRetry: () => true },\n  fetchOptions: {\n    headers: { Authorization: \"Bearer TOKEN\" },\n  },\n});\n```\n\n### Using the SDK\n\n```typescript\nasync function useSDK() {\n  // List items (using flat access and unwrap)\n  console.log(\"Fetching list via SDK...\");\n  const listData = await sdk.reconstructionMorphology\n    .list({ page: 1, page_size: 20 })\n    .unwrap();\n  // Access unwrapped data directly\n  // Get a specific item (using grouped access)\n  const morphologyId = listData.items[0]?.id;\n  if (!morphologyId) {\n    console.log(\"No morphology ID found to fetch.\");\n    return;\n  }\n  const getItemData = await sdk.reconstructionMorphology\n    .get(morphologyId)\n    .unwrap();\n  console.log(\"Single Item (SDK):\", getItemData);\n\n  // Create an item\n  const newItemData = {\n    name: \"New Morphology SDK\" /* other required fields */,\n  };\n  const createdItem = await sdk.reconstructionMorphology\n    .create({ ...newItemData })\n    .unwrap();\n}\n\nuseSDK();\n```\n\n### Using Standalone Functions\n\n```typescript\nasync function useFunctions() {\n    const apiClient = new ApiClient(\"http://localhost:8000/api/\", {/* client config */})\n    // or you can use the EntityCoreSDK.apiClient\n  // List items\n  const listResult = await listReconstructionMorphologies(apiClient, { page: 1, page_size: 20 } });\n    if (listResult.ok) {\n        const morphologyId = listResult.value.items[0]?.id;\n        if (!morphologyId) {\n            console.log(\"No morphology ID found to fetch.\");\n            return;\n        }\n    }\n    const getResult = await getReconstructionMorphology(apiClient, \"uuid\");\n    if (getResult.ok) {\n      console.log('Single Item (Functions):', getResult.value);\n    } else {\n      console.error('Function Error (Get):', getResult.error);\n    }\n   // Create an item\n    const newItemData = { name: \"New Morphology Function\", /* other required fields */ };\n    const createResult = await createReconstructionMorphology(apiClient, { ...newItemData });\n\n    if (createResult.ok) {\n        console.log('Created Item (Functions):', createResult.value);\n    } else {\n        console.error('Function Error (Create):', createResult.error);\n    }\n}\n\nuseFunctions();\n```\n\n## Result Handling\n\nAll API operations (both SDK methods and standalone functions) return a `Promise<Result<T, E>>`.\n\n- `Result.ok`: A boolean indicating success (`true`) or failure (`false`).\n- `Result.value`: The successful data payload (if `ok` is `true`).\n- `Result.error`: The error object (if `ok` is `false`).\n\nYou can handle results manually:\n\n```typescript\nconst result = await sdk.reconstructionMorphology.list();\nif (result.ok) {\n  console.log(result.value);\n} else {\n  console.error(\"Error:\", result.error);\n}\n```\n\nOr use the convenient `.unwrap()` method provided on the `Result` object, which returns the `value` on success or throws the `error` on failure:\n\n```typescript\ntry {\n  const data = await sdk.reconstructionMorphology.list().unwrap();\n  console.log(data);\n} catch (error) {\n  console.error(\"Caught error:\", error);\n}\n```\n\n## Development\n\n- **Build**: `pnpm run build` (uses `tshy` for dual CJS/ESM output)\n- **Lint**: `pnpm run lint`\n- **Format**: `pnpm run format`\n- **Check All**: `pnpm run check`\n- **Check Package Exports**: `pnpm run check-exports`\n","readmeFilename":"README.md"}