@unchainedshop/core 4.7.2 → 4.8.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.
Files changed (124) hide show
  1. package/lib/bulk-exporter/createBulkExporter.d.ts +2 -2
  2. package/lib/bulk-exporter/createBulkExporter.js +2 -2
  3. package/lib/bulk-exporter/handlers/exportAssortmentsHandler.d.ts +19 -19
  4. package/lib/bulk-exporter/handlers/exportAssortmentsHandler.js +9 -9
  5. package/lib/bulk-exporter/handlers/exportFiltersHandler.d.ts +11 -11
  6. package/lib/bulk-exporter/handlers/exportFiltersHandler.js +5 -5
  7. package/lib/bulk-exporter/handlers/exportProductsHandler.d.ts +19 -19
  8. package/lib/bulk-exporter/handlers/exportProductsHandler.js +9 -9
  9. package/lib/bulk-exporter/handlers/exportUsersHandler.d.ts +17 -17
  10. package/lib/bulk-exporter/handlers/exportUsersHandler.js +8 -8
  11. package/lib/bulk-importer/createBulkImporter.d.ts +2 -2
  12. package/lib/bulk-importer/createBulkImporter.js +4 -2
  13. package/lib/bulk-importer/handlers/assortment/create.d.ts +87 -87
  14. package/lib/bulk-importer/handlers/assortment/create.js +13 -15
  15. package/lib/bulk-importer/handlers/assortment/remove.d.ts +5 -5
  16. package/lib/bulk-importer/handlers/assortment/remove.js +1 -1
  17. package/lib/bulk-importer/handlers/assortment/update.d.ts +87 -87
  18. package/lib/bulk-importer/handlers/assortment/update.js +17 -21
  19. package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +7 -7
  20. package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +5 -5
  21. package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +7 -7
  22. package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js +5 -5
  23. package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +7 -7
  24. package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js +5 -5
  25. package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +14 -14
  26. package/lib/bulk-importer/handlers/assortment/upsertMedia.js +8 -10
  27. package/lib/bulk-importer/handlers/filter/create.d.ts +19 -19
  28. package/lib/bulk-importer/handlers/filter/create.js +8 -10
  29. package/lib/bulk-importer/handlers/filter/remove.d.ts +3 -3
  30. package/lib/bulk-importer/handlers/filter/remove.js +1 -1
  31. package/lib/bulk-importer/handlers/filter/update.d.ts +19 -19
  32. package/lib/bulk-importer/handlers/filter/update.js +8 -10
  33. package/lib/bulk-importer/handlers/product/create.d.ts +175 -175
  34. package/lib/bulk-importer/handlers/product/create.js +35 -45
  35. package/lib/bulk-importer/handlers/product/remove.d.ts +5 -5
  36. package/lib/bulk-importer/handlers/product/remove.js +1 -1
  37. package/lib/bulk-importer/handlers/product/update.d.ts +175 -175
  38. package/lib/bulk-importer/handlers/product/update.js +40 -52
  39. package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +14 -14
  40. package/lib/bulk-importer/handlers/product/upsertMedia.js +8 -10
  41. package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +13 -13
  42. package/lib/bulk-importer/handlers/product/upsertVariations.js +10 -14
  43. package/lib/bulk-importer/upsertAsset.d.ts +7 -7
  44. package/lib/bulk-importer/upsertAsset.js +4 -4
  45. package/lib/core-index.d.ts +0 -3
  46. package/lib/core-index.js +2 -6
  47. package/lib/directors/BaseDiscountDirector.js +6 -6
  48. package/lib/directors/BasePricingDirector.js +1 -1
  49. package/lib/directors/DeliveryAdapter.js +0 -1
  50. package/lib/directors/DeliveryDirector.js +2 -11
  51. package/lib/directors/DeliveryPricingAdapter.d.ts +1 -2
  52. package/lib/directors/DeliveryPricingAdapter.js +1 -2
  53. package/lib/directors/DeliveryPricingDirector.d.ts +1 -1
  54. package/lib/directors/DeliveryPricingDirector.js +2 -12
  55. package/lib/directors/DeliveryPricingSheet.d.ts +1 -1
  56. package/lib/directors/DeliveryPricingSheet.js +1 -1
  57. package/lib/directors/EnrollmentAdapter.js +0 -1
  58. package/lib/directors/EnrollmentDirector.js +1 -11
  59. package/lib/directors/FilterAdapter.js +0 -1
  60. package/lib/directors/FilterDirector.js +1 -11
  61. package/lib/directors/OrderDiscountAdapter.d.ts +2 -3
  62. package/lib/directors/OrderDiscountAdapter.js +2 -5
  63. package/lib/directors/OrderDiscountDirector.d.ts +1 -15
  64. package/lib/directors/OrderDiscountDirector.js +1 -14
  65. package/lib/directors/OrderPricingAdapter.d.ts +1 -2
  66. package/lib/directors/OrderPricingAdapter.js +1 -3
  67. package/lib/directors/OrderPricingDirector.d.ts +1 -4
  68. package/lib/directors/OrderPricingDirector.js +1 -12
  69. package/lib/directors/OrderPricingSheet.d.ts +1 -1
  70. package/lib/directors/OrderPricingSheet.js +1 -1
  71. package/lib/directors/PaymentAdapter.js +0 -1
  72. package/lib/directors/PaymentDirector.js +2 -11
  73. package/lib/directors/PaymentPricingAdapter.d.ts +1 -2
  74. package/lib/directors/PaymentPricingAdapter.js +1 -2
  75. package/lib/directors/PaymentPricingDirector.d.ts +1 -2
  76. package/lib/directors/PaymentPricingDirector.js +1 -11
  77. package/lib/directors/PaymentPricingSheet.d.ts +1 -2
  78. package/lib/directors/PaymentPricingSheet.js +1 -2
  79. package/lib/directors/ProductDiscountAdapter.d.ts +2 -3
  80. package/lib/directors/ProductDiscountAdapter.js +2 -5
  81. package/lib/directors/ProductDiscountDirector.d.ts +2 -16
  82. package/lib/directors/ProductDiscountDirector.js +2 -15
  83. package/lib/directors/ProductPricingAdapter.d.ts +1 -2
  84. package/lib/directors/ProductPricingAdapter.js +1 -3
  85. package/lib/directors/ProductPricingDirector.d.ts +1 -3
  86. package/lib/directors/ProductPricingDirector.js +1 -12
  87. package/lib/directors/ProductPricingSheet.d.ts +1 -1
  88. package/lib/directors/ProductPricingSheet.js +1 -1
  89. package/lib/directors/QuotationAdapter.js +0 -1
  90. package/lib/directors/QuotationDirector.js +2 -11
  91. package/lib/directors/WarehousingAdapter.js +0 -1
  92. package/lib/directors/WarehousingDirector.d.ts +1 -1
  93. package/lib/directors/WarehousingDirector.js +2 -12
  94. package/lib/directors/WorkerAdapter.js +0 -1
  95. package/lib/directors/WorkerDirector.d.ts +1 -1
  96. package/lib/directors/WorkerDirector.js +17 -10
  97. package/lib/directors/index.d.ts +0 -2
  98. package/lib/directors/index.js +0 -2
  99. package/lib/factory/registerAssortmentSearchFilter.d.ts +1 -2
  100. package/lib/factory/registerAssortmentSearchFilter.js +3 -12
  101. package/lib/factory/registerInvoicePayment.d.ts +2 -2
  102. package/lib/factory/registerInvoicePayment.js +3 -12
  103. package/lib/factory/registerPhysicalWarehousing.d.ts +2 -2
  104. package/lib/factory/registerPhysicalWarehousing.js +3 -12
  105. package/lib/factory/registerPickUpDelivery.d.ts +2 -2
  106. package/lib/factory/registerPickUpDelivery.js +3 -12
  107. package/lib/factory/registerProductDiscoverabilityFilter.d.ts +1 -2
  108. package/lib/factory/registerProductDiscoverabilityFilter.js +3 -12
  109. package/lib/factory/registerProductSearchFilter.d.ts +1 -2
  110. package/lib/factory/registerProductSearchFilter.js +3 -12
  111. package/lib/factory/registerShippingDelivery.d.ts +2 -2
  112. package/lib/factory/registerShippingDelivery.js +3 -12
  113. package/lib/factory/registerVirtualWarehousing.d.ts +2 -2
  114. package/lib/factory/registerVirtualWarehousing.js +3 -12
  115. package/lib/factory/registerWorker.d.ts +1 -2
  116. package/lib/factory/registerWorker.js +3 -12
  117. package/lib/services/createDownloadStream.js +1 -1
  118. package/lib/services/createFileDownloadURL.js +1 -2
  119. package/lib/services/createSignedURL.js +1 -2
  120. package/lib/services/linkFileService.js +1 -1
  121. package/lib/services/removeFiles.js +1 -1
  122. package/lib/services/uploadFileFromStream.js +1 -2
  123. package/lib/services/uploadFileFromURL.js +1 -2
  124. package/package.json +1 -1
