@intuitionrobotics/thunderstorm 0.42.8 → 0.42.9
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/modules/ForceUpgrade.d.ts +4 -7
- package/app-backend/modules/ForceUpgrade.js +42 -27
- package/app-backend/modules/ForceUpgrade.js.map +1 -1
- package/app-frontend/modules/ForceUpgrade.js +2 -2
- package/app-frontend/modules/ForceUpgrade.js.map +1 -1
- package/app-frontend/utils/tools.d.ts +2 -2
- package/package.json +1 -1
- package/shared/consts.d.ts +1 -1
- package/shared/force-upgrade.d.ts +3 -5
- package/shared/force-upgrade.js +3 -4
- package/shared/force-upgrade.js.map +1 -1
|
@@ -36,7 +36,7 @@ const ForceUpgrade_1 = require("../../../../modules/ForceUpgrade");
|
|
|
36
36
|
class ServerApi_AssertAppVersion extends server_api_1.ServerApi {
|
|
37
37
|
constructor() {
|
|
38
38
|
super(types_1.HttpMethod.GET, "assert");
|
|
39
|
-
this.addHeaderToLog(force_upgrade_1.
|
|
39
|
+
this.addHeaderToLog(force_upgrade_1.HeaderKey_PlatformVersion, force_upgrade_1.HeaderKey_PlatformName);
|
|
40
40
|
}
|
|
41
41
|
process(request, response, queryParams, body) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../../../../../../src/main/app-backend/api/v1/utils/version/assert.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;AAGH,
|
|
1
|
+
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../../../../../../src/main/app-backend/api/v1/utils/version/assert.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;AAGH,uEAI6C;AAC7C,sEAG+C;AAC/C,uDAAuD;AACvD,mEAA+D;AAI/D,MAAM,0BACL,SAAQ,sBAAqC;IAE7C;QACC,KAAK,CAAC,kBAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAChC,IAAI,CAAC,cAAc,CAAC,yCAAyB,EAAE,sCAAsB,CAAC,CAAC;IACxE,CAAC;IAEe,OAAO,CAAC,OAAuB,EAAE,QAAqB,EAAE,WAAe,EAAE,IAAU;;YAClG,OAAO,2BAAY,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;KAAA;CACD;AAED,MAAM,CAAC,OAAO,GAAG,IAAI,0BAA0B,EAAE,CAAC"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Module } from "@intuitionrobotics/ts-common";
|
|
2
2
|
import { ServerApi_Middleware } from "./server/HttpServer";
|
|
3
3
|
import { UpgradeRequired } from "../../shared/force-upgrade";
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformName } from "../../shared/consts";
|
|
5
5
|
import { ExpressRequest } from "../utils/types";
|
|
6
6
|
declare type VersionConfig = {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
[K in PlatformName]: {
|
|
8
|
+
regexp: string;
|
|
9
|
+
minimumValidVersion?: string;
|
|
9
10
|
};
|
|
10
|
-
browser: {
|
|
11
|
-
[K in Browser]: string;
|
|
12
|
-
};
|
|
13
|
-
app: string;
|
|
14
11
|
};
|
|
15
12
|
declare class ForceUpgrade_Class extends Module<VersionConfig> {
|
|
16
13
|
static readonly Middleware: ServerApi_Middleware;
|
|
@@ -34,39 +34,54 @@ const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
|
34
34
|
const HttpServer_1 = require("./server/HttpServer");
|
|
35
35
|
const exceptions_1 = require("../exceptions");
|
|
36
36
|
const force_upgrade_1 = require("../../shared/force-upgrade");
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
37
|
+
const Header_PlatformVersion = new HttpServer_1.HeaderKey(force_upgrade_1.HeaderKey_PlatformVersion);
|
|
38
|
+
const Header_PlatformName = new HttpServer_1.HeaderKey(force_upgrade_1.HeaderKey_PlatformName);
|
|
39
|
+
// const DefaultRegexps: { [k in PlatformName]: string } = {
|
|
40
|
+
// chrome: "Chrome/([0-9\.]+)"
|
|
41
|
+
// };
|
|
43
42
|
class ForceUpgrade_Class extends ts_common_1.Module {
|
|
44
43
|
compareVersion(request) {
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (!
|
|
50
|
-
throw new
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
57
|
-
throw new ts_common_1.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
44
|
+
const platformVersion = Header_PlatformVersion.get(request);
|
|
45
|
+
const platformName = Header_PlatformName.get(request);
|
|
46
|
+
if (!platformName)
|
|
47
|
+
throw new exceptions_1.ApiException(500, `Platform name was not specified`);
|
|
48
|
+
if (!platformVersion)
|
|
49
|
+
throw new exceptions_1.ApiException(500, `Platform version was not specified`);
|
|
50
|
+
const platformNameConfig = this.config[platformName];
|
|
51
|
+
if (!platformNameConfig || !platformNameConfig.regexp)
|
|
52
|
+
return {}; // no info about this platformName
|
|
53
|
+
const regex = new RegExp(platformNameConfig.regexp);
|
|
54
|
+
const match = platformVersion.match(regex);
|
|
55
|
+
if (!match)
|
|
56
|
+
throw new ts_common_1.BadImplementationException(`Error extracting version.. \nVersion: '${platformVersion}'\n config: '${ts_common_1.__stringify(this.config)}'`);
|
|
57
|
+
const minimumValidVersion = platformNameConfig.minimumValidVersion;
|
|
58
|
+
if (!minimumValidVersion)
|
|
59
|
+
return {
|
|
60
|
+
upgradeRequired: false
|
|
61
|
+
};
|
|
62
|
+
const matchGroups = match.groups;
|
|
63
|
+
if (!matchGroups)
|
|
64
|
+
throw new ts_common_1.BadImplementationException(`If minimumValidVersion is provided ${platformNameConfig.minimumValidVersion}, then groups in regex have to be defined ${ts_common_1.__stringify(match)}. i.e. "(?<first>[0-9]+).(?<second>[0-9]+).(?<third>[0-9]+)"`);
|
|
65
|
+
const minimumVersionMatch = minimumValidVersion.match(regex);
|
|
66
|
+
if (!minimumVersionMatch)
|
|
67
|
+
throw new ts_common_1.BadImplementationException(`Error extracting minimum valid version. \nVersion: '${minimumValidVersion}'\n config: '${ts_common_1.__stringify(this.config)}'`);
|
|
68
|
+
const versionsGroups = minimumVersionMatch.groups;
|
|
69
|
+
if (!versionsGroups)
|
|
70
|
+
throw new ts_common_1.BadImplementationException(`If minimumValidVersion is provided ${platformNameConfig.minimumValidVersion}, then groups in regex have to be defined ${ts_common_1.__stringify(minimumVersionMatch)}. i.e. "(?<first>[0-9]+).(?<second>[0-9]+).(?<third>[0-9]+)"`);
|
|
71
|
+
const versions = Object.values(matchGroups);
|
|
72
|
+
const minimumVersions = Object.values(versionsGroups);
|
|
73
|
+
for (let i = 0; i < versions.length; i++) {
|
|
74
|
+
const v = versions[i];
|
|
75
|
+
const minV = minimumVersions[i];
|
|
76
|
+
if (v < minV)
|
|
77
|
+
return { upgradeRequired: true };
|
|
78
|
+
}
|
|
79
|
+
return { upgradeRequired: false };
|
|
65
80
|
}
|
|
66
81
|
assertVersion(request) {
|
|
67
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
83
|
const upgradeRequired = this.compareVersion(request);
|
|
69
|
-
if (upgradeRequired.
|
|
84
|
+
if (upgradeRequired.upgradeRequired)
|
|
70
85
|
throw new exceptions_1.ApiException(426, "require upgrade..").setErrorBody({ type: "upgrade-required", body: upgradeRequired });
|
|
71
86
|
});
|
|
72
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForceUpgrade.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/ForceUpgrade.ts"],"names":[],"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AC,CAAA;IAChC,CAAC;IAEK,aAAa,CAAC,OAAuB;;YAC1C,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACrD,IAAI,eAAe,CAAC,eAAe;gBAClC,MAAM,IAAI,yBAAY,CAAkB,GAAG,EAAE,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,eAAe,EAAC,CAAC,CAAA;QACnI,CAAC;KAAA;;AA9De,6BAAU,GAAyB,CAAO,OAAuB,EAAE,EAAE,kDAAC,OAAA,oBAAY,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA,GAAA,CAAC;AAiE9G,QAAA,YAAY,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -41,8 +41,8 @@ class ForceUpgrade_Class extends ts_common_1.Module {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
init() {
|
|
44
|
-
XhrHttpModule_1.XhrHttpModule.addDefaultHeader(force_upgrade_1.
|
|
45
|
-
XhrHttpModule_1.XhrHttpModule.addDefaultHeader(force_upgrade_1.
|
|
44
|
+
XhrHttpModule_1.XhrHttpModule.addDefaultHeader(force_upgrade_1.HeaderKey_PlatformVersion, `${process.env.appVersion}`);
|
|
45
|
+
XhrHttpModule_1.XhrHttpModule.addDefaultHeader(force_upgrade_1.HeaderKey_PlatformName, `${tools_1.browserType()}`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
exports.ForceUpgrade = new ForceUpgrade_Class();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForceUpgrade.js","sourceRoot":"","sources":["../../../src/main/app-frontend/modules/ForceUpgrade.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,4DAGsC;AACtC,wDAAmD;AACnD,8DAKoC;AACpC,8CAA8C;AAC9C,0CAA2C;AAE9B,QAAA,2BAA2B,GAAG,oBAAoB,CAAC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AO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QACvF,6BAAa,CAAC,gBAAgB,CAAC,sCAAsB,EAAE,GAAG,mBAAW,EAAE,EAAE,CAAC,CAAC;IAC5E,CAAC;CAUD;AAEY,QAAA,YAAY,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlatformName } from "../../shared/consts";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
export declare function browserType():
|
|
3
|
+
export declare function browserType(): PlatformName;
|
|
4
4
|
export declare function convertBase64ToFile(fileName: string, base64: string, _mimeType?: string): File;
|
|
5
5
|
export declare const stopPropagation: (e: MouseEvent | React.MouseEvent | KeyboardEvent | React.KeyboardEvent) => void;
|
package/package.json
CHANGED
package/shared/consts.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ApiWithQuery } from "./types";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const HeaderKey_UserAgent = "user-agent";
|
|
2
|
+
export declare const HeaderKey_PlatformVersion = "x-platform-version";
|
|
3
|
+
export declare const HeaderKey_PlatformName = "x-platform-name";
|
|
5
4
|
export declare type UpgradeRequired = {
|
|
6
|
-
|
|
7
|
-
app: boolean;
|
|
5
|
+
upgradeRequired?: boolean;
|
|
8
6
|
};
|
|
9
7
|
export declare type ApiBinder_AssertAppVersion = ApiWithQuery<string, UpgradeRequired>;
|
package/shared/force-upgrade.js
CHANGED
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.HeaderKey_UserAgent = "user-agent";
|
|
23
|
+
exports.HeaderKey_PlatformName = exports.HeaderKey_PlatformVersion = void 0;
|
|
24
|
+
exports.HeaderKey_PlatformVersion = "x-platform-version";
|
|
25
|
+
exports.HeaderKey_PlatformName = "x-platform-name";
|
|
27
26
|
//# sourceMappingURL=force-upgrade.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"force-upgrade.js","sourceRoot":"","sources":["../../src/main/shared/force-upgrade.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAIU,QAAA,
|
|
1
|
+
{"version":3,"file":"force-upgrade.js","sourceRoot":"","sources":["../../src/main/shared/force-upgrade.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAIU,QAAA,yBAAyB,GAAG,oBAAoB,CAAC;AACjD,QAAA,sBAAsB,GAAG,iBAAiB,CAAC"}
|