@configura/web-api 2.2.0-alpha.1 → 2.2.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 -633
- package/dist/CatalogueAPI.js +312 -312
- package/dist/CfgMeasure.d.ts +32 -32
- package/dist/CfgMeasure.js +30 -30
- package/dist/CfgProduct.d.ts +359 -344
- package/dist/CfgProduct.js +1005 -992
- 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 +139 -139
- 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 +136 -129
- package/dist/productConfiguration/CfgProductConfiguration.js +355 -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 +65 -65
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
- package/dist/productConfiguration/utilitiesProductConfiguration.js +89 -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
package/dist/io/CfgIOManager.js
CHANGED
|
@@ -1,134 +1,134 @@
|
|
|
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
|
-
const CONFIGURA_ATTRIBUTE = "C0nf1gura";
|
|
11
|
-
const CONFIGURA_SHEBANG = "arug1fn0C";
|
|
12
|
-
// Support function. Did not manage to check both attribute and value in one step
|
|
13
|
-
const hasConfiguraAttribute = (data) => {
|
|
14
|
-
return typeof data === "object" && data !== null;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Base class for classes handling input and output in globally shared environments.
|
|
18
|
-
*/
|
|
19
|
-
export class CfgIOManager {
|
|
20
|
-
constructor() {
|
|
21
|
-
this._warningSuppliers = [];
|
|
22
|
-
// A lock to avoid circular write. Asynchronous conditions can make this not be enough.
|
|
23
|
-
// Avoid creating pre-conditions where this can happen.
|
|
24
|
-
this._receiveInProgress = false;
|
|
25
|
-
this._messageListeners = [];
|
|
26
|
-
this._getIndexOfMessageListener = (l) => this._messageListeners.findIndex((item) => l === item.l);
|
|
27
|
-
}
|
|
28
|
-
addWarningSupplier(supplier) {
|
|
29
|
-
this._warningSuppliers.push(supplier);
|
|
30
|
-
}
|
|
31
|
-
removeWarningSupplier(supplier) {
|
|
32
|
-
const i = this._warningSuppliers.indexOf(supplier);
|
|
33
|
-
if (i === -1) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
this._warningSuppliers.splice(i, 1);
|
|
37
|
-
}
|
|
38
|
-
getWarnings() {
|
|
39
|
-
return this._warningSuppliers.reduce((aggregated, supplier) => {
|
|
40
|
-
for (const warning of supplier.getWarnings()) {
|
|
41
|
-
aggregated.push(warning);
|
|
42
|
-
}
|
|
43
|
-
return aggregated;
|
|
44
|
-
}, []);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Listen for the message messageKey being received.
|
|
48
|
-
*/
|
|
49
|
-
listenForMessage(l, messageKey) {
|
|
50
|
-
if (this._getIndexOfMessageListener(l) !== -1) {
|
|
51
|
-
console.warn("Tried to add listener twice");
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
this._messageListeners.push({ l, messageKey });
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Removes the listener
|
|
59
|
-
*/
|
|
60
|
-
stopListenForMessage(l) {
|
|
61
|
-
const i = this._getIndexOfMessageListener(l);
|
|
62
|
-
if (i === -1) {
|
|
63
|
-
console.warn("Tried to stopListen on unknown listener");
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
this._messageListeners.splice(i, 1);
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
get receiveInProgress() {
|
|
70
|
-
return this._receiveInProgress;
|
|
71
|
-
}
|
|
72
|
-
get hasMessageListeners() {
|
|
73
|
-
return 0 < this._messageListeners.length;
|
|
74
|
-
}
|
|
75
|
-
_containerListener(data) {
|
|
76
|
-
if (CfgIOManager._inhibitAllReceive) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (!CfgIOManager.isIOContainer(data)) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
CfgIOManager._inhibitAllReceive = true;
|
|
83
|
-
this._receiveInProgress = true;
|
|
84
|
-
// The 15 or so rows below is one of the cases where I believe building a clever
|
|
85
|
-
// data structure of so would probably be worse for performance than just looping
|
|
86
|
-
// as the subscribers are expected to be very few
|
|
87
|
-
const listeners = this._messageListeners;
|
|
88
|
-
const allMessageKeys = listeners.reduce((a, c) => {
|
|
89
|
-
a.add(c.messageKey);
|
|
90
|
-
return a;
|
|
91
|
-
}, new Set());
|
|
92
|
-
const promises = [];
|
|
93
|
-
(() => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
for (const messageKey of allMessageKeys) {
|
|
95
|
-
if (!CfgIOManager.hasIOContainerMessageKey(data, messageKey)) {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
const message = CfgIOManager.getMessageFromIOContainer(data, messageKey);
|
|
99
|
-
for (const item of listeners) {
|
|
100
|
-
if (item.messageKey !== messageKey) {
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
// async, not waiting on each other. Might need to change.
|
|
104
|
-
promises.push(item.l(message));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}))();
|
|
108
|
-
Promise.all(promises)
|
|
109
|
-
.then(() => {
|
|
110
|
-
this._receiveInProgress = false;
|
|
111
|
-
CfgIOManager._inhibitAllReceive = false;
|
|
112
|
-
})
|
|
113
|
-
.catch(() => {
|
|
114
|
-
this._receiveInProgress = false;
|
|
115
|
-
CfgIOManager._inhibitAllReceive = false;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
CfgIOManager.isIOContainer = (data) => hasConfiguraAttribute(data) && data[CONFIGURA_ATTRIBUTE] === CONFIGURA_SHEBANG;
|
|
120
|
-
CfgIOManager.hasIOContainerMessageKey = (container, messageKey) => messageKey in container.messages;
|
|
121
|
-
CfgIOManager.getMessageFromIOContainer = (container, messageKey) => {
|
|
122
|
-
if (!CfgIOManager.isIOContainer(container)) {
|
|
123
|
-
throw new Error("The passed data was not a CfgIOContainer. It is to be expected that such data messages can arrive, so please use isIOContainer function to filter them out before calling this.");
|
|
124
|
-
}
|
|
125
|
-
if (!CfgIOManager.hasIOContainerMessageKey(container, messageKey)) {
|
|
126
|
-
throw new Error(`The passed data did not have the messageKey "${messageKey}". You can test for this using hasIOContainerMessageKey function.`);
|
|
127
|
-
}
|
|
128
|
-
return container.messages[messageKey];
|
|
129
|
-
};
|
|
130
|
-
CfgIOManager.makeContainer = (messages) => ({
|
|
131
|
-
[CONFIGURA_ATTRIBUTE]: CONFIGURA_SHEBANG,
|
|
132
|
-
messages,
|
|
133
|
-
});
|
|
134
|
-
CfgIOManager._inhibitAllReceive = false;
|
|
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
|
+
const CONFIGURA_ATTRIBUTE = "C0nf1gura";
|
|
11
|
+
const CONFIGURA_SHEBANG = "arug1fn0C";
|
|
12
|
+
// Support function. Did not manage to check both attribute and value in one step
|
|
13
|
+
const hasConfiguraAttribute = (data) => {
|
|
14
|
+
return typeof data === "object" && data !== null;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Base class for classes handling input and output in globally shared environments.
|
|
18
|
+
*/
|
|
19
|
+
export class CfgIOManager {
|
|
20
|
+
constructor() {
|
|
21
|
+
this._warningSuppliers = [];
|
|
22
|
+
// A lock to avoid circular write. Asynchronous conditions can make this not be enough.
|
|
23
|
+
// Avoid creating pre-conditions where this can happen.
|
|
24
|
+
this._receiveInProgress = false;
|
|
25
|
+
this._messageListeners = [];
|
|
26
|
+
this._getIndexOfMessageListener = (l) => this._messageListeners.findIndex((item) => l === item.l);
|
|
27
|
+
}
|
|
28
|
+
addWarningSupplier(supplier) {
|
|
29
|
+
this._warningSuppliers.push(supplier);
|
|
30
|
+
}
|
|
31
|
+
removeWarningSupplier(supplier) {
|
|
32
|
+
const i = this._warningSuppliers.indexOf(supplier);
|
|
33
|
+
if (i === -1) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this._warningSuppliers.splice(i, 1);
|
|
37
|
+
}
|
|
38
|
+
getWarnings() {
|
|
39
|
+
return this._warningSuppliers.reduce((aggregated, supplier) => {
|
|
40
|
+
for (const warning of supplier.getWarnings()) {
|
|
41
|
+
aggregated.push(warning);
|
|
42
|
+
}
|
|
43
|
+
return aggregated;
|
|
44
|
+
}, []);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Listen for the message messageKey being received.
|
|
48
|
+
*/
|
|
49
|
+
listenForMessage(l, messageKey) {
|
|
50
|
+
if (this._getIndexOfMessageListener(l) !== -1) {
|
|
51
|
+
console.warn("Tried to add listener twice");
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
this._messageListeners.push({ l, messageKey });
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Removes the listener
|
|
59
|
+
*/
|
|
60
|
+
stopListenForMessage(l) {
|
|
61
|
+
const i = this._getIndexOfMessageListener(l);
|
|
62
|
+
if (i === -1) {
|
|
63
|
+
console.warn("Tried to stopListen on unknown listener");
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
this._messageListeners.splice(i, 1);
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
get receiveInProgress() {
|
|
70
|
+
return this._receiveInProgress;
|
|
71
|
+
}
|
|
72
|
+
get hasMessageListeners() {
|
|
73
|
+
return 0 < this._messageListeners.length;
|
|
74
|
+
}
|
|
75
|
+
_containerListener(data) {
|
|
76
|
+
if (CfgIOManager._inhibitAllReceive) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (!CfgIOManager.isIOContainer(data)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
CfgIOManager._inhibitAllReceive = true;
|
|
83
|
+
this._receiveInProgress = true;
|
|
84
|
+
// The 15 or so rows below is one of the cases where I believe building a clever
|
|
85
|
+
// data structure of so would probably be worse for performance than just looping
|
|
86
|
+
// as the subscribers are expected to be very few
|
|
87
|
+
const listeners = this._messageListeners;
|
|
88
|
+
const allMessageKeys = listeners.reduce((a, c) => {
|
|
89
|
+
a.add(c.messageKey);
|
|
90
|
+
return a;
|
|
91
|
+
}, new Set());
|
|
92
|
+
const promises = [];
|
|
93
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
for (const messageKey of allMessageKeys) {
|
|
95
|
+
if (!CfgIOManager.hasIOContainerMessageKey(data, messageKey)) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const message = CfgIOManager.getMessageFromIOContainer(data, messageKey);
|
|
99
|
+
for (const item of listeners) {
|
|
100
|
+
if (item.messageKey !== messageKey) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
// async, not waiting on each other. Might need to change.
|
|
104
|
+
promises.push(item.l(message));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}))();
|
|
108
|
+
Promise.all(promises)
|
|
109
|
+
.then(() => {
|
|
110
|
+
this._receiveInProgress = false;
|
|
111
|
+
CfgIOManager._inhibitAllReceive = false;
|
|
112
|
+
})
|
|
113
|
+
.catch(() => {
|
|
114
|
+
this._receiveInProgress = false;
|
|
115
|
+
CfgIOManager._inhibitAllReceive = false;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
CfgIOManager.isIOContainer = (data) => hasConfiguraAttribute(data) && data[CONFIGURA_ATTRIBUTE] === CONFIGURA_SHEBANG;
|
|
120
|
+
CfgIOManager.hasIOContainerMessageKey = (container, messageKey) => messageKey in container.messages;
|
|
121
|
+
CfgIOManager.getMessageFromIOContainer = (container, messageKey) => {
|
|
122
|
+
if (!CfgIOManager.isIOContainer(container)) {
|
|
123
|
+
throw new Error("The passed data was not a CfgIOContainer. It is to be expected that such data messages can arrive, so please use isIOContainer function to filter them out before calling this.");
|
|
124
|
+
}
|
|
125
|
+
if (!CfgIOManager.hasIOContainerMessageKey(container, messageKey)) {
|
|
126
|
+
throw new Error(`The passed data did not have the messageKey "${messageKey}". You can test for this using hasIOContainerMessageKey function.`);
|
|
127
|
+
}
|
|
128
|
+
return container.messages[messageKey];
|
|
129
|
+
};
|
|
130
|
+
CfgIOManager.makeContainer = (messages) => ({
|
|
131
|
+
[CONFIGURA_ATTRIBUTE]: CONFIGURA_SHEBANG,
|
|
132
|
+
messages,
|
|
133
|
+
});
|
|
134
|
+
CfgIOManager._inhibitAllReceive = false;
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { DtoAdditionalProductConfiguration, DtoProductConf } from "../CatalogueAPI.js";
|
|
2
|
-
import { CfgProduct, CfgProductChangeNotification } from "../CfgProduct.js";
|
|
3
|
-
import { CfgProdConfParts } from "../utilitiesConfiguration.js";
|
|
4
|
-
import { CfgIOManager } from "./CfgIOManager.js";
|
|
5
|
-
import { CfgIOWarningSupplier } from "./CfgIOWarningSupplier.js";
|
|
6
|
-
export declare const isCfgProdConfMessage: (data: unknown) => data is CfgProdConfMessageV1 | CfgProdConfMessageV2;
|
|
7
|
-
export declare type CfgProdConfMessageV1 = {
|
|
8
|
-
version: "1.0";
|
|
9
|
-
conf: DtoAdditionalProductConfiguration;
|
|
10
|
-
};
|
|
11
|
-
export declare const isCfgProdConfMessageV1: (data: unknown) => data is CfgProdConfMessageV1;
|
|
12
|
-
export declare type CfgProdConfMessageV2 = {
|
|
13
|
-
version: "2.0";
|
|
14
|
-
conf: DtoProductConf;
|
|
15
|
-
};
|
|
16
|
-
export declare const isCfgProdConfMessageV2: (data: unknown) => data is CfgProdConfMessageV2;
|
|
17
|
-
export declare type CfgProdConfMessage = {
|
|
18
|
-
initial: boolean;
|
|
19
|
-
subMessages: (CfgProdConfMessageV1 | CfgProdConfMessageV2)[];
|
|
20
|
-
};
|
|
21
|
-
export declare const getHighestVersionProdConfMessage: (subMessages: (CfgProdConfMessageV1 | CfgProdConfMessageV2)[]) => CfgProdConfMessageV1 | CfgProdConfMessageV2;
|
|
22
|
-
export declare enum CfgProdConfMessageVersions {
|
|
23
|
-
V1dot0 = 1,
|
|
24
|
-
V2dot0 = 2
|
|
25
|
-
}
|
|
26
|
-
export declare const STAGE_PROD_CONF_MESSAGE_KEY = "stageprodconf";
|
|
27
|
-
declare type ProdConfMessageCallback = (message: CfgProdConfMessage) => Promise<void>;
|
|
28
|
-
declare type ProdConfCallback = (conf: DtoProductConf) => Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Base class for connecting the product configuration to an IO channel
|
|
31
|
-
*/
|
|
32
|
-
export declare abstract class CfgIOProdConfConnector<S> implements CfgIOWarningSupplier {
|
|
33
|
-
protected readonly _ioManager: CfgIOManager<S>;
|
|
34
|
-
private readonly _includeInSend;
|
|
35
|
-
protected _product: CfgProduct | undefined;
|
|
36
|
-
private _stopListenToMessage;
|
|
37
|
-
private _stopListenToProdConf;
|
|
38
|
-
constructor(_ioManager: CfgIOManager<S>, _includeInSend: CfgProdConfParts);
|
|
39
|
-
destroy(): void;
|
|
40
|
-
getWarnings(): string[];
|
|
41
|
-
setProduct: (product: CfgProduct | undefined) => Promise<void>;
|
|
42
|
-
private _send;
|
|
43
|
-
protected abstract makeSendData(conf: DtoProductConf, initial: boolean): S;
|
|
44
|
-
static makeMessage: (conf: DtoProductConf, initial: boolean, sendVersions: CfgProdConfMessageVersions) => CfgProdConfMessage;
|
|
45
|
-
static makeMessageListener: (callback: ProdConfMessageCallback) => (message: unknown) => Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Register the callback to listen for Product Configuration messages
|
|
48
|
-
* @returns A function which when called will cancel listening
|
|
49
|
-
*/
|
|
50
|
-
static listenForMessage<S>(callback: ProdConfMessageCallback, ioManager: CfgIOManager<S>): () => void;
|
|
51
|
-
static makeProdConfListener: (callback: ProdConfCallback, includeInSend: CfgProdConfParts) => (n: CfgProductChangeNotification) => void;
|
|
52
|
-
static listenForProdConf(product: CfgProduct, callback: ProdConfCallback, includeInSend: CfgProdConfParts): () => void;
|
|
53
|
-
}
|
|
54
|
-
export {};
|
|
1
|
+
import { DtoAdditionalProductConfiguration, DtoProductConf } from "../CatalogueAPI.js";
|
|
2
|
+
import { CfgProduct, CfgProductChangeNotification } from "../CfgProduct.js";
|
|
3
|
+
import { CfgProdConfParts } from "../utilitiesConfiguration.js";
|
|
4
|
+
import { CfgIOManager } from "./CfgIOManager.js";
|
|
5
|
+
import { CfgIOWarningSupplier } from "./CfgIOWarningSupplier.js";
|
|
6
|
+
export declare const isCfgProdConfMessage: (data: unknown) => data is CfgProdConfMessageV1 | CfgProdConfMessageV2;
|
|
7
|
+
export declare type CfgProdConfMessageV1 = {
|
|
8
|
+
version: "1.0";
|
|
9
|
+
conf: DtoAdditionalProductConfiguration;
|
|
10
|
+
};
|
|
11
|
+
export declare const isCfgProdConfMessageV1: (data: unknown) => data is CfgProdConfMessageV1;
|
|
12
|
+
export declare type CfgProdConfMessageV2 = {
|
|
13
|
+
version: "2.0";
|
|
14
|
+
conf: DtoProductConf;
|
|
15
|
+
};
|
|
16
|
+
export declare const isCfgProdConfMessageV2: (data: unknown) => data is CfgProdConfMessageV2;
|
|
17
|
+
export declare type CfgProdConfMessage = {
|
|
18
|
+
initial: boolean;
|
|
19
|
+
subMessages: (CfgProdConfMessageV1 | CfgProdConfMessageV2)[];
|
|
20
|
+
};
|
|
21
|
+
export declare const getHighestVersionProdConfMessage: (subMessages: (CfgProdConfMessageV1 | CfgProdConfMessageV2)[]) => CfgProdConfMessageV1 | CfgProdConfMessageV2;
|
|
22
|
+
export declare enum CfgProdConfMessageVersions {
|
|
23
|
+
V1dot0 = 1,
|
|
24
|
+
V2dot0 = 2
|
|
25
|
+
}
|
|
26
|
+
export declare const STAGE_PROD_CONF_MESSAGE_KEY = "stageprodconf";
|
|
27
|
+
declare type ProdConfMessageCallback = (message: CfgProdConfMessage) => Promise<void>;
|
|
28
|
+
declare type ProdConfCallback = (conf: DtoProductConf) => Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Base class for connecting the product configuration to an IO channel
|
|
31
|
+
*/
|
|
32
|
+
export declare abstract class CfgIOProdConfConnector<S> implements CfgIOWarningSupplier {
|
|
33
|
+
protected readonly _ioManager: CfgIOManager<S>;
|
|
34
|
+
private readonly _includeInSend;
|
|
35
|
+
protected _product: CfgProduct | undefined;
|
|
36
|
+
private _stopListenToMessage;
|
|
37
|
+
private _stopListenToProdConf;
|
|
38
|
+
constructor(_ioManager: CfgIOManager<S>, _includeInSend: CfgProdConfParts);
|
|
39
|
+
destroy(): void;
|
|
40
|
+
getWarnings(): string[];
|
|
41
|
+
setProduct: (product: CfgProduct | undefined) => Promise<void>;
|
|
42
|
+
private _send;
|
|
43
|
+
protected abstract makeSendData(conf: DtoProductConf, initial: boolean): S;
|
|
44
|
+
static makeMessage: (conf: DtoProductConf, initial: boolean, sendVersions: CfgProdConfMessageVersions) => CfgProdConfMessage;
|
|
45
|
+
static makeMessageListener: (callback: ProdConfMessageCallback) => (message: unknown) => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Register the callback to listen for Product Configuration messages
|
|
48
|
+
* @returns A function which when called will cancel listening
|
|
49
|
+
*/
|
|
50
|
+
static listenForMessage<S>(callback: ProdConfMessageCallback, ioManager: CfgIOManager<S>): () => void;
|
|
51
|
+
static makeProdConfListener: (callback: ProdConfCallback, includeInSend: CfgProdConfParts) => (n: CfgProductChangeNotification) => void;
|
|
52
|
+
static listenForProdConf(product: CfgProduct, callback: ProdConfCallback, includeInSend: CfgProdConfParts): () => void;
|
|
53
|
+
}
|
|
54
|
+
export {};
|
|
55
55
|
//# sourceMappingURL=CfgIOProdConfConnector.d.ts.map
|