@labdigital/commercetools-mock 2.66.0 → 3.0.0-beta.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.
Files changed (281) hide show
  1. package/README.md +31 -8
  2. package/dist/abstract-BKFcva6S.mjs +1044 -0
  3. package/dist/abstract-BKFcva6S.mjs.map +1 -0
  4. package/dist/config-BcNSzPZz.d.mts +1718 -0
  5. package/dist/index.d.mts +50 -1633
  6. package/dist/index.mjs +3769 -2653
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/storage/sqlite.d.mts +59 -0
  9. package/dist/storage/sqlite.mjs +234 -0
  10. package/dist/storage/sqlite.mjs.map +1 -0
  11. package/package.json +26 -29
  12. package/src/ctMock.ts +125 -136
  13. package/src/helpers.ts +14 -6
  14. package/src/index.ts +5 -0
  15. package/src/lib/masking.ts +4 -5
  16. package/src/lib/product-review-statistics.test.ts +257 -294
  17. package/src/lib/review-statistics.ts +17 -4
  18. package/src/oauth/helpers.ts +7 -4
  19. package/src/oauth/server.test.ts +102 -62
  20. package/src/oauth/server.ts +215 -213
  21. package/src/oauth/store.ts +20 -6
  22. package/src/orderSearch.ts +3 -3
  23. package/src/product-projection-search.ts +38 -20
  24. package/src/product-search-availability.test.ts +31 -52
  25. package/src/product-search.ts +19 -10
  26. package/src/projectAPI.ts +6 -22
  27. package/src/repositories/abstract.ts +182 -48
  28. package/src/repositories/as-associate.test.ts +19 -19
  29. package/src/repositories/associate-role.ts +12 -23
  30. package/src/repositories/attribute-group.test.ts +23 -23
  31. package/src/repositories/attribute-group.ts +6 -4
  32. package/src/repositories/business-unit.test.ts +63 -57
  33. package/src/repositories/business-unit.ts +107 -55
  34. package/src/repositories/cart/actions.ts +96 -65
  35. package/src/repositories/cart/helpers.ts +15 -11
  36. package/src/repositories/cart/index.test.ts +136 -30
  37. package/src/repositories/cart/index.ts +76 -59
  38. package/src/repositories/cart-discount/actions.ts +12 -44
  39. package/src/repositories/cart-discount/index.ts +20 -8
  40. package/src/repositories/category/actions.ts +27 -27
  41. package/src/repositories/category/index.test.ts +13 -9
  42. package/src/repositories/category/index.ts +40 -23
  43. package/src/repositories/channel.test.ts +53 -51
  44. package/src/repositories/channel.ts +12 -22
  45. package/src/repositories/custom-object.ts +34 -25
  46. package/src/repositories/customer/actions.ts +47 -25
  47. package/src/repositories/customer/index.test.ts +11 -11
  48. package/src/repositories/customer/index.ts +65 -35
  49. package/src/repositories/customer-group.test.ts +44 -42
  50. package/src/repositories/customer-group.ts +12 -22
  51. package/src/repositories/discount-code/actions.ts +3 -19
  52. package/src/repositories/discount-code/index.ts +9 -4
  53. package/src/repositories/discount-group/index.ts +8 -3
  54. package/src/repositories/extension.test.ts +27 -27
  55. package/src/repositories/extension.ts +10 -5
  56. package/src/repositories/helpers.ts +126 -47
  57. package/src/repositories/inventory-entry/actions.ts +3 -24
  58. package/src/repositories/inventory-entry/index.ts +19 -11
  59. package/src/repositories/my-customer.ts +13 -12
  60. package/src/repositories/my-order.ts +5 -2
  61. package/src/repositories/order/actions.ts +84 -56
  62. package/src/repositories/order/index.test.ts +36 -31
  63. package/src/repositories/order/index.ts +83 -49
  64. package/src/repositories/order-edit.ts +8 -3
  65. package/src/repositories/payment/actions.ts +64 -44
  66. package/src/repositories/payment/helpers.ts +3 -3
  67. package/src/repositories/payment/index.ts +28 -12
  68. package/src/repositories/product/actions.ts +133 -98
  69. package/src/repositories/product/helpers.ts +29 -16
  70. package/src/repositories/product/index.ts +42 -25
  71. package/src/repositories/product-discount.ts +6 -4
  72. package/src/repositories/product-projection.ts +41 -21
  73. package/src/repositories/product-selection.ts +8 -15
  74. package/src/repositories/product-tailoring.ts +22 -3
  75. package/src/repositories/product-type.ts +45 -4
  76. package/src/repositories/project.ts +57 -13
  77. package/src/repositories/quote/actions.ts +5 -28
  78. package/src/repositories/quote/index.ts +29 -6
  79. package/src/repositories/quote-request/actions.ts +5 -28
  80. package/src/repositories/quote-request/index.test.ts +3 -3
  81. package/src/repositories/quote-request/index.ts +31 -11
  82. package/src/repositories/quote-staged/actions.ts +5 -28
  83. package/src/repositories/quote-staged/index.ts +22 -8
  84. package/src/repositories/recurrence-policy/index.ts +6 -4
  85. package/src/repositories/recurring-order/actions.ts +7 -32
  86. package/src/repositories/recurring-order/index.ts +8 -6
  87. package/src/repositories/review.test.ts +147 -142
  88. package/src/repositories/review.ts +31 -37
  89. package/src/repositories/shipping-method/actions.ts +11 -28
  90. package/src/repositories/shipping-method/index.ts +26 -15
  91. package/src/repositories/shopping-list/actions.ts +21 -31
  92. package/src/repositories/shopping-list/index.ts +44 -22
  93. package/src/repositories/standalone-price.ts +6 -4
  94. package/src/repositories/state.ts +15 -9
  95. package/src/repositories/store.ts +21 -32
  96. package/src/repositories/subscription.test.ts +22 -22
  97. package/src/repositories/subscription.ts +8 -3
  98. package/src/repositories/tax-category/index.ts +8 -3
  99. package/src/repositories/type/actions.ts +21 -3
  100. package/src/repositories/type/index.ts +5 -3
  101. package/src/repositories/zone.test.ts +112 -77
  102. package/src/repositories/zone.ts +5 -3
  103. package/src/schemas/generated/associate-role.ts +13 -0
  104. package/src/schemas/generated/attribute-group.ts +12 -0
  105. package/src/schemas/generated/business-unit.ts +38 -0
  106. package/src/schemas/generated/cart-discount.ts +33 -0
  107. package/src/schemas/generated/cart.ts +61 -0
  108. package/src/schemas/generated/category.ts +25 -0
  109. package/src/schemas/generated/channel.ts +21 -0
  110. package/src/schemas/generated/common.ts +1372 -0
  111. package/src/schemas/generated/custom-object.ts +11 -0
  112. package/src/schemas/generated/customer-group.ts +11 -0
  113. package/src/schemas/generated/customer.ts +47 -0
  114. package/src/schemas/generated/discount-code.ts +25 -0
  115. package/src/schemas/generated/discount-group.ts +13 -0
  116. package/src/schemas/generated/extension.ts +15 -0
  117. package/src/schemas/generated/index.ts +42 -0
  118. package/src/schemas/generated/inventory-entry.ts +20 -0
  119. package/src/schemas/generated/my-quote-request.ts +10 -0
  120. package/src/schemas/generated/order-edit.ts +18 -0
  121. package/src/schemas/generated/order-from-cart.ts +25 -0
  122. package/src/schemas/generated/payment.ts +30 -0
  123. package/src/schemas/generated/product-discount.ts +20 -0
  124. package/src/schemas/generated/product-selection.ts +18 -0
  125. package/src/schemas/generated/product-tailoring.ts +26 -0
  126. package/src/schemas/generated/product-type.ts +12 -0
  127. package/src/schemas/generated/product.ts +37 -0
  128. package/src/schemas/generated/quote-request.ts +19 -0
  129. package/src/schemas/generated/quote.ts +18 -0
  130. package/src/schemas/generated/recurrence-policy.ts +15 -0
  131. package/src/schemas/generated/recurring-order.ts +19 -0
  132. package/src/schemas/generated/review.ts +24 -0
  133. package/src/schemas/generated/shipping-method.ts +24 -0
  134. package/src/schemas/generated/shopping-list.ts +28 -0
  135. package/src/schemas/generated/staged-quote.ts +18 -0
  136. package/src/schemas/generated/standalone-price.ts +32 -0
  137. package/src/schemas/generated/state.ts +20 -0
  138. package/src/schemas/generated/store.ts +23 -0
  139. package/src/schemas/generated/subscription.ts +20 -0
  140. package/src/schemas/generated/tax-category.ts +12 -0
  141. package/src/schemas/generated/type.ts +17 -0
  142. package/src/schemas/generated/zone.ts +12 -0
  143. package/src/schemas/update-request.ts +3 -5
  144. package/src/server.ts +32 -4
  145. package/src/services/abstract.ts +207 -101
  146. package/src/services/as-associate-cart.test.ts +28 -36
  147. package/src/services/as-associate-cart.ts +15 -12
  148. package/src/services/as-associate-order.test.ts +33 -40
  149. package/src/services/as-associate-order.ts +15 -12
  150. package/src/services/as-associate-quote-request.ts +15 -12
  151. package/src/services/as-associate-shopping-list.test.ts +25 -35
  152. package/src/services/as-associate-shopping-list.ts +15 -12
  153. package/src/services/as-associate.test.ts +21 -15
  154. package/src/services/as-associate.ts +23 -22
  155. package/src/services/associate-roles.test.ts +16 -22
  156. package/src/services/associate-roles.ts +2 -2
  157. package/src/services/attribute-group.test.ts +40 -44
  158. package/src/services/attribute-group.ts +2 -2
  159. package/src/services/business-units.test.ts +227 -163
  160. package/src/services/business-units.ts +2 -2
  161. package/src/services/cart-discount.test.ts +253 -187
  162. package/src/services/cart-discount.ts +2 -2
  163. package/src/services/cart.test.ts +833 -832
  164. package/src/services/cart.ts +31 -12
  165. package/src/services/category.test.ts +208 -130
  166. package/src/services/category.ts +2 -2
  167. package/src/services/channel.test.ts +39 -44
  168. package/src/services/channel.ts +2 -2
  169. package/src/services/custom-object.test.ts +103 -79
  170. package/src/services/custom-object.ts +106 -38
  171. package/src/services/customer-group.test.ts +39 -44
  172. package/src/services/customer-group.ts +2 -2
  173. package/src/services/customer.test.ts +357 -292
  174. package/src/services/customer.ts +70 -23
  175. package/src/services/discount-code.test.ts +57 -68
  176. package/src/services/discount-code.ts +2 -2
  177. package/src/services/discount-group.test.ts +111 -134
  178. package/src/services/discount-group.ts +2 -2
  179. package/src/services/draft-validation.test.ts +255 -0
  180. package/src/services/extension.test.ts +39 -44
  181. package/src/services/extension.ts +2 -2
  182. package/src/services/inventory-entry.test.ts +106 -87
  183. package/src/services/inventory-entry.ts +2 -2
  184. package/src/services/my-business-unit.test.ts +82 -112
  185. package/src/services/my-business-unit.ts +25 -19
  186. package/src/services/my-cart.test.ts +46 -41
  187. package/src/services/my-cart.ts +32 -28
  188. package/src/services/my-customer.test.ts +153 -88
  189. package/src/services/my-customer.ts +130 -61
  190. package/src/services/my-order.ts +15 -12
  191. package/src/services/my-payment.test.ts +30 -24
  192. package/src/services/my-payment.ts +2 -2
  193. package/src/services/my-shopping-list.ts +2 -2
  194. package/src/services/order.test.ts +332 -276
  195. package/src/services/order.ts +45 -27
  196. package/src/services/payment.test.ts +31 -29
  197. package/src/services/payment.ts +2 -2
  198. package/src/services/product-discount.test.ts +39 -46
  199. package/src/services/product-discount.ts +2 -2
  200. package/src/services/product-projection.test.ts +176 -166
  201. package/src/services/product-projection.ts +31 -15
  202. package/src/services/product-selection.test.ts +17 -9
  203. package/src/services/product-selection.ts +2 -2
  204. package/src/services/product-type.test.ts +80 -21
  205. package/src/services/product-type.ts +2 -2
  206. package/src/services/product.test.ts +569 -534
  207. package/src/services/product.ts +14 -7
  208. package/src/services/project.test.ts +22 -12
  209. package/src/services/project.ts +28 -13
  210. package/src/services/quote-request.test.ts +36 -39
  211. package/src/services/quote-request.ts +2 -2
  212. package/src/services/quote-staged.ts +2 -2
  213. package/src/services/quote.ts +2 -2
  214. package/src/services/recurrence-policy.test.ts +114 -139
  215. package/src/services/recurrence-policy.ts +2 -2
  216. package/src/services/recurring-order.test.ts +149 -194
  217. package/src/services/recurring-order.ts +2 -2
  218. package/src/services/reviews.test.ts +127 -106
  219. package/src/services/reviews.ts +2 -2
  220. package/src/services/shipping-method.test.ts +96 -125
  221. package/src/services/shipping-method.ts +24 -12
  222. package/src/services/shopping-list.test.ts +183 -141
  223. package/src/services/shopping-list.ts +2 -2
  224. package/src/services/standalone-price.test.ts +60 -46
  225. package/src/services/standalone-price.ts +2 -2
  226. package/src/services/state.test.ts +20 -25
  227. package/src/services/state.ts +2 -2
  228. package/src/services/store.test.ts +26 -45
  229. package/src/services/store.ts +2 -2
  230. package/src/services/subscription.test.ts +39 -44
  231. package/src/services/subscription.ts +2 -2
  232. package/src/services/tax-category.test.ts +33 -36
  233. package/src/services/tax-category.ts +2 -2
  234. package/src/services/type.test.ts +45 -44
  235. package/src/services/type.ts +2 -2
  236. package/src/services/zone.test.ts +40 -44
  237. package/src/services/zone.ts +2 -2
  238. package/src/shipping.ts +41 -11
  239. package/src/storage/abstract.ts +248 -17
  240. package/src/storage/in-memory.ts +147 -290
  241. package/src/storage/sqlite.ts +429 -0
  242. package/src/storage/storage-map.ts +75 -0
  243. package/src/storage/storage.test-helpers.ts +97 -0
  244. package/src/storage/storage.test.ts +802 -0
  245. package/src/testing/associate-role.ts +28 -0
  246. package/src/testing/attribute-group.ts +27 -0
  247. package/src/testing/business-unit.ts +9 -8
  248. package/src/testing/cart-discount.ts +34 -0
  249. package/src/testing/cart.ts +20 -0
  250. package/src/testing/category.ts +25 -0
  251. package/src/testing/channel.ts +23 -0
  252. package/src/testing/custom-object.ts +27 -0
  253. package/src/testing/customer-group.ts +26 -0
  254. package/src/testing/customer.ts +36 -33
  255. package/src/testing/discount-code.ts +29 -0
  256. package/src/testing/discount-group.ts +27 -0
  257. package/src/testing/extension.ts +32 -0
  258. package/src/testing/index.ts +33 -0
  259. package/src/testing/inventory-entry.ts +26 -0
  260. package/src/testing/order.ts +27 -0
  261. package/src/testing/payment.ts +23 -0
  262. package/src/testing/product-discount.ts +33 -0
  263. package/src/testing/product-selection.ts +28 -0
  264. package/src/testing/product-type.ts +27 -0
  265. package/src/testing/product.ts +38 -0
  266. package/src/testing/quote-request.ts +29 -0
  267. package/src/testing/recurrence-policy.ts +33 -0
  268. package/src/testing/recurring-order.ts +32 -0
  269. package/src/testing/review.ts +24 -0
  270. package/src/testing/shipping-method.ts +31 -0
  271. package/src/testing/shopping-list.ts +25 -0
  272. package/src/testing/standalone-price.ts +31 -0
  273. package/src/testing/state.ts +21 -0
  274. package/src/testing/store.ts +26 -0
  275. package/src/testing/subscription.ts +38 -0
  276. package/src/testing/tax-category.ts +27 -0
  277. package/src/testing/type.ts +9 -6
  278. package/src/testing/zone.ts +22 -0
  279. package/src/validate.test.ts +122 -0
  280. package/src/validate.ts +78 -7
  281. package/src/.env +0 -0