@@ -1,15 +1,2 @@
1
- import { BaseDiscountDirector } from "./BaseDiscountDirector.js";
2
- import { ProductDiscountAdapter } from "./ProductDiscountAdapter.js";
3
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
4
- const baseDirector = BaseDiscountDirector('ProductDiscountDirector');
5
- export const ProductDiscountDirector = {
6
- ...baseDirector,
7
- getAdapter: (key) => {
8
- const adapters = pluginRegistry.getAdapters(ProductDiscountAdapter.adapterType);
9
- return adapters.find((adapter) => adapter.key === key) || null;
10
- },
11
- getAdapters: (options) => {
12
- const adapters = pluginRegistry.getAdapters(ProductDiscountAdapter.adapterType);
13
- return adapters.filter(options?.adapterFilter || (() => true));
14
- },
15
- };
1
+ import { BaseDiscountDirector } from "../directors/index.js";
2
+ export const ProductDiscountDirector = BaseDiscountDirector('ProductDiscountDirector');
@@ -1,7 +1,6 @@
1
1
  import type { Product, ProductConfiguration } from '@unchainedshop/core-products';
2
2
  import type { Order } from '@unchainedshop/core-orders';
3
- import { type IProductPricingSheet, type ProductPricingCalculation } from './ProductPricingSheet.ts';
4
- import { type BasePricingAdapterContext, type IPricingAdapter } from './BasePricingAdapter.ts';
3
+ import { type IProductPricingSheet, type ProductPricingCalculation, type BasePricingAdapterContext, type IPricingAdapter } from '../directors/index.ts';
5
4
  import type { Modules } from '../modules.ts';
