@configura/web-api 2.0.0-alpha.20 → 2.0.0-alpha.21

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.
Files changed (100) hide show
  1. package/.eslintrc.json +5 -18
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +597 -581
  5. package/dist/CatalogueAPI.js +328 -328
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +328 -330
  9. package/dist/CfgProduct.js +934 -879
  10. package/dist/CfgReferencePathHelper.d.ts +26 -26
  11. package/dist/CfgReferencePathHelper.js +26 -26
  12. package/dist/ConfigurationConverter.d.ts +17 -13
  13. package/dist/ConfigurationConverter.js +175 -166
  14. package/dist/index.d.ts +23 -23
  15. package/dist/index.js +23 -23
  16. package/dist/io/CfgHistoryManager.d.ts +83 -83
  17. package/dist/io/CfgHistoryManager.js +144 -150
  18. package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -17
  19. package/dist/io/CfgHistoryToProdConfConnector.js +50 -47
  20. package/dist/io/CfgIOManager.d.ts +53 -53
  21. package/dist/io/CfgIOManager.js +134 -134
  22. package/dist/io/CfgIOProdConfConnector.d.ts +64 -56
  23. package/dist/io/CfgIOProdConfConnector.js +149 -158
  24. package/dist/io/CfgIOWarningSupplier.d.ts +3 -3
  25. package/dist/io/CfgIOWarningSupplier.js +1 -1
  26. package/dist/io/CfgObservableStateManager.d.ts +25 -25
  27. package/dist/io/CfgObservableStateManager.js +69 -69
  28. package/dist/io/CfgObservableStateToProdConfConnector.d.ts +14 -14
  29. package/dist/io/CfgObservableStateToProdConfConnector.js +16 -16
  30. package/dist/io/CfgWindowEventManager.d.ts +21 -21
  31. package/dist/io/CfgWindowEventManager.js +38 -38
  32. package/dist/io/CfgWindowMessageManager.d.ts +40 -40
  33. package/dist/io/CfgWindowMessageManager.js +91 -91
  34. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +16 -16
  35. package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -18
  36. package/dist/io/index.d.ts +8 -8
  37. package/dist/io/index.js +8 -8
  38. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  39. package/dist/material/CfgMaterialMapping.js +181 -181
  40. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  41. package/dist/material/CfgMtrlApplication.js +43 -43
  42. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  43. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  44. package/dist/material/CfgMtrlSource.d.ts +19 -19
  45. package/dist/material/CfgMtrlSource.js +40 -40
  46. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  47. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  48. package/dist/productConfiguration/CfgFeature.d.ts +189 -189
  49. package/dist/productConfiguration/CfgFeature.js +658 -658
  50. package/dist/productConfiguration/CfgOption.d.ts +151 -151
  51. package/dist/productConfiguration/CfgOption.js +422 -422
  52. package/dist/productConfiguration/CfgProductConfiguration.d.ts +129 -129
  53. package/dist/productConfiguration/CfgProductConfiguration.js +340 -340
  54. package/dist/productConfiguration/filters.d.ts +15 -15
  55. package/dist/productConfiguration/filters.js +70 -70
  56. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  57. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  58. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  59. package/dist/productConfiguration/utilitiesProductConfiguration.js +87 -87
  60. package/dist/productLoader.d.ts +33 -33
  61. package/dist/productLoader.js +49 -49
  62. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
  63. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
  64. package/dist/syncGroups/SyncGroupsHandler.d.ts +47 -43
  65. package/dist/syncGroups/SyncGroupsHandler.js +370 -363
  66. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
  67. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
  68. package/dist/syncGroups/SyncGroupsState.d.ts +39 -35
  69. package/dist/syncGroups/SyncGroupsState.js +167 -125
  70. package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
  71. package/dist/syncGroups/SyncGroupsTransaction.js +589 -589
  72. package/dist/tasks/TaskHandler.d.ts +77 -77
  73. package/dist/tasks/TaskHandler.js +276 -276
  74. package/dist/tasks/formats.d.ts +4 -4
  75. package/dist/tasks/formats.js +7 -7
  76. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  77. package/dist/tests/testData/collectorForTest.js +194 -194
  78. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  79. package/dist/tests/testData/dummyProductForTest.js +32 -32
  80. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
  81. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +282 -278
  82. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  83. package/dist/tests/testData/testDataCachedGetProduct.js +187 -186
  84. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  85. package/dist/tests/testData/testDataCachedPostValidate.js +185 -184
  86. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  87. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  88. package/dist/tests/testData/testDataOptions.d.ts +12 -12
  89. package/dist/tests/testData/testDataOptions.js +60 -60
  90. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  91. package/dist/tests/testData/testDataProductAggregatedPrice.js +189 -188
  92. package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
  93. package/dist/tests/testData/testDataUpcharge.js +121 -120
  94. package/dist/utilitiesCatalogueData.d.ts +47 -47
  95. package/dist/utilitiesCatalogueData.js +180 -180
  96. package/dist/utilitiesCataloguePermission.d.ts +38 -38
  97. package/dist/utilitiesCataloguePermission.js +79 -79
  98. package/dist/utilitiesNumericValues.d.ts +24 -24
  99. package/dist/utilitiesNumericValues.js +114 -109
  100. package/package.json +3 -3
