@configura/web-api 1.6.1-alpha.4 → 1.6.1-alpha.5

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.
@@ -57,10 +57,6 @@ export declare type CfgPrice = {
57
57
  currency: string;
58
58
  fractionDigits: number;
59
59
  };
60
- export declare type RevalidateResult = {
61
- wasAborted: boolean;
62
- requestDidValidate: boolean;
63
- };
64
60
  /**
65
61
  * This class is meant to only be used through CfgProduct. It should never be instantiated on its
66
62
  * own. Normally the internal state of this class should never be directly modified. CfgProduct is
@@ -149,7 +145,7 @@ export declare class _CfgProductInternal {
149
145
  * product in isolation. The validation result is applied on the configuration. Then additional
150
146
  * products are synced (unloaded, loaded etc.) Finally the changes bubble up the tree.
151
147
  */
152
- _revalidate: (bubbleMode: CfgProductBubbleMode, productLoader: ProductLoader) => Promise<RevalidateResult>;
148
+ _revalidate: (bubbleMode: CfgProductBubbleMode, productLoader: ProductLoader) => Promise<boolean>;
153
149
  /**
154
150
  * Based on this configuration find what additional products should be shown and not, unload
155
151
  * (i.e. destroy) those that should no longer be shown, load the new ones.
@@ -293,7 +293,6 @@ export class _CfgProductInternal {
293
293
  this._revalidateInProgressToken = token;
294
294
  try {
295
295
  const response = yield productLoader.postValidate(Object.assign(Object.assign({ lang: this.lang }, correctDefaultsOnCatalogueParams(this.catId)), { partNumber: this.partNumber }), { selOptions: configuration.getApiSelection() });
296
- const requestDidValidate = response.validated;
297
296
  // The revalidateInProgressToken is used to know if some other revalidate
298
297
  // call has happened after this call, thereby making this call obsolete.
299
298
  // This is a bit crude in that it does not actually cancel previous validate
@@ -302,7 +301,7 @@ export class _CfgProductInternal {
302
301
  // of all, the heavy work happens on the server, and that work will not be
303
302
  // cancelled even if we would cancel the call.
304
303
  if (this._revalidateInProgressToken !== token) {
305
- return { wasAborted: true, requestDidValidate };
304
+ return false;
306
305
  }
307
306
  // After a successful validate-call we will always assume there
308
307
  // is a change. It would be possible to compare relevant parts
@@ -310,7 +309,7 @@ export class _CfgProductInternal {
310
309
  // syndAndLoad, however the code comparing productData would be fragile
311
310
  // and likely to break if new data-fields were added.
312
311
  if (this._destroyed) {
313
- return { wasAborted: true, requestDidValidate };
312
+ return false;
314
313
  }
315
314
  const { productData, rootFeatureRefs } = response;
316
315
  const pricesUpdated = !comparePricesObjects(this.prices, productData.partsData.prices);
@@ -325,10 +324,10 @@ export class _CfgProductInternal {
325
324
  yield configuration._internal.setApiSelection(productData.partsData.selOptions || [], false);
326
325
  yield this._syncAndLoadAdditionalProducts(productLoader);
327
326
  if (this._destroyed) {
328
- return { wasAborted: true, requestDidValidate };
327
+ return false;
329
328
  }
330
329
  yield this._notifyAllOfChange(bubbleMode);
331
- return { wasAborted: false, requestDidValidate };
330
+ return true;
332
331
  }
333
332
  catch (e) {
334
333
  throw e;
@@ -99,13 +99,7 @@ class SyncStateOnto {
99
99
  promises.push(product._revalidate(CfgProductBubbleMode.ToRoot, transaction.productLoader));
100
100
  }
101
101
  const revalidationResults = yield Promise.all(promises);
102
- // When using SyncGroups we require each and every validate call to validate on the
103
- // server. Without SyncGroups we let these pass through, because any diversion from
104
- // what you did chose should be immediately visible. With SyncGroups the end result
105
- // is the combination of potentially many different validate calls, and so errors
106
- // could accumulate and what is cause and effect be hard to know.
107
- if (!revalidationResults.every((r) => r.requestDidValidate) ||
108
- revalidationResults.every((r) => r.wasAborted)) {
102
+ if (revalidationResults.every((r) => !r)) {
109
103
  transaction.close();
110
104
  return false;
111
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/web-api",
3
- "version": "1.6.1-alpha.4",
3
+ "version": "1.6.1-alpha.5",
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.1-alpha.4"
26
+ "@configura/web-utilities": "1.6.1-alpha.5"
27
27
  },
28
- "gitHead": "e4dc2f02eff0ea5b4b69fa14e3ae456f505b3e58"
28
+ "gitHead": "6fba3fe5dd83d77fb9d6af90389a6c46b7bbf161"
29
29
  }