{"_id":"@circles-market/sales","name":"@circles-market/sales","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@circles-market/sales","version":"0.1.0","private":false,"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.js"}},"sideEffects":false,"scripts":{"build":"tsup src/index.ts --dts --format esm,cjs --sourcemap","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"dependencies":{"@circles-market/core":"0.1.0","@circles-market/session":"0.1.0"},"devDependencies":{"tsup":"^8.3.0","typescript":"^5.6.3"},"_id":"@circles-market/sales@0.1.0","gitHead":"2bfca7a6816434444613f8ca4349e796179480b5","description":"Seller-scoped read-only endpoints for the Market API (requires a valid seller session token in `AuthContext`).","_nodeVersion":"24.8.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-Y6rZUkVme9bZ09RnIs180mM7DUaZKfmGllCN+ncAaYziXjAB2/RQJ6n5jyGLKVdZSL9BPZ7UluaapOIAZovKyQ==","shasum":"b627ea50183986ea41b48685401899fc9099c43f","tarball":"https://registry.npmjs.org/@circles-market/sales/-/sales-0.1.0.tgz","fileCount":12,"unpackedSize":22592,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDbOKy5Qtu9IrHgZnglogpEwHunQywxqoizRwfFC1DcKgIhAImncmztPs3iu2ZHZaDl9Kc/KZPPOT7IfxOf0enjf+VL"}]},"_npmUser":{"name":"jaensen","email":"daniel@djanz.de"},"directories":{},"maintainers":[{"name":"jaensen","email":"daniel@djanz.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sales_0.1.0_1768922741891_0.9294648275354347"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-20T15:25:41.685Z","0.1.0":"2026-01-20T15:25:42.026Z","modified":"2026-01-20T15:25:42.381Z"},"maintainers":[{"name":"jaensen","email":"daniel@djanz.de"}],"description":"Seller-scoped read-only endpoints for the Market API (requires a valid seller session token in `AuthContext`).","readme":"# @circles-market/sales\n\nSeller-scoped read-only endpoints for the Market API (requires a valid seller session token in `AuthContext`).\n\n## Install\n\n```bash\npnpm add @circles-market/sales @circles-market/core @circles-market/session\n```\n\n## Quickstart (list seller orders)\n\n```ts\nimport { FetchHttpTransport } from \"@circles-market/core\";\nimport { InMemoryAuthContext } from \"@circles-market/session\";\nimport { SalesClient } from \"@circles-market/sales\";\n\nasync function listSellerOrders(marketApiBase: string) {\n  const http = new FetchHttpTransport();\n  const session = new InMemoryAuthContext();\n  const sales = new SalesClient(marketApiBase, http, session);\n\n  return await sales.list({ page: 1, pageSize: 20 });\n}\n```\n\n## Quickstart (get one by id)\n\n```ts\nimport { SalesClient, isOrderId } from \"@circles-market/sales\";\n\nasync function getOrder(sales: SalesClient, id: string) {\n  if (!isOrderId(id)) return null;\n  const order = await sales.get(id);\n  return order; // `null` when not found (404)\n}\n```\n\n## Reference\n\n### Concepts\n\n* Seller-only view over orders created by buyers.\n* Requires a valid JWT in `AuthContext` belonging to the seller avatar (address lowercased) and the right `chainId`.\n* Pagination uses `page` + `pageSize` query params.\n\n### API and return values\n\n* `list({ page?, pageSize? })` → `SellerOrdersPage`\n  * `items`: array of `SellerOrderDto`\n* `get(orderId)` → `SellerOrderDto | null` (returns `null` on 404)\n\n### Types\n\n#### `SellerOrderDto`\nMinimal schema (selected fields):\n- `@context`: \"https://schema.org/\"\n- `@type`: \"Order\"\n- `orderNumber`: string\n- `orderStatus`: IRI string\n- `orderDate`: ISO date/time string\n- `paymentReference`: string | null\n- `broker`: opaque backend object\n- `acceptedOffer`: `any[]` (filtered to this seller)\n- `orderedItem`: `any[]` (filtered to this seller)\n- `totalPaymentDue`: `any | null`\n- `outbox?`: `any[]`\n- `[k: string]: unknown` for forward compatibility\n\n#### `SellerOrdersPage`\nFields:\n- `items`: `SellerOrderDto[]`\n\n#### `OrderId` and `isOrderId(s)`\n- `OrderId`: branded string type\n- `isOrderId(s: string)` → boolean (expects `ord_` + 32 uppercase hex chars)\n\n## Runtime notes\n\n* Requires global `fetch` (Node 18+ is fine).\n\n## Related packages\n\n* `@circles-market/auth` + `@circles-market/session` to obtain and store the seller JWT\n* `@circles-market/orders` for buyer-scoped order views\n* `@circles-market/sdk` if you want a single client wiring auth/catalog/cart/orders (and optionally offers)","readmeFilename":"README.md","_rev":"1-9d1ace54ddeae33400382a754cec079b"}