enterprise-fetch 1.0.0 → 2.0.0

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.
@@ -1,15 +1,15 @@
1
- import { AppError } from './AppError';
2
- export declare type Fetch = (url: RequestInfo, init?: FetchInit) => Promise<Response>;
3
- export declare type FetchInit = RequestInit & {
4
- retry?: {
5
- retries: number;
6
- minTimeout: number;
7
- factor: number;
8
- };
9
- timeout?: number;
10
- doRetry?: DoRetry;
11
- };
12
- export declare type DoRetry = (attempt: number, response: AppError | Response, fetchArgs?: {
13
- url: RequestInfo;
14
- options?: FetchInit;
15
- }) => Promise<boolean>;
1
+ import { AppError } from './AppError';
2
+ export type Fetch = (url: RequestInfo, init?: FetchInit) => Promise<Response>;
3
+ export type FetchInit = RequestInit & {
4
+ retry?: {
5
+ retries: number;
6
+ minTimeout: number;
7
+ factor: number;
8
+ };
9
+ timeout?: number;
10
+ doRetry?: DoRetry;
11
+ };
12
+ export type DoRetry = (attempt: number, response: AppError | Response, fetchArgs?: {
13
+ url: RequestInfo;
14
+ options?: FetchInit;
15
+ }) => Promise<boolean>;
@@ -1,2 +1,2 @@
1
- export * from './AppError';
2
- export * from './EnterpriseFetch';
1
+ export * from './AppError';
2
+ export * from './EnterpriseFetch';
@@ -1,2 +1,2 @@
1
- declare const isClient: () => boolean;
2
- export default isClient;
1
+ declare const isClient: () => boolean;
2
+ export default isClient;
@@ -1,3 +1,3 @@
1
- export declare const tryParse: (str: string) => any;
2
- export declare const isJson: (str: string) => boolean;
3
- export declare const tryStringify: (obj: any) => any;
1
+ export declare const tryParse: (str: string) => any;
2
+ export declare const isJson: (str: string) => boolean;
3
+ export declare const tryStringify: (obj: any) => any;
@@ -0,0 +1 @@
1
+ export declare const resolveFetch: () => Promise<typeof fetch>;
@@ -1,2 +1,2 @@
1
- import nodeFetch from 'node-fetch';
2
- export default nodeFetch;
1
+ import nodeFetch from 'node-fetch';
2
+ export default nodeFetch;
@@ -1,5 +1,5 @@
1
- declare type ProxyAgent = () => Promise<{
2
- agent?: any;
3
- }>;
4
- declare const proxyAgent: ProxyAgent;
5
- export default proxyAgent;
1
+ type ProxyAgent = () => Promise<{
2
+ agent?: any;
3
+ }>;
4
+ declare const proxyAgent: ProxyAgent;
5
+ export default proxyAgent;
@@ -1,2 +1,2 @@
1
- export declare const isSysError: (error: any) => error is Error;
2
- export declare const isFunc: (func: any) => boolean;
1
+ export declare const isSysError: (error: any) => error is Error;
2
+ export declare const isFunc: (func: any) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enterprise-fetch",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "A fetch wrapper to leverage enterprise features such as retry policy and request timeout",
5
5
  "browser": "dist/client/enterprise-fetch.esm.min.js",
6
6
  "module": "dist/enterprise-fetch.esm.js",
@@ -9,16 +9,16 @@
9
9
  "scripts": {
10
10
  "build": "npm run clean && tsc && rollup -c && npm run instrument",
11
11
  "build:serve": "npm run build && npm run serve",
12
- "clean": "rimraf dist",
13
- "cy:open": "start-server-and-test serve http://localhost:5000 cypress:open",
12
+ "clean": "rimraf dist && rimraf instrumented && rimraf coverage && rimraf .nyc_output",
13
+ "cy:open": "start-server-and-test serve http://localhost:3000 cypress:open",
14
14
  "cy:run": "cypress run",
15
15
  "cypress:open": "cypress open",
16
16
  "cypress:run": "cypress run",
17
17
  "instrument": "nyc instrument --compact=false dist/enterprise-fetch.esm.js instrumented",
18
- "mocha:run": "mocha --es-module-specifier-resolution=node --require @babel/register --timeout 500000 --exit cypress/integration/node.spec.js",
19
- "nyc:test": "nyc npm test",
18
+ "mocha:run": "mocha --timeout 500000 --exit cypress/integration/node.spec.mjs",
19
+ "nyc:test": "nyc npm run mocha:run && npm test",
20
20
  "prestart": "npm run build",
21
- "report:coverage": "nyc report --reporter=html && serve ./coverage",
21
+ "report:coverage": "nyc report --reporter=html && serve -c ../serve.json ./coverage",
22
22
  "report:coverage:text": "nyc report --reporter=text",
23
23
  "report:coverage:summary": "nyc report --reporter=text-summary",
24
24
  "codecov:linux": "curl -Os https://uploader.codecov.io/latest/linux/codecov && chmod +x codecov",
@@ -26,8 +26,8 @@
26
26
  "codecov:windows": "curl -Os https://uploader.codecov.io/latest/windows/codecov.exe",
27
27
  "report-coverage": "npm run codecov:windows && codecov -t 9f816f9c-8faa-4812-9bb2-5235c8c11468",
28
28
  "start": "npm run nyc:test",
29
- "serve": "serve .",
30
- "test": "start-server-and-test serve http://localhost:5000 cypress:run"
29
+ "serve": "serve",
30
+ "test": "start-server-and-test serve http://localhost:3000 cypress:run"
31
31
  },