package/dist/index.d.mts CHANGED
@@ -1,8 +1,10 @@
1
- import express from "express";
2
- import * as msw0 from "msw";
1
+ import { a as QueryParams, c as ResourceType, i as ProjectStorage, l as RepositoryMap, n as AbstractStorage, o as PagedQueryResponseMap, r as GetParams, s as ResourceMap, t as Config, u as GetParams$1 } from "./config-BcNSzPZz.mjs";
2
+ import * as fastify from "fastify";
3
+ import { FastifyBaseLogger, FastifyBaseLogger as FastifyBaseLogger$1, FastifyInstance } from "fastify";
4
+ import * as msw from "msw";
5
+ import "qs";
3
6
  import { SetupServer, SetupServerApi } from "msw/node";
4
- import * as _commercetools_platform_sdk0 from "@commercetools/platform-sdk";
5
- import { Address, AssociateRole, AssociateRoleDraft, AttributeGroup, AttributeGroupDraft, BaseResource, BusinessUnit, BusinessUnitDraft, Cart, CartDiscount, CartDiscountDraft, CartDraft, CartReference, Category, CategoryDraft, Channel, ChannelDraft, ChannelReference, ChannelResourceIdentifier, CustomObject, CustomObjectDraft, Customer, CustomerCreatePasswordResetToken, CustomerDraft, CustomerGroup, CustomerGroupDraft, CustomerResetPassword, CustomerToken, DiscountCode, DiscountCodeDraft, DiscountGroup, DiscountGroupDraft, Extension, ExtensionDraft, FacetResults, FilteredFacetResult, InventoryEntry, InventoryEntryDraft, LineItem, LineItemDraft, MyCustomerChangePassword, MyCustomerEmailVerify, MyCustomerResetPassword, MyOrderFromCartDraft, MyQuoteRequestDraft, Order, OrderEdit, OrderEditDraft, OrderFromCartDraft, OrderImportDraft, OrderPagedSearchResponse, OrderSearchRequest, Payment, PaymentDraft, Product, ProductDiscount, ProductDiscountDraft, ProductDraft, ProductPagedSearchResponse, ProductProjection, ProductProjectionPagedSearchResponse, ProductSearchRequest, ProductSelection, ProductSelectionDraft, ProductTailoring, ProductType, ProductTypeDraft, Project, QueryParam, Quote, QuoteDraft, QuoteRequest, QuoteRequestDraft, RangeFacetResult, RecurrencePolicy, RecurrencePolicyDraft, RecurringOrder, RecurringOrderDraft, ResourceIdentifier, Review, ReviewDraft, ReviewRatingStatistics, ShippingInfo, ShippingMethod, ShippingMethodDraft, ShippingMethodReference, ShoppingList, ShoppingListDraft, ShoppingListLineItem, StagedQuote, StagedQuoteDraft, StandalonePrice, StandalonePriceDraft, State, StateDraft, Store, StoreDraft, StoreKeyReference, Subscription, SubscriptionDraft, TaxCategory, TaxCategoryDraft, TermFacetResult, Type, TypeDraft, UpdateAction, Zone, ZoneDraft, ZoneReference } from "@commercetools/platform-sdk";
7
+ import { CustomObject, Project } from "@commercetools/platform-sdk";
6
8
 
7
9
  //#region src/oauth/store.d.ts
