@labdigital/commercetools-mock 2.45.1 → 2.47.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 (80) hide show
  1. package/dist/index.cjs +614 -250
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +788 -59
  4. package/dist/index.d.ts +788 -59
  5. package/dist/index.js +602 -238
  6. package/dist/index.js.map +1 -1
  7. package/package.json +41 -48
  8. package/src/ctMock.ts +11 -13
  9. package/src/index.test.ts +5 -5
  10. package/src/lib/predicateParser.test.ts +91 -60
  11. package/src/lib/predicateParser.ts +38 -42
  12. package/src/lib/productSearchFilter.test.ts +18 -0
  13. package/src/lib/productSearchFilter.ts +7 -0
  14. package/src/lib/projectionSearchFilter.test.ts +17 -17
  15. package/src/lib/projectionSearchFilter.ts +2 -3
  16. package/src/oauth/server.test.ts +1 -1
  17. package/src/oauth/server.ts +11 -11
  18. package/src/priceSelector.ts +1 -1
  19. package/src/product-projection-search.ts +18 -19
  20. package/src/product-search.ts +48 -8
  21. package/src/repositories/business-unit.ts +17 -16
  22. package/src/repositories/cart/actions.ts +32 -32
  23. package/src/repositories/cart/helpers.ts +1 -1
  24. package/src/repositories/cart/index.ts +25 -8
  25. package/src/repositories/cart-discount/actions.ts +1 -4
  26. package/src/repositories/category/actions.ts +2 -6
  27. package/src/repositories/custom-object.ts +20 -21
  28. package/src/repositories/customer/actions.ts +4 -4
  29. package/src/repositories/errors.ts +1 -1
  30. package/src/repositories/extension.ts +2 -1
  31. package/src/repositories/helpers.ts +27 -27
  32. package/src/repositories/index.ts +17 -17
  33. package/src/repositories/my-customer.ts +1 -1
  34. package/src/repositories/my-order.ts +2 -2
  35. package/src/repositories/order/index.ts +1 -1
  36. package/src/repositories/product/actions.ts +1 -1
  37. package/src/repositories/quote/actions.ts +83 -0
  38. package/src/repositories/quote/index.ts +54 -0
  39. package/src/repositories/quote-request/actions.ts +84 -0
  40. package/src/repositories/quote-request/index.test.ts +167 -0
  41. package/src/repositories/quote-request/index.ts +67 -0
  42. package/src/repositories/quote-staged/actions.ts +84 -0
  43. package/src/repositories/quote-staged/index.ts +47 -0
  44. package/src/repositories/review.ts +4 -4
  45. package/src/repositories/shipping-method/actions.ts +17 -17
  46. package/src/repositories/shipping-method/index.ts +6 -6
  47. package/src/repositories/shopping-list/actions.ts +1 -1
  48. package/src/repositories/shopping-list/index.ts +9 -1
  49. package/src/repositories/subscription.ts +2 -4
  50. package/src/server.ts +3 -2
  51. package/src/services/abstract.ts +7 -7
  52. package/src/services/as-associate-order.test.ts +1 -1
  53. package/src/services/cart-discount.test.ts +1 -1
  54. package/src/services/cart.test.ts +40 -15
  55. package/src/services/category.test.ts +1 -1
  56. package/src/services/customer.test.ts +16 -55
  57. package/src/services/customer.ts +1 -1
  58. package/src/services/index.ts +20 -14
  59. package/src/services/inventory-entry.test.ts +5 -5
  60. package/src/services/my-cart.test.ts +2 -2
  61. package/src/services/my-customer.test.ts +2 -2
  62. package/src/services/order.test.ts +8 -8
  63. package/src/services/product-projection.test.ts +5 -5
  64. package/src/services/product-projection.ts +12 -14
  65. package/src/services/product.test.ts +155 -71
  66. package/src/services/quote-request.test.ts +59 -0
  67. package/src/services/quote-request.ts +16 -0
  68. package/src/services/quote-staged.ts +16 -0
  69. package/src/services/quote.ts +16 -0
  70. package/src/services/standalone-price.test.ts +4 -4
  71. package/src/services/state.test.ts +1 -1
  72. package/src/services/store.test.ts +2 -2
  73. package/src/services/tax-category.test.ts +1 -1
  74. package/src/shipping.ts +3 -3
  75. package/src/storage/in-memory.ts +55 -63
  76. package/src/testing/customer.ts +40 -0
  77. package/src/types.ts +51 -31
  78. package/src/repositories/quote-request.ts +0 -17
  79. package/src/repositories/quote.ts +0 -14
  80. package/src/repositories/staged-quote.ts +0 -17
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as msw from 'msw';
2
2
  import express from 'express';
3
3
  import { SetupServerApi, SetupServer } from 'msw/node';
4
4
  import * as ctp from '@commercetools/platform-sdk';
