@unchainedshop/core 4.3.4 → 4.3.6

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.
Files changed (104) hide show
  1. package/lib/bulk-importer/createBulkImporter.d.ts +1 -1
  2. package/lib/bulk-importer/createBulkImporter.d.ts.map +1 -1
  3. package/lib/bulk-importer/handlers/assortment/create.d.ts +40 -480
  4. package/lib/bulk-importer/handlers/assortment/create.d.ts.map +1 -1
  5. package/lib/bulk-importer/handlers/assortment/create.js +1 -1
  6. package/lib/bulk-importer/handlers/assortment/create.js.map +1 -1
  7. package/lib/bulk-importer/handlers/assortment/remove.d.ts +2 -10
  8. package/lib/bulk-importer/handlers/assortment/remove.d.ts.map +1 -1
  9. package/lib/bulk-importer/handlers/assortment/update.d.ts +40 -480
  10. package/lib/bulk-importer/handlers/assortment/update.d.ts.map +1 -1
  11. package/lib/bulk-importer/handlers/assortment/update.js +1 -1
  12. package/lib/bulk-importer/handlers/assortment/update.js.map +1 -1
  13. package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +3 -15
  14. package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts.map +1 -1
  15. package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +1 -1
  16. package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js.map +1 -1
  17. package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +3 -15
  18. package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts.map +1 -1
  19. package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js +1 -1
  20. package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js.map +1 -1
  21. package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +3 -15
  22. package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts.map +1 -1
  23. package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js +1 -1
  24. package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js.map +1 -1
  25. package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +6 -54
  26. package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts.map +1 -1
  27. package/lib/bulk-importer/handlers/filter/create.d.ts +7 -107
  28. package/lib/bulk-importer/handlers/filter/create.d.ts.map +1 -1
  29. package/lib/bulk-importer/handlers/filter/create.js +1 -1
  30. package/lib/bulk-importer/handlers/filter/create.js.map +1 -1
  31. package/lib/bulk-importer/handlers/filter/remove.d.ts +1 -5
  32. package/lib/bulk-importer/handlers/filter/remove.d.ts.map +1 -1
  33. package/lib/bulk-importer/handlers/filter/update.d.ts +7 -107
  34. package/lib/bulk-importer/handlers/filter/update.d.ts.map +1 -1
  35. package/lib/bulk-importer/handlers/filter/update.js +1 -1
  36. package/lib/bulk-importer/handlers/filter/update.js.map +1 -1
  37. package/lib/bulk-importer/handlers/product/create.d.ts +61 -1155
  38. package/lib/bulk-importer/handlers/product/create.d.ts.map +1 -1
  39. package/lib/bulk-importer/handlers/product/create.js +2 -2
  40. package/lib/bulk-importer/handlers/product/create.js.map +1 -1
  41. package/lib/bulk-importer/handlers/product/remove.d.ts +2 -10
  42. package/lib/bulk-importer/handlers/product/remove.d.ts.map +1 -1
  43. package/lib/bulk-importer/handlers/product/update.d.ts +61 -1155
  44. package/lib/bulk-importer/handlers/product/update.d.ts.map +1 -1
  45. package/lib/bulk-importer/handlers/product/update.js +2 -2
  46. package/lib/bulk-importer/handlers/product/update.js.map +1 -1
  47. package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +6 -54
  48. package/lib/bulk-importer/handlers/product/upsertMedia.d.ts.map +1 -1
  49. package/lib/bulk-importer/handlers/product/upsertMedia.js +1 -1
  50. package/lib/bulk-importer/handlers/product/upsertMedia.js.map +1 -1
  51. package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +4 -58
  52. package/lib/bulk-importer/handlers/product/upsertVariations.d.ts.map +1 -1
  53. package/lib/bulk-importer/upsertAsset.d.ts +4 -16
  54. package/lib/bulk-importer/upsertAsset.d.ts.map +1 -1
  55. package/lib/bulk-importer/upsertAsset.js +7 -5
  56. package/lib/bulk-importer/upsertAsset.js.map +1 -1
  57. package/lib/directors/BasePricingSheet.d.ts.map +1 -1
  58. package/lib/directors/BasePricingSheet.js.map +1 -1
  59. package/lib/directors/FilterDirector.d.ts +2 -2
  60. package/lib/directors/FilterDirector.d.ts.map +1 -1
  61. package/lib/directors/FilterDirector.js +14 -11
  62. package/lib/directors/FilterDirector.js.map +1 -1
  63. package/lib/services/loadFilterOptions.js +1 -1
  64. package/lib/services/loadFilterOptions.js.map +1 -1
  65. package/lib/services/loadFilters.d.ts.map +1 -1
  66. package/lib/services/loadFilters.js +2 -1
  67. package/lib/services/loadFilters.js.map +1 -1
  68. package/package.json +1 -1
  69. package/src/bulk-importer/createBulkImporter.ts +1 -1
  70. package/src/bulk-importer/handlers/assortment/create.ts +1 -1
  71. package/src/bulk-importer/handlers/assortment/update.ts +1 -1
  72. package/src/bulk-importer/handlers/assortment/upsertAssortmentChildren.ts +1 -1
  73. package/src/bulk-importer/handlers/assortment/upsertAssortmentFilters.ts +1 -1
  74. package/src/bulk-importer/handlers/assortment/upsertAssortmentProducts.ts +1 -1
  75. package/src/bulk-importer/handlers/filter/create.ts +1 -1
  76. package/src/bulk-importer/handlers/filter/update.ts +1 -1
  77. package/src/bulk-importer/handlers/product/create.ts +2 -2
  78. package/src/bulk-importer/handlers/product/update.ts +2 -2
  79. package/src/bulk-importer/handlers/product/upsertMedia.ts +1 -1
  80. package/src/bulk-importer/upsertAsset.ts +8 -5
  81. package/src/directors/BasePricingSheet.ts +3 -2
  82. package/src/directors/FilterDirector.ts +31 -32
  83. package/src/services/loadFilterOptions.ts +1 -1
  84. package/src/services/loadFilters.ts +3 -1
  85. package/lib/factory/registerPhysicalWarehouse copy.d.ts +0 -10
  86. package/lib/factory/registerPhysicalWarehouse copy.d.ts.map +0 -1
  87. package/lib/factory/registerPhysicalWarehouse copy.js +0 -54
  88. package/lib/factory/registerPhysicalWarehouse copy.js.map +0 -1
  89. package/lib/factory/registerPhysicalWarehouse.d.ts +0 -10
  90. package/lib/factory/registerPhysicalWarehouse.d.ts.map +0 -1
  91. package/lib/factory/registerPhysicalWarehouse.js +0 -54
  92. package/lib/factory/registerPhysicalWarehouse.js.map +0 -1
  93. package/lib/factory/registerVirtualWarehouse.d.ts +0 -11
  94. package/lib/factory/registerVirtualWarehouse.d.ts.map +0 -1
  95. package/lib/factory/registerVirtualWarehouse.js +0 -51
  96. package/lib/factory/registerVirtualWarehouse.js.map +0 -1
  97. package/lib/factory/registerWarehouse.d.ts +0 -7
  98. package/lib/factory/registerWarehouse.d.ts.map +0 -1
  99. package/lib/factory/registerWarehouse.js +0 -35
  100. package/lib/factory/registerWarehouse.js.map +0 -1
  101. package/lib/factory/registerWorker copy.d.ts +0 -7
  102. package/lib/factory/registerWorker copy.d.ts.map +0 -1
  103. package/lib/factory/registerWorker copy.js +0 -35
  104. package/lib/factory/registerWorker copy.js.map +0 -1
