@configura/web-api 2.0.0-alpha.3 → 2.0.0-alpha.4
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.
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { DtoAdditionalProductConfiguration, DtoConfProd } from "../CatalogueAPI.js";
|
|
2
2
|
import { CfgProduct, CfgProductChangeNotification } from "../CfgProduct.js";
|
|
3
3
|
import { CfgIOManager } from "./CfgIOManager.js";
|
|
4
|
+
export declare const isCfgProdConfMessage: (data: unknown) => data is CfgProdConfMessageV1 | CfgProdConfMessageV2;
|
|
4
5
|
export declare type CfgProdConfMessageV1 = {
|
|
5
6
|
version: "1.0";
|
|
6
7
|
conf: DtoAdditionalProductConfiguration;
|
|
7
8
|
};
|
|
9
|
+
export declare const isCfgProdConfMessageV1: (data: unknown) => data is CfgProdConfMessageV1;
|
|
8
10
|
export declare type CfgProdConfMessageV2 = {
|
|
9
11
|
version: "2.0";
|
|
10
12
|
conf: DtoConfProd;
|
|
11
13
|
};
|
|
14
|
+
export declare const isCfgProdConfMessageV2: (data: unknown) => data is CfgProdConfMessageV2;
|
|
12
15
|
export declare type CfgProdConfMessage = {
|
|
13
16
|
initial: boolean;
|
|
14
17
|
subMessages: (CfgProdConfMessageV1 | CfgProdConfMessageV2)[];
|
|
15
18
|
};
|
|
19
|
+
export declare const getHighestVersionProdConfMessage: (subMessages: (CfgProdConfMessageV1 | CfgProdConfMessageV2)[]) => CfgProdConfMessageV1 | CfgProdConfMessageV2;
|
|
16
20
|
export declare enum CfgProdConfMessageVersions {
|
|
17
21
|
V1dot0 = 1,
|
|
18
22
|
V2dot0 = 2
|
|
@@ -8,6 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { convertDtoConfProdToV1 } from "../ConfigurationConverter.js";
|
|
11
|
+
export const isCfgProdConfMessage = (data) => typeof data === "object" && data !== null && "version" in data && "conf" in data;
|
|
12
|
+
export const isCfgProdConfMessageV1 = (data) => isCfgProdConfMessage(data) && data.version === "1.0";
|
|
13
|
+
export const isCfgProdConfMessageV2 = (data) => isCfgProdConfMessage(data) && data.version === "2.0";
|
|
14
|
+
export const getHighestVersionProdConfMessage = (subMessages) => subMessages
|
|
15
|
+
.slice(1)
|
|
16
|
+
.reduce((a, c) => (a.version < c.version ? c : a), subMessages[0]);
|
|
11
17
|
export var CfgProdConfMessageVersions;
|
|
12
18
|
(function (CfgProdConfMessageVersions) {
|
|
13
19
|
CfgProdConfMessageVersions[CfgProdConfMessageVersions["V1dot0"] = 1] = "V1dot0";
|
|
@@ -65,16 +71,14 @@ export class CfgIOProdConfConnector {
|
|
|
65
71
|
console.warn(`${STAGE_PROD_CONF_MESSAGE_KEY} message without any submessages. Unexpected.`);
|
|
66
72
|
return;
|
|
67
73
|
}
|
|
68
|
-
const highestVersionMessage = subMessages
|
|
69
|
-
|
|
70
|
-
.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
yield newProduct.setDtoConf(highestVersionMessage.conf, this._doValidate);
|
|
77
|
-
return;
|
|
74
|
+
const highestVersionMessage = getHighestVersionProdConfMessage(subMessages);
|
|
75
|
+
if (isCfgProdConfMessageV1(highestVersionMessage)) {
|
|
76
|
+
yield newProduct.setApiSelection(highestVersionMessage.conf, this._doValidate);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (isCfgProdConfMessageV2(highestVersionMessage)) {
|
|
80
|
+
yield newProduct.setDtoConf(highestVersionMessage.conf, this._doValidate);
|
|
81
|
+
return;
|
|
78
82
|
}
|
|
79
83
|
throw new Error("Unknown message version");
|
|
80
84
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configura/web-api",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@configura/web-utilities": "2.0.0-alpha.
|
|
26
|
+
"@configura/web-utilities": "2.0.0-alpha.4"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "d4c959d717ae06aafc5678e43ea8a32cace29eeb"
|
|
29
29
|
}
|