5
- import { QueryParam, BaseResource, Project, UpdateAction, ProductTailoring, CartDraft, Cart, LineItemDraft, LineItem, OrderFromCartDraft, Order, CartReference, OrderImportDraft, AssociateRoleDraft, AssociateRole, AttributeGroupDraft, AttributeGroup, BusinessUnitDraft, BusinessUnit, CartDiscountDraft, CartDiscount, CategoryDraft, Category, ChannelDraft, Channel, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerCreatePasswordResetToken, CustomerToken, CustomerResetPassword, MyCustomerResetPassword, CustomerGroupDraft, CustomerGroup, DiscountCodeDraft, DiscountCode, ExtensionDraft, Extension, InventoryEntryDraft, InventoryEntry, MyCustomerChangePassword, MyCustomerEmailVerify, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, PaymentDraft, Payment, ProductSearchRequest, ProductPagedSearchResponse, Product, ProductProjection, ProductDraft, ProductDiscountDraft, ProductDiscount, ProductProjectionPagedSearchResponse, 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, ResourceIdentifier } from '@commercetools/platform-sdk';
5
+ import { QueryParam, BaseResource, Project, UpdateAction, ProductTailoring, CartDraft, Cart, LineItemDraft, LineItem, OrderFromCartDraft, Order, CartReference, OrderImportDraft, AssociateRoleDraft, AssociateRole, AttributeGroupDraft, AttributeGroup, BusinessUnitDraft, BusinessUnit, CartDiscountDraft, CartDiscount, CategoryDraft, Category, ChannelDraft, Channel, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerCreatePasswordResetToken, CustomerToken, CustomerResetPassword, MyCustomerResetPassword, Address, StoreKeyReference, CustomerGroupDraft, CustomerGroup, DiscountCodeDraft, DiscountCode, ExtensionDraft, Extension, InventoryEntryDraft, InventoryEntry, MyCustomerChangePassword, MyCustomerEmailVerify, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, PaymentDraft, Payment, ProductSearchRequest, ProductPagedSearchResponse, Product, ProductProjection, ProductDraft, ProductDiscountDraft, ProductDiscount, ProductProjectionPagedSearchResponse, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ProductTypeDraft, ProductType, QuoteDraft, Quote, QuoteRequestDraft, QuoteRequest, StagedQuoteDraft, StagedQuote, ReviewDraft, Review, ShippingMethodDraft, ShippingMethod, ZoneReference, ShoppingListDraft, ShoppingList, ShoppingListLineItem, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, StateDraft, State, StoreDraft, Store, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TypeDraft, Type, ZoneDraft, Zone, ResourceIdentifier } from '@commercetools/platform-sdk';
6
6
 