@@ -23,7 +23,7 @@ export const FilterUpdatePayloadSchema = z.object({
23
23
  }),
24
24
  )
25
25
  .optional(),
26
- meta: z.record(z.unknown()).optional(),
26
+ meta: z.record(z.any(), z.any()).optional(),
27
27
  content: LocalizedContentSchema,
28
28
  }),
29
29
  });
@@ -54,7 +54,7 @@ export const ProductCreateSpecificationSchema = z.object({
54
54
  }),
55
55
  )
56
56
  .optional(),
57
- meta: z.record(z.unknown()).optional(),
57
+ meta: z.record(z.any(), z.any()).optional(),
58
58
  content: z.record(
59
59
  z.string(), // locale
60
60
  z.object({
@@ -70,7 +70,7 @@ export const ProductCreateSpecificationSchema = z.object({
70
70
  variationResolvers: z
71
71
  .array(
72
72
  z.object({
73
- vector: z.record(z.string()),
73
+ vector: z.record(z.string(), z.any()),
74
74
  productId: z.string(),
75
75
  }),
76
76
  )
@@ -54,7 +54,7 @@ export const ProductUpdateSpecificationSchema = z.object({
54
54
  }),
55
55
  )
56
56
  .optional(),
57
- meta: z.record(z.unknown()).optional(),
57
+ meta: z.record(z.any(), z.any()).optional(),
58
58
  content: z
59
59
  .record(
60
60
  z.string(), // locale
@@ -72,7 +72,7 @@ export const ProductUpdateSpecificationSchema = z.object({
72
72
  variationResolvers: z
73
73
  .array(
74
74
  z.object({
75
- vector: z.record(z.string()),
75
+ vector: z.record(z.string(), z.any()),
76
76
  productId: z.string(),
77
77
  }),
78
78
  )
@@ -40,7 +40,6 @@ export default async function upsertMedia(
40
40
 
41
41
  const productMediaObjects = await Promise.all(
42
42
  media.map(async ({ asset, content, ...mediaData }) => {
43
- const tags = mediaData?.tags ? convertTagsToLowerCase(mediaData?.tags)! : [];
44
43
  const file = await upsertAsset(
45
44
  'product-media',
46
45
  { meta: { ...(asset.meta || {}), productId }, ...asset },
@@ -48,6 +47,7 @@ export default async function upsertMedia(
48
47
  );
49
48
  if (!file) throw new Error(`Unable to create binary ${asset._id}`);
50
49
  const fileId = file._id;
50
+ const tags = mediaData?.tags ? convertTagsToLowerCase(mediaData?.tags)! : [];
51
51
  const productMedia = await upsertProductMedia(
52
52
  {
53
53
  ...mediaData,
@@ -1,13 +1,16 @@
1
+ import { createLogger } from '@unchainedshop/logger';
1
2
  import { Modules } from '../modules.js';
2
3
  import { Services } from '../services/index.js';
3
4
  import { z } from 'zod';
4
5
 
6
+ const logger = createLogger('unchained:bulk-import');
7
+
5
8
  export const AssetSchema = z.object({
6
9
  _id: z.string().optional(),
7
10
  url: z.string(),
8
- meta: z.record(z.unknown()).optional(),
11
+ meta: z.record(z.any(), z.any()).optional(),
9
12
  fileName: z.string(),
10
- headers: z.record(z.string()).optional(),
13
+ headers: z.record(z.string(), z.any()).optional(),
11
14
  });
12
15
 
13
16
  const upsertAsset = async (
@@ -40,9 +43,9 @@ const upsertAsset = async (
40
43
  meta,
41
44
  });
42
45
 
43
- if (!assetObject) throw new Error('Media not created');
44
- return assetObject;
45
- } catch {
46
+ if (!assetObject) return null;
47
+ } catch (e) {
48
+ logger.warn(`Unable to upsert asset ${fileId || fileName}: ${e.message}`);
46
49
  return null;
47
50
  }
48
51
  };
@@ -5,8 +5,9 @@ export interface PricingDiscount {
5
5
  currencyCode: string;
6
6
  }
7
7
 
8
- export interface IPricingSheet<Calculation extends PricingCalculation>
9
- extends IBasePricingSheet<Calculation> {
8
+ export interface IPricingSheet<
9
+ Calculation extends PricingCalculation,
10
+ > extends IBasePricingSheet<Calculation> {
10
11
  discountPrices: (discountId?: string) => PricingDiscount[];
11
12
  addDiscount: (params: { amount: number; discountId: string; meta?: any }) => void;
12
13
  }
@@ -40,14 +40,14 @@ export type IFilterDirector = IBaseDirector<IFilterAdapter> & {
40
40
  filter: Filter,
41
41
  { values, forceLiveCollection }: { values: string[]; forceLiveCollection?: boolean },
42
42
  unchainedAPI: { modules: Modules },
43
- ) => Promise<string[]>;
43
+ ) => Promise<Set<string>>;
44
44
 
45
45
  filterFacets: (
46
46
  filter: Filter,
47
47
  params: {
48
48
  searchQuery: SearchQuery;
49
49
  forceLiveCollection?: boolean;
50
- allProductIds: string[];
50
+ allProductIdSet: Set<string>;
51
51
  otherFilters: Filter[];
52
52
  },
53
53
  unchainedAPI: { modules: Modules },
@@ -177,7 +177,7 @@ export const FilterDirector: IFilterDirector = {
177
177
  filter: Filter,
178
178
  { values, forceLiveCollection }: { values: string[]; forceLiveCollection?: boolean },
179
179
  unchainedAPI: { modules: Modules },
180
- ) {
180
+ ): Promise<Set<string>> {
181
181
  const [allProductIds, keyToProductIdMap]: [string[], Record<string, string[]>] =
182
182
  (!forceLiveCollection && (await filtersSettings.getCachedProductIds(filter._id))) ||
183
183
  (await this.buildProductIdMap(filter, unchainedAPI));
@@ -187,11 +187,14 @@ export const FilterDirector: IFilterDirector = {
187
187
  values,
188
188
  Object.keys(keyToProductIdMap),
189
189
  );
190
- const result: string[] = [];
191
- for (const key of filteredKeys) {
192
- const additionalValues = key === undefined ? allProductIds : keyToProductIdMap[key];
190
+
191
+ if (filteredKeys.includes(undefined)) return new Set(allProductIds);
192
+
193
+ const result = new Set<string>();
194
+ for (const key of filteredKeys as string[]) {
195
+ const additionalValues = keyToProductIdMap[key];
193
196
  if (additionalValues) {
194
- result.push(...additionalValues);
197
+ for (const val of additionalValues) result.add(val);
195
198
  }
196
199
  }
197
200
  return result;
@@ -233,7 +236,7 @@ export const FilterDirector: IFilterDirector = {
233
236
  unchainedAPI,
234
237
  );
235
238
 
236
- return productIdSet.intersection(new Set(filterOptionProductIds));
239
+ return productIdSet.intersection(filterOptionProductIds);
237
240
  },
238
241
  Promise.resolve(new Set(productIds)),
239
242
  );
@@ -242,7 +245,7 @@ export const FilterDirector: IFilterDirector = {
242
245
  },
243
246
 
244
247
  async filterFacets(filter, params, unchainedAPI) {
245
- const { allProductIds, searchQuery, forceLiveCollection, otherFilters } = params;
248
+ const { allProductIdSet, searchQuery, forceLiveCollection, otherFilters } = params;
246
249
 
247
250
  const filterQueryParsed = parseQueryArray(searchQuery.filterQuery);
248
251
 
@@ -258,35 +261,33 @@ export const FilterDirector: IFilterDirector = {
258
261
  unchainedAPI,
259
262
  );
260
263
 
261
- const examinedProductIdSet = new Set(allProductIds).intersection(new Set(filteredProductIds));
264
+ // Optimize: Create Set from allProductIds, iterate through smaller filteredProductIds
265
+ const examinedProductIdSet = allProductIdSet.intersection(filteredProductIds);
262
266
  const values = filterQueryParsed[filter.key];
263
267
 
264
- // The filteredProductIdSet is a set of product id's that:
268
+ // The filteredProductIds is a set of product id's that:
265
269
  // - Are filtered by all other filters
266
270
  // - Are filtered by the currently selected value of this filter
267
271
  // or if there is no currently selected value:
268
272
  // - Is the same like examinedProductIdSet
269
273
  const filteredByOtherFiltersSet = await otherFilters
270
274
  .filter((otherFilter) => otherFilter.key !== filter.key)
271
- .reduce(
272
- async (productIdSetPromise, otherFilter) => {
273
- if (otherFilter.key === filter.key) return productIdSetPromise;
274
- if (!filterQueryParsed[otherFilter.key]) return productIdSetPromise;
275
- const productIdSet = await productIdSetPromise;
276
- const otherFilterProductIds = await this.filterProductIds(
277
- otherFilter,
278
- {
279
- values: filterQueryParsed[otherFilter.key],
280
- forceLiveCollection,
281
- },
282
- unchainedAPI,
283
- );
284
- return productIdSet.intersection(new Set(otherFilterProductIds));
285
- },
286
- Promise.resolve(new Set(examinedProductIdSet)),
287
- );
288
-
289
- const filterProductIdsForValues = values
275
+ .reduce(async (productIdSetPromise, otherFilter) => {
276
+ if (otherFilter.key === filter.key) return productIdSetPromise;
277
+ if (!filterQueryParsed[otherFilter.key]) return productIdSetPromise;
278
+ const productIdSet = await productIdSetPromise;
279
+ const otherFilterProductIds = await this.filterProductIds(
280
+ otherFilter,
281
+ {
282
+ values: filterQueryParsed[otherFilter.key],
283
+ forceLiveCollection,
284
+ },
285
+ unchainedAPI,
286
+ );
287
+ return productIdSet.intersection(otherFilterProductIds);
288
+ }, Promise.resolve(examinedProductIdSet));
289
+
290
+ const filteredByThisFilterSet = values
290
291
  ? await this.filterProductIds(
291
292
  filter,
292
293
  {
@@ -297,8 +298,6 @@ export const FilterDirector: IFilterDirector = {
297
298
  )
298
299
  : filteredProductIds;
299
300
 
300
- const filteredByThisFilterSet = new Set<string>(filterProductIdsForValues);
301
-
302
301
  return {
303
302
  examinedProductIdSet,
304
303
  filteredByOtherFiltersSet,
@@ -27,7 +27,7 @@ export async function loadFilterOptionsService(
27
27
  },
28
28
  { modules: this },
29
29
  );
30
- const filteredProductIdSet = productIdSet.intersection(new Set(filterOptionProductIds));
30
+ const filteredProductIdSet = productIdSet.intersection(filterOptionProductIds);
31
31
 
32
32
  const normalizedValues = values && this.filters.parse(filter, values, [value]);
33
33
  const isSelected = normalizedValues && normalizedValues.indexOf(value) !== -1;
@@ -33,6 +33,8 @@ export async function loadFiltersService(
33
33
  return leftIndex - rightIndex;
34
34
  });
35
35
 
36
+ const allProductIdSet = new Set(options.productIds || []);
37
+
36
38
  return Promise.all(
37
39
  sortedFilters.map(async (filter) => {
38
40
  const { examinedProductIdSet, filteredByOtherFiltersSet, filteredByThisFilterSet } =
@@ -41,7 +43,7 @@ export async function loadFiltersService(
41
43
  {
42
44
  searchQuery,
43
45
  forceLiveCollection: !!options.forceLiveCollection,
44
- allProductIds: options.productIds,
46
+ allProductIdSet,
45
47
  otherFilters: sortedFilters,
46
48
  },
47
49
  { modules: this },
@@ -1,10 +0,0 @@
1
- import { WarehousingConfiguration } from '@unchainedshop/core-warehousing';
2
- import { WarehousingContext } from '../core-index.js';
3
- export default function registerPhysicalWarehouse({ adapterId, orderIndex, stock, productionTime, commissioningTime, }: {
4
- adapterId: string;
5
- orderIndex?: number;
6
- stock?: number | ((referenceDate: Date, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<number>);
7
- productionTime?: number | ((quantityToProduct: number, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<number>);
8
- commissioningTime?: number | ((quantity: number, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<number>);
9
- }): void;
10
- //# sourceMappingURL=registerPhysicalWarehouse%20copy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerPhysicalWarehouse copy.d.ts","sourceRoot":"","sources":["../../src/factory/registerPhysicalWarehouse copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAA2B,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAsB,kBAAkB,EAAuB,MAAM,kBAAkB,CAAC;AAE/F,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAChD,SAAS,EACT,UAAc,EACd,KAAK,EACL,cAAc,EACd,iBAAiB,GAClB,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EACF,MAAM,GACN,CAAC,CACC,aAAa,EAAE,IAAI,EACnB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1B,cAAc,CAAC,EACX,MAAM,GACN,CAAC,CACC,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1B,iBAAiB,CAAC,EACd,MAAM,GACN,CAAC,CACC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;CAC3B,QAwDA"}
@@ -1,54 +0,0 @@
1
- import { WarehousingProviderType } from '@unchainedshop/core-warehousing';
2
- import { WarehousingAdapter, WarehousingDirector } from '../core-index.js';
3
- export default function registerPhysicalWarehouse({ adapterId, orderIndex = 0, stock, productionTime, commissioningTime, }) {
4
- WarehousingDirector.registerAdapter({
5
- ...WarehousingAdapter,
6
- key: 'shop.unchained.warehousing.physical.' + adapterId,
7
- label: 'Store',
8
- version: '1.0.0',
9
- orderIndex,
10
- initialConfiguration: [{ key: 'shipping-hub', value: 'Shipping Hub' }],
11
- typeSupported: (type) => {
12
- return type === WarehousingProviderType.PHYSICAL;
13
- },
14
- actions: (configuration, context) => {
15
- return {
16
- ...WarehousingAdapter.actions(configuration, context),
17
- isActive() {
18
- return true;
19
- },
20
- configurationError() {
21
- return null;
22
- },
23
- stock: async () => {
24
- if (typeof stock === 'number') {
25
- return stock;
26
- }
27
- else if (typeof stock === 'function') {
28
- return stock(new Date(), configuration, context);
29
- }
30
- return 99999;
31
- },
32
- productionTime: async (quantityToProduct) => {
33
- if (typeof productionTime === 'number') {
34
- return productionTime;
35
- }
36
- else if (typeof productionTime === 'function') {
37
- return productionTime(quantityToProduct, configuration, context);
38
- }
39
- return 0;
40
- },
41
- commissioningTime: async (quantity) => {
42
- if (typeof commissioningTime === 'number') {
43
- return commissioningTime;
44
- }
45
- else if (typeof commissioningTime === 'function') {
46
- return commissioningTime(quantity, configuration, context);
47
- }
48
- return 0;
49
- },
50
- };
51
- },
52
- });
53
- }
54
- //# sourceMappingURL=registerPhysicalWarehouse%20copy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerPhysicalWarehouse copy.js","sourceRoot":"","sources":["../../src/factory/registerPhysicalWarehouse copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,kBAAkB,EAAsB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE/F,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAChD,SAAS,EACT,UAAU,GAAG,CAAC,EACd,KAAK,EACL,cAAc,EACd,iBAAiB,GA2BlB;IACC,mBAAmB,CAAC,eAAe,CAAC;QAClC,GAAG,kBAAkB;QAErB,GAAG,EAAE,sCAAsC,GAAG,SAAS;QACvD,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,OAAO;QAChB,UAAU;QAEV,oBAAoB,EAAE,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;QAEtE,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;YACtB,OAAO,IAAI,KAAK,uBAAuB,CAAC,QAAQ,CAAC;QACnD,CAAC;QAED,OAAO,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;YAClC,OAAO;gBACL,GAAG,kBAAkB,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC;gBAErD,QAAQ;oBACN,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,kBAAkB;oBAChB,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,KAAK,EAAE,KAAK,IAAI,EAAE;oBAChB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;wBAC9B,OAAO,KAAK,CAAC;oBACf,CAAC;yBAAM,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;wBACvC,OAAO,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;oBACnD,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,cAAc,EAAE,KAAK,EAAE,iBAAyB,EAAE,EAAE;oBAClD,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;wBACvC,OAAO,cAAc,CAAC;oBACxB,CAAC;yBAAM,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE,CAAC;wBAChD,OAAO,cAAc,CAAC,iBAAiB,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;oBACnE,CAAC;oBACD,OAAO,CAAC,CAAC;gBACX,CAAC;gBAED,iBAAiB,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE;oBAC5C,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE,CAAC;wBAC1C,OAAO,iBAAiB,CAAC;oBAC3B,CAAC;yBAAM,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;wBACnD,OAAO,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;oBAC7D,CAAC;oBACD,OAAO,CAAC,CAAC;gBACX,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,10 +0,0 @@
1
- import { WarehousingConfiguration } from '@unchainedshop/core-warehousing';
2
- import { WarehousingContext } from '../core-index.js';
3
- export default function registerPhysicalWarehouse({ adapterId, orderIndex, stock, productionTime, commissioningTime, }: {
4
- adapterId: string;
5
- orderIndex?: number;
6
- stock?: number | ((referenceDate: Date, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<number>);
7
- productionTime?: number | ((quantityToProduct: number, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<number>);
8
- commissioningTime?: number | ((quantity: number, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<number>);
9
- }): void;
10
- //# sourceMappingURL=registerPhysicalWarehouse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerPhysicalWarehouse.d.ts","sourceRoot":"","sources":["../../src/factory/registerPhysicalWarehouse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAA2B,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAsB,kBAAkB,EAAuB,MAAM,kBAAkB,CAAC;AAE/F,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAChD,SAAS,EACT,UAAc,EACd,KAAK,EACL,cAAc,EACd,iBAAiB,GAClB,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EACF,MAAM,GACN,CAAC,CACC,aAAa,EAAE,IAAI,EACnB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1B,cAAc,CAAC,EACX,MAAM,GACN,CAAC,CACC,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1B,iBAAiB,CAAC,EACd,MAAM,GACN,CAAC,CACC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;CAC3B,QAwDA"}
@@ -1,54 +0,0 @@
1
- import { WarehousingProviderType } from '@unchainedshop/core-warehousing';
2
- import { WarehousingAdapter, WarehousingDirector } from '../core-index.js';
3
- export default function registerPhysicalWarehouse({ adapterId, orderIndex = 0, stock, productionTime, commissioningTime, }) {
4
- WarehousingDirector.registerAdapter({
5
- ...WarehousingAdapter,
6
- key: 'shop.unchained.warehousing.physical.' + adapterId,
7
- label: 'Physical Warehousing: ' + adapterId,
8
- version: '1.0.0',
9
- orderIndex,
10
- initialConfiguration: [{ key: 'shipping-hub', value: 'Shipping Hub' }],
11
- typeSupported: (type) => {
12
- return type === WarehousingProviderType.PHYSICAL;
13
- },
14
- actions: (configuration, context) => {
15
- return {
16
- ...WarehousingAdapter.actions(configuration, context),
17
- isActive() {
18
- return true;
19
- },
20
- configurationError() {
21
- return null;
22
- },
23
- stock: async (referenceDate) => {
24
- if (typeof stock === 'number') {
25
- return stock;
26
- }
27
- else if (typeof stock === 'function') {
28
- return stock(referenceDate, configuration, context);
29
- }
30
- return 99999;
31
- },
32
- productionTime: async (quantityToProduct) => {
33
- if (typeof productionTime === 'number') {
34
- return productionTime;
35
- }
36
- else if (typeof productionTime === 'function') {
37
- return productionTime(quantityToProduct, configuration, context);
38
- }
39
- return 0;
40
- },
41
- commissioningTime: async (quantity) => {
42
- if (typeof commissioningTime === 'number') {
43
- return commissioningTime;
44
- }
45
- else if (typeof commissioningTime === 'function') {
46
- return commissioningTime(quantity, configuration, context);
47
- }
48
- return 0;
49
- },
50
- };
51
- },
52
- });
53
- }
54
- //# sourceMappingURL=registerPhysicalWarehouse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerPhysicalWarehouse.js","sourceRoot":"","sources":["../../src/factory/registerPhysicalWarehouse.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,kBAAkB,EAAsB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE/F,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAChD,SAAS,EACT,UAAU,GAAG,CAAC,EACd,KAAK,EACL,cAAc,EACd,iBAAiB,GA2BlB;IACC,mBAAmB,CAAC,eAAe,CAAC;QAClC,GAAG,kBAAkB;QAErB,GAAG,EAAE,sCAAsC,GAAG,SAAS;QACvD,KAAK,EAAE,wBAAwB,GAAG,SAAS;QAC3C,OAAO,EAAE,OAAO;QAChB,UAAU;QAEV,oBAAoB,EAAE,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;QAEtE,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;YACtB,OAAO,IAAI,KAAK,uBAAuB,CAAC,QAAQ,CAAC;QACnD,CAAC;QAED,OAAO,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;YAClC,OAAO;gBACL,GAAG,kBAAkB,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC;gBAErD,QAAQ;oBACN,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,kBAAkB;oBAChB,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE;oBAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;wBAC9B,OAAO,KAAK,CAAC;oBACf,CAAC;yBAAM,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;wBACvC,OAAO,KAAK,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;oBACtD,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,cAAc,EAAE,KAAK,EAAE,iBAAyB,EAAE,EAAE;oBAClD,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;wBACvC,OAAO,cAAc,CAAC;oBACxB,CAAC;yBAAM,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE,CAAC;wBAChD,OAAO,cAAc,CAAC,iBAAiB,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;oBACnE,CAAC;oBACD,OAAO,CAAC,CAAC;gBACX,CAAC;gBAED,iBAAiB,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE;oBAC5C,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE,CAAC;wBAC1C,OAAO,iBAAiB,CAAC;oBAC3B,CAAC;yBAAM,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;wBACnD,OAAO,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;oBAC7D,CAAC;oBACD,OAAO,CAAC,CAAC;gBACX,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,11 +0,0 @@
1
- import { TokenSurrogate, WarehousingConfiguration } from '@unchainedshop/core-warehousing';
2
- import { WarehousingContext } from '../core-index.js';
3
- export default function registerVirtualWarehouse<Metadata = Record<string, any>>({ adapterId, orderIndex, stock, tokenize, tokenMetadata, isInvalidateable, }: {
4
- adapterId: string;
5
- orderIndex?: number;
6
- stock?: number | ((referenceDate: Date, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<number>);
7
- tokenize: (configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<Omit<TokenSurrogate, 'userId' | 'productId' | 'orderPositionId'>[]>;
8
- tokenMetadata?: (serialNumber: string, referenceDate: Date, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<Metadata>;
9
- isInvalidateable?: (serialNumber: string, referenceDate: Date, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<boolean>;
10
- }): void;
11
- //# sourceMappingURL=registerVirtualWarehouse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerVirtualWarehouse.d.ts","sourceRoot":"","sources":["../../src/factory/registerVirtualWarehouse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,wBAAwB,EAEzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAsB,kBAAkB,EAAuB,MAAM,kBAAkB,CAAC;AAE/F,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAC/E,SAAS,EACT,UAAc,EACd,KAAK,EACL,QAAQ,EACR,aAAa,EACb,gBAAgB,GACjB,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EACF,MAAM,GACN,CAAC,CACC,aAAa,EAAE,IAAI,EACnB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1B,QAAQ,EAAE,CACR,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,WAAW,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAEjF,aAAa,CAAC,EAAE,CACd,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,IAAI,EACnB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEvB,gBAAgB,CAAC,EAAE,CACjB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,IAAI,EACnB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,OAAO,CAAC,CAAC;CACvB,QAwDA"}
@@ -1,51 +0,0 @@
1
- import { WarehousingProviderType, } from '@unchainedshop/core-warehousing';
2
- import { WarehousingAdapter, WarehousingDirector } from '../core-index.js';
3
- export default function registerVirtualWarehouse({ adapterId, orderIndex = 0, stock, tokenize, tokenMetadata, isInvalidateable, }) {
4
- WarehousingDirector.registerAdapter({
5
- ...WarehousingAdapter,
6
- key: 'shop.unchained.warehousing.virtual.' + adapterId,
7
- label: 'Virtual Wareshousing: ' + adapterId,
8
- version: '1.0.0',
9
- orderIndex,
10
- initialConfiguration: [{ key: 'shipping-hub', value: 'Shipping Hub' }],
11
- typeSupported: (type) => {
12
- return type === WarehousingProviderType.VIRTUAL;
13
- },
14
- actions: (configuration, context) => {
15
- return {
16
- ...WarehousingAdapter.actions(configuration, context),
17
- isActive() {
18
- return true;
19
- },
20
- configurationError() {
21
- return null;
22
- },
23
- stock: async (referenceDate) => {
24
- if (typeof stock === 'number') {
25
- return stock;
26
- }
27
- else if (typeof stock === 'function') {
28
- return stock(referenceDate, configuration, context);
29
- }
30
- return 99999;
31
- },
32
- async tokenize() {
33
- return tokenize(configuration, context);
34
- },
35
- async tokenMetadata(serialNumber, referenceDate) {
36
- if (tokenMetadata) {
37
- return tokenMetadata(serialNumber, referenceDate, configuration, context);
38
- }
39
- return null;
40
- },
41
- async isInvalidateable(serialNumber, referenceDate) {
42
- if (isInvalidateable) {
43
- return isInvalidateable(serialNumber, referenceDate, configuration, context);
44
- }
45
- return false;
46
- },
47
- };
48
- },
49
- });
50
- }
51
- //# sourceMappingURL=registerVirtualWarehouse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerVirtualWarehouse.js","sourceRoot":"","sources":["../../src/factory/registerVirtualWarehouse.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAsB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE/F,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAiC,EAC/E,SAAS,EACT,UAAU,GAAG,CAAC,EACd,KAAK,EACL,QAAQ,EACR,aAAa,EACb,gBAAgB,GA8BjB;IACC,mBAAmB,CAAC,eAAe,CAAC;QAClC,GAAG,kBAAkB;QAErB,GAAG,EAAE,qCAAqC,GAAG,SAAS;QACtD,KAAK,EAAE,wBAAwB,GAAG,SAAS;QAC3C,OAAO,EAAE,OAAO;QAChB,UAAU;QAEV,oBAAoB,EAAE,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;QAEtE,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;YACtB,OAAO,IAAI,KAAK,uBAAuB,CAAC,OAAO,CAAC;QAClD,CAAC;QAED,OAAO,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;YAClC,OAAO;gBACL,GAAG,kBAAkB,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC;gBAErD,QAAQ;oBACN,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,kBAAkB;oBAChB,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE;oBAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;wBAC9B,OAAO,KAAK,CAAC;oBACf,CAAC;yBAAM,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;wBACvC,OAAO,KAAK,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;oBACtD,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,KAAK,CAAC,QAAQ;oBACZ,OAAO,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;gBAC1C,CAAC;gBAED,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,aAAa;oBAC7C,IAAI,aAAa,EAAE,CAAC;wBAClB,OAAO,aAAa,CAAC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;oBAC5E,CAAC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,KAAK,CAAC,gBAAgB,CAAC,YAAY,EAAE,aAAa;oBAChD,IAAI,gBAAgB,EAAE,CAAC;wBACrB,OAAO,gBAAgB,CAAC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;oBAC/E,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,7 +0,0 @@
1
- export default function registerWorker<Input = any, Result = any>({ type, external, maxParallelAllocations, process, }: {
2
- type: string;
3
- external?: boolean;
4
- maxParallelAllocations?: number;
5
- process?: (input: Input, workId: string) => Promise<Result>;
6
- }): void;
7
- //# sourceMappingURL=registerWarehouse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerWarehouse.d.ts","sourceRoot":"","sources":["../../src/factory/registerWarehouse.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,EAChE,IAAI,EACJ,QAAQ,EACR,sBAAsB,EACtB,OAAO,GACR,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7D,QAiCA"}
@@ -1,35 +0,0 @@
1
- import { WorkerAdapter, WorkerDirector } from '../core-index.js';
2
- export default function registerWorker({ type, external, maxParallelAllocations, process, }) {
3
- WorkerDirector.registerAdapter({
4
- ...WorkerAdapter,
5
- key: 'shop.unchained.worker.' + type.toLowerCase(),
6
- label: 'Worker: ' + type,
7
- version: '1.0',
8
- external: external ?? false,
9
- maxParallelAllocations,
10
- type,
11
- async doWork(input, _, workId) {
12
- if (!process) {
13
- return { success: false };
14
- }
15
- try {
16
- const result = await process(input, workId);
17
- return {
18
- success: true,
19
- result,
20
- };
21
- }
22
- catch (err) {
23
- return {
24
- success: false,
25
- error: {
26
- name: err.name,
27
- message: err.message,
28
- cause: err.cause,
29
- },
30
- };
31
- }
32
- },
33
- });
34
- }
35
- //# sourceMappingURL=registerWarehouse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerWarehouse.js","sourceRoot":"","sources":["../../src/factory/registerWarehouse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEjE,MAAM,CAAC,OAAO,UAAU,cAAc,CAA4B,EAChE,IAAI,EACJ,QAAQ,EACR,sBAAsB,EACtB,OAAO,GAMR;IACC,cAAc,CAAC,eAAe,CAAC;QAC7B,GAAG,aAAa;QAEhB,GAAG,EAAE,wBAAwB,GAAG,IAAI,CAAC,WAAW,EAAE;QAClD,KAAK,EAAE,UAAU,GAAG,IAAI;QACxB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,QAAQ,IAAI,KAAK;QAC3B,sBAAsB;QACtB,IAAI;QAEJ,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM;YAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;YAC5B,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBAC5C,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,MAAM;iBACP,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE;wBACL,IAAI,EAAE,GAAG,CAAC,IAAI;wBACd,OAAO,EAAE,GAAG,CAAC,OAAO;wBACpB,KAAK,EAAE,GAAG,CAAC,KAAK;qBACjB;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,7 +0,0 @@
1
- export default function registerWorker<Input = any, Result = any>({ type, external, maxParallelAllocations, process, }: {
2
- type: string;
3
- external?: boolean;
4
- maxParallelAllocations?: number;
5
- process?: (input: Input, workId: string) => Promise<Result>;
6
- }): void;
7
- //# sourceMappingURL=registerWorker%20copy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerWorker copy.d.ts","sourceRoot":"","sources":["../../src/factory/registerWorker copy.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,EAChE,IAAI,EACJ,QAAQ,EACR,sBAAsB,EACtB,OAAO,GACR,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7D,QAiCA"}
@@ -1,35 +0,0 @@
1
- import { WorkerAdapter, WorkerDirector } from '../core-index.js';
2
- export default function registerWorker({ type, external, maxParallelAllocations, process, }) {
3
- WorkerDirector.registerAdapter({
4
- ...WorkerAdapter,
5
- key: 'shop.unchained.worker.' + type.toLowerCase(),
6
- label: 'Worker: ' + type,
7
- version: '1.0',
8
- external: external ?? false,
9
- maxParallelAllocations,
10
- type,
11
- async doWork(input, _, workId) {
12
- if (!process) {
13
- return { success: false };
14
- }
15
- try {
16
- const result = await process(input, workId);
17
- return {
18
- success: true,
19
- result,
20
- };
21
- }
22
- catch (err) {
23
- return {
24
- success: false,
25
- error: {
26
- name: err.name,
27
- message: err.message,
28
- cause: err.cause,
29
- },
30
- };
31
- }
32
- },
33
- });
34
- }
35
- //# sourceMappingURL=registerWorker%20copy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerWorker copy.js","sourceRoot":"","sources":["../../src/factory/registerWorker copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEjE,MAAM,CAAC,OAAO,UAAU,cAAc,CAA4B,EAChE,IAAI,EACJ,QAAQ,EACR,sBAAsB,EACtB,OAAO,GAMR;IACC,cAAc,CAAC,eAAe,CAAC;QAC7B,GAAG,aAAa;QAEhB,GAAG,EAAE,wBAAwB,GAAG,IAAI,CAAC,WAAW,EAAE;QAClD,KAAK,EAAE,UAAU,GAAG,IAAI;QACxB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,QAAQ,IAAI,KAAK;QAC3B,sBAAsB;QACtB,IAAI;QAEJ,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM;YAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;YAC5B,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBAC5C,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,MAAM;iBACP,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE;wBACL,IAAI,EAAE,GAAG,CAAC,IAAI;wBACd,OAAO,EAAE,GAAG,CAAC,OAAO;wBACpB,KAAK,EAAE,GAAG,CAAC,KAAK;qBACjB;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}