{"_id":"@astralis-os/notfetch","_rev":"2-615f0daa3b447af1d269cb448a99a3e1","name":"@astralis-os/notfetch","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@astralis-os/notfetch","version":"1.0.0","keywords":["fetch","instance","fetches","notFetch"],"author":{"url":"https://github.com/Astralis-Team","name":"Astralis Open Source 🌚"},"license":"MIT","_id":"@astralis-os/notfetch@1.0.0","maintainers":[{"name":"jez-jack","email":"andrey.chernenko008@gmail.com"}],"homepage":"https://github.com/Astralis-Team/notFetch","bugs":{"url":"https://github.com/Astralis-Team/notFetch/issues"},"dist":{"shasum":"f7227f5cfd6331fbfe563e21c03b63ae9fb5a6d0","tarball":"https://registry.npmjs.org/@astralis-os/notfetch/-/notfetch-1.0.0.tgz","fileCount":8,"integrity":"sha512-8R1svu5BqrHNCsl1Mm/pZfclNIXOY6MhRl5ZNjIc0Bg/YH1vQfs6+QpiW7V3/+Tiu4srd2v137XTE5/kGgUDUw==","signatures":[{"sig":"MEQCIAPCKE5CBsw/YD0frqd2om6Y+cKnHSuX6OQ8iG63TACOAiAWvcJ6F0+F0HijFym3Y5xi+v+02Xs6vqEgwkslTY/L3A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68366},"main":"dist/cjs/index.cjs","type":"module","types":"dist/esm/index.d.mts","module":"dist/esm/index.mjs","exports":{".":{"import":{"types":"./dist/esm/index.d.mts","default":"./dist/esm/index.mjs"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}}},"gitHead":"ebd4d005a4b0962db1a661ace485a67e6e83f8b2","scripts":{"lint":"eslint . --fix","test":"vitest run","type":"tsc --noEmit","build":"tsdown","format":"prettier --write .","pretty":"pnpm type && pnpm lint && pnpm format","unit-test":"vitest","lint-inspector":"npx @eslint/config-inspector","prepublishOnly":"pnpm type && pnpm build"},"_npmUser":{"name":"jez-jack","email":"andrey.chernenko008@gmail.com"},"repository":{"url":"git+https://github.com/Astralis-Team/notFetch.git"},"_npmVersion":"11.6.2","description":"fetch instance","directories":{},"lint-staged":{"*.{js,ts}":["prettier --write","eslint --fix"]},"sideEffects":false,"_nodeVersion":"24.11.1","dependencies":{"tsdown":"^0.21.7"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.0.16","@siberiacancode/eslint":"*","@siberiacancode/vitest":"*","@siberiacancode/prettier":"*","@siberiacancode/tsconfig":"^1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/notfetch_1.0.0_1775548685054_0.04286760311840876","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@astralis-os/notfetch","type":"module","version":"1.0.1","description":"fetch instance","author":{"name":"Astralis Open Source 🌚","url":"https://github.com/Astralis-Team"},"license":"MIT","homepage":"https://github.com/Astralis-Team/notFetch","repository":{"url":"git+https://github.com/Astralis-Team/notFetch.git"},"bugs":{"url":"https://github.com/Astralis-Team/notFetch/issues"},"keywords":["fetch","instance","fetches","notFetch"],"publishConfig":{"access":"public"},"sideEffects":false,"exports":{".":{"import":{"types":"./dist/esm/index.d.mts","default":"./dist/esm/index.mjs"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}}},"main":"dist/cjs/index.cjs","module":"dist/esm/index.mjs","types":"dist/esm/index.d.mts","scripts":{"test":"vitest run","prepublishOnly":"pnpm type && pnpm build","build":"tsdown","unit-test":"vitest","lint":"eslint . --fix","lint-inspector":"npx @eslint/config-inspector","type":"tsc --noEmit","format":"prettier --write .","pretty":"pnpm type && pnpm lint && pnpm format"},"devDependencies":{"@astralis-os/eslint":"*","@astralis-os/prettier":"*","@astralis-os/tsconfig":"^1.0.0","@astralis-os/vitest":"*","vitest":"4.0.16"},"lint-staged":{"*.{js,ts}":["prettier --write","eslint --fix"]},"dependencies":{"tsdown":"^0.21.7"},"gitHead":"cbc3af52b4c992e1e7933fb6684b1ae075e4a210","_id":"@astralis-os/notfetch@1.0.1","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-PyYsrdMMTd+h+unlqfJVHrRQ7lz5SAA7+4KvhYTVlvTjjh2OlVBeurA7+qpegB6Qard7e5Aq1rofDohzlhyMSQ==","shasum":"d5a0ebb7e778a85b307b2abd12f3ac2eda8af2e6","tarball":"https://registry.npmjs.org/@astralis-os/notfetch/-/notfetch-1.0.1.tgz","fileCount":8,"unpackedSize":68354,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDLD9H/KcvIaFveG+4h2h/J6yG5ygF+01TQyZ+Z74dWqwIhAP03Ckbfyt44HVGrbUP9YfaPT9vMzqzeIZ6GUM3nyaH0"}]},"_npmUser":{"name":"jez-jack","email":"andrey.chernenko008@gmail.com"},"directories":{},"maintainers":[{"name":"jez-jack","email":"andrey.chernenko008@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/notfetch_1.0.1_1775559140964_0.6081553578629082"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-07T07:58:04.960Z","modified":"2026-04-07T10:52:21.237Z","1.0.0":"2026-04-07T07:58:05.195Z","1.0.1":"2026-04-07T10:52:21.112Z"},"bugs":{"url":"https://github.com/Astralis-Team/notFetch/issues"},"author":{"name":"Astralis Open Source 🌚","url":"https://github.com/Astralis-Team"},"license":"MIT","homepage":"https://github.com/Astralis-Team/notFetch","keywords":["fetch","instance","fetches","notFetch"],"repository":{"url":"git+https://github.com/Astralis-Team/notFetch.git"},"description":"fetch instance","maintainers":[{"name":"jez-jack","email":"andrey.chernenko008@gmail.com"}],"readme":"# notfetch\n\nA lightweight and flexible HTTP client for making API requests.\n\n## Installation\n\n```bash\nnpm install @astralis-os/notfetch\n```\n\n## Usage\n\n```typescript\nimport notfetch from '@astralis-os/notfetch';\n\nconst response = await notfetch.get<User[]>('/users');\n```\n\n## Custom instance\n\n```typescript\nconst api = notfetch.create({\n  baseURL: 'https://api.example.com',\n  headers: {\n    'Content-Type': 'application/json'\n  }\n});\n\napi.interceptors.request.use(\n  (config) => {\n    config.headers.Authorization = 'Bearer token';\n    return config;\n  },\n  (error) => Promise.reject(error)\n);\n```\n\n## Request wrapper\n\n```typescript\ninterface GetUsersParams {\n  limit: number;\n  page: number;\n}\n\nconst getUsers: ApiNotFetchRequest<GetUsersParams, any[]> = ({ params, config }) =>\n  notfetch.get('/users', {\n    ...config,\n    query: { ...config?.params, ...params }\n  });\n```\n\n## Response parse\n\nThe notfetch library provides flexible response parsing options to handle different types of responses. You can specify how to parse the response body using predefined modes or custom functions. If no parse mode is specified, the response will be automatically parsed based on the `Content-Type` header:\n\n```typescript\nconst response = await notfetch.get('/users', { parse: 'json' });\n```\n\n### Custom parse functions\n\nYou can provide a custom function that takes a Response object and returns a Promise with parsed data. This is useful for handling special response formats or custom parsing logic.\n\n```typescript\nconst response = await notfetch.get('/users', { parse: (data) => data.json() });\n```\n\n### Raw response\n\nTo get the raw response body without any parsing, use the `'raw'` parse mode. This is useful when you need to handle the response manually or when working with binary data.\n\n```typescript\nconst response = await notfetch.get('/binary-file', { parse: 'raw' });\n```\n\n## Base URL\n\nYou can set the base URL when creating a new instance:\n\n```typescript\nimport { NotFetch } from '@astralis-os/notfetch';\n\nconst api = new NotFetch({\n  baseURL: '/api'\n});\n\nawait api.get('/users'); // /api/users\n```\n\nYou can override the base URL for individual requests using the `baseURL` option:\n\n```typescript\nawait api.get('/users', { baseUrl: '/api' });\n```\n\n## Context\n\nThe library supports a context system that allows you to pass data through the entire request lifecycle.\n\n```typescript\nconst response = await notfetch.get('/users', { context: 'data' });\n\nconsole.log('response', response.options.context); // 'data'\n```\n\n## Validate status\n\nBy default, only HTTP status codes in the range 2xx are considered successful. Set `validateStatus` when creating the instance (or with `setValidateStatus`): if it returns `true`, the response is treated as success and no error is thrown.\n\n```typescript\n// Treat 2xx and 3xx as success\nconst api = notfetch.create({\n  baseURL: '/api',\n  validateStatus: (status) => status >= 200 && status < 400\n});\n\n// Accept 404 as success (e.g. \"not found\" as valid empty result)\nconst api = notfetch.create({\n  baseURL: '/api',\n  validateStatus: (status) => (status >= 200 && status < 300) || status === 404\n});\n```\n\n## Global error handling\n\nYou can handle errors globally by setting the response interceptors.\n\n```typescript\nconst api = notfetch.create({\n  baseURL: '/api'\n});\n\napi.interceptors.response.use(\n  (response) => response,\n  (error) => {\n    console.error(error);\n    return Promise.reject(error);\n  }\n);\n```\n","readmeFilename":"README.md"}