@labdigital/commercetools-mock 2.49.1 → 2.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts DELETED
@@ -1,1367 +0,0 @@
1
- import * as msw from 'msw';
2
- import express from 'express';
3
- import { SetupServerApi, SetupServer } from 'msw/node';
4
- import * as ctp from '@commercetools/platform-sdk';
5
- import { BaseResource, Project, UpdateAction, QueryParam, ProductTailoring, CartDraft, Cart, LineItemDraft, LineItem, OrderFromCartDraft, Order, CartReference, OrderImportDraft, QuoteRequestDraft, MyQuoteRequestDraft, QuoteRequest, 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, 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
-
7
- type Token = {
8
- access_token: string;
9
- token_type: "Bearer";
10
- expires_in: number;
11
- scope: string;
12
- refresh_token?: string;
13
- };
14
- declare class OAuth2Store {
15
- tokens: Token[];
16
- validate: boolean;
17
- constructor(validate?: boolean);
18
- addToken(token: Token): void;
19
- getClientToken(clientId: string, clientSecret: string, scope?: string): Token;
20
- getAnonymousToken(projectKey: string, anonymousId: string | undefined, scope: string): Token;
21
- getCustomerToken(projectKey: string, customerId: string, scope: string): Token;
22
- refreshToken(clientId: string, clientSecret: string, refreshToken: string): {
23
- access_token: string;
24
- token_type: "Bearer";
25
- expires_in: number;
26
- scope: string;
27
- } | undefined;
28
- validateToken(token: string): boolean;
29
- }
30
-
31
- type QueryParams$1 = {
32
- expand?: string[];
33
- where?: string[];
34
- offset?: number;
35
- limit?: number;
36
- [key: string]: QueryParam;
37
- };
38
- type GetParams$1 = {
39
- expand?: string[];
40
- };
41
- type RepositoryContext = {
42
- projectKey: string;
43
- storeKey?: string;
44
- };
45
- declare abstract class AbstractRepository<R extends BaseResource | Project> {
46
- protected _storage: AbstractStorage;
47
- protected config: Config;
48
- protected actions: AbstractUpdateHandler | undefined;
49
- constructor(config: Config);
50
- abstract saveNew({ projectKey }: RepositoryContext, resource: R): void;
51
- abstract saveUpdate({ projectKey }: RepositoryContext, version: number, resource: R): void;
52
- abstract postProcessResource(context: RepositoryContext, resource: any): any;
53
- processUpdateActions(context: RepositoryContext, resource: R, version: number, actions: UpdateAction[]): R;
54
- }
55
- declare abstract class AbstractResourceRepository<T extends ResourceType> extends AbstractRepository<ResourceMap[T]> {
56
- protected _typeId: T;
57
- constructor(typeId: T, config: Config);
58
- abstract create(context: RepositoryContext, draft: any): ResourceMap[T];
59
- protected getTypeId(): T;
60
- delete(context: RepositoryContext, id: string, params?: GetParams$1): ResourceMap[T] | null;
61
- get(context: RepositoryContext, id: string, params?: GetParams$1): ResourceMap[T] | null;
62
- getByKey(context: RepositoryContext, key: string, params?: GetParams$1): ResourceMap[T] | null;
63
- postProcessResource(context: RepositoryContext, resource: ResourceMap[T], params?: GetParams$1): ResourceMap[T];
64
- query(context: RepositoryContext, params?: QueryParams$1): PagedQueryResponseMap[T] & {
65
- results: ResourceMap[T][];
66
- };
67
- saveNew(context: RepositoryContext, resource: ShallowWritable<ResourceMap[T]>): ResourceMap[T];
68
- saveUpdate(context: RepositoryContext, version: number, resource: ShallowWritable<ResourceMap[T]>): ShallowWritable<ResourceMap[T]>;
69
- }
70
- declare class AbstractUpdateHandler {
71
- protected _storage: AbstractStorage;
72
- constructor(_storage: AbstractStorage);
73
- apply<R extends BaseResource | Project>(context: RepositoryContext, resource: R, version: number, actions: UpdateAction[]): R;
74
- }
75
-
76
- declare class ProductTailoringRepository extends AbstractResourceRepository<"product-tailoring"> {
77
- constructor(config: Config);
78
- create(context: RepositoryContext, draft: any): ProductTailoring;
79
- }
80
-
81
- declare class CartRepository extends AbstractResourceRepository<"cart"> {
82
- constructor(config: Config);
83
- create(context: RepositoryContext, draft: CartDraft): Cart;
84
- getActiveCart(projectKey: string): Cart | undefined;
85
- draftLineItemtoLineItem: (projectKey: string, draftLineItem: LineItemDraft, currency: string, country: string | undefined) => LineItem;
86
- }
87
-
88
- declare class OrderRepository extends AbstractResourceRepository<"order"> {
89
- constructor(config: Config);
90
- create(context: RepositoryContext, draft: OrderFromCartDraft): Order;
91
- createFromCart(context: RepositoryContext, cartReference: CartReference, orderNumber?: string): Order;
92
- import(context: RepositoryContext, draft: OrderImportDraft): Order;
93
- private lineItemFromImportDraft;
94
- private customLineItemFromImportDraft;
95
- getWithOrderNumber(context: RepositoryContext, orderNumber: string, params?: QueryParams$1): Order | undefined;
96
- }
97
-
98
- declare class QuoteRequestRepository extends AbstractResourceRepository<"quote-request"> {
99
- constructor(config: Config);
100
- create(context: RepositoryContext, draft: QuoteRequestDraft | MyQuoteRequestDraft): QuoteRequest;
101
- createFromCart(context: RepositoryContext, cartReference: CartReference): QuoteRequest;
102
- }
103
-
104
- declare class AsAssociateOrderRepository extends OrderRepository {
105
- }
106
- declare class AsAssociateCartRepository extends CartRepository {
107
- }
108
- declare class AsAssociateQuoteRequestRepository extends QuoteRequestRepository {
109
- }
110
-
111
- declare class AssociateRoleRepository extends AbstractResourceRepository<"associate-role"> {
112
- constructor(config: Config);
113
- create(context: RepositoryContext, draft: AssociateRoleDraft): AssociateRole;
114
- }
115
-
116
- declare class AttributeGroupRepository extends AbstractResourceRepository<"attribute-group"> {
117
- constructor(config: Config);
118
- create(context: RepositoryContext, draft: AttributeGroupDraft): AttributeGroup;
119
- }
120
-
121
- declare class BusinessUnitRepository extends AbstractResourceRepository<"business-unit"> {
122
- constructor(config: Config);
123
- create(context: RepositoryContext, draft: BusinessUnitDraft): BusinessUnit;
124
- private _isCompanyDraft;
125
- private _isDivisionDraft;
126
- }
127
-
128
- declare class CartDiscountRepository extends AbstractResourceRepository<"cart-discount"> {
129
- constructor(config: Config);
130
- create(context: RepositoryContext, draft: CartDiscountDraft): CartDiscount;
131
- private transformValueDraft;
132
- }
133
-
134
- declare class CategoryRepository extends AbstractResourceRepository<"category"> {
135
- constructor(config: Config);
136
- create(context: RepositoryContext, draft: CategoryDraft): Category;
137
- postProcessResource(context: RepositoryContext, resource: Writable<Category>, params?: GetParams$1): Category;
138
- }
139
-
140
- declare class ChannelRepository extends AbstractResourceRepository<"channel"> {
141
- constructor(config: Config);
142
- create(context: RepositoryContext, draft: ChannelDraft): Channel;
143
- }
144
-
145
- declare class CustomObjectRepository extends AbstractResourceRepository<"key-value-document"> {
146
- constructor(config: Config);
147
- create(context: RepositoryContext, draft: Writable<CustomObjectDraft>): CustomObject;
148
- getWithContainerAndKey(context: RepositoryContext, container: string, key: string): CustomObject | undefined;
149
- queryWithContainer(context: RepositoryContext, container: string, params?: QueryParams$1): ctp.CustomObjectPagedQueryResponse;
150
- }
151
-
152
- declare class CustomerRepository extends AbstractResourceRepository<"customer"> {
153
- constructor(config: Config);
154
- create(context: RepositoryContext, draft: CustomerDraft): Customer;
155
- saveUpdate(context: RepositoryContext, version: number, resource: ShallowWritable<ResourceMap["customer"]>): ShallowWritable<ResourceMap["customer"]>;
156
- passwordResetToken(context: RepositoryContext, request: CustomerCreatePasswordResetToken): CustomerToken;
157
- passwordReset(context: RepositoryContext, resetPassword: CustomerResetPassword | MyCustomerResetPassword): {
158
- id: string;
159
- version: number;
160
- key?: string | undefined;
161
- customerNumber?: string | undefined;
162
- externalId?: string | undefined;
163
- createdAt: string;
164
- lastModifiedAt: string;
165
- lastModifiedBy?: {
166
- clientId?: string | undefined;
167
- externalUserId?: string | undefined;
168
- customer?: {
169
- typeId: "customer";
170
- id: string;
171
- obj?: /*elided*/ any | undefined;
172
- } | undefined;
173
- anonymousId?: string | undefined;
174
- attributedTo?: {
175
- clientId?: string | undefined;
176
- source: ctp.AttributionSource;
177
- } | undefined;
178
- associate?: {
179
- typeId: "customer";
180
- id: string;
181
- obj?: /*elided*/ any | undefined;
182
- } | undefined;
183
- } | undefined;
184
- createdBy?: {
185
- clientId?: string | undefined;
186
- externalUserId?: string | undefined;
187
- customer?: {
188
- typeId: "customer";
189
- id: string;
190
- obj?: /*elided*/ any | undefined;
191
- } | undefined;
192
- anonymousId?: string | undefined;
193
- attributedTo?: {
194
- clientId?: string | undefined;
195
- source: ctp.AttributionSource;
196
- } | undefined;
197
- associate?: {
198
- typeId: "customer";
199
- id: string;
200
- obj?: /*elided*/ any | undefined;
201
- } | undefined;
202
- } | undefined;
203
- email: string;
204
- password?: string | undefined;
205
- firstName?: string | undefined;
206
- lastName?: string | undefined;
207
- middleName?: string | undefined;
208
- title?: string | undefined;
209
- dateOfBirth?: string | undefined;
210
- companyName?: string | undefined;
211
- vatId?: string | undefined;
212
- addresses: WritableArray<Address>;
213
- defaultShippingAddressId?: string | undefined;
214
- shippingAddressIds?: WritableArray<string> | undefined;
215
- defaultBillingAddressId?: string | undefined;
216
- billingAddressIds?: WritableArray<string> | undefined;
217
- isEmailVerified: boolean;
218
- customerGroup?: {
219
- typeId: "customer-group";
220
- id: string;
221
- obj?: {
222
- id: string;
223
- version: number;
224
- createdAt: string;
225
- lastModifiedAt: string;
226
- lastModifiedBy?: {
227
- clientId?: string | undefined;
228
- externalUserId?: string | undefined;
229
- customer?: {
230
- typeId: "customer";
231
- id: string;
232
- obj?: /*elided*/ any | undefined;
233
- } | undefined;
234
- anonymousId?: string | undefined;
235
- attributedTo?: {
236
- clientId?: string | undefined;
237
- source: ctp.AttributionSource;
238
- } | undefined;
239
- associate?: {
240
- typeId: "customer";
241
- id: string;
242
- obj?: /*elided*/ any | undefined;
243
- } | undefined;
244
- } | undefined;
245
- createdBy?: {
246
- clientId?: string | undefined;
247
- externalUserId?: string | undefined;
248
- customer?: {
249
- typeId: "customer";
250
- id: string;
251
- obj?: /*elided*/ any | undefined;
252
- } | undefined;
253
- anonymousId?: string | undefined;
254
- attributedTo?: {
255
- clientId?: string | undefined;
256
- source: ctp.AttributionSource;
257
- } | undefined;
258
- associate?: {
259
- typeId: "customer";
260
- id: string;
261
- obj?: /*elided*/ any | undefined;
262
- } | undefined;
263
- } | undefined;
264
- key?: string | undefined;
265
- name: string;
266
- custom?: {
267
- type: {
268
- typeId: "type";
269
- id: string;
270
- obj?: {
271
- id: string;
272
- version: number;
273
- createdAt: string;
274
- lastModifiedAt: string;
275
- lastModifiedBy?: {
276
- clientId?: string | undefined;
277
- externalUserId?: string | undefined;
278
- customer?: {
279
- typeId: "customer";
280
- id: string;
281
- obj?: /*elided*/ any | undefined;
282
- } | undefined;
283
- anonymousId?: string | undefined;
284
- attributedTo?: {
285
- clientId?: string | undefined;
286
- source: ctp.AttributionSource;
287
- } | undefined;
288
- associate?: {
289
- typeId: "customer";
290
- id: string;
291
- obj?: /*elided*/ any | undefined;
292
- } | undefined;
293
- } | undefined;
294
- createdBy?: {
295
- clientId?: string | undefined;
296
- externalUserId?: string | undefined;
297
- customer?: {
298
- typeId: "customer";
299
- id: string;
300
- obj?: /*elided*/ any | undefined;
301
- } | undefined;
302
- anonymousId?: string | undefined;
303
- attributedTo?: {
304
- clientId?: string | undefined;
305
- source: ctp.AttributionSource;
306
- } | undefined;
307
- associate?: {
308
- typeId: "customer";
309
- id: string;
310
- obj?: /*elided*/ any | undefined;
311
- } | undefined;
312
- } | undefined;
313
- key: string;
314
- name: {
315
- [x: string]: string;
316
- };
317
- description?: {
318
- [x: string]: string;
319
- } | undefined;
320
- resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
321
- fieldDefinitions: WritableArray<ctp.FieldDefinition>;
322
- } | undefined;
323
- };
324
- fields: {
325
- [x: string]: any;
326
- };
327
- } | undefined;
328
- } | undefined;
329
- } | undefined;
330
- custom?: {
331
- type: {
332
- typeId: "type";
333
- id: string;
334
- obj?: {
335
- id: string;
336
- version: number;
337
- createdAt: string;
338
- lastModifiedAt: string;
339
- lastModifiedBy?: {
340
- clientId?: string | undefined;
341
- externalUserId?: string | undefined;
342
- customer?: {
343
- typeId: "customer";
344
- id: string;
345
- obj?: /*elided*/ any | undefined;
346
- } | undefined;
347
- anonymousId?: string | undefined;
348
- attributedTo?: {
349
- clientId?: string | undefined;
350
- source: ctp.AttributionSource;
351
- } | undefined;
352
- associate?: {
353
- typeId: "customer";
354
- id: string;
355
- obj?: /*elided*/ any | undefined;
356
- } | undefined;
357
- } | undefined;
358
- createdBy?: {
359
- clientId?: string | undefined;
360
- externalUserId?: string | undefined;
361
- customer?: {
362
- typeId: "customer";
363
- id: string;
364
- obj?: /*elided*/ any | undefined;
365
- } | undefined;
366
- anonymousId?: string | undefined;
367
- attributedTo?: {
368
- clientId?: string | undefined;
369
- source: ctp.AttributionSource;
370
- } | undefined;
371
- associate?: {
372
- typeId: "customer";
373
- id: string;
374
- obj?: /*elided*/ any | undefined;
375
- } | undefined;
376
- } | undefined;
377
- key: string;
378
- name: {
379
- [x: string]: string;
380
- };
381
- description?: {
382
- [x: string]: string;
383
- } | undefined;
384
- resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
385
- fieldDefinitions: WritableArray<ctp.FieldDefinition>;
386
- } | undefined;
387
- };
388
- fields: {
389
- [x: string]: any;
390
- };
391
- } | undefined;
392
- locale?: string | undefined;
393
- salutation?: string | undefined;
394
- stores: WritableArray<StoreKeyReference>;
395
- authenticationMode: ctp.AuthenticationMode;
396
- customerGroupAssignments?: WritableArray<ctp.CustomerGroupAssignment> | undefined;
397
- };
398
- verifyEmailToken(context: RepositoryContext, id: string): CustomerToken;
399
- private storeReferenceToStoreKeyReference;
400
- }
401
-
402
- declare class CustomerGroupRepository extends AbstractResourceRepository<"customer-group"> {
403
- constructor(config: Config);
404
- create(context: RepositoryContext, draft: CustomerGroupDraft): CustomerGroup;
405
- }
406
-
407
- declare class DiscountCodeRepository extends AbstractResourceRepository<"discount-code"> {
408
- constructor(config: Config);
409
- create(context: RepositoryContext, draft: DiscountCodeDraft): DiscountCode;
410
- }
411
-
412
- declare class ExtensionRepository extends AbstractResourceRepository<"extension"> {
413
- constructor(config: Config);
414
- create(context: RepositoryContext, draft: ExtensionDraft): Extension;
415
- postProcessResource(context: RepositoryContext, resource: Extension): Extension;
416
- }
417
-
418
- declare class InventoryEntryRepository extends AbstractResourceRepository<"inventory-entry"> {
419
- constructor(config: Config);
420
- create(context: RepositoryContext, draft: InventoryEntryDraft): InventoryEntry;
421
- }
422
-
423
- declare class MyCustomerRepository extends CustomerRepository {
424
- changePassword(context: RepositoryContext, changePassword: MyCustomerChangePassword): {
425
- id: string;
426
- version: number;
427
- key?: string | undefined;
428
- customerNumber?: string | undefined;
429
- externalId?: string | undefined;
430
- createdAt: string;
431
- lastModifiedAt: string;
432
- lastModifiedBy?: {
433
- clientId?: string | undefined;
434
- externalUserId?: string | undefined;
435
- customer?: {
436
- typeId: "customer";
437
- id: string;
438
- obj?: /*elided*/ any | undefined;
439
- } | undefined;
440
- anonymousId?: string | undefined;
441
- attributedTo?: {
442
- clientId?: string | undefined;
443
- source: ctp.AttributionSource;
444
- } | undefined;
445
- associate?: {
446
- typeId: "customer";
447
- id: string;
448
- obj?: /*elided*/ any | undefined;
449
- } | undefined;
450
- } | undefined;
451
- createdBy?: {
452
- clientId?: string | undefined;
453
- externalUserId?: string | undefined;
454
- customer?: {
455
- typeId: "customer";
456
- id: string;
457
- obj?: /*elided*/ any | undefined;
458
- } | undefined;
459
- anonymousId?: string | undefined;
460
- attributedTo?: {
461
- clientId?: string | undefined;
462
- source: ctp.AttributionSource;
463
- } | undefined;
464
- associate?: {
465
- typeId: "customer";
466
- id: string;
467
- obj?: /*elided*/ any | undefined;
468
- } | undefined;
469
- } | undefined;
470
- email: string;
471
- password?: string | undefined;
472
- firstName?: string | undefined;
473
- lastName?: string | undefined;
474
- middleName?: string | undefined;
475
- title?: string | undefined;
476
- dateOfBirth?: string | undefined;
477
- companyName?: string | undefined;
478
- vatId?: string | undefined;
479
- addresses: WritableArray<ctp.Address>;
480
- defaultShippingAddressId?: string | undefined;
481
- shippingAddressIds?: WritableArray<string> | undefined;
482
- defaultBillingAddressId?: string | undefined;
483
- billingAddressIds?: WritableArray<string> | undefined;
484
- isEmailVerified: boolean;
485
- customerGroup?: {
486
- typeId: "customer-group";
487
- id: string;
488
- obj?: {
489
- id: string;
490
- version: number;
491
- createdAt: string;
492
- lastModifiedAt: string;
493
- lastModifiedBy?: {
494
- clientId?: string | undefined;
495
- externalUserId?: string | undefined;
496
- customer?: {
497
- typeId: "customer";
498
- id: string;
499
- obj?: /*elided*/ any | undefined;
500
- } | undefined;
501
- anonymousId?: string | undefined;
502
- attributedTo?: {
503
- clientId?: string | undefined;
504
- source: ctp.AttributionSource;
505
- } | undefined;
506
- associate?: {
507
- typeId: "customer";
508
- id: string;
509
- obj?: /*elided*/ any | undefined;
510
- } | undefined;
511
- } | undefined;
512
- createdBy?: {
513
- clientId?: string | undefined;
514
- externalUserId?: string | undefined;
515
- customer?: {
516
- typeId: "customer";
517
- id: string;
518
- obj?: /*elided*/ any | undefined;
519
- } | undefined;
520
- anonymousId?: string | undefined;
521
- attributedTo?: {
522
- clientId?: string | undefined;
523
- source: ctp.AttributionSource;
524
- } | undefined;
525
- associate?: {
526
- typeId: "customer";
527
- id: string;
528
- obj?: /*elided*/ any | undefined;
529
- } | undefined;
530
- } | undefined;
531
- key?: string | undefined;
532
- name: string;
533
- custom?: {
534
- type: {
535
- typeId: "type";
536
- id: string;
537
- obj?: {
538
- id: string;
539
- version: number;
540
- createdAt: string;
541
- lastModifiedAt: string;
542
- lastModifiedBy?: {
543
- clientId?: string | undefined;
544
- externalUserId?: string | undefined;
545
- customer?: {
546
- typeId: "customer";
547
- id: string;
548
- obj?: /*elided*/ any | undefined;
549
- } | undefined;
550
- anonymousId?: string | undefined;
551
- attributedTo?: {
552
- clientId?: string | undefined;
553
- source: ctp.AttributionSource;
554
- } | undefined;
555
- associate?: {
556
- typeId: "customer";
557
- id: string;
558
- obj?: /*elided*/ any | undefined;
559
- } | undefined;
560
- } | undefined;
561
- createdBy?: {
562
- clientId?: string | undefined;
563
- externalUserId?: string | undefined;
564
- customer?: {
565
- typeId: "customer";
566
- id: string;
567
- obj?: /*elided*/ any | undefined;
568
- } | undefined;
569
- anonymousId?: string | undefined;
570
- attributedTo?: {
571
- clientId?: string | undefined;
572
- source: ctp.AttributionSource;
573
- } | undefined;
574
- associate?: {
575
- typeId: "customer";
576
- id: string;
577
- obj?: /*elided*/ any | undefined;
578
- } | undefined;
579
- } | undefined;
580
- key: string;
581
- name: {
582
- [x: string]: string;
583
- };
584
- description?: {
585
- [x: string]: string;
586
- } | undefined;
587
- resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
588
- fieldDefinitions: WritableArray<ctp.FieldDefinition>;
589
- } | undefined;
590
- };
591
- fields: {
592
- [x: string]: any;
593
- };
594
- } | undefined;
595
- } | undefined;
596
- } | undefined;
597
- custom?: {
598
- type: {
599
- typeId: "type";
600
- id: string;
601
- obj?: {
602
- id: string;
603
- version: number;
604
- createdAt: string;
605
- lastModifiedAt: string;
606
- lastModifiedBy?: {
607
- clientId?: string | undefined;
608
- externalUserId?: string | undefined;
609
- customer?: {
610
- typeId: "customer";
611
- id: string;
612
- obj?: /*elided*/ any | undefined;
613
- } | undefined;
614
- anonymousId?: string | undefined;
615
- attributedTo?: {
616
- clientId?: string | undefined;
617
- source: ctp.AttributionSource;
618
- } | undefined;
619
- associate?: {
620
- typeId: "customer";
621
- id: string;
622
- obj?: /*elided*/ any | undefined;
623
- } | undefined;
624
- } | undefined;
625
- createdBy?: {
626
- clientId?: string | undefined;
627
- externalUserId?: string | undefined;
628
- customer?: {
629
- typeId: "customer";
630
- id: string;
631
- obj?: /*elided*/ any | undefined;
632
- } | undefined;
633
- anonymousId?: string | undefined;
634
- attributedTo?: {
635
- clientId?: string | undefined;
636
- source: ctp.AttributionSource;
637
- } | undefined;
638
- associate?: {
639
- typeId: "customer";
640
- id: string;
641
- obj?: /*elided*/ any | undefined;
642
- } | undefined;
643
- } | undefined;
644
- key: string;
645
- name: {
646
- [x: string]: string;
647
- };
648
- description?: {
649
- [x: string]: string;
650
- } | undefined;
651
- resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
652
- fieldDefinitions: WritableArray<ctp.FieldDefinition>;
653
- } | undefined;
654
- };
655
- fields: {
656
- [x: string]: any;
657
- };
658
- } | undefined;
659
- locale?: string | undefined;
660
- salutation?: string | undefined;
661
- stores: WritableArray<ctp.StoreKeyReference>;
662
- authenticationMode: ctp.AuthenticationMode;
663
- customerGroupAssignments?: WritableArray<ctp.CustomerGroupAssignment> | undefined;
664
- };
665
- confirmEmail(context: RepositoryContext, resetPassword: MyCustomerEmailVerify): {
666
- id: string;
667
- version: number;
668
- key?: string | undefined;
669
- customerNumber?: string | undefined;
670
- externalId?: string | undefined;
671
- createdAt: string;
672
- lastModifiedAt: string;
673
- lastModifiedBy?: {
674
- clientId?: string | undefined;
675
- externalUserId?: string | undefined;
676
- customer?: {
677
- typeId: "customer";
678
- id: string;
679
- obj?: /*elided*/ any | undefined;
680
- } | undefined;
681
- anonymousId?: string | undefined;
682
- attributedTo?: {
683
- clientId?: string | undefined;
684
- source: ctp.AttributionSource;
685
- } | undefined;
686
- associate?: {
687
- typeId: "customer";
688
- id: string;
689
- obj?: /*elided*/ any | undefined;
690
- } | undefined;
691
- } | undefined;
692
- createdBy?: {
693
- clientId?: string | undefined;
694
- externalUserId?: string | undefined;
695
- customer?: {
696
- typeId: "customer";
697
- id: string;
698
- obj?: /*elided*/ any | undefined;
699
- } | undefined;
700
- anonymousId?: string | undefined;
701
- attributedTo?: {
702
- clientId?: string | undefined;
703
- source: ctp.AttributionSource;
704
- } | undefined;
705
- associate?: {
706
- typeId: "customer";
707
- id: string;
708
- obj?: /*elided*/ any | undefined;
709
- } | undefined;
710
- } | undefined;
711
- email: string;
712
- password?: string | undefined;
713
- firstName?: string | undefined;
714
- lastName?: string | undefined;
715
- middleName?: string | undefined;
716
- title?: string | undefined;
717
- dateOfBirth?: string | undefined;
718
- companyName?: string | undefined;
719
- vatId?: string | undefined;
720
- addresses: WritableArray<ctp.Address>;
721
- defaultShippingAddressId?: string | undefined;
722
- shippingAddressIds?: WritableArray<string> | undefined;
723
- defaultBillingAddressId?: string | undefined;
724
- billingAddressIds?: WritableArray<string> | undefined;
725
- isEmailVerified: boolean;
726
- customerGroup?: {
727
- typeId: "customer-group";
728
- id: string;
729
- obj?: {
730
- id: string;
731
- version: number;
732
- createdAt: string;
733
- lastModifiedAt: string;
734
- lastModifiedBy?: {
735
- clientId?: string | undefined;
736
- externalUserId?: string | undefined;
737
- customer?: {
738
- typeId: "customer";
739
- id: string;
740
- obj?: /*elided*/ any | undefined;
741
- } | undefined;
742
- anonymousId?: string | undefined;
743
- attributedTo?: {
744
- clientId?: string | undefined;
745
- source: ctp.AttributionSource;
746
- } | undefined;
747
- associate?: {
748
- typeId: "customer";
749
- id: string;
750
- obj?: /*elided*/ any | undefined;
751
- } | undefined;
752
- } | undefined;
753
- createdBy?: {
754
- clientId?: string | undefined;
755
- externalUserId?: string | undefined;
756
- customer?: {
757
- typeId: "customer";
758
- id: string;
759
- obj?: /*elided*/ any | undefined;
760
- } | undefined;
761
- anonymousId?: string | undefined;
762
- attributedTo?: {
763
- clientId?: string | undefined;
764
- source: ctp.AttributionSource;
765
- } | undefined;
766
- associate?: {
767
- typeId: "customer";
768
- id: string;
769
- obj?: /*elided*/ any | undefined;
770
- } | undefined;
771
- } | undefined;
772
- key?: string | undefined;
773
- name: string;
774
- custom?: {
775
- type: {
776
- typeId: "type";
777
- id: string;
778
- obj?: {
779
- id: string;
780
- version: number;
781
- createdAt: string;
782
- lastModifiedAt: string;
783
- lastModifiedBy?: {
784
- clientId?: string | undefined;
785
- externalUserId?: string | undefined;
786
- customer?: {
787
- typeId: "customer";
788
- id: string;
789
- obj?: /*elided*/ any | undefined;
790
- } | undefined;
791
- anonymousId?: string | undefined;
792
- attributedTo?: {
793
- clientId?: string | undefined;
794
- source: ctp.AttributionSource;
795
- } | undefined;
796
- associate?: {
797
- typeId: "customer";
798
- id: string;
799
- obj?: /*elided*/ any | undefined;
800
- } | undefined;
801
- } | undefined;
802
- createdBy?: {
803
- clientId?: string | undefined;
804
- externalUserId?: string | undefined;
805
- customer?: {
806
- typeId: "customer";
807
- id: string;
808
- obj?: /*elided*/ any | undefined;
809
- } | undefined;
810
- anonymousId?: string | undefined;
811
- attributedTo?: {
812
- clientId?: string | undefined;
813
- source: ctp.AttributionSource;
814
- } | undefined;
815
- associate?: {
816
- typeId: "customer";
817
- id: string;
818
- obj?: /*elided*/ any | undefined;
819
- } | undefined;
820
- } | undefined;
821
- key: string;
822
- name: {
823
- [x: string]: string;
824
- };
825
- description?: {
826
- [x: string]: string;
827
- } | undefined;
828
- resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
829
- fieldDefinitions: WritableArray<ctp.FieldDefinition>;
830
- } | undefined;
831
- };
832
- fields: {
833
- [x: string]: any;
834
- };
835
- } | undefined;
836
- } | undefined;
837
- } | undefined;
838
- custom?: {
839
- type: {
840
- typeId: "type";
841
- id: string;
842
- obj?: {
843
- id: string;
844
- version: number;
845
- createdAt: string;
846
- lastModifiedAt: string;
847
- lastModifiedBy?: {
848
- clientId?: string | undefined;
849
- externalUserId?: string | undefined;
850
- customer?: {
851
- typeId: "customer";
852
- id: string;
853
- obj?: /*elided*/ any | undefined;
854
- } | undefined;
855
- anonymousId?: string | undefined;
856
- attributedTo?: {
857
- clientId?: string | undefined;
858
- source: ctp.AttributionSource;
859
- } | undefined;
860
- associate?: {
861
- typeId: "customer";
862
- id: string;
863
- obj?: /*elided*/ any | undefined;
864
- } | undefined;
865
- } | undefined;
866
- createdBy?: {
867
- clientId?: string | undefined;
868
- externalUserId?: string | undefined;
869
- customer?: {
870
- typeId: "customer";
871
- id: string;
872
- obj?: /*elided*/ any | undefined;
873
- } | undefined;
874
- anonymousId?: string | undefined;
875
- attributedTo?: {
876
- clientId?: string | undefined;
877
- source: ctp.AttributionSource;
878
- } | undefined;
879
- associate?: {
880
- typeId: "customer";
881
- id: string;
882
- obj?: /*elided*/ any | undefined;
883
- } | undefined;
884
- } | undefined;
885
- key: string;
886
- name: {
887
- [x: string]: string;
888
- };
889
- description?: {
890
- [x: string]: string;
891
- } | undefined;
892
- resourceTypeIds: WritableArray<ctp.ResourceTypeId>;
893
- fieldDefinitions: WritableArray<ctp.FieldDefinition>;
894
- } | undefined;
895
- };
896
- fields: {
897
- [x: string]: any;
898
- };
899
- } | undefined;
900
- locale?: string | undefined;
901
- salutation?: string | undefined;
902
- stores: WritableArray<ctp.StoreKeyReference>;
903
- authenticationMode: ctp.AuthenticationMode;
904
- customerGroupAssignments?: WritableArray<ctp.CustomerGroupAssignment> | undefined;
905
- };
906
- deleteMe(context: RepositoryContext): Customer | undefined;
907
- getMe(context: RepositoryContext): Customer | undefined;
908
- }
909
-
910
- declare class MyOrderRepository extends OrderRepository {
911
- create(context: RepositoryContext, draft: MyOrderFromCartDraft): Order;
912
- }
913
-
914
- declare class OrderEditRepository extends AbstractResourceRepository<"order-edit"> {
915
- constructor(config: Config);
916
- create(context: RepositoryContext, draft: OrderEditDraft): OrderEdit;
917
- }
918
-
919
- declare class PaymentRepository extends AbstractResourceRepository<"payment"> {
920
- constructor(config: Config);
921
- create(context: RepositoryContext, draft: PaymentDraft): Payment;
922
- }
923
-
924
- interface ProductSearchVariantAvailability {
925
- isOnStock: boolean;
926
- availableQuantity: number;
927
- isOnStockForChannel: string | undefined;
928
- }
929
- declare class ProductSearch {
930
- protected _storage: AbstractStorage;
931
- constructor(config: Config);
932
- search(projectKey: string, params: ProductSearchRequest): ProductPagedSearchResponse;
933
- transformProduct(product: Product, staged: boolean, availabilityBySku: Map<string, ProductSearchVariantAvailability>): ProductProjection;
934
- }
935
-
936
- declare class ProductRepository extends AbstractResourceRepository<"product"> {
937
- protected _searchService: ProductSearch;
938
- constructor(config: Config);
939
- create(context: RepositoryContext, draft: ProductDraft): Product;
940
- search(context: RepositoryContext, searchRequest: ProductSearchRequest): ProductPagedSearchResponse;
941
- }
942
-
943
- declare class ProductDiscountRepository extends AbstractResourceRepository<"product-discount"> {
944
- constructor(config: Config);
945
- create(context: RepositoryContext, draft: ProductDiscountDraft): ProductDiscount;
946
- }
947
-
948
- /**
949
- * This module implements the commercetools product projection filter expression.
950
- */
951
-
952
- type RangeExpression = {
953
- type: "RangeExpression";
954
- start?: number;
955
- stop?: number;
956
- match: (obj: any) => boolean;
957
- };
958
- type FilterExpression = {
959
- type: "FilterExpression";
960
- match: (obj: any) => boolean;
961
- };
962
-
963
- type ProductProjectionSearchParams = {
964
- fuzzy?: boolean;
965
- fuzzyLevel?: number;
966
- markMatchingVariants?: boolean;
967
- staged?: boolean;
968
- filter?: string[];
969
- "filter.facets"?: string[];
970
- "filter.query"?: string[];
971
- facet?: string | string[];
972
- sort?: string | string[];
973
- limit?: number;
974
- offset?: number;
975
- withTotal?: boolean;
976
- priceCurrency?: string;
977
- priceCountry?: string;
978
- priceCustomerGroup?: string;
979
- priceChannel?: string;
980
- localeProjection?: string;
981
- storeProjection?: string;
982
- expand?: string | string[];
983
- [key: string]: QueryParam;
984
- };
985
- declare class ProductProjectionSearch {
986
- protected _storage: AbstractStorage;
987
- constructor(config: Config);
988
- search(projectKey: string, params: ProductProjectionSearchParams): ProductProjectionPagedSearchResponse;
989
- transform(product: Product, staged: boolean): ProductProjection;
990
- getFacets(params: ProductProjectionSearchParams, products: ProductProjection[]): FacetResults;
991
- /**
992
- * TODO: This implemention needs the following additional features:
993
- * - counting products
994
- * - correct dataType
995
- */
996
- termFacet(facet: string, products: ProductProjection[], countProducts: boolean): TermFacetResult;
997
- filterFacet(source: string, filters: FilterExpression[] | undefined, products: ProductProjection[], countProducts: boolean): FilteredFacetResult;
998
- rangeFacet(source: string, ranges: RangeExpression[] | undefined, products: ProductProjection[], countProducts: boolean): RangeFacetResult;
999
- }
1000
-
1001
- type ProductProjectionQueryParams = {
1002
- staged?: boolean;
1003
- priceCurrency?: string;
1004
- priceCountry?: string;
1005
- priceCustomerGroup?: string;
1006
- priceChannel?: string;
1007
- localeProjection?: string;
1008
- storeProjection?: string;
1009
- expand?: string | string[];
1010
- sort?: string | string[];
1011
- limit?: number;
1012
- offset?: number;
1013
- withTotal?: boolean;
1014
- where?: string | string[];
1015
- [key: string]: QueryParam;
1016
- };
1017
- declare class ProductProjectionRepository extends AbstractResourceRepository<"product-projection"> {
1018
- protected _searchService: ProductProjectionSearch;
1019
- constructor(config: Config);
1020
- create(context: RepositoryContext, draft: ProductDraft): ProductProjection;
1021
- get(context: RepositoryContext, id: string, params?: GetParams$1): ProductProjection | null;
1022
- query(context: RepositoryContext, params?: ProductProjectionQueryParams): {
1023
- count: number;
1024
- total: number;
1025
- offset: number;
1026
- limit: number;
1027
- results: ProductProjection[];
1028
- };
1029
- search(context: RepositoryContext, query: ProductProjectionQueryParams): ctp.ProductProjectionPagedSearchResponse;
1030
- }
1031
-
1032
- declare class ProductSelectionRepository extends AbstractResourceRepository<"product-selection"> {
1033
- constructor(config: Config);
1034
- create(context: RepositoryContext, draft: ProductSelectionDraft): ProductSelection;
1035
- }
1036
-
1037
- declare class ProductTypeRepository extends AbstractResourceRepository<"product-type"> {
1038
- constructor(config: Config);
1039
- create(context: RepositoryContext, draft: ProductTypeDraft): ProductType;
1040
- }
1041
-
1042
- declare class ProjectRepository extends AbstractRepository<Project> {
1043
- constructor(config: Config);
1044
- get(context: RepositoryContext): Project | null;
1045
- postProcessResource(context: RepositoryContext, resource: Project): Project;
1046
- saveNew(context: RepositoryContext, resource: Writable<Project>): void;
1047
- saveUpdate(context: RepositoryContext, version: number, resource: Project): void;
1048
- }
1049
-
1050
- declare class QuoteRepository extends AbstractResourceRepository<"quote"> {
1051
- constructor(config: Config);
1052
- create(context: RepositoryContext, draft: QuoteDraft): Quote;
1053
- }
1054
-
1055
- declare class StagedQuoteRepository extends AbstractResourceRepository<"staged-quote"> {
1056
- constructor(config: Config);
1057
- create(context: RepositoryContext, draft: StagedQuoteDraft): StagedQuote;
1058
- }
1059
-
1060
- declare class ReviewRepository extends AbstractResourceRepository<"review"> {
1061
- constructor(config: Config);
1062
- create(context: RepositoryContext, draft: ReviewDraft): Review;
1063
- }
1064
-
1065
- declare class ShippingMethodRepository extends AbstractResourceRepository<"shipping-method"> {
1066
- constructor(config: Config);
1067
- create(context: RepositoryContext, draft: ShippingMethodDraft): ShippingMethod;
1068
- matchingCart(context: RepositoryContext, cartId: string, params?: GetParams$1): {
1069
- results: {
1070
- zoneRates: {
1071
- zone: ZoneReference;
1072
- shippingRates: ctp.ShippingRate[];
1073
- }[];
1074
- id: string;
1075
- version: number;
1076
- createdAt: string;
1077
- lastModifiedAt: string;
1078
- lastModifiedBy?: ctp.LastModifiedBy;
1079
- createdBy?: ctp.CreatedBy;
1080
- key?: string;
1081
- name: string;
1082
- localizedName?: ctp.LocalizedString;
1083
- description?: string;
1084
- localizedDescription?: ctp.LocalizedString;
1085
- taxCategory: ctp.TaxCategoryReference;
1086
- active: boolean;
1087
- isDefault: boolean;
1088
- predicate?: string;
1089
- custom?: ctp.CustomFields;
1090
- }[];
1091
- limit?: number;
1092
- count: number;
1093
- total?: number;
1094
- offset?: number;
1095
- } | undefined;
1096
- private _transformZoneRateDraft;
1097
- }
1098
-
1099
- declare class ShoppingListRepository extends AbstractResourceRepository<"shopping-list"> {
1100
- constructor(config: Config);
1101
- create(context: RepositoryContext, draft: ShoppingListDraft): ShoppingList;
1102
- draftLineItemtoLineItem: (projectKey: string, draftLineItem: LineItemDraft) => ShoppingListLineItem;
1103
- }
1104
-
1105
- declare class StandAlonePriceRepository extends AbstractResourceRepository<"standalone-price"> {
1106
- constructor(config: Config);
1107
- create(context: RepositoryContext, draft: StandalonePriceDraft): StandalonePrice;
1108
- transformChannelReferenceDraft(channel: ChannelResourceIdentifier): ChannelReference;
1109
- }
1110
-
1111
- declare class StateRepository extends AbstractResourceRepository<"state"> {
1112
- constructor(config: Config);
1113
- create(context: RepositoryContext, draft: StateDraft): State;
1114
- }
1115
-
1116
- declare class StoreRepository extends AbstractResourceRepository<"store"> {
1117
- constructor(config: Config);
1118
- create(context: RepositoryContext, draft: StoreDraft): Store;
1119
- }
1120
-
1121
- declare class SubscriptionRepository extends AbstractResourceRepository<"subscription"> {
1122
- constructor(config: Config);
1123
- create(context: RepositoryContext, draft: SubscriptionDraft): Subscription;
1124
- }
1125
-
1126
- declare class TaxCategoryRepository extends AbstractResourceRepository<"tax-category"> {
1127
- constructor(config: Config);
1128
- create(context: RepositoryContext, draft: TaxCategoryDraft): TaxCategory;
1129
- }
1130
-
1131
- declare class TypeRepository extends AbstractResourceRepository<"type"> {
1132
- constructor(config: Config);
1133
- create(context: RepositoryContext, draft: TypeDraft): Type;
1134
- }
1135
-
1136
- declare class ZoneRepository extends AbstractResourceRepository<"zone"> {
1137
- constructor(config: Config);
1138
- create(context: RepositoryContext, draft: ZoneDraft): Zone;
1139
- }
1140
-
1141
- type RepositoryMap = ReturnType<typeof createRepositories>;
1142
- declare const createRepositories: (config: Config) => {
1143
- "as-associate": {
1144
- cart: AsAssociateCartRepository;
1145
- order: AsAssociateOrderRepository;
1146
- "quote-request": AsAssociateQuoteRequestRepository;
1147
- };
1148
- "associate-role": AssociateRoleRepository;
1149
- "attribute-group": AttributeGroupRepository;
1150
- "business-unit": BusinessUnitRepository;
1151
- category: CategoryRepository;
1152
- cart: CartRepository;
1153
- "cart-discount": CartDiscountRepository;
1154
- customer: CustomerRepository;
1155
- channel: ChannelRepository;
1156
- "customer-group": CustomerGroupRepository;
1157
- "discount-code": DiscountCodeRepository;
1158
- extension: ExtensionRepository;
1159
- "inventory-entry": InventoryEntryRepository;
1160
- "key-value-document": CustomObjectRepository;
1161
- order: OrderRepository;
1162
- "order-edit": OrderEditRepository;
1163
- payment: PaymentRepository;
1164
- "my-cart": CartRepository;
1165
- "my-order": MyOrderRepository;
1166
- "my-customer": MyCustomerRepository;
1167
- "my-payment": PaymentRepository;
1168
- "my-shopping-list": ShoppingListRepository;
1169
- product: ProductRepository;
1170
- "product-type": ProductTypeRepository;
1171
- "product-discount": ProductDiscountRepository;
1172
- "product-projection": ProductProjectionRepository;
1173
- "product-selection": ProductSelectionRepository;
1174
- "product-tailoring": ProductTailoringRepository;
1175
- project: ProjectRepository;
1176
- review: ReviewRepository;
1177
- quote: QuoteRepository;
1178
- "quote-request": QuoteRequestRepository;
1179
- "shipping-method": ShippingMethodRepository;
1180
- "shopping-list": ShoppingListRepository;
1181
- "staged-quote": StagedQuoteRepository;
1182
- "standalone-price": StandAlonePriceRepository;
1183
- state: StateRepository;
1184
- store: StoreRepository;
1185
- subscription: SubscriptionRepository;
1186
- "tax-category": TaxCategoryRepository;
1187
- type: TypeRepository;
1188
- zone: ZoneRepository;
1189
- };
1190
-
1191
- type Builtin = string | number | boolean | undefined | null | symbol | bigint | Date | RegExp;
1192
- type Writable<T> = T extends Builtin ? T : T extends ReadonlyArray<infer U> ? WritableArray<U> : T extends object ? {
1193
- -readonly [P in keyof T]: Writable<T[P]>;
1194
- } : T;
1195
- interface WritableArray<T> extends Array<Writable<T>> {
1196
- }
1197
- type ShallowWritable<T> = {
1198
- -readonly [P in keyof T]: T[P];
1199
- };
1200
- type ResourceType = keyof ResourceMap & keyof RepositoryMap;
1201
- type ResourceMap = {
1202
- "attribute-group": ctp.AttributeGroup;
1203
- "associate-role": ctp.AssociateRole;
1204
- "business-unit": ctp.BusinessUnit;
1205
- "cart-discount": ctp.CartDiscount;
1206
- cart: ctp.Cart;
1207
- category: ctp.Category;
1208
- channel: ctp.Channel;
1209
- "customer-email-token": never;
1210
- "customer-group": ctp.CustomerGroup;
1211
- "customer-password-token": never;
1212
- customer: ctp.Customer;
1213
- "discount-code": ctp.DiscountCode;
1214
- extension: ctp.Extension;
1215
- "inventory-entry": ctp.InventoryEntry;
1216
- "key-value-document": ctp.CustomObject;
1217
- "order-edit": ctp.OrderEdit;
1218
- order: ctp.Order;
1219
- payment: ctp.Payment;
1220
- "product-discount": ctp.ProductDiscount;
1221
- "product-price": ctp.StandalonePrice;
1222
- "product-projection": ctp.ProductProjection;
1223
- "product-selection": ctp.ProductSelection;
1224
- "product-tailoring": ctp.ProductTailoring;
1225
- "product-type": ctp.ProductType;
1226
- product: ctp.Product;
1227
- "quote-request": ctp.QuoteRequest;
1228
- quote: ctp.Quote;
1229
- review: ctp.Review;
1230
- "shipping-method": ctp.ShippingMethod;
1231
- "shopping-list": ctp.ShoppingList;
1232
- "staged-quote": ctp.StagedQuote;
1233
- "standalone-price": ctp.StandalonePrice;
1234
- state: ctp.State;
1235
- store: ctp.Store;
1236
- subscription: ctp.Subscription;
1237
- "tax-category": ctp.TaxCategory;
1238
- type: ctp.Type;
1239
- zone: ctp.Zone;
1240
- };
1241
- type PagedQueryResponseMap = {
1242
- "attribute-group": ctp.AttributeGroupPagedQueryResponse;
1243
- "associate-role": ctp.AssociateRolePagedQueryResponse;
1244
- "business-unit": ctp.BusinessUnitPagedQueryResponse;
1245
- "cart-discount": ctp.CartDiscountPagedQueryResponse;
1246
- cart: ctp.CartPagedQueryResponse;
1247
- category: ctp.CategoryPagedQueryResponse;
1248
- channel: ctp.ChannelPagedQueryResponse;
1249
- "customer-email-token": never;
1250
- "customer-group": ctp.CustomerGroupPagedQueryResponse;
1251
- "customer-password-token": never;
1252
- customer: ctp.CustomerPagedQueryResponse;
1253
- "discount-code": ctp.DiscountCodePagedQueryResponse;
1254
- extension: ctp.ExtensionPagedQueryResponse;
1255
- "inventory-entry": ctp.InventoryPagedQueryResponse;
1256
- "key-value-document": ctp.CustomObjectPagedQueryResponse;
1257
- "order-edit": ctp.OrderEditPagedQueryResponse;
1258
- order: ctp.OrderPagedQueryResponse;
1259
- payment: ctp.PaymentPagedQueryResponse;
1260
- "product-discount": ctp.ProductDiscountPagedQueryResponse;
1261
- "product-price": ctp.StandalonePricePagedQueryResponse;
1262
- "product-projection": ctp.ProductProjectionPagedQueryResponse;
1263
- "product-selection": ctp.ProductSelectionPagedQueryResponse;
1264
- "product-tailoring": ctp.ProductTailoringPagedQueryResponse;
1265
- "product-type": ctp.ProductTypePagedQueryResponse;
1266
- product: ctp.ProductPagedQueryResponse;
1267
- "quote-request": ctp.QuoteRequestPagedQueryResponse;
1268
- quote: ctp.QuotePagedQueryResponse;
1269
- review: ctp.ReviewPagedQueryResponse;
1270
- "shipping-method": ctp.ShippingMethodPagedQueryResponse;
1271
- "shopping-list": ctp.ShoppingListPagedQueryResponse;
1272
- "staged-quote": ctp.StagedQuotePagedQueryResponse;
1273
- "standalone-price": ctp.StandalonePricePagedQueryResponse;
1274
- state: ctp.StatePagedQueryResponse;
1275
- store: ctp.StorePagedQueryResponse;
1276
- subscription: ctp.SubscriptionPagedQueryResponse;
1277
- "tax-category": ctp.TaxCategoryPagedQueryResponse;
1278
- type: ctp.TypePagedQueryResponse;
1279
- zone: ctp.ZonePagedQueryResponse;
1280
- };
1281
-
1282
- type GetParams = {
1283
- expand?: string[];
1284
- };
1285
- type QueryParams = {
1286
- expand?: string | string[];
1287
- sort?: string | string[];
1288
- limit?: number;
1289
- offset?: number;
1290
- withTotal?: boolean;
1291
- where?: string | string[];
1292
- [key: string]: QueryParam;
1293
- };
1294
- declare abstract class AbstractStorage {
1295
- abstract clear(): void;
1296
- abstract all<RT extends ResourceType>(projectKey: string, typeId: RT): Array<ResourceMap[RT]>;
1297
- abstract add<RT extends ResourceType>(projectKey: string, typeId: RT, obj: ResourceMap[RT]): ResourceMap[RT];
1298
- abstract get<RT extends ResourceType>(projectKey: string, typeId: RT, id: string, params?: GetParams): ResourceMap[RT] | null;
1299
- abstract getByKey<RT extends ResourceType>(projectKey: string, typeId: RT, key: string, params: GetParams): ResourceMap[RT] | null;
1300
- abstract addProject(projectKey: string): Project;
1301
- abstract getProject(projectKey: string): Project;
1302
- abstract saveProject(project: Project): Project;
1303
- abstract delete<RT extends ResourceType>(projectKey: string, typeId: RT, id: string, params: GetParams): ResourceMap[RT] | null;
1304
- abstract query<RT extends ResourceType>(projectKey: string, typeId: RT, params: QueryParams): PagedQueryResponseMap[RT];
1305
- abstract getByResourceIdentifier<RT extends ResourceType>(projectKey: string, identifier: ResourceIdentifier): ResourceMap[RT];
1306
- abstract expand<T>(projectKey: string, obj: T, clause: undefined | string | string[]): T;
1307
- }
1308
-
1309
- type Config = {
1310
- strict: boolean;
1311
- storage: AbstractStorage;
1312
- };
1313
-
1314
- declare class ProjectAPI {
1315
- private projectKey;
1316
- private _storage;
1317
- private _repositories;
1318
- private config;
1319
- constructor(projectKey: string, repositories: RepositoryMap, config: Config);
1320
- add<T extends keyof RepositoryMap & keyof ResourceMap>(typeId: T, resource: ResourceMap[T]): void;
1321
- unsafeAdd<T extends keyof RepositoryMap & keyof ResourceMap>(typeId: T, resource: ResourceMap[T]): void;
1322
- get<RT extends ResourceType>(typeId: RT, id: string, params?: GetParams$1): ResourceMap[RT];
1323
- getRepository<RT extends keyof RepositoryMap>(typeId: RT): RepositoryMap[RT];
1324
- }
1325
-
1326
- type CommercetoolsMockOptions = {
1327
- validateCredentials: boolean;
1328
- enableAuthentication: boolean;
1329
- defaultProjectKey: string | undefined;
1330
- apiHost: RegExp | string;
1331
- authHost: RegExp | string;
1332
- silent: boolean;
1333
- strict: boolean;
1334
- };
1335
- type AppOptions = {
1336
- silent?: boolean;
1337
- };
1338
- declare class CommercetoolsMock {
1339
- app: express.Express;
1340
- options: CommercetoolsMockOptions;
1341
- private _storage;
1342
- private _oauth2;
1343
- private _mswServer;
1344
- private _repositories;
1345
- private _projectService?;
1346
- constructor(options?: Partial<CommercetoolsMockOptions>);
1347
- start(): void;
1348
- stop(): void;
1349
- clear(): void;
1350
- project(projectKey?: string): ProjectAPI;
1351
- authStore(): OAuth2Store;
1352
- runServer(port?: number, options?: AppOptions): void;
1353
- private createApp;
1354
- registerHandlers(server: SetupServerApi): void;
1355
- getHandlers(): msw.HttpHandler[];
1356
- mswServer(): SetupServer | undefined;
1357
- private startServer;
1358
- }
1359
-
1360
- declare const getBaseResourceProperties: () => {
1361
- id: string;
1362
- createdAt: string;
1363
- lastModifiedAt: string;
1364
- version: number;
1365
- };
1366
-
1367
- export { CommercetoolsMock, type CommercetoolsMockOptions, getBaseResourceProperties };