@verdaccio/proxy 6.0.0-6-next.52 → 6.0.0-6-next.53
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/CHANGELOG.md +14 -0
- package/build/agent.d.ts +1 -1
- package/build/agent.js.map +1 -1
- package/build/proxy.d.ts +12 -13
- package/build/proxy.js +49 -41
- package/build/proxy.js.map +1 -1
- package/package.json +9 -12
- package/src/agent.ts +1 -1
- package/src/proxy.ts +60 -47
- package/test/headers.auth.spec.ts +16 -4
- package/test/noProxy.spec.ts +4 -2
- package/test/proxy.metadata.spec.ts +147 -31
- package/test/proxy.search.spec.ts +37 -53
- package/test/proxy.tarball.spec.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @verdaccio/proxy
|
|
2
2
|
|
|
3
|
+
## 6.0.0-6-next.53
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0a6412ca9: feat: refactor proxy with got v12
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 0a6412ca9: refactor: got instead undici
|
|
12
|
+
- Updated dependencies [0a6412ca9]
|
|
13
|
+
- @verdaccio/core@6.0.0-6-next.75
|
|
14
|
+
- @verdaccio/config@6.0.0-6-next.75
|
|
15
|
+
- @verdaccio/utils@6.0.0-6-next.43
|
|
16
|
+
|
|
3
17
|
## 6.0.0-6-next.52
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/build/agent.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { Agents } from 'got';
|
|
3
|
+
import { Agents } from 'got-cjs';
|
|
4
4
|
import { AgentOptions as HttpAgentOptions } from 'http';
|
|
5
5
|
import { AgentOptions as HttpsAgentOptions } from 'https';
|
|
6
6
|
export type AgentOptionsConf = HttpAgentOptions | HttpsAgentOptions;
|
package/build/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","names":["_hpagent","require","_http","_https","_url","CustomAgents","constructor","url","proxy","agentOptions","protocol","getParsedUrl","agent","getAgent","get","isHTTPS","options","https","HttpsProxyAgent","http","HttpProxyAgent","HttpsAgent","HttpAgent","URL","_default","exports","default"],"sources":["../src/agent.ts"],"sourcesContent":["import { Agents } from 'got';\nimport { HttpProxyAgent, HttpsProxyAgent } from 'hpagent';\nimport { Agent as HttpAgent, AgentOptions as HttpAgentOptions } from 'http';\nimport { Agent as HttpsAgent, AgentOptions as HttpsAgentOptions } from 'https';\nimport { URL } from 'url';\n\nexport type AgentOptionsConf = HttpAgentOptions | HttpsAgentOptions;\n\nclass CustomAgents {\n private url: string;\n private proxy: string | undefined;\n private agentOptions: HttpAgentOptions | HttpsAgentOptions;\n private agent: Agents;\n public constructor(\n url: string,\n proxy: string | undefined,\n agentOptions: HttpAgentOptions | HttpsAgentOptions\n ) {\n this.proxy = proxy;\n this.url = url;\n this.agentOptions = agentOptions;\n const { protocol } = this.getParsedUrl();\n this.agent = this.getAgent(protocol);\n }\n\n public get() {\n return this.agent;\n }\n\n private getAgent(protocol: string): Agents {\n const isHTTPS = protocol === 'https:';\n if (this.proxy) {\n const options = {\n proxy: this.proxy,\n ...this.agentOptions,\n };\n // use hpagent\n return isHTTPS\n ? { https: new HttpsProxyAgent(options) }\n : { http: new HttpProxyAgent(options) };\n } else {\n // use native http/https agent\n return isHTTPS\n ? { https: new HttpsAgent(this.agentOptions) }\n : { http: new HttpAgent(this.agentOptions) };\n }\n }\n\n private getParsedUrl() {\n return this.proxy ? new URL(this.proxy) : new URL(this.url);\n }\n}\n\nexport default CustomAgents;\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;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file":"agent.js","names":["_hpagent","require","_http","_https","_url","CustomAgents","constructor","url","proxy","agentOptions","protocol","getParsedUrl","agent","getAgent","get","isHTTPS","options","https","HttpsProxyAgent","http","HttpProxyAgent","HttpsAgent","HttpAgent","URL","_default","exports","default"],"sources":["../src/agent.ts"],"sourcesContent":["import { Agents } from 'got-cjs';\nimport { HttpProxyAgent, HttpsProxyAgent } from 'hpagent';\nimport { Agent as HttpAgent, AgentOptions as HttpAgentOptions } from 'http';\nimport { Agent as HttpsAgent, AgentOptions as HttpsAgentOptions } from 'https';\nimport { URL } from 'url';\n\nexport type AgentOptionsConf = HttpAgentOptions | HttpsAgentOptions;\n\nclass CustomAgents {\n private url: string;\n private proxy: string | undefined;\n private agentOptions: HttpAgentOptions | HttpsAgentOptions;\n private agent: Agents;\n public constructor(\n url: string,\n proxy: string | undefined,\n agentOptions: HttpAgentOptions | HttpsAgentOptions\n ) {\n this.proxy = proxy;\n this.url = url;\n this.agentOptions = agentOptions;\n const { protocol } = this.getParsedUrl();\n this.agent = this.getAgent(protocol);\n }\n\n public get() {\n return this.agent;\n }\n\n private getAgent(protocol: string): Agents {\n const isHTTPS = protocol === 'https:';\n if (this.proxy) {\n const options = {\n proxy: this.proxy,\n ...this.agentOptions,\n };\n // use hpagent\n return isHTTPS\n ? { https: new HttpsProxyAgent(options) }\n : { http: new HttpProxyAgent(options) };\n } else {\n // use native http/https agent\n return isHTTPS\n ? { https: new HttpsAgent(this.agentOptions) }\n : { http: new HttpAgent(this.agentOptions) };\n }\n }\n\n private getParsedUrl() {\n return this.proxy ? new URL(this.proxy) : new URL(this.url);\n }\n}\n\nexport default CustomAgents;\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAIA,MAAMI,YAAY,CAAC;EAKVC,WAAWA,CAChBC,GAAW,EACXC,KAAyB,EACzBC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types="node" />
|
|
3
|
-
import { Headers as gotHeaders } from 'got';
|
|
4
|
-
import type { Agents, Options } from 'got';
|
|
3
|
+
import { Agents, Delays, Options, RetryOptions, Headers as gotHeaders } from 'got-cjs';
|
|
5
4
|
import Stream, { PassThrough } from 'stream';
|
|
6
|
-
import { Headers } from 'undici';
|
|
7
5
|
import { URL } from 'url';
|
|
8
6
|
import { searchUtils } from '@verdaccio/core';
|
|
9
7
|
import { Manifest } from '@verdaccio/types';
|
|
@@ -16,10 +14,11 @@ export interface ProxyList {
|
|
|
16
14
|
[key: string]: IProxy;
|
|
17
15
|
}
|
|
18
16
|
export type ProxySearchParams = {
|
|
19
|
-
headers?: Headers;
|
|
20
17
|
url: string;
|
|
21
|
-
query?: searchUtils.SearchQuery;
|
|
22
18
|
abort: AbortController;
|
|
19
|
+
query?: searchUtils.SearchQuery;
|
|
20
|
+
headers?: Headers;
|
|
21
|
+
retry?: Partial<RetryOptions>;
|
|
23
22
|
};
|
|
24
23
|
export interface IProxy {
|
|
25
24
|
config: UpLinkConfLocal;
|
|
@@ -30,13 +29,13 @@ export interface IProxy {
|
|
|
30
29
|
server_id: string;
|
|
31
30
|
url: URL;
|
|
32
31
|
maxage: number;
|
|
33
|
-
timeout:
|
|
32
|
+
timeout: Delays;
|
|
34
33
|
max_fails: number;
|
|
35
34
|
fail_timeout: number;
|
|
36
35
|
upname: string;
|
|
37
36
|
search(options: ProxySearchParams): Promise<Stream.Readable>;
|
|
38
|
-
getRemoteMetadata(name: string, options: ISyncUplinksOptions): Promise<[Manifest, string]>;
|
|
39
|
-
fetchTarball(url: string, options: Pick<ISyncUplinksOptions, 'remoteAddress' | 'etag' | 'retry'
|
|
37
|
+
getRemoteMetadata(name: string, options: Partial<ISyncUplinksOptions>): Promise<[Manifest, string]>;
|
|
38
|
+
fetchTarball(url: string, options: Partial<Pick<ISyncUplinksOptions, 'remoteAddress' | 'etag' | 'retry'>>): PassThrough;
|
|
40
39
|
}
|
|
41
40
|
export { Options as FetchOptions };
|
|
42
41
|
export interface ISyncUplinksOptions extends Options {
|
|
@@ -57,7 +56,7 @@ declare class ProxyStorage implements IProxy {
|
|
|
57
56
|
server_id: string;
|
|
58
57
|
url: URL;
|
|
59
58
|
maxage: number;
|
|
60
|
-
timeout:
|
|
59
|
+
timeout: Delays;
|
|
61
60
|
max_fails: number;
|
|
62
61
|
fail_timeout: number;
|
|
63
62
|
agent_options: AgentOptionsConf;
|
|
@@ -67,9 +66,9 @@ declare class ProxyStorage implements IProxy {
|
|
|
67
66
|
last_request_time: number | null;
|
|
68
67
|
strict_ssl: boolean;
|
|
69
68
|
private retry;
|
|
70
|
-
constructor(config: UpLinkConfLocal, mainConfig: Config, agent?: Agents);
|
|
69
|
+
constructor(config: UpLinkConfLocal, mainConfig: Config, logger: Logger, agent?: Agents);
|
|
71
70
|
private getAgent;
|
|
72
|
-
|
|
71
|
+
getHeaders(headers?: {}): gotHeaders;
|
|
73
72
|
/**
|
|
74
73
|
* Validate configuration auth and assign Header authorization
|
|
75
74
|
* @param {Object} headers
|
|
@@ -113,14 +112,14 @@ declare class ProxyStorage implements IProxy {
|
|
|
113
112
|
*/
|
|
114
113
|
private _overrideWithUpLinkConfLocaligHeaders;
|
|
115
114
|
private applyUplinkHeaders;
|
|
116
|
-
getRemoteMetadata(name: string, options: ISyncUplinksOptions): Promise<[Manifest, string]>;
|
|
115
|
+
getRemoteMetadata(name: string, options: Partial<ISyncUplinksOptions>): Promise<[Manifest, string]>;
|
|
117
116
|
fetchTarball(url: string, overrideOptions: Pick<ISyncUplinksOptions, 'remoteAddress' | 'etag' | 'retry'>): any;
|
|
118
117
|
/**
|
|
119
118
|
* Perform a stream search.
|
|
120
119
|
* @param {*} options request options
|
|
121
120
|
* @return {Stream}
|
|
122
121
|
*/
|
|
123
|
-
search({ url, abort }: ProxySearchParams): Promise<Stream.Readable>;
|
|
122
|
+
search({ url, abort, retry }: ProxySearchParams): Promise<Stream.Readable>;
|
|
124
123
|
private addProxyHeaders;
|
|
125
124
|
/**
|
|
126
125
|
* If the request failure.
|
package/build/proxy.js
CHANGED
|
@@ -3,20 +3,26 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "FetchOptions", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _gotCjs.Options;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
exports.ProxyStorage = void 0;
|
|
7
13
|
var _JSONStream = _interopRequireDefault(require("JSONStream"));
|
|
8
14
|
var _debug = _interopRequireDefault(require("debug"));
|
|
9
|
-
var
|
|
15
|
+
var _gotCjs = _interopRequireWildcard(require("got-cjs"));
|
|
10
16
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
11
17
|
var _stream = require("stream");
|
|
12
|
-
var _undici = require("undici");
|
|
13
18
|
var _url = require("url");
|
|
14
19
|
var _core = require("@verdaccio/core");
|
|
15
20
|
var _utils = require("@verdaccio/utils");
|
|
16
21
|
var _agent = _interopRequireDefault(require("./agent"));
|
|
17
22
|
var _proxyUtils = require("./proxy-utils");
|
|
23
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
const LoggerApi = require('@verdaccio/logger');
|
|
20
26
|
const debug = (0, _debug.default)('verdaccio:proxy');
|
|
21
27
|
const encode = function (thing) {
|
|
22
28
|
return encodeURIComponent(thing).replace(/^%40/, '@');
|
|
@@ -41,14 +47,12 @@ class ProxyStorage {
|
|
|
41
47
|
// FIXME: upname is assigned to each instance
|
|
42
48
|
// @ts-ignore
|
|
43
49
|
// @ts-ignore
|
|
44
|
-
constructor(config, mainConfig, agent) {
|
|
50
|
+
constructor(config, mainConfig, logger, agent) {
|
|
45
51
|
this.config = config;
|
|
46
52
|
this.failed_requests = 0;
|
|
47
53
|
this.userAgent = mainConfig.user_agent ?? 'hidden';
|
|
48
54
|
this.ca = config.ca;
|
|
49
|
-
this.logger =
|
|
50
|
-
sub: 'out'
|
|
51
|
-
});
|
|
55
|
+
this.logger = logger;
|
|
52
56
|
this.server_id = mainConfig.server_id;
|
|
53
57
|
this.agent_options = setConfig(this.config, 'agent_options', {
|
|
54
58
|
keepAlive: true,
|
|
@@ -67,7 +71,10 @@ class ProxyStorage {
|
|
|
67
71
|
// a bunch of different configurable timers
|
|
68
72
|
this.maxage = (0, _proxyUtils.parseInterval)(setConfig(this.config, 'maxage', '2m'));
|
|
69
73
|
// https://github.com/sindresorhus/got/blob/main/documentation/6-timeout.md
|
|
70
|
-
this.timeout =
|
|
74
|
+
this.timeout = {
|
|
75
|
+
request: (0, _proxyUtils.parseInterval)(setConfig(this.config, 'timeout', '30s'))
|
|
76
|
+
};
|
|
77
|
+
debug('set timeout %s', this.timeout);
|
|
71
78
|
this.max_fails = Number(setConfig(this.config, 'max_fails', this.config.max_fails ?? 2));
|
|
72
79
|
this.fail_timeout = (0, _proxyUtils.parseInterval)(setConfig(this.config, 'fail_timeout', '5m'));
|
|
73
80
|
this.strict_ssl = Boolean(setConfig(this.config, 'strict_ssl', true));
|
|
@@ -84,7 +91,7 @@ class ProxyStorage {
|
|
|
84
91
|
return this.agent;
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
|
-
|
|
94
|
+
getHeaders(headers = {}) {
|
|
88
95
|
const accept = _core.HEADERS.ACCEPT;
|
|
89
96
|
const acceptEncoding = _core.HEADERS.ACCEPT_ENCODING;
|
|
90
97
|
const userAgent = _core.HEADERS.USER_AGENT;
|
|
@@ -215,8 +222,8 @@ class ProxyStorage {
|
|
|
215
222
|
}
|
|
216
223
|
|
|
217
224
|
// FUTURE: allow mix headers that comes from the client
|
|
218
|
-
debug('
|
|
219
|
-
let headers = this.
|
|
225
|
+
debug('getting metadata for package %s', name);
|
|
226
|
+
let headers = this.getHeaders(options === null || options === void 0 ? void 0 : options.headers);
|
|
220
227
|
headers = this.addProxyHeaders(headers, options.remoteAddress);
|
|
221
228
|
headers = this.applyUplinkHeaders(headers);
|
|
222
229
|
// the following headers cannot be overwritten
|
|
@@ -226,27 +233,24 @@ class ProxyStorage {
|
|
|
226
233
|
}
|
|
227
234
|
const method = options.method || 'GET';
|
|
228
235
|
const uri = this.config.url + `/${encode(name)}`;
|
|
229
|
-
debug('
|
|
236
|
+
debug('set retry limit is %s', this.retry.limit);
|
|
230
237
|
let response;
|
|
231
238
|
let responseLength = 0;
|
|
232
239
|
try {
|
|
233
240
|
var _response;
|
|
234
241
|
const retry = (options === null || options === void 0 ? void 0 : options.retry) ?? this.retry;
|
|
235
|
-
debug('retry
|
|
236
|
-
response = await (0,
|
|
242
|
+
debug('retry initial count %s', retry);
|
|
243
|
+
response = await (0, _gotCjs.default)(uri, {
|
|
237
244
|
headers,
|
|
238
245
|
responseType: 'json',
|
|
239
246
|
method,
|
|
240
247
|
agent: this.agent,
|
|
241
248
|
retry,
|
|
242
|
-
|
|
243
|
-
timeout: {
|
|
244
|
-
request: (options === null || options === void 0 ? void 0 : options.timeout) ?? this.timeout
|
|
245
|
-
},
|
|
249
|
+
timeout: this.timeout,
|
|
246
250
|
hooks: {
|
|
247
251
|
afterResponse: [afterResponse => {
|
|
248
252
|
const code = afterResponse.statusCode;
|
|
249
|
-
debug('
|
|
253
|
+
debug('after response code is %s', code);
|
|
250
254
|
if (code >= _core.HTTP_STATUS.OK && code < _core.HTTP_STATUS.MULTIPLE_CHOICES) {
|
|
251
255
|
if (this.failed_requests >= this.max_fails) {
|
|
252
256
|
this.failed_requests = 0;
|
|
@@ -257,9 +261,8 @@ class ProxyStorage {
|
|
|
257
261
|
}
|
|
258
262
|
return afterResponse;
|
|
259
263
|
}],
|
|
260
|
-
beforeRetry: [
|
|
261
|
-
|
|
262
|
-
(_options, error, count) => {
|
|
264
|
+
beforeRetry: [(error, count) => {
|
|
265
|
+
debug('retry %s count: %s', uri, count);
|
|
263
266
|
this.failed_requests = count ?? 0;
|
|
264
267
|
this.logger.info({
|
|
265
268
|
request: {
|
|
@@ -317,9 +320,10 @@ class ProxyStorage {
|
|
|
317
320
|
}, message);
|
|
318
321
|
return [data, etag];
|
|
319
322
|
} catch (err) {
|
|
320
|
-
debug('uri %s
|
|
323
|
+
debug('error %s on uri %s', err.code, uri);
|
|
321
324
|
if (err.code === 'ERR_NON_2XX_3XX_RESPONSE') {
|
|
322
325
|
const code = err.response.statusCode;
|
|
326
|
+
debug('error code %s', code);
|
|
323
327
|
if (code === _core.HTTP_STATUS.NOT_FOUND) {
|
|
324
328
|
throw _core.errorUtils.getNotFound(_core.errorUtils.API_ERROR.NOT_PACKAGE_UPLINK);
|
|
325
329
|
}
|
|
@@ -329,6 +333,13 @@ class ProxyStorage {
|
|
|
329
333
|
error.remoteStatus = code;
|
|
330
334
|
throw error;
|
|
331
335
|
}
|
|
336
|
+
} else if (err.code === 'ETIMEDOUT') {
|
|
337
|
+
debug('error code timeout');
|
|
338
|
+
const code = err.code;
|
|
339
|
+
const error = _core.errorUtils.getInternalError(`${_core.errorUtils.API_ERROR.SERVER_TIME_OUT}: ${code}`);
|
|
340
|
+
// we need this code to identify outside which status code triggered the error
|
|
341
|
+
error.remoteStatus = code;
|
|
342
|
+
throw error;
|
|
332
343
|
}
|
|
333
344
|
throw err;
|
|
334
345
|
}
|
|
@@ -341,7 +352,7 @@ class ProxyStorage {
|
|
|
341
352
|
...this.config,
|
|
342
353
|
...overrideOptions
|
|
343
354
|
};
|
|
344
|
-
let headers = this.
|
|
355
|
+
let headers = this.getHeaders(options === null || options === void 0 ? void 0 : options.headers);
|
|
345
356
|
headers = this.addProxyHeaders(headers, options.remoteAddress);
|
|
346
357
|
headers = this.applyUplinkHeaders(headers);
|
|
347
358
|
// the following headers cannot be overwritten
|
|
@@ -352,7 +363,7 @@ class ProxyStorage {
|
|
|
352
363
|
const method = 'GET';
|
|
353
364
|
// const uri = this.config.url + `/${encode(name)}`;
|
|
354
365
|
debug('request uri for %s', url);
|
|
355
|
-
const readStream =
|
|
366
|
+
const readStream = _gotCjs.default.stream(url, {
|
|
356
367
|
headers,
|
|
357
368
|
method,
|
|
358
369
|
agent: this.agent,
|
|
@@ -372,10 +383,9 @@ class ProxyStorage {
|
|
|
372
383
|
*/
|
|
373
384
|
async search({
|
|
374
385
|
url,
|
|
375
|
-
abort
|
|
386
|
+
abort,
|
|
387
|
+
retry
|
|
376
388
|
}) {
|
|
377
|
-
debug('search url %o', url);
|
|
378
|
-
let response;
|
|
379
389
|
try {
|
|
380
390
|
const fullURL = new _url.URL(`${this.url}${url}`);
|
|
381
391
|
// FIXME: a better way to remove duplicate slashes?
|
|
@@ -384,23 +394,17 @@ class ProxyStorage {
|
|
|
384
394
|
uri,
|
|
385
395
|
uplink: this.upname
|
|
386
396
|
}, 'search request to uplink @{uplink} - @{uri}');
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
// }),
|
|
394
|
-
signal: abort === null || abort === void 0 ? void 0 : abort.signal
|
|
397
|
+
debug('searching on %s', uri);
|
|
398
|
+
const response = (0, _gotCjs.default)(uri, {
|
|
399
|
+
signal: abort ? abort.signal : {},
|
|
400
|
+
agent: this.agent,
|
|
401
|
+
timeout: this.timeout,
|
|
402
|
+
retry: retry ?? this.retry
|
|
395
403
|
});
|
|
396
|
-
|
|
397
|
-
if (response.status >= _core.HTTP_STATUS.BAD_REQUEST) {
|
|
398
|
-
throw _core.errorUtils.getInternalError(`bad status code ${response.status} from uplink`);
|
|
399
|
-
}
|
|
404
|
+
const res = await response.text();
|
|
400
405
|
const streamSearch = new _stream.PassThrough({
|
|
401
406
|
objectMode: true
|
|
402
407
|
});
|
|
403
|
-
const res = await response.text();
|
|
404
408
|
const streamResponse = _stream.Readable.from(res);
|
|
405
409
|
// objects is one of the properties on the body, it ignores date and total
|
|
406
410
|
streamResponse.pipe(_JSONStream.default.parse('objects')).pipe(streamSearch, {
|
|
@@ -408,6 +412,10 @@ class ProxyStorage {
|
|
|
408
412
|
});
|
|
409
413
|
return streamSearch;
|
|
410
414
|
} catch (err) {
|
|
415
|
+
debug('search error %s', err);
|
|
416
|
+
if (err.response.statusCode === 409) {
|
|
417
|
+
throw _core.errorUtils.getInternalError(`bad status code ${err.response.statusCode} from uplink`);
|
|
418
|
+
}
|
|
411
419
|
this.logger.error({
|
|
412
420
|
errorMessage: err === null || err === void 0 ? void 0 : err.message,
|
|
413
421
|
name: this.upname
|
package/build/proxy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","names":["_JSONStream","_interopRequireDefault","require","_debug","_got","_lodash","_stream","_undici","_url","_core","_utils","_agent","_proxyUtils","obj","__esModule","default","LoggerApi","debug","buildDebug","encode","thing","encodeURIComponent","replace","jsonContentType","HEADERS","JSON","contentTypeAccept","setConfig","config","key","def","_","isNil","ProxyStorage","constructor","mainConfig","agent","failed_requests","userAgent","user_agent","ca","logger","child","sub","server_id","agent_options","keepAlive","maxSockets","maxFreeSockets","url","URL","isHTTPS","protocol","_setupProxy","hostname","getAgent","timeout","Number","warn","join","maxage","parseInterval","max_fails","fail_timeout","strict_ssl","Boolean","retry","limit","agentInstance","CustomAgents","proxy","get","getHeadersNext","headers","accept","ACCEPT","acceptEncoding","ACCEPT_ENCODING","USER_AGENT","setAuthNext","auth","AUTHORIZATION","isObject","token","_throwErrorAuth","tokenConf","isString","token_env","process","env","NPM_TOKEN","error","constants","ERROR_CODE","token_required","type","TOKEN_BASIC","_setHeaderAuthorization","message","Error","_type","toLowerCase","TOKEN_BEARER","upperFirst","buildToken","_overrideWithUpLinkConfLocaligHeaders","applyUplinkHeaders","getRemoteMetadata","name","options","_ifRequestFailure","errorUtils","getInternalError","API_ERROR","UPLINK_OFFLINE","addProxyHeaders","remoteAddress","etag","NONE_MATCH","method","uri","response","responseLength","_response","got","responseType","request","hooks","afterResponse","code","statusCode","HTTP_STATUS","OK","MULTIPLE_CHOICES","host","beforeRetry","_options","count","info","retryCount","on","last_request_time","Date","now","eventResponse","http","status","isNull","progress","total","data","body","NOT_MODIFIED","getCode","NOT_MODIFIED_NO_DATA","bytes","in","json","stringify","length","out","err","NOT_FOUND","getNotFound","NOT_PACKAGE_UPLINK","BAD_STATUS_CODE","remoteStatus","fetchTarball","overrideOptions","readStream","stream","search","abort","fullURL","href","uplink","upname","undiciFetch","signal","BAD_REQUEST","streamSearch","PassThrough","objectMode","res","text","streamResponse","Readable","from","pipe","JSONStream","parse","end","errorMessage","FORWARDED_FOR","Math","abs","mainconfig","noProxyList","proxy_key","no_proxy","split","isArray","i","noProxyItem","endsWith","rule","undefined","exports"],"sources":["../src/proxy.ts"],"sourcesContent":["import JSONStream from 'JSONStream';\nimport buildDebug from 'debug';\nimport got, { RequiredRetryOptions, Headers as gotHeaders } from 'got';\nimport type { Agents, Options } from 'got';\nimport _ from 'lodash';\nimport Stream, { PassThrough, Readable } from 'stream';\nimport { Headers, fetch as undiciFetch } from 'undici';\nimport { URL } from 'url';\n\nimport {\n API_ERROR,\n HEADERS,\n HTTP_STATUS,\n TOKEN_BASIC,\n TOKEN_BEARER,\n constants,\n errorUtils,\n searchUtils,\n} from '@verdaccio/core';\nimport { Manifest } from '@verdaccio/types';\nimport { Config, Logger, UpLinkConf } from '@verdaccio/types';\nimport { buildToken } from '@verdaccio/utils';\n\nimport CustomAgents, { AgentOptionsConf } from './agent';\nimport { parseInterval } from './proxy-utils';\n\nconst LoggerApi = require('@verdaccio/logger');\n\nconst debug = buildDebug('verdaccio:proxy');\n\nconst encode = function (thing): string {\n return encodeURIComponent(thing).replace(/^%40/, '@');\n};\n\nconst jsonContentType = HEADERS.JSON;\nconst contentTypeAccept = `${jsonContentType};`;\n\n/**\n * Just a helper (`config[key] || default` doesn't work because of zeroes)\n */\nconst setConfig = (config: UpLinkConfLocal, key: string, def): string => {\n return _.isNil(config[key]) === false ? config[key] : def;\n};\n\nexport type UpLinkConfLocal = UpLinkConf & {\n no_proxy?: string;\n};\n\nexport interface ProxyList {\n [key: string]: IProxy;\n}\n\nexport type ProxySearchParams = {\n headers?: Headers;\n url: string;\n query?: searchUtils.SearchQuery;\n abort: AbortController;\n};\nexport interface IProxy {\n config: UpLinkConfLocal;\n failed_requests: number;\n userAgent: string;\n ca?: string | void;\n logger: Logger;\n server_id: string;\n url: URL;\n maxage: number;\n timeout: number;\n max_fails: number;\n fail_timeout: number;\n upname: string;\n search(options: ProxySearchParams): Promise<Stream.Readable>;\n getRemoteMetadata(name: string, options: ISyncUplinksOptions): Promise<[Manifest, string]>;\n fetchTarball(\n url: string,\n options: Pick<ISyncUplinksOptions, 'remoteAddress' | 'etag' | 'retry'>\n ): PassThrough;\n}\n\n// this type is need it by storage\nexport { Options as FetchOptions };\n\nexport interface ISyncUplinksOptions extends Options {\n uplinksLook?: boolean;\n etag?: string;\n remoteAddress?: string;\n}\n\n/**\n * Implements Storage interface\n * (same for storage.js, local-storage.js, up-storage.js)\n */\nclass ProxyStorage implements IProxy {\n public config: UpLinkConfLocal;\n public failed_requests: number;\n public userAgent: string;\n public ca: string | void;\n public logger: Logger;\n public server_id: string;\n public url: URL;\n public maxage: number;\n public timeout: number;\n public max_fails: number;\n public fail_timeout: number;\n public agent_options: AgentOptionsConf;\n // FIXME: upname is assigned to each instance\n // @ts-ignore\n public upname: string;\n public proxy: string | undefined;\n private agent: Agents;\n // @ts-ignore\n public last_request_time: number | null;\n public strict_ssl: boolean;\n private retry: Partial<RequiredRetryOptions> | number;\n\n public constructor(config: UpLinkConfLocal, mainConfig: Config, agent?: Agents) {\n this.config = config;\n this.failed_requests = 0;\n this.userAgent = mainConfig.user_agent ?? 'hidden';\n this.ca = config.ca;\n this.logger = LoggerApi.logger.child({ sub: 'out' });\n this.server_id = mainConfig.server_id;\n this.agent_options = setConfig(this.config, 'agent_options', {\n keepAlive: true,\n maxSockets: 40,\n maxFreeSockets: 10,\n }) as AgentOptionsConf;\n this.url = new URL(this.config.url);\n const isHTTPS = this.url.protocol === 'https:';\n this._setupProxy(this.url.hostname, config, mainConfig, isHTTPS);\n this.agent = agent ?? this.getAgent();\n this.config.url = this.config.url.replace(/\\/$/, '');\n\n if (this.config.timeout && Number(this.config.timeout) >= 1000) {\n this.logger.warn(\n [\n 'Too big timeout value: ' + this.config.timeout,\n 'We changed time format to nginx-like one',\n '(see http://nginx.org/en/docs/syntax.html)',\n 'so please update your config accordingly',\n ].join('\\n')\n );\n }\n\n // a bunch of different configurable timers\n this.maxage = parseInterval(setConfig(this.config, 'maxage', '2m'));\n // https://github.com/sindresorhus/got/blob/main/documentation/6-timeout.md\n this.timeout = parseInterval(setConfig(this.config, 'timeout', '30s'));\n this.max_fails = Number(setConfig(this.config, 'max_fails', this.config.max_fails ?? 2));\n this.fail_timeout = parseInterval(setConfig(this.config, 'fail_timeout', '5m'));\n this.strict_ssl = Boolean(setConfig(this.config, 'strict_ssl', true));\n this.retry = { limit: this.max_fails ?? 2 };\n }\n\n private getAgent() {\n if (!this.agent) {\n // TODO: the config.ca (certificates) is not yet injected here\n const agentInstance = new CustomAgents(this.config.url, this.proxy, this.agent_options);\n return agentInstance.get();\n } else {\n return this.agent;\n }\n }\n\n public getHeadersNext(headers = {}): gotHeaders {\n const accept = HEADERS.ACCEPT;\n const acceptEncoding = HEADERS.ACCEPT_ENCODING;\n const userAgent = HEADERS.USER_AGENT;\n\n headers[accept] = headers[accept] || contentTypeAccept;\n headers[acceptEncoding] = headers[acceptEncoding] || 'gzip';\n // registry.npmjs.org will only return search result if user-agent include string 'npm'\n headers[userAgent] = headers[userAgent] || `npm (${this.userAgent})`;\n return this.setAuthNext(headers);\n }\n\n /**\n * Validate configuration auth and assign Header authorization\n * @param {Object} headers\n * @return {Object}\n * @private\n */\n private setAuthNext(headers: gotHeaders): gotHeaders {\n const { auth } = this.config;\n if (typeof auth === 'undefined' || typeof headers[HEADERS.AUTHORIZATION] === 'string') {\n return headers;\n }\n\n if (_.isObject(auth) === false && _.isObject(auth.token) === false) {\n this._throwErrorAuth('Auth invalid');\n }\n\n // get NPM_TOKEN http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules\n // or get other variable export in env\n // https://github.com/verdaccio/verdaccio/releases/tag/v2.5.0\n let token: any;\n const tokenConf: any = auth;\n if (_.isNil(tokenConf.token) === false && _.isString(tokenConf.token)) {\n token = tokenConf.token;\n } else if (_.isNil(tokenConf.token_env) === false) {\n if (typeof tokenConf.token_env === 'string') {\n token = process.env[tokenConf.token_env];\n } else if (typeof tokenConf.token_env === 'boolean' && tokenConf.token_env) {\n token = process.env.NPM_TOKEN;\n } else {\n this.logger.error(constants.ERROR_CODE.token_required);\n this._throwErrorAuth(constants.ERROR_CODE.token_required);\n }\n } else {\n token = process.env.NPM_TOKEN;\n }\n\n if (typeof token === 'undefined') {\n this._throwErrorAuth(constants.ERROR_CODE.token_required);\n }\n\n // define type Auth allow basic and bearer\n const type = tokenConf.type || TOKEN_BASIC;\n this._setHeaderAuthorization(headers, type, token);\n\n return headers;\n }\n\n /**\n * @param {string} message\n * @throws {Error}\n * @private\n */\n private _throwErrorAuth(message: string): Error {\n this.logger.error(message);\n throw new Error(message);\n }\n\n /**\n * Assign Header authorization with type authentication\n * @param {Object} headers\n * @param {string} type\n * @param {string} token\n * @private\n */\n private _setHeaderAuthorization(headers: any, type: string, token: any): void {\n const _type: string = type.toLowerCase();\n\n if (_type !== TOKEN_BEARER.toLowerCase() && _type !== TOKEN_BASIC.toLowerCase()) {\n this._throwErrorAuth(`Auth type '${_type}' not allowed`);\n }\n\n type = _.upperFirst(type);\n headers[HEADERS.AUTHORIZATION] = buildToken(type, token);\n }\n\n /**\n * It will add or override specified headers from config file.\n *\n * Eg:\n *\n * uplinks:\n npmjs:\n url: https://registry.npmjs.org/\n headers:\n Accept: \"application/vnd.npm.install-v2+json; q=1.0\"\n verdaccio-staging:\n url: https://mycompany.com/npm\n headers:\n Accept: \"application/json\"\n authorization: \"Basic YourBase64EncodedCredentials==\"\n\n * @param {Object} headers\n * @private\n * @deprecated use applyUplinkHeaders\n */\n private _overrideWithUpLinkConfLocaligHeaders(headers: Headers): any {\n if (!this.config.headers) {\n return headers;\n }\n\n // add/override headers specified in the config\n /* eslint guard-for-in: 0 */\n for (const key in this.config.headers) {\n headers[key] = this.config.headers[key];\n }\n }\n\n private applyUplinkHeaders(headers: gotHeaders): gotHeaders {\n if (!this.config.headers) {\n return headers;\n }\n\n // add/override headers specified in the config\n /* eslint guard-for-in: 0 */\n for (const key in this.config.headers) {\n headers[key] = this.config.headers[key];\n }\n return headers;\n }\n\n public async getRemoteMetadata(\n name: string,\n options: ISyncUplinksOptions\n ): Promise<[Manifest, string]> {\n if (this._ifRequestFailure()) {\n throw errorUtils.getInternalError(API_ERROR.UPLINK_OFFLINE);\n }\n\n // FUTURE: allow mix headers that comes from the client\n debug('get metadata for %s', name);\n let headers = this.getHeadersNext(options?.headers);\n headers = this.addProxyHeaders(headers, options.remoteAddress);\n headers = this.applyUplinkHeaders(headers);\n // the following headers cannot be overwritten\n if (_.isNil(options.etag) === false) {\n headers[HEADERS.NONE_MATCH] = options.etag;\n headers[HEADERS.ACCEPT] = contentTypeAccept;\n }\n const method = options.method || 'GET';\n const uri = this.config.url + `/${encode(name)}`;\n debug('request uri for %s retry %s', uri);\n let response;\n let responseLength = 0;\n try {\n const retry = options?.retry ?? this.retry;\n debug('retry times %s for %s', retry, uri);\n response = await got(uri, {\n headers,\n responseType: 'json',\n method,\n agent: this.agent,\n retry,\n // @ts-ignore\n timeout: { request: options?.timeout ?? this.timeout },\n hooks: {\n afterResponse: [\n (afterResponse) => {\n const code = afterResponse.statusCode;\n debug('code response %s', code);\n if (code >= HTTP_STATUS.OK && code < HTTP_STATUS.MULTIPLE_CHOICES) {\n if (this.failed_requests >= this.max_fails) {\n this.failed_requests = 0;\n this.logger.warn(\n {\n host: this.url.host,\n },\n 'host @{host} is now online'\n );\n }\n }\n\n return afterResponse;\n },\n ],\n beforeRetry: [\n // FUTURE: got 12.0.0, the option arg should be removed\n (_options, error: any, count) => {\n this.failed_requests = count ?? 0;\n this.logger.info(\n {\n request: {\n method: method,\n url: uri,\n },\n error: error.message,\n retryCount: this.failed_requests,\n },\n \"retry @{retryCount} req: '@{request.method} @{request.url}'\"\n );\n if (this.failed_requests >= this.max_fails) {\n this.logger.warn(\n {\n host: this.url.host,\n },\n 'host @{host} is now offline'\n );\n }\n },\n ],\n },\n })\n .on('request', () => {\n this.last_request_time = Date.now();\n })\n .on('response', (eventResponse) => {\n const message = \"@{!status}, req: '@{request.method} @{request.url}' (streaming)\";\n this.logger.http(\n {\n request: {\n method: method,\n url: uri,\n },\n status: _.isNull(eventResponse) === false ? eventResponse.statusCode : 'ERR',\n },\n message\n );\n })\n .on('downloadProgress', (progress) => {\n if (progress.total) {\n debug('responseLength %s', progress.total);\n responseLength = progress.total;\n }\n });\n const etag = response.headers.etag as string;\n const data = response.body;\n\n // not modified status (304) registry does not return any payload\n // it is handled as an error\n if (response?.statusCode === HTTP_STATUS.NOT_MODIFIED) {\n throw errorUtils.getCode(HTTP_STATUS.NOT_MODIFIED, API_ERROR.NOT_MODIFIED_NO_DATA);\n }\n\n debug('uri %s success', uri);\n const message = \"@{!status}, req: '@{request.method} @{request.url}'\";\n this.logger.http(\n {\n // if error is null/false change this to undefined so it wont log\n request: { method: method, url: uri },\n status: response.statusCode,\n bytes: {\n in: options?.json ? JSON.stringify(options?.json).length : 0,\n out: responseLength || 0,\n },\n },\n message\n );\n return [data, etag];\n } catch (err: any) {\n debug('uri %s fail', uri);\n if (err.code === 'ERR_NON_2XX_3XX_RESPONSE') {\n const code = err.response.statusCode;\n if (code === HTTP_STATUS.NOT_FOUND) {\n throw errorUtils.getNotFound(errorUtils.API_ERROR.NOT_PACKAGE_UPLINK);\n }\n\n if (!(code >= HTTP_STATUS.OK && code < HTTP_STATUS.MULTIPLE_CHOICES)) {\n const error = errorUtils.getInternalError(\n `${errorUtils.API_ERROR.BAD_STATUS_CODE}: ${code}`\n );\n // we need this code to identify outside which status code triggered the error\n error.remoteStatus = code;\n throw error;\n }\n }\n throw err;\n }\n }\n\n // FIXME: handle stream and retry\n public fetchTarball(\n url: string,\n overrideOptions: Pick<ISyncUplinksOptions, 'remoteAddress' | 'etag' | 'retry'>\n ): any {\n debug('fetching url for %s', url);\n const options = { ...this.config, ...overrideOptions };\n let headers = this.getHeadersNext(options?.headers);\n headers = this.addProxyHeaders(headers, options.remoteAddress);\n headers = this.applyUplinkHeaders(headers);\n // the following headers cannot be overwritten\n if (_.isNil(options.etag) === false) {\n headers[HEADERS.NONE_MATCH] = options.etag;\n headers[HEADERS.ACCEPT] = contentTypeAccept;\n }\n const method = 'GET';\n // const uri = this.config.url + `/${encode(name)}`;\n debug('request uri for %s', url);\n\n const readStream = got\n .stream(url, {\n headers,\n method,\n agent: this.agent,\n // FIXME: this should be taken from construtor as priority\n retry: this.retry ?? options?.retry,\n timeout: this.timeout,\n })\n .on('request', () => {\n this.last_request_time = Date.now();\n });\n\n return readStream;\n }\n\n /**\n * Perform a stream search.\n * @param {*} options request options\n * @return {Stream}\n */\n public async search({ url, abort }: ProxySearchParams): Promise<Stream.Readable> {\n debug('search url %o', url);\n\n let response;\n try {\n const fullURL = new URL(`${this.url}${url}`);\n // FIXME: a better way to remove duplicate slashes?\n const uri = fullURL.href.replace(/([^:]\\/)\\/+/g, '$1');\n this.logger.http({ uri, uplink: this.upname }, 'search request to uplink @{uplink} - @{uri}');\n response = await undiciFetch(uri, {\n method: 'GET',\n // FUTURE: whitelist domains what we are sending not need it headers, security check\n // headers: new Headers({\n // ...headers,\n // connection: 'keep-alive',\n // }),\n signal: abort?.signal,\n });\n debug('response.status %o', response.status);\n\n if (response.status >= HTTP_STATUS.BAD_REQUEST) {\n throw errorUtils.getInternalError(`bad status code ${response.status} from uplink`);\n }\n\n const streamSearch = new PassThrough({ objectMode: true });\n const res = await response.text();\n const streamResponse = Readable.from(res);\n // objects is one of the properties on the body, it ignores date and total\n streamResponse.pipe(JSONStream.parse('objects')).pipe(streamSearch, { end: true });\n return streamSearch;\n } catch (err: any) {\n this.logger.error(\n { errorMessage: err?.message, name: this.upname },\n 'proxy uplink @{name} search error: @{errorMessage}'\n );\n throw err;\n }\n }\n\n private addProxyHeaders(headers: gotHeaders, remoteAddress?: string): gotHeaders {\n // Only submit X-Forwarded-For field if we don't have a proxy selected\n // in the config file.\n //\n // Otherwise misconfigured proxy could return 407\n if (!this.proxy) {\n headers[HEADERS.FORWARDED_FOR] =\n (headers['x-forwarded-for'] ? headers['x-forwarded-for'] + ', ' : '') + remoteAddress;\n }\n\n // always attach Via header to avoid loops, even if we're not proxying\n headers['via'] = headers['via'] ? headers['via'] + ', ' : '';\n headers['via'] += '1.1 ' + this.server_id + ' (Verdaccio)';\n\n return headers;\n }\n\n /**\n * If the request failure.\n * @return {boolean}\n * @private\n */\n private _ifRequestFailure(): boolean {\n return (\n this.failed_requests >= this.max_fails &&\n Math.abs(Date.now() - (this.last_request_time as number)) < this.fail_timeout\n );\n }\n\n /**\n * Set up a proxy.\n * @param {*} hostname\n * @param {*} config\n * @param {*} mainconfig\n * @param {*} isHTTPS\n */\n private _setupProxy(\n hostname: string,\n config: UpLinkConfLocal,\n mainconfig: Config,\n isHTTPS: boolean\n ): void {\n let noProxyList;\n const proxy_key: string = isHTTPS ? 'https_proxy' : 'http_proxy';\n\n // get http_proxy and no_proxy configs\n if (proxy_key in config) {\n this.proxy = config[proxy_key];\n } else if (proxy_key in mainconfig) {\n this.proxy = mainconfig[proxy_key];\n }\n if ('no_proxy' in config) {\n noProxyList = config.no_proxy;\n } else if ('no_proxy' in mainconfig) {\n noProxyList = mainconfig.no_proxy;\n }\n\n // use wget-like algorithm to determine if proxy shouldn't be used\n if (hostname[0] !== '.') {\n hostname = '.' + hostname;\n }\n\n if (_.isString(noProxyList) && noProxyList.length) {\n noProxyList = noProxyList.split(',');\n }\n\n if (_.isArray(noProxyList)) {\n for (let i = 0; i < noProxyList.length; i++) {\n let noProxyItem = noProxyList[i];\n if (noProxyItem[0] !== '.') {\n noProxyItem = '.' + noProxyItem;\n }\n if (hostname.endsWith(noProxyItem)) {\n if (this.proxy) {\n this.logger.debug(\n { url: this.url.href, rule: noProxyItem },\n 'not using proxy for @{url}, excluded by @{rule} rule'\n );\n this.proxy = undefined;\n }\n break;\n }\n }\n }\n\n if (typeof this.proxy === 'string') {\n this.logger.debug(\n { url: this.url.href, proxy: this.proxy },\n 'using proxy @{proxy} for @{url}'\n );\n }\n }\n}\n\nexport { ProxyStorage };\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AAEA,IAAAO,KAAA,GAAAP,OAAA;AAYA,IAAAQ,MAAA,GAAAR,OAAA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C1B,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,WAAW,CAACtC,MAAM,EAAE2C,CAAC,EAAE,EAAE;QAC3C,IAAIC,WAAW,GAAGN,WAAW,CAACK,CAAC,CAAC;QAChC,IAAIC,WAAW,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;UAC1BA,WAAW,GAAG,GAAG,GAAGA,WAAW;QACjC;QACA,IAAIrJ,QAAQ,CAACsJ,QAAQ,CAACD,WAAW,CAAC,EAAE;UAClC,IAAI,IAAI,CAACrI,KAAK,EAAE;YACd,IAAI,CAAC7B,MAAM,CAACxB,KAAK,CACf;cAAEgC,GAAG,EAAE,IAAI,CAACA,GAAG,CAAC6H,IAAI;cAAE+B,IAAI,EAAEF;YAAY,CAAC,EACzC,sDACF,CAAC;YACD,IAAI,CAACrI,KAAK,GAAGwI,SAAS;UACxB;UACA;QACF;MACF;IACF;IAEA,IAAI,OAAO,IAAI,CAACxI,KAAK,KAAK,QAAQ,EAAE;MAClC,IAAI,CAAC7B,MAAM,CAACxB,KAAK,CACf;QAAEgC,GAAG,EAAE,IAAI,CAACA,GAAG,CAAC6H,IAAI;QAAExG,KAAK,EAAE,IAAI,CAACA;MAAM,CAAC,EACzC,iCACF,CAAC;IACH;EACF;AACF;AAACyI,OAAA,CAAA9K,YAAA,GAAAA,YAAA"}
|
|
1
|
+
{"version":3,"file":"proxy.js","names":["_JSONStream","_interopRequireDefault","require","_debug","_gotCjs","_interopRequireWildcard","_lodash","_stream","_url","_core","_utils","_agent","_proxyUtils","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","debug","buildDebug","encode","thing","encodeURIComponent","replace","jsonContentType","HEADERS","JSON","contentTypeAccept","setConfig","config","def","_","isNil","ProxyStorage","constructor","mainConfig","logger","agent","failed_requests","userAgent","user_agent","ca","server_id","agent_options","keepAlive","maxSockets","maxFreeSockets","url","URL","isHTTPS","protocol","_setupProxy","hostname","getAgent","timeout","Number","warn","join","maxage","parseInterval","request","max_fails","fail_timeout","strict_ssl","Boolean","retry","limit","agentInstance","CustomAgents","proxy","getHeaders","headers","accept","ACCEPT","acceptEncoding","ACCEPT_ENCODING","USER_AGENT","setAuthNext","auth","AUTHORIZATION","isObject","token","_throwErrorAuth","tokenConf","isString","token_env","process","env","NPM_TOKEN","error","constants","ERROR_CODE","token_required","type","TOKEN_BASIC","_setHeaderAuthorization","message","Error","_type","toLowerCase","TOKEN_BEARER","upperFirst","buildToken","_overrideWithUpLinkConfLocaligHeaders","applyUplinkHeaders","getRemoteMetadata","name","options","_ifRequestFailure","errorUtils","getInternalError","API_ERROR","UPLINK_OFFLINE","addProxyHeaders","remoteAddress","etag","NONE_MATCH","method","uri","response","responseLength","_response","got","responseType","hooks","afterResponse","code","statusCode","HTTP_STATUS","OK","MULTIPLE_CHOICES","host","beforeRetry","count","info","retryCount","on","last_request_time","Date","now","eventResponse","http","status","isNull","progress","total","data","body","NOT_MODIFIED","getCode","NOT_MODIFIED_NO_DATA","bytes","in","json","stringify","length","out","err","NOT_FOUND","getNotFound","NOT_PACKAGE_UPLINK","BAD_STATUS_CODE","remoteStatus","SERVER_TIME_OUT","fetchTarball","overrideOptions","readStream","stream","search","abort","fullURL","href","uplink","upname","signal","res","text","streamSearch","PassThrough","objectMode","streamResponse","Readable","from","pipe","JSONStream","parse","end","errorMessage","FORWARDED_FOR","Math","abs","mainconfig","noProxyList","proxy_key","no_proxy","split","isArray","i","noProxyItem","endsWith","rule","undefined","exports"],"sources":["../src/proxy.ts"],"sourcesContent":["import JSONStream from 'JSONStream';\nimport buildDebug from 'debug';\nimport got, {\n Agents,\n Delays,\n Options,\n RequestError,\n RetryOptions,\n Headers as gotHeaders,\n} from 'got-cjs';\nimport _ from 'lodash';\nimport Stream, { PassThrough, Readable } from 'stream';\nimport { URL } from 'url';\n\nimport {\n API_ERROR,\n HEADERS,\n HTTP_STATUS,\n TOKEN_BASIC,\n TOKEN_BEARER,\n constants,\n errorUtils,\n searchUtils,\n} from '@verdaccio/core';\nimport { Manifest } from '@verdaccio/types';\nimport { Config, Logger, UpLinkConf } from '@verdaccio/types';\nimport { buildToken } from '@verdaccio/utils';\n\nimport CustomAgents, { AgentOptionsConf } from './agent';\nimport { parseInterval } from './proxy-utils';\n\nconst debug = buildDebug('verdaccio:proxy');\n\nconst encode = function (thing): string {\n return encodeURIComponent(thing).replace(/^%40/, '@');\n};\n\nconst jsonContentType = HEADERS.JSON;\nconst contentTypeAccept = `${jsonContentType};`;\n\n/**\n * Just a helper (`config[key] || default` doesn't work because of zeroes)\n */\nconst setConfig = (config: UpLinkConfLocal, key: string, def): string => {\n return _.isNil(config[key]) === false ? config[key] : def;\n};\n\nexport type UpLinkConfLocal = UpLinkConf & {\n no_proxy?: string;\n};\n\nexport interface ProxyList {\n [key: string]: IProxy;\n}\n\nexport type ProxySearchParams = {\n url: string;\n abort: AbortController;\n query?: searchUtils.SearchQuery;\n headers?: Headers;\n retry?: Partial<RetryOptions>;\n};\nexport interface IProxy {\n config: UpLinkConfLocal;\n failed_requests: number;\n userAgent: string;\n ca?: string | void;\n logger: Logger;\n server_id: string;\n url: URL;\n maxage: number;\n timeout: Delays;\n max_fails: number;\n fail_timeout: number;\n upname: string;\n search(options: ProxySearchParams): Promise<Stream.Readable>;\n getRemoteMetadata(\n name: string,\n options: Partial<ISyncUplinksOptions>\n ): Promise<[Manifest, string]>;\n fetchTarball(\n url: string,\n options: Partial<Pick<ISyncUplinksOptions, 'remoteAddress' | 'etag' | 'retry'>>\n ): PassThrough;\n}\n\n// this type is need it by storage\nexport { Options as FetchOptions };\n\nexport interface ISyncUplinksOptions extends Options {\n uplinksLook?: boolean;\n etag?: string;\n remoteAddress?: string;\n}\n\n/**\n * Implements Storage interface\n * (same for storage.js, local-storage.js, up-storage.js)\n */\nclass ProxyStorage implements IProxy {\n public config: UpLinkConfLocal;\n public failed_requests: number;\n public userAgent: string;\n public ca: string | void;\n public logger: Logger;\n public server_id: string;\n public url: URL;\n public maxage: number;\n public timeout: Delays;\n public max_fails: number;\n public fail_timeout: number;\n public agent_options: AgentOptionsConf;\n // FIXME: upname is assigned to each instance\n // @ts-ignore\n public upname: string;\n public proxy: string | undefined;\n private agent: Agents;\n // @ts-ignore\n public last_request_time: number | null;\n public strict_ssl: boolean;\n private retry: Partial<RetryOptions>;\n\n public constructor(config: UpLinkConfLocal, mainConfig: Config, logger: Logger, agent?: Agents) {\n this.config = config;\n this.failed_requests = 0;\n this.userAgent = mainConfig.user_agent ?? 'hidden';\n this.ca = config.ca;\n this.logger = logger;\n this.server_id = mainConfig.server_id;\n this.agent_options = setConfig(this.config, 'agent_options', {\n keepAlive: true,\n maxSockets: 40,\n maxFreeSockets: 10,\n }) as AgentOptionsConf;\n this.url = new URL(this.config.url);\n const isHTTPS = this.url.protocol === 'https:';\n this._setupProxy(this.url.hostname, config, mainConfig, isHTTPS);\n this.agent = agent ?? this.getAgent();\n this.config.url = this.config.url.replace(/\\/$/, '');\n\n if (this.config.timeout && Number(this.config.timeout) >= 1000) {\n this.logger.warn(\n [\n 'Too big timeout value: ' + this.config.timeout,\n 'We changed time format to nginx-like one',\n '(see http://nginx.org/en/docs/syntax.html)',\n 'so please update your config accordingly',\n ].join('\\n')\n );\n }\n\n // a bunch of different configurable timers\n this.maxage = parseInterval(setConfig(this.config, 'maxage', '2m'));\n // https://github.com/sindresorhus/got/blob/main/documentation/6-timeout.md\n this.timeout = {\n request: parseInterval(setConfig(this.config, 'timeout', '30s')),\n };\n debug('set timeout %s', this.timeout);\n this.max_fails = Number(setConfig(this.config, 'max_fails', this.config.max_fails ?? 2));\n this.fail_timeout = parseInterval(setConfig(this.config, 'fail_timeout', '5m'));\n this.strict_ssl = Boolean(setConfig(this.config, 'strict_ssl', true));\n this.retry = { limit: this.max_fails ?? 2 };\n }\n\n private getAgent() {\n if (!this.agent) {\n // TODO: the config.ca (certificates) is not yet injected here\n const agentInstance = new CustomAgents(this.config.url, this.proxy, this.agent_options);\n return agentInstance.get();\n } else {\n return this.agent;\n }\n }\n\n public getHeaders(headers = {}): gotHeaders {\n const accept = HEADERS.ACCEPT;\n const acceptEncoding = HEADERS.ACCEPT_ENCODING;\n const userAgent = HEADERS.USER_AGENT;\n\n headers[accept] = headers[accept] || contentTypeAccept;\n headers[acceptEncoding] = headers[acceptEncoding] || 'gzip';\n // registry.npmjs.org will only return search result if user-agent include string 'npm'\n headers[userAgent] = headers[userAgent] || `npm (${this.userAgent})`;\n return this.setAuthNext(headers);\n }\n\n /**\n * Validate configuration auth and assign Header authorization\n * @param {Object} headers\n * @return {Object}\n * @private\n */\n private setAuthNext(headers: gotHeaders): gotHeaders {\n const { auth } = this.config;\n if (typeof auth === 'undefined' || typeof headers[HEADERS.AUTHORIZATION] === 'string') {\n return headers;\n }\n\n if (_.isObject(auth) === false && _.isObject(auth.token) === false) {\n this._throwErrorAuth('Auth invalid');\n }\n\n // get NPM_TOKEN http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules\n // or get other variable export in env\n // https://github.com/verdaccio/verdaccio/releases/tag/v2.5.0\n let token: any;\n const tokenConf: any = auth;\n if (_.isNil(tokenConf.token) === false && _.isString(tokenConf.token)) {\n token = tokenConf.token;\n } else if (_.isNil(tokenConf.token_env) === false) {\n if (typeof tokenConf.token_env === 'string') {\n token = process.env[tokenConf.token_env];\n } else if (typeof tokenConf.token_env === 'boolean' && tokenConf.token_env) {\n token = process.env.NPM_TOKEN;\n } else {\n this.logger.error(constants.ERROR_CODE.token_required);\n this._throwErrorAuth(constants.ERROR_CODE.token_required);\n }\n } else {\n token = process.env.NPM_TOKEN;\n }\n\n if (typeof token === 'undefined') {\n this._throwErrorAuth(constants.ERROR_CODE.token_required);\n }\n\n // define type Auth allow basic and bearer\n const type = tokenConf.type || TOKEN_BASIC;\n this._setHeaderAuthorization(headers, type, token);\n\n return headers;\n }\n\n /**\n * @param {string} message\n * @throws {Error}\n * @private\n */\n private _throwErrorAuth(message: string): Error {\n this.logger.error(message);\n throw new Error(message);\n }\n\n /**\n * Assign Header authorization with type authentication\n * @param {Object} headers\n * @param {string} type\n * @param {string} token\n * @private\n */\n private _setHeaderAuthorization(headers: any, type: string, token: any): void {\n const _type: string = type.toLowerCase();\n\n if (_type !== TOKEN_BEARER.toLowerCase() && _type !== TOKEN_BASIC.toLowerCase()) {\n this._throwErrorAuth(`Auth type '${_type}' not allowed`);\n }\n\n type = _.upperFirst(type);\n headers[HEADERS.AUTHORIZATION] = buildToken(type, token);\n }\n\n /**\n * It will add or override specified headers from config file.\n *\n * Eg:\n *\n * uplinks:\n npmjs:\n url: https://registry.npmjs.org/\n headers:\n Accept: \"application/vnd.npm.install-v2+json; q=1.0\"\n verdaccio-staging:\n url: https://mycompany.com/npm\n headers:\n Accept: \"application/json\"\n authorization: \"Basic YourBase64EncodedCredentials==\"\n\n * @param {Object} headers\n * @private\n * @deprecated use applyUplinkHeaders\n */\n private _overrideWithUpLinkConfLocaligHeaders(headers: Headers): any {\n if (!this.config.headers) {\n return headers;\n }\n\n // add/override headers specified in the config\n /* eslint guard-for-in: 0 */\n for (const key in this.config.headers) {\n headers[key] = this.config.headers[key];\n }\n }\n\n private applyUplinkHeaders(headers: gotHeaders): gotHeaders {\n if (!this.config.headers) {\n return headers;\n }\n\n // add/override headers specified in the config\n /* eslint guard-for-in: 0 */\n for (const key in this.config.headers) {\n headers[key] = this.config.headers[key];\n }\n return headers;\n }\n\n public async getRemoteMetadata(\n name: string,\n options: Partial<ISyncUplinksOptions>\n ): Promise<[Manifest, string]> {\n if (this._ifRequestFailure()) {\n throw errorUtils.getInternalError(API_ERROR.UPLINK_OFFLINE);\n }\n\n // FUTURE: allow mix headers that comes from the client\n debug('getting metadata for package %s', name);\n let headers = this.getHeaders(options?.headers);\n headers = this.addProxyHeaders(headers, options.remoteAddress);\n headers = this.applyUplinkHeaders(headers);\n // the following headers cannot be overwritten\n if (_.isNil(options.etag) === false) {\n headers[HEADERS.NONE_MATCH] = options.etag;\n headers[HEADERS.ACCEPT] = contentTypeAccept;\n }\n const method = options.method || 'GET';\n const uri = this.config.url + `/${encode(name)}`;\n debug('set retry limit is %s', this.retry.limit);\n let response;\n let responseLength = 0;\n try {\n const retry = options?.retry ?? this.retry;\n debug('retry initial count %s', retry);\n response = await got(uri, {\n headers,\n responseType: 'json',\n method,\n agent: this.agent,\n retry,\n timeout: this.timeout,\n hooks: {\n afterResponse: [\n (afterResponse) => {\n const code = afterResponse.statusCode;\n debug('after response code is %s', code);\n if (code >= HTTP_STATUS.OK && code < HTTP_STATUS.MULTIPLE_CHOICES) {\n if (this.failed_requests >= this.max_fails) {\n this.failed_requests = 0;\n this.logger.warn(\n {\n host: this.url.host,\n },\n 'host @{host} is now online'\n );\n }\n }\n\n return afterResponse;\n },\n ],\n beforeRetry: [\n (error: RequestError, count: number) => {\n debug('retry %s count: %s', uri, count);\n this.failed_requests = count ?? 0;\n this.logger.info(\n {\n request: {\n method: method,\n url: uri,\n },\n error: error.message,\n retryCount: this.failed_requests,\n },\n \"retry @{retryCount} req: '@{request.method} @{request.url}'\"\n );\n if (this.failed_requests >= this.max_fails) {\n this.logger.warn(\n {\n host: this.url.host,\n },\n 'host @{host} is now offline'\n );\n }\n },\n ],\n },\n })\n .on('request', () => {\n this.last_request_time = Date.now();\n })\n .on<any>('response', (eventResponse) => {\n const message = \"@{!status}, req: '@{request.method} @{request.url}' (streaming)\";\n this.logger.http(\n {\n request: {\n method: method,\n url: uri,\n },\n status: _.isNull(eventResponse) === false ? eventResponse.statusCode : 'ERR',\n },\n message\n );\n })\n .on('downloadProgress', (progress) => {\n if (progress.total) {\n debug('responseLength %s', progress.total);\n responseLength = progress.total;\n }\n });\n const etag = response.headers.etag as string;\n const data = response.body;\n\n // not modified status (304) registry does not return any payload\n // it is handled as an error\n if (response?.statusCode === HTTP_STATUS.NOT_MODIFIED) {\n throw errorUtils.getCode(HTTP_STATUS.NOT_MODIFIED, API_ERROR.NOT_MODIFIED_NO_DATA);\n }\n\n debug('uri %s success', uri);\n const message = \"@{!status}, req: '@{request.method} @{request.url}'\";\n this.logger.http(\n {\n // if error is null/false change this to undefined so it wont log\n request: { method: method, url: uri },\n status: response.statusCode,\n bytes: {\n in: options?.json ? JSON.stringify(options?.json).length : 0,\n out: responseLength || 0,\n },\n },\n message\n );\n return [data, etag];\n } catch (err: any) {\n debug('error %s on uri %s', err.code, uri);\n if (err.code === 'ERR_NON_2XX_3XX_RESPONSE') {\n const code = err.response.statusCode;\n debug('error code %s', code);\n if (code === HTTP_STATUS.NOT_FOUND) {\n throw errorUtils.getNotFound(errorUtils.API_ERROR.NOT_PACKAGE_UPLINK);\n }\n\n if (!(code >= HTTP_STATUS.OK && code < HTTP_STATUS.MULTIPLE_CHOICES)) {\n const error = errorUtils.getInternalError(\n `${errorUtils.API_ERROR.BAD_STATUS_CODE}: ${code}`\n );\n // we need this code to identify outside which status code triggered the error\n error.remoteStatus = code;\n throw error;\n }\n } else if (err.code === 'ETIMEDOUT') {\n debug('error code timeout');\n const code = err.code;\n const error = errorUtils.getInternalError(\n `${errorUtils.API_ERROR.SERVER_TIME_OUT}: ${code}`\n );\n // we need this code to identify outside which status code triggered the error\n error.remoteStatus = code;\n throw error;\n }\n throw err;\n }\n }\n\n // FIXME: handle stream and retry\n public fetchTarball(\n url: string,\n overrideOptions: Pick<ISyncUplinksOptions, 'remoteAddress' | 'etag' | 'retry'>\n ): any {\n debug('fetching url for %s', url);\n const options = { ...this.config, ...overrideOptions };\n let headers = this.getHeaders(options?.headers);\n headers = this.addProxyHeaders(headers, options.remoteAddress);\n headers = this.applyUplinkHeaders(headers);\n // the following headers cannot be overwritten\n if (_.isNil(options.etag) === false) {\n headers[HEADERS.NONE_MATCH] = options.etag;\n headers[HEADERS.ACCEPT] = contentTypeAccept;\n }\n const method = 'GET';\n // const uri = this.config.url + `/${encode(name)}`;\n debug('request uri for %s', url);\n\n const readStream = got\n .stream(url, {\n headers,\n method,\n agent: this.agent,\n // FIXME: this should be taken from construtor as priority\n retry: this.retry ?? options?.retry,\n timeout: this.timeout,\n })\n .on('request', () => {\n this.last_request_time = Date.now();\n });\n\n return readStream;\n }\n\n /**\n * Perform a stream search.\n * @param {*} options request options\n * @return {Stream}\n */\n public async search({ url, abort, retry }: ProxySearchParams): Promise<Stream.Readable> {\n try {\n const fullURL = new URL(`${this.url}${url}`);\n // FIXME: a better way to remove duplicate slashes?\n const uri = fullURL.href.replace(/([^:]\\/)\\/+/g, '$1');\n this.logger.http({ uri, uplink: this.upname }, 'search request to uplink @{uplink} - @{uri}');\n debug('searching on %s', uri);\n const response = got(uri, {\n signal: abort ? abort.signal : {},\n agent: this.agent,\n timeout: this.timeout,\n retry: retry ?? this.retry,\n });\n\n const res = await response.text();\n const streamSearch = new PassThrough({ objectMode: true });\n const streamResponse = Readable.from(res);\n // objects is one of the properties on the body, it ignores date and total\n streamResponse.pipe(JSONStream.parse('objects')).pipe(streamSearch, { end: true });\n return streamSearch;\n } catch (err: any) {\n debug('search error %s', err);\n if (err.response.statusCode === 409) {\n throw errorUtils.getInternalError(`bad status code ${err.response.statusCode} from uplink`);\n }\n this.logger.error(\n { errorMessage: err?.message, name: this.upname },\n 'proxy uplink @{name} search error: @{errorMessage}'\n );\n throw err;\n }\n }\n\n private addProxyHeaders(headers: gotHeaders, remoteAddress?: string): gotHeaders {\n // Only submit X-Forwarded-For field if we don't have a proxy selected\n // in the config file.\n //\n // Otherwise misconfigured proxy could return 407\n if (!this.proxy) {\n headers[HEADERS.FORWARDED_FOR] =\n (headers['x-forwarded-for'] ? headers['x-forwarded-for'] + ', ' : '') + remoteAddress;\n }\n\n // always attach Via header to avoid loops, even if we're not proxying\n headers['via'] = headers['via'] ? headers['via'] + ', ' : '';\n headers['via'] += '1.1 ' + this.server_id + ' (Verdaccio)';\n\n return headers;\n }\n\n /**\n * If the request failure.\n * @return {boolean}\n * @private\n */\n private _ifRequestFailure(): boolean {\n return (\n this.failed_requests >= this.max_fails &&\n Math.abs(Date.now() - (this.last_request_time as number)) < this.fail_timeout\n );\n }\n\n /**\n * Set up a proxy.\n * @param {*} hostname\n * @param {*} config\n * @param {*} mainconfig\n * @param {*} isHTTPS\n */\n private _setupProxy(\n hostname: string,\n config: UpLinkConfLocal,\n mainconfig: Config,\n isHTTPS: boolean\n ): void {\n let noProxyList;\n const proxy_key: string = isHTTPS ? 'https_proxy' : 'http_proxy';\n\n // get http_proxy and no_proxy configs\n if (proxy_key in config) {\n this.proxy = config[proxy_key];\n } else if (proxy_key in mainconfig) {\n this.proxy = mainconfig[proxy_key];\n }\n if ('no_proxy' in config) {\n noProxyList = config.no_proxy;\n } else if ('no_proxy' in mainconfig) {\n noProxyList = mainconfig.no_proxy;\n }\n\n // use wget-like algorithm to determine if proxy shouldn't be used\n if (hostname[0] !== '.') {\n hostname = '.' + hostname;\n }\n\n if (_.isString(noProxyList) && noProxyList.length) {\n noProxyList = noProxyList.split(',');\n }\n\n if (_.isArray(noProxyList)) {\n for (let i = 0; i < noProxyList.length; i++) {\n let noProxyItem = noProxyList[i];\n if (noProxyItem[0] !== '.') {\n noProxyItem = '.' + noProxyItem;\n }\n if (hostname.endsWith(noProxyItem)) {\n if (this.proxy) {\n this.logger.debug(\n { url: this.url.href, rule: noProxyItem },\n 'not using proxy for @{url}, excluded by @{rule} rule'\n );\n this.proxy = undefined;\n }\n break;\n }\n }\n }\n\n if (typeof this.proxy === 'string') {\n this.logger.debug(\n { url: this.url.href, proxy: this.proxy },\n 'using proxy @{proxy} for @{url}'\n );\n }\n }\n}\n\nexport { ProxyStorage };\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAC,uBAAA,CAAAH,OAAA;AAQA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,I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AAzK,YAAA,GAAAA,YAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/proxy",
|
|
3
|
-
"version": "6.0.0-6-next.
|
|
3
|
+
"version": "6.0.0-6-next.53",
|
|
4
4
|
"description": "verdaccio proxy fetcher",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -26,28 +26,25 @@
|
|
|
26
26
|
"verdaccio"
|
|
27
27
|
],
|
|
28
28
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
30
|
-
"npm": ">=6"
|
|
29
|
+
"node": ">=12"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
|
-
"@verdaccio/config": "6.0.0-6-next.
|
|
34
|
-
"@verdaccio/core": "6.0.0-6-next.
|
|
35
|
-
"@verdaccio/
|
|
36
|
-
"@verdaccio/logger": "6.0.0-6-next.42",
|
|
37
|
-
"@verdaccio/utils": "6.0.0-6-next.42",
|
|
32
|
+
"@verdaccio/config": "6.0.0-6-next.75",
|
|
33
|
+
"@verdaccio/core": "6.0.0-6-next.75",
|
|
34
|
+
"@verdaccio/utils": "6.0.0-6-next.43",
|
|
38
35
|
"JSONStream": "1.3.5",
|
|
39
36
|
"debug": "4.3.4",
|
|
40
|
-
"
|
|
41
|
-
"got": "11.8.6",
|
|
37
|
+
"got-cjs": "12.5.4",
|
|
42
38
|
"hpagent": "1.2.0",
|
|
43
|
-
"
|
|
39
|
+
"lodash": "4.17.21"
|
|
44
40
|
},
|
|
45
41
|
"devDependencies": {
|
|
46
|
-
"p-cancelable": "2.1.1",
|
|
47
42
|
"@verdaccio/types": "11.0.0-6-next.25",
|
|
43
|
+
"@verdaccio/logger": "6.0.0-6-next.43",
|
|
48
44
|
"get-stream": "^6.0.1",
|
|
49
45
|
"nock": "13.2.9",
|
|
50
46
|
"node-mocks-http": "1.12.1",
|
|
47
|
+
"p-cancelable": "2.1.1",
|
|
51
48
|
"semver": "7.5.4"
|
|
52
49
|
},
|
|
53
50
|
"funding": {
|
package/src/agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agents } from 'got';
|
|
1
|
+
import { Agents } from 'got-cjs';
|
|
2
2
|
import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent';
|
|
3
3
|
import { Agent as HttpAgent, AgentOptions as HttpAgentOptions } from 'http';
|
|
4
4
|
import { Agent as HttpsAgent, AgentOptions as HttpsAgentOptions } from 'https';
|