@intuitionrobotics/thunderstorm 0.41.76 → 0.42.2
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/modules/proxy/RemoteProxyCaller.d.ts +3 -2
- package/app-backend/modules/proxy/RemoteProxyCaller.js +12 -11
- package/app-backend/modules/proxy/RemoteProxyCaller.js.map +1 -1
- package/app-backend/utils/promisify-request.d.ts +2 -3
- package/app-backend/utils/promisify-request.js +22 -11
- package/app-backend/utils/promisify-request.js.map +1 -1
- package/app-frontend/modules/http/HttpClient.d.ts +0 -21
- package/app-frontend/modules/http/HttpClient.js +123 -106
- package/app-frontend/modules/http/HttpClient.js.map +1 -1
- package/backend.d.ts +0 -1
- package/backend.js +0 -1
- package/backend.js.map +1 -1
- package/package.json +5 -7
- package/app-frontend/types/request.d.ts +0 -2
- package/app-frontend/types/request.js +0 -23
- package/app-frontend/types/request.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Module } from "@intuitionrobotics/ts-common";
|
|
2
2
|
import { DeriveBodyType, DeriveQueryType, DeriveResponseType, DeriveUrlType, QueryParams } from "../../../shared/types";
|
|
3
|
+
import { AxiosResponse } from "axios";
|
|
3
4
|
export declare type RemoteServerConfig = {
|
|
4
5
|
secretHeaderName: string;
|
|
5
6
|
proxyHeaderName: string;
|
|
@@ -11,9 +12,9 @@ export declare class RemoteProxyCaller<Config extends RemoteServerConfig> extend
|
|
|
11
12
|
protected init(): void;
|
|
12
13
|
protected executeGetRequest: <Binder extends import("../../../shared/types").ApiTypeBinder<U, R, void, P, any>, U extends string = DeriveUrlType<Binder>, R = DeriveResponseType<Binder>, P extends QueryParams = DeriveQueryType<Binder>>(url: U, _params: P, _headers?: {
|
|
13
14
|
[key: string]: string;
|
|
14
|
-
} | undefined) => Promise<R
|
|
15
|
+
} | undefined) => Promise<AxiosResponse<R, any>>;
|
|
15
16
|
protected executePostRequest: <Binder extends import("../../../shared/types").ApiTypeBinder<U, B, R, {}, any>, U extends string = DeriveUrlType<Binder>, R = DeriveResponseType<Binder>, B = DeriveBodyType<Binder>>(url: U, body: B, _headers?: {
|
|
16
17
|
[key: string]: string;
|
|
17
|
-
} | undefined) => Promise<R
|
|
18
|
+
} | undefined) => Promise<AxiosResponse<R, any>>;
|
|
18
19
|
private executeRequest;
|
|
19
20
|
}
|
|
@@ -45,37 +45,38 @@ class RemoteProxyCaller extends ts_common_1.Module {
|
|
|
45
45
|
urlParams = `?${params.join("&")}`;
|
|
46
46
|
const proxyRequest = {
|
|
47
47
|
headers: Object.assign(Object.assign({}, _headers), { [this.config.secretHeaderName]: this.config.secret, [this.config.proxyHeaderName]: this.config.proxyId }),
|
|
48
|
-
|
|
48
|
+
url: `${this.config.url}${url}${urlParams}`,
|
|
49
49
|
method: 'GET',
|
|
50
|
-
|
|
50
|
+
responseType: 'json'
|
|
51
51
|
};
|
|
52
52
|
return yield this.executeRequest(proxyRequest);
|
|
53
53
|
});
|
|
54
54
|
this.executePostRequest = (url, body, _headers) => __awaiter(this, void 0, void 0, function* () {
|
|
55
55
|
const proxyRequest = {
|
|
56
56
|
headers: Object.assign(Object.assign({}, _headers), { 'Content-Type': 'application/json', [this.config.secretHeaderName]: this.config.secret, [this.config.proxyHeaderName]: this.config.proxyId }),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
responseType: "json",
|
|
58
|
+
url: `${this.config.url}${url}`,
|
|
59
|
+
data: body,
|
|
60
60
|
method: 'POST'
|
|
61
61
|
};
|
|
62
62
|
return this.executeRequest(proxyRequest);
|
|
63
63
|
});
|
|
64
64
|
this.executeRequest = (proxyRequest) => __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const response = yield promisify_request_1.promisifyRequest(proxyRequest
|
|
65
|
+
const response = yield promisify_request_1.promisifyRequest(proxyRequest);
|
|
66
66
|
if (proxyRequest.headers)
|
|
67
67
|
delete proxyRequest.headers[this.config.secretHeaderName];
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
const statusCode = response.status;
|
|
69
|
+
// TODO: need to handle 1XX and 3XX
|
|
70
|
+
if (statusCode < 200 || statusCode >= 300) {
|
|
71
|
+
const errorResponse = response.data;
|
|
71
72
|
if (!errorResponse)
|
|
72
73
|
throw new exceptions_1.ApiException(500, `Extraneous error ${ts_common_1.__stringify(response)}, Proxy Request: ${ts_common_1.__stringify(proxyRequest, true)}`);
|
|
73
|
-
const e = new exceptions_1.ApiException(response.
|
|
74
|
+
const e = new exceptions_1.ApiException(response.status, `Redirect proxy error: ${errorResponse.debugMessage} \n Proxy Request: ${ts_common_1.__stringify(proxyRequest, true)}`);
|
|
74
75
|
if (errorResponse.error)
|
|
75
76
|
e.setErrorBody(errorResponse.error);
|
|
76
77
|
throw e;
|
|
77
78
|
}
|
|
78
|
-
return response
|
|
79
|
+
return response;
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
init() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteProxyCaller.js","sourceRoot":"","sources":["../../../../src/main/app-backend/modules/proxy/RemoteProxyCaller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAIsC;
|
|
1
|
+
{"version":3,"file":"RemoteProxyCaller.js","sourceRoot":"","sources":["../../../../src/main/app-backend/modules/proxy/RemoteProxyCaller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAIsC;AAWtC,qEAA+D;AAC/D,iDAA8C;AAc9C,MAAa,iBACZ,SAAQ,kBAAc;IADvB;;QAuBW,sBAAiB,GAAG,CAAwK,GAAM,EAAE,OAAU,EAAE,QAAoC,EAA6B,EAAE;YAC5R,MAAM,MAAM,GAAG,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC1D,OAAO,GAA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AA8C,CAAC,CAAC;QAE1F,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;YACtB,MAAM,IAAI,0CAA8B,CAAC,iDAAiD,CAAC,CAAC;QAE7F,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB;YAChC,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAE3C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe;YAC/B,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,SAAS,CAAC;IAC1C,CAAC;CAiED;AAtFD,8CAsFC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function promisifyRequest(request: RequestOptions, throwException?: boolean): Promise<Response>;
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
|
+
export declare function promisifyRequest(_request: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
@@ -30,20 +30,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.promisifyRequest = void 0;
|
|
33
|
-
const _request = require("request");
|
|
34
33
|
const exceptions_1 = require("../exceptions");
|
|
35
34
|
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
36
|
-
|
|
35
|
+
const axios_1 = require("axios");
|
|
36
|
+
function promisifyRequest(_request) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
try {
|
|
39
|
+
return yield axios_1.default.request(_request);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
const resp = error.response;
|
|
43
|
+
if (resp) {
|
|
44
|
+
// The request was made and the server responded with a status code
|
|
45
|
+
// that falls out of the range of 2xx
|
|
46
|
+
return resp;
|
|
47
|
+
}
|
|
48
|
+
// if (error.request)
|
|
49
|
+
// The request was made but no response was received
|
|
50
|
+
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
51
|
+
// http.ClientRequest in node.js
|
|
52
|
+
throw new exceptions_1.ApiException(503, `Error: ${ts_common_1.__stringify(error)}\n Request: ${ts_common_1.__stringify(_request, true)}`);
|
|
53
|
+
// Something happened in setting up the request that triggered an Error
|
|
54
|
+
// console.log('Error', error.message);
|
|
55
|
+
//
|
|
56
|
+
// console.log(error.config);
|
|
57
|
+
}
|
|
47
58
|
});
|
|
48
59
|
}
|
|
49
60
|
exports.promisifyRequest = promisifyRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promisify-request.js","sourceRoot":"","sources":["../../../src/main/app-backend/utils/promisify-request.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"promisify-request.js","sourceRoot":"","sources":["../../../src/main/app-backend/utils/promisify-request.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;AAGH,8CAA2C;AAC3C,4DAAyD;AACzD,iCAGe;AAEf,SAAsB,gBAAgB,CAAC,QAA4B;;QAClE,IAAI;YACH,OAAO,MAAM,eAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SACrC;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC;YAC5B,IAAI,IAAI,EAAE;gBACT,mEAAmE;gBACnE,qCAAqC;gBACrC,OAAO,IAAI,CAAC;aACZ;YAED,qBAAqB;YACrB,oDAAoD;YACpD,qFAAqF;YACrF,gCAAgC;YAEhC,MAAM,IAAI,yBAAY,CAAC,GAAG,EAAE,UAAU,uBAAW,CAAC,KAAK,CAAC,eAAe,uBAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;YAErG,uEAAuE;YACvE,uCAAuC;YACvC,EAAE;YACF,6BAA6B;SAC7B;IACF,CAAC;CAAA;AAvBD,4CAuBC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { StringMap } from "@intuitionrobotics/ts-common";
|
|
3
|
-
export declare const createFormData: (filename: string, buffer: Buffer) => {
|
|
4
|
-
file: {
|
|
5
|
-
value: Buffer;
|
|
6
|
-
options: {
|
|
7
|
-
filename: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare class HttpClient {
|
|
12
|
-
private defaultHeaders;
|
|
13
|
-
private readonly baseUrl;
|
|
14
|
-
constructor(baseUrl: string);
|
|
15
|
-
setDefaultHeaders(defaultHeaders: Headers): void;
|
|
16
|
-
form(path: string, buffer: Buffer, headers?: Headers): Promise<any>;
|
|
17
|
-
get(path: string, _params?: StringMap, headers?: Headers): Promise<any>;
|
|
18
|
-
post(path: string, body: any, headers?: Headers): Promise<any>;
|
|
19
|
-
put(path: string, body: any, headers?: Headers): Promise<any>;
|
|
20
|
-
private executeRequest;
|
|
21
|
-
}
|
|
@@ -1,108 +1,125 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
2
|
+
// /*
|
|
3
|
+
// * Thunderstorm is a full web app framework!
|
|
4
|
+
// *
|
|
5
|
+
// * Typescript & Express backend infrastructure that natively runs on firebase function
|
|
6
|
+
// * Typescript & React frontend infrastructure
|
|
7
|
+
// *
|
|
8
|
+
// * Copyright (C) 2020 Intuition Robotics
|
|
9
|
+
// *
|
|
10
|
+
// * Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
// * you may not use this file except in compliance with the License.
|
|
12
|
+
// * You may obtain a copy of the License at
|
|
13
|
+
// *
|
|
14
|
+
// * http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
// *
|
|
16
|
+
// * Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
// * distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
// * See the License for the specific language governing permissions and
|
|
20
|
+
// * limitations under the License.
|
|
21
|
+
// */
|
|
22
|
+
//
|
|
23
|
+
// import {
|
|
24
|
+
// __stringify,
|
|
25
|
+
// StringMap
|
|
26
|
+
// } from "@intuitionrobotics/ts-common";
|
|
27
|
+
// import {
|
|
28
|
+
// ErrorResponse,
|
|
29
|
+
// HttpMethod
|
|
30
|
+
// } from "../../..";
|
|
31
|
+
// import {
|
|
32
|
+
// ApiException,
|
|
33
|
+
// promisifyRequest,
|
|
34
|
+
// RequestOptions
|
|
35
|
+
// } from "../../../backend";
|
|
36
|
+
//
|
|
37
|
+
// export const createFormData = (filename: string, buffer: Buffer) => ({file: {value: buffer, options: {filename}}});
|
|
38
|
+
//
|
|
39
|
+
// export class HttpClient {
|
|
40
|
+
//
|
|
41
|
+
// private defaultHeaders!: Headers;
|
|
42
|
+
// private readonly baseUrl: string;
|
|
43
|
+
//
|
|
44
|
+
// constructor(baseUrl: string) {
|
|
45
|
+
// this.baseUrl = baseUrl;
|
|
46
|
+
// }
|
|
47
|
+
//
|
|
48
|
+
// setDefaultHeaders(defaultHeaders: Headers) {
|
|
49
|
+
// this.defaultHeaders = defaultHeaders
|
|
50
|
+
// }
|
|
51
|
+
//
|
|
52
|
+
// form(path: string, buffer: Buffer, headers?: Headers) {
|
|
53
|
+
// const request: RequestOptions = {
|
|
54
|
+
// headers: {...this.defaultHeaders, headers},
|
|
55
|
+
// uri: `${this.baseUrl}${path}`,
|
|
56
|
+
// formData: createFormData('logs.zip', buffer),
|
|
57
|
+
// method: HttpMethod.POST,
|
|
58
|
+
// };
|
|
59
|
+
// return this.executeRequest(request);
|
|
60
|
+
// }
|
|
61
|
+
//
|
|
62
|
+
// get(path: string, _params?: StringMap, headers?: Headers) {
|
|
63
|
+
// let url = `${this.baseUrl}${path}`;
|
|
64
|
+
//
|
|
65
|
+
// let nextOperator = "?";
|
|
66
|
+
// if (url.indexOf("?") !== -1)
|
|
67
|
+
// nextOperator = "&";
|
|
68
|
+
//
|
|
69
|
+
// if (_params)
|
|
70
|
+
// url = Object.keys(_params).reduce((fullUrl: string, paramKey: string) => {
|
|
71
|
+
// const param: string | undefined = _params[paramKey];
|
|
72
|
+
// if (!param)
|
|
73
|
+
// return url;
|
|
74
|
+
//
|
|
75
|
+
// const temp = `${fullUrl}${nextOperator}${paramKey}=${encodeURIComponent(param)}`;
|
|
76
|
+
// nextOperator = "&";
|
|
77
|
+
// return temp;
|
|
78
|
+
// }, url);
|
|
79
|
+
//
|
|
80
|
+
// const request: RequestOptions = {
|
|
81
|
+
// headers: {...this.defaultHeaders, headers},
|
|
82
|
+
// uri: `${url}`,
|
|
83
|
+
// method: HttpMethod.GET,
|
|
84
|
+
// json: true
|
|
85
|
+
// };
|
|
86
|
+
// return this.executeRequest(request);
|
|
87
|
+
// }
|
|
88
|
+
//
|
|
89
|
+
// post(path: string, body: any, headers?: Headers) {
|
|
90
|
+
// const request: RequestOptions = {
|
|
91
|
+
// headers: {...this.defaultHeaders, ...headers},
|
|
92
|
+
// uri: `${this.baseUrl}${path}`,
|
|
93
|
+
// body,
|
|
94
|
+
// method: HttpMethod.POST,
|
|
95
|
+
// json: true
|
|
96
|
+
// };
|
|
97
|
+
// return this.executeRequest(request);
|
|
98
|
+
//
|
|
99
|
+
// }
|
|
100
|
+
//
|
|
101
|
+
// put(path: string, body: any, headers?: Headers) {
|
|
102
|
+
// const request: RequestOptions = {
|
|
103
|
+
// headers: {...this.defaultHeaders, headers},
|
|
104
|
+
// uri: `${this.baseUrl}${path}`,
|
|
105
|
+
// body,
|
|
106
|
+
// method: HttpMethod.PUT,
|
|
107
|
+
// json: true
|
|
108
|
+
// };
|
|
109
|
+
// return this.executeRequest(request);
|
|
110
|
+
// }
|
|
111
|
+
//
|
|
112
|
+
// private executeRequest = async (body: RequestOptions) => {
|
|
113
|
+
// const response = await promisifyRequest(body);
|
|
114
|
+
// const statusCode = response.status;
|
|
115
|
+
// if (statusCode >= 200 && statusCode < 300)
|
|
116
|
+
// return response.data;
|
|
117
|
+
//
|
|
118
|
+
// const errorResponse: ErrorResponse<any> = response.data;
|
|
119
|
+
// if (!errorResponse)
|
|
120
|
+
// throw new ApiException(statusCode, `Http request failed without error message: ${__stringify(body, true)}`);
|
|
121
|
+
//
|
|
122
|
+
// throw new ApiException<any>(statusCode, `Http request failed: ${errorResponse} \n For Request: ${__stringify(body, true)}`);
|
|
123
|
+
// };
|
|
124
|
+
// }
|
|
108
125
|
//# sourceMappingURL=HttpClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClient.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/http/HttpClient.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"HttpClient.js","sourceRoot":"","sources":["../../../../src/main/app-frontend/modules/http/HttpClient.ts"],"names":[],"mappings":";AAAA,KAAK;AACL,+CAA+C;AAC/C,KAAK;AACL,yFAAyF;AACzF,gDAAgD;AAChD,KAAK;AACL,2CAA2C;AAC3C,KAAK;AACL,qEAAqE;AACrE,sEAAsE;AACtE,6CAA6C;AAC7C,KAAK;AACL,oDAAoD;AACpD,KAAK;AACL,yEAAyE;AACzE,uEAAuE;AACvE,8EAA8E;AAC9E,yEAAyE;AACzE,oCAAoC;AACpC,MAAM;AACN,EAAE;AACF,WAAW;AACX,gBAAgB;AAChB,aAAa;AACb,yCAAyC;AACzC,WAAW;AACX,kBAAkB;AAClB,cAAc;AACd,qBAAqB;AACrB,WAAW;AACX,iBAAiB;AACjB,qBAAqB;AACrB,kBAAkB;AAClB,6BAA6B;AAC7B,EAAE;AACF,sHAAsH;AACtH,EAAE;AACF,4BAA4B;AAC5B,EAAE;AACF,qCAAqC;AACrC,qCAAqC;AACrC,EAAE;AACF,kCAAkC;AAClC,4BAA4B;AAC5B,KAAK;AACL,EAAE;AACF,gDAAgD;AAChD,yCAAyC;AACzC,KAAK;AACL,EAAE;AACF,2DAA2D;AAC3D,sCAAsC;AACtC,iDAAiD;AACjD,oCAAoC;AACpC,mDAAmD;AACnD,8BAA8B;AAC9B,OAAO;AACP,yCAAyC;AACzC,KAAK;AACL,EAAE;AACF,+DAA+D;AAC/D,wCAAwC;AACxC,EAAE;AACF,4BAA4B;AAC5B,iCAAiC;AACjC,yBAAyB;AACzB,EAAE;AACF,iBAAiB;AACjB,gFAAgF;AAChF,2DAA2D;AAC3D,kBAAkB;AAClB,mBAAmB;AACnB,EAAE;AACF,wFAAwF;AACxF,0BAA0B;AAC1B,mBAAmB;AACnB,cAAc;AACd,EAAE;AACF,sCAAsC;AACtC,iDAAiD;AACjD,oBAAoB;AACpB,6BAA6B;AAC7B,gBAAgB;AAChB,OAAO;AACP,yCAAyC;AACzC,KAAK;AACL,EAAE;AACF,sDAAsD;AACtD,sCAAsC;AACtC,oDAAoD;AACpD,oCAAoC;AACpC,WAAW;AACX,8BAA8B;AAC9B,gBAAgB;AAChB,OAAO;AACP,yCAAyC;AACzC,EAAE;AACF,KAAK;AACL,EAAE;AACF,qDAAqD;AACrD,sCAAsC;AACtC,iDAAiD;AACjD,oCAAoC;AACpC,WAAW;AACX,6BAA6B;AAC7B,gBAAgB;AAChB,OAAO;AACP,yCAAyC;AACzC,KAAK;AACL,EAAE;AACF,8DAA8D;AAC9D,mDAAmD;AACnD,wCAAwC;AACxC,+CAA+C;AAC/C,2BAA2B;AAC3B,EAAE;AACF,6DAA6D;AAC7D,wBAAwB;AACxB,kHAAkH;AAClH,EAAE;AACF,iIAAiI;AACjI,MAAM;AACN,IAAI"}
|
package/backend.d.ts
CHANGED
package/backend.js
CHANGED
|
@@ -47,5 +47,4 @@ __exportStar(require("./app-backend/utils/LogClient_File"), exports);
|
|
|
47
47
|
__exportStar(require("./app-backend/utils/file"), exports);
|
|
48
48
|
__exportStar(require("./app-backend/exceptions"), exports);
|
|
49
49
|
__exportStar(require("./app-backend/core/Storm"), exports);
|
|
50
|
-
__exportStar(require("./app-frontend/types/request"), exports);
|
|
51
50
|
//# sourceMappingURL=backend.js.map
|
package/backend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/main/backend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;AAEH,gFAA8D;AAC9D,0EAAwD;AACxD,yEAAuD;AACvD,iFAA+D;AAC/D,6EAA2D;AAC3D,0EAAwD;AACxD,0EAAwD;AACxD,6EAA2D;AAC3D,mEAAiD;AACjD,qEAAmD;AACnD,wEAAsD;AACtD,oEAAkD;AAClD,4DAA0C;AAC1C,qEAAmD;AACnD,2DAAyC;AACzC,2DAAyC;AACzC,2DAAyC
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/main/backend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;AAEH,gFAA8D;AAC9D,0EAAwD;AACxD,yEAAuD;AACvD,iFAA+D;AAC/D,6EAA2D;AAC3D,0EAAwD;AACxD,0EAAwD;AACxD,6EAA2D;AAC3D,mEAAiD;AACjD,qEAAmD;AACnD,wEAAsD;AACtD,oEAAkD;AAClD,4DAA0C;AAC1C,qEAAmD;AACnD,2DAAyC;AACzC,2DAAyC;AACzC,2DAAyC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuitionrobotics/thunderstorm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.2",
|
|
4
4
|
"description": "Thunderstorm",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"IR",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"build": "tsc"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@intuitionrobotics/firebase": "~0.
|
|
31
|
-
"@intuitionrobotics/testelot": "~0.
|
|
32
|
-
"@intuitionrobotics/ts-common": "~0.
|
|
30
|
+
"@intuitionrobotics/firebase": "~0.42.0",
|
|
31
|
+
"@intuitionrobotics/testelot": "~0.42.0",
|
|
32
|
+
"@intuitionrobotics/ts-common": "~0.42.0",
|
|
33
33
|
"abort-controller": "^3.0.0",
|
|
34
|
-
"axios": "^0.
|
|
34
|
+
"axios": "^0.27.2",
|
|
35
35
|
"browserify-zlib": "^0.2.0",
|
|
36
36
|
"buffer": "^6.0.3",
|
|
37
37
|
"crypto-browserify": "^3.12.0",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"react-router": "^5.1.2",
|
|
46
46
|
"react-router-dom": "^5.1.2",
|
|
47
47
|
"react-select": "^4.0.0",
|
|
48
|
-
"request": "^2.88.0",
|
|
49
48
|
"stream-browserify": "^3.0.0"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
@@ -60,7 +59,6 @@
|
|
|
60
59
|
"@types/react-router": "^5.1.4",
|
|
61
60
|
"@types/react-router-dom": "^5.1.3",
|
|
62
61
|
"@types/react-select": "^4.0.0",
|
|
63
|
-
"@types/request": "^2.48.1",
|
|
64
62
|
"body-parser": "^1.19.0",
|
|
65
63
|
"compression": "^1.7.4",
|
|
66
64
|
"csstype": "^3.0.0",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Thunderstorm is a full web app framework!
|
|
4
|
-
*
|
|
5
|
-
* Typescript & Express backend infrastructure that natively runs on firebase function
|
|
6
|
-
* Typescript & React frontend infrastructure
|
|
7
|
-
*
|
|
8
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
9
|
-
*
|
|
10
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
-
* you may not use this file except in compliance with the License.
|
|
12
|
-
* You may obtain a copy of the License at
|
|
13
|
-
*
|
|
14
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
-
* See the License for the specific language governing permissions and
|
|
20
|
-
* limitations under the License.
|
|
21
|
-
*/
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
//# sourceMappingURL=request.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/main/app-frontend/types/request.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
|