@configura/web-api 1.6.1-alpha.5 → 1.6.1-alpha.7

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 (75) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +1 -1
  3. package/dist/CatalogueAPI.d.ts +512 -511
  4. package/dist/CatalogueAPI.js +277 -273
  5. package/dist/CfgMeasure.d.ts +32 -32
  6. package/dist/CfgMeasure.js +30 -30
  7. package/dist/CfgProduct.d.ts +239 -253
  8. package/dist/CfgProduct.js +668 -731
  9. package/dist/index.d.ts +18 -20
  10. package/dist/index.js +18 -20
  11. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  12. package/dist/material/CfgMaterialMapping.js +181 -181
  13. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  14. package/dist/material/CfgMtrlApplication.js +43 -43
  15. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  16. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  17. package/dist/material/CfgMtrlSource.d.ts +19 -19
  18. package/dist/material/CfgMtrlSource.js +40 -40
  19. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  20. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  21. package/dist/productConfiguration/CfgFeature.d.ts +178 -179
  22. package/dist/productConfiguration/CfgFeature.js +611 -617
  23. package/dist/productConfiguration/CfgOption.d.ts +128 -150
  24. package/dist/productConfiguration/CfgOption.js +394 -426
  25. package/dist/productConfiguration/CfgProductConfiguration.d.ts +120 -120
  26. package/dist/productConfiguration/CfgProductConfiguration.js +307 -307
  27. package/dist/productConfiguration/filters.d.ts +15 -15
  28. package/dist/productConfiguration/filters.js +70 -70
  29. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  30. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  31. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  32. package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -80
  33. package/dist/productLoader.d.ts +33 -33
  34. package/dist/productLoader.js +49 -49
  35. package/dist/tasks/TaskHandler.d.ts +78 -78
  36. package/dist/tasks/TaskHandler.js +265 -265
  37. package/dist/tasks/formats.d.ts +4 -4
  38. package/dist/tasks/formats.js +7 -7
  39. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  40. package/dist/tests/testData/collectorForTest.js +195 -195
  41. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  42. package/dist/tests/testData/dummyProductForTest.js +36 -36
  43. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +32 -32
  44. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +348 -277
  45. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  46. package/dist/tests/testData/testDataCachedGetProduct.js +196 -185
  47. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  48. package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
  49. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  50. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  51. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  52. package/dist/tests/testData/testDataProductAggregatedPrice.js +198 -187
  53. package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
  54. package/dist/tests/testData/testDataUpcharge.js +151 -119
  55. package/dist/utilitiesCatalogueData.d.ts +25 -31
  56. package/dist/utilitiesCatalogueData.js +66 -168
  57. package/dist/utilitiesCataloguePermission.d.ts +39 -39
  58. package/dist/utilitiesCataloguePermission.js +84 -84
  59. package/dist/utilitiesNumericValues.d.ts +24 -24
  60. package/dist/utilitiesNumericValues.js +109 -109
  61. package/package.json +3 -3
  62. package/dist/syncGroups/SyncGroupsApplier.d.ts +0 -20
  63. package/dist/syncGroups/SyncGroupsApplier.js +0 -514
  64. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +0 -21
  65. package/dist/syncGroups/SyncGroupsApplyMode.js +0 -21
  66. package/dist/syncGroups/SyncGroupsHandler.d.ts +0 -40
  67. package/dist/syncGroups/SyncGroupsHandler.js +0 -352
  68. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +0 -27
  69. package/dist/syncGroups/SyncGroupsPathHelper.js +0 -89
  70. package/dist/syncGroups/SyncGroupsState.d.ts +0 -26
  71. package/dist/syncGroups/SyncGroupsState.js +0 -111
  72. package/dist/syncGroups/SyncGroupsTransaction.d.ts +0 -51
  73. package/dist/syncGroups/SyncGroupsTransaction.js +0 -100
  74. package/dist/tests/testData/testDataOptions.d.ts +0 -13
  75. package/dist/tests/testData/testDataOptions.js +0 -60
