@configura/web-api 1.6.0-rc.0 → 1.6.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/CfgProduct.d.ts +5 -0
- package/dist/CfgProduct.js +14 -0
- package/dist/syncGroups/SyncGroupsHandler.d.ts +6 -1
- package/dist/syncGroups/SyncGroupsHandler.js +11 -2
- package/dist/syncGroups/SyncGroupsState.d.ts +10 -0
- package/dist/syncGroups/SyncGroupsState.js +17 -5
- package/package.json +3 -3
package/dist/CfgProduct.d.ts
CHANGED
|
@@ -135,6 +135,11 @@ export declare class _CfgProductInternal {
|
|
|
135
135
|
copyFrom: (source: _CfgProductInternal, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
136
136
|
private _setApiSelectionWithOtherProduct;
|
|
137
137
|
get syncGroupHandler(): SyncGroupsHandler | undefined;
|
|
138
|
+
get syncGroupsVerboseLogging(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Set to true to get verbose sync state changes logged to the console.
|
|
141
|
+
*/
|
|
142
|
+
set syncGroupsVerboseLogging(v: boolean);
|
|
138
143
|
structureCompare: (other: _CfgProductInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
|
|
139
144
|
tryMatchSelection: (other: _CfgProductInternal, descriptionMatch?: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
140
145
|
/** Only features in selected options and selected additional products. */
|
package/dist/CfgProduct.js
CHANGED
|
@@ -549,6 +549,20 @@ export class _CfgProductInternal {
|
|
|
549
549
|
get syncGroupHandler() {
|
|
550
550
|
return this.root._syncGroupHandler;
|
|
551
551
|
}
|
|
552
|
+
get syncGroupsVerboseLogging() {
|
|
553
|
+
var _a, _b;
|
|
554
|
+
return (_b = (_a = this.syncGroupHandler) === null || _a === void 0 ? void 0 : _a.verboseLogging) !== null && _b !== void 0 ? _b : false;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Set to true to get verbose sync state changes logged to the console.
|
|
558
|
+
*/
|
|
559
|
+
set syncGroupsVerboseLogging(v) {
|
|
560
|
+
const syncGroupHandler = this.syncGroupHandler;
|
|
561
|
+
if (syncGroupHandler === undefined) {
|
|
562
|
+
throw new Error("No syncGroupHandler, so can not change log verbosity");
|
|
563
|
+
}
|
|
564
|
+
syncGroupHandler.verboseLogging = v;
|
|
565
|
+
}
|
|
552
566
|
}
|
|
553
567
|
_CfgProductInternal.make = (productLoaderRaw, productLoaderForGroupedLoad, // Used when instantiating the current product
|
|
554
568
|
lang, catId, partNumber, settings, optional, loadingObservable, parent, root, additionalProductRef) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -15,10 +15,15 @@ export declare class SyncGroupsHandler {
|
|
|
15
15
|
readonly updateMode: SyncGroupsApplyMode;
|
|
16
16
|
private readonly _loadingObservable;
|
|
17
17
|
private _currentTransaction;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @param verboseLogging Set to true to get verbose sync state changes logged to the console.
|
|
20
|
+
*/
|
|
21
|
+
static make(updateMode?: SyncGroupsApplyMode, loadingObservable?: AggregatedLoadingObservable, verboseLogging?: boolean): SyncGroupsHandler;
|
|
19
22
|
private constructor();
|
|
20
23
|
/** Please note that clones will use the same loadingObservable as their source. */
|
|
21
24
|
clone(): SyncGroupsHandler;
|
|
25
|
+
get verboseLogging(): boolean;
|
|
26
|
+
set verboseLogging(v: boolean);
|
|
22
27
|
/** Used to initially apply the sync state onto a new product so that it is "in sync". */
|
|
23
28
|
init(product: _CfgProductInternal, productLoader: ProductLoader): Promise<void>;
|
|
24
29
|
/**
|
|
@@ -258,13 +258,22 @@ export class SyncGroupsHandler {
|
|
|
258
258
|
this.updateMode = updateMode;
|
|
259
259
|
this._loadingObservable = _loadingObservable;
|
|
260
260
|
}
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
/**
|
|
262
|
+
* @param verboseLogging Set to true to get verbose sync state changes logged to the console.
|
|
263
|
+
*/
|
|
264
|
+
static make(updateMode = SyncGroupsApplyMode.Strict, loadingObservable, verboseLogging = false) {
|
|
265
|
+
return new SyncGroupsHandler(new SyncGroupsState(verboseLogging), updateMode, loadingObservable);
|
|
263
266
|
}
|
|
264
267
|
/** Please note that clones will use the same loadingObservable as their source. */
|
|
265
268
|
clone() {
|
|
266
269
|
return new SyncGroupsHandler(this._syncState.clone(), this.updateMode, this._loadingObservable);
|
|
267
270
|
}
|
|
271
|
+
get verboseLogging() {
|
|
272
|
+
return this._syncState.verboseLogging;
|
|
273
|
+
}
|
|
274
|
+
set verboseLogging(v) {
|
|
275
|
+
this._syncState.verboseLogging = v;
|
|
276
|
+
}
|
|
268
277
|
/** Used to initially apply the sync state onto a new product so that it is "in sync". */
|
|
269
278
|
init(product, productLoader) {
|
|
270
279
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -6,8 +6,18 @@ import { OptionCode, SyncCode } from "./SyncGroupsHandler.js";
|
|
|
6
6
|
* are synced separately. See SyncGroupsHandler for details.
|
|
7
7
|
*/
|
|
8
8
|
export declare class SyncGroupsState {
|
|
9
|
+
private _verboseLogging;
|
|
9
10
|
readonly _selectOne: Map<SyncCode, OptionCode>;
|
|
10
11
|
readonly _selectMany: Map<SyncCode, Map<OptionCode, boolean>>;
|
|
12
|
+
/**
|
|
13
|
+
* @param verboseLogging Set to true to get verbose sync state changes logged to the console.
|
|
14
|
+
*/
|
|
15
|
+
constructor(_verboseLogging: boolean);
|
|
16
|
+
get verboseLogging(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Set to true to get verbose sync state changes logged to the console.
|
|
19
|
+
*/
|
|
20
|
+
set verboseLogging(v: boolean);
|
|
11
21
|
/**
|
|
12
22
|
* @returns a deep copy of the SyncGroupState.
|
|
13
23
|
*/
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** Set to true to get verbose sync state changes logged to the console. */
|
|
2
|
-
const SYNCSTATE_VERBOSE = true; // TODO: Disable before merge
|
|
3
1
|
/**
|
|
4
2
|
* The SyncState is used to keep track of the current value of the SyncGroups.
|
|
5
3
|
*
|
|
@@ -7,15 +5,28 @@ const SYNCSTATE_VERBOSE = true; // TODO: Disable before merge
|
|
|
7
5
|
* are synced separately. See SyncGroupsHandler for details.
|
|
8
6
|
*/
|
|
9
7
|
export class SyncGroupsState {
|
|
10
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @param verboseLogging Set to true to get verbose sync state changes logged to the console.
|
|
10
|
+
*/
|
|
11
|
+
constructor(_verboseLogging) {
|
|
12
|
+
this._verboseLogging = _verboseLogging;
|
|
11
13
|
this._selectOne = new Map();
|
|
12
14
|
this._selectMany = new Map();
|
|
13
15
|
}
|
|
16
|
+
get verboseLogging() {
|
|
17
|
+
return this._verboseLogging;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Set to true to get verbose sync state changes logged to the console.
|
|
21
|
+
*/
|
|
22
|
+
set verboseLogging(v) {
|
|
23
|
+
this._verboseLogging = v;
|
|
24
|
+
}
|
|
14
25
|
/**
|
|
15
26
|
* @returns a deep copy of the SyncGroupState.
|
|
16
27
|
*/
|
|
17
28
|
clone() {
|
|
18
|
-
return new SyncGroupsState().copyFrom(this);
|
|
29
|
+
return new SyncGroupsState(this._verboseLogging).copyFrom(this);
|
|
19
30
|
}
|
|
20
31
|
/**
|
|
21
32
|
* Replaces the internal state of this SyncGroupState with a deep copy of the one in source.
|
|
@@ -57,8 +68,9 @@ export class SyncGroupsState {
|
|
|
57
68
|
return (_a = this._selectMany.get(syncCode)) === null || _a === void 0 ? void 0 : _a.get(optionCode);
|
|
58
69
|
}
|
|
59
70
|
log(syncCode, optionCode, selected) {
|
|
60
|
-
if (!
|
|
71
|
+
if (!this._verboseLogging) {
|
|
61
72
|
return;
|
|
73
|
+
}
|
|
62
74
|
const isMany = selected !== undefined;
|
|
63
75
|
const selectOne = Array.from(this._selectOne.entries());
|
|
64
76
|
const selectMany = Array.from(this._selectMany.entries()).reduce((a, [groupCode, optionCodeToSelected]) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configura/web-api",
|
|
3
|
-
"version": "1.6.0
|
|
3
|
+
"version": "1.6.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": "1.6.0
|
|
26
|
+
"@configura/web-utilities": "1.6.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "ddfb00d506937c14e07dac2f51c2f0d06fab97a8"
|
|
29
29
|
}
|