@@ -1,54 +1,54 @@
1
- import { CfgIOWarningSupplier } from "./CfgIOWarningSupplier";
2
- declare type ConfiguraAttribute = "C0nf1gura";
3
- declare type ConfiguraShebang = "arug1fn0C";
4
- declare const CONFIGURA_ATTRIBUTE: ConfiguraAttribute;
5
- export declare type IOManagerListener = (data: unknown) => Promise<void>;
6
- /**
7
- * The container format used when the environment is globally shared with things
8
- * outside our control. The "shebang" is a magic string that should prevent from a
9
- * CfgIOContainer being confused with something else.
10
- */
11
- export declare type CfgIOContainer = {
12
- [CONFIGURA_ATTRIBUTE]: ConfiguraShebang;
13
- messages: {
14
- [index: string]: unknown;
15
- };
16
- };
17
- /**
18
- * Base class for classes handling input and output in globally shared environments.
19
- */
20
- export declare abstract class CfgIOManager<S> {
21
- private _warningSuppliers;
22
- addWarningSupplier(supplier: CfgIOWarningSupplier): void;
23
- removeWarningSupplier(supplier: CfgIOWarningSupplier): void;
24
- getWarnings(): string[];
25
- /**
26
- * Listen for the message messageKey being received.
27
- */
28
- listenForMessage(l: IOManagerListener, messageKey: string): boolean;
29
- /**
30
- * Removes the listener
31
- */
32
- stopListenForMessage(l: IOManagerListener): boolean;
33
- static isIOContainer: (data: unknown) => data is CfgIOContainer;
34
- static hasIOContainerMessageKey: (container: CfgIOContainer, messageKey: string) => boolean;
35
- static getMessageFromIOContainer: (container: unknown, messageKey: string) => unknown;
36
- static makeContainer: (messages: {
37
- [index: string]: unknown;
38
- }) => CfgIOContainer;
39
- private _receiveInProgress;
40
- private static _inhibitAllReceive;
41
- get receiveInProgress(): boolean;
42
- private _messageListeners;
43
- private _getIndexOfMessageListener;
44
- get hasMessageListeners(): boolean;
45
- protected _containerListener(data: unknown): void;
46
- /**
47
- * Send the data with messageKey. This can for example be pushing or
48
- * replacing on the history stack or sending a message using the
49
- * window.message API.
50
- */
51
- abstract send(messageKey: string, data: S): void;
52
- }
53
- export {};
1
+ import { CfgIOWarningSupplier } from "./CfgIOWarningSupplier";
2
+ declare type ConfiguraAttribute = "C0nf1gura";
3
+ declare type ConfiguraShebang = "arug1fn0C";
4
+ declare const CONFIGURA_ATTRIBUTE: ConfiguraAttribute;
5
+ export declare type IOManagerListener = (data: unknown) => Promise<void>;
6
+ /**
7
+ * The container format used when the environment is globally shared with things
8
+ * outside our control. The "shebang" is a magic string that should prevent from a
9
+ * CfgIOContainer being confused with something else.
10
+ */
11
+ export declare type CfgIOContainer = {
12
+ [CONFIGURA_ATTRIBUTE]: ConfiguraShebang;
13
+ messages: {
14
+ [index: string]: unknown;
15
+ };
16
+ };
17
+ /**
18
+ * Base class for classes handling input and output in globally shared environments.
19
+ */
20
+ export declare abstract class CfgIOManager<S> {
21
+ private _warningSuppliers;
22
+ addWarningSupplier(supplier: CfgIOWarningSupplier): void;
23
+ removeWarningSupplier(supplier: CfgIOWarningSupplier): void;
24
+ getWarnings(): string[];
25
+ /**
26
+ * Listen for the message messageKey being received.
27
+ */
28
+ listenForMessage(l: IOManagerListener, messageKey: string): boolean;
29
+ /**
30
+ * Removes the listener
31
+ */
32
+ stopListenForMessage(l: IOManagerListener): boolean;
33
+ static isIOContainer: (data: unknown) => data is CfgIOContainer;
34
+ static hasIOContainerMessageKey: (container: CfgIOContainer, messageKey: string) => boolean;
35
+ static getMessageFromIOContainer: (container: unknown, messageKey: string) => unknown;
36
+ static makeContainer: (messages: {
37
+ [index: string]: unknown;
38
+ }) => CfgIOContainer;
39
+ private _receiveInProgress;
40
+ private static _inhibitAllReceive;
41
+ get receiveInProgress(): boolean;
42
+ private _messageListeners;
43
+ private _getIndexOfMessageListener;
44
+ get hasMessageListeners(): boolean;
45
+ protected _containerListener(data: unknown): void;
46
+ /**
47
+ * Send the data with messageKey. This can for example be pushing or
48
+ * replacing on the history stack or sending a message using the
49
+ * window.message API.
50
+ */
51
+ abstract send(messageKey: string, data: S): void;
52
+ }
53
+ export {};
54
54
  //# sourceMappingURL=CfgIOManager.d.ts.map
