@labdigital/commercetools-mock 2.37.0 → 2.39.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.cjs +216 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +216 -80
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
- package/src/ctMock.ts +10 -6
- package/src/helpers.ts +4 -4
- package/src/index.ts +2 -1
- package/src/lib/expandParser.ts +1 -1
- package/src/lib/haversine.test.ts +2 -1
- package/src/lib/password.ts +2 -2
- package/src/lib/predicateParser.ts +1 -1
- package/src/lib/productSearchFilter.test.ts +4 -1
- package/src/lib/projectionSearchFilter.ts +3 -3
- package/src/oauth/helpers.ts +1 -1
- package/src/oauth/server.test.ts +2 -1
- package/src/oauth/server.ts +5 -8
- package/src/oauth/store.ts +1 -1
- package/src/priceSelector.ts +1 -1
- package/src/product-projection-search.ts +4 -2
- package/src/product-search.ts +2 -2
- package/src/projectAPI.ts +4 -4
- package/src/repositories/abstract.ts +20 -3
- package/src/repositories/associate-role.ts +3 -3
- package/src/repositories/attribute-group.ts +3 -3
- package/src/repositories/business-unit.ts +6 -4
- package/src/repositories/cart/actions.ts +6 -7
- package/src/repositories/cart/helpers.ts +1 -1
- package/src/repositories/cart/index.ts +1 -1
- package/src/repositories/cart-discount/actions.ts +14 -5
- package/src/repositories/cart-discount/index.ts +1 -1
- package/src/repositories/category/actions.ts +4 -7
- package/src/repositories/category/index.ts +3 -3
- package/src/repositories/channel.ts +2 -2
- package/src/repositories/custom-object.ts +3 -6
- package/src/repositories/customer/actions.ts +272 -68
- package/src/repositories/customer/index.ts +10 -8
- package/src/repositories/customer-group.ts +2 -2
- package/src/repositories/discount-code/actions.ts +2 -5
- package/src/repositories/discount-code/index.ts +1 -1
- package/src/repositories/extension.ts +3 -3
- package/src/repositories/helpers.ts +4 -2
- package/src/repositories/index.ts +1 -1
- package/src/repositories/inventory-entry/actions.ts +2 -5
- package/src/repositories/inventory-entry/index.ts +1 -1
- package/src/repositories/my-customer.ts +2 -2
- package/src/repositories/order/actions.ts +2 -5
- package/src/repositories/order/index.ts +3 -6
- package/src/repositories/order-edit.ts +3 -2
- package/src/repositories/payment/actions.ts +2 -5
- package/src/repositories/payment/helpers.ts +6 -3
- package/src/repositories/payment/index.ts +3 -2
- package/src/repositories/product/actions.ts +2 -2
- package/src/repositories/product/helpers.ts +4 -4
- package/src/repositories/product/index.ts +3 -2
- package/src/repositories/product-discount.ts +3 -7
- package/src/repositories/product-projection.ts +2 -5
- package/src/repositories/product-selection.ts +3 -7
- package/src/repositories/product-tailoring.ts +3 -7
- package/src/repositories/product-type.ts +7 -11
- package/src/repositories/project.ts +4 -8
- package/src/repositories/quote-request.ts +3 -2
- package/src/repositories/quote.ts +3 -2
- package/src/repositories/review.ts +6 -3
- package/src/repositories/shipping-method/actions.ts +5 -6
- package/src/repositories/shipping-method/helpers.ts +4 -1
- package/src/repositories/shipping-method/index.ts +3 -6
- package/src/repositories/shopping-list/actions.ts +3 -6
- package/src/repositories/shopping-list/index.ts +4 -3
- package/src/repositories/staged-quote.ts +3 -2
- package/src/repositories/standalone-price.ts +3 -7
- package/src/repositories/state.ts +3 -7
- package/src/repositories/store.ts +3 -7
- package/src/repositories/subscription.ts +4 -8
- package/src/repositories/tax-category/actions.ts +2 -1
- package/src/repositories/tax-category/helpers.ts +1 -1
- package/src/repositories/tax-category/index.ts +3 -2
- package/src/repositories/type/actions.ts +2 -1
- package/src/repositories/type/index.ts +3 -2
- package/src/repositories/zone.ts +3 -7
- package/src/services/abstract.ts +2 -2
- package/src/services/associate-roles.test.ts +1 -1
- package/src/services/associate-roles.ts +2 -2
- package/src/services/attribute-group.ts +2 -2
- package/src/services/business-units.test.ts +1 -1
- package/src/services/business-units.ts +2 -2
- package/src/services/cart-discount.test.ts +1 -1
- package/src/services/cart-discount.ts +2 -2
- package/src/services/category.ts +2 -2
- package/src/services/channel.ts +2 -2
- package/src/services/customer-group.ts +2 -2
- package/src/services/customer.test.ts +422 -132
- package/src/services/customer.ts +4 -3
- package/src/services/discount-code.ts +2 -2
- package/src/services/extension.ts +2 -2
- package/src/services/index.ts +1 -1
- package/src/services/inventory-entry.ts +2 -2
- package/src/services/my-business-unit.ts +1 -1
- package/src/services/my-cart.ts +3 -2
- package/src/services/my-customer.ts +4 -3
- package/src/services/my-order.ts +1 -1
- package/src/services/my-payment.ts +2 -2
- package/src/services/my-shopping-list.ts +2 -2
- package/src/services/order.ts +2 -2
- package/src/services/payment.ts +2 -2
- package/src/services/product-discount.ts +2 -2
- package/src/services/product-projection.test.ts +1 -1
- package/src/services/product-projection.ts +2 -2
- package/src/services/product-selection.ts +2 -2
- package/src/services/product-type.ts +2 -2
- package/src/services/product.test.ts +1 -1
- package/src/services/product.ts +2 -2
- package/src/services/project.ts +3 -3
- package/src/services/reviews.ts +2 -2
- package/src/services/shipping-method.ts +2 -2
- package/src/services/shopping-list.test.ts +1 -1
- package/src/services/shopping-list.ts +2 -2
- package/src/services/standalone-price.ts +2 -2
- package/src/services/state.ts +2 -2
- package/src/services/store.ts +2 -2
- package/src/services/subscription.ts +2 -2
- package/src/services/tax-category.ts +2 -2
- package/src/services/type.ts +2 -2
- package/src/services/zone.ts +2 -2
- package/src/shipping.test.ts +1 -1
- package/src/shipping.ts +3 -3
- package/src/storage/abstract.ts +5 -1
- package/src/storage/in-memory.ts +6 -8
- package/src/types.ts +2 -2
- package/src/validate.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { ShoppingListRepository } from "../repositories/shopping-list";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { ShoppingListRepository } from "../repositories/shopping-list";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class MyShoppingListService extends AbstractService {
|
package/src/services/order.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Request, Response, Router } from "express";
|
|
1
|
+
import type { Request, Response, Router } from "express";
|
|
2
2
|
import { getRepositoryContext } from "../repositories/helpers";
|
|
3
|
-
import { OrderRepository } from "../repositories/order/index";
|
|
3
|
+
import type { OrderRepository } from "../repositories/order/index";
|
|
4
4
|
import AbstractService from "./abstract";
|
|
5
5
|
|
|
6
6
|
export class OrderService extends AbstractService {
|
package/src/services/payment.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { PaymentRepository } from "../repositories/payment";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { PaymentRepository } from "../repositories/payment";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class PaymentService extends AbstractService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { ProductDiscountRepository } from "../repositories/product-discount";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { ProductDiscountRepository } from "../repositories/product-discount";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class ProductDiscountService extends AbstractService {
|
|
@@ -10,7 +10,7 @@ import supertest from "supertest";
|
|
|
10
10
|
import * as timekeeper from "timekeeper";
|
|
11
11
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
12
12
|
import { CommercetoolsMock } from "../index";
|
|
13
|
-
import { Writable } from "../types";
|
|
13
|
+
import type { Writable } from "../types";
|
|
14
14
|
|
|
15
15
|
const ctMock = new CommercetoolsMock();
|
|
16
16
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Request, Response, Router } from "express";
|
|
1
|
+
import type { Request, Response, Router } from "express";
|
|
2
2
|
import { queryParamsArray, queryParamsValue } from "../helpers";
|
|
3
3
|
import { getRepositoryContext } from "../repositories/helpers";
|
|
4
|
-
import {
|
|
4
|
+
import type {
|
|
5
5
|
ProductProjectionQueryParams,
|
|
6
6
|
ProductProjectionRepository,
|
|
7
7
|
} from "./../repositories/product-projection";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { ProductSelectionRepository } from "../repositories/product-selection";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { ProductSelectionRepository } from "../repositories/product-selection";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class ProductSelectionService extends AbstractService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { ProductTypeRepository } from "../repositories/product-type";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { ProductTypeRepository } from "../repositories/product-type";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class ProductTypeService extends AbstractService {
|
package/src/services/product.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Request, Response, Router } from "express";
|
|
1
|
+
import type { Request, Response, Router } from "express";
|
|
2
2
|
import { getRepositoryContext } from "~src/repositories/helpers";
|
|
3
|
-
import { ProductRepository } from "../repositories/product";
|
|
3
|
+
import type { ProductRepository } from "../repositories/product";
|
|
4
4
|
import AbstractService from "./abstract";
|
|
5
5
|
|
|
6
6
|
export class ProductService extends AbstractService {
|
package/src/services/project.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Update } from "@commercetools/platform-sdk";
|
|
2
|
-
import { Request, Response, Router } from "express";
|
|
1
|
+
import type { Update } from "@commercetools/platform-sdk";
|
|
2
|
+
import type { Request, Response, Router } from "express";
|
|
3
3
|
import { updateRequestSchema } from "~src/schemas/update-request";
|
|
4
4
|
import { validateData } from "~src/validate";
|
|
5
5
|
import { getRepositoryContext } from "../repositories/helpers";
|
|
6
|
-
import { ProjectRepository } from "../repositories/project";
|
|
6
|
+
import type { ProjectRepository } from "../repositories/project";
|
|
7
7
|
|
|
8
8
|
export class ProjectService {
|
|
9
9
|
public repository: ProjectRepository;
|
package/src/services/reviews.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { ReviewRepository } from "../repositories/review";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { ReviewRepository } from "../repositories/review";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class ReviewService extends AbstractService {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Request, Response, Router } from "express";
|
|
1
|
+
import type { Request, Response, Router } from "express";
|
|
2
2
|
import { queryParamsValue } from "../helpers";
|
|
3
3
|
import { getRepositoryContext } from "../repositories/helpers";
|
|
4
|
-
import { ShippingMethodRepository } from "../repositories/shipping-method";
|
|
4
|
+
import type { ShippingMethodRepository } from "../repositories/shipping-method";
|
|
5
5
|
import AbstractService from "./abstract";
|
|
6
6
|
|
|
7
7
|
export class ShippingMethodService extends AbstractService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { ShoppingListRepository } from "../repositories/shopping-list";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { ShoppingListRepository } from "../repositories/shopping-list";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class ShoppingListService extends AbstractService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { StandAlonePriceRepository } from "../repositories/standalone-price";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { StandAlonePriceRepository } from "../repositories/standalone-price";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class StandAlonePriceService extends AbstractService {
|
package/src/services/state.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { StateRepository } from "../repositories/state";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { StateRepository } from "../repositories/state";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class StateService extends AbstractService {
|
package/src/services/store.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { StoreRepository } from "../repositories/store";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { StoreRepository } from "../repositories/store";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class StoreService extends AbstractService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { SubscriptionRepository } from "../repositories/subscription";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { SubscriptionRepository } from "../repositories/subscription";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class SubscriptionService extends AbstractService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { TaxCategoryRepository } from "../repositories/tax-category";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { TaxCategoryRepository } from "../repositories/tax-category";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class TaxCategoryService extends AbstractService {
|
package/src/services/type.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { TypeRepository } from "../repositories/type";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { TypeRepository } from "../repositories/type";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class TypeService extends AbstractService {
|
package/src/services/zone.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { ZoneRepository } from "../repositories/zone";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { ZoneRepository } from "../repositories/zone";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class ZoneService extends AbstractService {
|
package/src/shipping.test.ts
CHANGED
package/src/shipping.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
Cart,
|
|
3
3
|
CartValueTier,
|
|
4
4
|
InvalidOperationError,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
ShippingRatePriceTier,
|
|
7
7
|
} from "@commercetools/platform-sdk";
|
|
8
8
|
import { CommercetoolsError } from "./exceptions";
|
|
9
|
-
import { GetParams, RepositoryContext } from "./repositories/abstract";
|
|
10
|
-
import { AbstractStorage } from "./storage/abstract";
|
|
9
|
+
import type { GetParams, RepositoryContext } from "./repositories/abstract";
|
|
10
|
+
import type { AbstractStorage } from "./storage/abstract";
|
|
11
11
|
|
|
12
12
|
export const markMatchingShippingRate = (
|
|
13
13
|
cart: Cart,
|
package/src/storage/abstract.ts
CHANGED
|
@@ -4,7 +4,11 @@ import type {
|
|
|
4
4
|
QueryParam,
|
|
5
5
|
ResourceIdentifier,
|
|
6
6
|
} from "@commercetools/platform-sdk";
|
|
7
|
-
import {
|
|
7
|
+
import type {
|
|
8
|
+
PagedQueryResponseMap,
|
|
9
|
+
ResourceMap,
|
|
10
|
+
ResourceType,
|
|
11
|
+
} from "../types";
|
|
8
12
|
|
|
9
13
|
export type GetParams = {
|
|
10
14
|
expand?: string[];
|
package/src/storage/in-memory.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
InvalidJsonInputError,
|
|
3
3
|
ReferencedResourceNotFoundError,
|
|
4
4
|
ShoppingListLineItem,
|
|
5
|
+
} from "@commercetools/platform-sdk";
|
|
6
|
+
import {
|
|
5
7
|
type AssociateRole,
|
|
6
8
|
type AttributeGroup,
|
|
7
9
|
type BusinessUnit,
|
|
@@ -44,18 +46,14 @@ import { CommercetoolsError } from "~src/exceptions";
|
|
|
44
46
|
import { cloneObject } from "../helpers";
|
|
45
47
|
import { parseExpandClause } from "../lib/expandParser";
|
|
46
48
|
import { parseQueryExpression } from "../lib/predicateParser";
|
|
47
|
-
import {
|
|
49
|
+
import type {
|
|
48
50
|
PagedQueryResponseMap,
|
|
49
51
|
ResourceMap,
|
|
50
52
|
ResourceType,
|
|
51
53
|
Writable,
|
|
52
54
|
} from "../types";
|
|
53
|
-
import {
|
|
54
|
-
|
|
55
|
-
GetParams,
|
|
56
|
-
ProjectStorage,
|
|
57
|
-
QueryParams,
|
|
58
|
-
} from "./abstract";
|
|
55
|
+
import type { GetParams, ProjectStorage, QueryParams } from "./abstract";
|
|
56
|
+
import { AbstractStorage } from "./abstract";
|
|
59
57
|
|
|
60
58
|
export class InMemoryStorage extends AbstractStorage {
|
|
61
59
|
protected resources: {
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as ctp from "@commercetools/platform-sdk";
|
|
2
|
-
import { RepositoryMap } from "./repositories";
|
|
3
|
-
import AbstractService from "./services/abstract";
|
|
2
|
+
import type { RepositoryMap } from "./repositories";
|
|
3
|
+
import type AbstractService from "./services/abstract";
|
|
4
4
|
|
|
5
5
|
export const isType = <T>(x: T) => x;
|
|
6
6
|
|
package/src/validate.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InvalidJsonInputError } from "@commercetools/platform-sdk";
|
|
2
|
-
import { z } from "zod";
|
|
1
|
+
import type { InvalidJsonInputError } from "@commercetools/platform-sdk";
|
|
2
|
+
import type { z } from "zod";
|
|
3
3
|
import { fromZodError } from "zod-validation-error";
|
|
4
4
|
import { CommercetoolsError } from "./exceptions";
|
|
5
5
|
|