@intuitionrobotics/thunderstorm 0.41.67 → 0.41.70
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/app-backend/api/v1/utils/version/_assert.js +1 -1
- package/app-backend/api/v1/utils/version/_assert.js.map +1 -1
- package/app-backend/api/v1/utils/version/assert.js +13 -58
- package/app-backend/api/v1/utils/version/assert.js.map +1 -1
- package/app-backend/core/BaseStorm.js +34 -87
- package/app-backend/core/BaseStorm.js.map +1 -1
- package/app-backend/core/Storm.js +42 -112
- package/app-backend/core/Storm.js.map +1 -1
- package/app-backend/exceptions.js +11 -27
- package/app-backend/exceptions.js.map +1 -1
- package/app-backend/modules/CleanupScheduler.js +24 -92
- package/app-backend/modules/CleanupScheduler.js.map +1 -1
- package/app-backend/modules/FirestoreBackupScheduler.js +47 -138
- package/app-backend/modules/FirestoreBackupScheduler.js.map +1 -1
- package/app-backend/modules/ForceUpgrade.js +31 -82
- package/app-backend/modules/ForceUpgrade.js.map +1 -1
- package/app-backend/modules/http/AxiosHttpModule.js +116 -184
- package/app-backend/modules/http/AxiosHttpModule.js.map +1 -1
- package/app-backend/modules/proxy/RemoteProxy.js +40 -90
- package/app-backend/modules/proxy/RemoteProxy.js.map +1 -1
- package/app-backend/modules/proxy/RemoteProxyCaller.js +49 -122
- package/app-backend/modules/proxy/RemoteProxyCaller.js.map +1 -1
- package/app-backend/modules/server/HttpServer.js +153 -216
- package/app-backend/modules/server/HttpServer.js.map +1 -1
- package/app-backend/modules/server/server-api.js +236 -361
- package/app-backend/modules/server/server-api.js.map +1 -1
- package/app-backend/modules/server/server-errors.js +51 -91
- package/app-backend/modules/server/server-errors.js.map +1 -1
- package/app-backend/utils/LogClient_File.js +23 -42
- package/app-backend/utils/LogClient_File.js.map +1 -1
- package/app-backend/utils/file.js +7 -50
- package/app-backend/utils/file.js.map +1 -1
- package/app-backend/utils/promisify-request.js +13 -43
- package/app-backend/utils/promisify-request.js.map +1 -1
- package/app-backend/utils/to-be-removed.js +7 -8
- package/app-backend/utils/to-be-removed.js.map +1 -1
- package/app-backend/utils/types.js +1 -1
- package/app-backend/utils/types.js.map +1 -1
- package/app-frontend/components/ActionButton.js +5 -5
- package/app-frontend/components/ActionButton.js.map +1 -1
- package/app-frontend/components/DropDown.js +91 -119
- package/app-frontend/components/DropDown.js.map +1 -1
- package/app-frontend/components/FilterInput.js +31 -48
- package/app-frontend/components/FilterInput.js.map +1 -1
- package/app-frontend/components/GenericSelect.js +30 -59
- package/app-frontend/components/GenericSelect.js.map +1 -1
- package/app-frontend/components/GenericTabs.js +5 -23
- package/app-frontend/components/GenericTabs.js.map +1 -1
- package/app-frontend/components/Overlay.js +15 -34
- package/app-frontend/components/Overlay.js.map +1 -1
- package/app-frontend/components/TS_Input.js +43 -60
- package/app-frontend/components/TS_Input.js.map +1 -1
- package/app-frontend/components/TS_Table.js +31 -48
- package/app-frontend/components/TS_Table.js.map +1 -1
- package/app-frontend/components/TS_TextArea.js +21 -48
- package/app-frontend/components/TS_TextArea.js.map +1 -1
- package/app-frontend/components/Tabs.js +16 -33
- package/app-frontend/components/Tabs.js.map +1 -1
- package/app-frontend/components/adapter/Adapter.js +103 -154
- package/app-frontend/components/adapter/Adapter.js.map +1 -1
- package/app-frontend/components/adapter/BaseRenderer.js +9 -32
- package/app-frontend/components/adapter/BaseRenderer.js.map +1 -1
- package/app-frontend/components/checkbox/TS_Checkbox.js +12 -29
- package/app-frontend/components/checkbox/TS_Checkbox.js.map +1 -1
- package/app-frontend/components/checkbox/TS_CheckboxField.js +16 -34
- package/app-frontend/components/checkbox/TS_CheckboxField.js.map +1 -1
- package/app-frontend/components/form/Form.js +21 -39
- package/app-frontend/components/form/Form.js.map +1 -1
- package/app-frontend/components/playground/Example_NewProps.js +25 -53
- package/app-frontend/components/playground/Example_NewProps.js.map +1 -1
- package/app-frontend/components/playground/Playground.js +21 -49
- package/app-frontend/components/playground/Playground.js.map +1 -1
- package/app-frontend/components/tree/MenuComponent.js +11 -27
- package/app-frontend/components/tree/MenuComponent.js.map +1 -1
- package/app-frontend/components/tree/MultiTypeAdaptor.js +16 -32
- package/app-frontend/components/tree/MultiTypeAdaptor.js.map +1 -1
- package/app-frontend/components/tree/SimpleTreeNodeRenderer.js +18 -52
- package/app-frontend/components/tree/SimpleTreeNodeRenderer.js.map +1 -1
- package/app-frontend/components/tree/Tree.js +142 -178
- package/app-frontend/components/tree/Tree.js.map +1 -1
- package/app-frontend/components/treeicons.js +5 -5
- package/app-frontend/components/treeicons.js.map +1 -1
- package/app-frontend/core/AbstractThunder.js +27 -43
- package/app-frontend/core/AbstractThunder.js.map +1 -1
- package/app-frontend/core/AppPage.js +16 -32
- package/app-frontend/core/AppPage.js.map +1 -1
- package/app-frontend/core/AppWrapper.js +9 -10
- package/app-frontend/core/AppWrapper.js.map +1 -1
- package/app-frontend/core/BaseComponent.js +62 -106
- package/app-frontend/core/BaseComponent.js.map +1 -1
- package/app-frontend/core/SimpleScriptInjector.js +12 -31
- package/app-frontend/core/SimpleScriptInjector.js.map +1 -1
- package/app-frontend/core/Thunder.js +32 -48
- package/app-frontend/core/Thunder.js.map +1 -1
- package/app-frontend/core/thunder-dispatcher.js +18 -67
- package/app-frontend/core/thunder-dispatcher.js.map +1 -1
- package/app-frontend/modules/ConnectivityModule.js +16 -32
- package/app-frontend/modules/ConnectivityModule.js.map +1 -1
- package/app-frontend/modules/ForceUpgrade.js +17 -33
- package/app-frontend/modules/ForceUpgrade.js.map +1 -1
- package/app-frontend/modules/HistoryModule.js +51 -79
- package/app-frontend/modules/HistoryModule.js.map +1 -1
- package/app-frontend/modules/ResourcesModule.js +12 -28
- package/app-frontend/modules/ResourcesModule.js.map +1 -1
- package/app-frontend/modules/StorageModule.js +47 -68
- package/app-frontend/modules/StorageModule.js.map +1 -1
- package/app-frontend/modules/ThunderstormModule.js +15 -31
- package/app-frontend/modules/ThunderstormModule.js.map +1 -1
- package/app-frontend/modules/component-loader/ReactEntryComponentInjector.js +24 -41
- package/app-frontend/modules/component-loader/ReactEntryComponentInjector.js.map +1 -1
- package/app-frontend/modules/component-loader/entry-component-loading-module.js +19 -36
- package/app-frontend/modules/component-loader/entry-component-loading-module.js.map +1 -1
- package/app-frontend/modules/dialog/Dialog.js +55 -96
- package/app-frontend/modules/dialog/Dialog.js.map +1 -1
- package/app-frontend/modules/dialog/DialogModule.js +48 -84
- package/app-frontend/modules/dialog/DialogModule.js.map +1 -1
- package/app-frontend/modules/http/HttpClient.js +46 -93
- package/app-frontend/modules/http/HttpClient.js.map +1 -1
- package/app-frontend/modules/http/XhrHttpModule.js +66 -88
- package/app-frontend/modules/http/XhrHttpModule.js.map +1 -1
- package/app-frontend/modules/locale/LocaleModule.js +23 -50
- package/app-frontend/modules/locale/LocaleModule.js.map +1 -1
- package/app-frontend/modules/menu/MenuAndButton.js +23 -40
- package/app-frontend/modules/menu/MenuAndButton.js.map +1 -1
- package/app-frontend/modules/menu/MenuModule.js +25 -42
- package/app-frontend/modules/menu/MenuModule.js.map +1 -1
- package/app-frontend/modules/menu/PopupMenu.js +37 -64
- package/app-frontend/modules/menu/PopupMenu.js.map +1 -1
- package/app-frontend/modules/routing/RoutingModule.js +47 -66
- package/app-frontend/modules/routing/RoutingModule.js.map +1 -1
- package/app-frontend/modules/routing/route.js +31 -33
- package/app-frontend/modules/routing/route.js.map +1 -1
- package/app-frontend/modules/toaster/BaseToaster.js +18 -36
- package/app-frontend/modules/toaster/BaseToaster.js.map +1 -1
- package/app-frontend/modules/toaster/Toaster.js +12 -38
- package/app-frontend/modules/toaster/Toaster.js.map +1 -1
- package/app-frontend/modules/toaster/ToasterModule.js +61 -88
- package/app-frontend/modules/toaster/ToasterModule.js.map +1 -1
- package/app-frontend/modules/tooltip/Tooltip.js +25 -52
- package/app-frontend/modules/tooltip/Tooltip.js.map +1 -1
- package/app-frontend/modules/tooltip/TooltipModule.js +32 -51
- package/app-frontend/modules/tooltip/TooltipModule.js.map +1 -1
- package/app-frontend/tools/KeyboardListener.js +24 -41
- package/app-frontend/tools/KeyboardListener.js.map +1 -1
- package/app-frontend/tools/Stylable.js +14 -28
- package/app-frontend/tools/Stylable.js.map +1 -1
- package/app-frontend/utils/tools.js +8 -8
- package/app-frontend/utils/tools.js.map +1 -1
- package/app-frontend/widgets/FieldEditor.js +16 -32
- package/app-frontend/widgets/FieldEditor.js.map +1 -1
- package/app-frontend/widgets/FieldEditorClick.js +32 -49
- package/app-frontend/widgets/FieldEditorClick.js.map +1 -1
- package/app-frontend/widgets/FieldEditorWithButtons.js +33 -49
- package/app-frontend/widgets/FieldEditorWithButtons.js.map +1 -1
- package/app-frontend/widgets/click-to-drag/ClickToDrag.js +25 -41
- package/app-frontend/widgets/click-to-drag/ClickToDrag.js.map +1 -1
- package/app-frontend/widgets/click-to-drag/OverlayWithDocumentListener.js +22 -38
- package/app-frontend/widgets/click-to-drag/OverlayWithDocumentListener.js.map +1 -1
- package/package.json +4 -4
- package/shared/BaseHttpModule.js +44 -64
- package/shared/BaseHttpModule.js.map +1 -1
- package/shared/BaseHttpRequest.js +122 -176
- package/shared/BaseHttpRequest.js.map +1 -1
- package/shared/request-types.js +4 -19
- package/shared/request-types.js.map +1 -1
- package/test-backend/StormTester.js +37 -90
- package/test-backend/StormTester.js.map +1 -1
|
@@ -1,28 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __assign = (this && this.__assign) || function () {
|
|
16
|
-
__assign = Object.assign || function(t) {
|
|
17
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
-
s = arguments[i];
|
|
19
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
-
t[p] = s[p];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
return __assign.apply(this, arguments);
|
|
25
|
-
};
|
|
26
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,33 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
9
|
});
|
|
34
10
|
};
|
|
35
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
36
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
37
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
38
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
|
-
function step(op) {
|
|
40
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
41
|
-
while (_) try {
|
|
42
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
43
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
44
|
-
switch (op[0]) {
|
|
45
|
-
case 0: case 1: t = op; break;
|
|
46
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
47
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49
|
-
default:
|
|
50
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
51
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
52
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
53
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
54
|
-
if (t[2]) _.ops.pop();
|
|
55
|
-
_.trys.pop(); continue;
|
|
56
|
-
}
|
|
57
|
-
op = body.call(thisArg, _);
|
|
58
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
59
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
12
|
exports.AxiosHttpModule = exports.AxiosHttpModule_Class = void 0;
|
|
64
13
|
/*
|
|
@@ -82,26 +31,24 @@ exports.AxiosHttpModule = exports.AxiosHttpModule_Class = void 0;
|
|
|
82
31
|
* limitations under the License.
|
|
83
32
|
*/
|
|
84
33
|
// noinspection TypeScriptPreferShortImport
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
_this.requestOption = {};
|
|
96
|
-
return _this;
|
|
34
|
+
const axios_1 = require("axios");
|
|
35
|
+
const types_1 = require("../../../shared/types");
|
|
36
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
37
|
+
const BaseHttpRequest_1 = require("../../../shared/BaseHttpRequest");
|
|
38
|
+
const BaseHttpModule_1 = require("../../../shared/BaseHttpModule");
|
|
39
|
+
const fs = require("fs");
|
|
40
|
+
class AxiosHttpModule_Class extends BaseHttpModule_1.BaseHttpModule_Class {
|
|
41
|
+
constructor() {
|
|
42
|
+
super(...arguments);
|
|
43
|
+
this.requestOption = {};
|
|
97
44
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
45
|
+
init() {
|
|
46
|
+
super.init();
|
|
47
|
+
const origin = this.config.origin;
|
|
101
48
|
if (origin)
|
|
102
49
|
this.origin = origin;
|
|
103
|
-
}
|
|
104
|
-
|
|
50
|
+
}
|
|
51
|
+
createRequest(method, key, data) {
|
|
105
52
|
return new AxiosHttpRequest(key, data, this.shouldCompress())
|
|
106
53
|
.setOrigin(this.origin)
|
|
107
54
|
.setMethod(method)
|
|
@@ -111,139 +58,124 @@ var AxiosHttpModule_Class = /** @class */ (function (_super) {
|
|
|
111
58
|
.setHandleRequestFailure(this.handleRequestFailure)
|
|
112
59
|
.setDefaultRequestHandler(this.processDefaultResponseHandlers)
|
|
113
60
|
.setRequestOption(this.requestOption);
|
|
114
|
-
}
|
|
115
|
-
|
|
61
|
+
}
|
|
62
|
+
setRequestOption(requestOption) {
|
|
116
63
|
this.requestOption = requestOption;
|
|
117
64
|
return this;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return [4 /*yield*/, downloadRequest.executeSync()];
|
|
131
|
-
case 2:
|
|
132
|
-
downloadResponse = _a.sent();
|
|
133
|
-
outputFolder = outputFile.substring(0, outputFile.lastIndexOf("/"));
|
|
134
|
-
if (!fs.existsSync(outputFolder))
|
|
135
|
-
fs.mkdirSync(outputFolder);
|
|
136
|
-
fs.writeFileSync(outputFile, downloadResponse);
|
|
137
|
-
return [2 /*return*/, outputFile];
|
|
138
|
-
}
|
|
139
|
-
});
|
|
65
|
+
}
|
|
66
|
+
downloadFile(url, outputFile, key = `Download file: ${url}`) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const downloadRequest = yield this.createRequest(types_1.HttpMethod.GET, key)
|
|
69
|
+
.setResponseType("arraybuffer")
|
|
70
|
+
.setUrl(url);
|
|
71
|
+
const downloadResponse = yield downloadRequest.executeSync();
|
|
72
|
+
const outputFolder = outputFile.substring(0, outputFile.lastIndexOf("/"));
|
|
73
|
+
if (!fs.existsSync(outputFolder))
|
|
74
|
+
fs.mkdirSync(outputFolder);
|
|
75
|
+
fs.writeFileSync(outputFile, downloadResponse);
|
|
76
|
+
return outputFile;
|
|
140
77
|
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
}(BaseHttpModule_1.BaseHttpModule_Class));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
144
80
|
exports.AxiosHttpModule_Class = AxiosHttpModule_Class;
|
|
145
81
|
exports.AxiosHttpModule = new AxiosHttpModule_Class();
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
_this.cancelSignal = axios_1.default.CancelToken.source();
|
|
153
|
-
return _this;
|
|
82
|
+
class AxiosHttpRequest extends BaseHttpRequest_1.BaseHttpRequest {
|
|
83
|
+
constructor(requestKey, requestData, shouldCompress) {
|
|
84
|
+
super(requestKey, requestData);
|
|
85
|
+
this.requestOption = {};
|
|
86
|
+
this.compress = shouldCompress === undefined ? false : shouldCompress;
|
|
87
|
+
this.cancelSignal = axios_1.default.CancelToken.source();
|
|
154
88
|
}
|
|
155
|
-
|
|
89
|
+
getStatus() {
|
|
156
90
|
if (!this.status)
|
|
157
91
|
throw new ts_common_1.BadImplementationException('Missing status..');
|
|
158
92
|
return this.status;
|
|
159
|
-
}
|
|
160
|
-
|
|
93
|
+
}
|
|
94
|
+
getResponse() {
|
|
161
95
|
var _a;
|
|
162
96
|
return (_a = this.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
163
|
-
}
|
|
164
|
-
|
|
97
|
+
}
|
|
98
|
+
resolveResponse() {
|
|
165
99
|
return this.getResponse();
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
this.cancelSignal.cancel(
|
|
169
|
-
}
|
|
170
|
-
|
|
100
|
+
}
|
|
101
|
+
abortImpl() {
|
|
102
|
+
this.cancelSignal.cancel(`Request with key: '${this.key}' aborted by the user.`);
|
|
103
|
+
}
|
|
104
|
+
getErrorResponse() {
|
|
171
105
|
return { debugMessage: this.getResponse() };
|
|
172
|
-
}
|
|
173
|
-
|
|
106
|
+
}
|
|
107
|
+
setRequestOption(requestOption) {
|
|
174
108
|
this.requestOption = requestOption;
|
|
175
109
|
return this;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
var _this = this;
|
|
110
|
+
}
|
|
111
|
+
executeImpl() {
|
|
179
112
|
//loop through whatever preprocessor
|
|
180
|
-
return new Promise(
|
|
181
|
-
var
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
this.status = ((_c = this.response) === null || _c === void 0 ? void 0 : _c.status) || 500;
|
|
236
|
-
return [2 /*return*/, reject(e_1)];
|
|
237
|
-
case 4: return [2 /*return*/];
|
|
113
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
var _a, _b;
|
|
115
|
+
if (this.aborted)
|
|
116
|
+
return resolve();
|
|
117
|
+
let nextOperator = this.url.indexOf("?") === -1 ? "?" : "&";
|
|
118
|
+
const fullUrl = Object.keys(this.params).reduce((url, paramKey) => {
|
|
119
|
+
const param = this.params[paramKey];
|
|
120
|
+
if (!param)
|
|
121
|
+
return url;
|
|
122
|
+
const toRet = `${url}${nextOperator}${paramKey}=${encodeURIComponent(param)}`;
|
|
123
|
+
nextOperator = "&";
|
|
124
|
+
return toRet;
|
|
125
|
+
}, this.url);
|
|
126
|
+
// TODO set progress listener
|
|
127
|
+
// this.xhr.upload.onprogress = this.onProgressListener;
|
|
128
|
+
const body = this.body;
|
|
129
|
+
if (body)
|
|
130
|
+
this.addHeader("Content-Length", `${body.length}`);
|
|
131
|
+
// TODO add zipping of body
|
|
132
|
+
// if (typeof body === "string" && this.compress)
|
|
133
|
+
// return gzip(body, (error: Error | null, result: Buffer) => {
|
|
134
|
+
// if (error)
|
|
135
|
+
// return reject(error);
|
|
136
|
+
//
|
|
137
|
+
// xhr.send(result);
|
|
138
|
+
// });
|
|
139
|
+
//
|
|
140
|
+
// this.xhr.send(body as BodyInit);
|
|
141
|
+
const headers = Object.keys(this.headers).reduce((carry, headerKey) => {
|
|
142
|
+
carry[headerKey] = this.headers[headerKey].join('; ');
|
|
143
|
+
return carry;
|
|
144
|
+
}, {});
|
|
145
|
+
const options = Object.assign(Object.assign({}, this.requestOption), { url: fullUrl, method: this.method, headers: headers,
|
|
146
|
+
// TODO will probably need to use the abortController with a timeout for this.
|
|
147
|
+
timeout: this.timeout, cancelToken: this.cancelSignal.token });
|
|
148
|
+
if (body)
|
|
149
|
+
options.data = body;
|
|
150
|
+
if (this.responseType)
|
|
151
|
+
options.responseType = this.responseType;
|
|
152
|
+
try {
|
|
153
|
+
this.response = yield axios_1.default.request(options);
|
|
154
|
+
this.status = ((_a = this.response) === null || _a === void 0 ? void 0 : _a.status) || 200;
|
|
155
|
+
return resolve();
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
// console.log('In catch');
|
|
159
|
+
// TODO handle this here
|
|
160
|
+
// if (xhr.readyState === 4 && xhr.status === 0) {
|
|
161
|
+
// reject(new HttpException(404, this.url));
|
|
162
|
+
// return;
|
|
163
|
+
// }
|
|
164
|
+
if (axios_1.default.isCancel(e)) {
|
|
165
|
+
// Should already be set when I abort but just in case its aborted somehow else
|
|
166
|
+
this.aborted = true;
|
|
167
|
+
console.log('Api cancelled: ', e.message);
|
|
238
168
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
169
|
+
this.response = e.response;
|
|
170
|
+
this.status = ((_b = this.response) === null || _b === void 0 ? void 0 : _b.status) || 500;
|
|
171
|
+
return reject(e);
|
|
172
|
+
}
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
getResponseHeader(headerKey) {
|
|
243
176
|
if (!this.response)
|
|
244
|
-
throw new ts_common_1.BadImplementationException(
|
|
177
|
+
throw new ts_common_1.BadImplementationException(`axios didn't return yet`);
|
|
245
178
|
return this.response.headers[headerKey];
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
}(BaseHttpRequest_1.BaseHttpRequest));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
249
181
|
//# sourceMappingURL=AxiosHttpModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AxiosHttpModule.js","sourceRoot":"","sources":["../../../../src/main/app-backend/modules/http/AxiosHttpModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AxiosHttpModule.js","sourceRoot":"","sources":["../../../../src/main/app-backend/modules/http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pB,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;iBAC1C;gBAED,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;gBAC3B,IAAI,CAAC,MAAM,GAAG,OAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,KAAI,GAAG,CAAC;gBAC3C,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;aACjB;QACF,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,SAAiB;QAClC,IAAI,CAAC,IAAI,CAAC,QAAQ;YACjB,MAAM,IAAI,sCAA0B,CAAC,yBAAyB,CAAC,CAAC;QAEjE,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;CACD"}
|
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -21,33 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
9
|
});
|
|
23
10
|
};
|
|
24
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
25
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
26
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
27
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
28
|
-
function step(op) {
|
|
29
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
30
|
-
while (_) try {
|
|
31
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
32
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
33
|
-
switch (op[0]) {
|
|
34
|
-
case 0: case 1: t = op; break;
|
|
35
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
36
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
37
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
38
|
-
default:
|
|
39
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
40
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
41
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
42
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
43
|
-
if (t[2]) _.ops.pop();
|
|
44
|
-
_.trys.pop(); continue;
|
|
45
|
-
}
|
|
46
|
-
op = body.call(thisArg, _);
|
|
47
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
48
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
12
|
exports.RemoteProxy = exports.RemoteProxy_Class = void 0;
|
|
53
13
|
/*
|
|
@@ -70,38 +30,31 @@ exports.RemoteProxy = exports.RemoteProxy_Class = void 0;
|
|
|
70
30
|
* See the License for the specific language governing permissions and
|
|
71
31
|
* limitations under the License.
|
|
72
32
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
exports.RemoteProxy.assertSecret(request);
|
|
83
|
-
return [2 /*return*/];
|
|
84
|
-
});
|
|
85
|
-
}); };
|
|
86
|
-
return _this;
|
|
33
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
34
|
+
const HttpServer_1 = require("../server/HttpServer");
|
|
35
|
+
const exceptions_1 = require("../../exceptions");
|
|
36
|
+
class RemoteProxy_Class extends ts_common_1.Module {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
this.Middleware = (request) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
exports.RemoteProxy.assertSecret(request);
|
|
41
|
+
});
|
|
87
42
|
}
|
|
88
|
-
|
|
89
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}];
|
|
101
|
-
});
|
|
43
|
+
__queryRequestInfo(request) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
let data;
|
|
46
|
+
try {
|
|
47
|
+
data = this.proxyHeader.get(request);
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
key: this.getName(),
|
|
53
|
+
data
|
|
54
|
+
};
|
|
102
55
|
});
|
|
103
|
-
}
|
|
104
|
-
|
|
56
|
+
}
|
|
57
|
+
init() {
|
|
105
58
|
if (!this.config)
|
|
106
59
|
throw new ts_common_1.ImplementationMissingException("MUST specify config for this module!!");
|
|
107
60
|
if (!this.config.secretHeaderName)
|
|
@@ -110,35 +63,32 @@ var RemoteProxy_Class = /** @class */ (function (_super) {
|
|
|
110
63
|
this.config.proxyHeaderName = 'x-proxy';
|
|
111
64
|
this.secretHeader = new HttpServer_1.HeaderKey(this.config.secretHeaderName);
|
|
112
65
|
this.proxyHeader = new HttpServer_1.HeaderKey(this.config.proxyHeaderName);
|
|
113
|
-
}
|
|
114
|
-
|
|
66
|
+
}
|
|
67
|
+
assertSecret(request) {
|
|
115
68
|
if (!this.secretHeader || !this.proxyHeader)
|
|
116
69
|
throw new ts_common_1.ImplementationMissingException("MUST add RemoteProxy to your module list!!!");
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
70
|
+
const secret = this.secretHeader.get(request);
|
|
71
|
+
const proxyId = this.proxyHeader.get(request);
|
|
72
|
+
const expectedSecret = this.config.remotes[proxyId];
|
|
120
73
|
if (!proxyId)
|
|
121
|
-
throw new exceptions_1.ApiException(403,
|
|
74
|
+
throw new exceptions_1.ApiException(403, `Missing proxy declaration in config for ${proxyId} !!`);
|
|
122
75
|
if (!secret)
|
|
123
|
-
throw new exceptions_1.ApiException(403,
|
|
76
|
+
throw new exceptions_1.ApiException(403, `Missing secret !!`);
|
|
124
77
|
if (!expectedSecret)
|
|
125
|
-
throw new exceptions_1.ApiException(403,
|
|
78
|
+
throw new exceptions_1.ApiException(403, `ProxyId '${proxyId}' is not registered for remote access !!`);
|
|
126
79
|
if (expectedSecret.secret !== secret)
|
|
127
|
-
throw new exceptions_1.ApiException(403,
|
|
128
|
-
|
|
80
|
+
throw new exceptions_1.ApiException(403, `Secret does not match for proxyId: ${proxyId}`);
|
|
81
|
+
const requestUrl = request.path;
|
|
129
82
|
if (!expectedSecret.urls || !expectedSecret.urls.includes(requestUrl))
|
|
130
|
-
throw new exceptions_1.ApiException(403,
|
|
83
|
+
throw new exceptions_1.ApiException(403, `Requested url '${requestUrl}' is not allowed from proxyId: ${proxyId}`);
|
|
131
84
|
return expectedSecret.extras;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
135
|
-
return
|
|
136
|
-
return [2 /*return*/, this.assertSecret(request)];
|
|
137
|
-
});
|
|
85
|
+
}
|
|
86
|
+
processApi(request, requestData) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
return this.assertSecret(request);
|
|
138
89
|
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
}(ts_common_1.Module));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
142
92
|
exports.RemoteProxy_Class = RemoteProxy_Class;
|
|
143
93
|
exports.RemoteProxy = new RemoteProxy_Class();
|
|
144
94
|
//# sourceMappingURL=RemoteProxy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteProxy.js","sourceRoot":"","sources":["../../../../src/main/app-backend/modules/proxy/RemoteProxy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RemoteProxy.js","sourceRoot":"","sources":["../../../../src/main/app-backend/modules/proxy/RemoteProxy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAIsC;AAEtC,qDAG8B;AAC9B,iDAA8C;AAoB9C,MAAa,iBACZ,SAAQ,kBAAc;IADvB;;QAgBU,eAAU,GAAyB,CAAO,OAAuB,EAAE,EAAE;YAC7E,mBAAW,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC,CAAA,CAAC;IAiDH,CAAC;IA/DM,kBAAkB,CAAC,OAAuB;;YAC/C,IAAI,IAAwB,CAAC;YAC7B,IAA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