@@ -1,100 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { assert } from "@configura/web-utilities";
11
- import { SelectionType } from "../productConfiguration/CfgFeature.js";
12
- import { SyncGroupsApplier } from "./SyncGroupsApplier.js";
13
- import { SyncGroupsPathHelper } from "./SyncGroupsPathHelper.js";
14
- /**
15
- * A transaction is normally limited to one user interaction. Like opening a product or
16
- * selecting an option. This object is used to keep data for one transaction. In particular
17
- * what Features and what SyncGroups have been affected in the transaction. This is a means
18
- * to eliminate the risk of infinite loops.
19
- */
20
- export class SyncGroupsTransaction {
21
- /**
22
- *
23
- * @param syncState A clone of the original syncState. Replaces the original syncState if nothing fails and the transaction doesn't get cancelled
24
- * @param updateMode
25
- * @param productLoader
26
- * @param original The product instance that this transaction will be applied on provided nothing fails and the transaction doesn't get cancelled
27
- * @param target A clone of the original product used to apply the configuration changes to
28
- * @param initial A clone of the original product used to track what the original state was. As a safe measure we do not use originalProduct for this, as it might be changed by someone else
29
- */
30
- constructor(syncState, updateMode, productLoader, original, target, initial) {
31
- this.syncState = syncState;
32
- this.updateMode = updateMode;
33
- this.productLoader = productLoader;
34
- this.original = original;
35
- this.target = target;
36
- this.initial = initial;
37
- this._closed = false;
38
- this.affectedSelectOneFeatures = new Set();
39
- this.affectedSelectManyOptions = new Set();
40
- this.affectedSelectOneSyncGroups = new Set();
41
- this.affectedSelectManySyncGroupsAndOptions = new Map();
42
- }
43
- static make(syncState, updateMode, product, productLoader, assumeNoStartState) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- const t = new this(syncState.clone(), updateMode, productLoader, product, yield product.clone(), assumeNoStartState ? undefined : yield product.clone());
46
- return t;
47
- });
48
- }
49
- get isClosed() {
50
- return this._closed;
51
- }
52
- close() {
53
- this._closed = true;
54
- }
55
- init() {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- return yield SyncGroupsApplier.init(this);
58
- });
59
- }
60
- selectOption(optionPath, on) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- const targetOption = SyncGroupsPathHelper.getOptionFromPath(optionPath, this.target);
63
- return yield SyncGroupsApplier.selectOption(this, targetOption, on);
64
- });
65
- }
66
- addSelectOneFeatureAffected(feature) {
67
- assert(feature.selectionType === SelectionType.SelectOne, "Can only be used for SelectOne Feature");
68
- this.affectedSelectOneFeatures.add(feature);
69
- }
70
- addSelectManyOptionAffected(option) {
71
- assert(option.parent.selectionType === SelectionType.SelectMany, "Can only be used for option in SelectMany Feature");
72
- this.affectedSelectManyOptions.add(option);
73
- }
74
- hasSelectOneFeatureBeenAffected(feature) {
75
- assert(feature.selectionType === SelectionType.SelectOne, "Can only be used for SelectOne Feature");
76
- return this.affectedSelectOneFeatures.has(feature);
77
- }
78
- hasSelectManyOptionBeenAffected(option) {
79
- assert(option.parent.selectionType === SelectionType.SelectMany, "Can only be used for option in SelectMany Feature");
80
- return this.affectedSelectManyOptions.has(option);
81
- }
82
- addSyncGroupAffectedForSelectOne(syncCode) {
83
- this.affectedSelectOneSyncGroups.add(syncCode);
84
- }
85
- addSyncGroupAffectedForSelectMany(syncCode, optionCode) {
86
- let forSyncCode = this.affectedSelectManySyncGroupsAndOptions.get(syncCode);
87
- if (forSyncCode === undefined) {
88
- forSyncCode = new Set();
89
- this.affectedSelectManySyncGroupsAndOptions.set(syncCode, forSyncCode);
90
- }
91
- forSyncCode.add(optionCode);
92
- }
93
- isSyncGroupAffectedForSelectOne(syncCode) {
94
- return this.affectedSelectOneSyncGroups.has(syncCode);
95
- }
96
- isSyncGroupAffectedForSelectMany(syncCode, optionCode) {
97
- var _a;
98
- return ((_a = this.affectedSelectManySyncGroupsAndOptions.get(syncCode)) === null || _a === void 0 ? void 0 : _a.has(optionCode)) === true;
99
- }
100
- }
@@ -1,13 +0,0 @@
1
- import { Option, SelectedOption } from "../../CatalogueAPI.js";
2
- export declare function addDefaultsToMockSelectedOption(root: SelectedOption, optionCodeToAdd: string | undefined, optionCodesToRemove: string[], unlessOptionCodes: string[]): void;
3
- export declare const letterOptionCodeA = "optA";
4
- export declare const letterOptionCodeB = "optB";
5
- export declare const letterOptionCodeC = "optC";
6
- export declare const letterOptionCodeD = "optD";
7
- export declare const letterOptionCodeE = "optE";
8
- export declare const letterOptionCodeF = "optF";
9
- export declare const letterOptions: Option[];
10
- export declare const toggleOptionCodeOff = "optOff";
11
- export declare const toggleOptionCodeOn = "optOn";
12
- export declare const toggleOptions: Option[];
13
- //# sourceMappingURL=testDataOptions.d.ts.map
@@ -1,60 +0,0 @@
1
- export function addDefaultsToMockSelectedOption(root, optionCodeToAdd, optionCodesToRemove, unlessOptionCodes) {
2
- let next = root.next;
3
- if (next === undefined) {
4
- if (optionCodeToAdd === undefined) {
5
- return;
6
- }
7
- next = {};
8
- root.next = next;
9
- }
10
- for (const oCode of unlessOptionCodes) {
11
- if (next[oCode] !== undefined) {
12
- return;
13
- }
14
- }
15
- for (const oCode of optionCodesToRemove) {
16
- delete next[oCode];
17
- }
18
- if (optionCodeToAdd === undefined) {
19
- return;
20
- }
21
- next[optionCodeToAdd] = { code: optionCodeToAdd };
22
- }
23
- export const letterOptionCodeA = "optA";
24
- export const letterOptionCodeB = "optB";
25
- export const letterOptionCodeC = "optC";
26
- export const letterOptionCodeD = "optD";
27
- export const letterOptionCodeE = "optE";
28
- export const letterOptionCodeF = "optF";
29
- export const letterOptions = [
30
- {
31
- code: letterOptionCodeA,
32
- description: "",
33
- },
34
- {
35
- code: letterOptionCodeB,
36
- description: "",
37
- },
38
- {
39
- code: letterOptionCodeC,
40
- description: "",
41
- },
42
- {
43
- code: letterOptionCodeD,
44
- description: "",
45
- },
46
- {
47
- code: letterOptionCodeE,
48
- description: "",
49
- },
50
- {
51
- code: letterOptionCodeF,
52
- description: "",
53
- },
54
- ];
55
- export const toggleOptionCodeOff = "optOff";
56
- export const toggleOptionCodeOn = "optOn";
57
- export const toggleOptions = [
58
- { code: toggleOptionCodeOff, description: "" },
59
- { code: toggleOptionCodeOn, description: "" },
60
- ];