8
10
  type Token = {
@@ -14,12 +16,14 @@ type Token = {
14
16
  };
15
17
  declare class OAuth2Store {
16
18
  tokens: Token[];
19
+ private tokenClientMap;
17
20
  validate: boolean;
18
21
  constructor(validate?: boolean);
19
- addToken(token: Token): void;
22
+ addToken(token: Token, clientId?: string): void;
23
+ getClientIdForToken(accessToken: string): string | undefined;
20
24
  getClientToken(clientId: string, clientSecret: string, scope?: string): Token;
21
- getAnonymousToken(projectKey: string, anonymousId: string | undefined, scope: string): Token;
22
- getCustomerToken(projectKey: string, customerId: string, scope: string): Token;
25
+ getAnonymousToken(projectKey: string, anonymousId: string | undefined, scope: string, clientId?: string): Token;
26
+ getCustomerToken(projectKey: string, customerId: string, scope: string, clientId?: string): Token;
23
27
  refreshToken(clientId: string, clientSecret: string, refreshToken: string): {
24
28
  access_token: string;
25
29
  token_type: "Bearer";
@@ -29,1621 +33,30 @@ declare class OAuth2Store {
29
33
  validateToken(token: string): boolean;
30
34
  }
31
35
  //#endregion
32
- //#region src/repositories/abstract.d.ts
33
- type QueryParams$1 = {
34
- expand?: string[];
35
- where?: string[];
36
- offset?: number;
37
- limit?: number;
38
- [key: string]: QueryParam;
39
- };
40
- type GetParams = {
41
- expand?: string[];
42
- };
43
- type RepositoryContext = {
44
- projectKey: string;
45
- storeKey?: string;
46
- };
47
- declare abstract class AbstractRepository<R extends BaseResource | Project> {
48
- protected _storage: AbstractStorage;
49
- protected config: Config;
50
- protected actions: AbstractUpdateHandler | undefined;
51
- constructor(config: Config);
52
- abstract saveNew({
53
- projectKey
54
- }: RepositoryContext, resource: R): void;
55
- abstract saveUpdate({
56
- projectKey
57
- }: RepositoryContext, version: number, resource: R): void;
58
- abstract postProcessResource(context: RepositoryContext, resource: any): any;
59
- processUpdateActions(context: RepositoryContext, resource: R, version: number, actions: UpdateAction[]): R;
60
- }
61
- declare abstract class AbstractResourceRepository<T extends ResourceType> extends AbstractRepository<ResourceMap[T]> {
62
- protected _typeId: T;
63
- constructor(typeId: T, config: Config);
64
- abstract create(context: RepositoryContext, draft: any): ResourceMap[T];
65
- protected getTypeId(): T;
66
- delete(context: RepositoryContext, id: string, params?: GetParams): ResourceMap[T] | null;
67
- get(context: RepositoryContext, id: string, params?: GetParams): ResourceMap[T] | null;
68
- getByKey(context: RepositoryContext, key: string, params?: GetParams): ResourceMap[T] | null;
69
- postProcessResource(context: RepositoryContext, resource: ResourceMap[T], params?: GetParams): ResourceMap[T];
70
- query(context: RepositoryContext, params?: QueryParams$1): PagedQueryResponseMap[T] & {
71
- results: ResourceMap[T][];
72
- };
73
- saveNew(context: RepositoryContext, resource: ShallowWritable<ResourceMap[T]>): ResourceMap[T];
74
- saveUpdate(context: RepositoryContext, version: number, resource: ShallowWritable<ResourceMap[T]>): ShallowWritable<ResourceMap[T]>;
75
- }
76
- declare class AbstractUpdateHandler {
77
- protected _storage: AbstractStorage;
78
- constructor(_storage: AbstractStorage);
79
- apply<R extends BaseResource | Project>(context: RepositoryContext, resource: R, version: number, actions: UpdateAction[]): R;
80
- }
81
- //#endregion
82
- //#region src/repositories/product-tailoring.d.ts
83
- declare class ProductTailoringRepository extends AbstractResourceRepository<"product-tailoring"> {
84
- constructor(config: Config);
85
- create(context: RepositoryContext, draft: any): ProductTailoring;
86
- }
87
- //#endregion
88
- //#region src/repositories/cart/index.d.ts
89
- declare class CartRepository extends AbstractResourceRepository<"cart"> {
90
- constructor(config: Config);
91
- create(context: RepositoryContext, draft: CartDraft): Cart;
92
- getActiveCart(projectKey: string): Cart | undefined;
93
- draftLineItemtoLineItem: (projectKey: string, draftLineItem: LineItemDraft, currency: string, country: string | undefined) => LineItem;
94
- createShippingInfo(context: RepositoryContext, resource: Writable<Cart>, shippingMethodRef: NonNullable<CartDraft["shippingMethod"]>): NonNullable<Cart["shippingInfo"]>;
95
- }
96
- //#endregion
97
- //#region src/orderSearch.d.ts
98
- declare class OrderSearch {
99
- protected _storage: AbstractStorage;
100
- constructor(config: Config);
101
- search(projectKey: string, params: OrderSearchRequest): OrderPagedSearchResponse;
102
- }
103
- //#endregion
104
- //#region src/repositories/order/index.d.ts
105
- declare class OrderRepository extends AbstractResourceRepository<"order"> {
106
- protected _searchService: OrderSearch;
107
- constructor(config: Config);
108
- create(context: RepositoryContext, draft: OrderFromCartDraft): Order;
109
- createFromCart(context: RepositoryContext, cartReference: CartReference, orderNumber?: string): Order;
110
- import(context: RepositoryContext, draft: OrderImportDraft): Order;
111
- private lineItemFromImportDraft;
112
- private customLineItemFromImportDraft;
113
- getWithOrderNumber(context: RepositoryContext, orderNumber: string, params?: QueryParams$1): Order | undefined;
114
- createShippingInfo(context: RepositoryContext, resource: Writable<Order>, shippingMethodRef: ShippingMethodReference): ShippingInfo;
115
- search(context: RepositoryContext, searchRequest: OrderSearchRequest): OrderPagedSearchResponse;
116
- }
117
- //#endregion
118
- //#region src/repositories/quote-request/index.d.ts
119
- declare class QuoteRequestRepository extends AbstractResourceRepository<"quote-request"> {
120
- constructor(config: Config);
121
- create(context: RepositoryContext, draft: QuoteRequestDraft | MyQuoteRequestDraft): QuoteRequest;
122
- createFromCart(context: RepositoryContext, cartReference: CartReference): QuoteRequest;
123
- }
124
- //#endregion
125
- //#region src/repositories/shopping-list/index.d.ts
126
- declare class ShoppingListRepository extends AbstractResourceRepository<"shopping-list"> {
127
- constructor(config: Config);
128
- create(context: RepositoryContext, draft: ShoppingListDraft): ShoppingList;
129
- draftLineItemtoLineItem: (projectKey: string, draftLineItem: LineItemDraft) => ShoppingListLineItem;
130
- }
131
- //#endregion
132
- //#region src/repositories/as-associate.d.ts
133
- declare class AsAssociateOrderRepository extends OrderRepository {}
134
- declare class AsAssociateCartRepository extends CartRepository {}
135
- declare class AsAssociateQuoteRequestRepository extends QuoteRequestRepository {}
136
- declare class AsAssociateShoppingListRepository extends ShoppingListRepository {}
137
- //#endregion
138
- //#region src/repositories/associate-role.d.ts
139
- declare class AssociateRoleRepository extends AbstractResourceRepository<"associate-role"> {
140
- constructor(config: Config);
141
- create(context: RepositoryContext, draft: AssociateRoleDraft): AssociateRole;
142
- }
143
- //#endregion
144
- //#region src/repositories/attribute-group.d.ts
145
- declare class AttributeGroupRepository extends AbstractResourceRepository<"attribute-group"> {
146
- constructor(config: Config);
147
- create(context: RepositoryContext, draft: AttributeGroupDraft): AttributeGroup;
148
- }
149
- //#endregion
150
- //#region src/repositories/business-unit.d.ts
151
- declare class BusinessUnitRepository extends AbstractResourceRepository<"business-unit"> {
152
- constructor(config: Config);
153
- create(context: RepositoryContext, draft: BusinessUnitDraft): BusinessUnit;
154
- private _isCompanyDraft;
155
- private _isDivisionDraft;
156
- }
157
- //#endregion
158
- //#region src/repositories/cart-discount/index.d.ts
159
- declare class CartDiscountRepository extends AbstractResourceRepository<"cart-discount"> {
160
- constructor(config: Config);
161
- create(context: RepositoryContext, draft: CartDiscountDraft): CartDiscount;
162
- private transformValueDraft;
163
- }
164
- //#endregion
165
- //#region src/repositories/category/index.d.ts
166
- declare class CategoryRepository extends AbstractResourceRepository<"category"> {
167
- constructor(config: Config);
168
- create(context: RepositoryContext, draft: CategoryDraft): Category;
169
- postProcessResource(context: RepositoryContext, resource: Writable<Category>, params?: GetParams): Category;
170
- }
171
- //#endregion
172
- //#region src/repositories/channel.d.ts
173
- declare class ChannelRepository extends AbstractResourceRepository<"channel"> {
174
- constructor(config: Config);
175
- create(context: RepositoryContext, draft: ChannelDraft): Channel;
176
- }
177
- //#endregion
178
- //#region src/repositories/custom-object.d.ts
179
- declare class CustomObjectRepository extends AbstractResourceRepository<"key-value-document"> {
180
- constructor(config: Config);
181
- create(context: RepositoryContext, draft: Writable<CustomObjectDraft>): CustomObject;
182
- getWithContainerAndKey(context: RepositoryContext, container: string, key: string): CustomObject | undefined;
183
- queryWithContainer(context: RepositoryContext, container: string, params?: QueryParams$1): _commercetools_platform_sdk0.CustomObjectPagedQueryResponse;
184
- }
185
- //#endregion
186
- //#region src/repositories/customer/index.d.ts
187
- declare class CustomerRepository extends AbstractResourceRepository<"customer"> {
188
- constructor(config: Config);
189
- create(context: RepositoryContext, draft: CustomerDraft): Customer;
190
- saveUpdate(context: RepositoryContext, version: number, resource: ShallowWritable<ResourceMap["customer"]>): ShallowWritable<ResourceMap["customer"]>;
191
- passwordResetToken(context: RepositoryContext, request: CustomerCreatePasswordResetToken): CustomerToken;
192
- passwordReset(context: RepositoryContext, resetPassword: CustomerResetPassword | MyCustomerResetPassword): {
193
- id: string;
194
- version: number;
195
- key?: string | undefined;
196
- customerNumber?: string | undefined;
197
- externalId?: string | undefined;
198
- createdAt: string;
199
- lastModifiedAt: string;
200
- lastModifiedBy?: {
201
- clientId?: string | undefined;
202
- externalUserId?: string | undefined;
203
- customer?: {
204
- typeId: "customer";
205
- id: string;
206
- obj?: /*elided*/any | undefined;
207
- } | undefined;
208
- anonymousId?: string | undefined;
209
- attributedTo?: {
210
- clientId?: string | undefined;
211
- source: _commercetools_platform_sdk0.AttributionSource;
212
- } | undefined;
213
- associate?: {
214
- typeId: "customer";
215
- id: string;
216
- obj?: /*elided*/any | undefined;
217
- } | undefined;
218
- } | undefined;
219
- createdBy?: {
220
- clientId?: string | undefined;
221
- externalUserId?: string | undefined;
222
- customer?: {
223
- typeId: "customer";
224
- id: string;
225
- obj?: /*elided*/any | undefined;
226
- } | undefined;
227
- anonymousId?: string | undefined;
228
- attributedTo?: {
229
- clientId?: string | undefined;
230
- source: _commercetools_platform_sdk0.AttributionSource;
231
- } | undefined;
232
- associate?: {
233
- typeId: "customer";
234
- id: string;
235
- obj?: /*elided*/any | undefined;
236
- } | undefined;
237
- } | undefined;
238
- email: string;
239
- password?: string | undefined;
240
- firstName?: string | undefined;
241
- lastName?: string | undefined;
242
- middleName?: string | undefined;
243
- title?: string | undefined;
244
- dateOfBirth?: string | undefined;
245
- companyName?: string | undefined;
246
- vatId?: string | undefined;
247
- addresses: WritableArray<Address>;
248
- defaultShippingAddressId?: string | undefined;
249
- shippingAddressIds?: WritableArray<string> | undefined;
250
- defaultBillingAddressId?: string | undefined;
251
- billingAddressIds?: WritableArray<string> | undefined;
252
- isEmailVerified: boolean;
253
- customerGroup?: {
254
- typeId: "customer-group";
255
- id: string;
256
- obj?: {
257
- id: string;
258
- version: number;
259
- createdAt: string;
260
- lastModifiedAt: string;
261
- lastModifiedBy?: {
262
- clientId?: string | undefined;
263
- externalUserId?: string | undefined;
264
- customer?: {
265
- typeId: "customer";
266
- id: string;
267
- obj?: /*elided*/any | undefined;
268
- } | undefined;
269
- anonymousId?: string | undefined;
270
- attributedTo?: {
271
- clientId?: string | undefined;
272
- source: _commercetools_platform_sdk0.AttributionSource;
273
- } | undefined;
274
- associate?: {
275
- typeId: "customer";
276
- id: string;
277
- obj?: /*elided*/any | undefined;
278
- } | undefined;
279
- } | undefined;
280
- createdBy?: {
281
- clientId?: string | undefined;
282
- externalUserId?: string | undefined;
283
- customer?: {
284
- typeId: "customer";
285
- id: string;
286
- obj?: /*elided*/any | undefined;
287
- } | undefined;
288
- anonymousId?: string | undefined;
289
- attributedTo?: {
290
- clientId?: string | undefined;
291
- source: _commercetools_platform_sdk0.AttributionSource;
292
- } | undefined;
293
- associate?: {
294
- typeId: "customer";
295
- id: string;
296
- obj?: /*elided*/any | undefined;
297
- } | undefined;
298
- } | undefined;
299
- key?: string | undefined;
300
- name: string;
301
- custom?: {
302
- type: {
303
- typeId: "type";
304
- id: string;
305
- obj?: {
306
- id: string;
307
- version: number;
308
- createdAt: string;
309
- lastModifiedAt: string;
310
- lastModifiedBy?: {
311
- clientId?: string | undefined;
312
- externalUserId?: string | undefined;
313
- customer?: {
314
- typeId: "customer";
315
- id: string;
316
- obj?: /*elided*/any | undefined;
317
- } | undefined;
318
- anonymousId?: string | undefined;
319
- attributedTo?: {
320
- clientId?: string | undefined;
321
- source: _commercetools_platform_sdk0.AttributionSource;
322
- } | undefined;
323
- associate?: {
324
- typeId: "customer";
325
- id: string;
326
- obj?: /*elided*/any | undefined;
327
- } | undefined;
328
- } | undefined;
329
- createdBy?: {
330
- clientId?: string | undefined;
331
- externalUserId?: string | undefined;
332
- customer?: {
333
- typeId: "customer";
334
- id: string;
335
- obj?: /*elided*/any | undefined;
336
- } | undefined;
337
- anonymousId?: string | undefined;
338
- attributedTo?: {
339
- clientId?: string | undefined;
340
- source: _commercetools_platform_sdk0.AttributionSource;
341
- } | undefined;
342
- associate?: {
343
- typeId: "customer";
344
- id: string;
345
- obj?: /*elided*/any | undefined;
346
- } | undefined;
347
- } | undefined;
348
- key: string;
349
- name: {
350
- [x: string]: string;
351
- };
352
- description?: {
353
- [x: string]: string;
354
- } | undefined;
355
- resourceTypeIds: WritableArray<_commercetools_platform_sdk0.ResourceTypeId>;
356
- fieldDefinitions: WritableArray<_commercetools_platform_sdk0.FieldDefinition>;
357
- } | undefined;
358
- };
359
- fields: {
360
- [x: string]: any;
361
- };
362
- } | undefined;
363
- } | undefined;
364
- } | undefined;
365
- customerGroupAssignments?: WritableArray<_commercetools_platform_sdk0.CustomerGroupAssignment> | undefined;
366
- custom?: {
367
- type: {
368
- typeId: "type";
369
- id: string;
370
- obj?: {
371
- id: string;
372
- version: number;
373
- createdAt: string;
374
- lastModifiedAt: string;
375
- lastModifiedBy?: {
376
- clientId?: string | undefined;
377
- externalUserId?: string | undefined;
378
- customer?: {
379
- typeId: "customer";
380
- id: string;
381
- obj?: /*elided*/any | undefined;
382
- } | undefined;
383
- anonymousId?: string | undefined;
384
- attributedTo?: {
385
- clientId?: string | undefined;
386
- source: _commercetools_platform_sdk0.AttributionSource;
387
- } | undefined;
388
- associate?: {
389
- typeId: "customer";
390
- id: string;
391
- obj?: /*elided*/any | undefined;
392
- } | undefined;
393
- } | undefined;
394
- createdBy?: {
395
- clientId?: string | undefined;
396
- externalUserId?: string | undefined;
397
- customer?: {
398
- typeId: "customer";
399
- id: string;
400
- obj?: /*elided*/any | undefined;
401
- } | undefined;
402
- anonymousId?: string | undefined;
403
- attributedTo?: {
404
- clientId?: string | undefined;
405
- source: _commercetools_platform_sdk0.AttributionSource;
406
- } | undefined;
407
- associate?: {
408
- typeId: "customer";
409
- id: string;
410
- obj?: /*elided*/any | undefined;
411
- } | undefined;
412
- } | undefined;
413
- key: string;
414
- name: {
415
- [x: string]: string;
416
- };
417
- description?: {
418
- [x: string]: string;
419
- } | undefined;
420
- resourceTypeIds: WritableArray<_commercetools_platform_sdk0.ResourceTypeId>;
421
- fieldDefinitions: WritableArray<_commercetools_platform_sdk0.FieldDefinition>;
422
- } | undefined;
423
- };
424
- fields: {
425
- [x: string]: any;
426
- };
427
- } | undefined;
428
- locale?: string | undefined;
429
- salutation?: string | undefined;
430
- stores: WritableArray<StoreKeyReference>;
431
- authenticationMode: _commercetools_platform_sdk0.AuthenticationMode;
432
- };
433
- emailToken(context: RepositoryContext, id: string): CustomerToken;
434
- emailTokenConfirm(context: RepositoryContext, request: {
435
- tokenValue: string;
436
- }): {
437
- id: string;
438
- version: number;
439
- key?: string | undefined;
440
- customerNumber?: string | undefined;
441
- externalId?: string | undefined;
442
- createdAt: string;
443
- lastModifiedAt: string;
444
- lastModifiedBy?: {
445
- clientId?: string | undefined;
446
- externalUserId?: string | undefined;
447
- customer?: {
448
- typeId: "customer";
449
- id: string;
450
- obj?: /*elided*/any | undefined;
451
- } | undefined;
452
- anonymousId?: string | undefined;
453
- attributedTo?: {
454
- clientId?: string | undefined;
455
- source: _commercetools_platform_sdk0.AttributionSource;
456
- } | undefined;
457
- associate?: {
458
- typeId: "customer";
459
- id: string;
460
- obj?: /*elided*/any | undefined;
461
- } | undefined;
462
- } | undefined;
463
- createdBy?: {
464
- clientId?: string | undefined;
465
- externalUserId?: string | undefined;
466
- customer?: {
467
- typeId: "customer";
468
- id: string;
469
- obj?: /*elided*/any | undefined;
470
- } | undefined;
471
- anonymousId?: string | undefined;
472
- attributedTo?: {
473
- clientId?: string | undefined;
474
- source: _commercetools_platform_sdk0.AttributionSource;
475
- } | undefined;
476
- associate?: {
477
- typeId: "customer";
478
- id: string;
479
- obj?: /*elided*/any | undefined;
480
- } | undefined;
481
- } | undefined;
482
- email: string;
483
- password?: string | undefined;
484
- firstName?: string | undefined;
485
- lastName?: string | undefined;
486
- middleName?: string | undefined;
487
- title?: string | undefined;
488
- dateOfBirth?: string | undefined;
489
- companyName?: string | undefined;
490
- vatId?: string | undefined;
491
- addresses: WritableArray<Address>;
492
- defaultShippingAddressId?: string | undefined;
493
- shippingAddressIds?: WritableArray<string> | undefined;
494
- defaultBillingAddressId?: string | undefined;
495
- billingAddressIds?: WritableArray<string> | undefined;
496
- isEmailVerified: boolean;
497
- customerGroup?: {
498
- typeId: "customer-group";
499
- id: string;
500
- obj?: {
501
- id: string;
502
- version: number;
503
- createdAt: string;
504
- lastModifiedAt: string;
505
- lastModifiedBy?: {
506
- clientId?: string | undefined;
507
- externalUserId?: string | undefined;
508
- customer?: {
509
- typeId: "customer";
510
- id: string;
511
- obj?: /*elided*/any | undefined;
512
- } | undefined;
513
- anonymousId?: string | undefined;
514
- attributedTo?: {
515
- clientId?: string | undefined;
516
- source: _commercetools_platform_sdk0.AttributionSource;
517
- } | undefined;
518
- associate?: {
519
- typeId: "customer";
520
- id: string;
521
- obj?: /*elided*/any | undefined;
522
- } | undefined;
523
- } | undefined;
524
- createdBy?: {
525
- clientId?: string | undefined;
526
- externalUserId?: string | undefined;
527
- customer?: {
528
- typeId: "customer";
529
- id: string;
530
- obj?: /*elided*/any | undefined;
531
- } | undefined;
532
- anonymousId?: string | undefined;
533
- attributedTo?: {
534
- clientId?: string | undefined;
535
- source: _commercetools_platform_sdk0.AttributionSource;
536
- } | undefined;
537
- associate?: {
538
- typeId: "customer";
539
- id: string;
540
- obj?: /*elided*/any | undefined;
541
- } | undefined;
542
- } | undefined;
543
- key?: string | undefined;
544
- name: string;
545
- custom?: {
546
- type: {
547
- typeId: "type";
548
- id: string;
549
- obj?: {
550
- id: string;
551
- version: number;
552
- createdAt: string;
553
- lastModifiedAt: string;
554
- lastModifiedBy?: {
555
- clientId?: string | undefined;
556
- externalUserId?: string | undefined;
557
- customer?: {
558
- typeId: "customer";
559
- id: string;
560
- obj?: /*elided*/any | undefined;
561
- } | undefined;
562
- anonymousId?: string | undefined;
563
- attributedTo?: {
564
- clientId?: string | undefined;
565
- source: _commercetools_platform_sdk0.AttributionSource;
566
- } | undefined;
567
- associate?: {
568
- typeId: "customer";
569
- id: string;
570
- obj?: /*elided*/any | undefined;
571
- } | undefined;
572
- } | undefined;
573
- createdBy?: {
574
- clientId?: string | undefined;
575
- externalUserId?: string | undefined;
576
- customer?: {
577
- typeId: "customer";
578
- id: string;
579
- obj?: /*elided*/any | undefined;
580
- } | undefined;
581
- anonymousId?: string | undefined;
582
- attributedTo?: {
583
- clientId?: string | undefined;
584
- source: _commercetools_platform_sdk0.AttributionSource;
585
- } | undefined;
586
- associate?: {
587
- typeId: "customer";
588
- id: string;
589
- obj?: /*elided*/any | undefined;
590
- } | undefined;
591
- } | undefined;
592
- key: string;
593
- name: {
594
- [x: string]: string;
595
- };
596
- description?: {
597
- [x: string]: string;
598
- } | undefined;
599
- resourceTypeIds: WritableArray<_commercetools_platform_sdk0.ResourceTypeId>;
600
- fieldDefinitions: WritableArray<_commercetools_platform_sdk0.FieldDefinition>;
601
- } | undefined;
602
- };
603
- fields: {
604
- [x: string]: any;
605
- };
606
- } | undefined;
607
- } | undefined;
608
- } | undefined;
609
- customerGroupAssignments?: WritableArray<_commercetools_platform_sdk0.CustomerGroupAssignment> | undefined;
610
- custom?: {
611
- type: {
612
- typeId: "type";
613
- id: string;
614
- obj?: {
615
- id: string;
616
- version: number;
617
- createdAt: string;
618
- lastModifiedAt: string;
619
- lastModifiedBy?: {
620
- clientId?: string | undefined;
621
- externalUserId?: string | undefined;
622
- customer?: {
623
- typeId: "customer";
624
- id: string;
625
- obj?: /*elided*/any | undefined;
626
- } | undefined;
627
- anonymousId?: string | undefined;
628
- attributedTo?: {
629
- clientId?: string | undefined;
630
- source: _commercetools_platform_sdk0.AttributionSource;
631
- } | undefined;
632
- associate?: {
633
- typeId: "customer";
634
- id: string;
635
- obj?: /*elided*/any | undefined;
636
- } | undefined;
637
- } | undefined;
638
- createdBy?: {
639
- clientId?: string | undefined;
640
- externalUserId?: string | undefined;
641
- customer?: {
642
- typeId: "customer";
643
- id: string;
644
- obj?: /*elided*/any | undefined;
645
- } | undefined;
646
- anonymousId?: string | undefined;
647
- attributedTo?: {
648
- clientId?: string | undefined;
649
- source: _commercetools_platform_sdk0.AttributionSource;
650
- } | undefined;
651
- associate?: {
652
- typeId: "customer";
653
- id: string;
654
- obj?: /*elided*/any | undefined;
655
- } | undefined;
656
- } | undefined;
657
- key: string;
658
- name: {
659
- [x: string]: string;
660
- };
661
- description?: {
662
- [x: string]: string;
663
- } | undefined;
664
- resourceTypeIds: WritableArray<_commercetools_platform_sdk0.ResourceTypeId>;
665
- fieldDefinitions: WritableArray<_commercetools_platform_sdk0.FieldDefinition>;
666
- } | undefined;
667
- };
668
- fields: {
669
- [x: string]: any;
670
- };
671
- } | undefined;
672
- locale?: string | undefined;
673
- salutation?: string | undefined;
674
- stores: WritableArray<StoreKeyReference>;
675
- authenticationMode: _commercetools_platform_sdk0.AuthenticationMode;
676
- };
677
- private storeReferenceToStoreKeyReference;
678
- }
679
- //#endregion
680
- //#region src/repositories/customer-group.d.ts
681
- declare class CustomerGroupRepository extends AbstractResourceRepository<"customer-group"> {
682
- constructor(config: Config);
683
- create(context: RepositoryContext, draft: CustomerGroupDraft): CustomerGroup;
684
- }
685
- //#endregion
686
- //#region src/repositories/discount-code/index.d.ts
687
- declare class DiscountCodeRepository extends AbstractResourceRepository<"discount-code"> {
688
- constructor(config: Config);
689
- create(context: RepositoryContext, draft: DiscountCodeDraft): DiscountCode;
690
- }
691
- //#endregion
692
- //#region src/repositories/discount-group/index.d.ts
693
- declare class DiscountGroupRepository extends AbstractResourceRepository<"discount-group"> {
694
- constructor(config: Config);
695
- create(context: RepositoryContext, draft: DiscountGroupDraft): DiscountGroup;
696
- }
697
- //#endregion
698
- //#region src/repositories/extension.d.ts
699
- declare class ExtensionRepository extends AbstractResourceRepository<"extension"> {
700
- constructor(config: Config);
701
- create(context: RepositoryContext, draft: ExtensionDraft): Extension;
702
- postProcessResource(context: RepositoryContext, resource: Extension): Extension;
703
- }
704
- //#endregion
705
- //#region src/repositories/inventory-entry/index.d.ts
706
- declare class InventoryEntryRepository extends AbstractResourceRepository<"inventory-entry"> {
707
- constructor(config: Config);
708
- create(context: RepositoryContext, draft: InventoryEntryDraft): InventoryEntry;
709
- }
710
- //#endregion
711
- //#region src/repositories/my-customer.d.ts
712
- declare class MyCustomerRepository extends CustomerRepository {
713
- changePassword(context: RepositoryContext, changePassword: MyCustomerChangePassword): {
714
- id: string;
715
- version: number;
716
- key?: string | undefined;
717
- customerNumber?: string | undefined;
718
- externalId?: string | undefined;
719
- createdAt: string;
720
- lastModifiedAt: string;
721
- lastModifiedBy?: {
722
- clientId?: string | undefined;
723
- externalUserId?: string | undefined;
724
- customer?: {
725
- typeId: "customer";
726
- id: string;
727
- obj?: /*elided*/any | undefined;
728
- } | undefined;
729
- anonymousId?: string | undefined;
730
- attributedTo?: {
731
- clientId?: string | undefined;
732
- source: _commercetools_platform_sdk0.AttributionSource;
733
- } | undefined;
734
- associate?: {
735
- typeId: "customer";
736
- id: string;
737
- obj?: /*elided*/any | undefined;
738
- } | undefined;
739
- } | undefined;
740
- createdBy?: {
741
- clientId?: string | undefined;
742
- externalUserId?: string | undefined;
743
- customer?: {
744
- typeId: "customer";
745
- id: string;
746
- obj?: /*elided*/any | undefined;
747
- } | undefined;
748
- anonymousId?: string | undefined;
749
- attributedTo?: {
750
- clientId?: string | undefined;
751
- source: _commercetools_platform_sdk0.AttributionSource;
752
- } | undefined;
753
- associate?: {
754
- typeId: "customer";
755
- id: string;
756
- obj?: /*elided*/any | undefined;
757
- } | undefined;
758
- } | undefined;
759
- email: string;
760
- password?: string | undefined;
761
- firstName?: string | undefined;
762
- lastName?: string | undefined;
763
- middleName?: string | undefined;
764
- title?: string | undefined;
765
- dateOfBirth?: string | undefined;
766
- companyName?: string | undefined;
767
- vatId?: string | undefined;
768
- addresses: WritableArray<_commercetools_platform_sdk0.Address>;
769
- defaultShippingAddressId?: string | undefined;
770
- shippingAddressIds?: WritableArray<string> | undefined;
771
- defaultBillingAddressId?: string | undefined;
772
- billingAddressIds?: WritableArray<string> | undefined;
773
- isEmailVerified: boolean;
774
- customerGroup?: {
775
- typeId: "customer-group";
776
- id: string;
777
- obj?: {
778
- id: string;
779
- version: number;
780
- createdAt: string;
781
- lastModifiedAt: string;
782
- lastModifiedBy?: {
783
- clientId?: string | undefined;
784
- externalUserId?: string | undefined;
785
- customer?: {
786
- typeId: "customer";
787
- id: string;
788
- obj?: /*elided*/any | undefined;
789
- } | undefined;
790
- anonymousId?: string | undefined;
791
- attributedTo?: {
792
- clientId?: string | undefined;
793
- source: _commercetools_platform_sdk0.AttributionSource;
794
- } | undefined;
795
- associate?: {
796
- typeId: "customer";
797
- id: string;
798
- obj?: /*elided*/any | undefined;
799
- } | undefined;
800
- } | undefined;
801
- createdBy?: {
802
- clientId?: string | undefined;
803
- externalUserId?: string | undefined;
804
- customer?: {
805
- typeId: "customer";
806
- id: string;
807
- obj?: /*elided*/any | undefined;
808
- } | undefined;
809
- anonymousId?: string | undefined;
810
- attributedTo?: {
811
- clientId?: string | undefined;
812
- source: _commercetools_platform_sdk0.AttributionSource;
813
- } | undefined;
814
- associate?: {
815
- typeId: "customer";
816
- id: string;
817
- obj?: /*elided*/any | undefined;
818
- } | undefined;
819
- } | undefined;
820
- key?: string | undefined;
821
- name: string;
822
- custom?: {
823
- type: {
824
- typeId: "type";
825
- id: string;
826
- obj?: {
827
- id: string;
828
- version: number;
829
- createdAt: string;
830
- lastModifiedAt: string;
831
- lastModifiedBy?: {
832
- clientId?: string | undefined;
833
- externalUserId?: string | undefined;
834
- customer?: {
835
- typeId: "customer";
836
- id: string;
837
- obj?: /*elided*/any | undefined;
838
- } | undefined;
839
- anonymousId?: string | undefined;
840
- attributedTo?: {
841
- clientId?: string | undefined;
842
- source: _commercetools_platform_sdk0.AttributionSource;
843
- } | undefined;
844
- associate?: {
845
- typeId: "customer";
846
- id: string;
847
- obj?: /*elided*/any | undefined;
848
- } | undefined;
849
- } | undefined;
850
- createdBy?: {
851
- clientId?: string | undefined;
852
- externalUserId?: string | undefined;
853
- customer?: {
854
- typeId: "customer";
855
- id: string;
856
- obj?: /*elided*/any | undefined;
857
- } | undefined;
858
- anonymousId?: string | undefined;
859
- attributedTo?: {
860
- clientId?: string | undefined;
861
- source: _commercetools_platform_sdk0.AttributionSource;
862
- } | undefined;
863
- associate?: {
864
- typeId: "customer";
865
- id: string;
866
- obj?: /*elided*/any | undefined;
867
- } | undefined;
868
- } | undefined;
869
- key: string;
870
- name: {
871
- [x: string]: string;
872
- };
873
- description?: {
874
- [x: string]: string;
875
- } | undefined;
876
- resourceTypeIds: WritableArray<_commercetools_platform_sdk0.ResourceTypeId>;
877
- fieldDefinitions: WritableArray<_commercetools_platform_sdk0.FieldDefinition>;
878
- } | undefined;
879
- };
880
- fields: {
881
- [x: string]: any;
882
- };
883
- } | undefined;
884
- } | undefined;
885
- } | undefined;
886
- customerGroupAssignments?: WritableArray<_commercetools_platform_sdk0.CustomerGroupAssignment> | undefined;
887
- custom?: {
888
- type: {
889
- typeId: "type";
890
- id: string;
891
- obj?: {
892
- id: string;
893
- version: number;
894
- createdAt: string;
895
- lastModifiedAt: string;
896
- lastModifiedBy?: {
897
- clientId?: string | undefined;
898
- externalUserId?: string | undefined;
899
- customer?: {
900
- typeId: "customer";
901
- id: string;
902
- obj?: /*elided*/any | undefined;
903
- } | undefined;
904
- anonymousId?: string | undefined;
905
- attributedTo?: {
906
- clientId?: string | undefined;
907
- source: _commercetools_platform_sdk0.AttributionSource;
908
- } | undefined;
909
- associate?: {
910
- typeId: "customer";
911
- id: string;
912
- obj?: /*elided*/any | undefined;
913
- } | undefined;
914
- } | undefined;
915
- createdBy?: {
916
- clientId?: string | undefined;
917
- externalUserId?: string | undefined;
918
- customer?: {
919
- typeId: "customer";
920
- id: string;
921
- obj?: /*elided*/any | undefined;
922
- } | undefined;
923
- anonymousId?: string | undefined;
924
- attributedTo?: {
925
- clientId?: string | undefined;
926
- source: _commercetools_platform_sdk0.AttributionSource;
927
- } | undefined;
928
- associate?: {
929
- typeId: "customer";
930
- id: string;
931
- obj?: /*elided*/any | undefined;
932
- } | undefined;
933
- } | undefined;
934
- key: string;
935
- name: {
936
- [x: string]: string;
937
- };
938
- description?: {
939
- [x: string]: string;
940
- } | undefined;
941
- resourceTypeIds: WritableArray<_commercetools_platform_sdk0.ResourceTypeId>;
942
- fieldDefinitions: WritableArray<_commercetools_platform_sdk0.FieldDefinition>;
943
- } | undefined;
944
- };
945
- fields: {
946
- [x: string]: any;
947
- };
948
- } | undefined;
949
- locale?: string | undefined;
950
- salutation?: string | undefined;
951
- stores: WritableArray<_commercetools_platform_sdk0.StoreKeyReference>;
952
- authenticationMode: _commercetools_platform_sdk0.AuthenticationMode;
953
- };
954
- confirmEmail(context: RepositoryContext, resetPassword: MyCustomerEmailVerify): {
955
- id: string;
956
- version: number;
957
- key?: string | undefined;
958
- customerNumber?: string | undefined;
959
- externalId?: string | undefined;
960
- createdAt: string;
961
- lastModifiedAt: string;
962
- lastModifiedBy?: {
963
- clientId?: string | undefined;
964
- externalUserId?: string | undefined;
965
- customer?: {
966
- typeId: "customer";
967
- id: string;
968
- obj?: /*elided*/any | undefined;
969
- } | undefined;
970
- anonymousId?: string | undefined;
971
- attributedTo?: {
972
- clientId?: string | undefined;
973
- source: _commercetools_platform_sdk0.AttributionSource;
974
- } | undefined;
975
- associate?: {
976
- typeId: "customer";
977
- id: string;
978
- obj?: /*elided*/any | undefined;
979
- } | undefined;
980
- } | undefined;
981
- createdBy?: {
982
- clientId?: string | undefined;
983
- externalUserId?: string | undefined;
984
- customer?: {
985
- typeId: "customer";
986
- id: string;
987
- obj?: /*elided*/any | undefined;
988
- } | undefined;
989
- anonymousId?: string | undefined;
990
- attributedTo?: {
991
- clientId?: string | undefined;
992
- source: _commercetools_platform_sdk0.AttributionSource;
993
- } | undefined;
994
- associate?: {
995
- typeId: "customer";
996
- id: string;
997
- obj?: /*elided*/any | undefined;
998
- } | undefined;
999
- } | undefined;
1000
- email: string;
1001
- password?: string | undefined;
1002
- firstName?: string | undefined;
1003
- lastName?: string | undefined;
1004
- middleName?: string | undefined;
1005
- title?: string | undefined;
1006
- dateOfBirth?: string | undefined;
1007
- companyName?: string | undefined;
1008
- vatId?: string | undefined;
1009
- addresses: WritableArray<_commercetools_platform_sdk0.Address>;
1010
- defaultShippingAddressId?: string | undefined;
1011
- shippingAddressIds?: WritableArray<string> | undefined;
1012
- defaultBillingAddressId?: string | undefined;
1013
- billingAddressIds?: WritableArray<string> | undefined;
1014
- isEmailVerified: boolean;
1015
- customerGroup?: {
1016
- typeId: "customer-group";
1017
- id: string;
1018
- obj?: {
1019
- id: string;
1020
- version: number;
1021
- createdAt: string;
1022
- lastModifiedAt: string;
1023
- lastModifiedBy?: {
1024
- clientId?: string | undefined;
1025
- externalUserId?: string | undefined;
1026
- customer?: {
1027
- typeId: "customer";
1028
- id: string;
1029
- obj?: /*elided*/any | undefined;
1030
- } | undefined;
1031
- anonymousId?: string | undefined;
1032
- attributedTo?: {
1033
- clientId?: string | undefined;
1034
- source: _commercetools_platform_sdk0.AttributionSource;
1035
- } | undefined;
1036
- associate?: {
1037
- typeId: "customer";
1038
- id: string;
1039
- obj?: /*elided*/any | undefined;
1040
- } | undefined;
1041
- } | undefined;
1042
- createdBy?: {
1043
- clientId?: string | undefined;
1044
- externalUserId?: string | undefined;
1045
- customer?: {
1046
- typeId: "customer";
1047
- id: string;
1048
- obj?: /*elided*/any | undefined;
1049
- } | undefined;
1050
- anonymousId?: string | undefined;
1051
- attributedTo?: {
1052
- clientId?: string | undefined;
1053
- source: _commercetools_platform_sdk0.AttributionSource;
1054
- } | undefined;
1055
- associate?: {
1056
- typeId: "customer";
1057
- id: string;
1058
- obj?: /*elided*/any | undefined;
1059
- } | undefined;
1060
- } | undefined;
1061
- key?: string | undefined;
1062
- name: string;
1063
- custom?: {
1064
- type: {
1065
- typeId: "type";
1066
- id: string;
1067
- obj?: {
1068
- id: string;
1069
- version: number;
1070
- createdAt: string;
1071
- lastModifiedAt: string;
1072
- lastModifiedBy?: {
1073
- clientId?: string | undefined;
1074
- externalUserId?: string | undefined;
1075
- customer?: {
1076
- typeId: "customer";
1077
- id: string;
1078
- obj?: /*elided*/any | undefined;
1079
- } | undefined;
1080
- anonymousId?: string | undefined;
1081
- attributedTo?: {
1082
- clientId?: string | undefined;
1083
- source: _commercetools_platform_sdk0.AttributionSource;
1084
- } | undefined;
1085
- associate?: {
1086
- typeId: "customer";
1087
- id: string;
1088
- obj?: /*elided*/any | undefined;
1089
- } | undefined;
1090
- } | undefined;
1091
- createdBy?: {
1092
- clientId?: string | undefined;
1093
- externalUserId?: string | undefined;
1094
- customer?: {
1095
- typeId: "customer";
1096
- id: string;
1097
- obj?: /*elided*/any | undefined;
1098
- } | undefined;
1099
- anonymousId?: string | undefined;
1100
- attributedTo?: {
1101
- clientId?: string | undefined;
1102
- source: _commercetools_platform_sdk0.AttributionSource;
1103
- } | undefined;
1104
- associate?: {
1105
- typeId: "customer";
1106
- id: string;
1107
- obj?: /*elided*/any | undefined;
1108
- } | undefined;
1109
- } | undefined;
1110
- key: string;
1111
- name: {
1112
- [x: string]: string;
1113
- };
1114
- description?: {
1115
- [x: string]: string;
1116
- } | undefined;
1117
- resourceTypeIds: WritableArray<_commercetools_platform_sdk0.ResourceTypeId>;
1118
- fieldDefinitions: WritableArray<_commercetools_platform_sdk0.FieldDefinition>;
1119
- } | undefined;
1120
- };
1121
- fields: {
1122
- [x: string]: any;
1123
- };
1124
- } | undefined;
1125
- } | undefined;
1126
- } | undefined;
1127
- customerGroupAssignments?: WritableArray<_commercetools_platform_sdk0.CustomerGroupAssignment> | undefined;
1128
- custom?: {
1129
- type: {
1130
- typeId: "type";
1131
- id: string;
1132
- obj?: {
1133
- id: string;
1134
- version: number;
1135
- createdAt: string;
1136
- lastModifiedAt: string;
1137
- lastModifiedBy?: {
1138
- clientId?: string | undefined;
1139
- externalUserId?: string | undefined;
1140
- customer?: {
1141
- typeId: "customer";
1142
- id: string;
1143
- obj?: /*elided*/any | undefined;
1144
- } | undefined;
1145
- anonymousId?: string | undefined;
1146
- attributedTo?: {
1147
- clientId?: string | undefined;
1148
- source: _commercetools_platform_sdk0.AttributionSource;
1149
- } | undefined;
1150
- associate?: {
1151
- typeId: "customer";
1152
- id: string;
1153
- obj?: /*elided*/any | undefined;
1154
- } | undefined;
1155
- } | undefined;
1156
- createdBy?: {
1157
- clientId?: string | undefined;
1158
- externalUserId?: string | undefined;
1159
- customer?: {
1160
- typeId: "customer";
1161
- id: string;
1162
- obj?: /*elided*/any | undefined;
1163
- } | undefined;
1164
- anonymousId?: string | undefined;
1165
- attributedTo?: {
1166
- clientId?: string | undefined;
1167
- source: _commercetools_platform_sdk0.AttributionSource;
1168
- } | undefined;
1169
- associate?: {
1170
- typeId: "customer";
1171
- id: string;
1172
- obj?: /*elided*/any | undefined;
1173
- } | undefined;
1174
- } | undefined;
1175
- key: string;
1176
- name: {
1177
- [x: string]: string;
1178
- };
1179
- description?: {
1180
- [x: string]: string;
1181
- } | undefined;
1182
- resourceTypeIds: WritableArray<_commercetools_platform_sdk0.ResourceTypeId>;
1183
- fieldDefinitions: WritableArray<_commercetools_platform_sdk0.FieldDefinition>;
1184
- } | undefined;
1185
- };
1186
- fields: {
1187
- [x: string]: any;
1188
- };
1189
- } | undefined;
1190
- locale?: string | undefined;
1191
- salutation?: string | undefined;
1192
- stores: WritableArray<_commercetools_platform_sdk0.StoreKeyReference>;
1193
- authenticationMode: _commercetools_platform_sdk0.AuthenticationMode;
1194
- };
1195
- deleteMe(context: RepositoryContext): Customer | undefined;
1196
- getMe(context: RepositoryContext): Customer | undefined;
1197
- }
1198
- //#endregion
1199
- //#region src/repositories/my-order.d.ts
1200
- declare class MyOrderRepository extends OrderRepository {
1201
- create(context: RepositoryContext, draft: MyOrderFromCartDraft): Order;
1202
- }
1203
- //#endregion
1204
- //#region src/repositories/order-edit.d.ts
1205
- declare class OrderEditRepository extends AbstractResourceRepository<"order-edit"> {
1206
- constructor(config: Config);
1207
- create(context: RepositoryContext, draft: OrderEditDraft): OrderEdit;
1208
- }
1209
- //#endregion
1210
- //#region src/repositories/payment/index.d.ts
1211
- declare class PaymentRepository extends AbstractResourceRepository<"payment"> {
1212
- constructor(config: Config);
1213
- create(context: RepositoryContext, draft: PaymentDraft): Payment;
1214
- }
1215
- //#endregion
1216
- //#region src/lib/review-statistics.d.ts
1217
- declare class ReviewStatisticsService {
1218
- private _storage;
1219
- constructor(_storage: AbstractStorage);
1220
- calculateProductReviewStatistics(projectKey: string, productId: string): ReviewRatingStatistics | undefined;
1221
- }
1222
- //#endregion
1223
- //#region src/product-search.d.ts
1224
- interface ProductSearchVariantAvailability {
1225
- isOnStock: boolean;
1226
- availableQuantity: number;
1227
- isOnStockForChannel: string | undefined;
1228
- }
1229
- declare class ProductSearch {
1230
- protected _storage: AbstractStorage;
1231
- constructor(config: Config);
1232
- search(projectKey: string, params: ProductSearchRequest): ProductPagedSearchResponse;
1233
- transformProduct(product: Product, staged: boolean, availabilityBySku: Map<string, ProductSearchVariantAvailability>): ProductProjection;
1234
- }
1235
- //#endregion
1236
- //#region src/repositories/product/index.d.ts
1237
- declare class ProductRepository extends AbstractResourceRepository<"product"> {
1238
- protected _searchService: ProductSearch;
1239
- protected _reviewStatisticsService: ReviewStatisticsService;
1240
- constructor(config: Config);
1241
- create(context: RepositoryContext, draft: ProductDraft): Product;
1242
- postProcessResource(context: RepositoryContext, resource: Product, params?: GetParams): Product;
1243
- search(context: RepositoryContext, searchRequest: ProductSearchRequest): ProductPagedSearchResponse;
1244
- }
1245
- //#endregion
1246
- //#region src/repositories/product-discount.d.ts
1247
- declare class ProductDiscountRepository extends AbstractResourceRepository<"product-discount"> {
1248
- constructor(config: Config);
1249
- create(context: RepositoryContext, draft: ProductDiscountDraft): ProductDiscount;
1250
- }
1251
- //#endregion
1252
- //#region src/lib/projectionSearchFilter.d.ts
1253
- type RangeExpression = {
1254
- type: "RangeExpression";
1255
- start?: number;
1256
- stop?: number;
1257
- match: (obj: any) => boolean;
1258
- };
1259
- type FilterExpression = {
1260
- type: "FilterExpression";
1261
- match: (obj: any) => boolean;
1262
- };
1263
- //#endregion
1264
- //#region src/product-projection-search.d.ts
1265
- type ProductProjectionSearchParams = {
1266
- fuzzy?: boolean;
1267
- fuzzyLevel?: number;
1268
- markMatchingVariants?: boolean;
1269
- staged?: boolean;
1270
- filter?: string[];
1271
- "filter.facets"?: string[];
1272
- "filter.query"?: string[];
1273
- facet?: string | string[];
1274
- sort?: string | string[];
1275
- limit?: number;
1276
- offset?: number;
1277
- withTotal?: boolean;
1278
- priceCurrency?: string;
1279
- priceCountry?: string;
1280
- priceCustomerGroup?: string;
1281
- priceChannel?: string;
1282
- localeProjection?: string;
1283
- storeProjection?: string;
1284
- expand?: string | string[];
1285
- [key: string]: QueryParam;
1286
- };
1287
- declare class ProductProjectionSearch {
1288
- protected _storage: AbstractStorage;
1289
- protected _reviewStatisticsService: ReviewStatisticsService;
1290
- constructor(config: Config);
1291
- search(projectKey: string, params: ProductProjectionSearchParams): ProductProjectionPagedSearchResponse;
1292
- transform(product: Product, staged: boolean, projectKey: string): ProductProjection;
1293
- getFacets(params: ProductProjectionSearchParams, products: ProductProjection[]): FacetResults;
1294
- /**
1295
- * TODO: This implemention needs the following additional features:
1296
- * - counting products
1297
- * - correct dataType
1298
- */
1299
- termFacet(facet: string, products: ProductProjection[], countProducts: boolean): TermFacetResult;
1300
- filterFacet(source: string, filters: FilterExpression[] | undefined, products: ProductProjection[], countProducts: boolean): FilteredFacetResult;
1301
- rangeFacet(source: string, ranges: RangeExpression[] | undefined, products: ProductProjection[], countProducts: boolean): RangeFacetResult;
1302
- }
1303
- //#endregion
1304
- //#region src/repositories/product-projection.d.ts
1305
- type ProductProjectionQueryParams = {
1306
- staged?: boolean;
1307
- priceCurrency?: string;
1308
- priceCountry?: string;
1309
- priceCustomerGroup?: string;
1310
- priceChannel?: string;
1311
- localeProjection?: string;
1312
- storeProjection?: string;
1313
- expand?: string | string[];
1314
- sort?: string | string[];
1315
- limit?: number;
1316
- offset?: number;
1317
- withTotal?: boolean;
1318
- where?: string | string[];
1319
- [key: string]: QueryParam;
1320
- };
1321
- declare class ProductProjectionRepository extends AbstractResourceRepository<"product-projection"> {
1322
- protected _searchService: ProductProjectionSearch;
1323
- constructor(config: Config);
1324
- create(context: RepositoryContext, draft: ProductDraft): ProductProjection;
1325
- get(context: RepositoryContext, id: string, params?: GetParams): ProductProjection | null;
1326
- query(context: RepositoryContext, params?: ProductProjectionQueryParams): {
1327
- count: number;
1328
- total: number;
1329
- offset: number;
1330
- limit: number;
1331
- results: ProductProjection[];
36
+ //#region src/storage/in-memory.d.ts
37
+ declare class InMemoryStorage extends AbstractStorage {
38
+ protected resources: {
39
+ [projectKey: string]: ProjectStorage;
1332
40
  };
1333
- search(context: RepositoryContext, query: ProductProjectionQueryParams): _commercetools_platform_sdk0.ProductProjectionPagedSearchResponse;
1334
- }
1335
- //#endregion
1336
- //#region src/repositories/product-selection.d.ts
1337
- declare class ProductSelectionRepository extends AbstractResourceRepository<"product-selection"> {
1338
- constructor(config: Config);
1339
- create(context: RepositoryContext, draft: ProductSelectionDraft): ProductSelection;
1340
- }
1341
- //#endregion
1342
- //#region src/repositories/product-type.d.ts
1343
- declare class ProductTypeRepository extends AbstractResourceRepository<"product-type"> {
1344
- constructor(config: Config);
1345
- create(context: RepositoryContext, draft: ProductTypeDraft): ProductType;
1346
- }
1347
- //#endregion
1348
- //#region src/repositories/project.d.ts
1349
- declare class ProjectRepository extends AbstractRepository<Project> {
1350
- constructor(config: Config);
1351
- get(context: RepositoryContext): Project | null;
1352
- postProcessResource(context: RepositoryContext, resource: Project): Project;
1353
- saveNew(context: RepositoryContext, resource: Writable<Project>): void;
1354
- saveUpdate(context: RepositoryContext, version: number, resource: Project): void;
1355
- }
1356
- //#endregion
1357
- //#region src/repositories/quote/index.d.ts
1358
- declare class QuoteRepository extends AbstractResourceRepository<"quote"> {
1359
- constructor(config: Config);
1360
- create(context: RepositoryContext, draft: QuoteDraft): Quote;
1361
- }
1362
- //#endregion
1363
- //#region src/repositories/quote-staged/index.d.ts
1364
- declare class StagedQuoteRepository extends AbstractResourceRepository<"staged-quote"> {
1365
- constructor(config: Config);
1366
- create(context: RepositoryContext, draft: StagedQuoteDraft): StagedQuote;
1367
- }
1368
- //#endregion
1369
- //#region src/repositories/recurrence-policy/index.d.ts
1370
- declare class RecurrencePolicyRepository extends AbstractResourceRepository<"recurrence-policy"> {
1371
- constructor(config: Config);
1372
- create(context: RepositoryContext, draft: RecurrencePolicyDraft): RecurrencePolicy;
1373
- }
1374
- //#endregion
1375
- //#region src/repositories/recurring-order/index.d.ts
1376
- declare class RecurringOrderRepository extends AbstractResourceRepository<"recurring-order"> {
1377
- constructor(config: Config);
1378
- create(context: RepositoryContext, draft: RecurringOrderDraft): RecurringOrder;
1379
- }
1380
- //#endregion
1381
- //#region src/repositories/review.d.ts
1382
- declare class ReviewRepository extends AbstractResourceRepository<"review"> {
1383
- constructor(config: Config);
1384
- create(context: RepositoryContext, draft: ReviewDraft): Review;
1385
- }
1386
- //#endregion
1387
- //#region src/repositories/shipping-method/index.d.ts
1388
- declare class ShippingMethodRepository extends AbstractResourceRepository<"shipping-method"> {
1389
- constructor(config: Config);
1390
- create(context: RepositoryContext, draft: ShippingMethodDraft): ShippingMethod;
1391
- matchingCart(context: RepositoryContext, cartId: string, params?: GetParams): {
1392
- results: {
1393
- zoneRates: {
1394
- zone: ZoneReference;
1395
- shippingRates: _commercetools_platform_sdk0.ShippingRate[];
1396
- }[];
1397
- id: string;
1398
- version: number;
1399
- createdAt: string;
1400
- lastModifiedAt: string;
1401
- lastModifiedBy?: _commercetools_platform_sdk0.LastModifiedBy;
1402
- createdBy?: _commercetools_platform_sdk0.CreatedBy;
1403
- key?: string;
1404
- name: string;
1405
- localizedName?: _commercetools_platform_sdk0.LocalizedString;
1406
- description?: string;
1407
- localizedDescription?: _commercetools_platform_sdk0.LocalizedString;
1408
- taxCategory: _commercetools_platform_sdk0.TaxCategoryReference;
1409
- active: boolean;
1410
- isDefault: boolean;
1411
- predicate?: string;
1412
- custom?: _commercetools_platform_sdk0.CustomFields;
1413
- }[];
1414
- limit?: number;
1415
- count: number;
1416
- total?: number;
1417
- offset?: number;
1418
- } | undefined;
1419
- private _transformZoneRateDraft;
1420
- }
1421
- //#endregion
1422
- //#region src/repositories/standalone-price.d.ts
1423
- declare class StandAlonePriceRepository extends AbstractResourceRepository<"standalone-price"> {
1424
- constructor(config: Config);
1425
- create(context: RepositoryContext, draft: StandalonePriceDraft): StandalonePrice;
1426
- transformChannelReferenceDraft(channel: ChannelResourceIdentifier): ChannelReference;
1427
- }
1428
- //#endregion
1429
- //#region src/repositories/state.d.ts
1430
- declare class StateRepository extends AbstractResourceRepository<"state"> {
1431
- constructor(config: Config);
1432
- create(context: RepositoryContext, draft: StateDraft): State;
1433
- }
1434
- //#endregion
1435
- //#region src/repositories/store.d.ts
1436
- declare class StoreRepository extends AbstractResourceRepository<"store"> {
1437
- constructor(config: Config);
1438
- create(context: RepositoryContext, draft: StoreDraft): Store;
1439
- }
1440
- //#endregion
1441
- //#region src/repositories/subscription.d.ts
1442
- declare class SubscriptionRepository extends AbstractResourceRepository<"subscription"> {
1443
- constructor(config: Config);
1444
- create(context: RepositoryContext, draft: SubscriptionDraft): Subscription;
1445
- }
1446
- //#endregion
1447
- //#region src/repositories/tax-category/index.d.ts
1448
- declare class TaxCategoryRepository extends AbstractResourceRepository<"tax-category"> {
1449
- constructor(config: Config);
1450
- create(context: RepositoryContext, draft: TaxCategoryDraft): TaxCategory;
1451
- }
1452
- //#endregion
1453
- //#region src/repositories/type/index.d.ts
1454
- declare class TypeRepository extends AbstractResourceRepository<"type"> {
1455
- constructor(config: Config);
1456
- create(context: RepositoryContext, draft: TypeDraft): Type;
1457
- }
1458
- //#endregion
1459
- //#region src/repositories/zone.d.ts
1460
- declare class ZoneRepository extends AbstractResourceRepository<"zone"> {
1461
- constructor(config: Config);
1462
- create(context: RepositoryContext, draft: ZoneDraft): Zone;
1463
- }
1464
- //#endregion
1465
- //#region src/repositories/index.d.ts
1466
- type RepositoryMap = ReturnType<typeof createRepositories>;
1467
- declare const createRepositories: (config: Config) => {
1468
- "as-associate": {
1469
- cart: AsAssociateCartRepository;
1470
- order: AsAssociateOrderRepository;
1471
- "quote-request": AsAssociateQuoteRequestRepository;
1472
- "shopping-list": AsAssociateShoppingListRepository;
41
+ protected projects: {
42
+ [projectKey: string]: Project;
1473
43
  };
1474
- "associate-role": AssociateRoleRepository;
1475
- "attribute-group": AttributeGroupRepository;
1476
- "business-unit": BusinessUnitRepository;
1477
- category: CategoryRepository;
1478
- cart: CartRepository;
1479
- "cart-discount": CartDiscountRepository;
1480
- customer: CustomerRepository;
1481
- channel: ChannelRepository;
1482
- "customer-group": CustomerGroupRepository;
1483
- "discount-code": DiscountCodeRepository;
1484
- "discount-group": DiscountGroupRepository;
1485
- extension: ExtensionRepository;
1486
- "inventory-entry": InventoryEntryRepository;
1487
- "key-value-document": CustomObjectRepository;
1488
- order: OrderRepository;
1489
- "order-edit": OrderEditRepository;
1490
- payment: PaymentRepository;
1491
- "my-cart": CartRepository;
1492
- "my-order": MyOrderRepository;
1493
- "my-customer": MyCustomerRepository;
1494
- "my-payment": PaymentRepository;
1495
- "my-shopping-list": ShoppingListRepository;
1496
- product: ProductRepository;
1497
- "product-type": ProductTypeRepository;
1498
- "product-discount": ProductDiscountRepository;
1499
- "product-projection": ProductProjectionRepository;
1500
- "product-selection": ProductSelectionRepository;
1501
- "product-tailoring": ProductTailoringRepository;
1502
- project: ProjectRepository;
1503
- "recurring-order": RecurringOrderRepository;
1504
- "recurrence-policy": RecurrencePolicyRepository;
1505
- review: ReviewRepository;
1506
- quote: QuoteRepository;
1507
- "quote-request": QuoteRequestRepository;
1508
- "shipping-method": ShippingMethodRepository;
1509
- "shopping-list": ShoppingListRepository;
1510
- "staged-quote": StagedQuoteRepository;
1511
- "standalone-price": StandAlonePriceRepository;
1512
- state: StateRepository;
1513
- store: StoreRepository;
1514
- subscription: SubscriptionRepository;
1515
- "tax-category": TaxCategoryRepository;
1516
- type: TypeRepository;
1517
- zone: ZoneRepository;
1518
- };
1519
- //#endregion
1520
- //#region src/types.d.ts
1521
- type Builtin = string | number | boolean | undefined | null | symbol | bigint | Date | RegExp;
1522
- type Writable<T> = T extends Builtin ? T : T extends ReadonlyArray<infer U> ? WritableArray<U> : T extends object ? { -readonly [P in keyof T]: Writable<T[P]> } : T;
1523
- interface WritableArray<T> extends Array<Writable<T>> {}
1524
- type ShallowWritable<T> = { -readonly [P in keyof T]: T[P] };
1525
- type ResourceType = keyof ResourceMap & keyof RepositoryMap;
1526
- type ResourceMap = {
1527
- "attribute-group": _commercetools_platform_sdk0.AttributeGroup;
1528
- "associate-role": _commercetools_platform_sdk0.AssociateRole;
1529
- "business-unit": _commercetools_platform_sdk0.BusinessUnit;
1530
- "cart-discount": _commercetools_platform_sdk0.CartDiscount;
1531
- cart: _commercetools_platform_sdk0.Cart;
1532
- category: _commercetools_platform_sdk0.Category;
1533
- channel: _commercetools_platform_sdk0.Channel;
1534
- "customer-email-token": never;
1535
- "customer-group": _commercetools_platform_sdk0.CustomerGroup;
1536
- "customer-password-token": never;
1537
- customer: _commercetools_platform_sdk0.Customer;
1538
- "discount-code": _commercetools_platform_sdk0.DiscountCode;
1539
- "discount-group": _commercetools_platform_sdk0.DiscountGroup;
1540
- extension: _commercetools_platform_sdk0.Extension;
1541
- "inventory-entry": _commercetools_platform_sdk0.InventoryEntry;
1542
- "key-value-document": _commercetools_platform_sdk0.CustomObject;
1543
- "order-edit": _commercetools_platform_sdk0.OrderEdit;
1544
- order: _commercetools_platform_sdk0.Order;
1545
- payment: _commercetools_platform_sdk0.Payment;
1546
- "product-discount": _commercetools_platform_sdk0.ProductDiscount;
1547
- "product-price": _commercetools_platform_sdk0.StandalonePrice;
1548
- "product-projection": _commercetools_platform_sdk0.ProductProjection;
1549
- "product-selection": _commercetools_platform_sdk0.ProductSelection;
1550
- "product-tailoring": _commercetools_platform_sdk0.ProductTailoring;
1551
- "product-type": _commercetools_platform_sdk0.ProductType;
1552
- product: _commercetools_platform_sdk0.Product;
1553
- "quote-request": _commercetools_platform_sdk0.QuoteRequest;
1554
- quote: _commercetools_platform_sdk0.Quote;
1555
- review: _commercetools_platform_sdk0.Review;
1556
- "shipping-method": _commercetools_platform_sdk0.ShippingMethod;
1557
- "shopping-list": _commercetools_platform_sdk0.ShoppingList;
1558
- "staged-quote": _commercetools_platform_sdk0.StagedQuote;
1559
- "standalone-price": _commercetools_platform_sdk0.StandalonePrice;
1560
- state: _commercetools_platform_sdk0.State;
1561
- store: _commercetools_platform_sdk0.Store;
1562
- subscription: _commercetools_platform_sdk0.Subscription;
1563
- "recurring-order": _commercetools_platform_sdk0.RecurringOrder;
1564
- "recurrence-policy": _commercetools_platform_sdk0.RecurrencePolicy;
1565
- "tax-category": _commercetools_platform_sdk0.TaxCategory;
1566
- type: _commercetools_platform_sdk0.Type;
1567
- zone: _commercetools_platform_sdk0.Zone;
1568
- };
1569
- type PagedQueryResponseMap = {
1570
- "attribute-group": _commercetools_platform_sdk0.AttributeGroupPagedQueryResponse;
1571
- "associate-role": _commercetools_platform_sdk0.AssociateRolePagedQueryResponse;
1572
- "business-unit": _commercetools_platform_sdk0.BusinessUnitPagedQueryResponse;
1573
- "cart-discount": _commercetools_platform_sdk0.CartDiscountPagedQueryResponse;
1574
- cart: _commercetools_platform_sdk0.CartPagedQueryResponse;
1575
- category: _commercetools_platform_sdk0.CategoryPagedQueryResponse;
1576
- channel: _commercetools_platform_sdk0.ChannelPagedQueryResponse;
1577
- "customer-email-token": never;
1578
- "customer-group": _commercetools_platform_sdk0.CustomerGroupPagedQueryResponse;
1579
- "customer-password-token": never;
1580
- customer: _commercetools_platform_sdk0.CustomerPagedQueryResponse;
1581
- "discount-code": _commercetools_platform_sdk0.DiscountCodePagedQueryResponse;
1582
- "discount-group": _commercetools_platform_sdk0.DiscountGroupPagedQueryResponse;
1583
- extension: _commercetools_platform_sdk0.ExtensionPagedQueryResponse;
1584
- "inventory-entry": _commercetools_platform_sdk0.InventoryPagedQueryResponse;
1585
- "key-value-document": _commercetools_platform_sdk0.CustomObjectPagedQueryResponse;
1586
- "order-edit": _commercetools_platform_sdk0.OrderEditPagedQueryResponse;
1587
- order: _commercetools_platform_sdk0.OrderPagedQueryResponse;
1588
- payment: _commercetools_platform_sdk0.PaymentPagedQueryResponse;
1589
- "product-discount": _commercetools_platform_sdk0.ProductDiscountPagedQueryResponse;
1590
- "product-price": _commercetools_platform_sdk0.StandalonePricePagedQueryResponse;
1591
- "product-projection": _commercetools_platform_sdk0.ProductProjectionPagedQueryResponse;
1592
- "product-selection": _commercetools_platform_sdk0.ProductSelectionPagedQueryResponse;
1593
- "product-tailoring": _commercetools_platform_sdk0.ProductTailoringPagedQueryResponse;
1594
- "product-type": _commercetools_platform_sdk0.ProductTypePagedQueryResponse;
1595
- product: _commercetools_platform_sdk0.ProductPagedQueryResponse;
1596
- "quote-request": _commercetools_platform_sdk0.QuoteRequestPagedQueryResponse;
1597
- quote: _commercetools_platform_sdk0.QuotePagedQueryResponse;
1598
- review: _commercetools_platform_sdk0.ReviewPagedQueryResponse;
1599
- "shipping-method": _commercetools_platform_sdk0.ShippingMethodPagedQueryResponse;
1600
- "shopping-list": _commercetools_platform_sdk0.ShoppingListPagedQueryResponse;
1601
- "staged-quote": _commercetools_platform_sdk0.StagedQuotePagedQueryResponse;
1602
- "standalone-price": _commercetools_platform_sdk0.StandalonePricePagedQueryResponse;
1603
- state: _commercetools_platform_sdk0.StatePagedQueryResponse;
1604
- store: _commercetools_platform_sdk0.StorePagedQueryResponse;
1605
- subscription: _commercetools_platform_sdk0.SubscriptionPagedQueryResponse;
1606
- "recurring-order": _commercetools_platform_sdk0.RecurringOrderPagedQueryResponse;
1607
- "recurrence-policy": _commercetools_platform_sdk0.RecurrencePolicyPagedQueryResponse;
1608
- "tax-category": _commercetools_platform_sdk0.TaxCategoryPagedQueryResponse;
1609
- type: _commercetools_platform_sdk0.TypePagedQueryResponse;
1610
- zone: _commercetools_platform_sdk0.ZonePagedQueryResponse;
1611
- };
1612
- //#endregion
1613
- //#region src/storage/abstract.d.ts
1614
- type GetParams$1 = {
1615
- expand?: string[];
1616
- };
1617
- type QueryParams = {
1618
- expand?: string | string[];
1619
- sort?: string | string[];
1620
- limit?: number;
1621
- offset?: number;
1622
- withTotal?: boolean;
1623
- where?: string | string[];
1624
- [key: string]: QueryParam;
1625
- };
1626
- declare abstract class AbstractStorage {
1627
- abstract clear(): void;
1628
- abstract all<RT extends ResourceType>(projectKey: string, typeId: RT): Array<ResourceMap[RT]>;
1629
- abstract add<RT extends ResourceType>(projectKey: string, typeId: RT, obj: ResourceMap[RT]): ResourceMap[RT];
1630
- abstract get<RT extends ResourceType>(projectKey: string, typeId: RT, id: string, params?: GetParams$1): ResourceMap[RT] | null;
1631
- abstract getByKey<RT extends ResourceType>(projectKey: string, typeId: RT, key: string, params: GetParams$1): ResourceMap[RT] | null;
1632
- abstract addProject(projectKey: string): Project;
1633
- abstract getProject(projectKey: string): Project;
1634
- abstract saveProject(project: Project): Project;
1635
- abstract delete<RT extends ResourceType>(projectKey: string, typeId: RT, id: string, params: GetParams$1): ResourceMap[RT] | null;
1636
- abstract query<RT extends ResourceType>(projectKey: string, typeId: RT, params: QueryParams): PagedQueryResponseMap[RT];
1637
- abstract getByResourceIdentifier<RT extends ResourceType>(projectKey: string, identifier: ResourceIdentifier): ResourceMap[RT];
1638
- abstract expand<T>(projectKey: string, obj: T, clause: undefined | string | string[]): T;
44
+ private _customObjectIndex;
45
+ addProject(projectKey: string): Promise<Project>;
46
+ saveProject(project: Project): Promise<Project>;
47
+ getProject(projectKey: string): Promise<Project>;
48
+ private forProjectKey;
49
+ clear(): Promise<void>;
50
+ all<RT extends ResourceType>(projectKey: string, typeId: RT): Promise<ResourceMap[RT][]>;
51
+ count(projectKey: string, typeId: ResourceType): Promise<number>;
52
+ add<RT extends ResourceType>(projectKey: string, typeId: RT, obj: ResourceMap[RT], params?: GetParams): Promise<ResourceMap[RT]>;
53
+ get<RT extends ResourceType>(projectKey: string, typeId: RT, id: string, params?: GetParams): Promise<ResourceMap[RT] | null>;
54
+ getByKey<RT extends ResourceType>(projectKey: string, typeId: RT, key: string, params?: GetParams): Promise<ResourceMap[RT] | null>;
55
+ delete<RT extends ResourceType>(projectKey: string, typeId: RT, id: string, params?: GetParams): Promise<ResourceMap[RT] | null>;
56
+ getByContainerAndKey(projectKey: string, container: string, key: string): Promise<CustomObject | null>;
57
+ query<RT extends ResourceType>(projectKey: string, typeId: RT, params: QueryParams): Promise<PagedQueryResponseMap[RT]>;
1639
58
  }
1640
59
  //#endregion
1641
- //#region src/config.d.ts
1642
- type Config = {
1643
- strict: boolean;
1644
- storage: AbstractStorage;
1645
- };
1646
- //#endregion
1647
60
  //#region src/projectAPI.d.ts
1648
61
  declare class ProjectAPI {
1649
62
  private projectKey;
@@ -1651,9 +64,8 @@ declare class ProjectAPI {
1651
64
  private _repositories;
1652
65
  readonly config: Config;
1653
66
  constructor(projectKey: string, repositories: RepositoryMap, config: Config);
1654
- add<T extends keyof RepositoryMap & keyof ResourceMap>(typeId: T, resource: ResourceMap[T]): void;
1655
- unsafeAdd<T extends keyof RepositoryMap & keyof ResourceMap>(typeId: T, resource: ResourceMap[T]): void;
1656
- get<RT extends ResourceType>(typeId: RT, id: string, params?: GetParams): ResourceMap[RT];
67
+ unsafeAdd<T extends keyof RepositoryMap & keyof ResourceMap>(typeId: T, resource: ResourceMap[T]): Promise<void>;
68
+ get<RT extends ResourceType>(typeId: RT, id: string, params?: GetParams$1): Promise<ResourceMap[RT]>;
1657
69
  getRepository<RT extends keyof RepositoryMap>(typeId: RT): RepositoryMap[RT];
1658
70
  }
1659
71
  //#endregion
@@ -1666,12 +78,11 @@ type CommercetoolsMockOptions = {
1666
78
  authHost: RegExp | string;
1667
79
  silent: boolean;
1668
80
  strict: boolean;
1669
- };
1670
- type AppOptions = {
1671
- silent?: boolean;
81
+ storage: AbstractStorage | undefined;
82
+ logger: FastifyBaseLogger$1 | undefined;
1672
83
  };
1673
84
  declare class CommercetoolsMock {
1674
- app: express.Express;
85
+ app: FastifyInstance;
1675
86
  options: CommercetoolsMockOptions;
1676
87
  private _storage;
1677
88
  private _oauth2;
@@ -1679,26 +90,32 @@ declare class CommercetoolsMock {
1679
90
  private _repositories;
1680
91
  private _projectService;
1681
92
  constructor(options?: Partial<CommercetoolsMockOptions>);
1682
- start(): void;
1683
- stop(): void;
1684
- clear(): void;
93
+ get server(): fastify.RawServerDefault;
94
+ clear(): Promise<void>;
1685
95
  project(projectKey?: string): ProjectAPI;
1686
96
  authStore(): OAuth2Store;
1687
- runServer(port?: number, options?: AppOptions): void;
97
+ runServer(port?: number): Promise<void>;
1688
98
  private createApp;
1689
99
  registerHandlers(server: SetupServerApi): void;
1690
- getHandlers(): msw0.HttpHandler[];
100
+ getHandlers(): msw.HttpHandler[];
1691
101
  mswServer(): SetupServer | undefined;
1692
- private startServer;
1693
102
  }
1694
103
  //#endregion
1695
104
  //#region src/helpers.d.ts
1696
- declare const getBaseResourceProperties: () => {
105
+ declare const getBaseResourceProperties: (clientId?: string) => {
1697
106
  id: string;
1698
107
  createdAt: string;
1699
108
  lastModifiedAt: string;
1700
109
  version: number;
110
+ createdBy: {
111
+ clientId: string;
112
+ isPlatformClient: boolean;
113
+ };
114
+ lastModifiedBy: {
115
+ clientId: string;
116
+ isPlatformClient: boolean;
117
+ };
1701
118
  };
1702
119
  //#endregion
1703
- export { CommercetoolsMock, type CommercetoolsMockOptions, getBaseResourceProperties };
120
+ export { AbstractStorage, CommercetoolsMock, type CommercetoolsMockOptions, type FastifyBaseLogger, InMemoryStorage, getBaseResourceProperties };
1704
121
  //# sourceMappingURL=index.d.mts.map