@configura/web-api 1.4.0 → 1.5.0-alpha.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 (61) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +1 -1
  3. package/dist/CatalogueAPI.d.ts +504 -504
  4. package/dist/CatalogueAPI.js +250 -248
  5. package/dist/CfgMeasure.d.ts +32 -32
  6. package/dist/CfgMeasure.js +30 -30
  7. package/dist/CfgProduct.d.ts +217 -217
  8. package/dist/CfgProduct.js +636 -636
  9. package/dist/index.d.ts +18 -16
  10. package/dist/index.js +18 -16
  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 +164 -160
  22. package/dist/productConfiguration/CfgFeature.js +597 -593
  23. package/dist/productConfiguration/CfgOption.d.ts +128 -128
  24. package/dist/productConfiguration/CfgOption.js +394 -394
  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 +67 -67
  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 +79 -0
  36. package/dist/tasks/TaskHandler.js +264 -0
  37. package/dist/tasks/formats.d.ts +7 -0
  38. package/dist/tasks/formats.js +8 -0
  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 -348
  45. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  46. package/dist/tests/testData/testDataCachedGetProduct.js +196 -196
  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 -198
  53. package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
  54. package/dist/tests/testData/testDataUpcharge.js +151 -151
  55. package/dist/utilitiesCatalogueData.d.ts +25 -25
  56. package/dist/utilitiesCatalogueData.js +64 -64
  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