7
7
  type Token = {
8
8
  access_token: string;
@@ -146,7 +146,247 @@ declare class CustomerRepository extends AbstractResourceRepository<"customer">
146
146
  create(context: RepositoryContext, draft: CustomerDraft): Customer;
147
147
  saveUpdate(context: RepositoryContext, version: number, resource: ShallowWritable<ResourceMap["customer"]>): ShallowWritable<ResourceMap["customer"]>;
148
148
  passwordResetToken(context: RepositoryContext, request: CustomerCreatePasswordResetToken): CustomerToken;
149
- passwordReset(context: RepositoryContext, resetPassword: CustomerResetPassword | MyCustomerResetPassword): Writable<Customer>;
149
+ passwordReset(context: RepositoryContext, resetPassword: CustomerResetPassword | MyCustomerResetPassword): {
150
+ id: string;
151
+ version: number;
152
+ key?: string | undefined;
153
+ customerNumber?: string | undefined;
154
+ externalId?: string | undefined;
155
+ createdAt: string;
156
+ lastModifiedAt: string;
157
+ lastModifiedBy?: {
158
+ clientId?: string | undefined;
159
+ externalUserId?: string | undefined;
160
+ customer?: {
161
+ typeId: "customer";
162
+ id: string;
163
+ obj?: /*elided*/ any | undefined;
164
+ } | undefined;
165
+ anonymousId?: string | undefined;
166
+ attributedTo?: {
167
+ clientId?: string | undefined;
168
+ source: ctp.AttributionSource;
169
+ } | undefined;
170
+ associate?: {
171
+ typeId: "customer";
172
+ id: string;
173
+ obj?: /*elided*/ any | undefined;
174
+ } | undefined;
175
+ } | undefined;
176
+ createdBy?: {
177
+ clientId?: string | undefined;
178
+ externalUserId?: string | undefined;
179
+ customer?: {
180
+ typeId: "customer";
181
+ id: string;
182
+ obj?: /*elided*/ any | undefined;
183
+ } | undefined;
184
+ anonymousId?: string | undefined;
185
+ attributedTo?: {
186
+ clientId?: string | undefined;
187
+ source: ctp.AttributionSource;
188
+ } | undefined;
189
+ associate?: {
190
+ typeId: "customer";
191
+ id: string;
192
+ obj?: /*elided*/ any | undefined;
193
+ } | undefined;
194
+ } | undefined;
195
+ email: string;
196
+ password?: string | undefined;
197
+ firstName?: string | undefined;
198
+ lastName?: string | undefined;
199
+ middleName?: string | undefined;
200
+ title?: string | undefined;
201
+ dateOfBirth?: string | undefined;
202
+ companyName?: string | undefined;
203
+ vatId?: string | undefined;
204
+ addresses: WritableArray<Address>;
205
+ defaultShippingAddressId?: string | undefined;
206
+ shippingAddressIds?: WritableArray<string> | undefined;
207
+ defaultBillingAddressId?: string | undefined;
208
+ billingAddressIds?: WritableArray<string> | undefined;
209
+ isEmailVerified: boolean;
210
+ customerGroup?: {
211
+ typeId: "customer-group";
212
+ id: string;
213
+ obj?: {
214
+ id: string;
215
+ version: number;
216
+ createdAt: string;
217
+ lastModifiedAt: string;
218
+ lastModifiedBy?: {
219
+ clientId?: string | undefined;
220
+ externalUserId?: string | undefined;
221
+ customer?: {
222
+ typeId: "customer";
223
+ id: string;
224
+ obj?: /*elided*/ any | undefined;
225
+ } | undefined;
226
+ anonymousId?: string | undefined;
227
+ attributedTo?: {
228
+ clientId?: string | undefined;
229
+ source: ctp.AttributionSource;
230
+ } | undefined;
231
+ associate?: {
232
+ typeId: "customer";
233
+ id: string;
234
+ obj?: /*elided*/ any | undefined;
235
+ } | undefined;
236
+ } | undefined;
237
+ createdBy?: {
238
+ clientId?: string | undefined;
239
+ externalUserId?: string | undefined;
240
+ customer?: {
241
+ typeId: "customer";
242
+ id: string;
243
+ obj?: /*elided*/ any | undefined;
244
+ } | undefined;
245
+ anonymousId?: string | undefined;
246
+ attributedTo?: {
247
+ clientId?: string | undefined;
248
+ source: ctp.AttributionSource;
249
+ } | undefined;
250
+ associate?: {
251
+ typeId: "customer";
252
+ id: string;
253
+ obj?: /*elided*/ any | undefined;
254
+ } | undefined;
255
+ } | undefined;
256
+ key?: string | undefined;
257
+ name: string;
258
+ custom?: {
259
+ type: {
260
+ typeId: "type";
261
+ id: string;
262
+ obj?: {
263
+ id: string;
264
+ version: number;
265
+ createdAt: string;
266
+ lastModifiedAt: string;
267
+ lastModifiedBy?: {
268
+ clientId?: string | undefined;
269
+ externalUserId?: string | undefined;
270
+ customer?: {
271
+ typeId: "customer";
272
+ id: string;
273
+ obj?: /*elided*/ any | undefined;
274
+ } | undefined;
275
+ anonymousId?: string | undefined;
276
+ attributedTo?: {
277
+ clientId?: string | undefined;
278
+ source: ctp.AttributionSource;
279
+ } | undefined;
280
+ associate?: {
281
+ typeId: "customer";
282
+ id: string;
283
+ obj?: /*elided*/ any | undefined;
284
+ } | undefined;
285
+ } | undefined;
286
+ createdBy?: {
287
+ clientId?: string | undefined;
288
+ externalUserId?: string | undefined;
289
+ customer?: {
290
+ typeId: "customer";
291
+ id: string;
292
+ obj?: /*elided*/ any | undefined;
293
+ } | undefined;
294
+ anonymousId?: string | undefined;
295
+ attributedTo?: {
296
+ clientId?: string | undefined;
297
+ source: ctp.AttributionSource;
298
+ } | undefined;
299
+ associate?: {
300
+ typeId: "customer";
301
+ id: string;
302
+ obj?: /*elided*/ any | undefined;
303
+ } | undefined;
304
+ } | undefined;
305
+ key: string;
306
+ name: {
307
+ [x: string]: string;
308
+ };
309
+ description?: {
310
+ [x: string]: string;
311
+ } | undefined;
312
+ resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
313
+ fieldDefinitions: WritableArray<ctp.FieldDefinition>;
314
+ } | undefined;
315
+ };
316
+ fields: {
317
+ [x: string]: any;
318
+ };
319
+ } | undefined;
320
+ } | undefined;
321
+ } | undefined;
322
+ custom?: {
323
+ type: {
324
+ typeId: "type";
325
+ id: string;
326
+ obj?: {
327
+ id: string;
328
+ version: number;
329
+ createdAt: string;
330
+ lastModifiedAt: string;
331
+ lastModifiedBy?: {
332
+ clientId?: string | undefined;
333
+ externalUserId?: string | undefined;
334
+ customer?: {
335
+ typeId: "customer";
336
+ id: string;
337
+ obj?: /*elided*/ any | undefined;
338
+ } | undefined;
339
+ anonymousId?: string | undefined;
340
+ attributedTo?: {
341
+ clientId?: string | undefined;
342
+ source: ctp.AttributionSource;
343
+ } | undefined;
344
+ associate?: {
345
+ typeId: "customer";
346
+ id: string;
347
+ obj?: /*elided*/ any | undefined;
348
+ } | undefined;
349
+ } | undefined;
350
+ createdBy?: {
351
+ clientId?: string | undefined;
352
+ externalUserId?: string | undefined;
353
+ customer?: {
354
+ typeId: "customer";
355
+ id: string;
356
+ obj?: /*elided*/ any | undefined;
357
+ } | undefined;
358
+ anonymousId?: string | undefined;
359
+ attributedTo?: {
360
+ clientId?: string | undefined;
361
+ source: ctp.AttributionSource;
362
+ } | undefined;
363
+ associate?: {
364
+ typeId: "customer";
365
+ id: string;
366
+ obj?: /*elided*/ any | undefined;
367
+ } | undefined;
368
+ } | undefined;
369
+ key: string;
370
+ name: {
371
+ [x: string]: string;
372
+ };
373
+ description?: {
374
+ [x: string]: string;
375
+ } | undefined;
376
+ resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
377
+ fieldDefinitions: WritableArray<ctp.FieldDefinition>;
378
+ } | undefined;
379
+ };
380
+ fields: {
381
+ [x: string]: any;
382
+ };
383
+ } | undefined;
384
+ locale?: string | undefined;
385
+ salutation?: string | undefined;
386
+ stores: WritableArray<StoreKeyReference>;
387
+ authenticationMode: ctp.AuthenticationMode;
388
+ customerGroupAssignments?: WritableArray<ctp.CustomerGroupAssignment> | undefined;
389
+ };
150
390
  verifyEmailToken(context: RepositoryContext, id: string): CustomerToken;
151
391
  private storeReferenceToStoreKeyReference;
152
392
  }
@@ -173,8 +413,488 @@ declare class InventoryEntryRepository extends AbstractResourceRepository<"inven
173
413
  }
174
414
 
