@theia/request 1.67.0-next.13 → 1.67.0-next.56
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/package.json +2 -2
- package/lib/common-request-service.d.ts +0 -76
- package/lib/common-request-service.d.ts.map +0 -1
- package/lib/common-request-service.js +0 -85
- package/lib/common-request-service.js.map +0 -1
- package/lib/index.d.ts +0 -17
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -20
- package/lib/index.js.map +0 -1
- package/lib/node-request-service.d.ts +0 -41
- package/lib/node-request-service.d.ts.map +0 -1
- package/lib/node-request-service.js +0 -145
- package/lib/node-request-service.js.map +0 -1
- package/lib/package.spec.d.ts +0 -16
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -26
- package/lib/package.spec.js.map +0 -1
- package/lib/proxy.d.ts +0 -24
- package/lib/proxy.d.ts.map +0 -1
- package/lib/proxy.js +0 -51
- package/lib/proxy.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/request",
|
|
3
|
-
"version": "1.67.0-next.
|
|
3
|
+
"version": "1.67.0-next.56+d8f18cc386c",
|
|
4
4
|
"description": "Theia Proxy-Aware Request Service",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"https-proxy-agent": "^5.0.0",
|
|
34
34
|
"tslib": "^2.6.2"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "d8f18cc386c45a736cd193d42eab02c8f64c6b10"
|
|
37
37
|
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2022 TypeFox and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
export interface Headers {
|
|
17
|
-
[header: string]: string;
|
|
18
|
-
}
|
|
19
|
-
export interface RequestOptions {
|
|
20
|
-
type?: string;
|
|
21
|
-
url: string;
|
|
22
|
-
user?: string;
|
|
23
|
-
password?: string;
|
|
24
|
-
headers?: Headers;
|
|
25
|
-
timeout?: number;
|
|
26
|
-
data?: string;
|
|
27
|
-
followRedirects?: number;
|
|
28
|
-
proxyAuthorization?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface RequestContext {
|
|
31
|
-
url: string;
|
|
32
|
-
res: {
|
|
33
|
-
headers: Headers;
|
|
34
|
-
statusCode?: number;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Contains the data returned by the request.
|
|
38
|
-
*
|
|
39
|
-
* If the request was transferred from the backend to the frontend, the buffer has been compressed into a string. In every case the buffer is an {@link Uint8Array}.
|
|
40
|
-
*/
|
|
41
|
-
buffer: Uint8Array | string;
|
|
42
|
-
}
|
|
43
|
-
export declare namespace RequestContext {
|
|
44
|
-
function isSuccess(context: RequestContext): boolean;
|
|
45
|
-
function asText(context: RequestContext): string;
|
|
46
|
-
function asJson<T = {}>(context: RequestContext): T;
|
|
47
|
-
/**
|
|
48
|
-
* Convert the buffer to base64 before sending it to the frontend.
|
|
49
|
-
* This reduces the amount of JSON data transferred massively.
|
|
50
|
-
* Does nothing if the buffer is already compressed.
|
|
51
|
-
*/
|
|
52
|
-
function compress(context: RequestContext): RequestContext;
|
|
53
|
-
/**
|
|
54
|
-
* Decompresses a base64 buffer into a normal array buffer
|
|
55
|
-
* Does nothing if the buffer is not compressed.
|
|
56
|
-
*/
|
|
57
|
-
function decompress(context: RequestContext): RequestContext;
|
|
58
|
-
}
|
|
59
|
-
export interface RequestConfiguration {
|
|
60
|
-
proxyUrl?: string;
|
|
61
|
-
proxyAuthorization?: string;
|
|
62
|
-
strictSSL?: boolean;
|
|
63
|
-
}
|
|
64
|
-
export interface RequestService {
|
|
65
|
-
configure(config: RequestConfiguration): Promise<void>;
|
|
66
|
-
request(options: RequestOptions, token?: CancellationToken): Promise<RequestContext>;
|
|
67
|
-
resolveProxy(url: string): Promise<string | undefined>;
|
|
68
|
-
}
|
|
69
|
-
export declare const RequestService: unique symbol;
|
|
70
|
-
export declare const BackendRequestService: unique symbol;
|
|
71
|
-
export declare const REQUEST_SERVICE_PATH = "/services/request-service";
|
|
72
|
-
export interface CancellationToken {
|
|
73
|
-
readonly isCancellationRequested: boolean;
|
|
74
|
-
readonly onCancellationRequested: (listener: () => void) => void;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=common-request-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common-request-service.d.ts","sourceRoot":"","sources":["../src/common-request-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAIlF,MAAM,WAAW,OAAO;IACpB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,M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W,iBAAiB;IAC9B,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,QAAQ,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACpE"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/********************************************************************************
|
|
3
|
-
* Copyright (C) 2022 TypeFox and others.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials are made available under the
|
|
6
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
*
|
|
9
|
-
* This Source Code may also be made available under the following Secondary
|
|
10
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
* with the GNU Classpath Exception which is available at
|
|
13
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.REQUEST_SERVICE_PATH = exports.BackendRequestService = exports.RequestService = exports.RequestContext = void 0;
|
|
19
|
-
const textDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder() : undefined;
|
|
20
|
-
var RequestContext;
|
|
21
|
-
(function (RequestContext) {
|
|
22
|
-
function isSuccess(context) {
|
|
23
|
-
return (context.res.statusCode && context.res.statusCode >= 200 && context.res.statusCode < 300) || context.res.statusCode === 1223;
|
|
24
|
-
}
|
|
25
|
-
RequestContext.isSuccess = isSuccess;
|
|
26
|
-
function hasNoContent(context) {
|
|
27
|
-
return context.res.statusCode === 204;
|
|
28
|
-
}
|
|
29
|
-
function asText(context) {
|
|
30
|
-
if (!isSuccess(context)) {
|
|
31
|
-
throw new Error(`Server returned code ${context.res.statusCode}.`);
|
|
32
|
-
}
|
|
33
|
-
if (hasNoContent(context)) {
|
|
34
|
-
return '';
|
|
35
|
-
}
|
|
36
|
-
// Ensures that the buffer is an Uint8Array
|
|
37
|
-
context = decompress(context);
|
|
38
|
-
if (textDecoder) {
|
|
39
|
-
return textDecoder.decode(context.buffer);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
return context.buffer.toString();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
RequestContext.asText = asText;
|
|
46
|
-
function asJson(context) {
|
|
47
|
-
const str = asText(context);
|
|
48
|
-
try {
|
|
49
|
-
return JSON.parse(str);
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
err.message += ':\n' + str;
|
|
53
|
-
throw err;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
RequestContext.asJson = asJson;
|
|
57
|
-
/**
|
|
58
|
-
* Convert the buffer to base64 before sending it to the frontend.
|
|
59
|
-
* This reduces the amount of JSON data transferred massively.
|
|
60
|
-
* Does nothing if the buffer is already compressed.
|
|
61
|
-
*/
|
|
62
|
-
function compress(context) {
|
|
63
|
-
if (context.buffer instanceof Uint8Array && Buffer !== undefined) {
|
|
64
|
-
context.buffer = Buffer.from(context.buffer).toString('base64');
|
|
65
|
-
}
|
|
66
|
-
return context;
|
|
67
|
-
}
|
|
68
|
-
RequestContext.compress = compress;
|
|
69
|
-
/**
|
|
70
|
-
* Decompresses a base64 buffer into a normal array buffer
|
|
71
|
-
* Does nothing if the buffer is not compressed.
|
|
72
|
-
*/
|
|
73
|
-
function decompress(context) {
|
|
74
|
-
const buffer = context.buffer;
|
|
75
|
-
if (typeof buffer === 'string' && typeof atob === 'function') {
|
|
76
|
-
context.buffer = Uint8Array.from(atob(buffer), c => c.charCodeAt(0));
|
|
77
|
-
}
|
|
78
|
-
return context;
|
|
79
|
-
}
|
|
80
|
-
RequestContext.decompress = decompress;
|
|
81
|
-
})(RequestContext || (exports.RequestContext = RequestContext = {}));
|
|
82
|
-
exports.RequestService = Symbol('RequestService');
|
|
83
|
-
exports.BackendRequestService = Symbol('BackendRequestService');
|
|
84
|
-
exports.REQUEST_SERVICE_PATH = '/services/request-service';
|
|
85
|
-
//# sourceMappingURL=common-request-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common-request-service.js","sourceRoot":"","sources":["../src/common-request-service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,MAAM,WAAW,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAgCvF,IAAiB,cAAc,CA0D9B;AA1DD,WAAiB,cAAc;IAC3B,SAAgB,SAAS,CAAC,OAAuB;QAC7C,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,IAAI,CAAC;IACxI,CAAC;IAFe,wBAAS,YAExB,CAAA;IAED,SAAS,YAAY,CAAC,OAAuB;QACzC,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC;IAC1C,CAAC;IAED,SAAgB,MAAM,CAAC,OAAuB;QAC1C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;YACxB,OAAO,EAAE,CAAC;QACd,CAAC;QACD,2CAA2C;QAC3C,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QAC9B,IAAI,WAAW,EAAE,CAAC;YACd,OAAO,WAAW,CAAC,MAAM,CA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AAc,8BAAd,cAAc,QA0D9B;AAaY,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC1C,QAAA,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AACxD,QAAA,oBAAoB,GAAG,2BAA2B,CAAC"}
|
package/lib/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2022 TypeFox and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
export * from './common-request-service';
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,cAAc,0BAA0B,CAAC"}
|
package/lib/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/********************************************************************************
|
|
3
|
-
* Copyright (C) 2022 TypeFox and others.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials are made available under the
|
|
6
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
*
|
|
9
|
-
* This Source Code may also be made available under the following Secondary
|
|
10
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
* with the GNU Classpath Exception which is available at
|
|
13
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const tslib_1 = require("tslib");
|
|
19
|
-
tslib_1.__exportStar(require("./common-request-service"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,mEAAyC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2022 TypeFox and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
/// <reference types="node" />
|
|
17
|
-
/// <reference types="node" />
|
|
18
|
-
import * as http from 'http';
|
|
19
|
-
import * as https from 'https';
|
|
20
|
-
import { ProxyAgent } from './proxy';
|
|
21
|
-
import { RequestConfiguration, RequestContext, RequestOptions, RequestService, CancellationToken } from './common-request-service';
|
|
22
|
-
export interface RawRequestFunction {
|
|
23
|
-
(options: http.RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
|
24
|
-
}
|
|
25
|
-
export interface NodeRequestOptions extends RequestOptions {
|
|
26
|
-
agent?: ProxyAgent | http.Agent | https.Agent | boolean;
|
|
27
|
-
strictSSL?: boolean;
|
|
28
|
-
getRawRequest?(options: NodeRequestOptions): RawRequestFunction;
|
|
29
|
-
}
|
|
30
|
-
export declare class NodeRequestService implements RequestService {
|
|
31
|
-
protected proxyUrl?: string;
|
|
32
|
-
protected strictSSL?: boolean;
|
|
33
|
-
protected authorization?: string;
|
|
34
|
-
protected getNodeRequest(options: RequestOptions): RawRequestFunction;
|
|
35
|
-
protected getProxyUrl(url: string): Promise<string | undefined>;
|
|
36
|
-
configure(config: RequestConfiguration): Promise<void>;
|
|
37
|
-
protected processOptions(options: NodeRequestOptions): Promise<NodeRequestOptions>;
|
|
38
|
-
request(options: NodeRequestOptions, token?: CancellationToken): Promise<RequestContext>;
|
|
39
|
-
resolveProxy(url: string): Promise<string | undefined>;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=node-request-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-request-service.d.ts","sourceRoot":"","sources":["../src/node-request-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAiB,UAAU,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAW,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG5I,MAAM,WAAW,kBAAkB;IAC/B,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,KAAK,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC;CACtG;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACtD,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,CAAC,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;CACnE;AAED,qBAAa,kBAAmB,YAAW,cAAc;IACrD,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEjC,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,kBAAkB;cAMrD,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI/D,SAAS,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;cAY5C,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAyBxF,OAAO,CAAC,OAAO,EAAE,kBAAkB,EAAE,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC;IAwFlF,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAG/D"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/********************************************************************************
|
|
3
|
-
* Copyright (C) 2022 TypeFox and others.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials are made available under the
|
|
6
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
*
|
|
9
|
-
* This Source Code may also be made available under the following Secondary
|
|
10
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
* with the GNU Classpath Exception which is available at
|
|
13
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.NodeRequestService = void 0;
|
|
19
|
-
const http = require("http");
|
|
20
|
-
const https = require("https");
|
|
21
|
-
const proxy_1 = require("./proxy");
|
|
22
|
-
const zlib_1 = require("zlib");
|
|
23
|
-
;
|
|
24
|
-
class NodeRequestService {
|
|
25
|
-
getNodeRequest(options) {
|
|
26
|
-
const endpoint = new URL(options.url);
|
|
27
|
-
const module = endpoint.protocol === 'https:' ? https : http;
|
|
28
|
-
return module.request;
|
|
29
|
-
}
|
|
30
|
-
async getProxyUrl(url) {
|
|
31
|
-
return this.proxyUrl;
|
|
32
|
-
}
|
|
33
|
-
async configure(config) {
|
|
34
|
-
if (config.proxyUrl !== undefined) {
|
|
35
|
-
this.proxyUrl = config.proxyUrl;
|
|
36
|
-
}
|
|
37
|
-
if (config.strictSSL !== undefined) {
|
|
38
|
-
this.strictSSL = config.strictSSL;
|
|
39
|
-
}
|
|
40
|
-
if (config.proxyAuthorization !== undefined) {
|
|
41
|
-
this.authorization = config.proxyAuthorization;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async processOptions(options) {
|
|
45
|
-
var _a;
|
|
46
|
-
const { strictSSL } = this;
|
|
47
|
-
options.strictSSL = (_a = options.strictSSL) !== null && _a !== void 0 ? _a : strictSSL;
|
|
48
|
-
const agent = options.agent ? options.agent : (0, proxy_1.getProxyAgent)(options.url || '', process.env, {
|
|
49
|
-
proxyUrl: await this.getProxyUrl(options.url),
|
|
50
|
-
strictSSL: options.strictSSL
|
|
51
|
-
});
|
|
52
|
-
options.agent = agent;
|
|
53
|
-
const authorization = options.proxyAuthorization || this.authorization;
|
|
54
|
-
if (authorization) {
|
|
55
|
-
options.headers = {
|
|
56
|
-
...(options.headers || {}),
|
|
57
|
-
'Proxy-Authorization': authorization
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
options.headers = {
|
|
61
|
-
'Accept-Encoding': 'gzip',
|
|
62
|
-
...(options.headers || {}),
|
|
63
|
-
};
|
|
64
|
-
return options;
|
|
65
|
-
}
|
|
66
|
-
request(options, token) {
|
|
67
|
-
return new Promise(async (resolve, reject) => {
|
|
68
|
-
options = await this.processOptions(options);
|
|
69
|
-
const endpoint = new URL(options.url);
|
|
70
|
-
const rawRequest = options.getRawRequest
|
|
71
|
-
? options.getRawRequest(options)
|
|
72
|
-
: this.getNodeRequest(options);
|
|
73
|
-
const opts = {
|
|
74
|
-
hostname: endpoint.hostname,
|
|
75
|
-
port: endpoint.port ? parseInt(endpoint.port) : (endpoint.protocol === 'https:' ? 443 : 80),
|
|
76
|
-
protocol: endpoint.protocol,
|
|
77
|
-
path: endpoint.pathname + endpoint.search,
|
|
78
|
-
method: options.type || 'GET',
|
|
79
|
-
headers: options.headers,
|
|
80
|
-
agent: options.agent,
|
|
81
|
-
rejectUnauthorized: !!options.strictSSL
|
|
82
|
-
};
|
|
83
|
-
if (options.user && options.password) {
|
|
84
|
-
opts.auth = options.user + ':' + options.password;
|
|
85
|
-
}
|
|
86
|
-
const timeoutHandler = () => {
|
|
87
|
-
reject('timeout');
|
|
88
|
-
};
|
|
89
|
-
const req = rawRequest(opts, async (res) => {
|
|
90
|
-
var _a;
|
|
91
|
-
const followRedirects = (_a = options.followRedirects) !== null && _a !== void 0 ? _a : 3;
|
|
92
|
-
if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers.location) {
|
|
93
|
-
req.off('timeout', timeoutHandler);
|
|
94
|
-
this.request({
|
|
95
|
-
...options,
|
|
96
|
-
url: res.headers.location,
|
|
97
|
-
followRedirects: followRedirects - 1
|
|
98
|
-
}, token).then(resolve, reject);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
const chunks = [];
|
|
102
|
-
const stream = res.headers['content-encoding'] === 'gzip' ? res.pipe((0, zlib_1.createGunzip)()) : res;
|
|
103
|
-
stream.on('data', chunk => {
|
|
104
|
-
chunks.push(chunk);
|
|
105
|
-
});
|
|
106
|
-
stream.on('end', () => {
|
|
107
|
-
req.off('timeout', timeoutHandler);
|
|
108
|
-
const buffer = Buffer.concat(chunks);
|
|
109
|
-
resolve({
|
|
110
|
-
url: options.url,
|
|
111
|
-
res: {
|
|
112
|
-
headers: res.headers,
|
|
113
|
-
statusCode: res.statusCode
|
|
114
|
-
},
|
|
115
|
-
buffer
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
stream.on('error', err => {
|
|
119
|
-
reject(err);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
req.on('error', err => {
|
|
124
|
-
reject(err);
|
|
125
|
-
});
|
|
126
|
-
req.on('timeout', timeoutHandler);
|
|
127
|
-
if (options.timeout) {
|
|
128
|
-
req.setTimeout(options.timeout);
|
|
129
|
-
}
|
|
130
|
-
if (options.data) {
|
|
131
|
-
req.write(options.data);
|
|
132
|
-
}
|
|
133
|
-
req.end();
|
|
134
|
-
token === null || token === void 0 ? void 0 : token.onCancellationRequested(() => {
|
|
135
|
-
req.destroy();
|
|
136
|
-
reject();
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
async resolveProxy(url) {
|
|
141
|
-
return undefined;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.NodeRequestService = NodeRequestService;
|
|
145
|
-
//# sourceMappingURL=node-request-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-request-service.js","sourceRoot":"","sources":["../src/node-request-service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,6BAA6B;AAC7B,+BAA+B;AAC/B,mCAAoD;AAEpD,+BAAoC;AAUnC,CAAC;AAEF,MAAa,kBAAkB;IAKjB,cAAc,CAAC,OAAuB;QAC5C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7D,OAAO,MAAM,CAAC,OAAO,CAAC;IAC1B,CAAC;IAES,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAA4B;QACxC,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACpC,CAAC;QACD,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QACtC,CAAC;QACD,IAAI,MAAM,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YAC1C,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,kBAAkB,CAAC;QACnD,CAAC;IACL,CAAC;IAES,KAAK,CAAC,cAAc,CAAC,OAA2B;;QACtD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAC3B,OAAO,CAAC,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,SAAS,CAAC;QACnD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,O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AG,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACpC,CAAC;YAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;gBACf,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;YAED,GAAG,CAAC,GAAG,EAAE,CAAC;YAEV,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,uBAAuB,CAAC,GAAG,EAAE;gBAChC,GAAG,CAAC,OAAO,EAAE,CAAC;gBACd,MAAM,EAAE,CAAC;YACb,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW;QAC1B,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AA/ID,gDA+IC"}
|
package/lib/package.spec.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2022 TypeFox and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
//# sourceMappingURL=package.spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF"}
|
package/lib/package.spec.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2022 TypeFox and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
/* note: this bogus test file is required so that
|
|
17
|
-
we are able to run mocha unit tests on this
|
|
18
|
-
package, without having any actual unit tests in it.
|
|
19
|
-
This way a coverage report will be generated,
|
|
20
|
-
showing 0% coverage, instead of no report.
|
|
21
|
-
This file can be removed once we have real unit
|
|
22
|
-
tests in place. */
|
|
23
|
-
describe('request package', () => {
|
|
24
|
-
it('should support code coverage statistics', () => true);
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=package.spec.js.map
|
package/lib/package.spec.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF;;;;;;qBAMqB;AAErB,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAE7B,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC,CAAC,CAAC"}
|
package/lib/proxy.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2022 TypeFox and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
import * as httpAgent from 'http-proxy-agent';
|
|
17
|
-
import * as httpsAgent from 'https-proxy-agent';
|
|
18
|
-
export type ProxyAgent = httpAgent.HttpProxyAgent | httpsAgent.HttpsProxyAgent;
|
|
19
|
-
export interface ProxySettings {
|
|
20
|
-
proxyUrl?: string;
|
|
21
|
-
strictSSL?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare function getProxyAgent(rawRequestURL: string, env: typeof process.env, options?: ProxySettings): ProxyAgent | undefined;
|
|
24
|
-
//# sourceMappingURL=proxy.d.ts.map
|
package/lib/proxy.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAEhD,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,cAAc,GAAG,UAAU,CAAC,eAAe,CAAC;AAY/E,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,OAAO,CAAC,GAAG,EAAE,OAAO,GAAE,aAAkB,GAAG,UAAU,GAAG,SAAS,CAuBjI"}
|
package/lib/proxy.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/********************************************************************************
|
|
3
|
-
* Copyright (C) 2022 TypeFox and others.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials are made available under the
|
|
6
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
*
|
|
9
|
-
* This Source Code may also be made available under the following Secondary
|
|
10
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
* with the GNU Classpath Exception which is available at
|
|
13
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.getProxyAgent = void 0;
|
|
19
|
-
const url_1 = require("url");
|
|
20
|
-
const httpAgent = require("http-proxy-agent");
|
|
21
|
-
const httpsAgent = require("https-proxy-agent");
|
|
22
|
-
function getSystemProxyURI(requestURL, env) {
|
|
23
|
-
if (requestURL.protocol === 'http:') {
|
|
24
|
-
return env.HTTP_PROXY || env.http_proxy;
|
|
25
|
-
}
|
|
26
|
-
else if (requestURL.protocol === 'https:') {
|
|
27
|
-
return env.HTTPS_PROXY || env.https_proxy || env.HTTP_PROXY || env.http_proxy;
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
function getProxyAgent(rawRequestURL, env, options = {}) {
|
|
32
|
-
const requestURL = (0, url_1.parse)(rawRequestURL);
|
|
33
|
-
const proxyURL = options.proxyUrl || getSystemProxyURI(requestURL, env);
|
|
34
|
-
if (!proxyURL) {
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
const proxyEndpoint = (0, url_1.parse)(proxyURL);
|
|
38
|
-
if (!/^https?:$/.test(proxyEndpoint.protocol || '')) {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
const opts = {
|
|
42
|
-
host: proxyEndpoint.hostname || '',
|
|
43
|
-
port: proxyEndpoint.port || (proxyEndpoint.protocol === 'https' ? '443' : '80'),
|
|
44
|
-
auth: proxyEndpoint.auth,
|
|
45
|
-
rejectUnauthorized: !!options.strictSSL,
|
|
46
|
-
};
|
|
47
|
-
const createAgent = requestURL.protocol === 'http:' ? httpAgent : httpsAgent;
|
|
48
|
-
return createAgent(opts);
|
|
49
|
-
}
|
|
50
|
-
exports.getProxyAgent = getProxyAgent;
|
|
51
|
-
//# sourceMappingURL=proxy.js.map
|
package/lib/proxy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,6BAA6C;AAC7C,8CAA8C;AAC9C,gDAAgD;AAIhD,SAAS,iBAAiB,CAAC,UAAe,EAAE,GAAuB;IAC/D,IAAI,UAAU,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QAClC,OAAO,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,UAAU,CAAC;IAC5C,CAAC;SAAM,IAAI,UAAU,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,UAAU,CAAC;IAClF,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,C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