@unchainedshop/core 5.0.0-alpha.1 → 5.0.0-alpha.2

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.
@@ -30,7 +30,7 @@ export default function createBulkExporterFactory(bulkExporterOptions) {
30
30
  }
31
31
  }
32
32
  catch (e) {
33
- throw new Error(`${type}: ${e.message}`);
33
+ throw new Error(`${type}: ${e.message}`, { cause: e });
34
34
  }
35
35
  },
36
36
  execute: async (payload, locales, unchainedApi) => {
@@ -41,9 +41,7 @@ export default async function createAssortment(payload, { logger, createShouldUp
41
41
  if (!createShouldUpsertIfIDExists)
42
42
  throw e;
43
43
  logger.debug('entity already exists, falling back to update', specification);
44
- await modules.assortments.update(_id, {
45
- ...specification,
46
- });
44
+ await modules.assortments.update(_id, { ...specification }, { skipInvalidation: true });
47
45
  }
48
46
  if (!(await modules.assortments.assortmentExists({ assortmentId: _id }))) {
49
47
  throw new Error(`Can't create assortment ${_id}, fields missing?`);
@@ -45,7 +45,7 @@ export default async function updateAssortment(payload, { logger, createShouldUp
45
45
  if (specification.tags) {
46
46
  specification.tags = convertTagsToLowerCase(specification.tags);
47
47
  }
48
- await unchainedAPI.modules.assortments.update(_id, { ...specification });
48
+ await unchainedAPI.modules.assortments.update(_id, { ...specification }, { skipInvalidation: true });
49
49
  if (specification.content) {
50
50
  logger.debug('replace localized content for assortment', specification.content);
51
51
  await modules.assortments.texts.updateTexts(_id, Object.entries(specification.content).map(([locale, localizedData]) => {
@@ -1,5 +1,7 @@
1
1
  import type { TokenSurrogate } from '@unchainedshop/core-warehousing';
2
+ import type { Product } from '@unchainedshop/core-products';
2
3
  import type { Modules } from '../modules.ts';
3
- export declare function isTokenInvalidateableService(this: Modules, { token, }: {
4
+ export declare function isTokenInvalidateableService(this: Modules, { token, product: providedProduct, }: {
4
5
  token: TokenSurrogate;
6
+ product?: Product;
5
7
  }): Promise<boolean>;
@@ -1,7 +1,7 @@
1
1
  import { WarehousingProviderType } from '@unchainedshop/core-warehousing';
2
2
  import { WarehousingDirector } from "../directors/WarehousingDirector.js";
3
- export async function isTokenInvalidateableService({ token, }) {
4
- const product = await this.products.findProduct({ productId: token.productId });
3
+ export async function isTokenInvalidateableService({ token, product: providedProduct, }) {
4
+ const product = providedProduct || (await this.products.findProduct({ productId: token.productId }));
5
5
  if (!product)
6
6
  return false;
7
7
  const virtualProviders = (await this.warehousing.allProviders()).filter(({ type }) => type === WarehousingProviderType.VIRTUAL);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/core",
3
3
  "description": "Core orchestration package for the Unchained Engine with business services and directors",
4
- "version": "5.0.0-alpha.1",
4
+ "version": "5.0.0-alpha.2",
5
5
  "main": "lib/core-index.js",
6
6
  "types": "lib/core-index.d.ts",
7
7
  "type": "module",