@labdigital/commercetools-mock 2.17.1 → 2.18.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/dist/index.cjs +4351 -4099
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +266 -413
- package/dist/index.d.ts +266 -413
- package/dist/index.js +4351 -4099
- package/dist/index.js.map +1 -1
- package/package.json +47 -47
- package/src/constants.ts +2 -2
- package/src/ctMock.test.ts +11 -11
- package/src/ctMock.ts +141 -127
- package/src/deprecation.ts +8 -0
- package/src/exceptions.ts +17 -15
- package/src/helpers.ts +32 -32
- package/src/index.test.ts +128 -128
- package/src/index.ts +3 -3
- package/src/lib/expandParser.ts +13 -13
- package/src/lib/haversine.test.ts +9 -9
- package/src/lib/haversine.ts +11 -11
- package/src/lib/masking.ts +11 -11
- package/src/lib/parser.ts +2 -2
- package/src/lib/password.ts +23 -3
- package/src/lib/predicateParser.test.ts +185 -183
- package/src/lib/predicateParser.ts +234 -234
- package/src/lib/projectionSearchFilter.test.ts +103 -101
- package/src/lib/projectionSearchFilter.ts +152 -150
- package/src/lib/proxy.ts +5 -5
- package/src/oauth/errors.ts +4 -4
- package/src/oauth/helpers.ts +6 -6
- package/src/oauth/server.test.ts +86 -86
- package/src/oauth/server.ts +158 -144
- package/src/oauth/store.ts +44 -43
- package/src/priceSelector.test.ts +35 -35
- package/src/priceSelector.ts +30 -30
- package/src/product-projection-search.ts +136 -134
- package/src/projectAPI.test.ts +7 -7
- package/src/projectAPI.ts +24 -22
- package/src/repositories/abstract.ts +168 -116
- package/src/repositories/associate-role.ts +90 -77
- package/src/repositories/attribute-group.ts +51 -40
- package/src/repositories/business-unit.ts +168 -148
- package/src/repositories/cart/actions.ts +489 -0
- package/src/repositories/cart/helpers.ts +30 -0
- package/src/repositories/cart/index.ts +180 -0
- package/src/repositories/cart-discount/actions.ts +148 -0
- package/src/repositories/cart-discount/index.ts +86 -0
- package/src/repositories/category/actions.ts +231 -0
- package/src/repositories/category/index.ts +52 -0
- package/src/repositories/channel.ts +88 -90
- package/src/repositories/custom-object.ts +46 -45
- package/src/repositories/customer/actions.ts +165 -0
- package/src/repositories/customer/index.ts +79 -0
- package/src/repositories/customer-group.ts +66 -55
- package/src/repositories/discount-code/actions.ts +149 -0
- package/src/repositories/discount-code/index.ts +50 -0
- package/src/repositories/errors.ts +10 -10
- package/src/repositories/extension.ts +64 -62
- package/src/repositories/helpers.ts +117 -118
- package/src/repositories/index.ts +80 -79
- package/src/repositories/inventory-entry/actions.ts +84 -0
- package/src/repositories/inventory-entry/index.ts +44 -0
- package/src/repositories/my-customer.ts +114 -0
- package/src/repositories/my-order.ts +8 -8
- package/src/repositories/order/actions.ts +281 -0
- package/src/repositories/{order.test.ts → order/index.test.ts} +77 -77
- package/src/repositories/order/index.ts +260 -0
- package/src/repositories/order-edit.ts +10 -23
- package/src/repositories/payment/actions.ts +305 -0
- package/src/repositories/payment/helpers.ts +17 -0
- package/src/repositories/payment/index.ts +56 -0
- package/src/repositories/product/actions.ts +943 -0
- package/src/repositories/product/helpers.ts +98 -0
- package/src/repositories/product/index.ts +130 -0
- package/src/repositories/product-discount.ts +127 -117
- package/src/repositories/product-projection.ts +56 -62
- package/src/repositories/product-selection.ts +31 -28
- package/src/repositories/product-type.ts +136 -134
- package/src/repositories/project.ts +133 -118
- package/src/repositories/quote-request.ts +7 -19
- package/src/repositories/quote.ts +7 -22
- package/src/repositories/review.ts +13 -26
- package/src/repositories/shipping-method/actions.ts +198 -0
- package/src/repositories/shipping-method/helpers.ts +10 -0
- package/src/repositories/shipping-method/index.ts +138 -0
- package/src/repositories/shopping-list/actions.ts +295 -0
- package/src/repositories/shopping-list/index.ts +122 -0
- package/src/repositories/staged-quote.ts +7 -20
- package/src/repositories/standalone-price.ts +57 -44
- package/src/repositories/state.ts +113 -68
- package/src/repositories/store.ts +106 -94
- package/src/repositories/subscription.ts +46 -22
- package/src/repositories/tax-category/actions.ts +94 -0
- package/src/repositories/tax-category/helpers.ts +8 -0
- package/src/repositories/tax-category/index.ts +25 -0
- package/src/repositories/type/actions.ts +162 -0
- package/src/repositories/type/index.ts +24 -0
- package/src/repositories/zone.ts +62 -58
- package/src/schemas/update-request.ts +12 -0
- package/src/server.ts +9 -9
- package/src/services/abstract.ts +85 -72
- package/src/services/associate-roles.test.ts +27 -27
- package/src/services/associate-roles.ts +7 -7
- package/src/services/attribute-group.ts +7 -7
- package/src/services/business-units.test.ts +28 -28
- package/src/services/business-units.ts +7 -7
- package/src/services/cart-discount.test.ts +199 -199
- package/src/services/cart-discount.ts +7 -7
- package/src/services/cart.test.ts +261 -261
- package/src/services/cart.ts +22 -21
- package/src/services/category.test.ts +121 -121
- package/src/services/category.ts +7 -7
- package/src/services/channel.ts +7 -7
- package/src/services/custom-object.test.ts +130 -130
- package/src/services/custom-object.ts +34 -31
- package/src/services/customer-group.ts +7 -7
- package/src/services/customer.test.ts +205 -205
- package/src/services/customer.ts +23 -36
- package/src/services/discount-code.ts +7 -7
- package/src/services/extension.ts +7 -7
- package/src/services/index.ts +85 -81
- package/src/services/inventory-entry.test.ts +106 -106
- package/src/services/inventory-entry.ts +7 -7
- package/src/services/my-cart.test.ts +56 -56
- package/src/services/my-cart.ts +20 -20
- package/src/services/my-customer.test.ts +155 -104
- package/src/services/my-customer.ts +66 -75
- package/src/services/my-order.ts +16 -16
- package/src/services/my-payment.test.ts +40 -40
- package/src/services/my-payment.ts +7 -7
- package/src/services/my-shopping-list.ts +7 -7
- package/src/services/order.test.ts +243 -243
- package/src/services/order.ts +23 -18
- package/src/services/payment.test.ts +40 -40
- package/src/services/payment.ts +7 -7
- package/src/services/product-discount.ts +7 -7
- package/src/services/product-projection.test.ts +190 -190
- package/src/services/product-projection.ts +34 -32
- package/src/services/product-selection.test.ts +19 -19
- package/src/services/product-selection.ts +7 -7
- package/src/services/product-type.test.ts +38 -38
- package/src/services/product-type.ts +7 -7
- package/src/services/product.test.ts +658 -656
- package/src/services/product.ts +7 -7
- package/src/services/project.test.ts +29 -24
- package/src/services/project.ts +22 -17
- package/src/services/reviews.ts +7 -7
- package/src/services/shipping-method.test.ts +78 -78
- package/src/services/shipping-method.ts +16 -16
- package/src/services/shopping-list.test.ts +170 -170
- package/src/services/shopping-list.ts +7 -7
- package/src/services/standalone-price.test.ts +112 -112
- package/src/services/standalone-price.ts +7 -7
- package/src/services/state.test.ts +30 -30
- package/src/services/state.ts +7 -7
- package/src/services/store.test.ts +40 -40
- package/src/services/store.ts +7 -7
- package/src/services/subscription.ts +7 -7
- package/src/services/tax-category.test.ts +43 -43
- package/src/services/tax-category.ts +7 -7
- package/src/services/type.ts +7 -7
- package/src/services/zone.ts +7 -7
- package/src/shippingCalculator.test.ts +43 -43
- package/src/shippingCalculator.ts +23 -23
- package/src/storage/abstract.ts +36 -34
- package/src/storage/in-memory.ts +237 -233
- package/src/storage/index.ts +2 -2
- package/src/types.ts +91 -91
- package/src/validate.ts +18 -0
- package/src/repositories/cart-discount.ts +0 -219
- package/src/repositories/cart.ts +0 -659
- package/src/repositories/category.ts +0 -256
- package/src/repositories/customer.ts +0 -228
- package/src/repositories/discount-code.ts +0 -181
- package/src/repositories/inventory-entry.ts +0 -109
- package/src/repositories/order.ts +0 -514
- package/src/repositories/payment.ts +0 -342
- package/src/repositories/product.ts +0 -1106
- package/src/repositories/shipping-method.ts +0 -312
- package/src/repositories/shopping-list.ts +0 -392
- package/src/repositories/tax-category.ts +0 -111
- package/src/repositories/type.ts +0 -172
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { SetupServer } from 'msw/node';
|
|
3
3
|
import * as ctp from '@commercetools/platform-sdk';
|
|
4
|
-
import {
|
|
4
|
+
import { QueryParam, BaseResource, Project, UpdateAction, ResourceIdentifier, AssociateRoleDraft, AssociateRole, AttributeGroupDraft, AttributeGroup, BusinessUnitDraft, BusinessUnit, CartDraft, Cart, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CategoryDraft, Category, ChannelDraft, Channel, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerToken, CustomerGroupDraft, CustomerGroup, DiscountCodeDraft, DiscountCode, ExtensionDraft, Extension, InventoryEntryDraft, InventoryEntry, MyCustomerChangePassword, MyCustomerResetPassword, OrderFromCartDraft, Order, CartReference, OrderImportDraft, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, PaymentDraft, Payment, ProductDraft, Product, ProductDiscountDraft, ProductDiscount, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ProductTypeDraft, ProductType, QuoteDraft, Quote, QuoteRequestDraft, QuoteRequest, ReviewDraft, Review, ShippingMethodDraft, ShippingMethod, ZoneReference, ShoppingListDraft, ShoppingList, ShoppingListLineItem, StagedQuoteDraft, StagedQuote, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, StateDraft, State, StoreDraft, Store, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TypeDraft, Type, ZoneDraft, Zone } from '@commercetools/platform-sdk';
|
|
5
5
|
|
|
6
6
|
type Token = {
|
|
7
7
|
access_token: string;
|
|
8
|
-
token_type:
|
|
8
|
+
token_type: "Bearer";
|
|
9
9
|
expires_in: number;
|
|
10
10
|
scope: string;
|
|
11
11
|
refresh_token?: string;
|
|
@@ -27,10 +27,138 @@ declare class OAuth2Store {
|
|
|
27
27
|
validateToken(token: string): boolean;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
type QueryParams$1 = {
|
|
31
|
+
expand?: string[];
|
|
32
|
+
where?: string[];
|
|
33
|
+
offset?: number;
|
|
34
|
+
limit?: number;
|
|
35
|
+
[key: string]: QueryParam;
|
|
36
|
+
};
|
|
30
37
|
type GetParams$1 = {
|
|
31
38
|
expand?: string[];
|
|
32
39
|
};
|
|
33
|
-
type
|
|
40
|
+
type RepositoryContext = {
|
|
41
|
+
projectKey: string;
|
|
42
|
+
storeKey?: string;
|
|
43
|
+
};
|
|
44
|
+
declare abstract class AbstractRepository<R extends BaseResource | Project> {
|
|
45
|
+
protected _storage: AbstractStorage;
|
|
46
|
+
protected actions: AbstractUpdateHandler | undefined;
|
|
47
|
+
constructor(storage: AbstractStorage);
|
|
48
|
+
abstract saveNew({ projectKey }: RepositoryContext, resource: R): void;
|
|
49
|
+
abstract saveUpdate({ projectKey }: RepositoryContext, version: number, resource: R): void;
|
|
50
|
+
abstract postProcessResource(resource: any): any;
|
|
51
|
+
processUpdateActions(context: RepositoryContext, resource: R, version: number, actions: UpdateAction[]): R;
|
|
52
|
+
}
|
|
53
|
+
declare abstract class AbstractResourceRepository<T extends ResourceType> extends AbstractRepository<ResourceMap[T]> {
|
|
54
|
+
protected _typeId: T;
|
|
55
|
+
constructor(typeId: T, storage: AbstractStorage);
|
|
56
|
+
abstract create(context: RepositoryContext, draft: any): ResourceMap[T];
|
|
57
|
+
protected getTypeId(): T;
|
|
58
|
+
delete(context: RepositoryContext, id: string, params?: GetParams$1): ResourceMap[T] | null;
|
|
59
|
+
get(context: RepositoryContext, id: string, params?: GetParams$1): ResourceMap[T] | null;
|
|
60
|
+
getByKey(context: RepositoryContext, key: string, params?: GetParams$1): ResourceMap[T] | null;
|
|
61
|
+
postProcessResource(resource: ResourceMap[T]): ResourceMap[T];
|
|
62
|
+
query(context: RepositoryContext, params?: QueryParams$1): PagedQueryResponseMap[T];
|
|
63
|
+
saveNew(context: RepositoryContext, resource: ShallowWritable<ResourceMap[T]>): ResourceMap[T];
|
|
64
|
+
saveUpdate(context: RepositoryContext, version: number, resource: ShallowWritable<ResourceMap[T]>): ShallowWritable<ResourceMap[T]>;
|
|
65
|
+
}
|
|
66
|
+
declare class AbstractUpdateHandler {
|
|
67
|
+
protected _storage: AbstractStorage;
|
|
68
|
+
constructor(_storage: AbstractStorage);
|
|
69
|
+
apply<R extends BaseResource | Project>(context: RepositoryContext, resource: R, version: number, actions: UpdateAction[]): R;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
type Writable<T> = {
|
|
73
|
+
-readonly [P in keyof T]: Writable<T[P]>;
|
|
74
|
+
};
|
|
75
|
+
type ShallowWritable<T> = {
|
|
76
|
+
-readonly [P in keyof T]: T[P];
|
|
77
|
+
};
|
|
78
|
+
type ResourceType = keyof ResourceMap & keyof RepositoryMap;
|
|
79
|
+
type ResourceMap = {
|
|
80
|
+
"attribute-group": ctp.AttributeGroup;
|
|
81
|
+
"associate-role": ctp.AssociateRole;
|
|
82
|
+
"business-unit": ctp.BusinessUnit;
|
|
83
|
+
"cart-discount": ctp.CartDiscount;
|
|
84
|
+
"cart": ctp.Cart;
|
|
85
|
+
"category": ctp.Category;
|
|
86
|
+
"channel": ctp.Channel;
|
|
87
|
+
"customer-email-token": never;
|
|
88
|
+
"customer-group": ctp.CustomerGroup;
|
|
89
|
+
"customer-password-token": never;
|
|
90
|
+
"customer": ctp.Customer;
|
|
91
|
+
"discount-code": ctp.DiscountCode;
|
|
92
|
+
"extension": ctp.Extension;
|
|
93
|
+
"inventory-entry": ctp.InventoryEntry;
|
|
94
|
+
"key-value-document": ctp.CustomObject;
|
|
95
|
+
"order-edit": ctp.OrderEdit;
|
|
96
|
+
"order": ctp.Order;
|
|
97
|
+
"payment": ctp.Payment;
|
|
98
|
+
"product-discount": ctp.ProductDiscount;
|
|
99
|
+
"product-price": ctp.StandalonePrice;
|
|
100
|
+
"product-projection": ctp.ProductProjection;
|
|
101
|
+
"product-selection": ctp.ProductSelection;
|
|
102
|
+
"product-type": ctp.ProductType;
|
|
103
|
+
"product": ctp.Product;
|
|
104
|
+
"quote-request": ctp.QuoteRequest;
|
|
105
|
+
"quote": ctp.Quote;
|
|
106
|
+
"review": ctp.Review;
|
|
107
|
+
"shipping-method": ctp.ShippingMethod;
|
|
108
|
+
"shopping-list": ctp.ShoppingList;
|
|
109
|
+
"staged-quote": ctp.StagedQuote;
|
|
110
|
+
"standalone-price": ctp.StandalonePrice;
|
|
111
|
+
"state": ctp.State;
|
|
112
|
+
"store": ctp.Store;
|
|
113
|
+
"subscription": ctp.Subscription;
|
|
114
|
+
"tax-category": ctp.TaxCategory;
|
|
115
|
+
"type": ctp.Type;
|
|
116
|
+
"zone": ctp.Zone;
|
|
117
|
+
};
|
|
118
|
+
type PagedQueryResponseMap = {
|
|
119
|
+
"attribute-group": ctp.AttributeGroupPagedQueryResponse;
|
|
120
|
+
"associate-role": ctp.AssociateRolePagedQueryResponse;
|
|
121
|
+
"business-unit": ctp.BusinessUnitPagedQueryResponse;
|
|
122
|
+
"cart-discount": ctp.CartDiscountPagedQueryResponse;
|
|
123
|
+
"cart": ctp.CartPagedQueryResponse;
|
|
124
|
+
"category": ctp.CategoryPagedQueryResponse;
|
|
125
|
+
"channel": ctp.ChannelPagedQueryResponse;
|
|
126
|
+
"customer-email-token": never;
|
|
127
|
+
"customer-group": ctp.CustomerGroupPagedQueryResponse;
|
|
128
|
+
"customer-password-token": never;
|
|
129
|
+
"customer": ctp.CustomerPagedQueryResponse;
|
|
130
|
+
"discount-code": ctp.DiscountCodePagedQueryResponse;
|
|
131
|
+
"extension": ctp.ExtensionPagedQueryResponse;
|
|
132
|
+
"inventory-entry": ctp.InventoryPagedQueryResponse;
|
|
133
|
+
"key-value-document": ctp.CustomObjectPagedQueryResponse;
|
|
134
|
+
"order-edit": ctp.OrderEditPagedQueryResponse;
|
|
135
|
+
"order": ctp.OrderPagedQueryResponse;
|
|
136
|
+
"payment": ctp.PaymentPagedQueryResponse;
|
|
137
|
+
"product-discount": ctp.ProductDiscountPagedQueryResponse;
|
|
138
|
+
"product-price": ctp.StandalonePricePagedQueryResponse;
|
|
139
|
+
"product-projection": ctp.ProductProjectionPagedQueryResponse;
|
|
140
|
+
"product-selection": ctp.ProductSelectionPagedQueryResponse;
|
|
141
|
+
"product-type": ctp.ProductTypePagedQueryResponse;
|
|
142
|
+
"product": ctp.ProductPagedQueryResponse;
|
|
143
|
+
"quote-request": ctp.QuoteRequestPagedQueryResponse;
|
|
144
|
+
"quote": ctp.QuotePagedQueryResponse;
|
|
145
|
+
"review": ctp.ReviewPagedQueryResponse;
|
|
146
|
+
"shipping-method": ctp.ShippingMethodPagedQueryResponse;
|
|
147
|
+
"shopping-list": ctp.ShoppingListPagedQueryResponse;
|
|
148
|
+
"staged-quote": ctp.StagedQuotePagedQueryResponse;
|
|
149
|
+
"standalone-price": ctp.StandalonePricePagedQueryResponse;
|
|
150
|
+
"state": ctp.StatePagedQueryResponse;
|
|
151
|
+
"store": ctp.StorePagedQueryResponse;
|
|
152
|
+
"subscription": ctp.SubscriptionPagedQueryResponse;
|
|
153
|
+
"tax-category": ctp.TaxCategoryPagedQueryResponse;
|
|
154
|
+
"type": ctp.TypePagedQueryResponse;
|
|
155
|
+
"zone": ctp.ZonePagedQueryResponse;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
type GetParams = {
|
|
159
|
+
expand?: string[];
|
|
160
|
+
};
|
|
161
|
+
type QueryParams = {
|
|
34
162
|
expand?: string | string[];
|
|
35
163
|
sort?: string | string[];
|
|
36
164
|
limit?: number;
|
|
@@ -42,242 +170,131 @@ type QueryParams$1 = {
|
|
|
42
170
|
declare abstract class AbstractStorage {
|
|
43
171
|
abstract clear(): void;
|
|
44
172
|
abstract all<RT extends ResourceType>(projectKey: string, typeId: RT): Array<ResourceMap[RT]>;
|
|
45
|
-
abstract add<RT extends ResourceType>(projectKey: string, typeId: RT, obj: ResourceMap[RT]):
|
|
46
|
-
abstract get<RT extends ResourceType>(projectKey: string, typeId: RT, id: string, params?: GetParams
|
|
47
|
-
abstract getByKey<RT extends ResourceType>(projectKey: string, typeId: RT, key: string, params: GetParams
|
|
173
|
+
abstract add<RT extends ResourceType>(projectKey: string, typeId: RT, obj: ResourceMap[RT]): ResourceMap[RT];
|
|
174
|
+
abstract get<RT extends ResourceType>(projectKey: string, typeId: RT, id: string, params?: GetParams): ResourceMap[RT] | null;
|
|
175
|
+
abstract getByKey<RT extends ResourceType>(projectKey: string, typeId: RT, key: string, params: GetParams): ResourceMap[RT] | null;
|
|
48
176
|
abstract addProject(projectKey: string): Project;
|
|
49
177
|
abstract getProject(projectKey: string): Project;
|
|
50
178
|
abstract saveProject(project: Project): Project;
|
|
51
|
-
abstract delete<RT extends ResourceType>(projectKey: string, typeId: RT, id: string, params: GetParams
|
|
52
|
-
abstract query<RT extends ResourceType>(projectKey: string, typeId: RT, params: QueryParams
|
|
179
|
+
abstract delete<RT extends ResourceType>(projectKey: string, typeId: RT, id: string, params: GetParams): ResourceMap[RT] | null;
|
|
180
|
+
abstract query<RT extends ResourceType>(projectKey: string, typeId: RT, params: QueryParams): PagedQueryResponseMap[RT];
|
|
53
181
|
abstract getByResourceIdentifier<RT extends ResourceType>(projectKey: string, identifier: ResourceIdentifier): ResourceMap[RT];
|
|
54
182
|
abstract expand<T>(projectKey: string, obj: T, clause: undefined | string | string[]): T;
|
|
55
183
|
}
|
|
56
184
|
|
|
57
|
-
declare class AssociateRoleRepository extends AbstractResourceRepository<
|
|
58
|
-
|
|
185
|
+
declare class AssociateRoleRepository extends AbstractResourceRepository<"associate-role"> {
|
|
186
|
+
constructor(storage: AbstractStorage);
|
|
59
187
|
create(context: RepositoryContext, draft: AssociateRoleDraft): AssociateRole;
|
|
60
|
-
actions: {
|
|
61
|
-
setName: (context: RepositoryContext, resource: Writable<AssociateRole>, { name }: AssociateRoleSetNameAction) => void;
|
|
62
|
-
setPermissions: (context: RepositoryContext, resource: Writable<AssociateRole>, { permissions }: AssociateRoleSetPermissionsAction) => void;
|
|
63
|
-
setBuyerAssignable: (context: RepositoryContext, resource: Writable<AssociateRole>, { buyerAssignable }: AssociateRoleChangeBuyerAssignableAction) => void;
|
|
64
|
-
changeBuyerAssignable: (context: RepositoryContext, resource: Writable<AssociateRole>, { buyerAssignable }: AssociateRoleChangeBuyerAssignableAction) => void;
|
|
65
|
-
setCustomFields: (context: RepositoryContext, resource: Writable<AssociateRole>, { name, value }: AssociateRoleSetCustomFieldAction) => void;
|
|
66
|
-
addPermission: (context: RepositoryContext, resource: Writable<AssociateRole>, { permission }: AssociateRoleAddPermissionAction) => void;
|
|
67
|
-
removePermission: (context: RepositoryContext, resource: Writable<AssociateRole>, { permission }: AssociateRoleRemovePermissionAction) => void;
|
|
68
|
-
};
|
|
69
188
|
}
|
|
70
189
|
|
|
71
|
-
declare class AttributeGroupRepository extends AbstractResourceRepository<
|
|
72
|
-
|
|
190
|
+
declare class AttributeGroupRepository extends AbstractResourceRepository<"attribute-group"> {
|
|
191
|
+
constructor(storage: AbstractStorage);
|
|
73
192
|
create(context: RepositoryContext, draft: AttributeGroupDraft): AttributeGroup;
|
|
74
|
-
actions: {
|
|
75
|
-
setAttributes: (_context: RepositoryContext, resource: Writable<AttributeGroup>, { attributes }: AttributeGroupSetAttributesAction) => void;
|
|
76
|
-
changeName: (_context: RepositoryContext, resource: Writable<AttributeGroup>, { name }: AttributeGroupChangeNameAction) => void;
|
|
77
|
-
setDescription: (_context: RepositoryContext, resource: Writable<AttributeGroup>, { description }: AttributeGroupSetDescriptionAction) => void;
|
|
78
|
-
setKey: (_context: RepositoryContext, resource: Writable<AttributeGroup>, { key }: AttributeGroupSetKeyAction) => void;
|
|
79
|
-
};
|
|
80
193
|
}
|
|
81
194
|
|
|
82
|
-
declare class BusinessUnitRepository extends AbstractResourceRepository<
|
|
83
|
-
|
|
195
|
+
declare class BusinessUnitRepository extends AbstractResourceRepository<"business-unit"> {
|
|
196
|
+
constructor(storage: AbstractStorage);
|
|
197
|
+
create(context: RepositoryContext, draft: BusinessUnitDraft): BusinessUnit;
|
|
84
198
|
private _isCompanyDraft;
|
|
85
199
|
private _isDivisionDraft;
|
|
86
|
-
create(context: RepositoryContext, draft: BusinessUnitDraft): BusinessUnit;
|
|
87
|
-
actions: {
|
|
88
|
-
addAddress: (context: RepositoryContext, resource: Writable<BusinessUnit>, { address }: BusinessUnitAddAddressAction) => void;
|
|
89
|
-
addAssociate: (context: RepositoryContext, resource: Writable<BusinessUnit>, { associate }: BusinessUnitAddAssociateAction) => void;
|
|
90
|
-
setAssociates: (context: RepositoryContext, resource: Writable<BusinessUnit>, { associates }: BusinessUnitSetAssociatesAction) => void;
|
|
91
|
-
setContactEmail: (context: RepositoryContext, resource: Writable<BusinessUnit>, { contactEmail }: BusinessUnitSetContactEmailAction) => void;
|
|
92
|
-
setStoreMode: (context: RepositoryContext, resource: Writable<BusinessUnit>, { storeMode }: BusinessUnitSetStoreModeAction) => void;
|
|
93
|
-
changeAssociateMode: (context: RepositoryContext, resource: Writable<BusinessUnit>, { storeMode }: BusinessUnitSetStoreModeAction) => void;
|
|
94
|
-
changeName: (context: RepositoryContext, resource: Writable<BusinessUnit>, { name }: BusinessUnitChangeNameAction) => void;
|
|
95
|
-
changeAddress: (context: RepositoryContext, resource: Writable<BusinessUnit>, { address }: BusinessUnitChangeAddressAction) => void;
|
|
96
|
-
addStore: (context: RepositoryContext, resource: Writable<BusinessUnit>, { store }: BusinessUnitAddStoreAction) => void;
|
|
97
|
-
changeParentUnit: (context: RepositoryContext, resource: Writable<BusinessUnit>, { parentUnit }: BusinessUnitChangeParentUnitAction) => void;
|
|
98
|
-
changeStatus: (context: RepositoryContext, resource: Writable<BusinessUnit>, { status }: BusinessUnitChangeStatusAction) => void;
|
|
99
|
-
};
|
|
100
200
|
}
|
|
101
201
|
|
|
102
|
-
declare class CartRepository extends AbstractResourceRepository<
|
|
103
|
-
|
|
202
|
+
declare class CartRepository extends AbstractResourceRepository<"cart"> {
|
|
203
|
+
constructor(storage: AbstractStorage);
|
|
104
204
|
create(context: RepositoryContext, draft: CartDraft): Cart;
|
|
105
205
|
getActiveCart(projectKey: string): Cart | undefined;
|
|
106
|
-
actions: {
|
|
107
|
-
addLineItem: (context: RepositoryContext, resource: Writable<Cart>, { productId, variantId, sku, quantity }: CartAddLineItemAction) => void;
|
|
108
|
-
recalculate: () => void;
|
|
109
|
-
addItemShippingAddress: (context: RepositoryContext, resource: Writable<Cart>, { action, address }: CartAddItemShippingAddressAction) => void;
|
|
110
|
-
changeLineItemQuantity: (context: RepositoryContext, resource: Writable<Cart>, { lineItemId, lineItemKey, quantity }: CartChangeLineItemQuantityAction) => void;
|
|
111
|
-
removeLineItem: (context: RepositoryContext, resource: Writable<Cart>, { lineItemId, quantity }: CartRemoveLineItemAction) => void;
|
|
112
|
-
setBillingAddress: (context: RepositoryContext, resource: Writable<Cart>, { address }: CartSetBillingAddressAction) => void;
|
|
113
|
-
setShippingMethod: (context: RepositoryContext, resource: Writable<Cart>, { shippingMethod }: CartSetShippingMethodAction) => void;
|
|
114
|
-
setCountry: (context: RepositoryContext, resource: Writable<Cart>, { country }: CartSetCountryAction) => void;
|
|
115
|
-
setCustomerEmail: (context: RepositoryContext, resource: Writable<Cart>, { email }: CartSetCustomerEmailAction) => void;
|
|
116
|
-
setCustomField: (context: RepositoryContext, resource: Cart, { name, value }: CartSetCustomFieldAction) => void;
|
|
117
|
-
setCustomShippingMethod: (context: RepositoryContext, resource: Writable<Cart>, { shippingMethodName, shippingRate, taxCategory, externalTaxRate, }: CartSetCustomShippingMethodAction) => void;
|
|
118
|
-
setCustomType: (context: RepositoryContext, resource: Writable<Cart>, { type, fields }: CartSetCustomTypeAction) => void;
|
|
119
|
-
setDirectDiscounts: (context: RepositoryContext, resource: Writable<Cart>, { discounts }: CartSetDirectDiscountsAction) => void;
|
|
120
|
-
setLocale: (context: RepositoryContext, resource: Writable<Cart>, { locale }: CartSetLocaleAction) => void;
|
|
121
|
-
setLineItemShippingDetails: (context: RepositoryContext, resource: Writable<Cart>, { action, shippingDetails, lineItemId, lineItemKey, }: CartSetLineItemShippingDetailsAction) => void;
|
|
122
|
-
setShippingAddress: (context: RepositoryContext, resource: Writable<Cart>, { address }: CartSetShippingAddressAction) => void;
|
|
123
|
-
removeDiscountCode: (context: RepositoryContext, resource: Writable<Cart>, { discountCode }: CartRemoveDiscountCodeAction) => void;
|
|
124
|
-
};
|
|
125
206
|
draftLineItemtoLineItem: (projectKey: string, draftLineItem: LineItemDraft, currency: string, country: string | undefined) => LineItem;
|
|
126
207
|
}
|
|
127
208
|
|
|
128
|
-
declare class CartDiscountRepository extends AbstractResourceRepository<
|
|
129
|
-
|
|
209
|
+
declare class CartDiscountRepository extends AbstractResourceRepository<"cart-discount"> {
|
|
210
|
+
constructor(storage: AbstractStorage);
|
|
130
211
|
create(context: RepositoryContext, draft: CartDiscountDraft): CartDiscount;
|
|
131
212
|
private transformValueDraft;
|
|
132
|
-
actions: Partial<Record<CartDiscountUpdateAction['action'], (context: RepositoryContext, resource: Writable<CartDiscount>, action: any) => void>>;
|
|
133
213
|
}
|
|
134
214
|
|
|
135
|
-
declare class CategoryRepository extends AbstractResourceRepository<
|
|
136
|
-
|
|
137
|
-
assetFromAssetDraft: (draft: AssetDraft, context: RepositoryContext) => Asset;
|
|
215
|
+
declare class CategoryRepository extends AbstractResourceRepository<"category"> {
|
|
216
|
+
constructor(storage: AbstractStorage);
|
|
138
217
|
create(context: RepositoryContext, draft: CategoryDraft): Category;
|
|
139
|
-
actions: {
|
|
140
|
-
changeAssetName: (context: RepositoryContext, resource: Writable<Category>, { assetId, assetKey, name }: CategoryChangeAssetNameAction) => void;
|
|
141
|
-
changeSlug: (context: RepositoryContext, resource: Writable<Category>, { slug }: CategoryChangeSlugAction) => void;
|
|
142
|
-
changeName: (context: RepositoryContext, resource: Writable<Category>, { name }: CategoryChangeNameAction) => void;
|
|
143
|
-
changeParent: (context: RepositoryContext, resource: Writable<Category>, { parent }: CategoryChangeParentAction) => void;
|
|
144
|
-
setKey: (context: RepositoryContext, resource: Writable<Category>, { key }: CategorySetKeyAction) => void;
|
|
145
|
-
setAssetDescription: (context: RepositoryContext, resource: Writable<Category>, { assetId, assetKey, description }: CategorySetAssetDescriptionAction) => void;
|
|
146
|
-
setAssetSources: (context: RepositoryContext, resource: Writable<Category>, { assetId, assetKey, sources }: CategorySetAssetSourcesAction) => void;
|
|
147
|
-
setDescription: (context: RepositoryContext, resource: Writable<Category>, { description }: CategorySetDescriptionAction) => void;
|
|
148
|
-
setMetaDescription: (context: RepositoryContext, resource: Writable<Category>, { metaDescription }: CategorySetMetaDescriptionAction) => void;
|
|
149
|
-
setMetaKeywords: (context: RepositoryContext, resource: Writable<Category>, { metaKeywords }: CategorySetMetaKeywordsAction) => void;
|
|
150
|
-
setMetaTitle: (context: RepositoryContext, resource: Writable<Category>, { metaTitle }: CategorySetMetaTitleAction) => void;
|
|
151
|
-
setCustomType: (context: RepositoryContext, resource: Writable<Category>, { type, fields }: CategorySetCustomTypeAction) => void;
|
|
152
|
-
setCustomField: (context: RepositoryContext, resource: Writable<Category>, { name, value }: CategorySetCustomFieldAction) => void;
|
|
153
|
-
removeAsset: (context: RepositoryContext, resource: Writable<Category>, { assetId, assetKey }: CategoryRemoveAssetAction) => void;
|
|
154
|
-
addAsset: (context: RepositoryContext, resource: Writable<Category>, { asset }: CategoryAddAssetAction) => void;
|
|
155
|
-
};
|
|
156
218
|
}
|
|
157
219
|
|
|
158
|
-
declare class ChannelRepository extends AbstractResourceRepository<
|
|
159
|
-
|
|
220
|
+
declare class ChannelRepository extends AbstractResourceRepository<"channel"> {
|
|
221
|
+
constructor(storage: AbstractStorage);
|
|
160
222
|
create(context: RepositoryContext, draft: ChannelDraft): Channel;
|
|
161
|
-
actions: Partial<Record<ChannelUpdateAction['action'], (context: RepositoryContext, resource: Writable<Channel>, action: any) => void>>;
|
|
162
223
|
}
|
|
163
224
|
|
|
164
|
-
declare class CustomObjectRepository extends AbstractResourceRepository<
|
|
165
|
-
|
|
225
|
+
declare class CustomObjectRepository extends AbstractResourceRepository<"key-value-document"> {
|
|
226
|
+
constructor(storage: AbstractStorage);
|
|
166
227
|
create(context: RepositoryContext, draft: Writable<CustomObjectDraft>): CustomObject;
|
|
167
|
-
queryWithContainer(context: RepositoryContext, container: string, params?: QueryParams): ctp.CustomObjectPagedQueryResponse;
|
|
168
228
|
getWithContainerAndKey(context: RepositoryContext, container: string, key: string): CustomObject | undefined;
|
|
229
|
+
queryWithContainer(context: RepositoryContext, container: string, params?: QueryParams$1): ctp.CustomObjectPagedQueryResponse;
|
|
169
230
|
}
|
|
170
231
|
|
|
171
|
-
declare class CustomerRepository extends AbstractResourceRepository<
|
|
172
|
-
|
|
232
|
+
declare class CustomerRepository extends AbstractResourceRepository<"customer"> {
|
|
233
|
+
constructor(storage: AbstractStorage);
|
|
173
234
|
create(context: RepositoryContext, draft: CustomerDraft): Customer;
|
|
174
|
-
|
|
175
|
-
deleteMe(context: RepositoryContext): Customer | undefined;
|
|
176
|
-
actions: {
|
|
177
|
-
changeEmail: (_context: RepositoryContext, resource: Writable<Customer>, { email }: CustomerChangeEmailAction) => void;
|
|
178
|
-
setFirstName: (_context: RepositoryContext, resource: Writable<Customer>, { firstName }: CustomerSetFirstNameAction) => void;
|
|
179
|
-
setLastName: (_context: RepositoryContext, resource: Writable<Customer>, { lastName }: CustomerSetLastNameAction) => void;
|
|
180
|
-
setCompanyName: (_context: RepositoryContext, resource: Writable<Customer>, { companyName }: CustomerSetCompanyNameAction) => void;
|
|
181
|
-
setVatId: (_context: RepositoryContext, resource: Writable<Customer>, { vatId }: CustomerSetVatIdAction) => void;
|
|
182
|
-
changeAddress: (context: RepositoryContext, resource: Writable<Customer>, { addressId, addressKey, address }: CustomerChangeAddressAction) => void;
|
|
183
|
-
setAuthenticationMode: (_context: RepositoryContext, resource: Writable<Customer>, { authMode, password }: CustomerSetAuthenticationModeAction) => void;
|
|
184
|
-
setCustomField: (_context: RepositoryContext, resource: Writable<Customer>, { name, value }: CustomerSetCustomFieldAction) => void;
|
|
185
|
-
setCustomerNumber: (_context: RepositoryContext, resource: Writable<Customer>, { customerNumber }: CustomerSetCustomerNumberAction) => void;
|
|
186
|
-
};
|
|
235
|
+
passwordResetToken(context: RepositoryContext, email: string): CustomerToken;
|
|
187
236
|
}
|
|
188
237
|
|
|
189
|
-
declare class CustomerGroupRepository extends AbstractResourceRepository<
|
|
190
|
-
|
|
238
|
+
declare class CustomerGroupRepository extends AbstractResourceRepository<"customer-group"> {
|
|
239
|
+
constructor(storage: AbstractStorage);
|
|
191
240
|
create(context: RepositoryContext, draft: CustomerGroupDraft): CustomerGroup;
|
|
192
|
-
actions: {
|
|
193
|
-
setKey: (context: RepositoryContext, resource: Writable<CustomerGroup>, { key }: CustomerGroupSetKeyAction) => void;
|
|
194
|
-
changeName: (context: RepositoryContext, resource: Writable<CustomerGroup>, { name }: CustomerGroupChangeNameAction) => void;
|
|
195
|
-
setCustomType: (context: RepositoryContext, resource: Writable<CustomerGroup>, { type, fields }: CustomerGroupSetCustomTypeAction) => void;
|
|
196
|
-
setCustomField: (context: RepositoryContext, resource: Writable<CustomerGroup>, { name, value }: CustomerGroupSetCustomFieldAction) => void;
|
|
197
|
-
};
|
|
198
241
|
}
|
|
199
242
|
|
|
200
|
-
declare class DiscountCodeRepository extends AbstractResourceRepository<
|
|
201
|
-
|
|
243
|
+
declare class DiscountCodeRepository extends AbstractResourceRepository<"discount-code"> {
|
|
244
|
+
constructor(storage: AbstractStorage);
|
|
202
245
|
create(context: RepositoryContext, draft: DiscountCodeDraft): DiscountCode;
|
|
203
|
-
actions: Partial<Record<DiscountCodeUpdateAction['action'], (context: RepositoryContext, resource: Writable<DiscountCode>, action: any) => void>>;
|
|
204
246
|
}
|
|
205
247
|
|
|
206
|
-
declare class ExtensionRepository extends AbstractResourceRepository<
|
|
207
|
-
|
|
208
|
-
postProcessResource(resource: Extension): Extension;
|
|
248
|
+
declare class ExtensionRepository extends AbstractResourceRepository<"extension"> {
|
|
249
|
+
constructor(storage: AbstractStorage);
|
|
209
250
|
create(context: RepositoryContext, draft: ExtensionDraft): Extension;
|
|
210
|
-
|
|
251
|
+
postProcessResource(resource: Extension): Extension;
|
|
211
252
|
}
|
|
212
253
|
|
|
213
|
-
declare class InventoryEntryRepository extends AbstractResourceRepository<
|
|
214
|
-
|
|
254
|
+
declare class InventoryEntryRepository extends AbstractResourceRepository<"inventory-entry"> {
|
|
255
|
+
constructor(storage: AbstractStorage);
|
|
215
256
|
create(context: RepositoryContext, draft: InventoryEntryDraft): InventoryEntry;
|
|
216
|
-
actions: {
|
|
217
|
-
changeQuantity: (context: RepositoryContext, resource: Writable<InventoryEntry>, { quantity }: InventoryEntryChangeQuantityAction) => void;
|
|
218
|
-
setExpectedDelivery: (context: RepositoryContext, resource: Writable<InventoryEntry>, { expectedDelivery }: InventoryEntrySetExpectedDeliveryAction) => void;
|
|
219
|
-
setCustomField: (context: RepositoryContext, resource: InventoryEntry, { name, value }: InventoryEntrySetCustomFieldAction) => void;
|
|
220
|
-
setCustomType: (context: RepositoryContext, resource: Writable<InventoryEntry>, { type, fields }: InventoryEntrySetCustomTypeAction) => void;
|
|
221
|
-
setRestockableInDays: (context: RepositoryContext, resource: Writable<InventoryEntry>, { restockableInDays }: InventoryEntrySetRestockableInDaysAction) => void;
|
|
222
|
-
};
|
|
223
257
|
}
|
|
224
258
|
|
|
225
|
-
declare class
|
|
226
|
-
|
|
259
|
+
declare class MyCustomerRepository extends CustomerRepository {
|
|
260
|
+
changePassword(context: RepositoryContext, changePassword: MyCustomerChangePassword): Writable<Customer>;
|
|
261
|
+
deleteMe(context: RepositoryContext): Customer | undefined;
|
|
262
|
+
getMe(context: RepositoryContext): Customer | undefined;
|
|
263
|
+
resetPassword(context: RepositoryContext, resetPassword: MyCustomerResetPassword): Writable<Customer>;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
declare class OrderRepository extends AbstractResourceRepository<"order"> {
|
|
267
|
+
constructor(storage: AbstractStorage);
|
|
227
268
|
create(context: RepositoryContext, draft: OrderFromCartDraft): Order;
|
|
228
269
|
createFromCart(context: RepositoryContext, cartReference: CartReference, orderNumber?: string): Order;
|
|
229
270
|
import(context: RepositoryContext, draft: OrderImportDraft): Order;
|
|
230
271
|
private lineItemFromImportDraft;
|
|
231
272
|
private customLineItemFromImportDraft;
|
|
232
|
-
getWithOrderNumber(context: RepositoryContext, orderNumber: string, params?: QueryParams): Order | undefined;
|
|
233
|
-
actions: {
|
|
234
|
-
addPayment: (context: RepositoryContext, resource: Writable<Order>, { payment }: OrderAddPaymentAction) => void;
|
|
235
|
-
addReturnInfo: (context: RepositoryContext, resource: Writable<Order>, info: OrderAddReturnInfoAction) => void;
|
|
236
|
-
changeOrderState: (context: RepositoryContext, resource: Writable<Order>, { orderState }: OrderChangeOrderStateAction) => void;
|
|
237
|
-
changePaymentState: (context: RepositoryContext, resource: Writable<Order>, { paymentState }: OrderChangePaymentStateAction) => void;
|
|
238
|
-
transitionState: (context: RepositoryContext, resource: Writable<Order>, { state }: OrderTransitionStateAction) => void;
|
|
239
|
-
setBillingAddress: (context: RepositoryContext, resource: Writable<Order>, { address }: OrderSetBillingAddressAction) => void;
|
|
240
|
-
setCustomerEmail: (context: RepositoryContext, resource: Writable<Order>, { email }: OrderSetCustomerEmailAction) => void;
|
|
241
|
-
setCustomField: (context: RepositoryContext, resource: Order, { name, value }: OrderSetCustomFieldAction) => void;
|
|
242
|
-
setCustomType: (context: RepositoryContext, resource: Writable<Order>, { type, fields }: OrderSetCustomTypeAction) => void;
|
|
243
|
-
setLocale: (context: RepositoryContext, resource: Writable<Order>, { locale }: OrderSetLocaleAction) => void;
|
|
244
|
-
setOrderNumber: (context: RepositoryContext, resource: Writable<Order>, { orderNumber }: OrderSetOrderNumberAction) => void;
|
|
245
|
-
setShippingAddress: (context: RepositoryContext, resource: Writable<Order>, { address }: OrderSetShippingAddressAction) => void;
|
|
246
|
-
setStore: (context: RepositoryContext, resource: Writable<Order>, { store }: OrderSetStoreAction) => void;
|
|
247
|
-
updateSyncInfo: (context: RepositoryContext, resource: Writable<Order>, { channel, externalId, syncedAt }: OrderUpdateSyncInfoAction) => void;
|
|
248
|
-
};
|
|
273
|
+
getWithOrderNumber(context: RepositoryContext, orderNumber: string, params?: QueryParams$1): Order | undefined;
|
|
249
274
|
}
|
|
250
275
|
|
|
251
276
|
declare class MyOrderRepository extends OrderRepository {
|
|
252
277
|
create(context: RepositoryContext, draft: MyOrderFromCartDraft): Order;
|
|
253
278
|
}
|
|
254
279
|
|
|
255
|
-
declare class OrderEditRepository extends AbstractResourceRepository<
|
|
256
|
-
|
|
280
|
+
declare class OrderEditRepository extends AbstractResourceRepository<"order-edit"> {
|
|
281
|
+
constructor(storage: AbstractStorage);
|
|
257
282
|
create(context: RepositoryContext, draft: OrderEditDraft): OrderEdit;
|
|
258
|
-
actions: Partial<Record<OrderEditUpdateAction['action'], (context: RepositoryContext, resource: Writable<OrderEdit>, action: any) => void>>;
|
|
259
283
|
}
|
|
260
284
|
|
|
261
|
-
declare class PaymentRepository extends AbstractResourceRepository<
|
|
262
|
-
|
|
285
|
+
declare class PaymentRepository extends AbstractResourceRepository<"payment"> {
|
|
286
|
+
constructor(storage: AbstractStorage);
|
|
263
287
|
create(context: RepositoryContext, draft: PaymentDraft): Payment;
|
|
264
|
-
transactionFromTransactionDraft: (draft: TransactionDraft, context: RepositoryContext) => Transaction;
|
|
265
|
-
actions: Record<PaymentUpdateAction['action'], (context: RepositoryContext, resource: Writable<Payment>, action: any) => void>;
|
|
266
288
|
}
|
|
267
289
|
|
|
268
|
-
declare class ProductRepository extends AbstractResourceRepository<
|
|
269
|
-
|
|
290
|
+
declare class ProductRepository extends AbstractResourceRepository<"product"> {
|
|
291
|
+
constructor(storage: AbstractStorage);
|
|
270
292
|
create(context: RepositoryContext, draft: ProductDraft): Product;
|
|
271
|
-
private variantFromDraft;
|
|
272
|
-
private priceFromDraft;
|
|
273
|
-
actions: Partial<Record<ProductUpdateAction['action'], (context: RepositoryContext, resource: Writable<Product>, action: any) => void>>;
|
|
274
293
|
}
|
|
275
294
|
|
|
276
|
-
declare class ProductDiscountRepository extends AbstractResourceRepository<
|
|
277
|
-
|
|
295
|
+
declare class ProductDiscountRepository extends AbstractResourceRepository<"product-discount"> {
|
|
296
|
+
constructor(storage: AbstractStorage);
|
|
278
297
|
create(context: RepositoryContext, draft: ProductDiscountDraft): ProductDiscount;
|
|
279
|
-
private transformValueDraft;
|
|
280
|
-
actions: Partial<Record<ProductDiscountUpdateAction['action'], (context: RepositoryContext, resource: Writable<ProductDiscount>, action: any) => void>>;
|
|
281
298
|
}
|
|
282
299
|
|
|
283
300
|
/**
|
|
@@ -285,36 +302,36 @@ declare class ProductDiscountRepository extends AbstractResourceRepository<'prod
|
|
|
285
302
|
*/
|
|
286
303
|
|
|
287
304
|
type RangeExpression = {
|
|
288
|
-
type:
|
|
305
|
+
type: "RangeExpression";
|
|
289
306
|
start?: number;
|
|
290
307
|
stop?: number;
|
|
291
308
|
match: (obj: any) => boolean;
|
|
292
309
|
};
|
|
293
310
|
type FilterExpression = {
|
|
294
|
-
type:
|
|
311
|
+
type: "FilterExpression";
|
|
295
312
|
match: (obj: any) => boolean;
|
|
296
313
|
};
|
|
297
314
|
|
|
298
315
|
type ProductProjectionSearchParams = {
|
|
299
|
-
fuzzy?: boolean;
|
|
300
|
-
fuzzyLevel?: number;
|
|
301
|
-
markMatchingVariants?: boolean;
|
|
302
|
-
staged?: boolean;
|
|
303
|
-
filter?: string[];
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
facet?: string | string[];
|
|
307
|
-
sort?: string | string[];
|
|
308
|
-
limit?: number;
|
|
309
|
-
offset?: number;
|
|
310
|
-
withTotal?: boolean;
|
|
311
|
-
priceCurrency?: string;
|
|
312
|
-
priceCountry?: string;
|
|
313
|
-
priceCustomerGroup?: string;
|
|
314
|
-
priceChannel?: string;
|
|
315
|
-
localeProjection?: string;
|
|
316
|
-
storeProjection?: string;
|
|
317
|
-
expand?: string | string[];
|
|
316
|
+
"fuzzy"?: boolean;
|
|
317
|
+
"fuzzyLevel"?: number;
|
|
318
|
+
"markMatchingVariants"?: boolean;
|
|
319
|
+
"staged"?: boolean;
|
|
320
|
+
"filter"?: string[];
|
|
321
|
+
"filter.facets"?: string[];
|
|
322
|
+
"filter.query"?: string[];
|
|
323
|
+
"facet"?: string | string[];
|
|
324
|
+
"sort"?: string | string[];
|
|
325
|
+
"limit"?: number;
|
|
326
|
+
"offset"?: number;
|
|
327
|
+
"withTotal"?: boolean;
|
|
328
|
+
"priceCurrency"?: string;
|
|
329
|
+
"priceCountry"?: string;
|
|
330
|
+
"priceCustomerGroup"?: string;
|
|
331
|
+
"priceChannel"?: string;
|
|
332
|
+
"localeProjection"?: string;
|
|
333
|
+
"storeProjection"?: string;
|
|
334
|
+
"expand"?: string | string[];
|
|
318
335
|
[key: string]: QueryParam;
|
|
319
336
|
};
|
|
320
337
|
declare class ProductProjectionSearch {
|
|
@@ -349,12 +366,11 @@ type ProductProjectionQueryParams = {
|
|
|
349
366
|
where?: string | string[];
|
|
350
367
|
[key: string]: QueryParam;
|
|
351
368
|
};
|
|
352
|
-
declare class ProductProjectionRepository extends AbstractResourceRepository<
|
|
369
|
+
declare class ProductProjectionRepository extends AbstractResourceRepository<"product-projection"> {
|
|
353
370
|
protected _searchService: ProductProjectionSearch;
|
|
354
371
|
constructor(storage: AbstractStorage);
|
|
355
|
-
getTypeId(): "product-projection";
|
|
356
372
|
create(context: RepositoryContext, draft: ProductDraft): ProductProjection;
|
|
357
|
-
get(context: RepositoryContext, id: string, params?: GetParams): ProductProjection | null;
|
|
373
|
+
get(context: RepositoryContext, id: string, params?: GetParams$1): ProductProjection | null;
|
|
358
374
|
query(context: RepositoryContext, params?: ProductProjectionQueryParams): {
|
|
359
375
|
count: number;
|
|
360
376
|
total: number;
|
|
@@ -363,58 +379,49 @@ declare class ProductProjectionRepository extends AbstractResourceRepository<'pr
|
|
|
363
379
|
results: ProductProjection[];
|
|
364
380
|
};
|
|
365
381
|
search(context: RepositoryContext, query: ProductProjectionQueryParams): ctp.ProductProjectionPagedSearchResponse;
|
|
366
|
-
actions: {};
|
|
367
382
|
}
|
|
368
383
|
|
|
369
|
-
declare class ProductSelectionRepository extends AbstractResourceRepository<
|
|
370
|
-
|
|
384
|
+
declare class ProductSelectionRepository extends AbstractResourceRepository<"product-selection"> {
|
|
385
|
+
constructor(storage: AbstractStorage);
|
|
371
386
|
create(context: RepositoryContext, draft: ProductSelectionDraft): ProductSelection;
|
|
372
|
-
actions: Partial<Record<ProductSelectionUpdateAction['action'], (context: RepositoryContext, resource: Writable<ProductSelection>, action: any) => void>>;
|
|
373
387
|
}
|
|
374
388
|
|
|
375
|
-
declare class ProductTypeRepository extends AbstractResourceRepository<
|
|
376
|
-
|
|
389
|
+
declare class ProductTypeRepository extends AbstractResourceRepository<"product-type"> {
|
|
390
|
+
constructor(storage: AbstractStorage);
|
|
377
391
|
create(context: RepositoryContext, draft: ProductTypeDraft): ProductType;
|
|
378
|
-
attributeDefinitionFromAttributeDefinitionDraft: (_context: RepositoryContext, draft: AttributeDefinitionDraft) => AttributeDefinition;
|
|
379
|
-
actions: Partial<Record<ProductTypeUpdateAction['action'], (context: RepositoryContext, resource: Writable<ProductType>, action: any) => void>>;
|
|
380
392
|
}
|
|
381
393
|
|
|
382
394
|
declare class ProjectRepository extends AbstractRepository<Project> {
|
|
395
|
+
constructor(storage: AbstractStorage);
|
|
383
396
|
get(context: RepositoryContext): Project | null;
|
|
384
397
|
postProcessResource(resource: Project): Project;
|
|
385
398
|
saveNew(context: RepositoryContext, resource: Writable<Project>): void;
|
|
386
399
|
saveUpdate(context: RepositoryContext, version: number, resource: Project): void;
|
|
387
|
-
actions: Partial<Record<ProjectUpdateAction['action'], (context: RepositoryContext, resource: Writable<Project>, action: any) => void>>;
|
|
388
400
|
}
|
|
389
401
|
|
|
390
|
-
declare class QuoteRepository extends AbstractResourceRepository<
|
|
391
|
-
|
|
402
|
+
declare class QuoteRepository extends AbstractResourceRepository<"quote"> {
|
|
403
|
+
constructor(storage: AbstractStorage);
|
|
392
404
|
create(context: RepositoryContext, draft: QuoteDraft): Quote;
|
|
393
|
-
actions: Partial<Record<QuoteUpdateAction['action'], (context: RepositoryContext, resource: Writable<Quote>, action: any) => void>>;
|
|
394
405
|
}
|
|
395
406
|
|
|
396
|
-
declare class QuoteRequestRepository extends AbstractResourceRepository<
|
|
397
|
-
|
|
407
|
+
declare class QuoteRequestRepository extends AbstractResourceRepository<"quote-request"> {
|
|
408
|
+
constructor(storage: AbstractStorage);
|
|
398
409
|
create(context: RepositoryContext, draft: QuoteRequestDraft): QuoteRequest;
|
|
399
|
-
actions: Partial<Record<QuoteRequestUpdateAction['action'], (context: RepositoryContext, resource: Writable<QuoteRequest>, action: any) => void>>;
|
|
400
410
|
}
|
|
401
411
|
|
|
402
|
-
declare class ReviewRepository extends AbstractResourceRepository<
|
|
403
|
-
|
|
412
|
+
declare class ReviewRepository extends AbstractResourceRepository<"review"> {
|
|
413
|
+
constructor(storage: AbstractStorage);
|
|
404
414
|
create(context: RepositoryContext, draft: ReviewDraft): Review;
|
|
405
|
-
actions: Partial<Record<ReviewUpdateAction['action'], (context: RepositoryContext, resource: Writable<Review>, action: any) => void>>;
|
|
406
415
|
}
|
|
407
416
|
|
|
408
|
-
declare class ShippingMethodRepository extends AbstractResourceRepository<
|
|
409
|
-
|
|
417
|
+
declare class ShippingMethodRepository extends AbstractResourceRepository<"shipping-method"> {
|
|
418
|
+
constructor(storage: AbstractStorage);
|
|
410
419
|
create(context: RepositoryContext, draft: ShippingMethodDraft): ShippingMethod;
|
|
411
|
-
|
|
412
|
-
private _transformShippingRate;
|
|
413
|
-
matchingCart(context: RepositoryContext, cartId: string, params?: GetParams): {
|
|
420
|
+
matchingCart(context: RepositoryContext, cartId: string, params?: GetParams$1): {
|
|
414
421
|
results: {
|
|
415
422
|
zoneRates: {
|
|
416
423
|
zone: ZoneReference;
|
|
417
|
-
shippingRates: ShippingRate[];
|
|
424
|
+
shippingRates: ctp.ShippingRate[];
|
|
418
425
|
}[];
|
|
419
426
|
id: string;
|
|
420
427
|
version: number;
|
|
@@ -437,261 +444,107 @@ declare class ShippingMethodRepository extends AbstractResourceRepository<'shipp
|
|
|
437
444
|
total?: number | undefined;
|
|
438
445
|
offset?: number | undefined;
|
|
439
446
|
} | undefined;
|
|
440
|
-
|
|
447
|
+
private _transformZoneRateDraft;
|
|
441
448
|
}
|
|
442
449
|
|
|
443
|
-
declare class ShoppingListRepository extends AbstractResourceRepository<
|
|
444
|
-
|
|
450
|
+
declare class ShoppingListRepository extends AbstractResourceRepository<"shopping-list"> {
|
|
451
|
+
constructor(storage: AbstractStorage);
|
|
445
452
|
create(context: RepositoryContext, draft: ShoppingListDraft): ShoppingList;
|
|
446
|
-
actions: {
|
|
447
|
-
setKey: (context: RepositoryContext, resource: Writable<ShoppingList>, { key }: ShoppingListSetKeyAction) => void;
|
|
448
|
-
setSlug: (context: RepositoryContext, resource: Writable<ShoppingList>, { slug }: ShoppingListSetSlugAction) => void;
|
|
449
|
-
changeName: (context: RepositoryContext, resource: Writable<ShoppingList>, { name }: ShoppingListChangeNameAction) => void;
|
|
450
|
-
setDescription: (context: RepositoryContext, resource: Writable<ShoppingList>, { description }: ShoppingListSetDescriptionAction) => void;
|
|
451
|
-
setCustomer: (context: RepositoryContext, resource: Writable<ShoppingList>, { customer }: ShoppingListSetCustomerAction) => void;
|
|
452
|
-
setStore: (context: RepositoryContext, resource: Writable<ShoppingList>, { store }: ShoppingListSetStoreAction) => void;
|
|
453
|
-
setAnonymousId: (context: RepositoryContext, resource: Writable<ShoppingList>, { anonymousId }: ShoppingListSetAnonymousIdAction) => void;
|
|
454
|
-
setCustomType: (context: RepositoryContext, resource: Writable<ShoppingList>, { type, fields }: ShoppingListSetCustomTypeAction) => void;
|
|
455
|
-
setCustomField: (context: RepositoryContext, resource: ShoppingList, { name, value }: ShoppingListSetCustomFieldAction) => void;
|
|
456
|
-
setDeleteDaysAfterLastModification: (context: RepositoryContext, resource: Writable<ShoppingList>, { deleteDaysAfterLastModification, }: ShoppingListSetDeleteDaysAfterLastModificationAction) => void;
|
|
457
|
-
addLineItem: (context: RepositoryContext, resource: Writable<ShoppingList>, { productId, variantId, sku, quantity }: ShoppingListAddLineItemAction) => void;
|
|
458
|
-
removeLineItem: (context: RepositoryContext, resource: Writable<ShoppingList>, { lineItemId, quantity }: ShoppingListRemoveLineItemAction) => void;
|
|
459
|
-
changeLineItemQuantity: (context: RepositoryContext, resource: Writable<ShoppingList>, { lineItemId, lineItemKey, quantity, }: ShoppingListChangeLineItemQuantityAction) => void;
|
|
460
|
-
};
|
|
461
453
|
draftLineItemtoLineItem: (projectKey: string, draftLineItem: LineItemDraft) => ShoppingListLineItem;
|
|
462
454
|
}
|
|
463
455
|
|
|
464
|
-
declare class StagedQuoteRepository extends AbstractResourceRepository<
|
|
465
|
-
|
|
456
|
+
declare class StagedQuoteRepository extends AbstractResourceRepository<"staged-quote"> {
|
|
457
|
+
constructor(storage: AbstractStorage);
|
|
466
458
|
create(context: RepositoryContext, draft: StagedQuoteDraft): StagedQuote;
|
|
467
|
-
actions: Partial<Record<StagedQuoteUpdateAction['action'], (context: RepositoryContext, resource: Writable<Quote>, action: any) => void>>;
|
|
468
459
|
}
|
|
469
460
|
|
|
470
|
-
declare class StandAlonePriceRepository extends AbstractResourceRepository<
|
|
471
|
-
|
|
461
|
+
declare class StandAlonePriceRepository extends AbstractResourceRepository<"standalone-price"> {
|
|
462
|
+
constructor(storage: AbstractStorage);
|
|
472
463
|
create(context: RepositoryContext, draft: StandalonePriceDraft): StandalonePrice;
|
|
473
464
|
transformChannelReferenceDraft(channel: ChannelResourceIdentifier): ChannelReference;
|
|
474
|
-
transformDiscountDraft(discounted: DiscountedPriceDraft): {
|
|
475
|
-
value: ctp.TypedMoney;
|
|
476
|
-
discount: ctp.ProductDiscountReference;
|
|
477
|
-
};
|
|
478
|
-
actions: {
|
|
479
|
-
setActive: (context: RepositoryContext, resource: Writable<StandalonePrice>, action: StandalonePriceChangeActiveAction) => void;
|
|
480
|
-
changeValue: (context: RepositoryContext, resource: Writable<StandalonePrice>, action: StandalonePriceChangeValueAction) => void;
|
|
481
|
-
setDiscountedPrice: (context: RepositoryContext, resource: Writable<StandalonePrice>, action: StandalonePriceSetDiscountedPriceAction) => void;
|
|
482
|
-
};
|
|
483
465
|
}
|
|
484
466
|
|
|
485
|
-
declare class StateRepository extends AbstractResourceRepository<
|
|
486
|
-
|
|
467
|
+
declare class StateRepository extends AbstractResourceRepository<"state"> {
|
|
468
|
+
constructor(storage: AbstractStorage);
|
|
487
469
|
create(context: RepositoryContext, draft: StateDraft): State;
|
|
488
|
-
actions: Partial<Record<StateUpdateAction['action'], (context: RepositoryContext, resource: Writable<State>, action: any) => void>>;
|
|
489
470
|
}
|
|
490
471
|
|
|
491
|
-
declare class StoreRepository extends AbstractResourceRepository<
|
|
492
|
-
|
|
472
|
+
declare class StoreRepository extends AbstractResourceRepository<"store"> {
|
|
473
|
+
constructor(storage: AbstractStorage);
|
|
493
474
|
create(context: RepositoryContext, draft: StoreDraft): Store;
|
|
494
|
-
private transformChannels;
|
|
495
|
-
actions: Partial<Record<StoreUpdateAction['action'], (context: RepositoryContext, resource: Writable<Store>, action: any) => void>>;
|
|
496
475
|
}
|
|
497
476
|
|
|
498
|
-
declare class SubscriptionRepository extends AbstractResourceRepository<
|
|
499
|
-
|
|
477
|
+
declare class SubscriptionRepository extends AbstractResourceRepository<"subscription"> {
|
|
478
|
+
constructor(storage: AbstractStorage);
|
|
500
479
|
create(context: RepositoryContext, draft: SubscriptionDraft): Subscription;
|
|
501
480
|
}
|
|
502
481
|
|
|
503
|
-
declare class TaxCategoryRepository extends AbstractResourceRepository<
|
|
504
|
-
|
|
482
|
+
declare class TaxCategoryRepository extends AbstractResourceRepository<"tax-category"> {
|
|
483
|
+
constructor(storage: AbstractStorage);
|
|
505
484
|
create(context: RepositoryContext, draft: TaxCategoryDraft): TaxCategory;
|
|
506
|
-
private taxRateFromTaxRateDraft;
|
|
507
|
-
actions: Partial<Record<TaxCategoryUpdateAction['action'], (context: RepositoryContext, resource: Writable<TaxCategory>, action: any) => void>>;
|
|
508
485
|
}
|
|
509
486
|
|
|
510
|
-
declare class TypeRepository extends AbstractResourceRepository<
|
|
511
|
-
|
|
487
|
+
declare class TypeRepository extends AbstractResourceRepository<"type"> {
|
|
488
|
+
constructor(storage: AbstractStorage);
|
|
512
489
|
create(context: RepositoryContext, draft: TypeDraft): Type;
|
|
513
|
-
actions: Partial<Record<TypeUpdateAction['action'], (context: RepositoryContext, resource: Writable<Type>, action: any) => void>>;
|
|
514
490
|
}
|
|
515
491
|
|
|
516
|
-
declare class ZoneRepository extends AbstractResourceRepository<
|
|
517
|
-
|
|
492
|
+
declare class ZoneRepository extends AbstractResourceRepository<"zone"> {
|
|
493
|
+
constructor(storage: AbstractStorage);
|
|
518
494
|
create(context: RepositoryContext, draft: ZoneDraft): Zone;
|
|
519
|
-
actions: Partial<Record<ZoneUpdateAction['action'], (context: RepositoryContext, resource: Writable<Zone>, action: any) => void>>;
|
|
520
495
|
}
|
|
521
496
|
|
|
522
497
|
type RepositoryMap = ReturnType<typeof createRepositories>;
|
|
523
498
|
declare const createRepositories: (storage: AbstractStorage) => {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
499
|
+
"associate-role": AssociateRoleRepository;
|
|
500
|
+
"attribute-group": AttributeGroupRepository;
|
|
501
|
+
"business-unit": BusinessUnitRepository;
|
|
527
502
|
category: CategoryRepository;
|
|
528
503
|
cart: CartRepository;
|
|
529
|
-
|
|
504
|
+
"cart-discount": CartDiscountRepository;
|
|
530
505
|
customer: CustomerRepository;
|
|
531
506
|
channel: ChannelRepository;
|
|
532
|
-
|
|
533
|
-
|
|
507
|
+
"customer-group": CustomerGroupRepository;
|
|
508
|
+
"discount-code": DiscountCodeRepository;
|
|
534
509
|
extension: ExtensionRepository;
|
|
535
|
-
|
|
536
|
-
|
|
510
|
+
"inventory-entry": InventoryEntryRepository;
|
|
511
|
+
"key-value-document": CustomObjectRepository;
|
|
537
512
|
order: OrderRepository;
|
|
538
|
-
|
|
513
|
+
"order-edit": OrderEditRepository;
|
|
539
514
|
payment: PaymentRepository;
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
515
|
+
"my-cart": CartRepository;
|
|
516
|
+
"my-order": MyOrderRepository;
|
|
517
|
+
"my-customer": MyCustomerRepository;
|
|
518
|
+
"my-payment": PaymentRepository;
|
|
519
|
+
"my-shopping-list": ShoppingListRepository;
|
|
545
520
|
product: ProductRepository;
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
521
|
+
"product-type": ProductTypeRepository;
|
|
522
|
+
"product-discount": ProductDiscountRepository;
|
|
523
|
+
"product-projection": ProductProjectionRepository;
|
|
524
|
+
"product-selection": ProductSelectionRepository;
|
|
550
525
|
project: ProjectRepository;
|
|
551
526
|
review: ReviewRepository;
|
|
552
527
|
quote: QuoteRepository;
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
528
|
+
"quote-request": QuoteRequestRepository;
|
|
529
|
+
"shipping-method": ShippingMethodRepository;
|
|
530
|
+
"shopping-list": ShoppingListRepository;
|
|
531
|
+
"staged-quote": StagedQuoteRepository;
|
|
532
|
+
"standalone-price": StandAlonePriceRepository;
|
|
558
533
|
state: StateRepository;
|
|
559
534
|
store: StoreRepository;
|
|
560
535
|
subscription: SubscriptionRepository;
|
|
561
|
-
|
|
536
|
+
"tax-category": TaxCategoryRepository;
|
|
562
537
|
type: TypeRepository;
|
|
563
538
|
zone: ZoneRepository;
|
|
564
539
|
};
|
|
565
540
|
|
|
566
|
-
type Writable<T> = {
|
|
567
|
-
-readonly [P in keyof T]: Writable<T[P]>;
|
|
568
|
-
};
|
|
569
|
-
type ShallowWritable<T> = {
|
|
570
|
-
-readonly [P in keyof T]: T[P];
|
|
571
|
-
};
|
|
572
|
-
type ResourceType = keyof ResourceMap & keyof RepositoryMap;
|
|
573
|
-
type ResourceMap = {
|
|
574
|
-
'attribute-group': ctp.AttributeGroup;
|
|
575
|
-
'associate-role': ctp.AssociateRole;
|
|
576
|
-
'business-unit': ctp.BusinessUnit;
|
|
577
|
-
'cart-discount': ctp.CartDiscount;
|
|
578
|
-
cart: ctp.Cart;
|
|
579
|
-
category: ctp.Category;
|
|
580
|
-
channel: ctp.Channel;
|
|
581
|
-
'customer-email-token': never;
|
|
582
|
-
'customer-group': ctp.CustomerGroup;
|
|
583
|
-
'customer-password-token': never;
|
|
584
|
-
customer: ctp.Customer;
|
|
585
|
-
'discount-code': ctp.DiscountCode;
|
|
586
|
-
extension: ctp.Extension;
|
|
587
|
-
'inventory-entry': ctp.InventoryEntry;
|
|
588
|
-
'key-value-document': ctp.CustomObject;
|
|
589
|
-
'order-edit': ctp.OrderEdit;
|
|
590
|
-
order: ctp.Order;
|
|
591
|
-
payment: ctp.Payment;
|
|
592
|
-
'product-discount': ctp.ProductDiscount;
|
|
593
|
-
'product-price': ctp.StandalonePrice;
|
|
594
|
-
'product-projection': ctp.ProductProjection;
|
|
595
|
-
'product-selection': ctp.ProductSelection;
|
|
596
|
-
'product-type': ctp.ProductType;
|
|
597
|
-
product: ctp.Product;
|
|
598
|
-
'quote-request': ctp.QuoteRequest;
|
|
599
|
-
quote: ctp.Quote;
|
|
600
|
-
review: ctp.Review;
|
|
601
|
-
'shipping-method': ctp.ShippingMethod;
|
|
602
|
-
'shopping-list': ctp.ShoppingList;
|
|
603
|
-
'staged-quote': ctp.StagedQuote;
|
|
604
|
-
'standalone-price': ctp.StandalonePrice;
|
|
605
|
-
state: ctp.State;
|
|
606
|
-
store: ctp.Store;
|
|
607
|
-
subscription: ctp.Subscription;
|
|
608
|
-
'tax-category': ctp.TaxCategory;
|
|
609
|
-
type: ctp.Type;
|
|
610
|
-
zone: ctp.Zone;
|
|
611
|
-
};
|
|
612
|
-
type PagedQueryResponseMap = {
|
|
613
|
-
'attribute-group': ctp.AttributeGroupPagedQueryResponse;
|
|
614
|
-
'associate-role': ctp.AssociateRolePagedQueryResponse;
|
|
615
|
-
'business-unit': ctp.BusinessUnitPagedQueryResponse;
|
|
616
|
-
'cart-discount': ctp.CartDiscountPagedQueryResponse;
|
|
617
|
-
cart: ctp.CartPagedQueryResponse;
|
|
618
|
-
category: ctp.CategoryPagedQueryResponse;
|
|
619
|
-
channel: ctp.ChannelPagedQueryResponse;
|
|
620
|
-
'customer-email-token': never;
|
|
621
|
-
'customer-group': ctp.CustomerGroupPagedQueryResponse;
|
|
622
|
-
'customer-password-token': never;
|
|
623
|
-
customer: ctp.CustomerPagedQueryResponse;
|
|
624
|
-
'discount-code': ctp.DiscountCodePagedQueryResponse;
|
|
625
|
-
extension: ctp.ExtensionPagedQueryResponse;
|
|
626
|
-
'inventory-entry': ctp.InventoryPagedQueryResponse;
|
|
627
|
-
'key-value-document': ctp.CustomObjectPagedQueryResponse;
|
|
628
|
-
'order-edit': ctp.OrderEditPagedQueryResponse;
|
|
629
|
-
order: ctp.OrderPagedQueryResponse;
|
|
630
|
-
payment: ctp.PaymentPagedQueryResponse;
|
|
631
|
-
'product-discount': ctp.ProductDiscountPagedQueryResponse;
|
|
632
|
-
'product-price': ctp.StandalonePricePagedQueryResponse;
|
|
633
|
-
'product-projection': ctp.ProductProjectionPagedQueryResponse;
|
|
634
|
-
'product-selection': ctp.ProductSelectionPagedQueryResponse;
|
|
635
|
-
'product-type': ctp.ProductTypePagedQueryResponse;
|
|
636
|
-
product: ctp.ProductPagedQueryResponse;
|
|
637
|
-
'quote-request': ctp.QuoteRequestPagedQueryResponse;
|
|
638
|
-
quote: ctp.QuotePagedQueryResponse;
|
|
639
|
-
review: ctp.ReviewPagedQueryResponse;
|
|
640
|
-
'shipping-method': ctp.ShippingMethodPagedQueryResponse;
|
|
641
|
-
'shopping-list': ctp.ShoppingListPagedQueryResponse;
|
|
642
|
-
'staged-quote': ctp.StagedQuotePagedQueryResponse;
|
|
643
|
-
'standalone-price': ctp.StandalonePricePagedQueryResponse;
|
|
644
|
-
state: ctp.StatePagedQueryResponse;
|
|
645
|
-
store: ctp.StorePagedQueryResponse;
|
|
646
|
-
subscription: ctp.SubscriptionPagedQueryResponse;
|
|
647
|
-
'tax-category': ctp.TaxCategoryPagedQueryResponse;
|
|
648
|
-
type: ctp.TypePagedQueryResponse;
|
|
649
|
-
zone: ctp.ZonePagedQueryResponse;
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
type QueryParams = {
|
|
653
|
-
expand?: string[];
|
|
654
|
-
where?: string[];
|
|
655
|
-
offset?: number;
|
|
656
|
-
limit?: number;
|
|
657
|
-
[key: string]: QueryParam;
|
|
658
|
-
};
|
|
659
|
-
type GetParams = {
|
|
660
|
-
expand?: string[];
|
|
661
|
-
};
|
|
662
|
-
type RepositoryContext = {
|
|
663
|
-
projectKey: string;
|
|
664
|
-
storeKey?: string;
|
|
665
|
-
};
|
|
666
|
-
declare abstract class AbstractRepository<R extends BaseResource | Project> {
|
|
667
|
-
protected _storage: AbstractStorage;
|
|
668
|
-
protected actions: Partial<Record<any, (context: RepositoryContext, resource: any, action: any) => void>>;
|
|
669
|
-
constructor(storage: AbstractStorage);
|
|
670
|
-
abstract saveNew({ projectKey }: RepositoryContext, resource: R): void;
|
|
671
|
-
abstract saveUpdate({ projectKey }: RepositoryContext, version: number, resource: R): void;
|
|
672
|
-
processUpdateActions(context: RepositoryContext, resource: R, version: number, actions: UpdateAction[]): R;
|
|
673
|
-
abstract postProcessResource(resource: any): any;
|
|
674
|
-
}
|
|
675
|
-
declare abstract class AbstractResourceRepository<T extends ResourceType> extends AbstractRepository<ResourceMap[T]> {
|
|
676
|
-
abstract create(context: RepositoryContext, draft: any): ResourceMap[T];
|
|
677
|
-
abstract getTypeId(): T;
|
|
678
|
-
constructor(storage: AbstractStorage);
|
|
679
|
-
postProcessResource(resource: ResourceMap[T]): ResourceMap[T];
|
|
680
|
-
query(context: RepositoryContext, params?: QueryParams): PagedQueryResponseMap[T];
|
|
681
|
-
get(context: RepositoryContext, id: string, params?: GetParams): ResourceMap[T] | null;
|
|
682
|
-
getByKey(context: RepositoryContext, key: string, params?: GetParams): ResourceMap[T] | null;
|
|
683
|
-
delete(context: RepositoryContext, id: string, params?: GetParams): ResourceMap[T] | null;
|
|
684
|
-
saveNew(context: RepositoryContext, resource: ShallowWritable<ResourceMap[T]>): void;
|
|
685
|
-
saveUpdate(context: RepositoryContext, version: number, resource: ShallowWritable<ResourceMap[T]>): ShallowWritable<ResourceMap[T]>;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
541
|
declare class ProjectAPI {
|
|
689
542
|
private projectKey;
|
|
690
543
|
private _storage;
|
|
691
544
|
private _repositories;
|
|
692
545
|
constructor(projectKey: string, repositories: RepositoryMap, storage: AbstractStorage);
|
|
693
546
|
add<T extends keyof RepositoryMap & keyof ResourceMap>(typeId: T, resource: ResourceMap[T]): void;
|
|
694
|
-
get<RT extends ResourceType>(typeId: RT, id: string, params?: GetParams): ResourceMap[RT];
|
|
547
|
+
get<RT extends ResourceType>(typeId: RT, id: string, params?: GetParams$1): ResourceMap[RT];
|
|
695
548
|
getRepository<RT extends keyof RepositoryMap>(typeId: RT): RepositoryMap[RT];
|
|
696
549
|
}
|
|
697
550
|
|