@@ -1,129 +1,129 @@
1
- import { LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities";
2
- import { Feature, Option, SelectedOption } from "../CatalogueAPI.js";
3
- import { CfgProduct, _CfgProductInternal } from "../CfgProduct.js";
4
- import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js";
5
- import { NumericValuesSelection } from "../utilitiesNumericValues.js";
6
- import { CfgFeature, _CfgFeatureInternal } from "./CfgFeature.js";
7
- import { _CfgProductConfigurationInternal } from "./CfgProductConfiguration.js";
8
- export declare type OptionChangeNotification = {
9
- freshRef: CfgOption;
10
- };
11
- export declare enum ProductConfigurationBubbleMode {
12
- /**
13
- * Bubble to the closest CfgProduct, let it revalidate, then that will continue
14
- * the bubble after validate.
15
- */
16
- Validate = "Validate",
17
- /**
18
- * Bubble to the closest CfgProduct, let it revalidate, then that will continue
19
- * the bubble after validate. If this is select it will turns on all ancestors all the way up.
20
- * So with this mode it is possible to select an option where its parents are not selected.
21
- */
22
- ValidateAndBubbleSelected = "ValidateAndBubbleSelected",
23
- /**
24
- * Stop bubbling
25
- * This mode supports internal functionality and is not expected to be used by integrators.
26
- */
27
- Stop = "Stop",
28
- /**
29
- * Bubble to the next level up the tree. In features-options the next level is considered
30
- * the next feature, so option levels are skipped over. The node we call from notifies its
31
- * parent, and the parent switches out the reference to the node. Then bubbling stops.
32
- * This mode supports internal functionality and is not expected to be used by integrators.
33
- */
34
- OneLevel = "OneLevel",
35
- /**
36
- * Bubble to the closest CfgProduct without doing any validation
37
- * This mode supports internal functionality and is not expected to be used by integrators.
38
- */
39
- ToParentProduct = "ToParentProduct",
40
- /**
41
- * Bubble to the root CfgProduct
42
- * This mode supports internal functionality and is not expected to be used by integrators.
43
- */
44
- ToRoot = "ToRoot"
45
- }
46
- /**
47
- * This class is meant to only be used through CfgOption. It should
48
- * never be instantiated on its own. Normally the internal state of this class
49
- * should never be directly modified. CfgOption is the class that
50
- * should be used and interacted with.
51
- */
52
- export declare class _CfgOptionInternal {
53
- readonly rawOption: Option;
54
- private readonly allRawFeatures;
55
- readonly parent: _CfgFeatureInternal;
56
- readonly parentConfiguration: _CfgProductConfigurationInternal;
57
- readonly parentProduct: _CfgProductInternal;
58
- readonly rootProduct: _CfgProductInternal;
59
- constructor(rawOption: Option, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parent: _CfgFeatureInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal);
60
- private _features;
61
- private _mtrlApplications;
62
- readonly key: string;
63
- private _numericValue;
64
- readonly allowedNumericValues: NumericValuesSelection | undefined;
65
- isAllowedNumericValue(val: number): boolean;
66
- readonly changeObservable: Observable<OptionChangeNotification>;
67
- get code(): string;
68
- get isUseNumericValue(): boolean;
69
- get numericValue(): number | undefined;
70
- setNumericValue(val: number, doSelectOption: boolean): Promise<boolean>;
71
- get unit(): LengthUnit;
72
- get description(): string;
73
- get selected(): boolean;
74
- get ancestorsSelected(): boolean;
75
- get mtrlApplications(): CfgMtrlApplication[];
76
- get thumbnail(): string | undefined;
77
- get upcharge(): number | undefined;
78
- get priceChangeAtSelectChange(): number | undefined;
79
- get features(): CfgFeature[];
80
- /** Called by child to tell its parent that it has changed. */
81
- _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode) => Promise<void>;
82
- getApiSelection: () => SelectedOption;
83
- setApiSelection: (apiOptionSelection: SelectedOption | undefined) => Promise<boolean>;
84
- structureCompare: (other: _CfgOptionInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
85
- tryMatchSelection: (other: CfgOption, descriptionMatch?: boolean) => Promise<boolean>;
86
- keyMatch: (other: _CfgOptionInternal, descriptionMatch?: boolean) => boolean;
87
- _getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
88
- _freshRefDescendants(): void;
89
- }
90
- export declare class CfgOption {
91
- readonly _internal: _CfgOptionInternal;
92
- static make(rawOption: Option, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parent: _CfgFeatureInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): CfgOption;
93
- /**
94
- * Makes an object wrapping the passed object. This is not a clone method,
95
- * it is a method to make a new outer reference. Like a shallow copy.
96
- * We use this to help frameworks that are build around using equals to detect change.
97
- */
98
- static _makeNewRefFrom(internal: _CfgOptionInternal): CfgOption;
99
- /**
100
- * Private constructor and make-method because make new ref requires the constructor to
101
- * take an internal and we don't want those who instantiate CfgOption to have to be aware
102
- * of the internal.
103
- */
104
- private constructor();
105
- isBackedBySame: (other: CfgOption) => boolean;
106
- get parentProduct(): CfgProduct;
107
- get rootProduct(): CfgProduct;
108
- get rawOption(): Option;
109
- get key(): string;
110
- get code(): string;
111
- get isUseNumericValue(): boolean;
112
- get numericValue(): number | undefined;
113
- setNumericValue: (val: number, doSelectOption: boolean) => Promise<boolean>;
114
- get allowedNumericValues(): NumericValuesSelection | undefined;
115
- isAllowedNumericValue: (val: number) => boolean;
116
- get unit(): LengthUnit;
117
- get description(): string;
118
- get selected(): boolean;
119
- /** Are all ancestors up to the CfgProductConfiguration selected? Includes self. */
120
- get ancestorsSelected(): boolean;
121
- setSelected: (on: boolean) => Promise<boolean>;
122
- get thumbnail(): string | undefined;
123
- get upcharge(): number | undefined;
124
- get priceChangeAtSelectChange(): number | undefined;
125
- get features(): CfgFeature[];
126
- listenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
127
- stopListenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
128
- }
1
+ import { LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities";
2
+ import { Feature, Option, SelectedOption } from "../CatalogueAPI.js";
3
+ import { CfgProduct, _CfgProductInternal } from "../CfgProduct.js";
4
+ import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js";
5
+ import { NumericValuesSelection } from "../utilitiesNumericValues.js";
6
+ import { CfgFeature, _CfgFeatureInternal } from "./CfgFeature.js";
7
+ import { _CfgProductConfigurationInternal } from "./CfgProductConfiguration.js";
8
+ export declare type OptionChangeNotification = {
9
+ freshRef: CfgOption;
10
+ };
11
+ export declare enum ProductConfigurationBubbleMode {
12
+ /**
13
+ * Bubble to the closest CfgProduct, let it revalidate, then that will continue
14
+ * the bubble after validate.
15
+ */
16
+ Validate = "Validate",
17
+ /**
18
+ * Bubble to the closest CfgProduct, let it revalidate, then that will continue
19
+ * the bubble after validate. If this is select it will turns on all ancestors all the way up.
20
+ * So with this mode it is possible to select an option where its parents are not selected.
21
+ */
22
+ ValidateAndBubbleSelected = "ValidateAndBubbleSelected",
23
+ /**
24
+ * Stop bubbling
25
+ * This mode supports internal functionality and is not expected to be used by integrators.
26
+ */
27
+ Stop = "Stop",
28
+ /**
29
+ * Bubble to the next level up the tree. In features-options the next level is considered
30
+ * the next feature, so option levels are skipped over. The node we call from notifies its
31
+ * parent, and the parent switches out the reference to the node. Then bubbling stops.
32
+ * This mode supports internal functionality and is not expected to be used by integrators.
33
+ */
34
+ OneLevel = "OneLevel",
35
+ /**
36
+ * Bubble to the closest CfgProduct without doing any validation
37
+ * This mode supports internal functionality and is not expected to be used by integrators.
38
+ */
39
+ ToParentProduct = "ToParentProduct",
40
+ /**
41
+ * Bubble to the root CfgProduct
42
+ * This mode supports internal functionality and is not expected to be used by integrators.
43
+ */
44
+ ToRoot = "ToRoot"
45
+ }
46
+ /**
47
+ * This class is meant to only be used through CfgOption. It should
48
+ * never be instantiated on its own. Normally the internal state of this class
49
+ * should never be directly modified. CfgOption is the class that
50
+ * should be used and interacted with.
51
+ */
52
+ export declare class _CfgOptionInternal {
53
+ readonly rawOption: Option;
54
+ private readonly allRawFeatures;
55
+ readonly parent: _CfgFeatureInternal;
56
+ readonly parentConfiguration: _CfgProductConfigurationInternal;
57
+ readonly parentProduct: _CfgProductInternal;
58
+ readonly rootProduct: _CfgProductInternal;
59
+ constructor(rawOption: Option, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parent: _CfgFeatureInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal);
60
+ private _features;
61
+ private _mtrlApplications;
62
+ readonly key: string;
63
+ private _numericValue;
64
+ readonly allowedNumericValues: NumericValuesSelection | undefined;
65
+ isAllowedNumericValue(val: number): boolean;
66
+ readonly changeObservable: Observable<OptionChangeNotification>;
67
+ get code(): string;
68
+ get isUseNumericValue(): boolean;
69
+ get numericValue(): number | undefined;
70
+ setNumericValue(val: number, doSelectOption: boolean): Promise<boolean>;
71
+ get unit(): LengthUnit;
72
+ get description(): string;
73
+ get selected(): boolean;
74
+ get ancestorsSelected(): boolean;
75
+ get mtrlApplications(): CfgMtrlApplication[];
76
+ get thumbnail(): string | undefined;
77
+ get upcharge(): number | undefined;
78
+ get priceChangeAtSelectChange(): number | undefined;
79
+ get features(): CfgFeature[];
80
+ /** Called by child to tell its parent that it has changed. */
81
+ _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode) => Promise<void>;
82
+ getApiSelection: () => SelectedOption;
83
+ setApiSelection: (apiOptionSelection: SelectedOption | undefined) => Promise<boolean>;
84
+ structureCompare: (other: _CfgOptionInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
85
+ tryMatchSelection: (other: CfgOption, descriptionMatch?: boolean) => Promise<boolean>;
86
+ keyMatch: (other: _CfgOptionInternal, descriptionMatch?: boolean) => boolean;
87
+ _getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
88
+ _freshRefDescendants(): void;
89
+ }
90
+ export declare class CfgOption {
91
+ readonly _internal: _CfgOptionInternal;
92
+ static make(rawOption: Option, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parent: _CfgFeatureInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): CfgOption;
93
+ /**
94
+ * Makes an object wrapping the passed object. This is not a clone method,
95
+ * it is a method to make a new outer reference. Like a shallow copy.
96
+ * We use this to help frameworks that are build around using equals to detect change.
97
+ */
98
+ static _makeNewRefFrom(internal: _CfgOptionInternal): CfgOption;
99
+ /**
100
+ * Private constructor and make-method because make new ref requires the constructor to
101
+ * take an internal and we don't want those who instantiate CfgOption to have to be aware
102
+ * of the internal.
103
+ */
104
+ private constructor();
105
+ isBackedBySame: (other: CfgOption) => boolean;
106
+ get parentProduct(): CfgProduct;
107
+ get rootProduct(): CfgProduct;
108
+ get rawOption(): Option;
109
+ get key(): string;
110
+ get code(): string;
111
+ get isUseNumericValue(): boolean;
112
+ get numericValue(): number | undefined;
113
+ setNumericValue: (val: number, doSelectOption: boolean) => Promise<boolean>;
114
+ get allowedNumericValues(): NumericValuesSelection | undefined;
115
+ isAllowedNumericValue: (val: number) => boolean;
116
+ get unit(): LengthUnit;
117
+ get description(): string;
118
+ get selected(): boolean;
119
+ /** Are all ancestors up to the CfgProductConfiguration selected? Includes self. */
120
+ get ancestorsSelected(): boolean;
121
+ setSelected: (on: boolean) => Promise<boolean>;
122
+ get thumbnail(): string | undefined;
123
+ get upcharge(): number | undefined;
124
+ get priceChangeAtSelectChange(): number | undefined;
125
+ get features(): CfgFeature[];
126
+ listenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
127
+ stopListenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
128
+ }
129
129
  //# sourceMappingURL=CfgOption.d.ts.map