@theia/request 1.45.0 → 1.46.0-next.72
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/README.md +29 -29
- package/lib/common-request-service.d.ts +75 -75
- package/lib/common-request-service.js +84 -84
- package/lib/index.d.ts +16 -16
- package/lib/index.js +28 -28
- package/lib/node-request-service.d.ts +38 -38
- package/lib/node-request-service.js +134 -134
- package/lib/package.spec.d.ts +15 -15
- package/lib/package.spec.js +25 -25
- package/lib/proxy.d.ts +23 -23
- package/lib/proxy.js +50 -50
- package/package.json +2 -2
- package/src/common-request-service.ts +127 -127
- package/src/index.ts +17 -17
- package/src/node-request-service.ts +165 -165
- package/src/package.spec.ts +28 -28
- package/src/proxy.ts +61 -61
package/README.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
<div align='center'>
|
|
2
|
-
|
|
3
|
-
<br />
|
|
4
|
-
|
|
5
|
-
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
-
|
|
7
|
-
<h2>ECLIPSE THEIA - REQUEST</h2>
|
|
8
|
-
|
|
9
|
-
<hr />
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## Description
|
|
14
|
-
|
|
15
|
-
The `@theia/request` package is used to send proxy-aware http requests to other services.
|
|
16
|
-
|
|
17
|
-
## Additional Information
|
|
18
|
-
|
|
19
|
-
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
20
|
-
- [Theia - Website](https://theia-ide.org/)
|
|
21
|
-
|
|
22
|
-
## License
|
|
23
|
-
|
|
24
|
-
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
25
|
-
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
26
|
-
|
|
27
|
-
## Trademark
|
|
28
|
-
"Theia" is a trademark of the Eclipse Foundation
|
|
29
|
-
https://www.eclipse.org/theia
|
|
1
|
+
<div align='center'>
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
+
|
|
7
|
+
<h2>ECLIPSE THEIA - REQUEST</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
|
|
15
|
+
The `@theia/request` package is used to send proxy-aware http requests to other services.
|
|
16
|
+
|
|
17
|
+
## Additional Information
|
|
18
|
+
|
|
19
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
20
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
21
|
+
|
|
22
|
+
## License
|
|
23
|
+
|
|
24
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
25
|
+
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
26
|
+
|
|
27
|
+
## Trademark
|
|
28
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
29
|
+
https://www.eclipse.org/theia
|
|
@@ -1,76 +1,76 @@
|
|
|
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
|
-
}
|
|
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
76
|
//# sourceMappingURL=common-request-service.d.ts.map
|
|
@@ -1,85 +1,85 @@
|
|
|
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 || (exports.RequestContext = {}));
|
|
82
|
-
exports.RequestService = Symbol('RequestService');
|
|
83
|
-
exports.BackendRequestService = Symbol('BackendRequestService');
|
|
84
|
-
exports.REQUEST_SERVICE_PATH = '/services/request-service';
|
|
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 || (exports.RequestContext = {}));
|
|
82
|
+
exports.RequestService = Symbol('RequestService');
|
|
83
|
+
exports.BackendRequestService = Symbol('BackendRequestService');
|
|
84
|
+
exports.REQUEST_SERVICE_PATH = '/services/request-service';
|
|
85
85
|
//# sourceMappingURL=common-request-service.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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';
|
|
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
17
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
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
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
__exportStar(require("./common-request-service"), exports);
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
__exportStar(require("./common-request-service"), exports);
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,39 +1,39 @@
|
|
|
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
|
-
import * as http from 'http';
|
|
18
|
-
import { ProxyAgent } from './proxy';
|
|
19
|
-
import { RequestConfiguration, RequestContext, RequestOptions, RequestService, CancellationToken } from './common-request-service';
|
|
20
|
-
export interface RawRequestFunction {
|
|
21
|
-
(options: http.RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
|
22
|
-
}
|
|
23
|
-
export interface NodeRequestOptions extends RequestOptions {
|
|
24
|
-
agent?: ProxyAgent;
|
|
25
|
-
strictSSL?: boolean;
|
|
26
|
-
getRawRequest?(options: NodeRequestOptions): RawRequestFunction;
|
|
27
|
-
}
|
|
28
|
-
export declare class NodeRequestService implements RequestService {
|
|
29
|
-
protected proxyUrl?: string;
|
|
30
|
-
protected strictSSL?: boolean;
|
|
31
|
-
protected authorization?: string;
|
|
32
|
-
protected getNodeRequest(options: RequestOptions): RawRequestFunction;
|
|
33
|
-
protected getProxyUrl(url: string): Promise<string | undefined>;
|
|
34
|
-
configure(config: RequestConfiguration): Promise<void>;
|
|
35
|
-
protected processOptions(options: NodeRequestOptions): Promise<NodeRequestOptions>;
|
|
36
|
-
request(options: NodeRequestOptions, token?: CancellationToken): Promise<RequestContext>;
|
|
37
|
-
resolveProxy(url: string): Promise<string | undefined>;
|
|
38
|
-
}
|
|
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
|
+
import * as http from 'http';
|
|
18
|
+
import { ProxyAgent } from './proxy';
|
|
19
|
+
import { RequestConfiguration, RequestContext, RequestOptions, RequestService, CancellationToken } from './common-request-service';
|
|
20
|
+
export interface RawRequestFunction {
|
|
21
|
+
(options: http.RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
|
|
22
|
+
}
|
|
23
|
+
export interface NodeRequestOptions extends RequestOptions {
|
|
24
|
+
agent?: ProxyAgent;
|
|
25
|
+
strictSSL?: boolean;
|
|
26
|
+
getRawRequest?(options: NodeRequestOptions): RawRequestFunction;
|
|
27
|
+
}
|
|
28
|
+
export declare class NodeRequestService implements RequestService {
|
|
29
|
+
protected proxyUrl?: string;
|
|
30
|
+
protected strictSSL?: boolean;
|
|
31
|
+
protected authorization?: string;
|
|
32
|
+
protected getNodeRequest(options: RequestOptions): RawRequestFunction;
|
|
33
|
+
protected getProxyUrl(url: string): Promise<string | undefined>;
|
|
34
|
+
configure(config: RequestConfiguration): Promise<void>;
|
|
35
|
+
protected processOptions(options: NodeRequestOptions): Promise<NodeRequestOptions>;
|
|
36
|
+
request(options: NodeRequestOptions, token?: CancellationToken): Promise<RequestContext>;
|
|
37
|
+
resolveProxy(url: string): Promise<string | undefined>;
|
|
38
|
+
}
|
|
39
39
|
//# sourceMappingURL=node-request-service.d.ts.map
|