@zuplo/cli 6.70.16 → 6.70.21
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.
- package/dist/cli.js +0 -6
- package/dist/cli.js.map +1 -1
- package/node_modules/@cfworker/json-schema/README.md +75 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/deep-compare-strict.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/deep-compare-strict.js +42 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/dereference.d.ts +7 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/dereference.js +147 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/format.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/format.js +111 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/index.d.ts +8 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/index.js +24 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/package.json +3 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/pointer.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/pointer.js +10 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/types.d.ts +72 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/types.js +9 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/ucs2-length.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/ucs2-length.js +20 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validate.d.ts +3 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validate.js +805 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validator.d.ts +10 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validator.js +27 -0
- package/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js +39 -0
- package/node_modules/@cfworker/json-schema/dist/esm/dereference.d.ts +7 -0
- package/node_modules/@cfworker/json-schema/dist/esm/dereference.js +143 -0
- package/node_modules/@cfworker/json-schema/dist/esm/format.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/esm/format.js +108 -0
- package/node_modules/@cfworker/json-schema/dist/esm/index.d.ts +8 -0
- package/node_modules/@cfworker/json-schema/dist/esm/index.js +8 -0
- package/node_modules/@cfworker/json-schema/dist/esm/package.json +3 -0
- package/node_modules/@cfworker/json-schema/dist/esm/pointer.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/dist/esm/pointer.js +6 -0
- package/node_modules/@cfworker/json-schema/dist/esm/types.d.ts +72 -0
- package/node_modules/@cfworker/json-schema/dist/esm/types.js +6 -0
- package/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js +17 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validate.d.ts +3 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validate.js +802 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validator.d.ts +10 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validator.js +23 -0
- package/node_modules/@cfworker/json-schema/package.json +68 -0
- package/node_modules/@cfworker/json-schema/src/deep-compare-strict.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/src/deep-compare-strict.ts +39 -0
- package/node_modules/@cfworker/json-schema/src/dereference.d.ts +12 -0
- package/node_modules/@cfworker/json-schema/src/dereference.ts +188 -0
- package/node_modules/@cfworker/json-schema/src/format.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/src/format.ts +164 -0
- package/node_modules/@cfworker/json-schema/src/index.d.ts +8 -0
- package/node_modules/@cfworker/json-schema/src/index.ts +8 -0
- package/node_modules/@cfworker/json-schema/src/pointer.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/src/pointer.ts +7 -0
- package/node_modules/@cfworker/json-schema/src/types.d.ts +79 -0
- package/node_modules/@cfworker/json-schema/src/types.ts +92 -0
- package/node_modules/@cfworker/json-schema/src/ucs2-length.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/src/ucs2-length.ts +24 -0
- package/node_modules/@cfworker/json-schema/src/validate.d.ts +13 -0
- package/node_modules/@cfworker/json-schema/src/validate.ts +1168 -0
- package/node_modules/@cfworker/json-schema/src/validator.d.ts +14 -0
- package/node_modules/@cfworker/json-schema/src/validator.ts +32 -0
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ3VHQXF.js → chunk-2ZQVIVZ3.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-STBDRSX7.js → chunk-UMZORQLU.js} +67 -66
- package/node_modules/@zuplo/runtime/out/esm/chunk-UMZORQLU.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-KWR5BV7H.js → chunk-YGYFQCBA.js} +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-YGYFQCBA.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-NJNTFB34.js → chunk-ZS34EO4B.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-NJNTFB34.js.map → chunk-ZS34EO4B.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +208 -72
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +61 -12
- package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +8 -17
- package/node_modules/@zuplo/runtime/out/types/mocks/index.d.ts +3 -12
- package/node_modules/@zuplo/runtime/package.json +3 -2
- package/node_modules/agent-base/README.md +145 -0
- package/node_modules/agent-base/dist/src/index.d.ts +78 -0
- package/node_modules/agent-base/dist/src/index.js +203 -0
- package/node_modules/agent-base/dist/src/index.js.map +1 -0
- package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- package/node_modules/agent-base/dist/src/promisify.js +18 -0
- package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- package/node_modules/agent-base/package.json +64 -0
- package/node_modules/agent-base/src/index.ts +345 -0
- package/node_modules/agent-base/src/promisify.ts +33 -0
- package/node_modules/axios/CHANGELOG.md +71 -0
- package/node_modules/axios/README.md +46 -11
- package/node_modules/axios/dist/axios.js +81 -53
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +96 -64
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +96 -64
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +206 -85
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +1 -1
- package/node_modules/axios/index.d.ts +1 -1
- package/node_modules/axios/lib/adapters/fetch.js +6 -2
- package/node_modules/axios/lib/adapters/http.js +139 -29
- package/node_modules/axios/lib/adapters/xhr.js +2 -1
- package/node_modules/axios/lib/core/AxiosHeaders.js +1 -33
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
- package/node_modules/axios/lib/helpers/formDataToJSON.js +1 -1
- package/node_modules/axios/lib/helpers/fromDataURI.js +18 -5
- package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
- package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/node_modules/axios/lib/utils.js +8 -7
- package/node_modules/axios/package.json +3 -1
- package/node_modules/https-proxy-agent/README.md +137 -0
- package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- package/node_modules/https-proxy-agent/dist/agent.js +177 -0
- package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- package/node_modules/https-proxy-agent/dist/index.js +14 -0
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/https-proxy-agent/package.json +56 -0
- package/node_modules/type-is/index.js +8 -18
- package/node_modules/type-is/node_modules/content-type/LICENSE +22 -0
- package/node_modules/type-is/node_modules/content-type/README.md +69 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +26 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js +170 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/type-is/node_modules/content-type/package.json +52 -0
- package/node_modules/type-is/package.json +9 -5
- package/package.json +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-KWR5BV7H.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-STBDRSX7.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ3VHQXF.js.map → chunk-2ZQVIVZ3.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-STBDRSX7.js.LEGAL.txt → chunk-UMZORQLU.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-KWR5BV7H.js.LEGAL.txt → chunk-YGYFQCBA.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-base",
|
|
3
|
+
"version": "6.0.2",
|
|
4
|
+
"description": "Turn a function into an `http.Agent` instance",
|
|
5
|
+
"main": "dist/src/index",
|
|
6
|
+
"typings": "dist/src/index",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/src",
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"prebuild": "rimraf dist",
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"postbuild": "cpy --parents src test '!**/*.ts' dist",
|
|
15
|
+
"test": "mocha --reporter spec dist/test/*.js",
|
|
16
|
+
"test-lint": "eslint src --ext .js,.ts",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git://github.com/TooTallNate/node-agent-base.git"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"http",
|
|
25
|
+
"agent",
|
|
26
|
+
"base",
|
|
27
|
+
"barebones",
|
|
28
|
+
"https"
|
|
29
|
+
],
|
|
30
|
+
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/TooTallNate/node-agent-base/issues"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"debug": "4"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/debug": "4",
|
|
40
|
+
"@types/mocha": "^5.2.7",
|
|
41
|
+
"@types/node": "^14.0.20",
|
|
42
|
+
"@types/semver": "^7.1.0",
|
|
43
|
+
"@types/ws": "^6.0.3",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "1.6.0",
|
|
45
|
+
"@typescript-eslint/parser": "1.1.0",
|
|
46
|
+
"async-listen": "^1.2.0",
|
|
47
|
+
"cpy-cli": "^2.0.0",
|
|
48
|
+
"eslint": "5.16.0",
|
|
49
|
+
"eslint-config-airbnb": "17.1.0",
|
|
50
|
+
"eslint-config-prettier": "4.1.0",
|
|
51
|
+
"eslint-import-resolver-typescript": "1.1.1",
|
|
52
|
+
"eslint-plugin-import": "2.16.0",
|
|
53
|
+
"eslint-plugin-jsx-a11y": "6.2.1",
|
|
54
|
+
"eslint-plugin-react": "7.12.4",
|
|
55
|
+
"mocha": "^6.2.0",
|
|
56
|
+
"rimraf": "^3.0.0",
|
|
57
|
+
"semver": "^7.1.2",
|
|
58
|
+
"typescript": "^3.5.3",
|
|
59
|
+
"ws": "^3.0.0"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">= 6.0.0"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import net from 'net';
|
|
2
|
+
import http from 'http';
|
|
3
|
+
import https from 'https';
|
|
4
|
+
import { Duplex } from 'stream';
|
|
5
|
+
import { EventEmitter } from 'events';
|
|
6
|
+
import createDebug from 'debug';
|
|
7
|
+
import promisify from './promisify';
|
|
8
|
+
|
|
9
|
+
const debug = createDebug('agent-base');
|
|
10
|
+
|
|
11
|
+
function isAgent(v: any): v is createAgent.AgentLike {
|
|
12
|
+
return Boolean(v) && typeof v.addRequest === 'function';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function isSecureEndpoint(): boolean {
|
|
16
|
+
const { stack } = new Error();
|
|
17
|
+
if (typeof stack !== 'string') return false;
|
|
18
|
+
return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent;
|
|
22
|
+
function createAgent(
|
|
23
|
+
callback: createAgent.AgentCallback,
|
|
24
|
+
opts?: createAgent.AgentOptions
|
|
25
|
+
): createAgent.Agent;
|
|
26
|
+
function createAgent(
|
|
27
|
+
callback?: createAgent.AgentCallback | createAgent.AgentOptions,
|
|
28
|
+
opts?: createAgent.AgentOptions
|
|
29
|
+
) {
|
|
30
|
+
return new createAgent.Agent(callback, opts);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
namespace createAgent {
|
|
34
|
+
export interface ClientRequest extends http.ClientRequest {
|
|
35
|
+
_last?: boolean;
|
|
36
|
+
_hadError?: boolean;
|
|
37
|
+
method: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface AgentRequestOptions {
|
|
41
|
+
host?: string;
|
|
42
|
+
path?: string;
|
|
43
|
+
// `port` on `http.RequestOptions` can be a string or undefined,
|
|
44
|
+
// but `net.TcpNetConnectOpts` expects only a number
|
|
45
|
+
port: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface HttpRequestOptions
|
|
49
|
+
extends AgentRequestOptions,
|
|
50
|
+
Omit<http.RequestOptions, keyof AgentRequestOptions> {
|
|
51
|
+
secureEndpoint: false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface HttpsRequestOptions
|
|
55
|
+
extends AgentRequestOptions,
|
|
56
|
+
Omit<https.RequestOptions, keyof AgentRequestOptions> {
|
|
57
|
+
secureEndpoint: true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type RequestOptions = HttpRequestOptions | HttpsRequestOptions;
|
|
61
|
+
|
|
62
|
+
export type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent;
|
|
63
|
+
|
|
64
|
+
export type AgentCallbackReturn = Duplex | AgentLike;
|
|
65
|
+
|
|
66
|
+
export type AgentCallbackCallback = (
|
|
67
|
+
err?: Error | null,
|
|
68
|
+
socket?: createAgent.AgentCallbackReturn
|
|
69
|
+
) => void;
|
|
70
|
+
|
|
71
|
+
export type AgentCallbackPromise = (
|
|
72
|
+
req: createAgent.ClientRequest,
|
|
73
|
+
opts: createAgent.RequestOptions
|
|
74
|
+
) =>
|
|
75
|
+
| createAgent.AgentCallbackReturn
|
|
76
|
+
| Promise<createAgent.AgentCallbackReturn>;
|
|
77
|
+
|
|
78
|
+
export type AgentCallback = typeof Agent.prototype.callback;
|
|
79
|
+
|
|
80
|
+
export type AgentOptions = {
|
|
81
|
+
timeout?: number;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Base `http.Agent` implementation.
|
|
86
|
+
* No pooling/keep-alive is implemented by default.
|
|
87
|
+
*
|
|
88
|
+
* @param {Function} callback
|
|
89
|
+
* @api public
|
|
90
|
+
*/
|
|
91
|
+
export class Agent extends EventEmitter {
|
|
92
|
+
public timeout: number | null;
|
|
93
|
+
public maxFreeSockets: number;
|
|
94
|
+
public maxTotalSockets: number;
|
|
95
|
+
public maxSockets: number;
|
|
96
|
+
public sockets: {
|
|
97
|
+
[key: string]: net.Socket[];
|
|
98
|
+
};
|
|
99
|
+
public freeSockets: {
|
|
100
|
+
[key: string]: net.Socket[];
|
|
101
|
+
};
|
|
102
|
+
public requests: {
|
|
103
|
+
[key: string]: http.IncomingMessage[];
|
|
104
|
+
};
|
|
105
|
+
public options: https.AgentOptions;
|
|
106
|
+
private promisifiedCallback?: createAgent.AgentCallbackPromise;
|
|
107
|
+
private explicitDefaultPort?: number;
|
|
108
|
+
private explicitProtocol?: string;
|
|
109
|
+
|
|
110
|
+
constructor(
|
|
111
|
+
callback?: createAgent.AgentCallback | createAgent.AgentOptions,
|
|
112
|
+
_opts?: createAgent.AgentOptions
|
|
113
|
+
) {
|
|
114
|
+
super();
|
|
115
|
+
|
|
116
|
+
let opts = _opts;
|
|
117
|
+
if (typeof callback === 'function') {
|
|
118
|
+
this.callback = callback;
|
|
119
|
+
} else if (callback) {
|
|
120
|
+
opts = callback;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Timeout for the socket to be returned from the callback
|
|
124
|
+
this.timeout = null;
|
|
125
|
+
if (opts && typeof opts.timeout === 'number') {
|
|
126
|
+
this.timeout = opts.timeout;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// These aren't actually used by `agent-base`, but are required
|
|
130
|
+
// for the TypeScript definition files in `@types/node` :/
|
|
131
|
+
this.maxFreeSockets = 1;
|
|
132
|
+
this.maxSockets = 1;
|
|
133
|
+
this.maxTotalSockets = Infinity;
|
|
134
|
+
this.sockets = {};
|
|
135
|
+
this.freeSockets = {};
|
|
136
|
+
this.requests = {};
|
|
137
|
+
this.options = {};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
get defaultPort(): number {
|
|
141
|
+
if (typeof this.explicitDefaultPort === 'number') {
|
|
142
|
+
return this.explicitDefaultPort;
|
|
143
|
+
}
|
|
144
|
+
return isSecureEndpoint() ? 443 : 80;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
set defaultPort(v: number) {
|
|
148
|
+
this.explicitDefaultPort = v;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
get protocol(): string {
|
|
152
|
+
if (typeof this.explicitProtocol === 'string') {
|
|
153
|
+
return this.explicitProtocol;
|
|
154
|
+
}
|
|
155
|
+
return isSecureEndpoint() ? 'https:' : 'http:';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
set protocol(v: string) {
|
|
159
|
+
this.explicitProtocol = v;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
callback(
|
|
163
|
+
req: createAgent.ClientRequest,
|
|
164
|
+
opts: createAgent.RequestOptions,
|
|
165
|
+
fn: createAgent.AgentCallbackCallback
|
|
166
|
+
): void;
|
|
167
|
+
callback(
|
|
168
|
+
req: createAgent.ClientRequest,
|
|
169
|
+
opts: createAgent.RequestOptions
|
|
170
|
+
):
|
|
171
|
+
| createAgent.AgentCallbackReturn
|
|
172
|
+
| Promise<createAgent.AgentCallbackReturn>;
|
|
173
|
+
callback(
|
|
174
|
+
req: createAgent.ClientRequest,
|
|
175
|
+
opts: createAgent.AgentOptions,
|
|
176
|
+
fn?: createAgent.AgentCallbackCallback
|
|
177
|
+
):
|
|
178
|
+
| createAgent.AgentCallbackReturn
|
|
179
|
+
| Promise<createAgent.AgentCallbackReturn>
|
|
180
|
+
| void {
|
|
181
|
+
throw new Error(
|
|
182
|
+
'"agent-base" has no default implementation, you must subclass and override `callback()`'
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Called by node-core's "_http_client.js" module when creating
|
|
188
|
+
* a new HTTP request with this Agent instance.
|
|
189
|
+
*
|
|
190
|
+
* @api public
|
|
191
|
+
*/
|
|
192
|
+
addRequest(req: ClientRequest, _opts: RequestOptions): void {
|
|
193
|
+
const opts: RequestOptions = { ..._opts };
|
|
194
|
+
|
|
195
|
+
if (typeof opts.secureEndpoint !== 'boolean') {
|
|
196
|
+
opts.secureEndpoint = isSecureEndpoint();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (opts.host == null) {
|
|
200
|
+
opts.host = 'localhost';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (opts.port == null) {
|
|
204
|
+
opts.port = opts.secureEndpoint ? 443 : 80;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (opts.protocol == null) {
|
|
208
|
+
opts.protocol = opts.secureEndpoint ? 'https:' : 'http:';
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (opts.host && opts.path) {
|
|
212
|
+
// If both a `host` and `path` are specified then it's most
|
|
213
|
+
// likely the result of a `url.parse()` call... we need to
|
|
214
|
+
// remove the `path` portion so that `net.connect()` doesn't
|
|
215
|
+
// attempt to open that as a unix socket file.
|
|
216
|
+
delete opts.path;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
delete opts.agent;
|
|
220
|
+
delete opts.hostname;
|
|
221
|
+
delete opts._defaultAgent;
|
|
222
|
+
delete opts.defaultPort;
|
|
223
|
+
delete opts.createConnection;
|
|
224
|
+
|
|
225
|
+
// Hint to use "Connection: close"
|
|
226
|
+
// XXX: non-documented `http` module API :(
|
|
227
|
+
req._last = true;
|
|
228
|
+
req.shouldKeepAlive = false;
|
|
229
|
+
|
|
230
|
+
let timedOut = false;
|
|
231
|
+
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
|
232
|
+
const timeoutMs = opts.timeout || this.timeout;
|
|
233
|
+
|
|
234
|
+
const onerror = (err: NodeJS.ErrnoException) => {
|
|
235
|
+
if (req._hadError) return;
|
|
236
|
+
req.emit('error', err);
|
|
237
|
+
// For Safety. Some additional errors might fire later on
|
|
238
|
+
// and we need to make sure we don't double-fire the error event.
|
|
239
|
+
req._hadError = true;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const ontimeout = () => {
|
|
243
|
+
timeoutId = null;
|
|
244
|
+
timedOut = true;
|
|
245
|
+
const err: NodeJS.ErrnoException = new Error(
|
|
246
|
+
`A "socket" was not created for HTTP request before ${timeoutMs}ms`
|
|
247
|
+
);
|
|
248
|
+
err.code = 'ETIMEOUT';
|
|
249
|
+
onerror(err);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const callbackError = (err: NodeJS.ErrnoException) => {
|
|
253
|
+
if (timedOut) return;
|
|
254
|
+
if (timeoutId !== null) {
|
|
255
|
+
clearTimeout(timeoutId);
|
|
256
|
+
timeoutId = null;
|
|
257
|
+
}
|
|
258
|
+
onerror(err);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const onsocket = (socket: AgentCallbackReturn) => {
|
|
262
|
+
if (timedOut) return;
|
|
263
|
+
if (timeoutId != null) {
|
|
264
|
+
clearTimeout(timeoutId);
|
|
265
|
+
timeoutId = null;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (isAgent(socket)) {
|
|
269
|
+
// `socket` is actually an `http.Agent` instance, so
|
|
270
|
+
// relinquish responsibility for this `req` to the Agent
|
|
271
|
+
// from here on
|
|
272
|
+
debug(
|
|
273
|
+
'Callback returned another Agent instance %o',
|
|
274
|
+
socket.constructor.name
|
|
275
|
+
);
|
|
276
|
+
(socket as createAgent.Agent).addRequest(req, opts);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (socket) {
|
|
281
|
+
socket.once('free', () => {
|
|
282
|
+
this.freeSocket(socket as net.Socket, opts);
|
|
283
|
+
});
|
|
284
|
+
req.onSocket(socket as net.Socket);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const err = new Error(
|
|
289
|
+
`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``
|
|
290
|
+
);
|
|
291
|
+
onerror(err);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
if (typeof this.callback !== 'function') {
|
|
295
|
+
onerror(new Error('`callback` is not defined'));
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (!this.promisifiedCallback) {
|
|
300
|
+
if (this.callback.length >= 3) {
|
|
301
|
+
debug('Converting legacy callback function to promise');
|
|
302
|
+
this.promisifiedCallback = promisify(this.callback);
|
|
303
|
+
} else {
|
|
304
|
+
this.promisifiedCallback = this.callback;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (typeof timeoutMs === 'number' && timeoutMs > 0) {
|
|
309
|
+
timeoutId = setTimeout(ontimeout, timeoutMs);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if ('port' in opts && typeof opts.port !== 'number') {
|
|
313
|
+
opts.port = Number(opts.port);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
try {
|
|
317
|
+
debug(
|
|
318
|
+
'Resolving socket for %o request: %o',
|
|
319
|
+
opts.protocol,
|
|
320
|
+
`${req.method} ${req.path}`
|
|
321
|
+
);
|
|
322
|
+
Promise.resolve(this.promisifiedCallback(req, opts)).then(
|
|
323
|
+
onsocket,
|
|
324
|
+
callbackError
|
|
325
|
+
);
|
|
326
|
+
} catch (err) {
|
|
327
|
+
Promise.reject(err).catch(callbackError);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
freeSocket(socket: net.Socket, opts: AgentOptions) {
|
|
332
|
+
debug('Freeing socket %o %o', socket.constructor.name, opts);
|
|
333
|
+
socket.destroy();
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
destroy() {
|
|
337
|
+
debug('Destroying agent %o', this.constructor.name);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// So that `instanceof` works correctly
|
|
342
|
+
createAgent.prototype = createAgent.Agent.prototype;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export = createAgent;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Agent,
|
|
3
|
+
ClientRequest,
|
|
4
|
+
RequestOptions,
|
|
5
|
+
AgentCallbackCallback,
|
|
6
|
+
AgentCallbackPromise,
|
|
7
|
+
AgentCallbackReturn
|
|
8
|
+
} from './index';
|
|
9
|
+
|
|
10
|
+
type LegacyCallback = (
|
|
11
|
+
req: ClientRequest,
|
|
12
|
+
opts: RequestOptions,
|
|
13
|
+
fn: AgentCallbackCallback
|
|
14
|
+
) => void;
|
|
15
|
+
|
|
16
|
+
export default function promisify(fn: LegacyCallback): AgentCallbackPromise {
|
|
17
|
+
return function(this: Agent, req: ClientRequest, opts: RequestOptions) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
fn.call(
|
|
20
|
+
this,
|
|
21
|
+
req,
|
|
22
|
+
opts,
|
|
23
|
+
(err: Error | null | undefined, rtn?: AgentCallbackReturn) => {
|
|
24
|
+
if (err) {
|
|
25
|
+
reject(err);
|
|
26
|
+
} else {
|
|
27
|
+
resolve(rtn);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.16.0 — May 2, 2026
|
|
4
|
+
|
|
5
|
+
This release adds support for the QUERY HTTP method and a new `ECONNREFUSED` error constant, lands a substantial wave of HTTP, fetch, and XHR adapter bug fixes around redirects, aborts, headers, and timeouts, and welcomes 23 new contributors.
|
|
6
|
+
|
|
7
|
+
## ⚠️ Notable Changes
|
|
8
|
+
|
|
9
|
+
A handful of fixes in this release are either security-adjacent or change observable behaviour. Please review before upgrading:
|
|
10
|
+
|
|
11
|
+
- **Fetch adapter now enforces `maxBodyLength` and `maxContentLength`.** These limits were silently ignored on the fetch adapter prior to 1.16.0 — anyone relying on them as a safety net (DoS protection, accidental large uploads) had no protection. (**#10795**)
|
|
12
|
+
- **Proxy requests now preserve user-supplied `Host` headers.** Previously, the proxy path could overwrite a custom `Host`. Virtual-host-style routing through a proxy will now behave correctly. (**#10822**)
|
|
13
|
+
- **Basic auth credentials embedded in URLs are now URL-decoded.** If you have percent-encoded credentials in a URL (e.g. `https://user:p%40ss@host`), the decoded value is what now goes on the wire. (**#10825**)
|
|
14
|
+
- **`parseProtocol` now strictly requires a colon in the protocol separator.** Strings that loosely parsed as protocols before may no longer match. (**#10729**)
|
|
15
|
+
- **Deprecated `unescape()` replaced with modern UTF-8 encoding.** Non-ASCII URL handling is now spec-correct; consumers depending on legacy `unescape()` quirks may see different output bytes. (**#7378**)
|
|
16
|
+
- **`transformRequest` input typing change was reverted.** The typing change introduced in #10745 was reverted in #10810 after follow-up review — net behavior is unchanged from 1.15.2. (**#10745**, **#10810**)
|
|
17
|
+
|
|
18
|
+
## 🚀 New Features
|
|
19
|
+
|
|
20
|
+
- **QUERY HTTP Method:** Added support for the QUERY HTTP method across adapters and type definitions. (**#10802**)
|
|
21
|
+
- **ECONNREFUSED Error Constant:** Exposed `ECONNREFUSED` as a constant on `AxiosError` so callers can match connection-refused failures without comparing string literals (closes #6485). (**#10680**)
|
|
22
|
+
- **Encode Helper Export:** Exported the internal `encode` helper from `buildURL` so userland param serializers can reuse the same encoding logic that axios uses internally. (**#6897**)
|
|
23
|
+
|
|
24
|
+
## 🐛 Bug Fixes
|
|
25
|
+
|
|
26
|
+
- **HTTP Adapter — Redirects & Headers:** Cleared stale headers when a redirect targets a no-proxy host, fixed the redirect listener chain so listeners no longer stack across hops, restored the missing `requestDetails` argument on `beforeRedirect`, preserved user-supplied `Host` headers when forwarding through a proxy, and properly URL-decoded basic auth credentials. (**#10794**, **#10800**, **#6241**, **#10822**, **#10825**)
|
|
27
|
+
- **HTTP Adapter — Streams & Timeouts:** Preserved the partial response object on `AxiosError` when a stream is aborted after headers arrive, honoured the `timeout` option during the connect phase when redirects are disabled, and resolved an unsettled-promise hang when an aborted request was combined with compression and `maxRedirects: 0`. (**#10708**, **#10819**, **#7149**)
|
|
28
|
+
- **Fetch Adapter:** Enforced `maxBodyLength` / `maxContentLength` in the fetch adapter, set the `User-Agent` header to match the HTTP adapter, preserved the original abort reason instead of replacing it with a generic error, and deferred global access so importing the module no longer throws a `TypeError` in restricted environments. (**#10795**, **#10772**, **#10806**, **#7260**)
|
|
29
|
+
- **XHR Adapter:** Unsubscribed the `cancelToken` and `AbortSignal` listeners on the error, timeout, and abort code paths to prevent leaked subscriptions. (**#10787**)
|
|
30
|
+
- **Error Handling:** Attached the parsed response to `AxiosError` when `JSON.parse` fails inside `dispatchRequest`, prevented `settle` from emitting `undefined` error codes, and tightened the `parseProtocol` regex to require a colon in the protocol separator. (**#10724**, **#7276**, **#10729**)
|
|
31
|
+
- **Types & Exports:** Aligned the CommonJS `CancelToken` typings with the ESM build, fixed a compiler error caused by `RawAxiosHeaders`, and re-exported `create` from the package index. (**#7414**, **#6389**, **#6460**)
|
|
32
|
+
- **UTF-8 Encoding:** Replaced the deprecated `unescape()` call with a modern UTF-8 encoding implementation. (**#7378**)
|
|
33
|
+
- **Misc Cleanup:** Resolved a batch of small inconsistencies and gadget-level issues across the codebase. (**#10833**)
|
|
34
|
+
|
|
35
|
+
## 🔧 Maintenance & Chores
|
|
36
|
+
|
|
37
|
+
- **Refactor — ES6 Modernisation:** Modernised the `utils` module and XHR adapter to use ES6 features, and tidied the multipart boundary error message. (**#10588**, **#7419**)
|
|
38
|
+
- **Tests:** Hardened the HTTP test server lifecycle to fix flaky `FormData` EPIPE failures, fixed Win32 platform support for the pipe tests, and corrected an incorrect test assumption. (**#10820**, **#10791**, **#10796**)
|
|
39
|
+
- **Docs:** Documented `paramsSerializer.encode` for strict RFC 3986 query encoding, updated the `parseReviver` TypeScript definitions and configuration docs for ES2023, added timeout guidance to the README's first async example, and expanded notes around the recent type changes. (**#10821**, **#10782**, **#10759**, **#10804**)
|
|
40
|
+
- **Reverted:** Reverted the `transformRequest` input typing change from #10745 after follow-up review. (**#10745**, **#10810**)
|
|
41
|
+
- **Dependencies:** Bumped `actions/setup-node`, the `github-actions` group, and `postcss` (in `/docs`) to their latest versions. (**#10785**, **#10813**, **#10814**)
|
|
42
|
+
- **Release:** Updated changelog and packages, and prepared the 1.16.0 release. (**#10790**, **#10834**)
|
|
43
|
+
|
|
44
|
+
## 🌟 New Contributors
|
|
45
|
+
|
|
46
|
+
We are thrilled to welcome our new contributors. Thank you for helping improve axios:
|
|
47
|
+
|
|
48
|
+
- **@singhankit001** (**#10588**)
|
|
49
|
+
- **@cuiweixie** (**#7419**)
|
|
50
|
+
- **@iruizsalinas** (**#10787**)
|
|
51
|
+
- **@MarcosNocetti** (**#10680**)
|
|
52
|
+
- **@deepview-autofix** (**#10729**)
|
|
53
|
+
- **@atharvasingh7007** (**#10745**)
|
|
54
|
+
- **@OfekDanny** (**#10772**)
|
|
55
|
+
- **@mnahkies** (**#7414**)
|
|
56
|
+
- **@tboyila** (**#10759**)
|
|
57
|
+
- **@Kingo64** (**#6897**)
|
|
58
|
+
- **@ramram1048** (**#6389**)
|
|
59
|
+
- **@FLNacif** (**#6460**)
|
|
60
|
+
- **@zozo123** (**#10806**)
|
|
61
|
+
- **@pierluigilenoci** (**#10802**)
|
|
62
|
+
- **@afurm** (**#10708**)
|
|
63
|
+
- **@karan-lrn** (**#7378**)
|
|
64
|
+
- **@ebeigarts** (**#7149**)
|
|
65
|
+
- **@Raymondo97** (**#10782**)
|
|
66
|
+
- **@mixelburg** (**#10821**)
|
|
67
|
+
- **@ashishkr96** (**#10822**)
|
|
68
|
+
- **@cyphercodes** (**#10819**)
|
|
69
|
+
- **@Jye10032** (**#7260**)
|
|
70
|
+
- **@VeerShah41** (**#7276**)
|
|
71
|
+
|
|
72
|
+
[Full Changelog](https://github.com/axios/axios/compare/v1.15.2...v1.16.0)
|
|
73
|
+
|
|
3
74
|
## v1.15.2 - April 21, 2026
|
|
4
75
|
|
|
5
76
|
This release delivers prototype-pollution hardening for the Node HTTP adapter, adds an opt-in `allowedSocketPaths` allowlist to mitigate SSRF via Unix domain sockets, fixes a keep-alive socket memory leak, and ships supply-chain hardening across CI and security docs.
|
|
@@ -244,14 +244,13 @@
|
|
|
244
244
|
width="71px"
|
|
245
245
|
height="70px"
|
|
246
246
|
src="https://images.opencollective.com/buzzoid-buy-instagram-followers/56a09fe/logo.png"
|
|
247
|
-
alt="Buzzoid"
|
|
247
|
+
alt="Buzzoid - Buy Instagram Followers"
|
|
248
248
|
/>
|
|
249
249
|
</a>
|
|
250
250
|
<p
|
|
251
251
|
align="center"
|
|
252
252
|
>
|
|
253
|
-
|
|
254
|
-
platform
|
|
253
|
+
At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world's #1 IG service since 2012.
|
|
255
254
|
</p>
|
|
256
255
|
<p align="center">
|
|
257
256
|
<a
|
|
@@ -263,10 +262,29 @@
|
|
|
263
262
|
</td>
|
|
264
263
|
<td align="center" width="33.333333333333336%">
|
|
265
264
|
<a
|
|
266
|
-
href="https://
|
|
265
|
+
href="https://twicsy.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
266
|
+
style="padding: 10px; display: inline-block"
|
|
267
267
|
target="_blank"
|
|
268
|
-
>💜 Become a sponsor</a
|
|
269
268
|
>
|
|
269
|
+
<img
|
|
270
|
+
width="71px"
|
|
271
|
+
height="70px"
|
|
272
|
+
src="https://images.opencollective.com/buy-instagram-followers-twicsy/b4c5d7f/logo/256.png?height=256"
|
|
273
|
+
alt="Buy Instagram Followers Twicsy"
|
|
274
|
+
/>
|
|
275
|
+
</a>
|
|
276
|
+
<p
|
|
277
|
+
align="center"
|
|
278
|
+
>
|
|
279
|
+
Buy real Instagram followers from Twicsy. Twicsy has been voted the best site to buy followers from the likes of US Magazine.
|
|
280
|
+
</p>
|
|
281
|
+
<p align="center">
|
|
282
|
+
<a
|
|
283
|
+
href="https://twicsy.com/buy-instagram-followers/?utm_source=axios_docs_website&utm_medium=website&utm_campaign=axios_open_collective_sponsorship"
|
|
284
|
+
target="_blank"
|
|
285
|
+
><b>twicsy.com</b></a
|
|
286
|
+
>
|
|
287
|
+
</p>
|
|
270
288
|
</td>
|
|
271
289
|
<td align="center" width="33.333333333333336%">
|
|
272
290
|
<a
|
|
@@ -495,8 +513,16 @@ axios
|
|
|
495
513
|
// Want to use async/await? Add the `async` keyword to your outer function/method.
|
|
496
514
|
async function getUser() {
|
|
497
515
|
try {
|
|
498
|
-
|
|
499
|
-
|
|
516
|
+
// Example: GET request with query parameters
|
|
517
|
+
const response = await axios.get('/user', {
|
|
518
|
+
params: {
|
|
519
|
+
ID: 12345
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
// Using the `params` option improves readability and automatically formats query strings
|
|
524
|
+
|
|
525
|
+
console.log(response);
|
|
500
526
|
} catch (error) {
|
|
501
527
|
console.error(error);
|
|
502
528
|
}
|
|
@@ -934,15 +960,24 @@ These are the available config options for making requests. Only the `url` is re
|
|
|
934
960
|
// Use `false` to disable proxies, ignoring environment variables.
|
|
935
961
|
// `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
|
|
936
962
|
// supplies credentials.
|
|
937
|
-
//
|
|
938
|
-
// `Proxy-Authorization`
|
|
963
|
+
// For `http://` targets, axios sends the request to the proxy in
|
|
964
|
+
// forward-proxy mode and stamps `Proxy-Authorization` onto the request
|
|
965
|
+
// headers (overwriting any user-supplied `Proxy-Authorization` header).
|
|
966
|
+
// For `https://` targets, axios establishes a CONNECT tunnel through the
|
|
967
|
+
// proxy and performs TLS end-to-end with the origin; `Proxy-Authorization`
|
|
968
|
+
// is sent on the CONNECT request only, never on the wrapped TLS request,
|
|
969
|
+
// so the proxy never sees the URL, headers, or body. Supply a custom
|
|
970
|
+
// `httpsAgent` to opt out of automatic CONNECT tunneling.
|
|
939
971
|
// If the proxy server uses HTTPS, then you must set the protocol to `https`.
|
|
940
972
|
// A user-supplied `Host` header in `headers` is preserved when forwarding
|
|
941
973
|
// through a proxy (case-insensitive match on `host`/`Host`/`HOST`); this
|
|
942
974
|
// lets you target a virtual host that differs from the request URL — for
|
|
943
975
|
// example, hitting `127.0.0.1:4000` while having the proxy treat the
|
|
944
976
|
// request as `example.com`. If no `Host` header is supplied, axios
|
|
945
|
-
// defaults it to the request URL's `hostname:port` as before.
|
|
977
|
+
// defaults it to the request URL's `hostname:port` as before. The Host
|
|
978
|
+
// header is only set in forward-proxy mode (HTTP targets); for HTTPS
|
|
979
|
+
// tunneling the Host header is sent inside the TLS connection, not seen
|
|
980
|
+
// by the proxy.
|
|
946
981
|
proxy: {
|
|
947
982
|
protocol: 'https',
|
|
948
983
|
host: '127.0.0.1',
|
|
@@ -1180,7 +1215,7 @@ const instance = axios.create();
|
|
|
1180
1215
|
const myInterceptor = instance.interceptors.request.use(function () {
|
|
1181
1216
|
/*...*/
|
|
1182
1217
|
});
|
|
1183
|
-
|
|
1218
|
+
instance.interceptors.request.eject(myInterceptor);
|
|
1184
1219
|
```
|
|
1185
1220
|
|
|
1186
1221
|
You can also clear all interceptors for requests or responses.
|