@configura/web-api 2.2.0-alpha.1 → 2.2.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/.eslintrc.json +5 -5
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +633 -633
  5. package/dist/CatalogueAPI.js +312 -312
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +359 -344
  9. package/dist/CfgProduct.js +1005 -992
  10. package/dist/CfgReferencePathHelper.d.ts +26 -26
  11. package/dist/CfgReferencePathHelper.js +26 -26
  12. package/dist/index.d.ts +24 -24
  13. package/dist/index.js +24 -24
  14. package/dist/io/CfgHistoryManager.d.ts +83 -83
  15. package/dist/io/CfgHistoryManager.js +144 -144
  16. package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -21
  17. package/dist/io/CfgHistoryToProdConfConnector.js +50 -50
  18. package/dist/io/CfgIOManager.d.ts +53 -53
  19. package/dist/io/CfgIOManager.js +134 -134
  20. package/dist/io/CfgIOProdConfConnector.d.ts +54 -54
  21. package/dist/io/CfgIOProdConfConnector.js +139 -139
  22. package/dist/io/CfgIOWarningSupplier.d.ts +3 -3
  23. package/dist/io/CfgIOWarningSupplier.js +1 -1
  24. package/dist/io/CfgObservableStateManager.d.ts +25 -25
  25. package/dist/io/CfgObservableStateManager.js +69 -69
  26. package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -15
  27. package/dist/io/CfgObservableStateToProdConfConnector.js +17 -17
  28. package/dist/io/CfgWindowEventManager.d.ts +21 -21
  29. package/dist/io/CfgWindowEventManager.js +38 -38
  30. package/dist/io/CfgWindowMessageManager.d.ts +40 -40
  31. package/dist/io/CfgWindowMessageManager.js +91 -91
  32. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -17
  33. package/dist/io/CfgWindowMessageToProdConfConnector.js +19 -19
  34. package/dist/io/index.d.ts +8 -8
  35. package/dist/io/index.js +8 -8
  36. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  37. package/dist/material/CfgMaterialMapping.js +181 -181
  38. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  39. package/dist/material/CfgMtrlApplication.js +43 -43
  40. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  41. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  42. package/dist/material/CfgMtrlSource.d.ts +19 -19
  43. package/dist/material/CfgMtrlSource.js +40 -40
  44. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  45. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  46. package/dist/productConfiguration/CfgFeature.d.ts +199 -199
  47. package/dist/productConfiguration/CfgFeature.js +691 -691
  48. package/dist/productConfiguration/CfgOption.d.ts +160 -160
  49. package/dist/productConfiguration/CfgOption.js +464 -464
  50. package/dist/productConfiguration/CfgProductConfiguration.d.ts +136 -129
  51. package/dist/productConfiguration/CfgProductConfiguration.js +355 -346
  52. package/dist/productConfiguration/filters.d.ts +17 -17
  53. package/dist/productConfiguration/filters.js +141 -141
  54. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  55. package/dist/productConfiguration/productParamsGenerator.js +65 -65
  56. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  57. package/dist/productConfiguration/utilitiesProductConfiguration.js +89 -87
  58. package/dist/productLoader.d.ts +33 -33
  59. package/dist/productLoader.js +49 -49
  60. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
  61. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
  62. package/dist/syncGroups/SyncGroupsHandler.d.ts +47 -47
  63. package/dist/syncGroups/SyncGroupsHandler.js +370 -370
  64. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
  65. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
  66. package/dist/syncGroups/SyncGroupsState.d.ts +39 -39
  67. package/dist/syncGroups/SyncGroupsState.js +167 -167
  68. package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
  69. package/dist/syncGroups/SyncGroupsTransaction.js +589 -589
  70. package/dist/tasks/TaskHandler.d.ts +77 -77
  71. package/dist/tasks/TaskHandler.js +276 -276
  72. package/dist/tasks/formats.d.ts +4 -4
  73. package/dist/tasks/formats.js +7 -7
  74. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  75. package/dist/tests/testData/collectorForTest.js +194 -194
  76. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  77. package/dist/tests/testData/dummyProductForTest.js +32 -32
  78. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
  79. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +282 -282
  80. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  81. package/dist/tests/testData/testDataCachedGetProduct.js +187 -187
  82. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  83. package/dist/tests/testData/testDataCachedPostValidate.js +185 -185
  84. package/dist/tests/testData/testDataConstraints.d.ts +3 -3
  85. package/dist/tests/testData/testDataConstraints.js +174 -174
  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 -189
  92. package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
  93. package/dist/tests/testData/testDataUpcharge.js +121 -121
  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/utilitiesConfiguration.d.ts +28 -28
  99. package/dist/utilitiesConfiguration.js +200 -200
  100. package/dist/utilitiesNumericValues.d.ts +24 -24
  101. package/dist/utilitiesNumericValues.js +114 -114
  102. package/package.json +3 -3
