@labdigital/commercetools-mock 2.6.0 → 2.7.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 CHANGED
@@ -465,6 +465,7 @@ declare const createRepositories: (storage: AbstractStorage) => {
465
465
  'my-order': MyOrderRepository;
466
466
  'my-customer': CustomerRepository;
467
467
  'my-payment': PaymentRepository;
468
+ 'my-shopping-list': ShoppingListRepository;
468
469
  product: ProductRepository;
469
470
  'product-type': ProductTypeRepository;
470
471
  'product-discount': ProductDiscountRepository;
package/dist/index.d.ts CHANGED
@@ -465,6 +465,7 @@ declare const createRepositories: (storage: AbstractStorage) => {
465
465
  'my-order': MyOrderRepository;
466
466
  'my-customer': CustomerRepository;
467
467
  'my-payment': PaymentRepository;
468
+ 'my-shopping-list': ShoppingListRepository;
468
469
  product: ProductRepository;
469
470
  'product-type': ProductTypeRepository;
470
471
  'product-discount': ProductDiscountRepository;
package/dist/index.js CHANGED
@@ -5994,6 +5994,7 @@ var createRepositories = (storage) => ({
5994
5994
  "my-order": new MyOrderRepository(storage),
5995
5995
  "my-customer": new CustomerRepository(storage),
5996
5996
  "my-payment": new PaymentRepository(storage),
5997
+ "my-shopping-list": new ShoppingListRepository(storage),
5997
5998
  product: new ProductRepository(storage),
5998
5999
  "product-type": new ProductTypeRepository(storage),
5999
6000
  "product-discount": new ProductDiscountRepository(storage),
@@ -6449,6 +6450,7 @@ var MyCustomerService = class extends AbstractService {
6449
6450
  const router = Router3({ mergeParams: true });
6450
6451
  this.extraRoutes(router);
6451
6452
  router.get("", this.getMe.bind(this));
6453
+ router.post("", this.updateMe.bind(this));
6452
6454
  router.post("/signup", this.signUp.bind(this));
6453
6455
  router.post("/login", this.signIn.bind(this));
6454
6456
  parent.use(`/${basePath}`, router);
@@ -6460,6 +6462,21 @@ var MyCustomerService = class extends AbstractService {
6460
6462
  }
6461
6463
  return response.status(200).send(resource);
6462
6464
  }
6465
+ updateMe(request, response) {
6466
+ const resource = this.repository.getMe(getRepositoryContext(request));
6467
+ if (!resource) {
6468
+ return response.status(404).send("Not found");
6469
+ }
6470
+ const updateRequest = request.body;
6471
+ const updatedResource = this.repository.processUpdateActions(
6472
+ getRepositoryContext(request),
6473
+ resource,
6474
+ updateRequest.version,
6475
+ updateRequest.actions
6476
+ );
6477
+ const result = this._expandWithId(request, updatedResource.id);
6478
+ return response.status(200).send(result);
6479
+ }
6463
6480
  signUp(request, response) {
6464
6481
  const draft = request.body;
6465
6482
  const resource = this.repository.create(
@@ -6526,6 +6543,18 @@ var MyPaymentService = class extends AbstractService {
6526
6543
  }
6527
6544
  };
6528
6545
 
6546
+ // src/services/my-shopping-list.ts
6547
+ var MyShoppingListService = class extends AbstractService {
6548
+ repository;
6549
+ constructor(parent, repository) {
6550
+ super(parent);
6551
+ this.repository = repository;
6552
+ }
6553
+ getBasePath() {
6554
+ return "me/shopping-lists";
6555
+ }
6556
+ };
6557
+
6529
6558
  // src/services/order.ts
6530
6559
  var OrderService = class extends AbstractService {
6531
6560
  repository;
@@ -6813,6 +6842,10 @@ var createServices = (router, repos) => ({
6813
6842
  "my-order": new MyOrderService(router, repos["my-order"]),
6814
6843
  "my-customer": new MyCustomerService(router, repos["my-customer"]),
6815
6844
  "my-payment": new MyPaymentService(router, repos["my-payment"]),
6845
+ "my-shopping-list": new MyShoppingListService(
6846
+ router,
6847
+ repos["my-shopping-list"]
6848
+ ),
6816
6849
  "shipping-method": new ShippingMethodService(
6817
6850
  router,
6818
6851
  repos["shipping-method"]
@@ -6884,7 +6917,6 @@ var CommercetoolsMock = class {
6884
6917
  this._mswServer = void 0;
6885
6918
  }
6886
6919
  clear() {
6887
- this._mswServer?.resetHandlers();
6888
6920
  this._storage.clear();
6889
6921
  }
6890
6922
  project(projectKey) {