@configura/web-api 2.1.0-alpha.1 → 2.1.0-alpha.3
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/.eslintrc.json +5 -5
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/CatalogueAPI.d.ts +633 -632
- package/dist/CatalogueAPI.js +329 -329
- package/dist/CfgMeasure.d.ts +32 -32
- package/dist/CfgMeasure.js +30 -30
- package/dist/CfgProduct.d.ts +344 -344
- package/dist/CfgProduct.js +990 -990
- package/dist/CfgReferencePathHelper.d.ts +26 -26
- package/dist/CfgReferencePathHelper.js +26 -26
- package/dist/index.d.ts +24 -24
- package/dist/index.js +24 -24
- package/dist/io/CfgHistoryManager.d.ts +83 -83
- package/dist/io/CfgHistoryManager.js +144 -144
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -21
- package/dist/io/CfgHistoryToProdConfConnector.js +50 -50
- package/dist/io/CfgIOManager.d.ts +53 -53
- package/dist/io/CfgIOManager.js +134 -134
- package/dist/io/CfgIOProdConfConnector.d.ts +54 -54
- package/dist/io/CfgIOProdConfConnector.js +137 -137
- package/dist/io/CfgIOWarningSupplier.d.ts +3 -3
- package/dist/io/CfgIOWarningSupplier.js +1 -1
- package/dist/io/CfgObservableStateManager.d.ts +25 -25
- package/dist/io/CfgObservableStateManager.js +69 -69
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -15
- package/dist/io/CfgObservableStateToProdConfConnector.js +17 -17
- package/dist/io/CfgWindowEventManager.d.ts +21 -21
- package/dist/io/CfgWindowEventManager.js +38 -38
- package/dist/io/CfgWindowMessageManager.d.ts +40 -40
- package/dist/io/CfgWindowMessageManager.js +91 -91
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -17
- package/dist/io/CfgWindowMessageToProdConfConnector.js +19 -19
- package/dist/io/index.d.ts +8 -8
- package/dist/io/index.js +8 -8
- package/dist/material/CfgMaterialMapping.d.ts +7 -7
- package/dist/material/CfgMaterialMapping.js +181 -181
- package/dist/material/CfgMtrlApplication.d.ts +18 -18
- package/dist/material/CfgMtrlApplication.js +43 -43
- package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
- package/dist/material/CfgMtrlApplicationSource.js +8 -8
- package/dist/material/CfgMtrlSource.d.ts +19 -19
- package/dist/material/CfgMtrlSource.js +40 -40
- package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
- package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
- package/dist/productConfiguration/CfgFeature.d.ts +199 -199
- package/dist/productConfiguration/CfgFeature.js +691 -691
- package/dist/productConfiguration/CfgOption.d.ts +160 -160
- package/dist/productConfiguration/CfgOption.js +464 -464
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +129 -129
- package/dist/productConfiguration/CfgProductConfiguration.js +346 -346
- package/dist/productConfiguration/filters.d.ts +17 -17
- package/dist/productConfiguration/filters.js +141 -141
- package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
- package/dist/productConfiguration/productParamsGenerator.js +51 -51
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
- package/dist/productConfiguration/utilitiesProductConfiguration.js +87 -87
- package/dist/productLoader.d.ts +33 -33
- package/dist/productLoader.js +49 -49
- package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
- package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
- package/dist/syncGroups/SyncGroupsHandler.d.ts +47 -47
- package/dist/syncGroups/SyncGroupsHandler.js +370 -370
- package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
- package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
- package/dist/syncGroups/SyncGroupsState.d.ts +39 -39
- package/dist/syncGroups/SyncGroupsState.js +167 -167
- package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
- package/dist/syncGroups/SyncGroupsTransaction.js +589 -589
- package/dist/tasks/TaskHandler.d.ts +77 -77
- package/dist/tasks/TaskHandler.js +276 -276
- package/dist/tasks/formats.d.ts +4 -4
- package/dist/tasks/formats.js +7 -7
- package/dist/tests/testData/collectorForTest.d.ts +73 -73
- package/dist/tests/testData/collectorForTest.js +194 -194
- package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
- package/dist/tests/testData/dummyProductForTest.js +32 -32
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +282 -282
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
- package/dist/tests/testData/testDataCachedGetProduct.js +187 -187
- package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
- package/dist/tests/testData/testDataCachedPostValidate.js +185 -185
- package/dist/tests/testData/testDataConstraints.d.ts +3 -3
- package/dist/tests/testData/testDataConstraints.js +174 -174
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
- package/dist/tests/testData/testDataOptions.d.ts +12 -12
- package/dist/tests/testData/testDataOptions.js +60 -60
- package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
- package/dist/tests/testData/testDataProductAggregatedPrice.js +189 -189
- package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
- package/dist/tests/testData/testDataUpcharge.js +121 -121
- package/dist/utilitiesCatalogueData.d.ts +47 -47
- package/dist/utilitiesCatalogueData.js +180 -180
- package/dist/utilitiesCataloguePermission.d.ts +38 -38
- package/dist/utilitiesCataloguePermission.js +79 -79
- package/dist/utilitiesConfiguration.d.ts +28 -28
- package/dist/utilitiesConfiguration.js +200 -200
- package/dist/utilitiesNumericValues.d.ts +24 -24
- package/dist/utilitiesNumericValues.js +114 -114
- package/package.json +3 -3
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { convertDtoProductConfToV1 } from "../utilitiesConfiguration.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]);
|
|
17
|
-
export var CfgProdConfMessageVersions;
|
|
18
|
-
(function (CfgProdConfMessageVersions) {
|
|
19
|
-
CfgProdConfMessageVersions[CfgProdConfMessageVersions["V1dot0"] = 1] = "V1dot0";
|
|
20
|
-
CfgProdConfMessageVersions[CfgProdConfMessageVersions["V2dot0"] = 2] = "V2dot0";
|
|
21
|
-
})(CfgProdConfMessageVersions || (CfgProdConfMessageVersions = {}));
|
|
22
|
-
export const STAGE_PROD_CONF_MESSAGE_KEY = "stageprodconf";
|
|
23
|
-
/**
|
|
24
|
-
* Base class for connecting the product configuration to an IO channel
|
|
25
|
-
*/
|
|
26
|
-
export class CfgIOProdConfConnector {
|
|
27
|
-
constructor(_ioManager, _includeInSend // Only for v2.0
|
|
28
|
-
) {
|
|
29
|
-
this._ioManager = _ioManager;
|
|
30
|
-
this._includeInSend = _includeInSend;
|
|
31
|
-
this._stopListenToMessage = undefined;
|
|
32
|
-
this._stopListenToProdConf = undefined;
|
|
33
|
-
this.setProduct = (product) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
const currentProduct = this._product;
|
|
36
|
-
const newProduct = product;
|
|
37
|
-
this._product = newProduct;
|
|
38
|
-
// If same product don't do anything at all
|
|
39
|
-
if (currentProduct !== undefined &&
|
|
40
|
-
newProduct !== undefined &&
|
|
41
|
-
currentProduct.isBackedBySame(newProduct)) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (currentProduct !== undefined) {
|
|
45
|
-
(_a = this._stopListenToMessage) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
46
|
-
(_b = this._stopListenToProdConf) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
47
|
-
}
|
|
48
|
-
if (newProduct === undefined) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
this._send(this.makeSendData(newProduct.getDtoConf(this._includeInSend), true));
|
|
52
|
-
this._stopListenToMessage = CfgIOProdConfConnector.listenForMessage((messages) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const subMessages = messages.subMessages;
|
|
54
|
-
if (subMessages.length === 0) {
|
|
55
|
-
console.warn(`${STAGE_PROD_CONF_MESSAGE_KEY} message without any submessages. Unexpected.`);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const highestVersionMessage = getHighestVersionProdConfMessage(subMessages);
|
|
59
|
-
if (isCfgProdConfMessageV1(highestVersionMessage)) {
|
|
60
|
-
yield newProduct.setApiSelection(highestVersionMessage.conf);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (isCfgProdConfMessageV2(highestVersionMessage)) {
|
|
64
|
-
yield newProduct.setDtoConf(highestVersionMessage.conf);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
throw new Error("Unknown message version");
|
|
68
|
-
}), this._ioManager);
|
|
69
|
-
this._stopListenToProdConf = CfgIOProdConfConnector.listenForProdConf(newProduct, (conf) => __awaiter(this, void 0, void 0, function* () { return this._send(this.makeSendData(conf, false)); }), this._includeInSend);
|
|
70
|
-
});
|
|
71
|
-
this._send = (data) => this._ioManager.send(STAGE_PROD_CONF_MESSAGE_KEY, data);
|
|
72
|
-
_ioManager.addWarningSupplier(this);
|
|
73
|
-
}
|
|
74
|
-
destroy() {
|
|
75
|
-
var _a, _b;
|
|
76
|
-
(_a = this._stopListenToMessage) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
77
|
-
(_b = this._stopListenToProdConf) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
78
|
-
this._ioManager.removeWarningSupplier(this);
|
|
79
|
-
}
|
|
80
|
-
getWarnings() {
|
|
81
|
-
const product = this._product;
|
|
82
|
-
if (product !== undefined && product.hasRootFeaturesChanged) {
|
|
83
|
-
return [
|
|
84
|
-
"In at least one of the Products, Functional Selection has taken place, thereby changing what root Features are used. The SDK can not yet apply a serialized configuration in these cases. Extracting this data from the SDK for external applications can work, but reinserting the data into Stage will most likely fail.",
|
|
85
|
-
];
|
|
86
|
-
}
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Register the callback to listen for Product Configuration messages
|
|
91
|
-
* @returns A function which when called will cancel listening
|
|
92
|
-
*/
|
|
93
|
-
static listenForMessage(callback, ioManager) {
|
|
94
|
-
const listener = this.makeMessageListener(callback);
|
|
95
|
-
ioManager.listenForMessage(listener, STAGE_PROD_CONF_MESSAGE_KEY);
|
|
96
|
-
return () => {
|
|
97
|
-
ioManager.stopListenForMessage(listener);
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
static listenForProdConf(product, callback, includeInSend) {
|
|
101
|
-
const listener = this.makeProdConfListener(callback, includeInSend);
|
|
102
|
-
product.listenForChange(listener);
|
|
103
|
-
return () => {
|
|
104
|
-
product.stopListenForChange(listener);
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
CfgIOProdConfConnector.makeMessage = (conf, initial, sendVersions) => {
|
|
109
|
-
const result = [];
|
|
110
|
-
if ((sendVersions & CfgProdConfMessageVersions.V1dot0) ===
|
|
111
|
-
CfgProdConfMessageVersions.V1dot0) {
|
|
112
|
-
const v1 = {
|
|
113
|
-
version: "1.0",
|
|
114
|
-
conf: convertDtoProductConfToV1(conf, true),
|
|
115
|
-
};
|
|
116
|
-
result.push(v1);
|
|
117
|
-
}
|
|
118
|
-
if ((sendVersions & CfgProdConfMessageVersions.V2dot0) ===
|
|
119
|
-
CfgProdConfMessageVersions.V2dot0) {
|
|
120
|
-
const v2 = {
|
|
121
|
-
version: "2.0",
|
|
122
|
-
conf,
|
|
123
|
-
};
|
|
124
|
-
result.push(v2);
|
|
125
|
-
}
|
|
126
|
-
return { subMessages: result, initial };
|
|
127
|
-
};
|
|
128
|
-
CfgIOProdConfConnector.makeMessageListener = (callback) => (message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
-
const prodConfMessage = message;
|
|
130
|
-
yield callback(prodConfMessage);
|
|
131
|
-
});
|
|
132
|
-
CfgIOProdConfConnector.makeProdConfListener = (callback, includeInSend) => (n) => {
|
|
133
|
-
if (!n.committed) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
callback(n.freshRef.getDtoConf(includeInSend));
|
|
137
|
-
};
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { convertDtoProductConfToV1 } from "../utilitiesConfiguration.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]);
|
|
17
|
+
export var CfgProdConfMessageVersions;
|
|
18
|
+
(function (CfgProdConfMessageVersions) {
|
|
19
|
+
CfgProdConfMessageVersions[CfgProdConfMessageVersions["V1dot0"] = 1] = "V1dot0";
|
|
20
|
+
CfgProdConfMessageVersions[CfgProdConfMessageVersions["V2dot0"] = 2] = "V2dot0";
|
|
21
|
+
})(CfgProdConfMessageVersions || (CfgProdConfMessageVersions = {}));
|
|
22
|
+
export const STAGE_PROD_CONF_MESSAGE_KEY = "stageprodconf";
|
|
23
|
+
/**
|
|
24
|
+
* Base class for connecting the product configuration to an IO channel
|
|
25
|
+
*/
|
|
26
|
+
export class CfgIOProdConfConnector {
|
|
27
|
+
constructor(_ioManager, _includeInSend // Only for v2.0
|
|
28
|
+
) {
|
|
29
|
+
this._ioManager = _ioManager;
|
|
30
|
+
this._includeInSend = _includeInSend;
|
|
31
|
+
this._stopListenToMessage = undefined;
|
|
32
|
+
this._stopListenToProdConf = undefined;
|
|
33
|
+
this.setProduct = (product) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const currentProduct = this._product;
|
|
36
|
+
const newProduct = product;
|
|
37
|
+
this._product = newProduct;
|
|
38
|
+
// If same product don't do anything at all
|
|
39
|
+
if (currentProduct !== undefined &&
|
|
40
|
+
newProduct !== undefined &&
|
|
41
|
+
currentProduct.isBackedBySame(newProduct)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (currentProduct !== undefined) {
|
|
45
|
+
(_a = this._stopListenToMessage) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
46
|
+
(_b = this._stopListenToProdConf) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
47
|
+
}
|
|
48
|
+
if (newProduct === undefined) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this._send(this.makeSendData(newProduct.getDtoConf(this._includeInSend), true));
|
|
52
|
+
this._stopListenToMessage = CfgIOProdConfConnector.listenForMessage((messages) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const subMessages = messages.subMessages;
|
|
54
|
+
if (subMessages.length === 0) {
|
|
55
|
+
console.warn(`${STAGE_PROD_CONF_MESSAGE_KEY} message without any submessages. Unexpected.`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const highestVersionMessage = getHighestVersionProdConfMessage(subMessages);
|
|
59
|
+
if (isCfgProdConfMessageV1(highestVersionMessage)) {
|
|
60
|
+
yield newProduct.setApiSelection(highestVersionMessage.conf);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (isCfgProdConfMessageV2(highestVersionMessage)) {
|
|
64
|
+
yield newProduct.setDtoConf(highestVersionMessage.conf);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
throw new Error("Unknown message version");
|
|
68
|
+
}), this._ioManager);
|
|
69
|
+
this._stopListenToProdConf = CfgIOProdConfConnector.listenForProdConf(newProduct, (conf) => __awaiter(this, void 0, void 0, function* () { return this._send(this.makeSendData(conf, false)); }), this._includeInSend);
|
|
70
|
+
});
|
|
71
|
+
this._send = (data) => this._ioManager.send(STAGE_PROD_CONF_MESSAGE_KEY, data);
|
|
72
|
+
_ioManager.addWarningSupplier(this);
|
|
73
|
+
}
|
|
74
|
+
destroy() {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
(_a = this._stopListenToMessage) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
77
|
+
(_b = this._stopListenToProdConf) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
78
|
+
this._ioManager.removeWarningSupplier(this);
|
|
79
|
+
}
|
|
80
|
+
getWarnings() {
|
|
81
|
+
const product = this._product;
|
|
82
|
+
if (product !== undefined && product.hasRootFeaturesChanged) {
|
|
83
|
+
return [
|
|
84
|
+
"In at least one of the Products, Functional Selection has taken place, thereby changing what root Features are used. The SDK can not yet apply a serialized configuration in these cases. Extracting this data from the SDK for external applications can work, but reinserting the data into Stage will most likely fail.",
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Register the callback to listen for Product Configuration messages
|
|
91
|
+
* @returns A function which when called will cancel listening
|
|
92
|
+
*/
|
|
93
|
+
static listenForMessage(callback, ioManager) {
|
|
94
|
+
const listener = this.makeMessageListener(callback);
|
|
95
|
+
ioManager.listenForMessage(listener, STAGE_PROD_CONF_MESSAGE_KEY);
|
|
96
|
+
return () => {
|
|
97
|
+
ioManager.stopListenForMessage(listener);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
static listenForProdConf(product, callback, includeInSend) {
|
|
101
|
+
const listener = this.makeProdConfListener(callback, includeInSend);
|
|
102
|
+
product.listenForChange(listener);
|
|
103
|
+
return () => {
|
|
104
|
+
product.stopListenForChange(listener);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
CfgIOProdConfConnector.makeMessage = (conf, initial, sendVersions) => {
|
|
109
|
+
const result = [];
|
|
110
|
+
if ((sendVersions & CfgProdConfMessageVersions.V1dot0) ===
|
|
111
|
+
CfgProdConfMessageVersions.V1dot0) {
|
|
112
|
+
const v1 = {
|
|
113
|
+
version: "1.0",
|
|
114
|
+
conf: convertDtoProductConfToV1(conf, true),
|
|
115
|
+
};
|
|
116
|
+
result.push(v1);
|
|
117
|
+
}
|
|
118
|
+
if ((sendVersions & CfgProdConfMessageVersions.V2dot0) ===
|
|
119
|
+
CfgProdConfMessageVersions.V2dot0) {
|
|
120
|
+
const v2 = {
|
|
121
|
+
version: "2.0",
|
|
122
|
+
conf,
|
|
123
|
+
};
|
|
124
|
+
result.push(v2);
|
|
125
|
+
}
|
|
126
|
+
return { subMessages: result, initial };
|
|
127
|
+
};
|
|
128
|
+
CfgIOProdConfConnector.makeMessageListener = (callback) => (message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
const prodConfMessage = message;
|
|
130
|
+
yield callback(prodConfMessage);
|
|
131
|
+
});
|
|
132
|
+
CfgIOProdConfConnector.makeProdConfListener = (callback, includeInSend) => (n) => {
|
|
133
|
+
if (!n.committed) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
callback(n.freshRef.getDtoConf(includeInSend));
|
|
137
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface CfgIOWarningSupplier {
|
|
2
|
-
getWarnings(): string[];
|
|
3
|
-
}
|
|
1
|
+
export interface CfgIOWarningSupplier {
|
|
2
|
+
getWarnings(): string[];
|
|
3
|
+
}
|
|
4
4
|
//# sourceMappingURL=CfgIOWarningSupplier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Observable } from "@configura/web-utilities";
|
|
2
|
-
import { CfgIOManager, IOManagerListener } from "./CfgIOManager.js";
|
|
3
|
-
/**
|
|
4
|
-
* This class is used to coordinate sending and receiving using the observable
|
|
5
|
-
* state in the class. It handles messages sent from the connectors.
|
|
6
|
-
*/
|
|
7
|
-
export declare class CfgObservableStateManager extends CfgIOManager<unknown> {
|
|
8
|
-
private static _instance;
|
|
9
|
-
static get instance(): CfgObservableStateManager;
|
|
10
|
-
private constructor();
|
|
11
|
-
readonly stateObservable: Observable<string>;
|
|
12
|
-
private messagesState;
|
|
13
|
-
get stateAsString(): string;
|
|
14
|
-
set stateAsString(s: string);
|
|
15
|
-
listenForStateChange(listener: (v: string) => void): void;
|
|
16
|
-
stopListenForStateChange(listener: (v: string) => void): void;
|
|
17
|
-
listenForMessage(l: IOManagerListener, messageKey: string): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Removes the listener
|
|
20
|
-
*/
|
|
21
|
-
stopListenForMessage(l: IOManagerListener): boolean;
|
|
22
|
-
private _stateListenerBound;
|
|
23
|
-
private _stateListener;
|
|
24
|
-
send(messageKey: string, data: unknown): void;
|
|
25
|
-
}
|
|
1
|
+
import { Observable } from "@configura/web-utilities";
|
|
2
|
+
import { CfgIOManager, IOManagerListener } from "./CfgIOManager.js";
|
|
3
|
+
/**
|
|
4
|
+
* This class is used to coordinate sending and receiving using the observable
|
|
5
|
+
* state in the class. It handles messages sent from the connectors.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CfgObservableStateManager extends CfgIOManager<unknown> {
|
|
8
|
+
private static _instance;
|
|
9
|
+
static get instance(): CfgObservableStateManager;
|
|
10
|
+
private constructor();
|
|
11
|
+
readonly stateObservable: Observable<string>;
|
|
12
|
+
private messagesState;
|
|
13
|
+
get stateAsString(): string;
|
|
14
|
+
set stateAsString(s: string);
|
|
15
|
+
listenForStateChange(listener: (v: string) => void): void;
|
|
16
|
+
stopListenForStateChange(listener: (v: string) => void): void;
|
|
17
|
+
listenForMessage(l: IOManagerListener, messageKey: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Removes the listener
|
|
20
|
+
*/
|
|
21
|
+
stopListenForMessage(l: IOManagerListener): boolean;
|
|
22
|
+
private _stateListenerBound;
|
|
23
|
+
private _stateListener;
|
|
24
|
+
send(messageKey: string, data: unknown): void;
|
|
25
|
+
}
|
|
26
26
|
//# sourceMappingURL=CfgObservableStateManager.d.ts.map
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { Observable } from "@configura/web-utilities";
|
|
2
|
-
import { CfgIOManager } from "./CfgIOManager.js";
|
|
3
|
-
/**
|
|
4
|
-
* This class is used to coordinate sending and receiving using the observable
|
|
5
|
-
* state in the class. It handles messages sent from the connectors.
|
|
6
|
-
*/
|
|
7
|
-
export class CfgObservableStateManager extends CfgIOManager {
|
|
8
|
-
constructor() {
|
|
9
|
-
super();
|
|
10
|
-
this.stateObservable = new Observable();
|
|
11
|
-
this.messagesState = {};
|
|
12
|
-
this._stateListenerBound = this._stateListener.bind(this);
|
|
13
|
-
}
|
|
14
|
-
static get instance() {
|
|
15
|
-
if (this._instance === undefined) {
|
|
16
|
-
this._instance = new CfgObservableStateManager();
|
|
17
|
-
}
|
|
18
|
-
return this._instance;
|
|
19
|
-
}
|
|
20
|
-
get stateAsString() {
|
|
21
|
-
return JSON.stringify(CfgObservableStateManager.makeContainer(this.messagesState), null, 2);
|
|
22
|
-
}
|
|
23
|
-
set stateAsString(s) {
|
|
24
|
-
this.stateObservable.notifyAll(s);
|
|
25
|
-
}
|
|
26
|
-
listenForStateChange(listener) {
|
|
27
|
-
this.stateObservable.listen(listener);
|
|
28
|
-
}
|
|
29
|
-
stopListenForStateChange(listener) {
|
|
30
|
-
this.stateObservable.stopListen(listener);
|
|
31
|
-
}
|
|
32
|
-
listenForMessage(l, messageKey) {
|
|
33
|
-
const hadListeners = this.hasMessageListeners;
|
|
34
|
-
const didStartListen = super.listenForMessage(l, messageKey);
|
|
35
|
-
if (!hadListeners && didStartListen) {
|
|
36
|
-
this.stateObservable.listen(this._stateListenerBound, this);
|
|
37
|
-
}
|
|
38
|
-
return didStartListen;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Removes the listener
|
|
42
|
-
*/
|
|
43
|
-
stopListenForMessage(l) {
|
|
44
|
-
const didStopListen = super.stopListenForMessage(l);
|
|
45
|
-
if (didStopListen && !this.hasMessageListeners) {
|
|
46
|
-
this.stateObservable.stopListen(this._stateListenerBound);
|
|
47
|
-
}
|
|
48
|
-
return didStopListen;
|
|
49
|
-
}
|
|
50
|
-
_stateListener(data) {
|
|
51
|
-
let asJson;
|
|
52
|
-
try {
|
|
53
|
-
asJson = JSON.parse(data);
|
|
54
|
-
}
|
|
55
|
-
catch (_a) {
|
|
56
|
-
throw new Error("Not JSON data");
|
|
57
|
-
}
|
|
58
|
-
if (!CfgIOManager.isIOContainer(asJson)) {
|
|
59
|
-
console.warn("Not a readable IO container");
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
this.messagesState = asJson.messages;
|
|
63
|
-
super._containerListener(asJson);
|
|
64
|
-
}
|
|
65
|
-
send(messageKey, data) {
|
|
66
|
-
this.messagesState[messageKey] = data;
|
|
67
|
-
this.stateObservable.notifyAll(this.stateAsString, this);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
1
|
+
import { Observable } from "@configura/web-utilities";
|
|
2
|
+
import { CfgIOManager } from "./CfgIOManager.js";
|
|
3
|
+
/**
|
|
4
|
+
* This class is used to coordinate sending and receiving using the observable
|
|
5
|
+
* state in the class. It handles messages sent from the connectors.
|
|
6
|
+
*/
|
|
7
|
+
export class CfgObservableStateManager extends CfgIOManager {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.stateObservable = new Observable();
|
|
11
|
+
this.messagesState = {};
|
|
12
|
+
this._stateListenerBound = this._stateListener.bind(this);
|
|
13
|
+
}
|
|
14
|
+
static get instance() {
|
|
15
|
+
if (this._instance === undefined) {
|
|
16
|
+
this._instance = new CfgObservableStateManager();
|
|
17
|
+
}
|
|
18
|
+
return this._instance;
|
|
19
|
+
}
|
|
20
|
+
get stateAsString() {
|
|
21
|
+
return JSON.stringify(CfgObservableStateManager.makeContainer(this.messagesState), null, 2);
|
|
22
|
+
}
|
|
23
|
+
set stateAsString(s) {
|
|
24
|
+
this.stateObservable.notifyAll(s);
|
|
25
|
+
}
|
|
26
|
+
listenForStateChange(listener) {
|
|
27
|
+
this.stateObservable.listen(listener);
|
|
28
|
+
}
|
|
29
|
+
stopListenForStateChange(listener) {
|
|
30
|
+
this.stateObservable.stopListen(listener);
|
|
31
|
+
}
|
|
32
|
+
listenForMessage(l, messageKey) {
|
|
33
|
+
const hadListeners = this.hasMessageListeners;
|
|
34
|
+
const didStartListen = super.listenForMessage(l, messageKey);
|
|
35
|
+
if (!hadListeners && didStartListen) {
|
|
36
|
+
this.stateObservable.listen(this._stateListenerBound, this);
|
|
37
|
+
}
|
|
38
|
+
return didStartListen;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Removes the listener
|
|
42
|
+
*/
|
|
43
|
+
stopListenForMessage(l) {
|
|
44
|
+
const didStopListen = super.stopListenForMessage(l);
|
|
45
|
+
if (didStopListen && !this.hasMessageListeners) {
|
|
46
|
+
this.stateObservable.stopListen(this._stateListenerBound);
|
|
47
|
+
}
|
|
48
|
+
return didStopListen;
|
|
49
|
+
}
|
|
50
|
+
_stateListener(data) {
|
|
51
|
+
let asJson;
|
|
52
|
+
try {
|
|
53
|
+
asJson = JSON.parse(data);
|
|
54
|
+
}
|
|
55
|
+
catch (_a) {
|
|
56
|
+
throw new Error("Not JSON data");
|
|
57
|
+
}
|
|
58
|
+
if (!CfgIOManager.isIOContainer(asJson)) {
|
|
59
|
+
console.warn("Not a readable IO container");
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.messagesState = asJson.messages;
|
|
63
|
+
super._containerListener(asJson);
|
|
64
|
+
}
|
|
65
|
+
send(messageKey, data) {
|
|
66
|
+
this.messagesState[messageKey] = data;
|
|
67
|
+
this.stateObservable.notifyAll(this.stateAsString, this);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { DtoProductConf } from "../CatalogueAPI.js";
|
|
2
|
-
import { CfgProdConfParts } from "../utilitiesConfiguration.js";
|
|
3
|
-
import { CfgIOProdConfConnector, CfgProdConfMessage, CfgProdConfMessageVersions } from "./CfgIOProdConfConnector.js";
|
|
4
|
-
import { CfgObservableStateManager } from "./CfgObservableStateManager.js";
|
|
5
|
-
/**
|
|
6
|
-
* Instantiating this will make the observable state update with the product configuration.
|
|
7
|
-
* @param sendVersions What versions of the productConfiguration shall be sent? Multiple can be selected
|
|
8
|
-
* @param includeExtendedDataInSend Only for version 2.0. Includes unit and groupCode.
|
|
9
|
-
* @param includeProdParamsInSend Only for version 2.0. Includes product params, in both main and additional products.
|
|
10
|
-
*/
|
|
11
|
-
export declare class CfgObservableStateToProdConfConnector extends CfgIOProdConfConnector<CfgProdConfMessage> {
|
|
12
|
-
private _sendVersions;
|
|
13
|
-
constructor(manager: CfgObservableStateManager, _sendVersions?: CfgProdConfMessageVersions, includeInSend?: CfgProdConfParts);
|
|
14
|
-
protected makeSendData(conf: DtoProductConf, initial: boolean): CfgProdConfMessage;
|
|
15
|
-
}
|
|
1
|
+
import { DtoProductConf } from "../CatalogueAPI.js";
|
|
2
|
+
import { CfgProdConfParts } from "../utilitiesConfiguration.js";
|
|
3
|
+
import { CfgIOProdConfConnector, CfgProdConfMessage, CfgProdConfMessageVersions } from "./CfgIOProdConfConnector.js";
|
|
4
|
+
import { CfgObservableStateManager } from "./CfgObservableStateManager.js";
|
|
5
|
+
/**
|
|
6
|
+
* Instantiating this will make the observable state update with the product configuration.
|
|
7
|
+
* @param sendVersions What versions of the productConfiguration shall be sent? Multiple can be selected
|
|
8
|
+
* @param includeExtendedDataInSend Only for version 2.0. Includes unit and groupCode.
|
|
9
|
+
* @param includeProdParamsInSend Only for version 2.0. Includes product params, in both main and additional products.
|
|
10
|
+
*/
|
|
11
|
+
export declare class CfgObservableStateToProdConfConnector extends CfgIOProdConfConnector<CfgProdConfMessage> {
|
|
12
|
+
private _sendVersions;
|
|
13
|
+
constructor(manager: CfgObservableStateManager, _sendVersions?: CfgProdConfMessageVersions, includeInSend?: CfgProdConfParts);
|
|
14
|
+
protected makeSendData(conf: DtoProductConf, initial: boolean): CfgProdConfMessage;
|
|
15
|
+
}
|
|
16
16
|
//# sourceMappingURL=CfgObservableStateToProdConfConnector.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { CfgProdConfParts } from "../utilitiesConfiguration.js";
|
|
2
|
-
import { CfgIOProdConfConnector, CfgProdConfMessageVersions, } from "./CfgIOProdConfConnector.js";
|
|
3
|
-
/**
|
|
4
|
-
* Instantiating this will make the observable state update with the product configuration.
|
|
5
|
-
* @param sendVersions What versions of the productConfiguration shall be sent? Multiple can be selected
|
|
6
|
-
* @param includeExtendedDataInSend Only for version 2.0. Includes unit and groupCode.
|
|
7
|
-
* @param includeProdParamsInSend Only for version 2.0. Includes product params, in both main and additional products.
|
|
8
|
-
*/
|
|
9
|
-
export class CfgObservableStateToProdConfConnector extends CfgIOProdConfConnector {
|
|
10
|
-
constructor(manager, _sendVersions = CfgProdConfMessageVersions.V2dot0, includeInSend = CfgProdConfParts.NoExtra) {
|
|
11
|
-
super(manager, includeInSend);
|
|
12
|
-
this._sendVersions = _sendVersions;
|
|
13
|
-
}
|
|
14
|
-
makeSendData(conf, initial) {
|
|
15
|
-
return CfgIOProdConfConnector.makeMessage(conf, initial, this._sendVersions);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
import { CfgProdConfParts } from "../utilitiesConfiguration.js";
|
|
2
|
+
import { CfgIOProdConfConnector, CfgProdConfMessageVersions, } from "./CfgIOProdConfConnector.js";
|
|
3
|
+
/**
|
|
4
|
+
* Instantiating this will make the observable state update with the product configuration.
|
|
5
|
+
* @param sendVersions What versions of the productConfiguration shall be sent? Multiple can be selected
|
|
6
|
+
* @param includeExtendedDataInSend Only for version 2.0. Includes unit and groupCode.
|
|
7
|
+
* @param includeProdParamsInSend Only for version 2.0. Includes product params, in both main and additional products.
|
|
8
|
+
*/
|
|
9
|
+
export class CfgObservableStateToProdConfConnector extends CfgIOProdConfConnector {
|
|
10
|
+
constructor(manager, _sendVersions = CfgProdConfMessageVersions.V2dot0, includeInSend = CfgProdConfParts.NoExtra) {
|
|
11
|
+
super(manager, includeInSend);
|
|
12
|
+
this._sendVersions = _sendVersions;
|
|
13
|
+
}
|
|
14
|
+
makeSendData(conf, initial) {
|
|
15
|
+
return CfgIOProdConfConnector.makeMessage(conf, initial, this._sendVersions);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { CfgIOManager, IOManagerListener } from "./CfgIOManager.js";
|
|
2
|
-
/**
|
|
3
|
-
* Base class for classes handling input and output in globally shared environments, using
|
|
4
|
-
* event listeners on the window object, for example the History API and window.message API.
|
|
5
|
-
* These are global resources where data not being handled by Stage can appear.
|
|
6
|
-
*/
|
|
7
|
-
export declare abstract class CfgWindowEventManager<K extends keyof WindowEventMap, S> extends CfgIOManager<S> {
|
|
8
|
-
/**
|
|
9
|
-
* Listen for the message messageKey being received. This can for example be the history stack
|
|
10
|
-
* being popped or a window.message being received.
|
|
11
|
-
*/
|
|
12
|
-
listenForMessage(l: IOManagerListener, messageKey: string): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Removes the listener
|
|
15
|
-
*/
|
|
16
|
-
stopListenForMessage(l: IOManagerListener): boolean;
|
|
17
|
-
private _windowEventListenerBound;
|
|
18
|
-
private _windowEventListener;
|
|
19
|
-
protected abstract readonly eventType: K;
|
|
20
|
-
protected abstract getDataFromEvent(event: WindowEventMap[K]): unknown;
|
|
21
|
-
}
|
|
1
|
+
import { CfgIOManager, IOManagerListener } from "./CfgIOManager.js";
|
|
2
|
+
/**
|
|
3
|
+
* Base class for classes handling input and output in globally shared environments, using
|
|
4
|
+
* event listeners on the window object, for example the History API and window.message API.
|
|
5
|
+
* These are global resources where data not being handled by Stage can appear.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class CfgWindowEventManager<K extends keyof WindowEventMap, S> extends CfgIOManager<S> {
|
|
8
|
+
/**
|
|
9
|
+
* Listen for the message messageKey being received. This can for example be the history stack
|
|
10
|
+
* being popped or a window.message being received.
|
|
11
|
+
*/
|
|
12
|
+
listenForMessage(l: IOManagerListener, messageKey: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Removes the listener
|
|
15
|
+
*/
|
|
16
|
+
stopListenForMessage(l: IOManagerListener): boolean;
|
|
17
|
+
private _windowEventListenerBound;
|
|
18
|
+
private _windowEventListener;
|
|
19
|
+
protected abstract readonly eventType: K;
|
|
20
|
+
protected abstract getDataFromEvent(event: WindowEventMap[K]): unknown;
|
|
21
|
+
}
|
|
22
22
|
//# sourceMappingURL=CfgWindowEventManager.d.ts.map
|