@configura/web-api 1.6.1 → 2.0.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.
- package/dist/CatalogueAPI.d.ts +200 -156
- package/dist/CatalogueAPI.js +23 -10
- package/dist/CfgMeasure.d.ts +3 -3
- package/dist/CfgProduct.d.ts +31 -21
- package/dist/CfgProduct.js +77 -46
- package/dist/CfgReferencePathHelper.d.ts +14 -0
- package/dist/CfgReferencePathHelper.js +13 -0
- package/dist/ConfigurationConverter.d.ts +5 -0
- package/dist/ConfigurationConverter.js +72 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/io/CfgHistoryManager.d.ts +51 -0
- package/dist/io/CfgHistoryManager.js +82 -0
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -0
- package/dist/io/CfgHistoryToProdConfConnector.js +56 -0
- package/dist/io/CfgIOManager.d.ts +49 -0
- package/dist/io/CfgIOManager.js +115 -0
- package/dist/io/CfgIOProdConfConnector.d.ts +53 -0
- package/dist/io/CfgIOProdConfConnector.js +141 -0
- package/dist/io/CfgObservableStateManager.d.ts +22 -0
- package/dist/io/CfgObservableStateManager.js +65 -0
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -0
- package/dist/io/CfgObservableStateToProdConfConnector.js +16 -0
- package/dist/io/CfgWindowEventManager.d.ts +22 -0
- package/dist/io/CfgWindowEventManager.js +38 -0
- package/dist/io/CfgWindowMessageManager.d.ts +41 -0
- package/dist/io/CfgWindowMessageManager.js +84 -0
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -0
- package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -0
- package/dist/io/index.d.ts +9 -0
- package/dist/io/index.js +8 -0
- package/dist/material/CfgMtrlApplication.d.ts +2 -2
- package/dist/productConfiguration/CfgFeature.d.ts +11 -12
- package/dist/productConfiguration/CfgFeature.js +37 -28
- package/dist/productConfiguration/CfgOption.d.ts +9 -8
- package/dist/productConfiguration/CfgOption.js +20 -30
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +17 -20
- package/dist/productConfiguration/CfgProductConfiguration.js +14 -16
- package/dist/productConfiguration/filters.d.ts +4 -4
- package/dist/productConfiguration/productParamsGenerator.d.ts +4 -4
- package/dist/productConfiguration/productParamsGenerator.js +5 -5
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +3 -3
- package/dist/productLoader.d.ts +3 -3
- package/dist/syncGroups/SyncGroupsHandler.js +3 -2
- package/dist/syncGroups/SyncGroupsTransaction.js +1 -1
- package/dist/tasks/TaskHandler.d.ts +7 -8
- package/dist/tasks/TaskHandler.js +4 -5
- package/dist/tasks/formats.d.ts +4 -4
- package/dist/tasks/formats.js +3 -3
- package/dist/tests/testData/dummyProductForTest.d.ts +2 -2
- package/dist/tests/testData/dummyProductForTest.js +3 -7
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +2 -2
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +1 -1
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +2 -2
- package/dist/tests/testData/testDataCachedGetProduct.js +1 -1
- package/dist/tests/testData/testDataCachedPostValidate.js +1 -1
- package/dist/tests/testData/testDataOptions.d.ts +4 -4
- package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +3 -3
- package/dist/tests/testData/testDataProductAggregatedPrice.js +1 -1
- package/dist/tests/testData/testDataUpcharge.js +1 -1
- package/dist/utilitiesCatalogueData.d.ts +25 -23
- package/dist/utilitiesCatalogueData.js +10 -8
- package/dist/utilitiesCataloguePermission.d.ts +8 -13
- package/dist/utilitiesCataloguePermission.js +7 -11
- package/dist/utilitiesNumericValues.d.ts +3 -3
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoAdditionalProductRef, DtoFeature, DtoFeatureRef } from "../CatalogueAPI.js";
|
|
2
2
|
import { _CfgProductInternal } from "../CfgProduct.js";
|
|
3
3
|
import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js";
|
|
4
4
|
import { CfgFeature } from "./CfgFeature.js";
|
|
@@ -8,11 +8,11 @@ import { CfgProductConfiguration, _CfgProductConfigurationInternal } from "./Cfg
|
|
|
8
8
|
* Returns a new array of CfgFeatures that maps to the newFeatureRefs array. Uses CfgFeatures from
|
|
9
9
|
* currentFeatures if they can be found, otherwise makes new.
|
|
10
10
|
*/
|
|
11
|
-
export declare function syncCfgFeatures(newFeatureRefs:
|
|
11
|
+
export declare function syncCfgFeatures(newFeatureRefs: DtoFeatureRef[], currentFeatures: CfgFeature[], allRawFeatures: DtoFeature[], parent: _CfgProductConfigurationInternal | _CfgOptionInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): CfgFeature[];
|
|
12
12
|
export declare function getMtrlPreview(mtrlApplications: CfgMtrlApplication[] | undefined): string | undefined;
|
|
13
13
|
/**
|
|
14
14
|
* Recursively find all additional product references given a product configuration.
|
|
15
15
|
* Only selected options are considered.
|
|
16
16
|
*/
|
|
17
|
-
export declare function collectAdditionalProductRefs(parent: CfgProductConfiguration):
|
|
17
|
+
export declare function collectAdditionalProductRefs(parent: CfgProductConfiguration): DtoAdditionalProductRef[];
|
|
18
18
|
//# sourceMappingURL=utilitiesProductConfiguration.d.ts.map
|
package/dist/productLoader.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoProductParamsWithLang, DtoValidateRequest } from "./CatalogueAPI.js";
|
|
2
2
|
import { CfgProductResponse, CfgValidateResponse } from "./utilitiesCatalogueData.js";
|
|
3
|
-
export declare type GetProduct = (params:
|
|
4
|
-
export declare type PostValidate = (params:
|
|
3
|
+
export declare type GetProduct = (params: DtoProductParamsWithLang) => Promise<CfgProductResponse>;
|
|
4
|
+
export declare type PostValidate = (params: DtoProductParamsWithLang, body: DtoValidateRequest) => Promise<CfgValidateResponse>;
|
|
5
5
|
export declare type ProductLoader = {
|
|
6
6
|
getProduct: GetProduct;
|
|
7
7
|
postValidate: PostValidate;
|
|
@@ -240,12 +240,13 @@ import { SyncGroupsTransaction } from "./SyncGroupsTransaction.js";
|
|
|
240
240
|
*/
|
|
241
241
|
function notifyOptionAndSelectedSiblings(option) {
|
|
242
242
|
return __awaiter(this, void 0, void 0, function* () {
|
|
243
|
+
const committed = false;
|
|
243
244
|
const parentFeature = option.parent;
|
|
244
245
|
if (parentFeature.selectionType === SelectionType.SelectOne) {
|
|
245
246
|
// These only need to be OneLevel, as the final is ToRoot and they share their parent.
|
|
246
|
-
yield Promise.all(option.parent.selectedOptions.map((o) => parentFeature._childHasChanged(o._internal, ProductConfigurationBubbleMode.OneLevel)));
|
|
247
|
+
yield Promise.all(option.parent.selectedOptions.map((o) => parentFeature._childHasChanged(o._internal, ProductConfigurationBubbleMode.OneLevel, committed)));
|
|
247
248
|
}
|
|
248
|
-
yield parentFeature._childHasChanged(option, ProductConfigurationBubbleMode.ToRoot);
|
|
249
|
+
yield parentFeature._childHasChanged(option, ProductConfigurationBubbleMode.ToRoot, committed);
|
|
249
250
|
});
|
|
250
251
|
}
|
|
251
252
|
/**
|
|
@@ -167,7 +167,7 @@ export class SyncGroupsTransaction {
|
|
|
167
167
|
}
|
|
168
168
|
const promises = [];
|
|
169
169
|
for (const product of productsToValidate) {
|
|
170
|
-
promises.push(product._revalidate(CfgProductBubbleMode.ToRoot, this.productLoader));
|
|
170
|
+
promises.push(product._revalidate(CfgProductBubbleMode.ToRoot, this.productLoader, true));
|
|
171
171
|
}
|
|
172
172
|
const revalidationResults = yield Promise.all(promises);
|
|
173
173
|
if (revalidationResults.every((r) => !r)) {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
-
import {
|
|
2
|
+
import { CatalogueAPI, DtoAdditionalProductConfiguration, DtoExportStatus, DtoExportStatusStatus, DtoProductParamsWithLang, DtoRenderStatus, DtoRenderStatusStatus, DtoTargetCameraArgs } from "../CatalogueAPI.js";
|
|
3
3
|
import { CfgProduct } from "../CfgProduct.js";
|
|
4
4
|
import { RenderOrExportFormat } from "./formats.js";
|
|
5
5
|
export declare type TasksChangeNotification = {
|
|
6
6
|
freshRef: TaskHandler;
|
|
7
7
|
};
|
|
8
8
|
export declare type RenderTaskParams = {
|
|
9
|
-
targetCameraArgs?:
|
|
9
|
+
targetCameraArgs?: DtoTargetCameraArgs;
|
|
10
10
|
width: number;
|
|
11
11
|
height: number;
|
|
12
12
|
};
|
|
13
|
-
export declare type ProductParams = PostRenderParams | PostExportParams;
|
|
14
13
|
export declare class _TaskHandlerInternal {
|
|
15
14
|
api: CatalogueAPI;
|
|
16
15
|
readonly changeObservable: Observable<TasksChangeNotification>;
|
|
@@ -44,16 +43,16 @@ export declare class TaskHandler {
|
|
|
44
43
|
listenForChange: (l: SingleArgCallback<TasksChangeNotification>) => void;
|
|
45
44
|
stopListenForChange: (l: SingleArgCallback<TasksChangeNotification>) => void;
|
|
46
45
|
}
|
|
47
|
-
declare type TaskStatus =
|
|
46
|
+
declare type TaskStatus = DtoRenderStatusStatus | DtoExportStatusStatus | "abandoned";
|
|
48
47
|
export declare abstract class Task<F extends RenderOrExportFormat> {
|
|
49
48
|
protected readonly taskHandler: _TaskHandlerInternal;
|
|
50
49
|
readonly format: F;
|
|
51
50
|
private _timerId;
|
|
52
51
|
protected constructor(taskHandler: _TaskHandlerInternal, format: F, product: CfgProduct, getPreviewUrl: (() => Promise<string>) | undefined);
|
|
53
|
-
protected abstract postInit(): Promise<
|
|
54
|
-
protected abstract pollStatus(): Promise<
|
|
55
|
-
protected _productParams:
|
|
56
|
-
protected _apiSelection:
|
|
52
|
+
protected abstract postInit(): Promise<DtoRenderStatus | DtoExportStatus>;
|
|
53
|
+
protected abstract pollStatus(): Promise<DtoRenderStatus | DtoExportStatus>;
|
|
54
|
+
protected _productParams: DtoProductParamsWithLang;
|
|
55
|
+
protected _apiSelection: DtoAdditionalProductConfiguration;
|
|
57
56
|
private _status;
|
|
58
57
|
private _uuid;
|
|
59
58
|
private _created;
|
|
@@ -8,9 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { augmentErrorMessage, Observable } from "@configura/web-utilities";
|
|
11
|
-
import {
|
|
11
|
+
import { dtoExportFormatNames, dtoRenderFormatNames, } from "../CatalogueAPI.js";
|
|
12
12
|
import { isExportFormat, isRenderFormat } from "./formats.js";
|
|
13
|
-
const productToParams = (product) => (Object.assign(Object.assign({ lang: product.lang }, product.catId), { partNumber: product.partNumber }));
|
|
14
13
|
export class _TaskHandlerInternal {
|
|
15
14
|
constructor(api) {
|
|
16
15
|
this.api = api;
|
|
@@ -56,10 +55,10 @@ export class _TaskHandlerInternal {
|
|
|
56
55
|
get availableFormats() {
|
|
57
56
|
const result = [];
|
|
58
57
|
if (this.hasExport) {
|
|
59
|
-
result.push(...
|
|
58
|
+
result.push(...dtoExportFormatNames);
|
|
60
59
|
}
|
|
61
60
|
if (this.hasRender) {
|
|
62
|
-
result.push(...
|
|
61
|
+
result.push(...dtoRenderFormatNames);
|
|
63
62
|
}
|
|
64
63
|
return result;
|
|
65
64
|
}
|
|
@@ -175,7 +174,7 @@ export class Task {
|
|
|
175
174
|
this.stop();
|
|
176
175
|
this.taskHandler.removeTask(this);
|
|
177
176
|
};
|
|
178
|
-
this._productParams =
|
|
177
|
+
this._productParams = product.prodParams;
|
|
179
178
|
this._apiSelection = product.getApiSelection();
|
|
180
179
|
if (getPreviewUrl !== undefined) {
|
|
181
180
|
void getPreviewUrl().then((dataUrl) => {
|
package/dist/tasks/formats.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare type RenderOrExportFormat =
|
|
3
|
-
export declare function isRenderFormat(type: unknown): type is
|
|
4
|
-
export declare function isExportFormat(type: unknown): type is
|
|
1
|
+
import { DtoExportFormat, DtoRenderFormat } from "../CatalogueAPI.js";
|
|
2
|
+
export declare type RenderOrExportFormat = DtoRenderFormat | DtoExportFormat;
|
|
3
|
+
export declare function isRenderFormat(type: unknown): type is DtoRenderFormat;
|
|
4
|
+
export declare function isExportFormat(type: unknown): type is DtoExportFormat;
|
|
5
5
|
//# sourceMappingURL=formats.d.ts.map
|
package/dist/tasks/formats.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dtoExportFormatNames, dtoRenderFormatNames, } from "../CatalogueAPI.js";
|
|
2
2
|
export function isRenderFormat(type) {
|
|
3
|
-
return
|
|
3
|
+
return dtoRenderFormatNames.some((f) => type === f);
|
|
4
4
|
}
|
|
5
5
|
export function isExportFormat(type) {
|
|
6
|
-
return
|
|
6
|
+
return dtoExportFormatNames.some((f) => type === f);
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoCatalogueParamsWithLang } from "../../CatalogueAPI.js";
|
|
2
2
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
3
|
-
export declare const dummyCatId:
|
|
3
|
+
export declare const dummyCatId: DtoCatalogueParamsWithLang;
|
|
4
4
|
export declare const getDummyCfgProduct: () => Promise<CfgProduct>;
|
|
5
5
|
//# sourceMappingURL=dummyProductForTest.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
2
2
|
export const dummyCatId = {
|
|
3
|
+
cid: 123,
|
|
4
|
+
lang: "lang",
|
|
3
5
|
enterprise: "enterprise",
|
|
4
6
|
prdCat: "prdCat",
|
|
5
7
|
prdCatVersion: "prdCatVersion",
|
|
@@ -27,10 +29,4 @@ export const getDummyCfgProduct = () => CfgProduct.make({
|
|
|
27
29
|
postValidate: () => {
|
|
28
30
|
throw new Error("Should not be used");
|
|
29
31
|
},
|
|
30
|
-
}, "
|
|
31
|
-
enterprise: "enterprise",
|
|
32
|
-
prdCat: "prdCat",
|
|
33
|
-
prdCatVersion: "prdCatVersion",
|
|
34
|
-
priceList: "priceList",
|
|
35
|
-
vendor: "vendor",
|
|
36
|
-
}, "partNumber");
|
|
32
|
+
}, Object.assign(Object.assign({}, dummyCatId), { partNumber: "partNumber" }));
|
package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoGetProductParams } from "../../CatalogueAPI.js";
|
|
2
2
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
3
3
|
import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
|
|
4
4
|
import { SnapShotForWrapperWithoutRef } from "./collectorForTest.js";
|
|
5
|
-
export declare const getTestProduct: (params:
|
|
5
|
+
export declare const getTestProduct: (params: DtoGetProductParams) => Promise<CfgProductResponse>;
|
|
6
6
|
export declare const cfgProductTest: (testFunc: (product: CfgProduct) => Promise<void>, prepFunc?: ((product: CfgProduct) => Promise<void>) | undefined) => Promise<{
|
|
7
7
|
beforeSnapshot: SnapShotForWrapperWithoutRef;
|
|
8
8
|
afterSnapshot: SnapShotForWrapperWithoutRef;
|
|
@@ -258,7 +258,7 @@ export const cfgProductTest = (testFunc, prepFunc) => __awaiter(void 0, void 0,
|
|
|
258
258
|
collect.pushNotification(`Validate ${params.enterprise} ${params.prdCat} ${params.prdCatVersion} ${params.priceList} ${params.vendor} ${params.partNumber}`);
|
|
259
259
|
return validateResponse;
|
|
260
260
|
}),
|
|
261
|
-
},
|
|
261
|
+
}, Object.assign(Object.assign({}, dummyCatId), { partNumber: "A" }));
|
|
262
262
|
if (prepFunc !== undefined) {
|
|
263
263
|
yield prepFunc(product);
|
|
264
264
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoGetProductParams } from "../../CatalogueAPI.js";
|
|
2
2
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
3
3
|
import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
|
|
4
|
-
export declare const getTestProduct: (params:
|
|
4
|
+
export declare const getTestProduct: (params: DtoGetProductParams, validateCall?: boolean | undefined) => Promise<CfgProductResponse>;
|
|
5
5
|
export declare const cachedProductLoaderTest: () => Promise<CfgProduct>;
|
|
6
6
|
//# sourceMappingURL=testDataCachedGetProduct.d.ts.map
|
|
@@ -180,6 +180,6 @@ export const cachedProductLoaderTest = () => __awaiter(void 0, void 0, void 0, f
|
|
|
180
180
|
const productWrapper = yield CfgProduct.make({
|
|
181
181
|
getProduct: wrapWithGetProductCache(productLoader.getProduct.bind(productLoader)),
|
|
182
182
|
postValidate: productLoader.postValidate.bind(productLoader),
|
|
183
|
-
},
|
|
183
|
+
}, Object.assign(Object.assign({}, dummyCatId), { partNumber: "A" }));
|
|
184
184
|
return productWrapper;
|
|
185
185
|
});
|
|
@@ -178,6 +178,6 @@ export const cachedProductLoaderTest = () => __awaiter(void 0, void 0, void 0, f
|
|
|
178
178
|
return validateResponse;
|
|
179
179
|
}),
|
|
180
180
|
};
|
|
181
|
-
const product = yield CfgProduct.make(productLoader,
|
|
181
|
+
const product = yield CfgProduct.make(productLoader, Object.assign(Object.assign({}, dummyCatId), { partNumber: "Table" }));
|
|
182
182
|
return { product, validateCounter };
|
|
183
183
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function addDefaultsToMockSelectedOption(root:
|
|
1
|
+
import { DtoOption, DtoSelectedOption } from "../../CatalogueAPI.js";
|
|
2
|
+
export declare function addDefaultsToMockSelectedOption(root: DtoSelectedOption, optionCodeToAdd: string | undefined, optionCodesToRemove: string[], unlessOptionCodes: string[]): void;
|
|
3
3
|
export declare const letterOptionCodeA = "optA";
|
|
4
4
|
export declare const letterOptionCodeB = "optB";
|
|
5
5
|
export declare const letterOptionCodeC = "optC";
|
|
6
6
|
export declare const letterOptionCodeD = "optD";
|
|
7
7
|
export declare const letterOptionCodeE = "optE";
|
|
8
8
|
export declare const letterOptionCodeF = "optF";
|
|
9
|
-
export declare const letterOptions:
|
|
9
|
+
export declare const letterOptions: DtoOption[];
|
|
10
10
|
export declare const toggleOptionCodeOff = "optOff";
|
|
11
11
|
export declare const toggleOptionCodeOn = "optOn";
|
|
12
|
-
export declare const toggleOptions:
|
|
12
|
+
export declare const toggleOptions: DtoOption[];
|
|
13
13
|
//# sourceMappingURL=testDataOptions.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoGetProductParams, DtoSelectedOption } from "../../CatalogueAPI.js";
|
|
2
2
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
3
3
|
import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
|
|
4
|
-
export declare const getTestProduct: (params:
|
|
5
|
-
export declare function getSelOptions(option: string):
|
|
4
|
+
export declare const getTestProduct: (params: DtoGetProductParams) => Promise<CfgProductResponse>;
|
|
5
|
+
export declare function getSelOptions(option: string): DtoSelectedOption[];
|
|
6
6
|
export declare const cfgProductPriceTest: (testFunc?: ((cfgProduct: CfgProduct) => Promise<void>) | undefined, featureOption?: string | undefined) => Promise<CfgProduct>;
|
|
7
7
|
//# sourceMappingURL=testDataProductAggregatedPrice.d.ts.map
|
|
@@ -179,7 +179,7 @@ export const cfgProductPriceTest = (testFunc, featureOption) => __awaiter(void 0
|
|
|
179
179
|
};
|
|
180
180
|
return validateResponse;
|
|
181
181
|
}),
|
|
182
|
-
},
|
|
182
|
+
}, Object.assign(Object.assign({}, dummyCatId), { partNumber: "A" }));
|
|
183
183
|
if (testFunc !== undefined) {
|
|
184
184
|
yield testFunc(cfgProduct);
|
|
185
185
|
}
|
|
@@ -103,7 +103,7 @@ export const getUpchargeProduct = (testFunc) => __awaiter(void 0, void 0, void 0
|
|
|
103
103
|
return validateResponse;
|
|
104
104
|
}),
|
|
105
105
|
};
|
|
106
|
-
const product = yield CfgProduct.make(productLoader,
|
|
106
|
+
const product = yield CfgProduct.make(productLoader, Object.assign(Object.assign({}, dummyCatId), { partNumber: "Table" }));
|
|
107
107
|
const collect = new Collector(product);
|
|
108
108
|
const beforeSnapshot = collect.takeSnapshot();
|
|
109
109
|
yield testFunc(product);
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const makeCatalogueKey: (cat:
|
|
3
|
-
export declare const makeProductKey: (cat:
|
|
4
|
-
export declare const makeSelOptionsKey: (options:
|
|
5
|
-
export declare type RootNodeSource =
|
|
6
|
-
export declare type CfgProductData = Omit<Omit<
|
|
1
|
+
import { DtoAdditionalProductRef, DtoCatalogueParams, DtoCatalogueParamsWithLang, DtoCatalogueParamsWithoutCid, DtoMeasureParam, DtoModel, DtoOrientation, DtoPartsData, DtoPrices, DtoProductData, DtoProductParams, DtoProductParamsWithLang, DtoProductResponse, DtoSelectedOption, DtoTransform, DtoValidateResponse, DtoVector } from "./CatalogueAPI.js";
|
|
2
|
+
export declare const makeCatalogueKey: (cat: DtoCatalogueParams) => string;
|
|
3
|
+
export declare const makeProductKey: (cat: DtoCatalogueParams, pKey: string) => string;
|
|
4
|
+
export declare const makeSelOptionsKey: (options: DtoSelectedOption[]) => string;
|
|
5
|
+
export declare type RootNodeSource = DtoModel | File;
|
|
6
|
+
export declare type CfgProductData = Omit<Omit<DtoProductData, "models">, "partsData"> & {
|
|
7
7
|
models?: RootNodeSource[];
|
|
8
|
-
partsData: Omit<
|
|
9
|
-
selOptions:
|
|
8
|
+
partsData: Omit<DtoPartsData, "selOptions"> & {
|
|
9
|
+
selOptions: DtoSelectedOption[];
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export declare type CfgProductResponse = Omit<
|
|
12
|
+
export declare type CfgProductResponse = Omit<DtoProductResponse, "productData"> & {
|
|
13
13
|
productData: CfgProductData;
|
|
14
14
|
};
|
|
15
|
-
/** This must be kept in sync with
|
|
16
|
-
export declare type CfgValidateResponse = Omit<
|
|
15
|
+
/** This must be kept in sync with DtoValidateResponse. */
|
|
16
|
+
export declare type CfgValidateResponse = Omit<DtoValidateResponse, "productData"> & {
|
|
17
17
|
productData: CfgProductData;
|
|
18
18
|
};
|
|
19
|
-
export declare function isModel(arg: unknown): arg is
|
|
19
|
+
export declare function isModel(arg: unknown): arg is DtoModel;
|
|
20
20
|
/** Replace empty strings with "-" for compatibility with the API. */
|
|
21
|
-
export declare function correctDefaultsOnCatalogueParams(catId:
|
|
22
|
-
export declare function recursivelyGetPriceCodeValue(priceCodes: string[], prices:
|
|
23
|
-
export declare function comparePricesObjects(prices1:
|
|
24
|
-
export declare const decodeCatalogueParams: <T extends
|
|
25
|
-
export declare const decodeProductParams: <T extends
|
|
26
|
-
export declare function isSameCatalogueParams(left:
|
|
27
|
-
export declare function isSameVector(left:
|
|
28
|
-
export declare function isSameOrientation(left:
|
|
29
|
-
export declare function isSameAnchor(left:
|
|
30
|
-
export declare function isSameTransform(left:
|
|
31
|
-
export declare function isSameProductRef(left:
|
|
21
|
+
export declare function correctDefaultsOnCatalogueParams<T extends DtoCatalogueParamsWithoutCid>(catId: T): T;
|
|
22
|
+
export declare function recursivelyGetPriceCodeValue(priceCodes: string[], prices: DtoPrices | undefined): number | undefined;
|
|
23
|
+
export declare function comparePricesObjects(prices1: DtoPrices | undefined, prices2: DtoPrices | undefined): boolean;
|
|
24
|
+
export declare const decodeCatalogueParams: <T extends DtoCatalogueParamsWithoutCid>(params: T) => T;
|
|
25
|
+
export declare const decodeProductParams: <T extends DtoProductParams>(params: T) => T;
|
|
26
|
+
export declare function isSameCatalogueParams(left: DtoCatalogueParamsWithoutCid, right: DtoCatalogueParamsWithoutCid): boolean;
|
|
27
|
+
export declare function isSameVector(left: DtoVector, right: DtoVector): boolean;
|
|
28
|
+
export declare function isSameOrientation(left: DtoOrientation, right: DtoOrientation): boolean;
|
|
29
|
+
export declare function isSameAnchor(left: DtoMeasureParam, right: DtoMeasureParam): boolean;
|
|
30
|
+
export declare function isSameTransform(left: DtoTransform, right: DtoTransform): boolean;
|
|
31
|
+
export declare function isSameProductRef(left: DtoAdditionalProductRef, right: DtoAdditionalProductRef): boolean;
|
|
32
|
+
export declare const isSameDtoCatalogueParamsWithLang: (left: DtoCatalogueParamsWithLang, right: DtoCatalogueParamsWithLang) => boolean;
|
|
33
|
+
export declare const isSameDtoProductParamsWithLang: (left: DtoProductParamsWithLang, right: DtoProductParamsWithLang) => boolean;
|
|
32
34
|
//# sourceMappingURL=utilitiesCatalogueData.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowCompareDictionaries } from "@configura/web-utilities";
|
|
2
|
-
export const makeCatalogueKey = (cat) => `${cat.enterprise}-${cat.prdCat}-${cat.prdCatVersion}-${cat.priceList}-${cat.vendor}`;
|
|
2
|
+
export const makeCatalogueKey = (cat) => `${cat.cid}-${cat.enterprise}-${cat.prdCat}-${cat.prdCatVersion}-${cat.priceList}-${cat.vendor}`;
|
|
3
3
|
export const makeProductKey = (cat, pKey) => `${makeCatalogueKey(cat)}-${pKey}`;
|
|
4
4
|
export const makeSelOptionsKey = (options) => options.reduce((p, option) => {
|
|
5
5
|
var _a;
|
|
@@ -22,13 +22,7 @@ export function isModel(arg) {
|
|
|
22
22
|
/** Replace empty strings with "-" for compatibility with the API. */
|
|
23
23
|
export function correctDefaultsOnCatalogueParams(catId) {
|
|
24
24
|
// Enterprise, prdCat and vendor have to be set, so we don't try and fix those
|
|
25
|
-
return {
|
|
26
|
-
enterprise: catId.enterprise,
|
|
27
|
-
prdCat: catId.prdCat,
|
|
28
|
-
prdCatVersion: catId.prdCatVersion || "-",
|
|
29
|
-
priceList: catId.priceList || "-",
|
|
30
|
-
vendor: catId.vendor,
|
|
31
|
-
};
|
|
25
|
+
return Object.assign(Object.assign({}, catId), { prdCatVersion: catId.prdCatVersion || "-", priceList: catId.priceList || "-" });
|
|
32
26
|
}
|
|
33
27
|
export function recursivelyGetPriceCodeValue(priceCodes, prices) {
|
|
34
28
|
while (prices) {
|
|
@@ -160,3 +154,11 @@ export function isSameProductRef(left, right) {
|
|
|
160
154
|
}
|
|
161
155
|
return true;
|
|
162
156
|
}
|
|
157
|
+
export const isSameDtoCatalogueParamsWithLang = (left, right) => left.cid === right.cid &&
|
|
158
|
+
left.lang === right.lang &&
|
|
159
|
+
left.enterprise === right.enterprise &&
|
|
160
|
+
left.prdCat === right.prdCat &&
|
|
161
|
+
left.prdCatVersion === right.prdCatVersion &&
|
|
162
|
+
left.priceList === right.priceList &&
|
|
163
|
+
left.vendor === right.vendor;
|
|
164
|
+
export const isSameDtoProductParamsWithLang = (left, right) => isSameDtoCatalogueParamsWithLang(left, right) && left.partNumber === right.partNumber;
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoCatalogueParams, DtoCataloguePermission } from "./CatalogueAPI.js";
|
|
2
2
|
interface CataloguePermissionByEnterpriseKey {
|
|
3
|
-
[key: string]:
|
|
3
|
+
[key: string]: DtoCataloguePermission[];
|
|
4
4
|
}
|
|
5
|
-
export declare const groupAndSortCataloguePermissions: (cataloguePermissions:
|
|
6
|
-
export declare const isParamSet: (param: string) => boolean;
|
|
7
|
-
export declare const createCataloguePermissionsFilter: (enterprise: string, prdCat: string, prdCatVersion: string, priceList: string, vendor: string) => (perm:
|
|
5
|
+
export declare const groupAndSortCataloguePermissions: (cataloguePermissions: DtoCataloguePermission[]) => CataloguePermissionByEnterpriseKey;
|
|
6
|
+
export declare const isParamSet: (param: string | undefined) => boolean;
|
|
7
|
+
export declare const createCataloguePermissionsFilter: (cid: number | undefined, enterprise: string | undefined, prdCat: string | undefined, prdCatVersion: string | undefined, priceList: string | undefined, vendor: string | undefined) => (perm: DtoCataloguePermission) => boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Sometimes you will want to use the latest available prdCatVersion. This method will
|
|
10
10
|
* find the highest prdCatVersion version in the cataloguePermissions. If the versions are
|
|
11
11
|
* numeric ("1", "4.3", "0.2") they will be numerically compared, otherwise non localized
|
|
12
12
|
* string compare.
|
|
13
|
-
* @param cataloguePermissions
|
|
14
|
-
* @param enterprise
|
|
15
|
-
* @param prdCat
|
|
16
|
-
* @param priceList
|
|
17
|
-
* @param vendor
|
|
18
13
|
*/
|
|
19
|
-
export declare const getPrdCatVersionFromPermissions: (cataloguePermissions:
|
|
14
|
+
export declare const getPrdCatVersionFromPermissions: (cataloguePermissions: DtoCataloguePermission[], cid: number | undefined, enterprise: string | undefined, prdCat: string | undefined, priceList: string | undefined, vendor: string | undefined) => string | undefined;
|
|
20
15
|
/**
|
|
21
16
|
* Sometimes you will want a missing prdCatVersion to represent "Get the current highest version".
|
|
22
17
|
* This method will, if the prdCatVersion is not set, fetch the highest available from the catalogue
|
|
@@ -24,7 +19,7 @@ export declare const getPrdCatVersionFromPermissions: (cataloguePermissions: Cat
|
|
|
24
19
|
* @param auth
|
|
25
20
|
* @param params
|
|
26
21
|
*/
|
|
27
|
-
export declare const getPrdCatVersionOrLatestFromPermissions: (params:
|
|
22
|
+
export declare const getPrdCatVersionOrLatestFromPermissions: (params: DtoCatalogueParams, cataloguePermissions: DtoCataloguePermission[]) => string;
|
|
28
23
|
/**
|
|
29
24
|
* Sometimes you will want a missing prdCatVersion to represent "Get the current highest version".
|
|
30
25
|
* This method will, if the prdCatVersion is not set, fetch the highest available from the
|
|
@@ -33,6 +28,6 @@ export declare const getPrdCatVersionOrLatestFromPermissions: (params: Catalogue
|
|
|
33
28
|
* @param auth
|
|
34
29
|
* @param params
|
|
35
30
|
*/
|
|
36
|
-
export declare const fillMissingPrdCatVersionFromPermissions: <T extends
|
|
31
|
+
export declare const fillMissingPrdCatVersionFromPermissions: <T extends DtoCatalogueParams>(params: T, cataloguePermissions: DtoCataloguePermission[]) => T;
|
|
37
32
|
export {};
|
|
38
33
|
//# sourceMappingURL=utilitiesCataloguePermission.d.ts.map
|
|
@@ -14,8 +14,9 @@ export const groupAndSortCataloguePermissions = (cataloguePermissions) => {
|
|
|
14
14
|
Object.keys(cataloguePermissionByEnterpriseKey).forEach((enterprise) => cataloguePermissionByEnterpriseKey[enterprise].sort((a, b) => a.prdCat.toLocaleLowerCase().localeCompare(b.prdCat.toLocaleLowerCase())));
|
|
15
15
|
return cataloguePermissionByEnterpriseKey;
|
|
16
16
|
};
|
|
17
|
-
export const isParamSet = (param) => param !== "" && param !== "-";
|
|
18
|
-
export const createCataloguePermissionsFilter = (enterprise, prdCat, prdCatVersion, priceList, vendor) => (perm) => (
|
|
17
|
+
export const isParamSet = (param) => param !== undefined && param !== "" && param !== "-";
|
|
18
|
+
export const createCataloguePermissionsFilter = (cid, enterprise, prdCat, prdCatVersion, priceList, vendor) => (perm) => (cid === undefined || cid === perm.cid) &&
|
|
19
|
+
(!isParamSet(enterprise) || enterprise === perm.enterprise) &&
|
|
19
20
|
(!isParamSet(prdCat) || prdCat === perm.prdCat) &&
|
|
20
21
|
(!isParamSet(prdCatVersion) || prdCatVersion === perm.prdCatVersion) &&
|
|
21
22
|
(!isParamSet(vendor) ||
|
|
@@ -29,14 +30,9 @@ export const createCataloguePermissionsFilter = (enterprise, prdCat, prdCatVersi
|
|
|
29
30
|
* find the highest prdCatVersion version in the cataloguePermissions. If the versions are
|
|
30
31
|
* numeric ("1", "4.3", "0.2") they will be numerically compared, otherwise non localized
|
|
31
32
|
* string compare.
|
|
32
|
-
* @param cataloguePermissions
|
|
33
|
-
* @param enterprise
|
|
34
|
-
* @param prdCat
|
|
35
|
-
* @param priceList
|
|
36
|
-
* @param vendor
|
|
37
33
|
*/
|
|
38
|
-
export const getPrdCatVersionFromPermissions = (cataloguePermissions, enterprise, prdCat, priceList, vendor) => {
|
|
39
|
-
const filter = createCataloguePermissionsFilter(enterprise, prdCat, "-", priceList, vendor);
|
|
34
|
+
export const getPrdCatVersionFromPermissions = (cataloguePermissions, cid, enterprise, prdCat, priceList, vendor) => {
|
|
35
|
+
const filter = createCataloguePermissionsFilter(cid, enterprise, prdCat, "-", priceList, vendor);
|
|
40
36
|
const applicablePermissions = cataloguePermissions.filter(filter);
|
|
41
37
|
return applicablePermissions.reduce((pVersion, c) => {
|
|
42
38
|
const cVersion = c.prdCatVersion;
|
|
@@ -59,11 +55,11 @@ export const getPrdCatVersionFromPermissions = (cataloguePermissions, enterprise
|
|
|
59
55
|
* @param params
|
|
60
56
|
*/
|
|
61
57
|
export const getPrdCatVersionOrLatestFromPermissions = (params, cataloguePermissions) => {
|
|
62
|
-
const { enterprise, prdCat, prdCatVersion, priceList, vendor } = params;
|
|
58
|
+
const { cid, enterprise, prdCat, prdCatVersion, priceList, vendor } = params;
|
|
63
59
|
if (isParamSet(prdCatVersion)) {
|
|
64
60
|
return prdCatVersion;
|
|
65
61
|
}
|
|
66
|
-
const highestFoundVersion = getPrdCatVersionFromPermissions(cataloguePermissions, enterprise, prdCat, priceList, vendor);
|
|
62
|
+
const highestFoundVersion = getPrdCatVersionFromPermissions(cataloguePermissions, cid, enterprise, prdCat, priceList, vendor);
|
|
67
63
|
if (highestFoundVersion === undefined) {
|
|
68
64
|
return prdCatVersion;
|
|
69
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoCodeRange } from "./CatalogueAPI.js";
|
|
2
2
|
export declare class NumericValuesSelection {
|
|
3
|
-
constructor(rawRanges:
|
|
3
|
+
constructor(rawRanges: DtoCodeRange[]);
|
|
4
4
|
readonly ranges: (NumericValueRangeDefinition | NumericValueDiscrete)[];
|
|
5
5
|
includesValue(value: number): boolean;
|
|
6
6
|
get first(): number;
|
|
@@ -14,7 +14,7 @@ export declare class NumericValueDiscrete {
|
|
|
14
14
|
get legend(): string;
|
|
15
15
|
}
|
|
16
16
|
export declare class NumericValueRangeDefinition {
|
|
17
|
-
constructor(rawRange:
|
|
17
|
+
constructor(rawRange: DtoCodeRange);
|
|
18
18
|
readonly minValue: number;
|
|
19
19
|
readonly maxValue: number;
|
|
20
20
|
readonly increment: number | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configura/web-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.0",
|
|
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": "
|
|
26
|
+
"@configura/web-utilities": "2.0.0-alpha.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "b802ecc481c41f8dd8342dc6eaf5010a86f0f85d"
|
|
29
29
|
}
|