{"_id":"@dannychirkov/salesdrive-transport-fetch","_rev":"2-ec603d94b1e7930a56be5c263359b7b7","name":"@dannychirkov/salesdrive-transport-fetch","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@dannychirkov/salesdrive-transport-fetch","version":"0.1.0","keywords":["salesdrive","transport","fetch","http"],"author":{"name":"Danny Chirkov"},"license":"Apache-2.0","_id":"@dannychirkov/salesdrive-transport-fetch@0.1.0","maintainers":[{"name":"dannychirkov","email":"dannychirkov@gmail.com"}],"homepage":"https://github.com/dannychirkov/salesdrive-api#readme","bugs":{"url":"https://github.com/dannychirkov/salesdrive-api/issues"},"dist":{"shasum":"3e8e0130c303c0b5104c5f2dec9aa86857276dda","tarball":"https://registry.npmjs.org/@dannychirkov/salesdrive-transport-fetch/-/salesdrive-transport-fetch-0.1.0.tgz","fileCount":6,"integrity":"sha512-A5WUbzc6/BRehstJ6FQAGZMPsT2Q+kVhRIj4r5zbrKflE3SrwUj7gPsYBxn4e9M1EhaKEhk11ynpSk/nFjRkUQ==","signatures":[{"sig":"MEUCIQD53V8iheeC1w7aGDrQ30bBjr6Nsq/7LIUGqi5VJNxjLgIgBuh+g52YLPVM6s3TGbOVfDTaDdBJHBkxTMAXhmPbC34=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17368},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"c71db20321b4850f9e586de442a4c05b07a37a70","scripts":{"test":"jest","build":"tsc","clean":"rimraf dist","type-check":"tsc --noEmit"},"_npmUser":{"name":"dannychirkov","email":"dannychirkov@gmail.com"},"repository":{"url":"git+https://github.com/dannychirkov/salesdrive-api.git","type":"git","directory":"packages/salesdrive-transport-fetch"},"_npmVersion":"10.9.2","description":"Fetch-based HTTP transport for SalesDrive API client","directories":{},"_nodeVersion":"22.17.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","rimraf":"^5.0.5","ts-jest":"^29.1.1","typescript":"^5.3.0","@types/jest":"^29.5.11","@types/node":"^20.10.0","@dannychirkov/salesdrive-api-client":"*"},"peerDependencies":{"@dannychirkov/salesdrive-api-client":"*"},"_npmOperationalInternal":{"tmp":"tmp/salesdrive-transport-fetch_0.1.0_1768112101257_0.912828416015816","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@dannychirkov/salesdrive-transport-fetch","version":"0.1.1","description":"Fetch-based HTTP transport for SalesDrive API client","main":"dist/index.js","types":"dist/index.d.ts","license":"Apache-2.0","author":{"name":"Danny Chirkov"},"repository":{"type":"git","url":"git+https://github.com/dannychirkov/salesdrive-api.git","directory":"packages/salesdrive-transport-fetch"},"homepage":"https://github.com/dannychirkov/salesdrive-api#readme","bugs":{"url":"https://github.com/dannychirkov/salesdrive-api/issues"},"keywords":["salesdrive","transport","fetch","http"],"scripts":{"build":"tsc","test":"jest","type-check":"tsc --noEmit","clean":"rimraf dist"},"peerDependencies":{"@dannychirkov/salesdrive-api-client":"*"},"devDependencies":{"@dannychirkov/salesdrive-api-client":"*","typescript":"^5.3.0","@types/node":"^20.10.0","jest":"^29.7.0","@types/jest":"^29.5.11","ts-jest":"^29.1.1","rimraf":"^5.0.5"},"engines":{"node":">=18.0.0"},"_id":"@dannychirkov/salesdrive-transport-fetch@0.1.1","gitHead":"7e1ce79bf6c667ae934d7447e7512644e70fa7a1","_nodeVersion":"22.17.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-VE8J66yKoWTRrEFjih5VPwP+bqcMn5cThPWSDvrEXqNT3KovYnKxIiytZpVfrfsF9h2RheRB+XeP4+/4TVPk7w==","shasum":"291c9413b6848108178393dc97fe67d68a0a5069","tarball":"https://registry.npmjs.org/@dannychirkov/salesdrive-transport-fetch/-/salesdrive-transport-fetch-0.1.1.tgz","fileCount":6,"unpackedSize":18076,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDmfqxPc5OXgUWCU+R/ehrjE6FL3GNWSzA1E98/VMN7QgIhAKrlEzc77zv1BsyKlCMJuZslm9DsWyvZBXY46Co1bh48"}]},"_npmUser":{"name":"dannychirkov","email":"dannychirkov@gmail.com"},"directories":{},"maintainers":[{"name":"dannychirkov","email":"dannychirkov@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/salesdrive-transport-fetch_0.1.1_1768138521323_0.300143962664039"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-11T06:15:01.177Z","modified":"2026-01-11T13:35:21.642Z","0.1.0":"2026-01-11T06:15:01.416Z","0.1.1":"2026-01-11T13:35:21.459Z"},"bugs":{"url":"https://github.com/dannychirkov/salesdrive-api/issues"},"author":{"name":"Danny Chirkov"},"license":"Apache-2.0","homepage":"https://github.com/dannychirkov/salesdrive-api#readme","keywords":["salesdrive","transport","fetch","http"],"repository":{"type":"git","url":"git+https://github.com/dannychirkov/salesdrive-api.git","directory":"packages/salesdrive-transport-fetch"},"description":"Fetch-based HTTP transport for SalesDrive API client","maintainers":[{"name":"dannychirkov","email":"dannychirkov@gmail.com"}],"readme":"# @dannychirkov/salesdrive-transport-fetch\n\nFetch-based HTTP transport for SalesDrive API client.\n\n## Installation\n\n```bash\nnpm install @dannychirkov/salesdrive-api-client @dannychirkov/salesdrive-transport-fetch\n```\n\n## Usage\n\n```typescript\nimport { createFetchTransport } from '@dannychirkov/salesdrive-transport-fetch';\nimport { createClient, orderService } from '@dannychirkov/salesdrive-api-client';\n\nconst transport = createFetchTransport({\n  apiKey: 'your-api-key',\n  baseUrl: 'https://your-account.salesdrive.me',\n});\n\nconst client = createClient({\n  transport,\n  apiKey: 'your-api-key',\n  baseUrl: 'https://your-account.salesdrive.me',\n}).extend(orderService);\n\nconst orders = await client.orders.list();\n```\n\n## Configuration\n\n```typescript\ninterface FetchTransportConfig {\n  // SalesDrive API key (required)\n  apiKey: string;\n\n  // Base URL for the API (required)\n  // Example: https://demo.salesdrive.me\n  baseUrl: string;\n\n  // Additional headers to include in requests\n  headers?: Record<string, string>;\n\n  // Custom fetch implementation\n  // Useful for testing or Node.js < 18\n  fetch?: typeof fetch;\n\n  // Request timeout in milliseconds (default: 30000)\n  timeout?: number;\n}\n```\n\n## With Retry Logic\n\nFor automatic retry on rate limit errors:\n\n```typescript\nimport { createFetchTransportWithRetry } from '@dannychirkov/salesdrive-transport-fetch';\n\nconst transport = createFetchTransportWithRetry(\n  {\n    apiKey: 'your-api-key',\n    baseUrl: 'https://your-account.salesdrive.me',\n  },\n  {\n    maxRetries: 3,\n    retryDelay: 1000,\n    retryMultiplier: 2,\n  }\n);\n```\n\n### SalesDrive Rate Limits\n\nSalesDrive API has the following rate limits:\n\n- **10 requests per minute**\n- **100 requests per hour**\n- **1000 requests per 24 hours**\n\nWhen limits are exceeded, the API returns HTTP 400 with message `\"API limit reached. Please try again later.\"` (not standard 429). This transport handles both cases automatically.\n\n**Recommended retry config for SalesDrive:**\n\n```typescript\nconst transport = createFetchTransportWithRetry(\n  {\n    apiKey: 'your-api-key',\n    baseUrl: 'https://demo.salesdrive.me',\n  },\n  {\n    maxRetries: 3,\n    retryDelay: 60000, // Wait 60 seconds (full minute window)\n    retryMultiplier: 1, // Don't increase delay, just wait another minute\n  }\n);\n```\n\n## Custom Fetch Implementation\n\n```typescript\nimport nodeFetch from 'node-fetch';\n\nconst transport = createFetchTransport({\n  apiKey: 'your-api-key',\n  baseUrl: 'https://your-account.salesdrive.me',\n  fetch: nodeFetch as unknown as typeof fetch,\n});\n```\n\n## License\n\n[Apache License 2.0](../../LICENSE)\n","readmeFilename":"README.md"}