@configura/web-api 2.0.0-alpha.11 → 2.0.0-alpha.14

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.
@@ -136,8 +136,8 @@ export declare class _CfgProductInternal {
136
136
  _additionalProductHasChanged: (freshRef: CfgProduct, bubbleMode: CfgProductBubbleMode, committed: boolean) => Promise<void>;
137
137
  /** Called by the configuration to tell its parent that it has changed. */
138
138
  _configurationHasChanged: (freshRef: CfgProductConfiguration, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
139
- getDtoConf: (includeExtendedData: boolean, includeProductParams: boolean) => DtoProductConfiguration;
140
- setDtoConf: (s: DtoProductConfiguration, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
139
+ getDtoConfiguration: (includeExtendedData: boolean, includeProductParams: boolean) => DtoProductConfiguration;
140
+ setDtoConfiguration: (s: DtoProductConfiguration, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
141
141
  setApiSelection: (s: DtoAdditionalProductConfiguration, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
142
142
  copyFrom: (source: _CfgProductInternal, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
143
143
  private _setApiSelectionWithOtherProduct;
@@ -256,8 +256,8 @@ export declare class CfgProduct {
256
256
  * selections on a product is needed, such as when doing Render or Export.
257
257
  */
258
258
  getApiSelection: () => DtoAdditionalProductConfiguration;
259
- getDtoConf: (includeExtendedData?: boolean, includeProductParams?: boolean) => DtoProductConfiguration;
260
- setDtoConf: (s: DtoProductConfiguration, doValidate?: boolean) => Promise<boolean>;
259
+ getDtoConfiguration: (includeExtendedData?: boolean, includeProductParams?: boolean) => DtoProductConfiguration;
260
+ setDtoConfiguration: (s: DtoProductConfiguration, doValidate?: boolean) => Promise<boolean>;
261
261
  setApiSelection: (s: DtoAdditionalProductConfiguration, doValidate?: boolean) => Promise<boolean>;
262
262
  listenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
263
263
  stopListenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { AggregatedLoadingObservable, assert, assertDefined, augmentErrorMessage, compareArrays, count, Observable, toLengthUnit, } from "@configura/web-utilities";
11
11
  import { CfgMeasureDefinition } from "./CfgMeasure.js";
12
- import { convertDtoConfProdToV1 } from "./ConfigurationConverter.js";
12
+ import { convertDtoProductConfigurationToV1 } from "./ConfigurationConverter.js";
13
13
  import { ProductConfigurationBubbleMode } from "./productConfiguration/CfgOption.js";
14
14
  import { CfgProductConfiguration } from "./productConfiguration/CfgProductConfiguration.js";
15
15
  import { collectAdditionalProductRefs } from "./productConfiguration/utilitiesProductConfiguration.js";
@@ -140,9 +140,9 @@ export class _CfgProductInternal {
140
140
  return;
141
141
  }
142
142
  });
143
- this.getDtoConf = (includeExtendedData, includeProductParams) => {
143
+ this.getDtoConfiguration = (includeExtendedData, includeProductParams) => {
144
144
  const conf = {};
145
- const features = this.configuration._internal.getDtoConf(includeExtendedData);
145
+ const features = this.configuration._internal.getDtoConfiguration(includeExtendedData);
146
146
  if (0 < features.length) {
147
147
  conf.features = features;
148
148
  }
@@ -151,7 +151,7 @@ export class _CfgProductInternal {
151
151
  }
152
152
  const additionalProducts = this.additionalProducts;
153
153
  if (0 < additionalProducts.length) {
154
- conf.additionalProducts = additionalProducts.map((p) => p._internal.getDtoConf(includeExtendedData, includeProductParams));
154
+ conf.additionalProducts = additionalProducts.map((p) => p._internal.getDtoConfiguration(includeExtendedData, includeProductParams));
155
155
  }
156
156
  if (this.isAdditionalProduct) {
157
157
  const refKey = this.refKey;
@@ -164,14 +164,14 @@ export class _CfgProductInternal {
164
164
  }
165
165
  return conf;
166
166
  };
167
- this.setDtoConf = (s, doValidate, productLoaderForGroupedLoad) => __awaiter(this, void 0, void 0, function* () {
168
- return yield this.setApiSelection(convertDtoConfProdToV1(s), doValidate, productLoaderForGroupedLoad);
167
+ this.setDtoConfiguration = (s, doValidate, productLoaderForGroupedLoad) => __awaiter(this, void 0, void 0, function* () {
168
+ return yield this.setApiSelection(convertDtoProductConfigurationToV1(s), doValidate, productLoaderForGroupedLoad);
169
169
  });
170
170
  this.setApiSelection = (s, doValidate, productLoaderForGroupedLoad) => __awaiter(this, void 0, void 0, function* () {
171
171
  return yield this._setApiSelectionWithOtherProduct(s, doValidate, productLoaderForGroupedLoad, undefined);
172
172
  });
173
173
  this.copyFrom = (source, doValidate, productLoaderForGroupedLoad) => __awaiter(this, void 0, void 0, function* () {
174
- return yield this._setApiSelectionWithOtherProduct(convertDtoConfProdToV1(source.getDtoConf(false, false)), doValidate, productLoaderForGroupedLoad, source);
174
+ return yield this._setApiSelectionWithOtherProduct(convertDtoProductConfigurationToV1(source.getDtoConfiguration(false, false)), doValidate, productLoaderForGroupedLoad, source);
175
175
  });
176
176
  this._setApiSelectionWithOtherProduct = (s, doValidate, productLoaderForGroupedLoad, sourceProduct) => __awaiter(this, void 0, void 0, function* () {
177
177
  // Wrap with cache will make getProduct for this function call use the same server call
@@ -651,10 +651,10 @@ export class CfgProduct {
651
651
  * configuration, optional products and additional products. Used when a full view of all
652
652
  * selections on a product is needed, such as when doing Render or Export.
653
653
  */
654
- this.getApiSelection = () => convertDtoConfProdToV1(this._internal.getDtoConf(false, false), true);
655
- this.getDtoConf = (includeExtendedData = false, includeProductParams = false) => this._internal.getDtoConf(includeExtendedData, includeProductParams);
656
- this.setDtoConf = (s, doValidate = false) => __awaiter(this, void 0, void 0, function* () { return yield this._internal.setDtoConf(s, doValidate); });
657
- this.setApiSelection = (s, doValidate = false) => __awaiter(this, void 0, void 0, function* () { return yield this._internal.setApiSelection(s, doValidate); });
654
+ this.getApiSelection = () => convertDtoProductConfigurationToV1(this._internal.getDtoConfiguration(false, false), true);
655
+ this.getDtoConfiguration = (includeExtendedData = false, includeProductParams = false) => this._internal.getDtoConfiguration(includeExtendedData, includeProductParams);
656
+ this.setDtoConfiguration = (s, doValidate = true) => __awaiter(this, void 0, void 0, function* () { return yield this._internal.setDtoConfiguration(s, doValidate); });
657
+ this.setApiSelection = (s, doValidate = true) => __awaiter(this, void 0, void 0, function* () { return yield this._internal.setApiSelection(s, doValidate); });
658
658
  this.listenForChange = (l) => this._internal.changeObservable.listen(l);
659
659
  this.stopListenForChange = (l) => this._internal.changeObservable.stopListen(l);
660
660
  this.stopAllListenForChange = () => this._internal.changeObservable.stopAllListen();
@@ -1,5 +1,14 @@
1
1
  import { DtoAdditionalProductConfiguration, DtoAdditionalProductConfigurationV2, DtoFeatureConfiguration, DtoProductConfiguration, DtoSelectedOption } from "./CatalogueAPI.js";
2
- export declare const isDtoConfProdAdditional: (value: DtoProductConfiguration) => value is DtoAdditionalProductConfigurationV2;
3
- export declare const convertDtoConfProdToV1: (conf: DtoProductConfiguration, silenceWarnings?: boolean) => DtoAdditionalProductConfiguration;
4
- export declare const convertDtoConfFeaturesToSelOptions: (features: DtoFeatureConfiguration[], silenceWarnings?: boolean) => DtoSelectedOption[];
2
+ export declare const isDtoProductConfigurationAdditional: (value: DtoProductConfiguration) => value is DtoAdditionalProductConfigurationV2;
3
+ export declare const convertDtoProductConfigurationToV1: (conf: DtoProductConfiguration, silenceWarnings?: boolean) => DtoAdditionalProductConfiguration;
4
+ export declare const convertDtoFeatureConfigurationsToSelOptions: (features: DtoFeatureConfiguration[], silenceWarnings?: boolean) => DtoSelectedOption[];
5
+ /**
6
+ * Serializes and compacts the configuration into a format especially suited for URLs
7
+ */
8
+ export declare const dtoProductConfigurationToCompactString: (conf: DtoProductConfiguration) => string;
9
+ /**
10
+ * Deserializes and inflates the configuration from the compacted format
11
+ */
12
+ export declare const compactStringToDtoProductConfiguration: (versionAndConf: string) => DtoProductConfiguration;
13
+ export declare const stripExtendedDataFromDtoProductConfiguration: (conf: DtoProductConfiguration) => DtoProductConfiguration;
5
14
  //# sourceMappingURL=ConfigurationConverter.d.ts.map
@@ -1,9 +1,9 @@
1
- export const isDtoConfProdAdditional = (value) => "refKey" in value;
1
+ export const isDtoProductConfigurationAdditional = (value) => "refKey" in value;
2
2
  // As this has potential to flood the terminal we only inform once
3
3
  let hasInformedAboutProdParams = false;
4
4
  let hasInformedAboutGroupCode = false;
5
5
  let hasInformedAboutUnit = false;
6
- export const convertDtoConfProdToV1 = (conf, silenceWarnings = false) => {
6
+ export const convertDtoProductConfigurationToV1 = (conf, silenceWarnings = false) => {
7
7
  var _a, _b;
8
8
  if (!silenceWarnings && conf.prodParams !== undefined && !hasInformedAboutProdParams) {
9
9
  hasInformedAboutProdParams = true;
@@ -12,22 +12,22 @@ export const convertDtoConfProdToV1 = (conf, silenceWarnings = false) => {
12
12
  const result = {
13
13
  selOptions: ((_a = conf.features) !== null && _a !== void 0 ? _a : []).map((f) => ({
14
14
  code: "!~!",
15
- next: convertDtoConfFeatureToApiSelection(f, silenceWarnings),
15
+ next: convertDtoFeatureConfigurationToApiSelection(f, silenceWarnings),
16
16
  })),
17
- additionalProducts: ((_b = conf.additionalProducts) !== null && _b !== void 0 ? _b : []).map((p) => convertDtoConfProdToV1(p, silenceWarnings)),
17
+ additionalProducts: ((_b = conf.additionalProducts) !== null && _b !== void 0 ? _b : []).map((p) => convertDtoProductConfigurationToV1(p, silenceWarnings)),
18
18
  selected: true,
19
19
  };
20
- if (isDtoConfProdAdditional(conf)) {
20
+ if (isDtoProductConfigurationAdditional(conf)) {
21
21
  result.refKey = conf.refKey;
22
22
  result.selected = conf.selected;
23
23
  }
24
24
  return result;
25
25
  };
26
- export const convertDtoConfFeaturesToSelOptions = (features, silenceWarnings = false) => (features !== null && features !== void 0 ? features : []).map((f) => ({
26
+ export const convertDtoFeatureConfigurationsToSelOptions = (features, silenceWarnings = false) => (features !== null && features !== void 0 ? features : []).map((f) => ({
27
27
  code: "!~!",
28
- next: convertDtoConfFeatureToApiSelection(f, silenceWarnings),
28
+ next: convertDtoFeatureConfigurationToApiSelection(f, silenceWarnings),
29
29
  }));
30
- const convertDtoConfFeatureToApiSelection = (feature, silenceWarnings) => {
30
+ const convertDtoFeatureConfigurationToApiSelection = (feature, silenceWarnings) => {
31
31
  const { groupCode, options, unit } = feature;
32
32
  if (!silenceWarnings && groupCode !== undefined && !hasInformedAboutGroupCode) {
33
33
  hasInformedAboutGroupCode = true;
@@ -39,13 +39,13 @@ const convertDtoConfFeatureToApiSelection = (feature, silenceWarnings) => {
39
39
  }
40
40
  const result = {};
41
41
  for (const option of (options !== null && options !== void 0 ? options : []).filter((o) => o.selected)) {
42
- result[option.code] = convertDtoConfOptionToSelectedOption(option, silenceWarnings);
42
+ result[option.code] = convertDtoOptionConfigurationToSelectedOption(option, silenceWarnings);
43
43
  }
44
44
  return result;
45
45
  };
46
- const convertDtoConfOptionToSelectedOption = (option, silenceWarnings) => {
46
+ const convertDtoOptionConfigurationToSelectedOption = (option, silenceWarnings) => {
47
47
  const { features, code, numericValue } = option;
48
- const selectionTrees = (features !== null && features !== void 0 ? features : []).map((f) => convertDtoConfFeatureToApiSelection(f, silenceWarnings));
48
+ const selectionTrees = (features !== null && features !== void 0 ? features : []).map((f) => convertDtoFeatureConfigurationToApiSelection(f, silenceWarnings));
49
49
  const mergedSelectionTree = {};
50
50
  let anyItems = false;
51
51
  for (const selectionTree of selectionTrees) {
@@ -70,3 +70,97 @@ const convertDtoConfOptionToSelectedOption = (option, silenceWarnings) => {
70
70
  }
71
71
  return selectedOption;
72
72
  };
73
+ const versionedRegex = /^v(\d+)(.+)$/;
74
+ const jsonKeyRegex = /"([^"]+)":/g;
75
+ const swapForUrlAdaptedRegex = /[-~_{}"]/g;
76
+ const shortToLong = new Map();
77
+ const longToShort = new Map();
78
+ // The replacement scheme here assumes this will only be used for keys
79
+ // in DtoProductConfiguration and the knowledge that it contains no one
80
+ // one char keys.
81
+ for (const [long, short] of [
82
+ ["configuration", "c"],
83
+ ["additionalProducts", "a"],
84
+ ["prodParams", "p"],
85
+ ["refKey", "r"],
86
+ ["selected", "s"],
87
+ ["features", "f"],
88
+ ["code", "d"],
89
+ ["options", "o"],
90
+ ["numericValue", "n"],
91
+ ["groupCode", "g"],
92
+ ["unit", "u"],
93
+ ]) {
94
+ shortToLong.set(short, long);
95
+ longToShort.set(long, short);
96
+ }
97
+ /**
98
+ * As certain chars are abundant in JSON but less abundant in the actual data
99
+ * we swap these so that frequent characters do not need to be URL-encoded.
100
+ */
101
+ const jsonStringSwapCharsForUrl = (data) => data.replace(swapForUrlAdaptedRegex, (char) => {
102
+ switch (char) {
103
+ case "{":
104
+ return "~";
105
+ case "}":
106
+ return "-";
107
+ case '"':
108
+ return "_";
109
+ case "~":
110
+ return "{";
111
+ case "-":
112
+ return "}";
113
+ case "_":
114
+ return '"';
115
+ default:
116
+ throw new Error(`Unexpected char "${char}" in swap for URL`);
117
+ }
118
+ });
119
+ const compactDtoProductConfigurationJsonKeys = (data) => data.replace(jsonKeyRegex, (_, key) => { var _a; return `"${(_a = longToShort.get(key)) !== null && _a !== void 0 ? _a : key}":`; });
120
+ const expandDtoProductConfigurationJsonKeys = (data) => data.replace(jsonKeyRegex, (_, key) => { var _a; return `"${(_a = shortToLong.get(key)) !== null && _a !== void 0 ? _a : key}":`; });
121
+ /**
122
+ * Serializes and compacts the configuration into a format especially suited for URLs
123
+ */
124
+ export const dtoProductConfigurationToCompactString = (conf) => "v1" +
125
+ jsonStringSwapCharsForUrl(compactDtoProductConfigurationJsonKeys(JSON.stringify(conf, undefined, "")));
126
+ /**
127
+ * Deserializes and inflates the configuration from the compacted format
128
+ */
129
+ export const compactStringToDtoProductConfiguration = (versionAndConf) => {
130
+ const match = versionedRegex.exec(versionAndConf);
131
+ if (match === null) {
132
+ throw new Error("Could not match version string");
133
+ }
134
+ const [, version, conf] = match;
135
+ if (version !== "1") {
136
+ throw new Error("Unknown packed URL version");
137
+ }
138
+ if (conf === "") {
139
+ throw new Error("No conf found");
140
+ }
141
+ return JSON.parse(expandDtoProductConfigurationJsonKeys(jsonStringSwapCharsForUrl(conf)));
142
+ };
143
+ export const stripExtendedDataFromDtoProductConfiguration = (conf) => {
144
+ var _a, _b;
145
+ return ({
146
+ features: (_a = conf.features) === null || _a === void 0 ? void 0 : _a.map(stripExtendedDataFromDtoFeatureConfiguration),
147
+ additionalProducts: (_b = conf.additionalProducts) === null || _b === void 0 ? void 0 : _b.map(stripExtendedDataFromDtoAdditionalProductConfiguration),
148
+ });
149
+ };
150
+ const stripExtendedDataFromDtoAdditionalProductConfiguration = (conf) => (Object.assign(Object.assign({}, stripExtendedDataFromDtoProductConfiguration(conf)), { refKey: conf.refKey, selected: conf.selected }));
151
+ const stripExtendedDataFromDtoFeatureConfiguration = (conf) => {
152
+ var _a;
153
+ return ({
154
+ code: conf.code,
155
+ options: (_a = conf.options) === null || _a === void 0 ? void 0 : _a.map(stripExtendedDataFromDtoOptionConfiguration),
156
+ });
157
+ };
158
+ const stripExtendedDataFromDtoOptionConfiguration = (conf) => {
159
+ var _a;
160
+ return ({
161
+ code: conf.code,
162
+ selected: conf.selected,
163
+ numericValue: conf.numericValue,
164
+ features: (_a = conf.features) === null || _a === void 0 ? void 0 : _a.map(stripExtendedDataFromDtoFeatureConfiguration),
165
+ });
166
+ };
@@ -1,8 +1,6 @@
1
1
  import { DtoProductConfiguration } from "../CatalogueAPI.js";
2
2
  import { CfgHistoryManager, CfgHistoryManagerSendData } from "./CfgHistoryManager.js";
3
3
  import { CfgIOProdConfConnector, CfgProdConfMessage } from "./CfgIOProdConfConnector.js";
4
- export declare const dtoConfToCompactString: (conf: DtoProductConfiguration) => string;
5
- export declare const compactStringToDtoConf: (versionAndConf: string) => DtoProductConfiguration;
6
4
  /**
7
5
  * Instantiating this will make the browser history (and URL) update with the product configuration.
8
6
  */
@@ -1,75 +1,6 @@
1
+ import { compactStringToDtoProductConfiguration, dtoProductConfigurationToCompactString, } from "../ConfigurationConverter.js";
1
2
  import { CfgHistoryManager } from "./CfgHistoryManager.js";
2
3
  import { CfgIOProdConfConnector, CfgProdConfMessageVersions, STAGE_PROD_CONF_MESSAGE_KEY, } from "./CfgIOProdConfConnector.js";
3
- const versionedRegex = /^v(\d+)(.+)$/;
4
- const jsonKeyRegex = /"([^"]+)":/g;
5
- const swapIntoUrlAdaptedRegex = /[{}"]/g;
6
- const swapFromUrlAdaptedRegex = /[-~_]/g;
7
- const shortToLong = new Map();
8
- const longToShort = new Map();
9
- // The replacement scheme here assumes this will only be used for keys
10
- // in DtoProductConfiguration and the knowledge that it contains no one
11
- // one char keys.
12
- for (const [long, short] of [
13
- ["configuration", "c"],
14
- ["additionalProducts", "a"],
15
- ["prodParams", "p"],
16
- ["refKey", "r"],
17
- ["selected", "s"],
18
- ["features", "f"],
19
- ["code", "d"],
20
- ["options", "o"],
21
- ["numericValue", "n"],
22
- ["groupCode", "g"],
23
- ["unit", "u"],
24
- ]) {
25
- shortToLong.set(short, long);
26
- longToShort.set(long, short);
27
- }
28
- /**
29
- * As certain chars are abundant in JSON but less abundant in the actual data
30
- * we swap these so that frequent characters do not need to be URL-encoded.
31
- */
32
- const jsonStringSwapCharsForUrl = (data) => data.replace(swapIntoUrlAdaptedRegex, (char) => {
33
- switch (char) {
34
- case "{":
35
- return "~";
36
- case "}":
37
- return "-";
38
- case '"':
39
- return "_";
40
- default:
41
- throw new Error(`Unexpected char "${char}" in swap for URL`);
42
- }
43
- });
44
- const jsonStringSwapCharsFromUrl = (data) => data.replace(swapFromUrlAdaptedRegex, (char) => {
45
- switch (char) {
46
- case "~":
47
- return "{";
48
- case "-":
49
- return "}";
50
- case "_":
51
- return '"';
52
- default:
53
- throw new Error(`Unexpected char "${char}" in swap from URL`);
54
- }
55
- });
56
- const compactDtoConfJsonKeys = (data) => data.replace(jsonKeyRegex, (_, key) => { var _a; return `"${(_a = longToShort.get(key)) !== null && _a !== void 0 ? _a : key}":`; });
57
- const expandDtoConfJsonKeys = (data) => data.replace(jsonKeyRegex, (_, key) => { var _a; return `"${(_a = shortToLong.get(key)) !== null && _a !== void 0 ? _a : key}":`; });
58
- export const dtoConfToCompactString = (conf) => "v1" + jsonStringSwapCharsForUrl(compactDtoConfJsonKeys(JSON.stringify(conf, undefined, "")));
59
- export const compactStringToDtoConf = (versionAndConf) => {
60
- const match = versionedRegex.exec(versionAndConf);
61
- if (match === null) {
62
- throw new Error("Could not match version string");
63
- }
64
- const [, version, conf] = match;
65
- if (version !== "1") {
66
- throw new Error("Unknown packed URL version");
67
- }
68
- if (conf === "") {
69
- throw new Error("No conf found");
70
- }
71
- return JSON.parse(expandDtoConfJsonKeys(jsonStringSwapCharsFromUrl(conf)));
72
- };
73
4
  /**
74
5
  * Instantiating this will make the browser history (and URL) update with the product configuration.
75
6
  */
@@ -89,12 +20,14 @@ export class CfgHistoryToProdConfConnector extends CfgIOProdConfConnector {
89
20
  if (s === undefined) {
90
21
  return undefined;
91
22
  }
92
- return compactStringToDtoConf(s);
23
+ return compactStringToDtoProductConfiguration(s);
93
24
  }
94
25
  makeSendData(conf, initial) {
95
26
  return {
96
27
  message: CfgIOProdConfConnector.makeMessage(conf, initial, CfgProdConfMessageVersions.V2dot0),
97
- qsKeyValues: new Map([[STAGE_PROD_CONF_MESSAGE_KEY, dtoConfToCompactString(conf)]]),
28
+ qsKeyValues: new Map([
29
+ [STAGE_PROD_CONF_MESSAGE_KEY, dtoProductConfigurationToCompactString(conf)],
30
+ ]),
98
31
  useHistoryPush: this._useHistoryPush,
99
32
  };
100
33
  }
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { convertDtoConfProdToV1 } from "../ConfigurationConverter.js";
10
+ import { convertDtoProductConfigurationToV1 } from "../ConfigurationConverter.js";
11
11
  export const isCfgProdConfMessage = (data) => typeof data === "object" && data !== null && "version" in data && "conf" in data;
12
12
  export const isCfgProdConfMessageV1 = (data) => isCfgProdConfMessage(data) && data.version === "1.0";
13
13
  export const isCfgProdConfMessageV2 = (data) => isCfgProdConfMessage(data) && data.version === "2.0";
@@ -60,10 +60,10 @@ export class CfgIOProdConfConnector {
60
60
  if (currentProduct === undefined) {
61
61
  const initialProdConf = this.getInitialProdConf();
62
62
  if (initialProdConf !== undefined) {
63
- yield newProduct.setDtoConf(initialProdConf, this._doValidate);
63
+ yield newProduct.setDtoConfiguration(initialProdConf, this._doValidate);
64
64
  }
65
65
  }
66
- this._send(this.makeSendData(newProduct.getDtoConf(this._includeExtendedDataInSend, this._includeProdParamsInSend), true));
66
+ this._send(this.makeSendData(newProduct.getDtoConfiguration(this._includeExtendedDataInSend, this._includeProdParamsInSend), true));
67
67
  this._stopListenToMessage = CfgIOProdConfConnector.listenForMessage((messages) => __awaiter(this, void 0, void 0, function* () {
68
68
  const subMessages = messages.subMessages;
69
69
  if (subMessages.length === 0) {
@@ -76,7 +76,7 @@ export class CfgIOProdConfConnector {
76
76
  return;
77
77
  }
78
78
  if (isCfgProdConfMessageV2(highestVersionMessage)) {
79
- yield newProduct.setDtoConf(highestVersionMessage.conf, this._doValidate);
79
+ yield newProduct.setDtoConfiguration(highestVersionMessage.conf, this._doValidate);
80
80
  return;
81
81
  }
82
82
  throw new Error("Unknown message version");
@@ -94,7 +94,7 @@ export class CfgIOProdConfConnector {
94
94
  CfgProdConfMessageVersions.V1dot0) {
95
95
  const v1 = {
96
96
  version: "1.0",
97
- conf: convertDtoConfProdToV1(conf, true),
97
+ conf: convertDtoProductConfigurationToV1(conf, true),
98
98
  };
99
99
  result.push(v1);
100
100
  }
@@ -130,7 +130,7 @@ export class CfgIOProdConfConnector {
130
130
  if (!n.committed) {
131
131
  return;
132
132
  }
133
- callback(n.freshRef.getDtoConf(includeExtendedDataInSend, includeProdParamsInSend));
133
+ callback(n.freshRef.getDtoConfiguration(includeExtendedDataInSend, includeProdParamsInSend));
134
134
  };
135
135
  }
136
136
  static listenForProdConf(product, callback, includeExtendedDataInSend, includeProdParamsInSend) {
@@ -99,7 +99,7 @@ export declare class _CfgFeatureInternal {
99
99
  * as nonexisting children can not call their parent.
100
100
  */
101
101
  _childHasChanged: (childOption: _CfgOptionInternal, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
102
- getDtoConf: (includeExtendedData: boolean) => DtoFeatureConfiguration;
102
+ getDtoConfiguration: (includeExtendedData: boolean) => DtoFeatureConfiguration;
103
103
  setApiSelection: (apiOptionSelectionMap: {
104
104
  [index: string]: DtoSelectedOption;
105
105
  } | undefined) => Promise<boolean>;
@@ -114,7 +114,7 @@ export class _CfgFeatureInternal {
114
114
  }
115
115
  yield this._notifyAllOfChange(bubbleMode, committed);
116
116
  });
117
- this.getDtoConf = (includeExtendedData) => {
117
+ this.getDtoConfiguration = (includeExtendedData) => {
118
118
  const result = {
119
119
  code: this.code,
120
120
  };
@@ -124,7 +124,7 @@ export class _CfgFeatureInternal {
124
124
  }
125
125
  const selectedOptions = this._selectedOptions;
126
126
  if (0 < selectedOptions.length) {
127
- result.options = selectedOptions.map((o) => o._internal.getDtoConf(includeExtendedData));
127
+ result.options = selectedOptions.map((o) => o._internal.getDtoConfiguration(includeExtendedData));
128
128
  }
129
129
  return result;
130
130
  };
@@ -89,7 +89,7 @@ export declare class _CfgOptionInternal {
89
89
  get features(): CfgFeature[];
90
90
  /** Called by child to tell its parent that it has changed. */
91
91
  _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
92
- getDtoConf: (includeExtendedData: boolean) => DtoOptionConfiguration;
92
+ getDtoConfiguration: (includeExtendedData: boolean) => DtoOptionConfiguration;
93
93
  setApiSelection: (apiOptionSelection: DtoSelectedOption | undefined) => Promise<boolean>;
94
94
  structureCompare: (other: _CfgOptionInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
95
95
  tryMatchSelection: (other: CfgOption, descriptionMatch?: boolean) => Promise<boolean>;
@@ -110,7 +110,7 @@ export class _CfgOptionInternal {
110
110
  yield this.parent._childHasChanged(this, bubbleMode, committed);
111
111
  }
112
112
  });
113
- this.getDtoConf = (includeExtendedData) => {
113
+ this.getDtoConfiguration = (includeExtendedData) => {
114
114
  const { features, isUseNumericValue, code, selected, numericValue } = this;
115
115
  if (!selected) {
116
116
  throw new Error("Currently only useable on selected options. Selected in the result is for future use.");
@@ -128,7 +128,7 @@ export class _CfgOptionInternal {
128
128
  }
129
129
  }
130
130
  if (0 < features.length) {
131
- result.features = features.map((f) => f._internal.getDtoConf(includeExtendedData));
131
+ result.features = features.map((f) => f._internal.getDtoConfiguration(includeExtendedData));
132
132
  }
133
133
  return result;
134
134
  };
@@ -34,7 +34,7 @@ export declare class _CfgProductConfigurationInternal {
34
34
  _freshRefDescendants(): void;
35
35
  /** Called by child to tell its parent that it has changed. */
36
36
  _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
37
- getDtoConf: (includeExtendedData: boolean) => DtoFeatureConfiguration[];
37
+ getDtoConfiguration: (includeExtendedData: boolean) => DtoFeatureConfiguration[];
38
38
  /**
39
39
  * When used internally the notifications are taken care off by the caller, but if set from
40
40
  * outside we want notifications to bubble all the way to the root.
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { compareArrays, count, isEqualLength, isLengthUnit, Observable, toError, toLengthUnit, } from "@configura/web-utilities";
11
11
  import { CfgProduct } from "../CfgProduct.js";
12
- import { convertDtoConfFeaturesToSelOptions } from "../ConfigurationConverter.js";
12
+ import { convertDtoFeatureConfigurationsToSelOptions } from "../ConfigurationConverter.js";
13
13
  import { CfgFeature } from "./CfgFeature.js";
14
14
  import { ProductConfigurationBubbleMode } from "./CfgOption.js";
15
15
  import { syncCfgFeatures } from "./utilitiesProductConfiguration.js";
@@ -55,7 +55,7 @@ export class _CfgProductConfigurationInternal {
55
55
  features[i] = freshRef;
56
56
  yield this._notifyAllOfChange(bubbleMode, committed);
57
57
  });
58
- this.getDtoConf = (includeExtendedData) => this._features.map((f) => f._internal.getDtoConf(includeExtendedData));
58
+ this.getDtoConfiguration = (includeExtendedData) => this._features.map((f) => f._internal.getDtoConfiguration(includeExtendedData));
59
59
  /**
60
60
  * When used internally the notifications are taken care off by the caller, but if set from
61
61
  * outside we want notifications to bubble all the way to the root.
@@ -233,7 +233,7 @@ export class CfgProductConfiguration {
233
233
  */
234
234
  this.tryMatchSelection = (other, descriptionMatch = false // Match on case insensitive description, not code
235
235
  ) => __awaiter(this, void 0, void 0, function* () { return yield this._internal.tryMatchSelection(other._internal, descriptionMatch, true); });
236
- this.getApiSelection = () => convertDtoConfFeaturesToSelOptions(this._internal.getDtoConf(false), true);
236
+ this.getApiSelection = () => convertDtoFeatureConfigurationsToSelOptions(this._internal.getDtoConfiguration(false), true);
237
237
  /**
238
238
  * This method does not propagate its selections.
239
239
  * This method will not cause validation calls. Data is assumed to already be validated.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/web-api",
3
- "version": "2.0.0-alpha.11",
3
+ "version": "2.0.0-alpha.14",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@configura/web-utilities": "2.0.0-alpha.11"
26
+ "@configura/web-utilities": "2.0.0-alpha.14"
27
27
  },
28
- "gitHead": "a57e59802cbbcb61f2a49b64dcefeb7123679478"
28
+ "gitHead": "b3d0439069dc8cca134143d00fcd2f964525ceca"
29
29
  }