@@ -1,130 +1,137 @@
1
- import { LengthUnit, LengthValue, Observable, SingleArgCallback } from "@configura/web-utilities";
2
- import { DtoFeature, DtoFeatureConf, DtoFeatureRef, DtoPartsConstrainedOption, DtoSelectedOption } from "../CatalogueAPI.js";
3
- import { CfgProduct, _CfgProductInternal } from "../CfgProduct.js";
4
- import { CfgFeature, _CfgFeatureInternal } from "./CfgFeature.js";
5
- import { ProductConfigurationBubbleMode } from "./CfgOption.js";
6
- export declare type ProductConfigurationChangeNotification = {
7
- freshRef: CfgProductConfiguration;
8
- committed: boolean;
9
- };
10
- export declare type StretchMap = Map<string, {
11
- def: LengthValue | undefined;
12
- current: LengthValue;
13
- }>;
14
- /**
15
- * This class is meant to only be used through CfgProductConfiguration. It should never be
16
- * instantiated on its own. Normally the internal state of this class should never be directly
17
- * modified. CfgProductConfiguration is the class that should be used and interacted with.
18
- */
19
- export declare class _CfgProductConfigurationInternal {
20
- readonly parentProduct: _CfgProductInternal;
21
- readonly rootProduct: _CfgProductInternal;
22
- private readonly _initialRootFeatureRefs;
23
- static _makeUninitialized(rootFeatureRefs: DtoFeatureRef[], rawFeatures: DtoFeature[], // Flat packed. All the features that can currently appear anyplace in the selection tree.
24
- parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): _CfgProductConfigurationInternal;
25
- private constructor();
26
- readonly key = "~";
27
- private _rootFeatureRefs;
28
- readonly accumulatedRawFeatures: DtoFeature[];
29
- private _features;
30
- readonly stretchReferenceLengthsByMeasureParamCode: StretchMap;
31
- readonly changeObservable: Observable<ProductConfigurationChangeNotification>;
32
- get rootFeatureRefs(): DtoFeatureRef[];
33
- get features(): CfgFeature[];
34
- private _notifyAllOfChange;
35
- /** Called by child to tell its parent that it has changed. */
36
- _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
37
- getDtoConf: (includeExtendedData: boolean) => DtoFeatureConf[];
38
- getApiSelection: () => DtoSelectedOption[];
39
- getApiConstrained: () => DtoPartsConstrainedOption[];
40
- /**
41
- * When used internally the notifications are taken care off by the caller, but if set from
42
- * outside we want notifications to bubble all the way to the root.
43
- * This method will not cause validation calls. Data is assumed to already be validated.
44
- */
45
- setApiSelection: (selectedOptions: DtoSelectedOption[], constrOptions: readonly DtoPartsConstrainedOption[] | undefined, bubbleToRoot: boolean) => Promise<boolean>;
46
- structureCompare: (other: _CfgProductConfigurationInternal, strictOrder: boolean, descriptionMatch: boolean) => boolean;
47
- /**
48
- * When used internally the notifications are taken care off by the caller, but if set from
49
- * outside we want notifications to bubble all the way to the root.
50
- */
51
- tryMatchSelection: (other: _CfgProductConfigurationInternal, descriptionMatch: boolean | undefined, validate: boolean) => Promise<boolean>;
52
- /** Only selected features. */
53
- _getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
54
- /**
55
- * Extends the list of loaded potentially used features. Will warn for but ignore duplicates.
56
- * Returns true if a change happened.
57
- */
58
- addRawFeatures: (rawFeatures: DtoFeature[], warnForDuplicates: boolean) => boolean;
59
- private _hasRootFeaturesChanged;
60
- /**
61
- * True if what root Features are used is not the same as at initial load.
62
- * This means that functional selection has happened.
63
- */
64
- get hasRootFeaturesChanged(): boolean;
65
- /**
66
- * Populates _features based on the passed @param rootFeatureRefs .
67
- * @return true if a change happened.
68
- */
69
- populateFeatures: (rootFeatureRefs: DtoFeatureRef[]) => boolean;
70
- setStretchReferenceLength: (measureParamCode: string, referenceLength: number | undefined, unit: LengthUnit) => Promise<boolean>;
71
- }
72
- export declare class CfgProductConfiguration {
73
- readonly _internal: _CfgProductConfigurationInternal;
74
- /**
75
- * This method is semi-async. It will immediately give you a reference to the created
76
- * CfgProductConfiguration, but is not properly initialized until the initDone-callback
77
- * has been called.
78
- */
79
- static make(initSuccess: (c: CfgProductConfiguration) => void, initFail: (error: Error) => void, rootFeatureRefs: DtoFeatureRef[], rawFeatures: DtoFeature[], // Flat packed. All the features that can currently appear anyplace in the selection tree.
80
- apiSelection: DtoSelectedOption[], apiConstraints: readonly DtoPartsConstrainedOption[] | undefined, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): CfgProductConfiguration;
81
- /**
82
- * Makes an object wrapping the passed object. This is not a clone method, it is a method to
83
- * make a new outer reference. Like a shallow copy.
84
- *
85
- * We use this to help frameworks that are built around using equals to detect change.
86
- */
87
- static _makeNewRefFrom(internal: _CfgProductConfigurationInternal): CfgProductConfiguration;
88
- /**
89
- * Private constructor and make-method because make new ref requires the constructor to take an
90
- * internal and we don't want those who instantiate CfgProductConfiguration to have to be aware
91
- * of the internal.
92
- */
93
- private constructor();
94
- isBackedBySame: (other: CfgProductConfiguration) => boolean;
95
- get parentProduct(): CfgProduct;
96
- get rootProduct(): CfgProduct;
97
- get key(): string;
98
- /**
99
- * Every (unprocessed) feature that is currently loaded for this product. This can be extended
100
- * by validation calls. What features are actually used is controlled by rootFeatureRefs and what
101
- * options are selected.
102
- */
103
- get rawFeatures(): DtoFeature[];
104
- /** What features are used in the root of this. This can change with new validate calls. */
105
- get rootFeatureRefs(): DtoFeatureRef[];
106
- /** The root features at the root of the selection tree. */
107
- get features(): CfgFeature[];
108
- structureCompare: (other: CfgProductConfiguration, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
109
- /**
110
- * This method will try to match the selection from another product configuration
111
- * This method does not propagate its selections.
112
- * This method will cause validation calls.
113
- */
114
- tryMatchSelection: (other: CfgProductConfiguration, descriptionMatch?: boolean) => Promise<boolean>;
115
- /**
116
- * Set how stretched a certain measure should be measureParamCode is the measure to be
117
- * stretched referenceLength is a value relative to the initial length of the measure. If the
118
- * stretch drawn up in Model Lab was from the start let's say 2.4 units from start point to end
119
- * point a reference value of 4.8 would stretch the start point to end point to double length.
120
- * This however does not stop things from extending outside start point to end point. So the
121
- * actual perceived length after stretching might have little to do with the referenceLength.
122
- * Undefined as referenceLength will clear, that is, make the stretched thing revert to its
123
- * default state.
124
- */
125
- setStretchReferenceLength: (measureParamCode: string, referenceLength: number, unit: LengthUnit) => Promise<boolean>;
126
- listenForChange: (l: SingleArgCallback<ProductConfigurationChangeNotification>) => void;
127
- stopListenForChange: (l: SingleArgCallback<ProductConfigurationChangeNotification>) => void;
128
- stopAllListenForChange: () => void;
129
- }
1
+ import { LengthUnit, LengthValue, Observable, SingleArgCallback } from "@configura/web-utilities";
2
+ import { DtoFeature, DtoFeatureConf, DtoFeatureRef, DtoPartsConstrainedOption, DtoSelectedOption } from "../CatalogueAPI.js";
3
+ import { CfgProduct, _CfgProductInternal } from "../CfgProduct.js";
4
+ import { CfgFeature, _CfgFeatureInternal } from "./CfgFeature.js";
5
+ import { ProductConfigurationBubbleMode } from "./CfgOption.js";
6
+ export declare type ProductConfigurationChangeNotification = {
7
+ freshRef: CfgProductConfiguration;
8
+ committed: boolean;
9
+ };
10
+ export declare type StretchMap = Map<string, {
11
+ def: LengthValue | undefined;
12
+ current: LengthValue;
13
+ }>;
14
+ /**
15
+ * This class is meant to only be used through CfgProductConfiguration. It should never be
16
+ * instantiated on its own. Normally the internal state of this class should never be directly
17
+ * modified. CfgProductConfiguration is the class that should be used and interacted with.
18
+ */
19
+ export declare class _CfgProductConfigurationInternal {
20
+ readonly parentProduct: _CfgProductInternal;
21
+ readonly rootProduct: _CfgProductInternal;
22
+ private readonly _initialRootFeatureRefs;
23
+ static _makeUninitialized(rootFeatureRefs: DtoFeatureRef[], rawFeatures: DtoFeature[], // Flat packed. All the features that can currently appear anyplace in the selection tree.
24
+ parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): _CfgProductConfigurationInternal;
25
+ private constructor();
26
+ readonly key = "~";
27
+ private _rootFeatureRefs;
28
+ readonly accumulatedRawFeatures: DtoFeature[];
29
+ private _features;
30
+ private _stretchReferenceLengthsByMeasureParamCode;
31
+ get stretchReferenceLengthsByMeasureParamCode(): StretchMap;
32
+ clearStretchMeasurements(): void;
33
+ readonly changeObservable: Observable<ProductConfigurationChangeNotification>;
34
+ get rootFeatureRefs(): DtoFeatureRef[];
35
+ get features(): CfgFeature[];
36
+ private _notifyAllOfChange;
37
+ /** Called by child to tell its parent that it has changed. */
38
+ _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
39
+ getDtoConf: (includeExtendedData: boolean) => DtoFeatureConf[];
40
+ getApiSelection: () => DtoSelectedOption[];
41
+ getApiConstrained: () => DtoPartsConstrainedOption[];
42
+ /**
43
+ * When used internally the notifications are taken care off by the caller, but if set from
44
+ * outside we want notifications to bubble all the way to the root.
45
+ * This method will not cause validation calls. Data is assumed to already be validated.
46
+ */
47
+ setApiSelection: (selectedOptions: DtoSelectedOption[], constrOptions: readonly DtoPartsConstrainedOption[] | undefined, bubbleToRoot: boolean) => Promise<boolean>;
48
+ structureCompare: (other: _CfgProductConfigurationInternal, strictOrder: boolean, descriptionMatch: boolean) => boolean;
49
+ /**
50
+ * When used internally the notifications are taken care off by the caller, but if set from
51
+ * outside we want notifications to bubble all the way to the root.
52
+ */
53
+ tryMatchSelection: (other: _CfgProductConfigurationInternal, descriptionMatch: boolean | undefined, validate: boolean) => Promise<boolean>;
54
+ /** Only selected features. */
55
+ _getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
56
+ /**
57
+ * Extends the list of loaded potentially used features. Will warn for but ignore duplicates.
58
+ * Returns true if a change happened.
59
+ */
60
+ addRawFeatures: (rawFeatures: DtoFeature[], warnForDuplicates: boolean) => boolean;
61
+ private _hasRootFeaturesChanged;
62
+ /**
63
+ * True if what root Features are used is not the same as at initial load.
64
+ * This means that functional selection has happened.
65
+ */
66
+ get hasRootFeaturesChanged(): boolean;
67
+ /**
68
+ * Populates _features based on the passed @param rootFeatureRefs .
69
+ * @return true if a change happened.
70
+ */
71
+ populateFeatures: (rootFeatureRefs: DtoFeatureRef[]) => boolean;
72
+ setStretchReferenceLength: (measureParamCode: string, referenceLength: number | undefined, unit: LengthUnit) => Promise<boolean>;
73
+ }
74
+ export declare class CfgProductConfiguration {
75
+ readonly _internal: _CfgProductConfigurationInternal;
76
+ /**
77
+ * This method is semi-async. It will immediately give you a reference to the created
78
+ * CfgProductConfiguration, but is not properly initialized until the initDone-callback
79
+ * has been called.
80
+ */
81
+ static make(initSuccess: (c: CfgProductConfiguration) => void, initFail: (error: Error) => void, rootFeatureRefs: DtoFeatureRef[], rawFeatures: DtoFeature[], // Flat packed. All the features that can currently appear anyplace in the selection tree.
82
+ apiSelection: DtoSelectedOption[], apiConstraints: readonly DtoPartsConstrainedOption[] | undefined, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): CfgProductConfiguration;
83
+ /**
84
+ * Makes an object wrapping the passed object. This is not a clone method, it is a method to
85
+ * make a new outer reference. Like a shallow copy.
86
+ *
87
+ * We use this to help frameworks that are built around using equals to detect change.
88
+ */
89
+ static _makeNewRefFrom(internal: _CfgProductConfigurationInternal): CfgProductConfiguration;
90
+ /**
91
+ * Private constructor and make-method because make new ref requires the constructor to take an
92
+ * internal and we don't want those who instantiate CfgProductConfiguration to have to be aware
93
+ * of the internal.
94
+ */
95
+ private constructor();
96
+ isBackedBySame: (other: CfgProductConfiguration) => boolean;
97
+ get parentProduct(): CfgProduct;
98
+ get rootProduct(): CfgProduct;
99
+ get key(): string;
100
+ /**
101
+ * Every (unprocessed) feature that is currently loaded for this product. This can be extended
102
+ * by validation calls. What features are actually used is controlled by rootFeatureRefs and what
103
+ * options are selected.
104
+ */
105
+ get rawFeatures(): DtoFeature[];
106
+ /** What features are used in the root of this. This can change with new validate calls. */
107
+ get rootFeatureRefs(): DtoFeatureRef[];
108
+ /** The root features at the root of the selection tree. */
109
+ get features(): CfgFeature[];
110
+ structureCompare: (other: CfgProductConfiguration, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
111
+ /**
112
+ * This method will try to match the selection from another product configuration
113
+ * This method does not propagate its selections.
114
+ * This method will cause validation calls.
115
+ */
116
+ tryMatchSelection: (other: CfgProductConfiguration, descriptionMatch?: boolean) => Promise<boolean>;
117
+ /**
118
+ * Set how stretched a certain measure should be measureParamCode is the measure to be
119
+ * stretched referenceLength is a value relative to the initial length of the measure. If the
120
+ * stretch drawn up in Model Lab was from the start let's say 2.4 units from start point to end
121
+ * point a reference value of 4.8 would stretch the start point to end point to double length.
122
+ * This however does not stop things from extending outside start point to end point. So the
123
+ * actual perceived length after stretching might have little to do with the referenceLength.
124
+ * Undefined as referenceLength will clear, that is, make the stretched thing revert to its
125
+ * default state.
126
+ */
127
+ setStretchReferenceLength: (measureParamCode: string, referenceLength: number, unit: LengthUnit) => Promise<boolean>;
128
+ listenForChange: (l: SingleArgCallback<ProductConfigurationChangeNotification>) => void;
129
+ stopListenForChange: (l: SingleArgCallback<ProductConfigurationChangeNotification>) => void;
130
+ stopAllListenForChange: () => void;
131
+ /**
132
+ * Clears cached stretch measurement map. Called by the parent product when the
133
+ * rawProductData has changed, which may potentially change the measurements.
134
+ */
135
+ clearStretchMeasurements(): void;
136
+ }
130
137
  //# sourceMappingURL=CfgProductConfiguration.d.ts.map