@configura/web-api 1.5.0 → 1.6.0-iotest.1
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/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/CatalogueAPI.d.ts +511 -511
- package/dist/CatalogueAPI.js +273 -273
- package/dist/CfgMeasure.d.ts +32 -32
- package/dist/CfgMeasure.js +30 -30
- package/dist/CfgProduct.d.ts +244 -239
- package/dist/CfgProduct.js +674 -668
- package/dist/index.d.ts +22 -18
- package/dist/index.js +22 -18
- package/dist/io/CfgHistoryManager.d.ts +30 -0
- package/dist/io/CfgHistoryManager.js +62 -0
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +10 -0
- package/dist/io/CfgHistoryToProdConfConnector.js +20 -0
- package/dist/io/CfgIOManager.d.ts +29 -0
- package/dist/io/CfgIOManager.js +89 -0
- package/dist/io/CfgIOProdConfConnector.d.ts +31 -0
- package/dist/io/CfgIOProdConfConnector.js +98 -0
- package/dist/io/CfgWindowMessageManager.d.ts +13 -0
- package/dist/io/CfgWindowMessageManager.js +28 -0
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +13 -0
- package/dist/io/CfgWindowMessageToProdConfConnector.js +17 -0
- package/dist/material/CfgMaterialMapping.d.ts +7 -7
- package/dist/material/CfgMaterialMapping.js +181 -181
- package/dist/material/CfgMtrlApplication.d.ts +18 -18
- package/dist/material/CfgMtrlApplication.js +43 -43
- package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
- package/dist/material/CfgMtrlApplicationSource.js +8 -8
- package/dist/material/CfgMtrlSource.d.ts +19 -19
- package/dist/material/CfgMtrlSource.js +40 -40
- package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
- package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
- package/dist/productConfiguration/CfgFeature.d.ts +178 -178
- package/dist/productConfiguration/CfgFeature.js +611 -611
- package/dist/productConfiguration/CfgOption.d.ts +128 -128
- package/dist/productConfiguration/CfgOption.js +394 -394
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +121 -120
- package/dist/productConfiguration/CfgProductConfiguration.js +306 -307
- package/dist/productConfiguration/filters.d.ts +15 -15
- package/dist/productConfiguration/filters.js +67 -67
- package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
- package/dist/productConfiguration/productParamsGenerator.js +51 -51
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
- package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -80
- package/dist/productLoader.d.ts +33 -33
- package/dist/productLoader.js +49 -49
- package/dist/tasks/TaskHandler.d.ts +78 -78
- package/dist/tasks/TaskHandler.js +265 -265
- package/dist/tasks/formats.d.ts +4 -4
- package/dist/tasks/formats.js +7 -7
- package/dist/tests/testData/collectorForTest.d.ts +73 -73
- package/dist/tests/testData/collectorForTest.js +195 -195
- package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
- package/dist/tests/testData/dummyProductForTest.js +36 -36
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +32 -32
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +348 -348
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
- package/dist/tests/testData/testDataCachedGetProduct.js +196 -196
- package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
- package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
- package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
- package/dist/tests/testData/testDataProductAggregatedPrice.js +198 -198
- package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
- package/dist/tests/testData/testDataUpcharge.js +151 -151
- package/dist/utilitiesCatalogueData.d.ts +25 -25
- package/dist/utilitiesCatalogueData.js +65 -64
- package/dist/utilitiesCataloguePermission.d.ts +39 -39
- package/dist/utilitiesCataloguePermission.js +84 -84
- package/dist/utilitiesNumericValues.d.ts +24 -24
- package/dist/utilitiesNumericValues.js +109 -109
- package/package.json +3 -3
package/dist/productLoader.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
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 { PromiseCache } from "@configura/web-utilities";
|
|
11
|
-
import { makeProductKey, makeSelOptionsKey, } from "./utilitiesCatalogueData.js";
|
|
12
|
-
/**
|
|
13
|
-
* Wraps a getProduct function so that it caches for the time it lives.
|
|
14
|
-
*
|
|
15
|
-
* It has no cache invalidation or timeouts, so whatever ends up in the cache stays there
|
|
16
|
-
* indefinitely. For this reason we recommend using this with caution.
|
|
17
|
-
*
|
|
18
|
-
* In our Example App we use it to cache the internal calls in additional products as in such a
|
|
19
|
-
* product you tend to frequently get calls to same sub-product. Such as loading the same table leg
|
|
20
|
-
* four times.
|
|
21
|
-
*/
|
|
22
|
-
export function wrapWithGetProductCache(getProduct) {
|
|
23
|
-
const cache = new PromiseCache();
|
|
24
|
-
return (params) => __awaiter(this, void 0, void 0, function* () { return cache.get(makeProductKey(params, params.partNumber), () => getProduct(params)); });
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Wraps a postValidate function so that it caches for the time it lives.
|
|
28
|
-
*
|
|
29
|
-
* It has no cache invalidation or timeouts, so whatever ends up in the cache stays there
|
|
30
|
-
* indefinitely. We recommend you do not use this unless you are really, really sure what you are
|
|
31
|
-
* doing.
|
|
32
|
-
*
|
|
33
|
-
* The SDK uses it for additional products to avoid validating for example the same table legs four
|
|
34
|
-
* times at the same time. There we make sure the this cache only stays in scope for one user
|
|
35
|
-
* interaction. No longer than the actions caused by a user clicking an option.
|
|
36
|
-
*/
|
|
37
|
-
export function wrapWithPostValidateCache(postValidate) {
|
|
38
|
-
const cache = new PromiseCache();
|
|
39
|
-
return (params, body) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
return cache.get(`${makeProductKey(params, params.partNumber)}-${makeSelOptionsKey(body.selOptions)}`, () => postValidate(params, body));
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
/** Does both wrapWithGetProductCache and wrapWithPostValidateCache. */
|
|
44
|
-
export function wrapWithCache(loader) {
|
|
45
|
-
return {
|
|
46
|
-
getProduct: wrapWithGetProductCache(loader.getProduct.bind(loader)),
|
|
47
|
-
postValidate: wrapWithPostValidateCache(loader.postValidate.bind(loader)),
|
|
48
|
-
};
|
|
49
|
-
}
|
|
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 { PromiseCache } from "@configura/web-utilities";
|
|
11
|
+
import { makeProductKey, makeSelOptionsKey, } from "./utilitiesCatalogueData.js";
|
|
12
|
+
/**
|
|
13
|
+
* Wraps a getProduct function so that it caches for the time it lives.
|
|
14
|
+
*
|
|
15
|
+
* It has no cache invalidation or timeouts, so whatever ends up in the cache stays there
|
|
16
|
+
* indefinitely. For this reason we recommend using this with caution.
|
|
17
|
+
*
|
|
18
|
+
* In our Example App we use it to cache the internal calls in additional products as in such a
|
|
19
|
+
* product you tend to frequently get calls to same sub-product. Such as loading the same table leg
|
|
20
|
+
* four times.
|
|
21
|
+
*/
|
|
22
|
+
export function wrapWithGetProductCache(getProduct) {
|
|
23
|
+
const cache = new PromiseCache();
|
|
24
|
+
return (params) => __awaiter(this, void 0, void 0, function* () { return cache.get(makeProductKey(params, params.partNumber), () => getProduct(params)); });
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Wraps a postValidate function so that it caches for the time it lives.
|
|
28
|
+
*
|
|
29
|
+
* It has no cache invalidation or timeouts, so whatever ends up in the cache stays there
|
|
30
|
+
* indefinitely. We recommend you do not use this unless you are really, really sure what you are
|
|
31
|
+
* doing.
|
|
32
|
+
*
|
|
33
|
+
* The SDK uses it for additional products to avoid validating for example the same table legs four
|
|
34
|
+
* times at the same time. There we make sure the this cache only stays in scope for one user
|
|
35
|
+
* interaction. No longer than the actions caused by a user clicking an option.
|
|
36
|
+
*/
|
|
37
|
+
export function wrapWithPostValidateCache(postValidate) {
|
|
38
|
+
const cache = new PromiseCache();
|
|
39
|
+
return (params, body) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return cache.get(`${makeProductKey(params, params.partNumber)}-${makeSelOptionsKey(body.selOptions)}`, () => postValidate(params, body));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Does both wrapWithGetProductCache and wrapWithPostValidateCache. */
|
|
44
|
+
export function wrapWithCache(loader) {
|
|
45
|
+
return {
|
|
46
|
+
getProduct: wrapWithGetProductCache(loader.getProduct.bind(loader)),
|
|
47
|
+
postValidate: wrapWithPostValidateCache(loader.postValidate.bind(loader)),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
-
import { AdditionalProductConfiguration, CatalogueAPI, ExportStatus, ExportStatusStatus, PostExportParams, PostRenderParams, RenderStatus, RenderStatusStatus, TargetCameraArgs } from "../CatalogueAPI.js";
|
|
3
|
-
import { CfgProduct } from "../CfgProduct.js";
|
|
4
|
-
import { RenderOrExportFormat } from "./formats.js";
|
|
5
|
-
export declare type TasksChangeNotification = {
|
|
6
|
-
freshRef: TaskHandler;
|
|
7
|
-
};
|
|
8
|
-
export declare type RenderTaskParams = {
|
|
9
|
-
targetCameraArgs?: TargetCameraArgs;
|
|
10
|
-
width: number;
|
|
11
|
-
height: number;
|
|
12
|
-
};
|
|
13
|
-
export declare type ProductParams = PostRenderParams | PostExportParams;
|
|
14
|
-
export declare class _TaskHandlerInternal {
|
|
15
|
-
api: CatalogueAPI;
|
|
16
|
-
readonly changeObservable: Observable<TasksChangeNotification>;
|
|
17
|
-
readonly tasks: Task<RenderOrExportFormat>[];
|
|
18
|
-
constructor(api: CatalogueAPI);
|
|
19
|
-
_notifyAllOfChange: () => Promise<void>;
|
|
20
|
-
destroy: () => void;
|
|
21
|
-
get hasExport(): boolean;
|
|
22
|
-
get hasRender(): boolean;
|
|
23
|
-
get availableFormats(): RenderOrExportFormat[];
|
|
24
|
-
start: (format: RenderOrExportFormat, product: CfgProduct, renderParams: RenderTaskParams | undefined, getPreviewUrl: (() => Promise<string>) | undefined) => Promise<void>;
|
|
25
|
-
addTask(task: Task<RenderOrExportFormat>): void;
|
|
26
|
-
removeTask(task: Task<RenderOrExportFormat>): void;
|
|
27
|
-
}
|
|
28
|
-
export declare class TaskHandler {
|
|
29
|
-
private readonly _internal;
|
|
30
|
-
static make(api: CatalogueAPI): TaskHandler;
|
|
31
|
-
/**
|
|
32
|
-
* Makes an object wrapping the passed object. This is not a clone method,
|
|
33
|
-
* it is a method to make a new outer reference. Like a shallow copy.
|
|
34
|
-
* We use this to help frameworks that are build around using equals to detect change.
|
|
35
|
-
*/
|
|
36
|
-
static _makeNewRefFrom(internal: _TaskHandlerInternal): TaskHandler;
|
|
37
|
-
private constructor();
|
|
38
|
-
destroy: () => void;
|
|
39
|
-
get tasks(): Task<RenderOrExportFormat>[];
|
|
40
|
-
get hasExport(): boolean;
|
|
41
|
-
get hasRender(): boolean;
|
|
42
|
-
get availableFormats(): RenderOrExportFormat[];
|
|
43
|
-
start: (format: RenderOrExportFormat, product: CfgProduct, renderParams?: RenderTaskParams | undefined, getPreviewUrl?: (() => Promise<string>) | undefined) => Promise<void>;
|
|
44
|
-
listenForChange: (l: SingleArgCallback<TasksChangeNotification>) => void;
|
|
45
|
-
stopListenForChange: (l: SingleArgCallback<TasksChangeNotification>) => void;
|
|
46
|
-
}
|
|
47
|
-
declare type TaskStatus = RenderStatusStatus | ExportStatusStatus | "abandoned";
|
|
48
|
-
export declare abstract class Task<F extends RenderOrExportFormat> {
|
|
49
|
-
protected readonly taskHandler: _TaskHandlerInternal;
|
|
50
|
-
readonly format: F;
|
|
51
|
-
private _timerId;
|
|
52
|
-
protected constructor(taskHandler: _TaskHandlerInternal, format: F, product: CfgProduct, getPreviewUrl: (() => Promise<string>) | undefined);
|
|
53
|
-
protected abstract postInit(): Promise<RenderStatus | ExportStatus>;
|
|
54
|
-
protected abstract pollStatus(): Promise<RenderStatus | ExportStatus>;
|
|
55
|
-
protected _productParams: ProductParams;
|
|
56
|
-
protected _apiSelection: AdditionalProductConfiguration;
|
|
57
|
-
private _status;
|
|
58
|
-
private _uuid;
|
|
59
|
-
private _created;
|
|
60
|
-
private _modified;
|
|
61
|
-
private _url;
|
|
62
|
-
private _previewUrl;
|
|
63
|
-
private setStatus;
|
|
64
|
-
get status(): TaskStatus;
|
|
65
|
-
get uuid(): string;
|
|
66
|
-
get created(): string;
|
|
67
|
-
get modified(): string;
|
|
68
|
-
get url(): string | undefined;
|
|
69
|
-
get previewUrl(): string | undefined;
|
|
70
|
-
private _start;
|
|
71
|
-
protected startAndRegister: () => Promise<void>;
|
|
72
|
-
restart: () => Promise<void>;
|
|
73
|
-
private scheduleRefresh;
|
|
74
|
-
private refresh;
|
|
75
|
-
private stop;
|
|
76
|
-
abort: () => void;
|
|
77
|
-
}
|
|
78
|
-
export {};
|
|
1
|
+
import { Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
+
import { AdditionalProductConfiguration, CatalogueAPI, ExportStatus, ExportStatusStatus, PostExportParams, PostRenderParams, RenderStatus, RenderStatusStatus, TargetCameraArgs } from "../CatalogueAPI.js";
|
|
3
|
+
import { CfgProduct } from "../CfgProduct.js";
|
|
4
|
+
import { RenderOrExportFormat } from "./formats.js";
|
|
5
|
+
export declare type TasksChangeNotification = {
|
|
6
|
+
freshRef: TaskHandler;
|
|
7
|
+
};
|
|
8
|
+
export declare type RenderTaskParams = {
|
|
9
|
+
targetCameraArgs?: TargetCameraArgs;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
export declare type ProductParams = PostRenderParams | PostExportParams;
|
|
14
|
+
export declare class _TaskHandlerInternal {
|
|
15
|
+
api: CatalogueAPI;
|
|
16
|
+
readonly changeObservable: Observable<TasksChangeNotification>;
|
|
17
|
+
readonly tasks: Task<RenderOrExportFormat>[];
|
|
18
|
+
constructor(api: CatalogueAPI);
|
|
19
|
+
_notifyAllOfChange: () => Promise<void>;
|
|
20
|
+
destroy: () => void;
|
|
21
|
+
get hasExport(): boolean;
|
|
22
|
+
get hasRender(): boolean;
|
|
23
|
+
get availableFormats(): RenderOrExportFormat[];
|
|
24
|
+
start: (format: RenderOrExportFormat, product: CfgProduct, renderParams: RenderTaskParams | undefined, getPreviewUrl: (() => Promise<string>) | undefined) => Promise<void>;
|
|
25
|
+
addTask(task: Task<RenderOrExportFormat>): void;
|
|
26
|
+
removeTask(task: Task<RenderOrExportFormat>): void;
|
|
27
|
+
}
|
|
28
|
+
export declare class TaskHandler {
|
|
29
|
+
private readonly _internal;
|
|
30
|
+
static make(api: CatalogueAPI): TaskHandler;
|
|
31
|
+
/**
|
|
32
|
+
* Makes an object wrapping the passed object. This is not a clone method,
|
|
33
|
+
* it is a method to make a new outer reference. Like a shallow copy.
|
|
34
|
+
* We use this to help frameworks that are build around using equals to detect change.
|
|
35
|
+
*/
|
|
36
|
+
static _makeNewRefFrom(internal: _TaskHandlerInternal): TaskHandler;
|
|
37
|
+
private constructor();
|
|
38
|
+
destroy: () => void;
|
|
39
|
+
get tasks(): Task<RenderOrExportFormat>[];
|
|
40
|
+
get hasExport(): boolean;
|
|
41
|
+
get hasRender(): boolean;
|
|
42
|
+
get availableFormats(): RenderOrExportFormat[];
|
|
43
|
+
start: (format: RenderOrExportFormat, product: CfgProduct, renderParams?: RenderTaskParams | undefined, getPreviewUrl?: (() => Promise<string>) | undefined) => Promise<void>;
|
|
44
|
+
listenForChange: (l: SingleArgCallback<TasksChangeNotification>) => void;
|
|
45
|
+
stopListenForChange: (l: SingleArgCallback<TasksChangeNotification>) => void;
|
|
46
|
+
}
|
|
47
|
+
declare type TaskStatus = RenderStatusStatus | ExportStatusStatus | "abandoned";
|
|
48
|
+
export declare abstract class Task<F extends RenderOrExportFormat> {
|
|
49
|
+
protected readonly taskHandler: _TaskHandlerInternal;
|
|
50
|
+
readonly format: F;
|
|
51
|
+
private _timerId;
|
|
52
|
+
protected constructor(taskHandler: _TaskHandlerInternal, format: F, product: CfgProduct, getPreviewUrl: (() => Promise<string>) | undefined);
|
|
53
|
+
protected abstract postInit(): Promise<RenderStatus | ExportStatus>;
|
|
54
|
+
protected abstract pollStatus(): Promise<RenderStatus | ExportStatus>;
|
|
55
|
+
protected _productParams: ProductParams;
|
|
56
|
+
protected _apiSelection: AdditionalProductConfiguration;
|
|
57
|
+
private _status;
|
|
58
|
+
private _uuid;
|
|
59
|
+
private _created;
|
|
60
|
+
private _modified;
|
|
61
|
+
private _url;
|
|
62
|
+
private _previewUrl;
|
|
63
|
+
private setStatus;
|
|
64
|
+
get status(): TaskStatus;
|
|
65
|
+
get uuid(): string;
|
|
66
|
+
get created(): string;
|
|
67
|
+
get modified(): string;
|
|
68
|
+
get url(): string | undefined;
|
|
69
|
+
get previewUrl(): string | undefined;
|
|
70
|
+
private _start;
|
|
71
|
+
protected startAndRegister: () => Promise<void>;
|
|
72
|
+
restart: () => Promise<void>;
|
|
73
|
+
private scheduleRefresh;
|
|
74
|
+
private refresh;
|
|
75
|
+
private stop;
|
|
76
|
+
abort: () => void;
|
|
77
|
+
}
|
|
78
|
+
export {};
|
|
79
79
|
//# sourceMappingURL=TaskHandler.d.ts.map
|