@loadmill/universal 0.3.172 → 0.3.173-rc.1
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.
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProxyServerUrl = exports.isProxyServerSet = void 0;
|
|
4
|
+
var isProxyServerSet = function () {
|
|
5
|
+
return !!process.env.LOADMILL_PROXY_URL;
|
|
6
|
+
};
|
|
7
|
+
exports.isProxyServerSet = isProxyServerSet;
|
|
8
|
+
var getProxyServerUrl = function () {
|
|
9
|
+
return process.env.LOADMILL_PROXY_URL || null;
|
|
10
|
+
};
|
|
11
|
+
exports.getProxyServerUrl = getProxyServerUrl;
|
|
12
|
+
//# sourceMappingURL=proxy-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-server.js","sourceRoot":"","sources":["../src/proxy-server.ts"],"names":[],"mappings":";;;AAAO,IAAM,gBAAgB,GAAG;IAC9B,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;AAC1C,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEK,IAAM,iBAAiB,GAAG;IAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,IAAI,CAAC;AAChD,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const applySuperAgentProxy: () => void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applySuperAgentProxy = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var superagent_1 = tslib_1.__importDefault(require("superagent"));
|
|
6
|
+
var proxy_server_1 = require("./proxy-server");
|
|
7
|
+
var log_1 = tslib_1.__importDefault(require("./log"));
|
|
8
|
+
var applySuperAgentProxy = function () {
|
|
9
|
+
if ((0, proxy_server_1.isProxyServerSet)()) {
|
|
10
|
+
log_1.default.info('Applying superagent proxy settings');
|
|
11
|
+
require('superagent-proxy')(superagent_1.default);
|
|
12
|
+
var proxyUrl_1 = (0, proxy_server_1.getProxyServerUrl)();
|
|
13
|
+
log_1.default.info('Using proxy server', { proxyUrl: proxyUrl_1 });
|
|
14
|
+
['get', 'post', 'put', 'patch', 'delete', 'head'].forEach(function (method) {
|
|
15
|
+
var orig = superagent_1.default[method];
|
|
16
|
+
superagent_1.default[method] = function () {
|
|
17
|
+
var args = [];
|
|
18
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
19
|
+
args[_i] = arguments[_i];
|
|
20
|
+
}
|
|
21
|
+
log_1.default.info("Proxying superagent ".concat(method, " request"), { args: args });
|
|
22
|
+
var req = orig.apply(this, args);
|
|
23
|
+
return req.proxy(proxyUrl_1);
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.applySuperAgentProxy = applySuperAgentProxy;
|
|
29
|
+
//# sourceMappingURL=super-agent-proxy-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"super-agent-proxy-wrapper.js","sourceRoot":"","sources":["../src/super-agent-proxy-wrapper.ts"],"names":[],"mappings":";;;;AAAA,kEAAoC;AACpC,+CAAqE;AACrE,sDAAwB;AAEjB,IAAM,oBAAoB,GAAG;IAClC,IAAI,IAAA,+BAAgB,GAAE,EAAE;QACtB,aAAG,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QAC/C,OAAO,CAAC,kBAAkB,CAAC,CAAC,oBAAU,CAAC,CAAC;QAExC,IAAM,UAAQ,GAAG,IAAA,gCAAiB,GAAE,CAAC;QACrC,aAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,QAAQ,YAAA,EAAE,CAAC,CAAC;QAC7C,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,MAAM;YAC9D,IAAM,IAAI,GAAG,oBAAU,CAAC,MAAM,CAAC,CAAC;YAChC,oBAAU,CAAC,MAAM,CAAC,GAAG;gBAAU,cAAc;qBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;oBAAd,yBAAc;;gBAC3C,aAAG,CAAC,IAAI,CAAC,8BAAuB,MAAM,aAAU,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;gBAC5D,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBACnC,OAAO,GAAG,CAAC,KAAK,CAAC,UAAQ,CAAC,CAAC;YAC7B,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;AACH,CAAC,CAAC;AAhBW,QAAA,oBAAoB,wBAgB/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadmill/universal",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.173-rc.1",
|
|
4
4
|
"description": "Loadmill universal utilities",
|
|
5
5
|
"main": "dist/",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"quickselect": "^2.0.0",
|
|
39
39
|
"source-map-support": "^0.5.0",
|
|
40
40
|
"stack-trace": "^0.0.10",
|
|
41
|
+
"superagent-proxy": "^3.0.0",
|
|
41
42
|
"tslib": "^2.8.1",
|
|
42
43
|
"urijs": "^1.18.1",
|
|
43
44
|
"uuid": "^3.0.1"
|