@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.
- package/lib/bulk-exporter/createBulkExporter.d.ts +2 -2
- package/lib/bulk-exporter/createBulkExporter.js +2 -2
- package/lib/bulk-exporter/handlers/exportAssortmentsHandler.d.ts +19 -19
- package/lib/bulk-exporter/handlers/exportAssortmentsHandler.js +9 -9
- package/lib/bulk-exporter/handlers/exportFiltersHandler.d.ts +11 -11
- package/lib/bulk-exporter/handlers/exportFiltersHandler.js +5 -5
- package/lib/bulk-exporter/handlers/exportProductsHandler.d.ts +19 -19
- package/lib/bulk-exporter/handlers/exportProductsHandler.js +9 -9
- package/lib/bulk-exporter/handlers/exportUsersHandler.d.ts +17 -17
- package/lib/bulk-exporter/handlers/exportUsersHandler.js +8 -8
- package/lib/bulk-importer/createBulkImporter.d.ts +2 -2
- package/lib/bulk-importer/createBulkImporter.js +4 -2
- package/lib/bulk-importer/handlers/assortment/create.d.ts +87 -87
- package/lib/bulk-importer/handlers/assortment/create.js +13 -15
- package/lib/bulk-importer/handlers/assortment/remove.d.ts +5 -5
- package/lib/bulk-importer/handlers/assortment/remove.js +1 -1
- package/lib/bulk-importer/handlers/assortment/update.d.ts +87 -87
- package/lib/bulk-importer/handlers/assortment/update.js +17 -21
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.d.ts +7 -7
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentChildren.js +5 -5
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.d.ts +7 -7
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentFilters.js +5 -5
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.d.ts +7 -7
- package/lib/bulk-importer/handlers/assortment/upsertAssortmentProducts.js +5 -5
- package/lib/bulk-importer/handlers/assortment/upsertMedia.d.ts +14 -14
- package/lib/bulk-importer/handlers/assortment/upsertMedia.js +8 -10
- package/lib/bulk-importer/handlers/filter/create.d.ts +19 -19
- package/lib/bulk-importer/handlers/filter/create.js +8 -10
- package/lib/bulk-importer/handlers/filter/remove.d.ts +3 -3
- package/lib/bulk-importer/handlers/filter/remove.js +1 -1
- package/lib/bulk-importer/handlers/filter/update.d.ts +19 -19
- package/lib/bulk-importer/handlers/filter/update.js +8 -10
- package/lib/bulk-importer/handlers/product/create.d.ts +175 -175
- package/lib/bulk-importer/handlers/product/create.js +35 -45
- package/lib/bulk-importer/handlers/product/remove.d.ts +5 -5
- package/lib/bulk-importer/handlers/product/remove.js +1 -1
- package/lib/bulk-importer/handlers/product/update.d.ts +175 -175
- package/lib/bulk-importer/handlers/product/update.js +40 -52
- package/lib/bulk-importer/handlers/product/upsertMedia.d.ts +14 -14
- package/lib/bulk-importer/handlers/product/upsertMedia.js +8 -10
- package/lib/bulk-importer/handlers/product/upsertVariations.d.ts +13 -13
- package/lib/bulk-importer/handlers/product/upsertVariations.js +10 -14
- package/lib/bulk-importer/upsertAsset.d.ts +7 -7
- package/lib/bulk-importer/upsertAsset.js +4 -4
- package/lib/core-index.d.ts +0 -3
- package/lib/core-index.js +2 -6
- package/lib/directors/BaseDiscountDirector.js +6 -6
- package/lib/directors/BasePricingDirector.js +1 -1
- package/lib/directors/DeliveryAdapter.js +0 -1
- package/lib/directors/DeliveryDirector.js +2 -11
- package/lib/directors/DeliveryPricingAdapter.d.ts +1 -2
- package/lib/directors/DeliveryPricingAdapter.js +1 -2
- package/lib/directors/DeliveryPricingDirector.d.ts +1 -1
- package/lib/directors/DeliveryPricingDirector.js +2 -12
- package/lib/directors/DeliveryPricingSheet.d.ts +1 -1
- package/lib/directors/DeliveryPricingSheet.js +1 -1
- package/lib/directors/EnrollmentAdapter.js +0 -1
- package/lib/directors/EnrollmentDirector.js +1 -11
- package/lib/directors/FilterAdapter.js +0 -1
- package/lib/directors/FilterDirector.js +1 -11
- package/lib/directors/OrderDiscountAdapter.d.ts +2 -3
- package/lib/directors/OrderDiscountAdapter.js +2 -5
- package/lib/directors/OrderDiscountDirector.d.ts +1 -15
- package/lib/directors/OrderDiscountDirector.js +1 -14
- package/lib/directors/OrderPricingAdapter.d.ts +1 -2
- package/lib/directors/OrderPricingAdapter.js +1 -3
- package/lib/directors/OrderPricingDirector.d.ts +1 -4
- package/lib/directors/OrderPricingDirector.js +1 -12
- package/lib/directors/OrderPricingSheet.d.ts +1 -1
- package/lib/directors/OrderPricingSheet.js +1 -1
- package/lib/directors/PaymentAdapter.js +0 -1
- package/lib/directors/PaymentDirector.js +2 -11
- package/lib/directors/PaymentPricingAdapter.d.ts +1 -2
- package/lib/directors/PaymentPricingAdapter.js +1 -2
- package/lib/directors/PaymentPricingDirector.d.ts +1 -2
- package/lib/directors/PaymentPricingDirector.js +1 -11
- package/lib/directors/PaymentPricingSheet.d.ts +1 -2
- package/lib/directors/PaymentPricingSheet.js +1 -2
- package/lib/directors/ProductDiscountAdapter.d.ts +2 -3
- package/lib/directors/ProductDiscountAdapter.js +2 -5
- package/lib/directors/ProductDiscountDirector.d.ts +2 -16
- package/lib/directors/ProductDiscountDirector.js +2 -15
- package/lib/directors/ProductPricingAdapter.d.ts +1 -2
- package/lib/directors/ProductPricingAdapter.js +1 -3
- package/lib/directors/ProductPricingDirector.d.ts +1 -3
- package/lib/directors/ProductPricingDirector.js +1 -12
- package/lib/directors/ProductPricingSheet.d.ts +1 -1
- package/lib/directors/ProductPricingSheet.js +1 -1
- package/lib/directors/QuotationAdapter.js +0 -1
- package/lib/directors/QuotationDirector.js +2 -11
- package/lib/directors/WarehousingAdapter.js +0 -1
- package/lib/directors/WarehousingDirector.d.ts +1 -1
- package/lib/directors/WarehousingDirector.js +2 -12
- package/lib/directors/WorkerAdapter.js +0 -1
- package/lib/directors/WorkerDirector.d.ts +1 -1
- package/lib/directors/WorkerDirector.js +17 -10
- package/lib/directors/index.d.ts +0 -2
- package/lib/directors/index.js +0 -2
- package/lib/factory/registerAssortmentSearchFilter.d.ts +1 -2
- package/lib/factory/registerAssortmentSearchFilter.js +3 -12
- package/lib/factory/registerInvoicePayment.d.ts +2 -2
- package/lib/factory/registerInvoicePayment.js +3 -12
- package/lib/factory/registerPhysicalWarehousing.d.ts +2 -2
- package/lib/factory/registerPhysicalWarehousing.js +3 -12
- package/lib/factory/registerPickUpDelivery.d.ts +2 -2
- package/lib/factory/registerPickUpDelivery.js +3 -12
- package/lib/factory/registerProductDiscoverabilityFilter.d.ts +1 -2
- package/lib/factory/registerProductDiscoverabilityFilter.js +3 -12
- package/lib/factory/registerProductSearchFilter.d.ts +1 -2
- package/lib/factory/registerProductSearchFilter.js +3 -12
- package/lib/factory/registerShippingDelivery.d.ts +2 -2
- package/lib/factory/registerShippingDelivery.js +3 -12
- package/lib/factory/registerVirtualWarehousing.d.ts +2 -2
- package/lib/factory/registerVirtualWarehousing.js +3 -12
- package/lib/factory/registerWorker.d.ts +1 -2
- package/lib/factory/registerWorker.js +3 -12
- package/lib/services/createDownloadStream.js +1 -1
- package/lib/services/createFileDownloadURL.js +1 -2
- package/lib/services/createSignedURL.js +1 -2
- package/lib/services/linkFileService.js +1 -1
- package/lib/services/removeFiles.js +1 -1
- package/lib/services/uploadFileFromStream.js +1 -2
- package/lib/services/uploadFileFromURL.js +1 -2
- package/package.json +1 -1
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import { BaseDiscountDirector } from "
|
|
2
|
-
|
|
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 '
|
|
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 "
|
|
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 '
|
|
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 "
|
|
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 '
|
|
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,12 +1,11 @@
|
|
|
1
1
|
import { BaseDirector } from '@unchainedshop/utils';
|
|
2
|
-
import { QuotationError,
|
|
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) =>
|
|
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();
|
|
@@ -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 '
|
|
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 "
|
|
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 =
|
|
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,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 {
|
|
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
|
},
|
package/lib/directors/index.d.ts
CHANGED
|
@@ -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';
|
package/lib/directors/index.js
CHANGED
|
@@ -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
|
-
}):
|
|
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
|
-
|
|
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
|
|
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
|
-
}):
|
|
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
|
-
|
|
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
|
|
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
|
-
}):
|
|
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
|
-
|
|
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
|
|
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
|
-
}):
|
|
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
|
-
|
|
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,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
|
-
|
|
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
|
-
}):
|
|
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
|
-
|
|
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
|
|
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
|
-
}):
|
|
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
|
-
|
|
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
|
|
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
|
-
}):
|
|
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
|
-
|
|
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
|
-
}):
|
|
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
|
-
|
|
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
|
|
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, {
|