175
415
  declare class MyCustomerRepository extends CustomerRepository {
176
- changePassword(context: RepositoryContext, changePassword: MyCustomerChangePassword): Writable<Customer>;
177
- confirmEmail(context: RepositoryContext, resetPassword: MyCustomerEmailVerify): Writable<Customer>;
416
+ changePassword(context: RepositoryContext, changePassword: MyCustomerChangePassword): {
417
+ id: string;
418
+ version: number;
419
+ key?: string | undefined;
420
+ customerNumber?: string | undefined;
421
+ externalId?: string | undefined;
422
+ createdAt: string;
423
+ lastModifiedAt: string;
424
+ lastModifiedBy?: {
425
+ clientId?: string | undefined;
426
+ externalUserId?: string | undefined;
427
+ customer?: {
428
+ typeId: "customer";
429
+ id: string;
430
+ obj?: /*elided*/ any | undefined;
431
+ } | undefined;
432
+ anonymousId?: string | undefined;
433
+ attributedTo?: {
434
+ clientId?: string | undefined;
435
+ source: ctp.AttributionSource;
436
+ } | undefined;
437
+ associate?: {
438
+ typeId: "customer";
439
+ id: string;
440
+ obj?: /*elided*/ any | undefined;
441
+ } | undefined;
442
+ } | undefined;
443
+ createdBy?: {
444
+ clientId?: string | undefined;
445
+ externalUserId?: string | undefined;
446
+ customer?: {
447
+ typeId: "customer";
448
+ id: string;
449
+ obj?: /*elided*/ any | undefined;
450
+ } | undefined;
451
+ anonymousId?: string | undefined;
452
+ attributedTo?: {
453
+ clientId?: string | undefined;
454
+ source: ctp.AttributionSource;
455
+ } | undefined;
456
+ associate?: {
457
+ typeId: "customer";
458
+ id: string;
459
+ obj?: /*elided*/ any | undefined;
460
+ } | undefined;
461
+ } | undefined;
462
+ email: string;
463
+ password?: string | undefined;
464
+ firstName?: string | undefined;
465
+ lastName?: string | undefined;
466
+ middleName?: string | undefined;
467
+ title?: string | undefined;
468
+ dateOfBirth?: string | undefined;
469
+ companyName?: string | undefined;
470
+ vatId?: string | undefined;
471
+ addresses: WritableArray<ctp.Address>;
472
+ defaultShippingAddressId?: string | undefined;
473
+ shippingAddressIds?: WritableArray<string> | undefined;
474
+ defaultBillingAddressId?: string | undefined;
475
+ billingAddressIds?: WritableArray<string> | undefined;
476
+ isEmailVerified: boolean;
477
+ customerGroup?: {
478
+ typeId: "customer-group";
479
+ id: string;
480
+ obj?: {
481
+ id: string;
482
+ version: number;
483
+ createdAt: string;
484
+ lastModifiedAt: string;
485
+ lastModifiedBy?: {
486
+ clientId?: string | undefined;
487
+ externalUserId?: string | undefined;
488
+ customer?: {
489
+ typeId: "customer";
490
+ id: string;
491
+ obj?: /*elided*/ any | undefined;
492
+ } | undefined;
493
+ anonymousId?: string | undefined;
494
+ attributedTo?: {
495
+ clientId?: string | undefined;
496
+ source: ctp.AttributionSource;
497
+ } | undefined;
498
+ associate?: {
499
+ typeId: "customer";
500
+ id: string;
501
+ obj?: /*elided*/ any | undefined;
502
+ } | undefined;
503
+ } | undefined;
504
+ createdBy?: {
505
+ clientId?: string | undefined;
506
+ externalUserId?: string | undefined;
507
+ customer?: {
508
+ typeId: "customer";
509
+ id: string;
510
+ obj?: /*elided*/ any | undefined;
511
+ } | undefined;
512
+ anonymousId?: string | undefined;
513
+ attributedTo?: {
514
+ clientId?: string | undefined;
515
+ source: ctp.AttributionSource;
516
+ } | undefined;
517
+ associate?: {
518
+ typeId: "customer";
519
+ id: string;
520
+ obj?: /*elided*/ any | undefined;
521
+ } | undefined;
522
+ } | undefined;
523
+ key?: string | undefined;
524
+ name: string;
525
+ custom?: {
526
+ type: {
527
+ typeId: "type";
528
+ id: string;
529
+ obj?: {
530
+ id: string;
531
+ version: number;
532
+ createdAt: string;
533
+ lastModifiedAt: string;
534
+ lastModifiedBy?: {
535
+ clientId?: string | undefined;
536
+ externalUserId?: string | undefined;
537
+ customer?: {
538
+ typeId: "customer";
539
+ id: string;
540
+ obj?: /*elided*/ any | undefined;
541
+ } | undefined;
542
+ anonymousId?: string | undefined;
543
+ attributedTo?: {
544
+ clientId?: string | undefined;
545
+ source: ctp.AttributionSource;
546
+ } | undefined;
547
+ associate?: {
548
+ typeId: "customer";
549
+ id: string;
550
+ obj?: /*elided*/ any | undefined;
551
+ } | undefined;
552
+ } | undefined;
553
+ createdBy?: {
554
+ clientId?: string | undefined;
555
+ externalUserId?: string | undefined;
556
+ customer?: {
557
+ typeId: "customer";
558
+ id: string;
559
+ obj?: /*elided*/ any | undefined;
560
+ } | undefined;
561
+ anonymousId?: string | undefined;
562
+ attributedTo?: {
563
+ clientId?: string | undefined;
564
+ source: ctp.AttributionSource;
565
+ } | undefined;
566
+ associate?: {
567
+ typeId: "customer";
568
+ id: string;
569
+ obj?: /*elided*/ any | undefined;
570
+ } | undefined;
571
+ } | undefined;
572
+ key: string;
573
+ name: {
574
+ [x: string]: string;
575
+ };
576
+ description?: {
577
+ [x: string]: string;
578
+ } | undefined;
579
+ resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
580
+ fieldDefinitions: WritableArray<ctp.FieldDefinition>;
581
+ } | undefined;
582
+ };
583
+ fields: {
584
+ [x: string]: any;
585
+ };
586
+ } | undefined;
587
+ } | undefined;
588
+ } | undefined;
589
+ custom?: {
590
+ type: {
591
+ typeId: "type";
592
+ id: string;
593
+ obj?: {
594
+ id: string;
595
+ version: number;
596
+ createdAt: string;
597
+ lastModifiedAt: string;
598
+ lastModifiedBy?: {
599
+ clientId?: string | undefined;
600
+ externalUserId?: string | undefined;
601
+ customer?: {
602
+ typeId: "customer";
603
+ id: string;
604
+ obj?: /*elided*/ any | undefined;
605
+ } | undefined;
606
+ anonymousId?: string | undefined;
607
+ attributedTo?: {
608
+ clientId?: string | undefined;
609
+ source: ctp.AttributionSource;
610
+ } | undefined;
611
+ associate?: {
612
+ typeId: "customer";
613
+ id: string;
614
+ obj?: /*elided*/ any | undefined;
615
+ } | undefined;
616
+ } | undefined;
617
+ createdBy?: {
618
+ clientId?: string | undefined;
619
+ externalUserId?: string | undefined;
620
+ customer?: {
621
+ typeId: "customer";
622
+ id: string;
623
+ obj?: /*elided*/ any | undefined;
624
+ } | undefined;
625
+ anonymousId?: string | undefined;
626
+ attributedTo?: {
627
+ clientId?: string | undefined;
628
+ source: ctp.AttributionSource;
629
+ } | undefined;
630
+ associate?: {
631
+ typeId: "customer";
632
+ id: string;
633
+ obj?: /*elided*/ any | undefined;
634
+ } | undefined;
635
+ } | undefined;
636
+ key: string;
637
+ name: {
638
+ [x: string]: string;
639
+ };
640
+ description?: {
641
+ [x: string]: string;
642
+ } | undefined;
643
+ resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
644
+ fieldDefinitions: WritableArray<ctp.FieldDefinition>;
645
+ } | undefined;
646
+ };
647
+ fields: {
648
+ [x: string]: any;
649
+ };
650
+ } | undefined;
651
+ locale?: string | undefined;
652
+ salutation?: string | undefined;
653
+ stores: WritableArray<ctp.StoreKeyReference>;
654
+ authenticationMode: ctp.AuthenticationMode;
655
+ customerGroupAssignments?: WritableArray<ctp.CustomerGroupAssignment> | undefined;
656
+ };
657
+ confirmEmail(context: RepositoryContext, resetPassword: MyCustomerEmailVerify): {
658
+ id: string;
659
+ version: number;
660
+ key?: string | undefined;
661
+ customerNumber?: string | undefined;
662
+ externalId?: string | undefined;
663
+ createdAt: string;
664
+ lastModifiedAt: string;
665
+ lastModifiedBy?: {
666
+ clientId?: string | undefined;
667
+ externalUserId?: string | undefined;
668
+ customer?: {
669
+ typeId: "customer";
670
+ id: string;
671
+ obj?: /*elided*/ any | undefined;
672
+ } | undefined;
673
+ anonymousId?: string | undefined;
674
+ attributedTo?: {
675
+ clientId?: string | undefined;
676
+ source: ctp.AttributionSource;
677
+ } | undefined;
678
+ associate?: {
679
+ typeId: "customer";
680
+ id: string;
681
+ obj?: /*elided*/ any | undefined;
682
+ } | undefined;
683
+ } | undefined;
684
+ createdBy?: {
685
+ clientId?: string | undefined;
686
+ externalUserId?: string | undefined;
687
+ customer?: {
688
+ typeId: "customer";
689
+ id: string;
690
+ obj?: /*elided*/ any | undefined;
691
+ } | undefined;
692
+ anonymousId?: string | undefined;
693
+ attributedTo?: {
694
+ clientId?: string | undefined;
695
+ source: ctp.AttributionSource;
696
+ } | undefined;
697
+ associate?: {
698
+ typeId: "customer";
699
+ id: string;
700
+ obj?: /*elided*/ any | undefined;
701
+ } | undefined;
702
+ } | undefined;
703
+ email: string;
704
+ password?: string | undefined;
705
+ firstName?: string | undefined;
706
+ lastName?: string | undefined;
707
+ middleName?: string | undefined;
708
+ title?: string | undefined;
709
+ dateOfBirth?: string | undefined;
710
+ companyName?: string | undefined;
711
+ vatId?: string | undefined;
712
+ addresses: WritableArray<ctp.Address>;
713
+ defaultShippingAddressId?: string | undefined;
714
+ shippingAddressIds?: WritableArray<string> | undefined;
715
+ defaultBillingAddressId?: string | undefined;
716
+ billingAddressIds?: WritableArray<string> | undefined;
717
+ isEmailVerified: boolean;
718
+ customerGroup?: {
719
+ typeId: "customer-group";
720
+ id: string;
721
+ obj?: {
722
+ id: string;
723
+ version: number;
724
+ createdAt: string;
725
+ lastModifiedAt: string;
726
+ lastModifiedBy?: {
727
+ clientId?: string | undefined;
728
+ externalUserId?: string | undefined;
729
+ customer?: {
730
+ typeId: "customer";
731
+ id: string;
732
+ obj?: /*elided*/ any | undefined;
733
+ } | undefined;
734
+ anonymousId?: string | undefined;
735
+ attributedTo?: {
736
+ clientId?: string | undefined;
737
+ source: ctp.AttributionSource;
738
+ } | undefined;
739
+ associate?: {
740
+ typeId: "customer";
741
+ id: string;
742
+ obj?: /*elided*/ any | undefined;
743
+ } | undefined;
744
+ } | undefined;
745
+ createdBy?: {
746
+ clientId?: string | undefined;
747
+ externalUserId?: string | undefined;
748
+ customer?: {
749
+ typeId: "customer";
750
+ id: string;
751
+ obj?: /*elided*/ any | undefined;
752
+ } | undefined;
753
+ anonymousId?: string | undefined;
754
+ attributedTo?: {
755
+ clientId?: string | undefined;
756
+ source: ctp.AttributionSource;
757
+ } | undefined;
758
+ associate?: {
759
+ typeId: "customer";
760
+ id: string;
761
+ obj?: /*elided*/ any | undefined;
762
+ } | undefined;
763
+ } | undefined;
764
+ key?: string | undefined;
765
+ name: string;
766
+ custom?: {
767
+ type: {
768
+ typeId: "type";
769
+ id: string;
770
+ obj?: {
771
+ id: string;
772
+ version: number;
773
+ createdAt: string;
774
+ lastModifiedAt: string;
775
+ lastModifiedBy?: {
776
+ clientId?: string | undefined;
777
+ externalUserId?: string | undefined;
778
+ customer?: {
779
+ typeId: "customer";
780
+ id: string;
781
+ obj?: /*elided*/ any | undefined;
782
+ } | undefined;
783
+ anonymousId?: string | undefined;
784
+ attributedTo?: {
785
+ clientId?: string | undefined;
786
+ source: ctp.AttributionSource;
787
+ } | undefined;
788
+ associate?: {
789
+ typeId: "customer";
790
+ id: string;
791
+ obj?: /*elided*/ any | undefined;
792
+ } | undefined;
793
+ } | undefined;
794
+ createdBy?: {
795
+ clientId?: string | undefined;
796
+ externalUserId?: string | undefined;
797
+ customer?: {
798
+ typeId: "customer";
799
+ id: string;
800
+ obj?: /*elided*/ any | undefined;
801
+ } | undefined;
802
+ anonymousId?: string | undefined;
803
+ attributedTo?: {
804
+ clientId?: string | undefined;
805
+ source: ctp.AttributionSource;
806
+ } | undefined;
807
+ associate?: {
808
+ typeId: "customer";
809
+ id: string;
810
+ obj?: /*elided*/ any | undefined;
811
+ } | undefined;
812
+ } | undefined;
813
+ key: string;
814
+ name: {
815
+ [x: string]: string;
816
+ };
817
+ description?: {
818
+ [x: string]: string;
819
+ } | undefined;
820
+ resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
821
+ fieldDefinitions: WritableArray<ctp.FieldDefinition>;
822
+ } | undefined;
823
+ };
824
+ fields: {
825
+ [x: string]: any;
826
+ };
827
+ } | undefined;
828
+ } | undefined;
829
+ } | undefined;
830
+ custom?: {
831
+ type: {
832
+ typeId: "type";
833
+ id: string;
834
+ obj?: {
835
+ id: string;
836
+ version: number;
837
+ createdAt: string;
838
+ lastModifiedAt: string;
839
+ lastModifiedBy?: {
840
+ clientId?: string | undefined;
841
+ externalUserId?: string | undefined;
842
+ customer?: {
843
+ typeId: "customer";
844
+ id: string;
845
+ obj?: /*elided*/ any | undefined;
846
+ } | undefined;
847
+ anonymousId?: string | undefined;
848
+ attributedTo?: {
849
+ clientId?: string | undefined;
850
+ source: ctp.AttributionSource;
851
+ } | undefined;
852
+ associate?: {
853
+ typeId: "customer";
854
+ id: string;
855
+ obj?: /*elided*/ any | undefined;
856
+ } | undefined;
857
+ } | undefined;
858
+ createdBy?: {
859
+ clientId?: string | undefined;
860
+ externalUserId?: string | undefined;
861
+ customer?: {
862
+ typeId: "customer";
863
+ id: string;
864
+ obj?: /*elided*/ any | undefined;
865
+ } | undefined;
866
+ anonymousId?: string | undefined;
867
+ attributedTo?: {
868
+ clientId?: string | undefined;
869
+ source: ctp.AttributionSource;
870
+ } | undefined;
871
+ associate?: {
872
+ typeId: "customer";
873
+ id: string;
874
+ obj?: /*elided*/ any | undefined;
875
+ } | undefined;
876
+ } | undefined;
877
+ key: string;
878
+ name: {
879
+ [x: string]: string;
880
+ };
881
+ description?: {
882
+ [x: string]: string;
883
+ } | undefined;
884
+ resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
885
+ fieldDefinitions: WritableArray<ctp.FieldDefinition>;
886
+ } | undefined;
887
+ };
888
+ fields: {
889
+ [x: string]: any;
890
+ };
891
+ } | undefined;
892
+ locale?: string | undefined;
893
+ salutation?: string | undefined;
894
+ stores: WritableArray<ctp.StoreKeyReference>;
895
+ authenticationMode: ctp.AuthenticationMode;
896
+ customerGroupAssignments?: WritableArray<ctp.CustomerGroupAssignment> | undefined;
897
+ };
178
898
  deleteMe(context: RepositoryContext): Customer | undefined;
179
899
  getMe(context: RepositoryContext): Customer | undefined;
180
900
  }