32
32
  "keywords": [
33
33
  "fetch",
@@ -46,49 +46,48 @@
46
46
  "dependencies": {
47
47
  "abort-controller": "^3.0.0",
48
48
  "await-to-js": "^3.0.0",
49
- "cross-fetch": "^3.1.2",
50
- "https-proxy-agent": "^5.0.0",
49
+ "https-proxy-agent": "^7.0.6",
50
+ "node-fetch": "^2.7.0",
51
51
  "promise-retry": "^2.0.1"
52
52
  },
53
53
  "devDependencies": {
54
- "@babel/core": "^7.13.10",
55
- "@babel/plugin-proposal-class-properties": "^7.13.0",
56
- "@babel/plugin-proposal-export-default-from": "^7.12.13",
57
- "@babel/plugin-proposal-object-rest-spread": "^7.13.8",
58
- "@babel/plugin-syntax-export-default-from": "^7.12.13",
59
- "@babel/plugin-transform-classes": "^7.13.0",
60
- "@babel/plugin-transform-regenerator": "^7.12.13",
61
- "@babel/plugin-transform-runtime": "^7.13.10",
62
- "@babel/preset-env": "^7.13.12",
63
- "@babel/preset-typescript": "^7.13.0",
64
- "@babel/register": "^7.13.8",
65
- "@cypress/code-coverage": "^3.9.2",
66
- "@rollup/plugin-babel": "^5.3.0",
67
- "@rollup/plugin-commonjs": "^17.1.0",
68
- "@rollup/plugin-node-resolve": "^11.2.0",
69
- "@types/node": "^14.14.35",
70
- "@types/node-fetch": "^2.5.8",
71
- "@types/promise-retry": "^1.1.3",
72
- "@typescript-eslint/eslint-plugin": "^4.19.0",
73
- "@typescript-eslint/parser": "^4.19.0",
74
- "chai": "^4.3.4",
75
- "cross-env": "^7.0.3",
76
- "cypress": "^6.8.0",
77
- "eslint": "^7.22.0",
78
- "eslint-config-prettier": "^8.1.0",
79
- "eslint-import-resolver-typescript": "^2.4.0",
80
- "eslint-plugin-import": "^2.22.1",
81
- "eslint-plugin-prettier": "^3.3.1",
82
- "mocha": "^8.3.2",
83
- "node-fetch": "^2.6.1",
54
+ "@babel/core": "^7.28.4",
55
+ "@babel/plugin-transform-runtime": "^7.28.3",
56
+ "@babel/preset-env": "^7.28.3",
57
+ "@babel/preset-typescript": "^7.27.1",
58
+ "@babel/register": "^7.28.3",
59
+ "@babel/runtime": "^7.28.4",
60
+ "@codecov/rollup-plugin": "^1.9.1",
61
+ "@cypress/code-coverage": "^3.14.7",
62
+ "@eslint/js": "^9.38.0",
63
+ "@rollup/plugin-babel": "^6.1.0",
64
+ "@rollup/plugin-commonjs": "^28.0.8",
65
+ "@rollup/plugin-node-resolve": "^16.0.3",
66
+ "@rollup/plugin-terser": "^0.4.4",
67
+ "@rollup/plugin-typescript": "^12.1.4",
68
+ "@types/node": "^22.9.0",
69
+ "@types/node-fetch": "^2.6.13",
70
+ "@types/promise-retry": "^1.1.6",
71
+ "@typescript-eslint/eslint-plugin": "^8.46.1",
72
+ "@typescript-eslint/parser": "^8.46.1",
73
+ "chai": "^6.2.0",
74
+ "cross-env": "^10.1.0",
75
+ "cypress": "^15.5.0",
76
+ "eslint": "^9.38.0",
77
+ "eslint-config-prettier": "^10.1.8",
78
+ "eslint-import-resolver-typescript": "^4.4.4",
79
+ "eslint-plugin-import": "^2.32.0",
80
+ "eslint-plugin-prettier": "^5.5.4",
81
+ "fetch-mock": "^12.5.4",
82
+ "mocha": "^11.7.4",
84
83
  "nyc": "^15.1.0",
85
- "prettier": "^2.2.1",
86
- "rimraf": "^3.0.2",
87
- "rollup": "^2.42.3",
88
- "rollup-plugin-terser": "^7.0.2",
89
- "serve": "^11.3.2",
90
- "start-server-and-test": "^1.12.1",
91
- "tslint": "^6.1.3",
92
- "typescript": "^4.2.3"
84
+ "prettier": "^3.6.2",
85
+ "rimraf": "^6.0.1",
86
+ "rollup": "^4.52.5",
87
+ "serve": "^14.2.5",
88
+ "start-server-and-test": "^2.1.2",
89
+ "typescript": "^5.9.3",
90
+ "typescript-eslint": "^8.46.1",
91
+ "url": "^0.11.4"
93
92
  }
94
93
  }