@configura/web-api 2.0.0-alpha.8 → 2.0.0

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 +622 -551
  5. package/dist/CatalogueAPI.js +329 -273
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +344 -268
  9. package/dist/CfgProduct.js +991 -780
  10. package/dist/CfgReferencePathHelper.d.ts +26 -13
  11. package/dist/CfgReferencePathHelper.js +26 -13
  12. package/dist/ConfigurationConverter.d.ts +17 -4
  13. package/dist/ConfigurationConverter.js +175 -72
  14. package/dist/index.d.ts +23 -23
  15. package/dist/index.js +23 -23
  16. package/dist/io/CfgHistoryManager.d.ts +83 -51
  17. package/dist/io/CfgHistoryManager.js +144 -82
  18. package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -20
  19. package/dist/io/CfgHistoryToProdConfConnector.js +50 -56
  20. package/dist/io/CfgIOManager.d.ts +53 -48
  21. package/dist/io/CfgIOManager.js +134 -115
  22. package/dist/io/CfgIOProdConfConnector.d.ts +64 -55
  23. package/dist/io/CfgIOProdConfConnector.js +149 -143
  24. package/dist/io/CfgIOWarningSupplier.d.ts +4 -0
  25. package/dist/io/CfgIOWarningSupplier.js +1 -0
  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 -15
  29. package/dist/io/CfgObservableStateToProdConfConnector.js +16 -17
  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 -87
  34. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +16 -17
  35. package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -19
  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 +192 -187
  49. package/dist/productConfiguration/CfgFeature.js +663 -645
  50. package/dist/productConfiguration/CfgOption.d.ts +157 -151
  51. package/dist/productConfiguration/CfgOption.js +444 -416
  52. package/dist/productConfiguration/CfgProductConfiguration.d.ts +128 -117
  53. package/dist/productConfiguration/CfgProductConfiguration.js +331 -307
  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 -80
  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 -40
  65. package/dist/syncGroups/SyncGroupsHandler.js +370 -359
  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 -576
  72. package/dist/tasks/TaskHandler.d.ts +77 -77
  73. package/dist/tasks/TaskHandler.js +276 -275
  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 -277
  82. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  83. package/dist/tests/testData/testDataCachedGetProduct.js +187 -185
  84. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  85. package/dist/tests/testData/testDataCachedPostValidate.js +185 -183
  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 -187
  92. package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
  93. package/dist/tests/testData/testDataUpcharge.js +121 -119
  94. package/dist/utilitiesCatalogueData.d.ts +47 -42
  95. package/dist/utilitiesCatalogueData.js +180 -173
  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,82 +1,144 @@
