create-request 0.0.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ import { HttpMethod, RequestPriority, CredentialsPolicy, RequestMode, RedirectMode, CacheMode } from "./enums";
2
+ import type { RequestError } from "./RequestError";
3
+ export type Body = null | Blob | string | object | FormData | ArrayBuffer | URLSearchParams | ReadableStream;
4
+ export type RetryCallback = (options: {
5
+ retryCount: number;
6
+ error: RequestError;
7
+ }) => void | Promise<void>;
8
+ export { HttpMethod, RequestPriority, CredentialsPolicy, RequestMode, RedirectMode, CacheMode };
9
+ export interface RequestOptions extends Omit<RequestInit, "signal" | "body" | "method" | "credentials" | "mode" | "redirect" | "cache" | "priority"> {
10
+ timeout?: number;
11
+ retries?: number;
12
+ onRetry?: RetryCallback;
13
+ body?: any;
14
+ credentials?: CredentialsPolicy | RequestCredentials;
15
+ mode?: RequestMode;
16
+ redirect?: RedirectMode | RequestRedirect;
17
+ priority?: RequestPriority | string;
18
+ keepalive?: boolean;
19
+ }
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "create-request",
3
+ "version": "0.0.1-beta.2",
4
+ "description": "A modern, chainable wrapper for fetch with automatic retries, timeouts, comprehensive error handling, and first-class TypeScript support",
5
+ "main": "dist/library/index.js",
6
+ "module": "dist/library/index.esm.js",
7
+ "types": "dist/library/index.d.ts",
8
+ "files": [
9
+ "dist/library"
10
+ ],
11
+ "scripts": {
12
+ "build": "rollup -c",
13
+ "dev": "rollup -c -w",
14
+ "test": "tsc -p tsconfig.test.json && node --test --experimental-test-coverage",
15
+ "test:coverage": "tsc -p tsconfig.test.json && node --test --experimental-test-coverage dist/tests/test/",
16
+ "pretest": "tsc -p tsconfig.test.json",
17
+ "prepublishOnly": "npm run build",
18
+ "publish:beta": "npm version prerelease --preid=beta && git push origin --tags && npm publish --tag beta",
19
+ "publish:patch": "npm version patch && git push origin --tags && npm publish",
20
+ "publish:minor": "npm version minor && git push origin --tags && npm publish",
21
+ "publish:major": "npm version major && git push origin --tags && npm publish",
22
+ "lint": "eslint 'src/**/*.ts' 'test/**/*.ts'",
23
+ "lint:fix": "eslint 'src/**/*.ts' 'test/**/*.ts' --fix",
24
+ "format": "prettier --write 'src/**/*.ts' 'test/**/*.ts'",
25
+ "check": "npm run lint && npm run test"
26
+ },
27
+ "keywords": [
28
+ "fetch",
29
+ "http",
30
+ "request",
31
+ "api",
32
+ "xhr",
33
+ "ajax"
34
+ ],
35
+ "author": "Daniel Amenou <amenou.daniel@gmail.com>",
36
+ "license": "MIT",
37
+ "devDependencies": {
38
+ "@rollup/plugin-commonjs": "^22.0.0",
39
+ "@rollup/plugin-node-resolve": "^13.3.0",
40
+ "@rollup/plugin-typescript": "^8.3.2",
41
+ "@types/node": "^18.0.0",
42
+ "@typescript-eslint/eslint-plugin": "^6.15.0",
43
+ "@typescript-eslint/parser": "^6.15.0",
44
+ "eslint": "^8.56.0",
45
+ "eslint-config-prettier": "^9.1.0",
46
+ "eslint-import-resolver-typescript": "^3.6.1",
47
+ "eslint-plugin-import": "^2.29.1",
48
+ "eslint-plugin-prettier": "^5.0.1",
49
+ "prettier": "^3.1.1",
50
+ "rollup": "^2.75.5",
51
+ "rollup-plugin-cleaner": "^1.0.0",
52
+ "tslib": "^2.4.0",
53
+ "typescript": "^4.7.3",
54
+ "undici": "^5.28.5"
55
+ }
56
+ }