6
5
  import type { User } from '@unchainedshop/core-users';
7
6
  export interface ProductPricingAdapterContext extends BasePricingAdapterContext {
@@ -1,9 +1,7 @@
1
- import { ProductPricingSheet, } from "./ProductPricingSheet.js";
2
- import { BasePricingAdapter, } from "./BasePricingAdapter.js";
1
+ import { ProductPricingSheet, BasePricingAdapter, } from "../directors/index.js";
3
2
  const basePricingAdapter = BasePricingAdapter();
4
3
  export const ProductPricingAdapter = {
5
4
  ...basePricingAdapter,
6
- adapterType: Symbol.for('unchained:adapter:pricing:product'),
7
5
  isActivatedFor: () => {
8
6
  return false;
9
7
  },
@@ -1,9 +1,7 @@
1
1
  import type { Product, ProductConfiguration } from '@unchainedshop/core-products';
2
2
  import type { User } from '@unchainedshop/core-users';
3
3
  import type { Order, OrderDiscount, OrderPosition } from '@unchainedshop/core-orders';
4
- import { type IProductPricingSheet, type ProductPricingCalculation } from './ProductPricingSheet.ts';
5
- import { type IProductPricingAdapter, type ProductPricingAdapterContext } from './ProductPricingAdapter.ts';
6
- import { type IPricingDirector } from './BasePricingDirector.ts';
4
+ import { type IProductPricingSheet, type ProductPricingCalculation, type IProductPricingAdapter, type ProductPricingAdapterContext, type IPricingDirector } from '../directors/index.ts';
7
5
  export type ProductPricingContext = {
8
6
  currencyCode: string;
9
7
  countryCode: string;
@@ -1,18 +1,7 @@
1
- import { ProductPricingSheet, } from "./ProductPricingSheet.js";
2
- import { ProductPricingAdapter, } from "./ProductPricingAdapter.js";
3
- import { BasePricingDirector } from "./BasePricingDirector.js";
4
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
1
+ import { ProductPricingSheet, BasePricingDirector, } from "../directors/index.js";
5
2
  const baseDirector = BasePricingDirector('ProductPricingDirector');
6
3
  export const ProductPricingDirector = {
7
4
  ...baseDirector,
8
- getAdapter: (key) => {
9
- const adapters = pluginRegistry.getAdapters(ProductPricingAdapter.adapterType);
10
- return adapters.find((adapter) => adapter.key === key) || null;
11
- },
12
- getAdapters: ({ adapterFilter } = {}) => {
13
- const adapters = pluginRegistry.getAdapters(ProductPricingAdapter.adapterType);
14
- return adapters.filter(adapterFilter || (() => true));
15
- },
16
5
  async buildPricingContext(context, unchainedAPI) {
17
6
  const { modules } = unchainedAPI;
18
7
  const { quantity = 1, currencyCode } = context;
@@ -1,5 +1,5 @@
1
1
  import type { Price, PricingCalculation } from '@unchainedshop/utils';
2
- import { type IPricingSheet, type PricingSheetParams } from './BasePricingSheet.ts';
2
+ import { type IPricingSheet, type PricingSheetParams } from '../directors/index.ts';
3
3
  export interface ProductPricingCalculation extends PricingCalculation {
4
4
  discountId?: string;
5
5
  isTaxable: boolean;
@@ -1,4 +1,4 @@
1
- import { BasePricingSheet } from "./BasePricingSheet.js";
1
+ import { BasePricingSheet } from "../directors/index.js";
2
2
  export const ProductPricingRowCategory = {
3
3
  Item: 'ITEM',
4
4
  Discount: 'DISCOUNT',
@@ -7,7 +7,6 @@ export const QuotationError = {
7
7
  };
8
8
  export const QuotationAdapter = {
9
9
  ...BaseAdapter,
10
- adapterType: Symbol.for('unchained:adapter:quotation'),
11
10
  orderIndex: 0,
12
11
  isActivatedFor: () => {
13
12
  return false;
@@ -1,12 +1,11 @@
1
1
  import { BaseDirector } from '@unchainedshop/utils';
2
- import { QuotationError, QuotationAdapter, } from "./QuotationAdapter.js";
2
+ import { QuotationError, } from "./QuotationAdapter.js";
3
3
  import { createLogger } from '@unchainedshop/logger';
4
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
5
4
  const logger = createLogger('unchained:core');
6
5
  const baseDirector = BaseDirector('QuotationDirector', {
7
6
  adapterSortKey: 'orderIndex',
8
7
  });
9
- const findAppropriateAdapters = (quotationContext, unchainedAPI) => QuotationDirector.getAdapters({
8
+ const findAppropriateAdapters = (quotationContext, unchainedAPI) => baseDirector.getAdapters({
10
9
  adapterFilter: (Adapter) => {
11
10
  const activated = Adapter.isActivatedFor(quotationContext, unchainedAPI);
12
11
  if (!activated) {
@@ -17,14 +16,6 @@ const findAppropriateAdapters = (quotationContext, unchainedAPI) => QuotationDir
17
16
  });
18
17
  export const QuotationDirector = {
19
18
  ...baseDirector,
20
- getAdapter: (key) => {
21
- const adapters = pluginRegistry.getAdapters(QuotationAdapter.adapterType);
22
- return adapters.find((adapter) => adapter.key === key) || null;
23
- },
24
- getAdapters: ({ adapterFilter } = {}) => {
25
- const adapters = pluginRegistry.getAdapters(QuotationAdapter.adapterType);
26
- return adapters.filter(adapterFilter || (() => true));
27
- },
28
19
  actions: async (quotationContext, unchainedAPI) => {
29
20
  const context = { ...quotationContext, ...unchainedAPI };
30
21
  const Adapter = findAppropriateAdapters(quotationContext, unchainedAPI)?.shift();
@@ -7,7 +7,6 @@ export const WarehousingError = {
7
7
  };
8
8
  export const WarehousingAdapter = {
9
9
  ...BaseAdapter,
10
- adapterType: Symbol.for('unchained:adapter:warehousing'),
11
10
  orderIndex: 0,
12
11
  typeSupported: () => {
13
12
  return false;
@@ -1,6 +1,6 @@
1
1
  import type { IBaseDirector } from '@unchainedshop/utils';
2
2
  import type { WarehousingProvider, TokenSurrogate } from '@unchainedshop/core-warehousing';
3
- import { type IWarehousingAdapter, type WarehousingContext, WarehousingError } from './WarehousingAdapter.ts';
3
+ import { type IWarehousingAdapter, type WarehousingContext, WarehousingError } from '../directors/index.ts';
4
4
  import type { Modules } from '../modules.ts';
5
5
  export interface EstimatedDispatch {
6
6
  shipping?: Date;
@@ -1,9 +1,7 @@
1
1
  import { BaseDirector } from '@unchainedshop/utils';
2
2
  import { createLogger } from '@unchainedshop/logger';
3
3
  const logger = createLogger('unchained:core');
4
- import { DeliveryDirector } from "./DeliveryDirector.js";
5
- import { WarehousingError, WarehousingAdapter, } from "./WarehousingAdapter.js";
6
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
4
+ import { DeliveryDirector, WarehousingError, } from "../directors/index.js";
7
5
  const getReferenceDate = (context) => {
8
6
  return context && context.referenceDate ? context.referenceDate : new Date();
9
7
  };
@@ -12,16 +10,8 @@ const baseDirector = BaseDirector('WarehousingDirector', {
12
10
  });
13
11
  export const WarehousingDirector = {
14
12
  ...baseDirector,
15
- getAdapter: (key) => {
16
- const adapters = pluginRegistry.getAdapters(WarehousingAdapter.adapterType);
17
- return adapters.find((adapter) => adapter.key === key) || null;
18
- },
19
- getAdapters: ({ adapterFilter } = {}) => {
20
- const adapters = pluginRegistry.getAdapters(WarehousingAdapter.adapterType);
21
- return adapters.filter(adapterFilter || (() => true));
22
- },
23
13
  actions: async (warehousingProvider, warehousingContext, unchainedAPI) => {
24
- const Adapter = WarehousingDirector.getAdapter(warehousingProvider.adapterKey);
14
+ const Adapter = baseDirector.getAdapter(warehousingProvider.adapterKey);
25
15
  if (!Adapter) {
26
16
  throw new Error(`Warehousing Plugin ${warehousingProvider.adapterKey} not available`);
27
17
  }
@@ -1,7 +1,6 @@
1
1
  import { BaseAdapter } from '@unchainedshop/utils';
2
2
  export const WorkerAdapter = {
3
3
  ...BaseAdapter,
4
- adapterType: Symbol.for('unchained:adapter:worker'),
5
4
  external: false,
6
5
  async doWork() {
7
6
  return { success: false };
@@ -1,7 +1,7 @@
1
1
  import type { Work, WorkData, WorkResult } from '@unchainedshop/core-worker';
2
2
  import { type IBaseDirector } from '@unchainedshop/utils';
3
3
  import type { ScheduleData } from '../utils/schedule.ts';
4
- import { type IWorkerAdapter } from './WorkerAdapter.ts';
4
+ import type { IWorkerAdapter } from './WorkerAdapter.ts';
5
5
  import type { Modules } from '../modules.ts';
6
6
  export type WorkScheduleConfiguration = Pick<WorkData, 'timeout' | 'retries' | 'priority' | 'worker' | 'scheduleId'> & {
7
7
  type: string;
@@ -1,7 +1,5 @@
1
1
  import { BaseDirector } from '@unchainedshop/utils';
2
- import { WorkerAdapter } from "./WorkerAdapter.js";
3
2
  import { createLogger } from '@unchainedshop/logger';
4
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
5
3
  const logger = createLogger('unchained:core');
6
4
  const AutoScheduleMap = new Map();
7
5
  const baseDirector = BaseDirector('WorkerDirector', {
@@ -9,14 +7,6 @@ const baseDirector = BaseDirector('WorkerDirector', {
9
7
  });
10
8
  export const WorkerDirector = {
11
9
  ...baseDirector,
12
- getAdapter: (key) => {
13
- const adapters = pluginRegistry.getAdapters(WorkerAdapter.adapterType);
14
- return adapters.find((adapter) => adapter.key === key) || null;
15
- },
16
- getAdapters: ({ adapterFilter } = {}) => {
17
- const adapters = pluginRegistry.getAdapters(WorkerAdapter.adapterType);
18
- return adapters.filter(adapterFilter || (() => true));
19
- },
20
10
  getActivePluginTypes: ({ external } = {}) => {
21
11
  return WorkerDirector.getAdapters()
22
12
  .filter((adapter) => {
@@ -26,9 +16,26 @@ export const WorkerDirector = {
26
16
  })
27
17
  .map((adapter) => adapter.type);
28
18
  },
19
+ registerAdapter: (Adapter) => {
20
+ if (WorkerDirector.getAdapterByType(Adapter.type))
21
+ throw new Error(`WorkerDirector: There is already a adapter registered with type: ${Adapter.type}`);
22
+ baseDirector.registerAdapter(Adapter);
23
+ },
29
24
  disableAutoscheduling: (type) => {
30
25
  AutoScheduleMap.delete(type);
31
26
  },
27
+ unregisterAdapter: (key) => {
28
+ const adapter = WorkerDirector.getAdapter(key);
29
+ const result = baseDirector.unregisterAdapter(key);
30
+ if (adapter) {
31
+ AutoScheduleMap.forEach((workItemConfiguration, scheduleId) => {
32
+ if (workItemConfiguration.type === adapter.type) {
33
+ AutoScheduleMap.delete(scheduleId);
34
+ }
35
+ });
36
+ }
37
+ return result;
38
+ },
32
39
  configureAutoscheduling: (workItemConfiguration) => {
33
40
  AutoScheduleMap.set(workItemConfiguration.scheduleId || workItemConfiguration.type, workItemConfiguration);
34
41
  },
@@ -39,6 +39,4 @@ export * from './FailedRescheduler.ts';
39
39
  export * from './BaseWorker.ts';
40
40
  export * from './QuotationAdapter.ts';
41
41
  export * from './QuotationDirector.ts';
42
- export * from './FileDirector.ts';
43
- export { type IFileAdapter, FileAdapter } from '@unchainedshop/core-files';
44
42
  export * from './MessagingDirector.ts';
@@ -39,6 +39,4 @@ export * from "./FailedRescheduler.js";
39
39
  export * from "./BaseWorker.js";
40
40
  export * from "./QuotationAdapter.js";
41
41
  export * from "./QuotationDirector.js";
42
- export * from "./FileDirector.js";
43
- export { FileAdapter } from '@unchainedshop/core-files';
44
42
  export * from "./MessagingDirector.js";
@@ -1,9 +1,8 @@
1
1
  import type { SearchQuery } from '@unchainedshop/core-filters';
2
- import { type IPlugin } from '../core-index.ts';
3
2
  export default function registerAssortmentSearchFilter({ orderIndex, search, }: {
4
3
  orderIndex?: number;
5
4
  search: (params: SearchQuery & {
6
5
  queryString: string;
7
6
  locale: Intl.Locale;
8
7
  }) => Promise<string[]>;
9
- }): IPlugin;
8
+ }): void;
@@ -1,7 +1,6 @@
1
- import { FilterAdapter } from "../core-index.js";
2
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
1
+ import { FilterAdapter, FilterDirector } from "../core-index.js";
3
2
  export default function registerAssortmentSearchFilter({ orderIndex = 0, search, }) {
4
- const adapter = {
3
+ FilterDirector.registerAdapter({
5
4
  ...FilterAdapter,
6
5
  key: `shop.unchained.filters.assortment-search-${crypto.randomUUID()}`,
7
6
  label: 'Assortment Search Filter (auto-generated)',
@@ -20,13 +19,5 @@ export default function registerAssortmentSearchFilter({ orderIndex = 0, search,
20
19
  },
21
20
  };
22
21
  },
23
- };
24
- const plugin = {
25
- key: adapter.key,
26
- label: adapter.label,
27
- version: adapter.version,
28
- adapters: [adapter],
29
- };
30
- pluginRegistry.register(plugin);
31
- return plugin;
22
+ });
32
23
  }
@@ -1,8 +1,8 @@
1
1
  import type { PaymentConfiguration } from '@unchainedshop/core-payment';
2
- import { type PaymentContext, type PaymentChargeActionResult, type IPlugin } from '../core-index.ts';
2
+ import { type PaymentContext, type PaymentChargeActionResult } from '../core-index.ts';
3
3
  export default function registerInvoicePayment({ adapterId, active, payLaterAllowed, charge, }: {
4
4
  adapterId: string;
5
5
  active?: boolean;
6
6
  payLaterAllowed?: boolean;
7
7
  charge: false | ((configuration: PaymentConfiguration, context: PaymentContext) => Promise<PaymentChargeActionResult | false>);
8
- }): IPlugin;
8
+ }): void;
@@ -1,8 +1,7 @@
1
- import { PaymentAdapter, } from "../core-index.js";
2
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
1
+ import { PaymentAdapter, PaymentDirector, } from "../core-index.js";
3
2
  import { PaymentProviderType } from '@unchainedshop/core-payment';
4
3
  export default function registerInvoicePayment({ adapterId, active, payLaterAllowed, charge, }) {
5
- const adapter = {
4
+ PaymentDirector.registerAdapter({
6
5
  ...PaymentAdapter,
7
6
  key: `shop.unchained.payment.invoice-${adapterId}`,
8
7
  label: 'Invoice Payment: ' + adapterId,
@@ -28,13 +27,5 @@ export default function registerInvoicePayment({ adapterId, active, payLaterAllo
28
27
  },
29
28
  };
30
29
  },
31
- };
32
- const plugin = {
33
- key: adapter.key,
34
- label: adapter.label,
35
- version: adapter.version,
36
- adapters: [adapter],
37
- };
38
- pluginRegistry.register(plugin);
39
- return plugin;
30
+ });
40
31
  }
@@ -1,9 +1,9 @@
1
1
  import type { WarehousingConfiguration } from '@unchainedshop/core-warehousing';
2
- import { type WarehousingContext, type IPlugin } from '../core-index.ts';
2
+ import { type WarehousingContext } from '../core-index.ts';
3
3
  export default function registerPhysicalWarehousing({ adapterId, orderIndex, stock, productionTime, commissioningTime, }: {
4
4
  adapterId: string;
5
5
  orderIndex?: number;
6
6
  stock?: number | ((referenceDate: Date, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<number>);
7
7
  productionTime?: number | ((quantityToProduct: number, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<number>);
8
8
  commissioningTime?: number | ((quantity: number, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<number>);
9
- }): IPlugin;
9
+ }): void;
@@ -1,8 +1,7 @@
1
1
  import { WarehousingProviderType } from '@unchainedshop/core-warehousing';
2
- import { WarehousingAdapter, } from "../core-index.js";
3
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
2
+ import { WarehousingAdapter, WarehousingDirector } from "../core-index.js";
4
3
  export default function registerPhysicalWarehousing({ adapterId, orderIndex = 0, stock, productionTime, commissioningTime, }) {
5
- const adapter = {
4
+ WarehousingDirector.registerAdapter({
6
5
  ...WarehousingAdapter,
7
6
  key: 'shop.unchained.warehousing.physical.' + adapterId,
8
7
  label: 'Physical Warehousing: ' + adapterId,
@@ -50,13 +49,5 @@ export default function registerPhysicalWarehousing({ adapterId, orderIndex = 0,
50
49
  },
51
50
  };
52
51
  },
53
- };
54
- const plugin = {
55
- key: adapter.key,
56
- label: adapter.label,
57
- version: adapter.version,
58
- adapters: [adapter],
59
- };
60
- pluginRegistry.register(plugin);
61
- return plugin;
52
+ });
62
53
  }
@@ -1,5 +1,5 @@
1
1
  import { type DeliveryConfiguration, type DeliveryLocation } from '@unchainedshop/core-delivery';
2
- import { type DeliveryContext, type IPlugin } from '../core-index.ts';
2
+ import { type DeliveryContext } from '../core-index.ts';
3
3
  import type { Work } from '@unchainedshop/core-worker';
4
4
  export default function registerPickUpDelivery({ adapterId, locations, active, autoReleaseAllowed, estimatedDeliveryThroughput, send, }: {
5
5
  adapterId: string;
@@ -8,4 +8,4 @@ export default function registerPickUpDelivery({ adapterId, locations, active, a
8
8
  estimatedDeliveryThroughput?: (warehousingThroughputTime: number, context: DeliveryContext) => Promise<number | null>;
9
9
  send: boolean | ((configuration: DeliveryConfiguration, context: DeliveryContext) => Promise<boolean | Work>);
10
10
  locations: DeliveryLocation[] | ((context: DeliveryContext) => Promise<DeliveryLocation[]>);
11
- }): IPlugin;
11
+ }): void;
@@ -1,8 +1,7 @@
1
1
  import { DeliveryProviderType, } from '@unchainedshop/core-delivery';
2
- import { DeliveryAdapter, } from "../core-index.js";
3
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
2
+ import { DeliveryAdapter, DeliveryDirector } from "../core-index.js";
4
3
  export default function registerPickUpDelivery({ adapterId, locations, active, autoReleaseAllowed, estimatedDeliveryThroughput, send, }) {
5
- const adapter = {
4
+ DeliveryDirector.registerAdapter({
6
5
  ...DeliveryAdapter,
7
6
  key: `shop.unchained.delivery.pickup-${adapterId}`,
8
7
  label: 'PickUp Delivery: ' + adapterId,
@@ -42,13 +41,5 @@ export default function registerPickUpDelivery({ adapterId, locations, active, a
42
41
  },
43
42
  };
44
43
  },
45
- };
46
- const plugin = {
47
- key: adapter.key,
48
- label: adapter.label,
49
- version: adapter.version,
50
- adapters: [adapter],
51
- };
52
- pluginRegistry.register(plugin);
53
- return plugin;
44
+ });
54
45
  }
@@ -1,5 +1,4 @@
1
- import { type IPlugin } from '../core-index.ts';
2
1
  export default function registerProductDiscoverabilityFilter({ orderIndex, hiddenTagValue, }: {
3
2
  orderIndex?: number;
4
3
  hiddenTagValue?: string;
5
- }): IPlugin;
4
+ }): void;
@@ -1,7 +1,6 @@
1
- import { FilterAdapter } from "../core-index.js";
2
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
1
+ import { FilterAdapter, FilterDirector } from "../core-index.js";
3
2
  export default function registerProductDiscoverabilityFilter({ orderIndex = 0, hiddenTagValue = 'hidden', }) {
4
- const adapter = {
3
+ FilterDirector.registerAdapter({
5
4
  ...FilterAdapter,
6
5
  key: `shop.unchained.filters.product-discoverability-${crypto.randomUUID()}`,
7
6
  label: 'Product Discoverability Filter (auto-generated)',
@@ -23,13 +22,5 @@ export default function registerProductDiscoverabilityFilter({ orderIndex = 0, h
23
22
  },
24
23
  };
25
24
  },
26
- };
27
- const plugin = {
28
- key: adapter.key,
29
- label: adapter.label,
30
- version: adapter.version,
31
- adapters: [adapter],
32
- };
33
- pluginRegistry.register(plugin);
34
- return plugin;
25
+ });
35
26
  }
@@ -1,9 +1,8 @@
1
1
  import type { SearchQuery } from '@unchainedshop/core-filters';
2
- import { type IPlugin } from '../core-index.ts';
3
2
  export default function registerProductSearchFilter({ orderIndex, search, }: {
4
3
  orderIndex?: number;
5
4
  search: (params: SearchQuery & {
6
5
  queryString: string;
7
6
  locale: Intl.Locale;
8
7
  }) => Promise<string[]>;
9
- }): IPlugin;
8
+ }): void;
@@ -1,7 +1,6 @@
1
- import { FilterAdapter } from "../core-index.js";
2
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
1
+ import { FilterAdapter, FilterDirector } from "../core-index.js";
3
2
  export default function registerProductSearchFilter({ orderIndex = 0, search, }) {
4
- const adapter = {
3
+ FilterDirector.registerAdapter({
5
4
  ...FilterAdapter,
6
5
  key: `shop.unchained.filters.product-search-${crypto.randomUUID()}`,
7
6
  label: 'Product Search Filter (auto-generated)',
@@ -20,13 +19,5 @@ export default function registerProductSearchFilter({ orderIndex = 0, search, })
20
19
  },
21
20
  };
22
21
  },
23
- };
24
- const plugin = {
25
- key: adapter.key,
26
- label: adapter.label,
27
- version: adapter.version,
28
- adapters: [adapter],
29
- };
30
- pluginRegistry.register(plugin);
31
- return plugin;
22
+ });
32
23
  }
@@ -1,5 +1,5 @@
1
1
  import type { DeliveryConfiguration } from '@unchainedshop/core-delivery';
2
- import { type DeliveryContext, type IPlugin } from '../core-index.ts';
2
+ import { type DeliveryContext } from '../core-index.ts';
3
3
  import type { Work } from '@unchainedshop/core-worker';
4
4
  export default function registerShippingDelivery({ adapterId, active, autoReleaseAllowed, estimatedDeliveryThroughput, send, }: {
5
5
  adapterId: string;
@@ -7,4 +7,4 @@ export default function registerShippingDelivery({ adapterId, active, autoReleas
7
7
  autoReleaseAllowed?: boolean;
8
8
  estimatedDeliveryThroughput?: (warehousingThroughputTime: number, context: DeliveryContext) => Promise<number | null>;
9
9
  send: boolean | ((configuration: DeliveryConfiguration, context: DeliveryContext) => Promise<boolean | Work>);
10
- }): IPlugin;
10
+ }): void;
@@ -1,8 +1,7 @@
1
1
  import { DeliveryProviderType } from '@unchainedshop/core-delivery';
2
- import { DeliveryAdapter, } from "../core-index.js";
3
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
2
+ import { DeliveryAdapter, DeliveryDirector } from "../core-index.js";
4
3
  export default function registerShippingDelivery({ adapterId, active, autoReleaseAllowed, estimatedDeliveryThroughput, send, }) {
5
- const adapter = {
4
+ DeliveryDirector.registerAdapter({
6
5
  ...DeliveryAdapter,
7
6
  key: `shop.unchained.delivery.shipping-${adapterId}`,
8
7
  label: 'Shipping Delivery: ' + adapterId,
@@ -34,13 +33,5 @@ export default function registerShippingDelivery({ adapterId, active, autoReleas
34
33
  },
35
34
  };
36
35
  },
37
- };
38
- const plugin = {
39
- key: adapter.key,
40
- label: adapter.label,
41
- version: adapter.version,
42
- adapters: [adapter],
43
- };
44
- pluginRegistry.register(plugin);
45
- return plugin;
36
+ });
46
37
  }
@@ -1,5 +1,5 @@
1
1
  import { type TokenSurrogate, type WarehousingConfiguration } from '@unchainedshop/core-warehousing';
2
- import { type WarehousingContext, type IPlugin } from '../core-index.ts';
2
+ import { type WarehousingContext } from '../core-index.ts';
3
3
  export default function registerVirtualWarehousing<Metadata = Record<string, any>>({ adapterId, orderIndex, stock, tokenize, tokenMetadata, isInvalidateable, }: {
4
4
  adapterId: string;
5
5
  orderIndex?: number;
@@ -7,4 +7,4 @@ export default function registerVirtualWarehousing<Metadata = Record<string, any
7
7
  tokenize: (configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<Omit<TokenSurrogate, 'userId' | 'productId' | 'orderPositionId'>[]>;
8
8
  tokenMetadata?: (serialNumber: string, referenceDate: Date, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<Metadata>;
9
9
  isInvalidateable?: (serialNumber: string, referenceDate: Date, configuration: WarehousingConfiguration, context: WarehousingContext) => Promise<boolean>;
10
- }): IPlugin;
10
+ }): void;
@@ -1,8 +1,7 @@
1
1
  import { WarehousingProviderType, } from '@unchainedshop/core-warehousing';
2
- import { WarehousingAdapter, } from "../core-index.js";
3
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
2
+ import { WarehousingAdapter, WarehousingDirector } from "../core-index.js";
4
3
  export default function registerVirtualWarehousing({ adapterId, orderIndex = 0, stock, tokenize, tokenMetadata, isInvalidateable, }) {
5
- const adapter = {
4
+ WarehousingDirector.registerAdapter({
6
5
  ...WarehousingAdapter,
7
6
  key: 'shop.unchained.warehousing.virtual.' + adapterId,
8
7
  label: 'Virtual Wareshousing: ' + adapterId,
@@ -47,13 +46,5 @@ export default function registerVirtualWarehousing({ adapterId, orderIndex = 0,
47
46
  },
48
47
  };
49
48
  },
50
- };
51
- const plugin = {
52
- key: adapter.key,
53
- label: adapter.label,
54
- version: adapter.version,
55
- adapters: [adapter],
56
- };
57
- pluginRegistry.register(plugin);
58
- return plugin;
49
+ });
59
50
  }
@@ -1,7 +1,6 @@
1
- import { type IPlugin } from '../core-index.ts';
2
1
  export default function registerWorker<Input = any, Result = any>({ type, external, maxParallelAllocations, process, }: {
3
2
  type: string;
4
3
  external?: boolean;
5
4
  maxParallelAllocations?: number;
6
5
  process?: (input: Input, workId: string) => Promise<Result>;
7
- }): IPlugin;
6
+ }): void;
@@ -1,7 +1,6 @@
1
- import { WorkerAdapter } from "../core-index.js";
2
- import { pluginRegistry } from "../plugins/PluginRegistry.js";
1
+ import { WorkerAdapter, WorkerDirector } from "../core-index.js";
3
2
  export default function registerWorker({ type, external, maxParallelAllocations, process, }) {
4
- const adapter = {
3
+ WorkerDirector.registerAdapter({
5
4
  ...WorkerAdapter,
6
5
  key: 'shop.unchained.worker.' + type.toLowerCase(),
7
6
  label: 'Worker: ' + type,
@@ -31,13 +30,5 @@ export default function registerWorker({ type, external, maxParallelAllocations,
31
30
  };
32
31
  }
33
32
  },
34
- };
35
- const plugin = {
36
- key: adapter.key,
37
- label: adapter.label,
38
- version: adapter.version,
39
- adapters: [adapter],
40
- };
41
- pluginRegistry.register(plugin);
42
- return plugin;
33
+ });
43
34
  }
@@ -1,4 +1,4 @@
1
- import { getFileAdapter } from "../utils/getFileAdapter.js";
1
+ import { getFileAdapter } from '@unchainedshop/core-files';
2
2
  export async function createDownloadStreamService({ fileId, }) {
3
3
  const fileAdapter = getFileAdapter();
4
4
  const file = await this.files.findFile({ fileId });
@@ -1,5 +1,4 @@
1
- import {} from '@unchainedshop/core-files';
2
- import { getFileAdapter } from "../utils/getFileAdapter.js";
1
+ import { getFileAdapter } from '@unchainedshop/core-files';
3
2
  export async function createFileDownloadURLService({ file, expires, params = {}, }) {
4
3
  if (!file)
5
4
  return null;
@@ -1,5 +1,4 @@
1
- import { getFileFromFileData } from '@unchainedshop/core-files';
2
- import { getFileAdapter } from "../utils/getFileAdapter.js";
1
+ import { getFileFromFileData, getFileAdapter } from '@unchainedshop/core-files';
3
2
  export async function createSignedURLService({ directoryName, fileName, meta }) {
4
3
  const fileUploadAdapter = getFileAdapter();
5
4
  const preparedFileData = await fileUploadAdapter.createSignedURL(directoryName, fileName, {
@@ -1,4 +1,4 @@
1
- import { FileDirector } from "../directors/FileDirector.js";
1
+ import { FileDirector } from '@unchainedshop/file-upload';
2
2
  export async function linkFileService({ fileId, size, type }) {
3
3
  const file = await this.files.findFile({ fileId });
4
4
  if (!file)