1
- import { mapQueryString, unmapQueryString } from "@configura/web-utilities";
2
- import { CfgIOManager } from "./CfgIOManager.js";
3
- import { CfgWindowEventManager } from "./CfgWindowEventManager.js";
4
- /**
5
- * This class is used to coordinate writing and reading to the browser history.
6
- * It handles messages sent from the connectors.
7
- */
8
- export class CfgHistoryManager extends CfgWindowEventManager {
9
- constructor() {
10
- super();
11
- this.eventType = "popstate";
12
- }
13
- static get instance() {
14
- if (this._instance === undefined) {
15
- this._instance = new CfgHistoryManager();
16
- }
17
- return this._instance;
18
- }
19
- /**
20
- * Write to the history
21
- */
22
- send(messageKey, data) {
23
- const { qsKeyValues, message, useHistoryPush } = data;
24
- // Initial data is before user interaction has happened
25
- const initial = message.initial;
26
- // At initial we do not replace the URL as we presumable have the defaults
27
- const newUrl = initial ? null : CfgHistoryManager._makeUpdatedUrl(qsKeyValues);
28
- // ...but we do replace the state so that we can in the future browse back to here
29
- const newState = CfgHistoryManager._makeUpdatedState(window.history.state, message, messageKey);
30
- if (initial || !useHistoryPush || this.receiveInProgress) {
31
- window.history.replaceState(newState, "", newUrl);
32
- }
33
- else {
34
- window.history.pushState(newState, "", newUrl);
35
- }
36
- }
37
- /**
38
- * Takes the current in browser URL and updates it with the provided Query String values.
39
- * Old Query String is replaced.
40
- */
41
- static _makeUpdatedUrl(qsKeyValues) {
42
- const qs = this._makeUpdatedQueryString(qsKeyValues);
43
- return `${window.location.origin}${window.location.pathname}${qs ? "?" : ""}${qs}${window.location.hash}`;
44
- }
45
- /**
46
- * Returns the current in browser Query String updated with the key values provided.
47
- * If a value is undefined in the passed map it will be deleted from the Query String.
48
- */
49
- static _makeUpdatedQueryString(qsKeyValues) {
50
- const currentKeyValues = this.currentQsKeyValues();
51
- for (const [key, value] of qsKeyValues) {
52
- if (value === undefined) {
53
- currentKeyValues.delete(key);
54
- }
55
- else {
56
- currentKeyValues.set(key, value);
57
- }
58
- }
59
- return unmapQueryString(currentKeyValues);
60
- }
61
- /**
62
- * @returns The current in browser Query String as a Map
63
- */
64
- static currentQsKeyValues() {
65
- return mapQueryString(window.location.search);
66
- }
67
- /**
68
- * If the passed currentState is a CfgIOContainer it will update it with the
69
- * passed message. If not it will create a new CfgIOContainer with the message.
70
- */
71
- static _makeUpdatedState(currentState, message, messageKey) {
72
- let messages = {};
73
- if (CfgIOManager.isIOContainer(currentState)) {
74
- messages = currentState.messages;
75
- }
76
- messages[messageKey] = message;
77
- return CfgIOManager.makeContainer(messages);
78
- }
79
- getDataFromEvent(event) {
80
- return event.state;
81
- }
82
- }
1
+ import { mapQueryString, Observable, unmapQueryString } from "@configura/web-utilities";
2
+ import { CfgIOManager } from "./CfgIOManager.js";
3
+ import { CfgWindowEventManager } from "./CfgWindowEventManager.js";
4
+ /**
5
+ * How the history is updated.
6
+ * @param DoNotWrite Only listens to initial URL-values.
7
+ * @param Replace Replaces the current history frame at updates.
8
+ * @param Push Adds history frames at updates.
9
+ * @param ReplaceAndUpdateUrl Replaces the current history frame at updates and updates the browser URL
10
+ * @param PushAndUpdateUrl Adds history frames at updates and updates the browser URL
11
+ */
12
+ export var HistoryMode;
13
+ (function (HistoryMode) {
14
+ HistoryMode[HistoryMode["DoNotWrite"] = 0] = "DoNotWrite";
15
+ HistoryMode[HistoryMode["Replace"] = 1] = "Replace";
16
+ HistoryMode[HistoryMode["Push"] = 2] = "Push";
17
+ HistoryMode[HistoryMode["ReplaceAndUpdateUrl"] = 3] = "ReplaceAndUpdateUrl";
18
+ HistoryMode[HistoryMode["PushAndUpdateUrl"] = 4] = "PushAndUpdateUrl";
19
+ })(HistoryMode || (HistoryMode = {}));
20
+ /**
21
+ * This class is used to coordinate writing and reading to the browser history.
22
+ * It handles messages sent from the connectors.
23
+ */
24
+ export class CfgHistoryManager extends CfgWindowEventManager {
25
+ constructor() {
26
+ super();
27
+ this._aggregatedQsKeyValues = new Map();
28
+ this._urlUpdateObservable = new Observable();
29
+ this.eventType = "popstate";
30
+ }
31
+ static get instance() {
32
+ if (this._instance === undefined) {
33
+ this._instance = new CfgHistoryManager();
34
+ }
35
+ return this._instance;
36
+ }
37
+ /**
38
+ * @returns The current browser URL updated with the latest updates from
39
+ * the Connectors.
40
+ */
41
+ getUrl() {
42
+ return CfgHistoryManager._makeUpdatedUrl(this._aggregatedQsKeyValues);
43
+ }
44
+ /**
45
+ * Listen for updated URL:s. This doesn't have to mean the URL in the
46
+ * browser has been updated.
47
+ */
48
+ listenForUrl(listener) {
49
+ this._urlUpdateObservable.listen(listener);
50
+ }
51
+ /**
52
+ * Stop listen.
53
+ */
54
+ stopListenForUrl(listener) {
55
+ this._urlUpdateObservable.stopListen(listener);
56
+ }
57
+ /**
58
+ * Write to the history
59
+ */
60
+ send(messageKey, data) {
61
+ const { qsKeyValues, message, mode } = data;
62
+ for (const keyValue of qsKeyValues) {
63
+ this._aggregatedQsKeyValues.set(keyValue[0], keyValue[1]);
64
+ }
65
+ this._urlUpdateObservable.notifyAll(this.getUrl());
66
+ if (mode === HistoryMode.DoNotWrite) {
67
+ return;
68
+ }
69
+ // Initial data is before user interaction has happened
70
+ const initial = message.initial;
71
+ const url = CfgHistoryManager._makeUpdatedUrl(qsKeyValues);
72
+ // At initial we do not replace the URL as we presumable have the defaults
73
+ const writeUrl = initial ||
74
+ !(mode === HistoryMode.PushAndUpdateUrl || mode === HistoryMode.ReplaceAndUpdateUrl)
75
+ ? null
76
+ : url;
77
+ // ...but we do replace the state so that we can in the future browse back to here
78
+ const newState = CfgHistoryManager._makeUpdatedState(window.history.state, message, messageKey);
79
+ if (initial ||
80
+ mode === HistoryMode.Replace ||
81
+ mode === HistoryMode.ReplaceAndUpdateUrl ||
82
+ this.receiveInProgress) {
83
+ window.history.replaceState(newState, "", writeUrl);
84
+ }
85
+ else {
86
+ window.history.pushState(newState, "", writeUrl);
87
+ }
88
+ }
89
+ /**
90
+ * Takes the current in browser URL and updates it with the provided Query String values.
91
+ * Old Query String is replaced.
92
+ */
93
+ static _makeUpdatedUrl(qsKeyValues) {
94
+ const qs = this._makeUpdatedQueryString(qsKeyValues);
95
+ return `${window.location.origin}${window.location.pathname}${qs ? "?" : ""}${qs}${window.location.hash}`;
96
+ }
97
+ /**
98
+ * Returns the current in browser Query String updated with the key values provided.
99
+ * If a value is undefined in the passed map it will be deleted from the Query String.
100
+ */
101
+ static _makeUpdatedQueryString(qsKeyValues) {
102
+ const currentKeyValues = this.currentQsKeyValues();
103
+ for (const [key, value] of qsKeyValues) {
104
+ if (value === undefined) {
105
+ currentKeyValues.delete(key);
106
+ }
107
+ else {
108
+ currentKeyValues.set(key, value);
109
+ }
110
+ }
111
+ return unmapQueryString(currentKeyValues);
112
+ }
113
+ /**
114
+ * @returns The current in browser Query String as a Map
115
+ */
116
+ static currentQsKeyValues() {
117
+ return mapQueryString(window.location.search);
118
+ }
119
+ /**
120
+ * If the passed currentState is a CfgIOContainer it will update it with the
121
+ * passed message. If not it will create a new CfgIOContainer with the message.
122
+ */
123
+ static _makeUpdatedState(currentState, message, messageKey) {
124
+ let messages = {};
125
+ if (CfgIOManager.isIOContainer(currentState)) {
126
+ messages = currentState.messages;
127
+ }
128
+ messages[messageKey] = message;
129
+ return CfgIOManager.makeContainer(messages);
130
+ }
131
+ getDataFromEvent(event) {
132
+ return event.state;
133
+ }
134
+ static getMessageFromCurrentHistoryState(messageKey) {
135
+ const state = window.history.state;
136
+ if (!CfgIOManager.isIOContainer(state)) {
137
+ return undefined;
138
+ }
139
+ if (!CfgIOManager.hasIOContainerMessageKey(state, messageKey)) {
140
+ return undefined;
141
+ }
142
+ return CfgIOManager.getMessageFromIOContainer(state, messageKey);
143
+ }
144
+ }
@@ -1,21 +1,22 @@
1
- import { DtoProductConfiguration } from "../CatalogueAPI.js";
2
- import { CfgHistoryManager, CfgHistoryManagerSendData } from "./CfgHistoryManager.js";
3
- import { CfgIOProdConfConnector, CfgProdConfMessage } from "./CfgIOProdConfConnector.js";
4
- export declare function dtoConfToString(conf: DtoProductConfiguration): string;
5
- export declare function stringToDtoConf(conf: string): DtoProductConfiguration;
6
- /**
7
- * Instantiating this will make the browser history (and URL) update with the product configuration.
8
- */
9
- export declare class CfgHistoryToProdConfConnector extends CfgIOProdConfConnector<CfgHistoryManagerSendData<CfgProdConfMessage>> {
10
- private readonly _useHistoryPush;
11
- private readonly _qsKey;
12
- /**
13
- * @param _useHistoryPush As opposed to replace. Push makes the web browser navigation buttons navigate configuration changes. Replace just updates the URL.
14
- * @param _qsKey The Query String key for product configuration.
15
- * @param doValidate When popping from the history stack (navigating in the browser), should a navigate call be sent to the server to verify that the product configuration is still valid?
16
- */
17
- constructor(manager: CfgHistoryManager, _useHistoryPush: boolean, _qsKey?: string, doValidate?: boolean);
18
- protected getInitialProdConf(): DtoProductConfiguration | undefined;
19
- protected makeSendData(conf: DtoProductConfiguration, initial: boolean): CfgHistoryManagerSendData<CfgProdConfMessage>;
20
- }
1
+ import { DtoProductConf } from "../CatalogueAPI.js";
2
+ import { CfgHistoryManager, CfgHistoryManagerSendData, HistoryMode } from "./CfgHistoryManager.js";
3
+ import { CfgIOProdConfConnector, CfgProdConfMessage } from "./CfgIOProdConfConnector.js";
4
+ /**
5
+ * Instantiating this will make the browser history (and URL) update with the product configuration.
6
+ */
7
+ export declare class CfgHistoryToProdConfConnector extends CfgIOProdConfConnector<CfgHistoryManagerSendData<CfgProdConfMessage>> {
8
+ private readonly _mode;
9
+ private readonly _qsKey;
10
+ private static getInitialProdConf;
11
+ static make(manager: CfgHistoryManager, mode: HistoryMode, qsKey?: string): {
12
+ instance: CfgHistoryToProdConfConnector;
13
+ initial: DtoProductConf | undefined;
14
+ };
15
+ /**
16
+ * @param _mode
17
+ * @param _qsKey The Query String key for product configuration.
18
+ */
19
+ private constructor();
20
+ protected makeSendData(conf: DtoProductConf, initial: boolean): CfgHistoryManagerSendData<CfgProdConfMessage>;
21
+ }
21
22
  //# sourceMappingURL=CfgHistoryToProdConfConnector.d.ts.map