@@ -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,57 +1,65 @@
1
- import { DtoAdditionalProductConfiguration, DtoProductConf } from "../CatalogueAPI.js";
2
- import { CfgProduct, CfgProductChangeNotification } from "../CfgProduct.js";
3
- import { CfgIOManager } from "./CfgIOManager.js";
4
- import { CfgIOWarningSupplier } from "./CfgIOWarningSupplier.js";
5
- export declare const isCfgProdConfMessage: (data: unknown) => data is CfgProdConfMessageV1 | CfgProdConfMessageV2;
6
- export declare type CfgProdConfMessageV1 = {
7
- version: "1.0";
8
- conf: DtoAdditionalProductConfiguration;
9
- };
10
- export declare const isCfgProdConfMessageV1: (data: unknown) => data is CfgProdConfMessageV1;
11
- export declare type CfgProdConfMessageV2 = {
12
- version: "2.0";
13
- conf: DtoProductConf;
14
- };
15
- export declare const isCfgProdConfMessageV2: (data: unknown) => data is CfgProdConfMessageV2;
16
- export declare type CfgProdConfMessage = {
17
- initial: boolean;
18
- subMessages: (CfgProdConfMessageV1 | CfgProdConfMessageV2)[];
19
- };
20
- export declare const getHighestVersionProdConfMessage: (subMessages: (CfgProdConfMessageV1 | CfgProdConfMessageV2)[]) => CfgProdConfMessageV1 | CfgProdConfMessageV2;
21
- export declare enum CfgProdConfMessageVersions {
22
- V1dot0 = 1,
23
- V2dot0 = 2
24
- }
25
- export declare const STAGE_PROD_CONF_MESSAGE_KEY = "stageprodconf";
26
- declare type ProdConfMessageCallback = (message: CfgProdConfMessage) => Promise<void>;
27
- declare type ProdConfCallback = (conf: DtoProductConf) => Promise<void>;
28
- /**
29
- * Base class for connecting the product configuration to an IO channel
30
- */
31
- export declare abstract class CfgIOProdConfConnector<S> implements CfgIOWarningSupplier {
32
- protected readonly _ioManager: CfgIOManager<S>;
33
- private readonly _includeExtendedDataInSend;
34
- private readonly _includeProdParamsInSend;
35
- protected _product: CfgProduct | undefined;
36
- private _stopListenToMessage;
37
- private _stopListenToProdConf;
38
- constructor(_ioManager: CfgIOManager<S>, _includeExtendedDataInSend: boolean, // Only for v2.0
39
- _includeProdParamsInSend: boolean);
40
- destroy(): void;
41
- getWarnings(): string[];
42
- setProduct: (product: CfgProduct | undefined) => Promise<void>;
43
- private _send;
44
- protected getInitialProdConf(): DtoProductConf | undefined;
45
- protected abstract makeSendData(conf: DtoProductConf, initial: boolean): S;
46
- static makeMessage(conf: DtoProductConf, initial: boolean, sendVersions: CfgProdConfMessageVersions): CfgProdConfMessage;
47
- static makeMessageListener(callback: ProdConfMessageCallback): (message: unknown) => Promise<void>;
48
- /**
49
- * Register the callback to listen for Product Configuration messages
50
- * @returns A function which when called will cancel listening
51
- */
52
- static listenForMessage<S>(callback: ProdConfMessageCallback, ioManager: CfgIOManager<S>): () => void;
53
- static makeProdConfListener(callback: ProdConfCallback, includeExtendedDataInSend: boolean, includeProdParamsInSend: boolean): (n: CfgProductChangeNotification) => void;
54
- static listenForProdConf(product: CfgProduct, callback: ProdConfCallback, includeExtendedDataInSend: boolean, includeProdParamsInSend: boolean): () => void;
55
- }
56
- export {};
1
+ import { DtoAdditionalProductConfiguration, DtoProductConf } from "../CatalogueAPI.js";
2
+ import { CfgProduct, CfgProductChangeNotification } from "../CfgProduct.js";
3
+ import { CfgIOManager } from "./CfgIOManager.js";
4
+ import { CfgIOWarningSupplier } from "./CfgIOWarningSupplier.js";
5
+ export declare const isCfgProdConfMessage: (data: unknown) => data is CfgProdConfMessageV1 | CfgProdConfMessageV2;
6
+ export declare type CfgProdConfMessageV1 = {
7
+ version: "1.0";
8
+ conf: DtoAdditionalProductConfiguration;
9
+ };
10
+ export declare const isCfgProdConfMessageV1: (data: unknown) => data is CfgProdConfMessageV1;
11
+ export declare type CfgProdConfMessageV2 = {
12
+ version: "2.0";
13
+ conf: DtoProductConf;
14
+ };
15
+ export declare const isCfgProdConfMessageV2: (data: unknown) => data is CfgProdConfMessageV2;
16
+ export declare type CfgProdConfMessage = {
17
+ initial: boolean;
18
+ subMessages: (CfgProdConfMessageV1 | CfgProdConfMessageV2)[];
19
+ };
20
+ export declare const getHighestVersionProdConfMessage: (subMessages: (CfgProdConfMessageV1 | CfgProdConfMessageV2)[]) => CfgProdConfMessageV1 | CfgProdConfMessageV2;
21
+ export declare enum CfgProdConfMessageVersions {
22
+ V1dot0 = 1,
23
+ V2dot0 = 2
24
+ }
25
+ /**
26
+ * @param ExtendedData Includes extra data, i.e. units and groupCodes
27
+ * @param ProductParams Includes what Product this was generated for, and the same for any Additional Products.
28
+ * @param SyncGroupState Includes the current sync group state
29
+ */
30
+ export declare enum CfgProdConfParts {
31
+ NoExtra = 0,
32
+ ExtendedData = 1,
33
+ ProdParams = 2,
34
+ SyncGroupState = 4
35
+ }
36
+ export declare const STAGE_PROD_CONF_MESSAGE_KEY = "stageprodconf";
37
+ declare type ProdConfMessageCallback = (message: CfgProdConfMessage) => Promise<void>;
38
+ declare type ProdConfCallback = (conf: DtoProductConf) => Promise<void>;
39
+ /**
40
+ * Base class for connecting the product configuration to an IO channel
41
+ */
42
+ export declare abstract class CfgIOProdConfConnector<S> implements CfgIOWarningSupplier {
43
+ protected readonly _ioManager: CfgIOManager<S>;
44
+ private readonly _includeInSend;
45
+ protected _product: CfgProduct | undefined;
46
+ private _stopListenToMessage;
47
+ private _stopListenToProdConf;
48
+ constructor(_ioManager: CfgIOManager<S>, _includeInSend: CfgProdConfParts);
49
+ destroy(): void;
50
+ getWarnings(): string[];
51
+ setProduct: (product: CfgProduct | undefined) => Promise<void>;
52
+ private _send;
53
+ protected abstract makeSendData(conf: DtoProductConf, initial: boolean): S;
54
+ static makeMessage: (conf: DtoProductConf, initial: boolean, sendVersions: CfgProdConfMessageVersions) => CfgProdConfMessage;
55
+ static makeMessageListener: (callback: ProdConfMessageCallback) => (message: unknown) => Promise<void>;
56
+ /**
57
+ * Register the callback to listen for Product Configuration messages
58
+ * @returns A function which when called will cancel listening
59
+ */
60
+ static listenForMessage<S>(callback: ProdConfMessageCallback, ioManager: CfgIOManager<S>): () => void;
61
+ static makeProdConfListener: (callback: ProdConfCallback, includeInSend: CfgProdConfParts) => (n: CfgProductChangeNotification) => void;
62
+ static listenForProdConf(product: CfgProduct, callback: ProdConfCallback, includeInSend: CfgProdConfParts): () => void;
63
+ }
64
+ export {};
57
65
  //# sourceMappingURL=CfgIOProdConfConnector.d.ts.map