@labdigital/commercetools-mock 1.8.0 → 1.9.0
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/dist/index.cjs +269 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -8
- package/dist/index.d.ts +22 -8
- package/dist/index.js +269 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers.ts +19 -6
- package/src/product-projection-search.ts +27 -8
- package/src/repositories/business-unit.ts +204 -3
- package/src/repositories/cart-discount.ts +26 -1
- package/src/repositories/helpers.ts +118 -21
- package/src/repositories/product-projection.ts +4 -16
- package/src/services/abstract.ts +2 -7
- package/src/services/business-units.test.ts +42 -0
- package/src/services/business-units.ts +17 -0
- package/src/services/cart-discount.test.ts +18 -0
- package/src/services/index.ts +3 -1
- package/src/services/product-projection.ts +22 -2
- package/src/services/project.test.ts +52 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import * as ctp from '@commercetools/platform-sdk';
|
|
3
|
-
import { Project, ResourceIdentifier, QueryParam, AssociateRoleDraft, AssociateRole, AssociateRoleSetNameAction, AssociateRoleSetPermissionsAction, AssociateRoleChangeBuyerAssignableAction, AssociateRoleSetCustomFieldAction, AssociateRoleAddPermissionAction, AssociateRoleRemovePermissionAction, AttributeGroupDraft, AttributeGroup, AttributeGroupSetAttributesAction, AttributeGroupChangeNameAction, AttributeGroupSetDescriptionAction, AttributeGroupSetKeyAction, BusinessUnit, CartDraft, Cart, CartAddLineItemAction, CartChangeLineItemQuantityAction, CartRemoveLineItemAction, CartSetBillingAddressAction, CartSetShippingMethodAction, CartSetCountryAction, CartSetCustomerEmailAction, CartSetCustomFieldAction, CartSetCustomTypeAction, CartSetLocaleAction, CartSetShippingAddressAction, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CartDiscountUpdateAction, AssetDraft, Asset, CategoryDraft, Category, CategoryChangeAssetNameAction, CategoryChangeSlugAction, CategorySetKeyAction, CategorySetAssetDescriptionAction, CategorySetAssetSourcesAction, CategorySetDescriptionAction, CategorySetMetaDescriptionAction, CategorySetMetaKeywordsAction, CategorySetMetaTitleAction, CategorySetCustomTypeAction, CategorySetCustomFieldAction, CategoryRemoveAssetAction, CategoryAddAssetAction, ChannelDraft, Channel, ChannelUpdateAction, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerChangeEmailAction, CustomerSetAuthenticationModeAction, CustomerSetCustomFieldAction, CustomerGroupDraft, CustomerGroup, CustomerGroupSetKeyAction, CustomerGroupChangeNameAction, CustomerGroupSetCustomTypeAction, CustomerGroupSetCustomFieldAction, DiscountCodeDraft, DiscountCode, DiscountCodeUpdateAction, Extension, ExtensionDraft, ExtensionUpdateAction, InventoryEntryDraft, InventoryEntry, InventoryEntryChangeQuantityAction, InventoryEntrySetExpectedDeliveryAction, InventoryEntrySetCustomFieldAction, InventoryEntrySetCustomTypeAction, InventoryEntrySetRestockableInDaysAction, OrderFromCartDraft, Order, CartReference, OrderImportDraft, OrderAddPaymentAction, OrderChangeOrderStateAction, OrderChangePaymentStateAction, OrderTransitionStateAction, OrderSetBillingAddressAction, OrderSetCustomerEmailAction, OrderSetCustomFieldAction, OrderSetCustomTypeAction, OrderSetLocaleAction, OrderSetOrderNumberAction, OrderSetShippingAddressAction, OrderSetStoreAction, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, OrderEditUpdateAction, PaymentDraft, Payment, TransactionDraft, Transaction, PaymentSetCustomFieldAction, PaymentSetCustomTypeAction, PaymentAddTransactionAction, PaymentChangeTransactionStateAction, PaymentTransitionStateAction, ProductDraft, Product, ProductUpdateAction, ProductDiscountDraft, ProductDiscount, ProductDiscountUpdateAction, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ReviewUpdateAction, Review, ProductTypeDraft, ProductType, AttributeDefinitionDraft, AttributeDefinition, ProductTypeUpdateAction, ProjectUpdateAction, QuoteDraft, Quote, QuoteUpdateAction, QuoteRequestDraft, QuoteRequest, QuoteRequestUpdateAction, ReviewDraft, ShippingMethodDraft, ShippingMethod, ShippingMethodUpdateAction, ShoppingListDraft, ShoppingList, StagedQuoteDraft, StagedQuote, StagedQuoteUpdateAction, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, DiscountedPriceDraft, StandalonePriceChangeActiveAction, StandalonePriceChangeValueAction, StandalonePriceSetDiscountedPriceAction, StateDraft, State, StateUpdateAction, StoreDraft, Store, StoreUpdateAction, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TaxCategoryUpdateAction, TypeDraft, Type, TypeUpdateAction, ZoneDraft, Zone, ZoneUpdateAction, BaseResource, UpdateAction } from '@commercetools/platform-sdk';
|
|
4
|
-
import { ParsedQs } from 'qs';
|
|
3
|
+
import { Project, ResourceIdentifier, QueryParam, AssociateRoleDraft, AssociateRole, AssociateRoleSetNameAction, AssociateRoleSetPermissionsAction, AssociateRoleChangeBuyerAssignableAction, AssociateRoleSetCustomFieldAction, AssociateRoleAddPermissionAction, AssociateRoleRemovePermissionAction, AttributeGroupDraft, AttributeGroup, AttributeGroupSetAttributesAction, AttributeGroupChangeNameAction, AttributeGroupSetDescriptionAction, AttributeGroupSetKeyAction, BusinessUnitDraft, BusinessUnit, BusinessUnitAddAddressAction, BusinessUnitAddAssociateAction, BusinessUnitSetAssociatesAction, BusinessUnitSetContactEmailAction, BusinessUnitSetStoreModeAction, BusinessUnitChangeNameAction, BusinessUnitChangeAddressAction, BusinessUnitAddStoreAction, BusinessUnitChangeParentUnitAction, BusinessUnitChangeStatusAction, CartDraft, Cart, CartAddLineItemAction, CartChangeLineItemQuantityAction, CartRemoveLineItemAction, CartSetBillingAddressAction, CartSetShippingMethodAction, CartSetCountryAction, CartSetCustomerEmailAction, CartSetCustomFieldAction, CartSetCustomTypeAction, CartSetLocaleAction, CartSetShippingAddressAction, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CartDiscountUpdateAction, AssetDraft, Asset, CategoryDraft, Category, CategoryChangeAssetNameAction, CategoryChangeSlugAction, CategorySetKeyAction, CategorySetAssetDescriptionAction, CategorySetAssetSourcesAction, CategorySetDescriptionAction, CategorySetMetaDescriptionAction, CategorySetMetaKeywordsAction, CategorySetMetaTitleAction, CategorySetCustomTypeAction, CategorySetCustomFieldAction, CategoryRemoveAssetAction, CategoryAddAssetAction, ChannelDraft, Channel, ChannelUpdateAction, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerChangeEmailAction, CustomerSetAuthenticationModeAction, CustomerSetCustomFieldAction, CustomerGroupDraft, CustomerGroup, CustomerGroupSetKeyAction, CustomerGroupChangeNameAction, CustomerGroupSetCustomTypeAction, CustomerGroupSetCustomFieldAction, DiscountCodeDraft, DiscountCode, DiscountCodeUpdateAction, Extension, ExtensionDraft, ExtensionUpdateAction, InventoryEntryDraft, InventoryEntry, InventoryEntryChangeQuantityAction, InventoryEntrySetExpectedDeliveryAction, InventoryEntrySetCustomFieldAction, InventoryEntrySetCustomTypeAction, InventoryEntrySetRestockableInDaysAction, OrderFromCartDraft, Order, CartReference, OrderImportDraft, OrderAddPaymentAction, OrderChangeOrderStateAction, OrderChangePaymentStateAction, OrderTransitionStateAction, OrderSetBillingAddressAction, OrderSetCustomerEmailAction, OrderSetCustomFieldAction, OrderSetCustomTypeAction, OrderSetLocaleAction, OrderSetOrderNumberAction, OrderSetShippingAddressAction, OrderSetStoreAction, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, OrderEditUpdateAction, PaymentDraft, Payment, TransactionDraft, Transaction, PaymentSetCustomFieldAction, PaymentSetCustomTypeAction, PaymentAddTransactionAction, PaymentChangeTransactionStateAction, PaymentTransitionStateAction, ProductDraft, Product, ProductUpdateAction, ProductDiscountDraft, ProductDiscount, ProductDiscountUpdateAction, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ReviewUpdateAction, Review, ProductTypeDraft, ProductType, AttributeDefinitionDraft, AttributeDefinition, ProductTypeUpdateAction, ProjectUpdateAction, QuoteDraft, Quote, QuoteUpdateAction, QuoteRequestDraft, QuoteRequest, QuoteRequestUpdateAction, ReviewDraft, ShippingMethodDraft, ShippingMethod, ShippingMethodUpdateAction, ShoppingListDraft, ShoppingList, StagedQuoteDraft, StagedQuote, StagedQuoteUpdateAction, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, DiscountedPriceDraft, StandalonePriceChangeActiveAction, StandalonePriceChangeValueAction, StandalonePriceSetDiscountedPriceAction, StateDraft, State, StateUpdateAction, StoreDraft, Store, StoreUpdateAction, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TaxCategoryUpdateAction, TypeDraft, Type, TypeUpdateAction, ZoneDraft, Zone, ZoneUpdateAction, BaseResource, UpdateAction } from '@commercetools/platform-sdk';
|
|
5
4
|
|
|
6
5
|
type GetParams$1 = {
|
|
7
6
|
expand?: string[];
|
|
@@ -57,7 +56,22 @@ declare class AttributeGroupRepository extends AbstractResourceRepository<'attri
|
|
|
57
56
|
|
|
58
57
|
declare class BusinessUnitRepository extends AbstractResourceRepository<'business-unit'> {
|
|
59
58
|
getTypeId(): "business-unit";
|
|
60
|
-
|
|
59
|
+
private _isCompanyDraft;
|
|
60
|
+
private _isDivisionDraft;
|
|
61
|
+
create(context: RepositoryContext, draft: BusinessUnitDraft): BusinessUnit;
|
|
62
|
+
actions: {
|
|
63
|
+
addAddress: (context: RepositoryContext, resource: Writable<BusinessUnit>, { address }: BusinessUnitAddAddressAction) => void;
|
|
64
|
+
addAssociate: (context: RepositoryContext, resource: Writable<BusinessUnit>, { associate }: BusinessUnitAddAssociateAction) => void;
|
|
65
|
+
setAssociates: (context: RepositoryContext, resource: Writable<BusinessUnit>, { associates }: BusinessUnitSetAssociatesAction) => void;
|
|
66
|
+
setContactEmail: (context: RepositoryContext, resource: Writable<BusinessUnit>, { contactEmail }: BusinessUnitSetContactEmailAction) => void;
|
|
67
|
+
setStoreMode: (context: RepositoryContext, resource: Writable<BusinessUnit>, { storeMode }: BusinessUnitSetStoreModeAction) => void;
|
|
68
|
+
changeAssociateMode: (context: RepositoryContext, resource: Writable<BusinessUnit>, { storeMode }: BusinessUnitSetStoreModeAction) => void;
|
|
69
|
+
changeName: (context: RepositoryContext, resource: Writable<BusinessUnit>, { name }: BusinessUnitChangeNameAction) => void;
|
|
70
|
+
changeAddress: (context: RepositoryContext, resource: Writable<BusinessUnit>, { address }: BusinessUnitChangeAddressAction) => void;
|
|
71
|
+
addStore: (context: RepositoryContext, resource: Writable<BusinessUnit>, { store }: BusinessUnitAddStoreAction) => void;
|
|
72
|
+
changeParentUnit: (context: RepositoryContext, resource: Writable<BusinessUnit>, { parentUnit }: BusinessUnitChangeParentUnitAction) => void;
|
|
73
|
+
changeStatus: (context: RepositoryContext, resource: Writable<BusinessUnit>, { status }: BusinessUnitChangeStatusAction) => void;
|
|
74
|
+
};
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
declare class CartRepository extends AbstractResourceRepository<'cart'> {
|
|
@@ -275,9 +289,9 @@ declare class ProductProjectionSearch {
|
|
|
275
289
|
* - counting products
|
|
276
290
|
* - correct dataType
|
|
277
291
|
*/
|
|
278
|
-
termFacet(facet: string, products: ProductProjection[]): TermFacetResult;
|
|
279
|
-
filterFacet(source: string, filters: FilterExpression[] | undefined, products: ProductProjection[]): FilteredFacetResult;
|
|
280
|
-
rangeFacet(source: string, ranges: RangeExpression[] | undefined, products: ProductProjection[]): RangeFacetResult;
|
|
292
|
+
termFacet(facet: string, products: ProductProjection[], countProducts: boolean): TermFacetResult;
|
|
293
|
+
filterFacet(source: string, filters: FilterExpression[] | undefined, products: ProductProjection[], countProducts: boolean): FilteredFacetResult;
|
|
294
|
+
rangeFacet(source: string, ranges: RangeExpression[] | undefined, products: ProductProjection[], countProducts: boolean): RangeFacetResult;
|
|
281
295
|
}
|
|
282
296
|
|
|
283
297
|
type ProductProjectionQueryParams = {
|
|
@@ -286,7 +300,7 @@ type ProductProjectionQueryParams = {
|
|
|
286
300
|
priceCountry?: string;
|
|
287
301
|
priceCustomerGroup?: string;
|
|
288
302
|
priceChannel?: string;
|
|
289
|
-
localeProjection?: string
|
|
303
|
+
localeProjection?: string;
|
|
290
304
|
storeProjection?: string;
|
|
291
305
|
expand?: string | string[];
|
|
292
306
|
sort?: string | string[];
|
|
@@ -309,7 +323,7 @@ declare class ProductProjectionRepository extends AbstractResourceRepository<'pr
|
|
|
309
323
|
limit: number;
|
|
310
324
|
results: ProductProjection[];
|
|
311
325
|
};
|
|
312
|
-
search(context: RepositoryContext, query:
|
|
326
|
+
search(context: RepositoryContext, query: ProductProjectionQueryParams): ctp.ProductProjectionPagedSearchResponse;
|
|
313
327
|
actions: {};
|
|
314
328
|
}
|
|
315
329
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import * as ctp from '@commercetools/platform-sdk';
|
|
3
|
-
import { Project, ResourceIdentifier, QueryParam, AssociateRoleDraft, AssociateRole, AssociateRoleSetNameAction, AssociateRoleSetPermissionsAction, AssociateRoleChangeBuyerAssignableAction, AssociateRoleSetCustomFieldAction, AssociateRoleAddPermissionAction, AssociateRoleRemovePermissionAction, AttributeGroupDraft, AttributeGroup, AttributeGroupSetAttributesAction, AttributeGroupChangeNameAction, AttributeGroupSetDescriptionAction, AttributeGroupSetKeyAction, BusinessUnit, CartDraft, Cart, CartAddLineItemAction, CartChangeLineItemQuantityAction, CartRemoveLineItemAction, CartSetBillingAddressAction, CartSetShippingMethodAction, CartSetCountryAction, CartSetCustomerEmailAction, CartSetCustomFieldAction, CartSetCustomTypeAction, CartSetLocaleAction, CartSetShippingAddressAction, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CartDiscountUpdateAction, AssetDraft, Asset, CategoryDraft, Category, CategoryChangeAssetNameAction, CategoryChangeSlugAction, CategorySetKeyAction, CategorySetAssetDescriptionAction, CategorySetAssetSourcesAction, CategorySetDescriptionAction, CategorySetMetaDescriptionAction, CategorySetMetaKeywordsAction, CategorySetMetaTitleAction, CategorySetCustomTypeAction, CategorySetCustomFieldAction, CategoryRemoveAssetAction, CategoryAddAssetAction, ChannelDraft, Channel, ChannelUpdateAction, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerChangeEmailAction, CustomerSetAuthenticationModeAction, CustomerSetCustomFieldAction, CustomerGroupDraft, CustomerGroup, CustomerGroupSetKeyAction, CustomerGroupChangeNameAction, CustomerGroupSetCustomTypeAction, CustomerGroupSetCustomFieldAction, DiscountCodeDraft, DiscountCode, DiscountCodeUpdateAction, Extension, ExtensionDraft, ExtensionUpdateAction, InventoryEntryDraft, InventoryEntry, InventoryEntryChangeQuantityAction, InventoryEntrySetExpectedDeliveryAction, InventoryEntrySetCustomFieldAction, InventoryEntrySetCustomTypeAction, InventoryEntrySetRestockableInDaysAction, OrderFromCartDraft, Order, CartReference, OrderImportDraft, OrderAddPaymentAction, OrderChangeOrderStateAction, OrderChangePaymentStateAction, OrderTransitionStateAction, OrderSetBillingAddressAction, OrderSetCustomerEmailAction, OrderSetCustomFieldAction, OrderSetCustomTypeAction, OrderSetLocaleAction, OrderSetOrderNumberAction, OrderSetShippingAddressAction, OrderSetStoreAction, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, OrderEditUpdateAction, PaymentDraft, Payment, TransactionDraft, Transaction, PaymentSetCustomFieldAction, PaymentSetCustomTypeAction, PaymentAddTransactionAction, PaymentChangeTransactionStateAction, PaymentTransitionStateAction, ProductDraft, Product, ProductUpdateAction, ProductDiscountDraft, ProductDiscount, ProductDiscountUpdateAction, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ReviewUpdateAction, Review, ProductTypeDraft, ProductType, AttributeDefinitionDraft, AttributeDefinition, ProductTypeUpdateAction, ProjectUpdateAction, QuoteDraft, Quote, QuoteUpdateAction, QuoteRequestDraft, QuoteRequest, QuoteRequestUpdateAction, ReviewDraft, ShippingMethodDraft, ShippingMethod, ShippingMethodUpdateAction, ShoppingListDraft, ShoppingList, StagedQuoteDraft, StagedQuote, StagedQuoteUpdateAction, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, DiscountedPriceDraft, StandalonePriceChangeActiveAction, StandalonePriceChangeValueAction, StandalonePriceSetDiscountedPriceAction, StateDraft, State, StateUpdateAction, StoreDraft, Store, StoreUpdateAction, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TaxCategoryUpdateAction, TypeDraft, Type, TypeUpdateAction, ZoneDraft, Zone, ZoneUpdateAction, BaseResource, UpdateAction } from '@commercetools/platform-sdk';
|
|
4
|
-
import { ParsedQs } from 'qs';
|
|
3
|
+
import { Project, ResourceIdentifier, QueryParam, AssociateRoleDraft, AssociateRole, AssociateRoleSetNameAction, AssociateRoleSetPermissionsAction, AssociateRoleChangeBuyerAssignableAction, AssociateRoleSetCustomFieldAction, AssociateRoleAddPermissionAction, AssociateRoleRemovePermissionAction, AttributeGroupDraft, AttributeGroup, AttributeGroupSetAttributesAction, AttributeGroupChangeNameAction, AttributeGroupSetDescriptionAction, AttributeGroupSetKeyAction, BusinessUnitDraft, BusinessUnit, BusinessUnitAddAddressAction, BusinessUnitAddAssociateAction, BusinessUnitSetAssociatesAction, BusinessUnitSetContactEmailAction, BusinessUnitSetStoreModeAction, BusinessUnitChangeNameAction, BusinessUnitChangeAddressAction, BusinessUnitAddStoreAction, BusinessUnitChangeParentUnitAction, BusinessUnitChangeStatusAction, CartDraft, Cart, CartAddLineItemAction, CartChangeLineItemQuantityAction, CartRemoveLineItemAction, CartSetBillingAddressAction, CartSetShippingMethodAction, CartSetCountryAction, CartSetCustomerEmailAction, CartSetCustomFieldAction, CartSetCustomTypeAction, CartSetLocaleAction, CartSetShippingAddressAction, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CartDiscountUpdateAction, AssetDraft, Asset, CategoryDraft, Category, CategoryChangeAssetNameAction, CategoryChangeSlugAction, CategorySetKeyAction, CategorySetAssetDescriptionAction, CategorySetAssetSourcesAction, CategorySetDescriptionAction, CategorySetMetaDescriptionAction, CategorySetMetaKeywordsAction, CategorySetMetaTitleAction, CategorySetCustomTypeAction, CategorySetCustomFieldAction, CategoryRemoveAssetAction, CategoryAddAssetAction, ChannelDraft, Channel, ChannelUpdateAction, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerChangeEmailAction, CustomerSetAuthenticationModeAction, CustomerSetCustomFieldAction, CustomerGroupDraft, CustomerGroup, CustomerGroupSetKeyAction, CustomerGroupChangeNameAction, CustomerGroupSetCustomTypeAction, CustomerGroupSetCustomFieldAction, DiscountCodeDraft, DiscountCode, DiscountCodeUpdateAction, Extension, ExtensionDraft, ExtensionUpdateAction, InventoryEntryDraft, InventoryEntry, InventoryEntryChangeQuantityAction, InventoryEntrySetExpectedDeliveryAction, InventoryEntrySetCustomFieldAction, InventoryEntrySetCustomTypeAction, InventoryEntrySetRestockableInDaysAction, OrderFromCartDraft, Order, CartReference, OrderImportDraft, OrderAddPaymentAction, OrderChangeOrderStateAction, OrderChangePaymentStateAction, OrderTransitionStateAction, OrderSetBillingAddressAction, OrderSetCustomerEmailAction, OrderSetCustomFieldAction, OrderSetCustomTypeAction, OrderSetLocaleAction, OrderSetOrderNumberAction, OrderSetShippingAddressAction, OrderSetStoreAction, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, OrderEditUpdateAction, PaymentDraft, Payment, TransactionDraft, Transaction, PaymentSetCustomFieldAction, PaymentSetCustomTypeAction, PaymentAddTransactionAction, PaymentChangeTransactionStateAction, PaymentTransitionStateAction, ProductDraft, Product, ProductUpdateAction, ProductDiscountDraft, ProductDiscount, ProductDiscountUpdateAction, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ReviewUpdateAction, Review, ProductTypeDraft, ProductType, AttributeDefinitionDraft, AttributeDefinition, ProductTypeUpdateAction, ProjectUpdateAction, QuoteDraft, Quote, QuoteUpdateAction, QuoteRequestDraft, QuoteRequest, QuoteRequestUpdateAction, ReviewDraft, ShippingMethodDraft, ShippingMethod, ShippingMethodUpdateAction, ShoppingListDraft, ShoppingList, StagedQuoteDraft, StagedQuote, StagedQuoteUpdateAction, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, DiscountedPriceDraft, StandalonePriceChangeActiveAction, StandalonePriceChangeValueAction, StandalonePriceSetDiscountedPriceAction, StateDraft, State, StateUpdateAction, StoreDraft, Store, StoreUpdateAction, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TaxCategoryUpdateAction, TypeDraft, Type, TypeUpdateAction, ZoneDraft, Zone, ZoneUpdateAction, BaseResource, UpdateAction } from '@commercetools/platform-sdk';
|
|
5
4
|
|
|
6
5
|
type GetParams$1 = {
|
|
7
6
|
expand?: string[];
|
|
@@ -57,7 +56,22 @@ declare class AttributeGroupRepository extends AbstractResourceRepository<'attri
|
|
|
57
56
|
|
|
58
57
|
declare class BusinessUnitRepository extends AbstractResourceRepository<'business-unit'> {
|
|
59
58
|
getTypeId(): "business-unit";
|
|
60
|
-
|
|
59
|
+
private _isCompanyDraft;
|
|
60
|
+
private _isDivisionDraft;
|
|
61
|
+
create(context: RepositoryContext, draft: BusinessUnitDraft): BusinessUnit;
|
|
62
|
+
actions: {
|
|
63
|
+
addAddress: (context: RepositoryContext, resource: Writable<BusinessUnit>, { address }: BusinessUnitAddAddressAction) => void;
|
|
64
|
+
addAssociate: (context: RepositoryContext, resource: Writable<BusinessUnit>, { associate }: BusinessUnitAddAssociateAction) => void;
|
|
65
|
+
setAssociates: (context: RepositoryContext, resource: Writable<BusinessUnit>, { associates }: BusinessUnitSetAssociatesAction) => void;
|
|
66
|
+
setContactEmail: (context: RepositoryContext, resource: Writable<BusinessUnit>, { contactEmail }: BusinessUnitSetContactEmailAction) => void;
|
|
67
|
+
setStoreMode: (context: RepositoryContext, resource: Writable<BusinessUnit>, { storeMode }: BusinessUnitSetStoreModeAction) => void;
|
|
68
|
+
changeAssociateMode: (context: RepositoryContext, resource: Writable<BusinessUnit>, { storeMode }: BusinessUnitSetStoreModeAction) => void;
|
|
69
|
+
changeName: (context: RepositoryContext, resource: Writable<BusinessUnit>, { name }: BusinessUnitChangeNameAction) => void;
|
|
70
|
+
changeAddress: (context: RepositoryContext, resource: Writable<BusinessUnit>, { address }: BusinessUnitChangeAddressAction) => void;
|
|
71
|
+
addStore: (context: RepositoryContext, resource: Writable<BusinessUnit>, { store }: BusinessUnitAddStoreAction) => void;
|
|
72
|
+
changeParentUnit: (context: RepositoryContext, resource: Writable<BusinessUnit>, { parentUnit }: BusinessUnitChangeParentUnitAction) => void;
|
|
73
|
+
changeStatus: (context: RepositoryContext, resource: Writable<BusinessUnit>, { status }: BusinessUnitChangeStatusAction) => void;
|
|
74
|
+
};
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
declare class CartRepository extends AbstractResourceRepository<'cart'> {
|
|
@@ -275,9 +289,9 @@ declare class ProductProjectionSearch {
|
|
|
275
289
|
* - counting products
|
|
276
290
|
* - correct dataType
|
|
277
291
|
*/
|
|
278
|
-
termFacet(facet: string, products: ProductProjection[]): TermFacetResult;
|
|
279
|
-
filterFacet(source: string, filters: FilterExpression[] | undefined, products: ProductProjection[]): FilteredFacetResult;
|
|
280
|
-
rangeFacet(source: string, ranges: RangeExpression[] | undefined, products: ProductProjection[]): RangeFacetResult;
|
|
292
|
+
termFacet(facet: string, products: ProductProjection[], countProducts: boolean): TermFacetResult;
|
|
293
|
+
filterFacet(source: string, filters: FilterExpression[] | undefined, products: ProductProjection[], countProducts: boolean): FilteredFacetResult;
|
|
294
|
+
rangeFacet(source: string, ranges: RangeExpression[] | undefined, products: ProductProjection[], countProducts: boolean): RangeFacetResult;
|
|
281
295
|
}
|
|
282
296
|
|
|
283
297
|
type ProductProjectionQueryParams = {
|
|
@@ -286,7 +300,7 @@ type ProductProjectionQueryParams = {
|
|
|
286
300
|
priceCountry?: string;
|
|
287
301
|
priceCustomerGroup?: string;
|
|
288
302
|
priceChannel?: string;
|
|
289
|
-
localeProjection?: string
|
|
303
|
+
localeProjection?: string;
|
|
290
304
|
storeProjection?: string;
|
|
291
305
|
expand?: string | string[];
|
|
292
306
|
sort?: string | string[];
|
|
@@ -309,7 +323,7 @@ declare class ProductProjectionRepository extends AbstractResourceRepository<'pr
|
|
|
309
323
|
limit: number;
|
|
310
324
|
results: ProductProjection[];
|
|
311
325
|
};
|
|
312
|
-
search(context: RepositoryContext, query:
|
|
326
|
+
search(context: RepositoryContext, query: ProductProjectionQueryParams): ctp.ProductProjectionPagedSearchResponse;
|
|
313
327
|
actions: {};
|
|
314
328
|
}
|
|
315
329
|
|
package/dist/index.js
CHANGED
|
@@ -45,14 +45,22 @@ var nestedLookup = (obj, path) => {
|
|
|
45
45
|
}
|
|
46
46
|
return val;
|
|
47
47
|
};
|
|
48
|
-
var
|
|
48
|
+
var queryParamsArray = (input) => {
|
|
49
49
|
if (input == void 0) {
|
|
50
|
-
return
|
|
50
|
+
return void 0;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const values = Array.isArray(input) ? input : [input];
|
|
53
|
+
if (values.length < 1) {
|
|
54
|
+
return void 0;
|
|
54
55
|
}
|
|
55
|
-
return
|
|
56
|
+
return values;
|
|
57
|
+
};
|
|
58
|
+
var queryParamsValue = (value) => {
|
|
59
|
+
const values = queryParamsArray(value);
|
|
60
|
+
if (values && values.length > 0) {
|
|
61
|
+
return values[0];
|
|
62
|
+
}
|
|
63
|
+
return void 0;
|
|
56
64
|
};
|
|
57
65
|
var cloneObject = (o) => JSON.parse(JSON.stringify(o));
|
|
58
66
|
|
|
@@ -1543,6 +1551,71 @@ var getRepositoryContext = (request) => ({
|
|
|
1543
1551
|
projectKey: request.params.projectKey,
|
|
1544
1552
|
storeKey: request.params.storeKey
|
|
1545
1553
|
});
|
|
1554
|
+
var createAssociate = (a, projectKey, storage) => {
|
|
1555
|
+
if (!a)
|
|
1556
|
+
return void 0;
|
|
1557
|
+
if (!a.associateRoleAssignments) {
|
|
1558
|
+
throw new Error("AssociateRoleAssignments is required");
|
|
1559
|
+
}
|
|
1560
|
+
return {
|
|
1561
|
+
customer: getReferenceFromResourceIdentifier(
|
|
1562
|
+
a.customer,
|
|
1563
|
+
projectKey,
|
|
1564
|
+
storage
|
|
1565
|
+
),
|
|
1566
|
+
associateRoleAssignments: a.associateRoleAssignments?.map(
|
|
1567
|
+
(a2) => ({
|
|
1568
|
+
associateRole: getAssociateRoleKeyReference(
|
|
1569
|
+
a2.associateRole,
|
|
1570
|
+
projectKey,
|
|
1571
|
+
storage
|
|
1572
|
+
),
|
|
1573
|
+
inheritance: a2.inheritance
|
|
1574
|
+
})
|
|
1575
|
+
),
|
|
1576
|
+
roles: a.roles
|
|
1577
|
+
};
|
|
1578
|
+
};
|
|
1579
|
+
var getAssociateRoleKeyReference = (id, projectKey, storage) => {
|
|
1580
|
+
if (id.key) {
|
|
1581
|
+
return {
|
|
1582
|
+
typeId: "associate-role",
|
|
1583
|
+
key: id.key
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1586
|
+
const value = getReferenceFromResourceIdentifier(
|
|
1587
|
+
id,
|
|
1588
|
+
projectKey,
|
|
1589
|
+
storage
|
|
1590
|
+
);
|
|
1591
|
+
if (!value.obj?.key) {
|
|
1592
|
+
throw new Error("No associate-role found for reference");
|
|
1593
|
+
}
|
|
1594
|
+
return {
|
|
1595
|
+
typeId: "associate-role",
|
|
1596
|
+
key: value.obj?.key
|
|
1597
|
+
};
|
|
1598
|
+
};
|
|
1599
|
+
var getBusinessUnitKeyReference = (id, projectKey, storage) => {
|
|
1600
|
+
if (id.key) {
|
|
1601
|
+
return {
|
|
1602
|
+
typeId: "business-unit",
|
|
1603
|
+
key: id.key
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
const value = getReferenceFromResourceIdentifier(
|
|
1607
|
+
id,
|
|
1608
|
+
projectKey,
|
|
1609
|
+
storage
|
|
1610
|
+
);
|
|
1611
|
+
if (!value.obj?.key) {
|
|
1612
|
+
throw new Error("No business-unit found for reference");
|
|
1613
|
+
}
|
|
1614
|
+
return {
|
|
1615
|
+
typeId: "business-unit",
|
|
1616
|
+
key: value.obj?.key
|
|
1617
|
+
};
|
|
1618
|
+
};
|
|
1546
1619
|
|
|
1547
1620
|
// src/services/project.ts
|
|
1548
1621
|
var ProjectService = class {
|
|
@@ -1802,9 +1875,128 @@ var BusinessUnitRepository = class extends AbstractResourceRepository {
|
|
|
1802
1875
|
getTypeId() {
|
|
1803
1876
|
return "business-unit";
|
|
1804
1877
|
}
|
|
1878
|
+
_isCompanyDraft(draft) {
|
|
1879
|
+
return draft.unitType === "Company";
|
|
1880
|
+
}
|
|
1881
|
+
_isDivisionDraft(draft) {
|
|
1882
|
+
return draft.unitType === "Division";
|
|
1883
|
+
}
|
|
1805
1884
|
create(context, draft) {
|
|
1806
|
-
|
|
1885
|
+
const resource = {
|
|
1886
|
+
...getBaseResourceProperties(),
|
|
1887
|
+
key: draft.key,
|
|
1888
|
+
status: draft.status,
|
|
1889
|
+
stores: draft.stores?.map(
|
|
1890
|
+
(s) => getStoreKeyReference(s, context.projectKey, this._storage)
|
|
1891
|
+
),
|
|
1892
|
+
storeMode: draft.storeMode,
|
|
1893
|
+
name: draft.name,
|
|
1894
|
+
contactEmail: draft.contactEmail,
|
|
1895
|
+
addresses: draft.addresses?.map(
|
|
1896
|
+
(a) => createAddress(a, context.projectKey, this._storage)
|
|
1897
|
+
),
|
|
1898
|
+
custom: createCustomFields(
|
|
1899
|
+
draft.custom,
|
|
1900
|
+
context.projectKey,
|
|
1901
|
+
this._storage
|
|
1902
|
+
),
|
|
1903
|
+
shippingAddressIds: draft.shippingAddresses,
|
|
1904
|
+
defaultShippingAddressId: draft.defaultShippingAddress,
|
|
1905
|
+
billingAddressIds: draft.billingAddresses,
|
|
1906
|
+
associateMode: draft.associateMode,
|
|
1907
|
+
associates: draft.associates?.map(
|
|
1908
|
+
(a) => createAssociate(a, context.projectKey, this._storage)
|
|
1909
|
+
)
|
|
1910
|
+
};
|
|
1911
|
+
if (this._isDivisionDraft(draft)) {
|
|
1912
|
+
const division = {
|
|
1913
|
+
...resource,
|
|
1914
|
+
parentUnit: getBusinessUnitKeyReference(
|
|
1915
|
+
draft.parentUnit,
|
|
1916
|
+
context.projectKey,
|
|
1917
|
+
this._storage
|
|
1918
|
+
)
|
|
1919
|
+
};
|
|
1920
|
+
this.saveNew(context, division);
|
|
1921
|
+
return division;
|
|
1922
|
+
} else if (this._isCompanyDraft(draft)) {
|
|
1923
|
+
const company = resource;
|
|
1924
|
+
this.saveNew(context, company);
|
|
1925
|
+
return company;
|
|
1926
|
+
}
|
|
1927
|
+
throw new Error("Invalid business unit type");
|
|
1807
1928
|
}
|
|
1929
|
+
actions = {
|
|
1930
|
+
addAddress: (context, resource, { address }) => {
|
|
1931
|
+
const newAddress = createAddress(
|
|
1932
|
+
address,
|
|
1933
|
+
context.projectKey,
|
|
1934
|
+
this._storage
|
|
1935
|
+
);
|
|
1936
|
+
if (newAddress) {
|
|
1937
|
+
resource.addresses.push(newAddress);
|
|
1938
|
+
}
|
|
1939
|
+
},
|
|
1940
|
+
addAssociate: (context, resource, { associate }) => {
|
|
1941
|
+
const newAssociate = createAssociate(
|
|
1942
|
+
associate,
|
|
1943
|
+
context.projectKey,
|
|
1944
|
+
this._storage
|
|
1945
|
+
);
|
|
1946
|
+
if (newAssociate) {
|
|
1947
|
+
resource.associates.push(newAssociate);
|
|
1948
|
+
}
|
|
1949
|
+
},
|
|
1950
|
+
setAssociates: (context, resource, { associates }) => {
|
|
1951
|
+
const newAssociates = associates.map((a) => createAssociate(a, context.projectKey, this._storage)).filter((a) => a !== void 0);
|
|
1952
|
+
resource.associates = newAssociates || void 0;
|
|
1953
|
+
},
|
|
1954
|
+
setContactEmail: (context, resource, { contactEmail }) => {
|
|
1955
|
+
resource.contactEmail = contactEmail;
|
|
1956
|
+
},
|
|
1957
|
+
setStoreMode: (context, resource, { storeMode }) => {
|
|
1958
|
+
resource.storeMode = storeMode;
|
|
1959
|
+
},
|
|
1960
|
+
changeAssociateMode: (context, resource, { storeMode }) => {
|
|
1961
|
+
resource.associateMode = storeMode;
|
|
1962
|
+
},
|
|
1963
|
+
changeName: (context, resource, { name }) => {
|
|
1964
|
+
resource.name = name;
|
|
1965
|
+
},
|
|
1966
|
+
changeAddress: (context, resource, { address }) => {
|
|
1967
|
+
const newAddress = createAddress(
|
|
1968
|
+
address,
|
|
1969
|
+
context.projectKey,
|
|
1970
|
+
this._storage
|
|
1971
|
+
);
|
|
1972
|
+
if (newAddress) {
|
|
1973
|
+
resource.addresses.push(newAddress);
|
|
1974
|
+
}
|
|
1975
|
+
},
|
|
1976
|
+
addStore: (context, resource, { store }) => {
|
|
1977
|
+
const newStore = getStoreKeyReference(
|
|
1978
|
+
store,
|
|
1979
|
+
context.projectKey,
|
|
1980
|
+
this._storage
|
|
1981
|
+
);
|
|
1982
|
+
if (newStore) {
|
|
1983
|
+
if (!resource.stores) {
|
|
1984
|
+
resource.stores = [];
|
|
1985
|
+
}
|
|
1986
|
+
resource.stores.push(newStore);
|
|
1987
|
+
}
|
|
1988
|
+
},
|
|
1989
|
+
changeParentUnit: (context, resource, { parentUnit }) => {
|
|
1990
|
+
resource.parentUnit = getBusinessUnitKeyReference(
|
|
1991
|
+
parentUnit,
|
|
1992
|
+
context.projectKey,
|
|
1993
|
+
this._storage
|
|
1994
|
+
);
|
|
1995
|
+
},
|
|
1996
|
+
changeStatus: (context, resource, { status }) => {
|
|
1997
|
+
resource.status = status;
|
|
1998
|
+
}
|
|
1999
|
+
};
|
|
1808
2000
|
};
|
|
1809
2001
|
|
|
1810
2002
|
// src/repositories/cart.ts
|
|
@@ -2292,6 +2484,26 @@ var CartDiscountRepository = class extends AbstractResourceRepository {
|
|
|
2292
2484
|
} else {
|
|
2293
2485
|
resource.custom.fields[name] = value;
|
|
2294
2486
|
}
|
|
2487
|
+
},
|
|
2488
|
+
setCustomType: (context, resource, { type, fields }) => {
|
|
2489
|
+
if (!type) {
|
|
2490
|
+
resource.custom = void 0;
|
|
2491
|
+
} else {
|
|
2492
|
+
const resolvedType = this._storage.getByResourceIdentifier(
|
|
2493
|
+
context.projectKey,
|
|
2494
|
+
type
|
|
2495
|
+
);
|
|
2496
|
+
if (!resolvedType) {
|
|
2497
|
+
throw new Error(`Type ${type} not found`);
|
|
2498
|
+
}
|
|
2499
|
+
resource.custom = {
|
|
2500
|
+
type: {
|
|
2501
|
+
typeId: "type",
|
|
2502
|
+
id: resolvedType.id
|
|
2503
|
+
},
|
|
2504
|
+
fields: fields || {}
|
|
2505
|
+
};
|
|
2506
|
+
}
|
|
2295
2507
|
}
|
|
2296
2508
|
};
|
|
2297
2509
|
};
|
|
@@ -4185,25 +4397,36 @@ var ProductProjectionSearch = class {
|
|
|
4185
4397
|
getFacets(params, products) {
|
|
4186
4398
|
if (!params.facet)
|
|
4187
4399
|
return {};
|
|
4188
|
-
const staged = false;
|
|
4189
4400
|
const result = {};
|
|
4190
|
-
|
|
4401
|
+
const regexp = new RegExp(/ counting products$/);
|
|
4402
|
+
for (let facet of params.facet) {
|
|
4403
|
+
let countProducts = false;
|
|
4404
|
+
if (facet.endsWith(" counting products")) {
|
|
4405
|
+
facet = facet.replace(regexp, "");
|
|
4406
|
+
countProducts = true;
|
|
4407
|
+
}
|
|
4191
4408
|
const expression = generateFacetFunc(facet);
|
|
4192
4409
|
if (expression.type === "TermExpression") {
|
|
4193
|
-
result[facet] = this.termFacet(
|
|
4410
|
+
result[facet] = this.termFacet(
|
|
4411
|
+
expression.source,
|
|
4412
|
+
products,
|
|
4413
|
+
countProducts
|
|
4414
|
+
);
|
|
4194
4415
|
}
|
|
4195
4416
|
if (expression.type === "RangeExpression") {
|
|
4196
4417
|
result[expression.source] = this.rangeFacet(
|
|
4197
4418
|
expression.source,
|
|
4198
4419
|
expression.children,
|
|
4199
|
-
products
|
|
4420
|
+
products,
|
|
4421
|
+
countProducts
|
|
4200
4422
|
);
|
|
4201
4423
|
}
|
|
4202
4424
|
if (expression.type === "FilterExpression") {
|
|
4203
4425
|
result[expression.source] = this.filterFacet(
|
|
4204
4426
|
expression.source,
|
|
4205
4427
|
expression.children,
|
|
4206
|
-
products
|
|
4428
|
+
products,
|
|
4429
|
+
countProducts
|
|
4207
4430
|
);
|
|
4208
4431
|
}
|
|
4209
4432
|
}
|
|
@@ -4214,7 +4437,7 @@ var ProductProjectionSearch = class {
|
|
|
4214
4437
|
* - counting products
|
|
4215
4438
|
* - correct dataType
|
|
4216
4439
|
*/
|
|
4217
|
-
termFacet(facet, products) {
|
|
4440
|
+
termFacet(facet, products, countProducts) {
|
|
4218
4441
|
const result = {
|
|
4219
4442
|
type: "terms",
|
|
4220
4443
|
dataType: "text",
|
|
@@ -4259,7 +4482,7 @@ var ProductProjectionSearch = class {
|
|
|
4259
4482
|
}
|
|
4260
4483
|
return result;
|
|
4261
4484
|
}
|
|
4262
|
-
filterFacet(source, filters, products) {
|
|
4485
|
+
filterFacet(source, filters, products, countProducts) {
|
|
4263
4486
|
let count = 0;
|
|
4264
4487
|
if (source.startsWith("variants.")) {
|
|
4265
4488
|
for (const p of products) {
|
|
@@ -4278,7 +4501,7 @@ var ProductProjectionSearch = class {
|
|
|
4278
4501
|
count
|
|
4279
4502
|
};
|
|
4280
4503
|
}
|
|
4281
|
-
rangeFacet(source, ranges, products) {
|
|
4504
|
+
rangeFacet(source, ranges, products, countProducts) {
|
|
4282
4505
|
const counts = ranges?.map((range) => {
|
|
4283
4506
|
if (source.startsWith("variants.")) {
|
|
4284
4507
|
const values = [];
|
|
@@ -4400,16 +4623,7 @@ var ProductProjectionRepository = class extends AbstractResourceRepository {
|
|
|
4400
4623
|
};
|
|
4401
4624
|
}
|
|
4402
4625
|
search(context, query) {
|
|
4403
|
-
|
|
4404
|
-
filter: QueryParamsAsArray(query.filter),
|
|
4405
|
-
"filter.query": QueryParamsAsArray(query["filter.query"]),
|
|
4406
|
-
facet: QueryParamsAsArray(query.facet),
|
|
4407
|
-
offset: query.offset ? Number(query.offset) : void 0,
|
|
4408
|
-
limit: query.limit ? Number(query.limit) : void 0,
|
|
4409
|
-
expand: QueryParamsAsArray(query.expand),
|
|
4410
|
-
staged: query.staged === "true"
|
|
4411
|
-
});
|
|
4412
|
-
return results;
|
|
4626
|
+
return this._searchService.search(context.projectKey, query);
|
|
4413
4627
|
}
|
|
4414
4628
|
actions = {};
|
|
4415
4629
|
};
|
|
@@ -5414,12 +5628,7 @@ var AbstractService = class {
|
|
|
5414
5628
|
}
|
|
5415
5629
|
// No idea what i'm doing
|
|
5416
5630
|
_parseParam(value) {
|
|
5417
|
-
|
|
5418
|
-
return value;
|
|
5419
|
-
} else if (value !== void 0) {
|
|
5420
|
-
return [`${value}`];
|
|
5421
|
-
}
|
|
5422
|
-
return void 0;
|
|
5631
|
+
return queryParamsArray(value);
|
|
5423
5632
|
}
|
|
5424
5633
|
};
|
|
5425
5634
|
|
|
@@ -5435,6 +5644,18 @@ var AssociateRoleServices = class extends AbstractService {
|
|
|
5435
5644
|
}
|
|
5436
5645
|
};
|
|
5437
5646
|
|
|
5647
|
+
// src/services/business-units.ts
|
|
5648
|
+
var BusinessUnitServices = class extends AbstractService {
|
|
5649
|
+
repository;
|
|
5650
|
+
constructor(parent, repository) {
|
|
5651
|
+
super(parent);
|
|
5652
|
+
this.repository = repository;
|
|
5653
|
+
}
|
|
5654
|
+
getBasePath() {
|
|
5655
|
+
return "business-units";
|
|
5656
|
+
}
|
|
5657
|
+
};
|
|
5658
|
+
|
|
5438
5659
|
// src/services/cart.ts
|
|
5439
5660
|
var CartService = class extends AbstractService {
|
|
5440
5661
|
repository;
|
|
@@ -5862,9 +6083,25 @@ var ProductProjectionService = class extends AbstractService {
|
|
|
5862
6083
|
return response.status(200).send(result);
|
|
5863
6084
|
}
|
|
5864
6085
|
search(request, response) {
|
|
6086
|
+
const query = request.query;
|
|
6087
|
+
const searchParams = {
|
|
6088
|
+
filter: queryParamsArray(query.filter),
|
|
6089
|
+
"filter.query": queryParamsArray(query["filter.query"]),
|
|
6090
|
+
facet: queryParamsArray(query.facet),
|
|
6091
|
+
expand: queryParamsArray(query.expand),
|
|
6092
|
+
staged: queryParamsValue(query.staged) === "true",
|
|
6093
|
+
localeProjection: queryParamsValue(query.localeProjection),
|
|
6094
|
+
storeProjection: queryParamsValue(query.storeProjection),
|
|
6095
|
+
priceChannel: queryParamsValue(query.priceChannel),
|
|
6096
|
+
priceCountry: queryParamsValue(query.priceCountry),
|
|
6097
|
+
priceCurrency: queryParamsValue(query.priceCurrency),
|
|
6098
|
+
priceCustomerGroup: queryParamsValue(query.priceCustomerGroup),
|
|
6099
|
+
offset: query.offset ? Number(queryParamsValue(query.offset)) : void 0,
|
|
6100
|
+
limit: query.limit ? Number(queryParamsValue(query.limit)) : void 0
|
|
6101
|
+
};
|
|
5865
6102
|
const resource = this.repository.search(
|
|
5866
6103
|
getRepositoryContext(request),
|
|
5867
|
-
|
|
6104
|
+
searchParams
|
|
5868
6105
|
);
|
|
5869
6106
|
return response.status(200).send(resource);
|
|
5870
6107
|
}
|
|
@@ -6009,6 +6246,7 @@ var AttributeGroupService = class extends AbstractService {
|
|
|
6009
6246
|
// src/services/index.ts
|
|
6010
6247
|
var createServices = (router, repos) => ({
|
|
6011
6248
|
"associate-role": new AssociateRoleServices(router, repos["associate-role"]),
|
|
6249
|
+
"business-unit": new BusinessUnitServices(router, repos["business-unit"]),
|
|
6012
6250
|
category: new CategoryServices(router, repos["category"]),
|
|
6013
6251
|
cart: new CartService(router, repos["cart"], repos["order"]),
|
|
6014
6252
|
"cart-discount": new CartDiscountService(router, repos["cart-discount"]),
|