@@ -1,56 +1,50 @@
1
- import { CfgHistoryManager } from "./CfgHistoryManager.js";
2
- import { CfgIOProdConfConnector, CfgProdConfMessageVersions, STAGE_PROD_CONF_MESSAGE_KEY, } from "./CfgIOProdConfConnector.js";
3
- const jsonKeyRegex = /"([^"]+)":/g;
4
- const keyMap = [
5
- ["configuration", "cn"],
6
- ["additionalProducts", "as"],
7
- ["prodParams", "pp"],
8
- ["refKey", "rk"],
9
- ["selected", "se"],
10
- ["features", "fs"],
11
- ["code", "cd"],
12
- ["options", "os"],
13
- ["numericValue", "nu"],
14
- ["groupCode", "gc"],
15
- ["unit", "un"],
16
- ];
17
- // todo: Could be worth making faster
18
- const toCompact = (key) => { var _a, _b; return (_b = (_a = keyMap.find((i) => i[0] === key)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : key; };
19
- const toExpanded = (key) => { var _a, _b; return (_b = (_a = keyMap.find((i) => i[1] === key)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : key; };
20
- export function dtoConfToString(conf) {
21
- const stringified = JSON.stringify(conf, undefined, "");
22
- return stringified.replace(jsonKeyRegex, (_, key) => `"${toCompact(key)}":`);
23
- }
24
- export function stringToDtoConf(conf) {
25
- const expandedKeys = conf.replace(jsonKeyRegex, (_, key) => `"${toExpanded(key)}":`);
26
- return JSON.parse(expandedKeys);
27
- }
28
- /**
29
- * Instantiating this will make the browser history (and URL) update with the product configuration.
30
- */
31
- export class CfgHistoryToProdConfConnector extends CfgIOProdConfConnector {
32
- /**
33
- * @param _useHistoryPush As opposed to replace. Push makes the web browser navigation buttons navigate configuration changes. Replace just updates the URL.
34
- * @param _qsKey The Query String key for product configuration.
35
- * @param doValidate When popping from the history stack (navigating in the browser), should a navigate call be sent to the server to verify that the product configuration is still valid?
36
- */
37
- constructor(manager, _useHistoryPush, _qsKey = STAGE_PROD_CONF_MESSAGE_KEY, doValidate = true) {
38
- super(manager, doValidate, false, false);
39
- this._useHistoryPush = _useHistoryPush;
40
- this._qsKey = _qsKey;
41
- }
42
- getInitialProdConf() {
43
- const s = CfgHistoryManager.currentQsKeyValues().get(this._qsKey);
44
- if (s === undefined) {
45
- return undefined;
46
- }
47
- return stringToDtoConf(s);
48
- }
49
- makeSendData(conf, initial) {
50
- return {
51
- message: CfgIOProdConfConnector.makeMessage(conf, initial, CfgProdConfMessageVersions.V2dot0),
52
- qsKeyValues: new Map([[STAGE_PROD_CONF_MESSAGE_KEY, dtoConfToString(conf)]]),
53
- useHistoryPush: this._useHistoryPush,
54
- };
55
- }
56
- }
1
+ import { augmentErrorMessage } from "@configura/web-utilities";
2
+ import { compactStringToDtoProductConf, dtoProductConfigurationToCompactString, } from "../ConfigurationConverter.js";
3
+ import { CfgHistoryManager } from "./CfgHistoryManager.js";
4
+ import { CfgIOProdConfConnector, CfgProdConfMessageVersions, CfgProdConfParts, getHighestVersionProdConfMessage, isCfgProdConfMessageV2, STAGE_PROD_CONF_MESSAGE_KEY, } from "./CfgIOProdConfConnector.js";
5
+ /**
6
+ * Instantiating this will make the browser history (and URL) update with the product configuration.
7
+ */
8
+ export class CfgHistoryToProdConfConnector extends CfgIOProdConfConnector {
9
+ /**
10
+ * @param _mode
11
+ * @param _qsKey The Query String key for product configuration.
12
+ */
13
+ constructor(manager, _mode, _qsKey) {
14
+ super(manager, CfgProdConfParts.SyncGroupState);
15
+ this._mode = _mode;
16
+ this._qsKey = _qsKey;
17
+ }
18
+ static getInitialProdConf(qsKey) {
19
+ // First try to use the state, if that doesn't work use the query string
20
+ const initialMessage = CfgHistoryManager.getMessageFromCurrentHistoryState(STAGE_PROD_CONF_MESSAGE_KEY);
21
+ if (initialMessage !== undefined) {
22
+ const highestVersionMessage = getHighestVersionProdConfMessage(initialMessage.subMessages);
23
+ if (isCfgProdConfMessageV2(highestVersionMessage)) {
24
+ return highestVersionMessage.conf;
25
+ }
26
+ }
27
+ try {
28
+ const s = CfgHistoryManager.currentQsKeyValues().get(qsKey);
29
+ if (s === undefined) {
30
+ return undefined;
31
+ }
32
+ return compactStringToDtoProductConf(s);
33
+ }
34
+ catch (err) {
35
+ throw augmentErrorMessage(err, "Failed read configuration from query string");
36
+ }
37
+ }
38
+ static make(manager, mode, qsKey = STAGE_PROD_CONF_MESSAGE_KEY) {
39
+ const initial = this.getInitialProdConf(qsKey);
40
+ const instance = new CfgHistoryToProdConfConnector(manager, mode, qsKey);
41
+ return { instance, initial };
42
+ }
43
+ makeSendData(conf, initial) {
44
+ return {
45
+ message: CfgIOProdConfConnector.makeMessage(conf, initial, CfgProdConfMessageVersions.V2dot0),
46
+ qsKeyValues: new Map([[this._qsKey, dtoProductConfigurationToCompactString(conf)]]),
47
+ mode: this._mode,
48
+ };
49
+ }
50
+ }
@@ -1,49 +1,54 @@
1
- declare type ConfiguraAttribute = "C0nf1gura";
2
- declare type ConfiguraShebang = "arug1fn0C";
3
- declare const CONFIGURA_ATTRIBUTE: ConfiguraAttribute;
4
- export declare type IOManagerListener = (data: unknown) => Promise<void>;
5
- /**
6
- * The container format used when the environment is globally shared with things
7
- * outside our control. The "shebang" is a magic string that should prevent from a
8
- * CfgIOContainer being confused with something else.
9
- */
10
- export declare type CfgIOContainer = {
11
- [CONFIGURA_ATTRIBUTE]: ConfiguraShebang;
12
- messages: {
13
- [index: string]: unknown;
14
- };
15
- };
16
- /**
17
- * Base class for classes handling input and output in globally shared environments.
18
- */
19
- export declare abstract class CfgIOManager<S> {
20
- /**
21
- * Listen for the message messageKey being received.
22
- */
23
- listenForMessage(l: IOManagerListener, messageKey: string): boolean;
24
- /**
25
- * Removes the listener
26
- */
27
- stopListenForMessage(l: IOManagerListener): boolean;
28
- static isIOContainer: (data: unknown) => data is CfgIOContainer;
29
- static hasIOContainerMessageKey: (container: CfgIOContainer, messageKey: string) => boolean;
30
- static getMessageFromIOContainer: (container: unknown, messageKey: string) => unknown;
31
- static makeContainer: (messages: {
32
- [index: string]: unknown;
33
- }) => CfgIOContainer;
34
- private _receiveInProgress;
35
- private static _inhibitAllReceive;
36
- get receiveInProgress(): boolean;
37
- private _messageListeners;
38
- private _getIndexOfMessageListener;
39
- get hasMessageListeners(): boolean;
40
- protected _containerListener(data: unknown): void;
41
- /**
42
- * Send the data with messageKey. This can for example be pushing or
43
- * replacing on the history stack or sending a message using the
44
- * window.message API.
45
- */
46
- abstract send(messageKey: string, data: S): void;
47
- }
48
- 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 {};
49
54
  //# sourceMappingURL=CfgIOManager.d.ts.map