@@ -193,11 +913,16 @@ declare class PaymentRepository extends AbstractResourceRepository<"payment"> {
193
913
  create(context: RepositoryContext, draft: PaymentDraft): Payment;
194
914
  }
195
915
 
916
+ interface ProductSearchVariantAvailability {
917
+ isOnStock: boolean;
918
+ availableQuantity: number;
919
+ isOnStockForChannel: string | undefined;
920
+ }
196
921
  declare class ProductSearch {
197
922
  protected _storage: AbstractStorage;
198
923
  constructor(config: Config);
199
924
  search(projectKey: string, params: ProductSearchRequest): ProductPagedSearchResponse;
200
- transform(product: Product, staged: boolean): ProductProjection;
925
+ transformProduct(product: Product, staged: boolean, availabilityBySku: Map<string, ProductSearchVariantAvailability>): ProductProjection;
201
926
  }
202
927
 
203
928
  declare class ProductRepository extends AbstractResourceRepository<"product"> {
@@ -228,25 +953,25 @@ type FilterExpression = {
228
953
  };
229
954
 
230
955
  type ProductProjectionSearchParams = {
231
- "fuzzy"?: boolean;
232
- "fuzzyLevel"?: number;
233
- "markMatchingVariants"?: boolean;
234
- "staged"?: boolean;
235
- "filter"?: string[];
956
+ fuzzy?: boolean;
957
+ fuzzyLevel?: number;
958
+ markMatchingVariants?: boolean;
959
+ staged?: boolean;
960
+ filter?: string[];
236
961
  "filter.facets"?: string[];
237
962
  "filter.query"?: string[];
238
- "facet"?: string | string[];
239
- "sort"?: string | string[];
240
- "limit"?: number;
241
- "offset"?: number;
242
- "withTotal"?: boolean;
243
- "priceCurrency"?: string;
244
- "priceCountry"?: string;
245
- "priceCustomerGroup"?: string;
246
- "priceChannel"?: string;
247
- "localeProjection"?: string;
248
- "storeProjection"?: string;
249
- "expand"?: string | string[];
963
+ facet?: string | string[];
964
+ sort?: string | string[];
965
+ limit?: number;
966
+ offset?: number;
967
+ withTotal?: boolean;
968
+ priceCurrency?: string;
969
+ priceCountry?: string;
970
+ priceCustomerGroup?: string;
971
+ priceChannel?: string;
972
+ localeProjection?: string;
973
+ storeProjection?: string;
974
+ expand?: string | string[];
250
975
  [key: string]: QueryParam;
251
976
  };
252
977
  declare class ProductProjectionSearch {
@@ -322,6 +1047,12 @@ declare class QuoteRepository extends AbstractResourceRepository<"quote"> {
322
1047
  declare class QuoteRequestRepository extends AbstractResourceRepository<"quote-request"> {
323
1048
  constructor(config: Config);
324
1049
  create(context: RepositoryContext, draft: QuoteRequestDraft): QuoteRequest;
1050
+ createFromCart(context: RepositoryContext, cartReference: CartReference): QuoteRequest;
1051
+ }
1052
+
1053
+ declare class StagedQuoteRepository extends AbstractResourceRepository<"staged-quote"> {
1054
+ constructor(config: Config);
1055
+ create(context: RepositoryContext, draft: StagedQuoteDraft): StagedQuote;
325
1056
  }
326
1057
 
327
1058
  declare class ReviewRepository extends AbstractResourceRepository<"review"> {
@@ -369,11 +1100,6 @@ declare class ShoppingListRepository extends AbstractResourceRepository<"shoppin
369
1100
  draftLineItemtoLineItem: (projectKey: string, draftLineItem: LineItemDraft) => ShoppingListLineItem;
370
1101
  }
371
1102
 
372
- declare class StagedQuoteRepository extends AbstractResourceRepository<"staged-quote"> {
373
- constructor(config: Config);
374
- create(context: RepositoryContext, draft: StagedQuoteDraft): StagedQuote;
375
- }
376
-
377
1103
  declare class StandAlonePriceRepository extends AbstractResourceRepository<"standalone-price"> {
378
1104
  constructor(config: Config);
379
1105
  create(context: RepositoryContext, draft: StandalonePriceDraft): StandalonePrice;
@@ -459,9 +1185,12 @@ declare const createRepositories: (config: Config) => {
459
1185
  zone: ZoneRepository;
460
1186
  };
461
1187
 
462
- type Writable<T> = {
1188
+ type Builtin = string | number | boolean | undefined | null | symbol | bigint | Date | RegExp;
1189
+ type Writable<T> = T extends Builtin ? T : T extends ReadonlyArray<infer U> ? WritableArray<U> : T extends object ? {
463
1190
  -readonly [P in keyof T]: Writable<T[P]>;
464
- };
1191
+ } : T;
1192
+ interface WritableArray<T> extends Array<Writable<T>> {
1193
+ }
465
1194
  type ShallowWritable<T> = {
466
1195
  -readonly [P in keyof T]: T[P];
467
1196
  };
@@ -471,80 +1200,80 @@ type ResourceMap = {
471
1200
  "associate-role": ctp.AssociateRole;
472
1201
  "business-unit": ctp.BusinessUnit;
473
1202
  "cart-discount": ctp.CartDiscount;
474
- "cart": ctp.Cart;
475
- "category": ctp.Category;
476
- "channel": ctp.Channel;
1203
+ cart: ctp.Cart;
1204
+ category: ctp.Category;
1205
+ channel: ctp.Channel;
477
1206
  "customer-email-token": never;
478
1207
  "customer-group": ctp.CustomerGroup;
479
1208
  "customer-password-token": never;
480
- "customer": ctp.Customer;
1209
+ customer: ctp.Customer;
481
1210
  "discount-code": ctp.DiscountCode;
482
- "extension": ctp.Extension;
1211
+ extension: ctp.Extension;
483
1212
  "inventory-entry": ctp.InventoryEntry;
484
1213
  "key-value-document": ctp.CustomObject;
485
1214
  "order-edit": ctp.OrderEdit;
486
- "order": ctp.Order;
487
- "payment": ctp.Payment;
1215
+ order: ctp.Order;
1216
+ payment: ctp.Payment;
488
1217
  "product-discount": ctp.ProductDiscount;
489
1218
  "product-price": ctp.StandalonePrice;
490
1219
  "product-projection": ctp.ProductProjection;
491
1220
  "product-selection": ctp.ProductSelection;
492
1221
  "product-tailoring": ctp.ProductTailoring;
493
1222
  "product-type": ctp.ProductType;
494
- "product": ctp.Product;
1223
+ product: ctp.Product;
495
1224
  "quote-request": ctp.QuoteRequest;
496
- "quote": ctp.Quote;
497
- "review": ctp.Review;
1225
+ quote: ctp.Quote;
1226
+ review: ctp.Review;
498
1227
  "shipping-method": ctp.ShippingMethod;
499
1228
  "shopping-list": ctp.ShoppingList;
500
1229
  "staged-quote": ctp.StagedQuote;
501
1230
  "standalone-price": ctp.StandalonePrice;
502
- "state": ctp.State;
503
- "store": ctp.Store;
504
- "subscription": ctp.Subscription;
1231
+ state: ctp.State;
1232
+ store: ctp.Store;
1233
+ subscription: ctp.Subscription;
505
1234
  "tax-category": ctp.TaxCategory;
506
- "type": ctp.Type;
507
- "zone": ctp.Zone;
1235
+ type: ctp.Type;
1236
+ zone: ctp.Zone;
508
1237
  };
509
1238
  type PagedQueryResponseMap = {
510
1239
  "attribute-group": ctp.AttributeGroupPagedQueryResponse;
511
1240
  "associate-role": ctp.AssociateRolePagedQueryResponse;
512
1241
  "business-unit": ctp.BusinessUnitPagedQueryResponse;
513
1242
  "cart-discount": ctp.CartDiscountPagedQueryResponse;
514
- "cart": ctp.CartPagedQueryResponse;
515
- "category": ctp.CategoryPagedQueryResponse;
516
- "channel": ctp.ChannelPagedQueryResponse;
1243
+ cart: ctp.CartPagedQueryResponse;
1244
+ category: ctp.CategoryPagedQueryResponse;
1245
+ channel: ctp.ChannelPagedQueryResponse;
517
1246
  "customer-email-token": never;
518
1247
  "customer-group": ctp.CustomerGroupPagedQueryResponse;
519
1248
  "customer-password-token": never;
520
- "customer": ctp.CustomerPagedQueryResponse;
1249
+ customer: ctp.CustomerPagedQueryResponse;
521
1250
  "discount-code": ctp.DiscountCodePagedQueryResponse;
522
- "extension": ctp.ExtensionPagedQueryResponse;
1251
+ extension: ctp.ExtensionPagedQueryResponse;
523
1252
  "inventory-entry": ctp.InventoryPagedQueryResponse;
524
1253
  "key-value-document": ctp.CustomObjectPagedQueryResponse;
525
1254
  "order-edit": ctp.OrderEditPagedQueryResponse;
526
- "order": ctp.OrderPagedQueryResponse;
527
- "payment": ctp.PaymentPagedQueryResponse;
1255
+ order: ctp.OrderPagedQueryResponse;
1256
+ payment: ctp.PaymentPagedQueryResponse;
528
1257
  "product-discount": ctp.ProductDiscountPagedQueryResponse;
529
1258
  "product-price": ctp.StandalonePricePagedQueryResponse;
530
1259
  "product-projection": ctp.ProductProjectionPagedQueryResponse;
531
1260
  "product-selection": ctp.ProductSelectionPagedQueryResponse;
532
1261
  "product-tailoring": ctp.ProductTailoringPagedQueryResponse;
533
1262
  "product-type": ctp.ProductTypePagedQueryResponse;
534
- "product": ctp.ProductPagedQueryResponse;
1263
+ product: ctp.ProductPagedQueryResponse;
535
1264
  "quote-request": ctp.QuoteRequestPagedQueryResponse;
536
- "quote": ctp.QuotePagedQueryResponse;
537
- "review": ctp.ReviewPagedQueryResponse;
1265
+ quote: ctp.QuotePagedQueryResponse;
1266
+ review: ctp.ReviewPagedQueryResponse;
538
1267
  "shipping-method": ctp.ShippingMethodPagedQueryResponse;
539
1268
  "shopping-list": ctp.ShoppingListPagedQueryResponse;
540
1269
  "staged-quote": ctp.StagedQuotePagedQueryResponse;
541
1270
  "standalone-price": ctp.StandalonePricePagedQueryResponse;
542
- "state": ctp.StatePagedQueryResponse;
543
- "store": ctp.StorePagedQueryResponse;
544
- "subscription": ctp.SubscriptionPagedQueryResponse;
1271
+ state: ctp.StatePagedQueryResponse;
1272
+ store: ctp.StorePagedQueryResponse;
1273
+ subscription: ctp.SubscriptionPagedQueryResponse;
545
1274
  "tax-category": ctp.TaxCategoryPagedQueryResponse;
546
- "type": ctp.TypePagedQueryResponse;
547
- "zone": ctp.ZonePagedQueryResponse;
1275
+ type: ctp.TypePagedQueryResponse;
1276
+ zone: ctp.ZonePagedQueryResponse;
548
1277
  };
549
1278
 
550
1279
  type GetParams = {