@labdigital/commercetools-mock 2.37.0 → 2.38.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 +211 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +211 -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 +2 -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
|
@@ -4,8 +4,9 @@ import type {
|
|
|
4
4
|
StateReference,
|
|
5
5
|
} from "@commercetools/platform-sdk";
|
|
6
6
|
import { getBaseResourceProperties } from "~src/helpers";
|
|
7
|
-
import { AbstractStorage } from "~src/storage/abstract";
|
|
8
|
-
import {
|
|
7
|
+
import type { AbstractStorage } from "~src/storage/abstract";
|
|
8
|
+
import type { RepositoryContext } from "../abstract";
|
|
9
|
+
import { AbstractResourceRepository } from "../abstract";
|
|
9
10
|
import {
|
|
10
11
|
createCentPrecisionMoney,
|
|
11
12
|
createCustomFields,
|
|
@@ -481,7 +481,7 @@ export class ProductUpdateHandler
|
|
|
481
481
|
|
|
482
482
|
const foundCategory = data.categories.find(
|
|
483
483
|
(productCategory: CategoryReference) => {
|
|
484
|
-
if (productCategory.id
|
|
484
|
+
if (productCategory.id === resolvedCategory.id) {
|
|
485
485
|
return productCategory;
|
|
486
486
|
}
|
|
487
487
|
return false;
|
|
@@ -502,7 +502,7 @@ export class ProductUpdateHandler
|
|
|
502
502
|
|
|
503
503
|
data.categories = data.categories.filter(
|
|
504
504
|
(productCategory: CategoryReference) => {
|
|
505
|
-
if (productCategory.id
|
|
505
|
+
if (productCategory.id === resolvedCategory.id) {
|
|
506
506
|
return false;
|
|
507
507
|
}
|
|
508
508
|
return true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
ChannelReference,
|
|
3
3
|
Price,
|
|
4
4
|
PriceDraft,
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
} from "@commercetools/platform-sdk";
|
|
10
10
|
import deepEqual from "deep-equal";
|
|
11
11
|
import { v4 as uuidv4 } from "uuid";
|
|
12
|
-
import { AbstractStorage } from "~src/storage";
|
|
13
|
-
import { Writable } from "~src/types";
|
|
14
|
-
import { RepositoryContext } from "../abstract";
|
|
12
|
+
import type { AbstractStorage } from "~src/storage";
|
|
13
|
+
import type { Writable } from "~src/types";
|
|
14
|
+
import type { RepositoryContext } from "../abstract";
|
|
15
15
|
import {
|
|
16
16
|
createTypedMoney,
|
|
17
17
|
getReferenceFromResourceIdentifier,
|
|
@@ -13,8 +13,9 @@ import type {
|
|
|
13
13
|
import { CommercetoolsError } from "~src/exceptions";
|
|
14
14
|
import { getBaseResourceProperties } from "~src/helpers";
|
|
15
15
|
import { ProductSearch } from "~src/product-search";
|
|
16
|
-
import { AbstractStorage } from "~src/storage/abstract";
|
|
17
|
-
import {
|
|
16
|
+
import type { AbstractStorage } from "~src/storage/abstract";
|
|
17
|
+
import type { RepositoryContext } from "../abstract";
|
|
18
|
+
import { AbstractResourceRepository } from "../abstract";
|
|
18
19
|
import { getReferenceFromResourceIdentifier } from "../helpers";
|
|
19
20
|
import { ProductUpdateHandler } from "./actions";
|
|
20
21
|
import { variantFromDraft } from "./helpers";
|
|
@@ -19,14 +19,10 @@ import type {
|
|
|
19
19
|
ProductDiscountValueRelative,
|
|
20
20
|
} from "@commercetools/platform-sdk";
|
|
21
21
|
import { getBaseResourceProperties } from "../helpers";
|
|
22
|
-
import { AbstractStorage } from "../storage/abstract";
|
|
22
|
+
import type { AbstractStorage } from "../storage/abstract";
|
|
23
23
|
import type { Writable } from "../types";
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
AbstractUpdateHandler,
|
|
27
|
-
RepositoryContext,
|
|
28
|
-
UpdateHandlerInterface,
|
|
29
|
-
} from "./abstract";
|
|
24
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "./abstract";
|
|
25
|
+
import { AbstractResourceRepository, AbstractUpdateHandler } from "./abstract";
|
|
30
26
|
import { createTypedMoney } from "./helpers";
|
|
31
27
|
|
|
32
28
|
export class ProductDiscountRepository extends AbstractResourceRepository<"product-discount"> {
|
|
@@ -9,11 +9,8 @@ import { parseQueryExpression } from "../lib/predicateParser";
|
|
|
9
9
|
import { applyPriceSelector } from "../priceSelector";
|
|
10
10
|
import { ProductProjectionSearch } from "../product-projection-search";
|
|
11
11
|
import { type AbstractStorage } from "../storage";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
GetParams,
|
|
15
|
-
RepositoryContext,
|
|
16
|
-
} from "./abstract";
|
|
12
|
+
import type { GetParams, RepositoryContext } from "./abstract";
|
|
13
|
+
import { AbstractResourceRepository } from "./abstract";
|
|
17
14
|
|
|
18
15
|
export type ProductProjectionQueryParams = {
|
|
19
16
|
staged?: boolean;
|
|
@@ -5,14 +5,10 @@ import type {
|
|
|
5
5
|
ProductSelectionUpdateAction,
|
|
6
6
|
} from "@commercetools/platform-sdk";
|
|
7
7
|
import { getBaseResourceProperties } from "../helpers";
|
|
8
|
-
import { AbstractStorage } from "../storage/abstract";
|
|
8
|
+
import type { AbstractStorage } from "../storage/abstract";
|
|
9
9
|
import type { Writable } from "../types";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
AbstractUpdateHandler,
|
|
13
|
-
RepositoryContext,
|
|
14
|
-
UpdateHandlerInterface,
|
|
15
|
-
} from "./abstract";
|
|
10
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "./abstract";
|
|
11
|
+
import { AbstractResourceRepository, AbstractUpdateHandler } from "./abstract";
|
|
16
12
|
|
|
17
13
|
export class ProductSelectionRepository extends AbstractResourceRepository<"product-selection"> {
|
|
18
14
|
constructor(storage: AbstractStorage) {
|
|
@@ -2,13 +2,9 @@ import type {
|
|
|
2
2
|
ProductTailoring,
|
|
3
3
|
ProductTailoringUpdateAction,
|
|
4
4
|
} from "@commercetools/platform-sdk";
|
|
5
|
-
import { AbstractStorage } from "~src/storage";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
AbstractUpdateHandler,
|
|
9
|
-
RepositoryContext,
|
|
10
|
-
UpdateHandlerInterface,
|
|
11
|
-
} from "./abstract";
|
|
5
|
+
import type { AbstractStorage } from "~src/storage";
|
|
6
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "./abstract";
|
|
7
|
+
import { AbstractResourceRepository, AbstractUpdateHandler } from "./abstract";
|
|
12
8
|
|
|
13
9
|
export class ProductTailoringRepository extends AbstractResourceRepository<"product-tailoring"> {
|
|
14
10
|
constructor(storage: AbstractStorage) {
|
|
@@ -13,14 +13,10 @@ import type {
|
|
|
13
13
|
ProductTypeUpdateAction,
|
|
14
14
|
} from "@commercetools/platform-sdk";
|
|
15
15
|
import { getBaseResourceProperties } from "../helpers";
|
|
16
|
-
import { AbstractStorage } from "../storage/abstract";
|
|
16
|
+
import type { AbstractStorage } from "../storage/abstract";
|
|
17
17
|
import type { Writable } from "../types";
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
AbstractUpdateHandler,
|
|
21
|
-
RepositoryContext,
|
|
22
|
-
UpdateHandlerInterface,
|
|
23
|
-
} from "./abstract";
|
|
18
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "./abstract";
|
|
19
|
+
import { AbstractResourceRepository, AbstractUpdateHandler } from "./abstract";
|
|
24
20
|
|
|
25
21
|
export class ProductTypeRepository extends AbstractResourceRepository<"product-type"> {
|
|
26
22
|
constructor(storage: AbstractStorage) {
|
|
@@ -155,15 +151,15 @@ class ProductTypeUpdateHandler
|
|
|
155
151
|
{ attributeName, keys }: ProductTypeRemoveEnumValuesAction,
|
|
156
152
|
) {
|
|
157
153
|
resource.attributes?.forEach((attr) => {
|
|
158
|
-
if (attr.name
|
|
159
|
-
if (attr.type.name
|
|
154
|
+
if (attr.name === attributeName) {
|
|
155
|
+
if (attr.type.name === "enum") {
|
|
160
156
|
attr.type.values = attr.type.values.filter(
|
|
161
157
|
(v) => !keys.includes(v.key),
|
|
162
158
|
);
|
|
163
159
|
}
|
|
164
160
|
|
|
165
|
-
if (attr.type.name
|
|
166
|
-
if (attr.type.elementType.name
|
|
161
|
+
if (attr.type.name === "set") {
|
|
162
|
+
if (attr.type.elementType.name === "enum") {
|
|
167
163
|
attr.type.elementType.values = attr.type.elementType.values.filter(
|
|
168
164
|
(v) => !keys.includes(v.key),
|
|
169
165
|
);
|
|
@@ -15,16 +15,12 @@ import type {
|
|
|
15
15
|
ProjectSetShippingRateInputTypeAction,
|
|
16
16
|
ProjectUpdateAction,
|
|
17
17
|
} from "@commercetools/platform-sdk";
|
|
18
|
-
import { ProjectSetBusinessUnitAssociateRoleOnCreationAction } from "@commercetools/platform-sdk/dist/declarations/src/generated/models/project";
|
|
18
|
+
import type { ProjectSetBusinessUnitAssociateRoleOnCreationAction } from "@commercetools/platform-sdk/dist/declarations/src/generated/models/project";
|
|
19
19
|
import { maskSecretValue } from "../lib/masking";
|
|
20
|
-
import { AbstractStorage } from "../storage/abstract";
|
|
20
|
+
import type { AbstractStorage } from "../storage/abstract";
|
|
21
21
|
import type { Writable } from "../types";
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
AbstractUpdateHandler,
|
|
25
|
-
RepositoryContext,
|
|
26
|
-
UpdateHandlerInterface,
|
|
27
|
-
} from "./abstract";
|
|
22
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "./abstract";
|
|
23
|
+
import { AbstractRepository, AbstractUpdateHandler } from "./abstract";
|
|
28
24
|
|
|
29
25
|
export class ProjectRepository extends AbstractRepository<Project> {
|
|
30
26
|
constructor(storage: AbstractStorage) {
|
|
@@ -2,8 +2,9 @@ import type {
|
|
|
2
2
|
QuoteRequest,
|
|
3
3
|
QuoteRequestDraft,
|
|
4
4
|
} from "@commercetools/platform-sdk";
|
|
5
|
-
import { AbstractStorage } from "~src/storage";
|
|
6
|
-
import {
|
|
5
|
+
import type { AbstractStorage } from "~src/storage";
|
|
6
|
+
import type { RepositoryContext } from "./abstract";
|
|
7
|
+
import { AbstractResourceRepository } from "./abstract";
|
|
7
8
|
|
|
8
9
|
export class QuoteRequestRepository extends AbstractResourceRepository<"quote-request"> {
|
|
9
10
|
constructor(storage: AbstractStorage) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Quote, QuoteDraft } from "@commercetools/platform-sdk";
|
|
2
|
-
import { AbstractStorage } from "~src/storage";
|
|
3
|
-
import {
|
|
2
|
+
import type { AbstractStorage } from "~src/storage";
|
|
3
|
+
import type { RepositoryContext } from "./abstract";
|
|
4
|
+
import { AbstractResourceRepository } from "./abstract";
|
|
4
5
|
|
|
5
6
|
export class QuoteRepository extends AbstractResourceRepository<"quote"> {
|
|
6
7
|
constructor(storage: AbstractStorage) {
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
ChannelReference,
|
|
3
3
|
ProductReference,
|
|
4
|
+
} from "@commercetools/platform-sdk";
|
|
5
|
+
import {
|
|
4
6
|
type Review,
|
|
5
7
|
type ReviewDraft,
|
|
6
8
|
type StateReference,
|
|
7
9
|
} from "@commercetools/platform-sdk";
|
|
8
|
-
import { AbstractStorage } from "~src/storage";
|
|
10
|
+
import type { AbstractStorage } from "~src/storage";
|
|
9
11
|
import { getBaseResourceProperties } from "../helpers";
|
|
10
|
-
import {
|
|
12
|
+
import type { RepositoryContext } from "./abstract";
|
|
13
|
+
import { AbstractResourceRepository } from "./abstract";
|
|
11
14
|
import {
|
|
12
15
|
createCustomFields,
|
|
13
16
|
getReferenceFromResourceIdentifier,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
ShippingMethodChangeTaxCategoryAction,
|
|
3
3
|
ShippingMethodRemoveShippingRateAction,
|
|
4
|
+
} from "@commercetools/platform-sdk";
|
|
5
|
+
import {
|
|
4
6
|
type ShippingMethod,
|
|
5
7
|
type ShippingMethodAddShippingRateAction,
|
|
6
8
|
type ShippingMethodAddZoneAction,
|
|
@@ -20,11 +22,8 @@ import {
|
|
|
20
22
|
} from "@commercetools/platform-sdk";
|
|
21
23
|
import deepEqual from "deep-equal";
|
|
22
24
|
import type { Writable } from "~src/types";
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
RepositoryContext,
|
|
26
|
-
UpdateHandlerInterface,
|
|
27
|
-
} from "../abstract";
|
|
25
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "../abstract";
|
|
26
|
+
import { AbstractUpdateHandler } from "../abstract";
|
|
28
27
|
import {
|
|
29
28
|
createCustomFields,
|
|
30
29
|
getReferenceFromResourceIdentifier,
|
|
@@ -7,12 +7,9 @@ import {
|
|
|
7
7
|
} from "@commercetools/platform-sdk";
|
|
8
8
|
import { getBaseResourceProperties } from "../../helpers";
|
|
9
9
|
import { getShippingMethodsMatchingCart } from "../../shipping";
|
|
10
|
-
import { AbstractStorage } from "../../storage/abstract";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
GetParams,
|
|
14
|
-
RepositoryContext,
|
|
15
|
-
} from "../abstract";
|
|
10
|
+
import type { AbstractStorage } from "../../storage/abstract";
|
|
11
|
+
import type { GetParams, RepositoryContext } from "../abstract";
|
|
12
|
+
import { AbstractResourceRepository } from "../abstract";
|
|
16
13
|
import {
|
|
17
14
|
createCustomFields,
|
|
18
15
|
getReferenceFromResourceIdentifier,
|
|
@@ -21,12 +21,9 @@ import type {
|
|
|
21
21
|
} from "@commercetools/platform-sdk";
|
|
22
22
|
import { v4 as uuidv4 } from "uuid";
|
|
23
23
|
import { CommercetoolsError } from "~src/exceptions";
|
|
24
|
-
import { Writable } from "../../types";
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
RepositoryContext,
|
|
28
|
-
UpdateHandlerInterface,
|
|
29
|
-
} from "../abstract";
|
|
24
|
+
import type { Writable } from "../../types";
|
|
25
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "../abstract";
|
|
26
|
+
import { AbstractUpdateHandler } from "../abstract";
|
|
30
27
|
|
|
31
28
|
export class ShoppingListUpdateHandler
|
|
32
29
|
extends AbstractUpdateHandler
|
|
@@ -7,9 +7,10 @@ import type {
|
|
|
7
7
|
ShoppingListLineItem,
|
|
8
8
|
} from "@commercetools/platform-sdk";
|
|
9
9
|
import { getBaseResourceProperties } from "../../helpers";
|
|
10
|
-
import { AbstractStorage } from "../../storage/abstract";
|
|
11
|
-
import { Writable } from "../../types";
|
|
12
|
-
import {
|
|
10
|
+
import type { AbstractStorage } from "../../storage/abstract";
|
|
11
|
+
import type { Writable } from "../../types";
|
|
12
|
+
import type { RepositoryContext } from "../abstract";
|
|
13
|
+
import { AbstractResourceRepository } from "../abstract";
|
|
13
14
|
import {
|
|
14
15
|
createCustomFields,
|
|
15
16
|
getReferenceFromResourceIdentifier,
|
|
@@ -2,8 +2,9 @@ import type {
|
|
|
2
2
|
StagedQuote,
|
|
3
3
|
StagedQuoteDraft,
|
|
4
4
|
} from "@commercetools/platform-sdk";
|
|
5
|
-
import { AbstractStorage } from "~src/storage";
|
|
6
|
-
import {
|
|
5
|
+
import type { AbstractStorage } from "~src/storage";
|
|
6
|
+
import type { RepositoryContext } from "./abstract";
|
|
7
|
+
import { AbstractResourceRepository } from "./abstract";
|
|
7
8
|
|
|
8
9
|
export class StagedQuoteRepository extends AbstractResourceRepository<"staged-quote"> {
|
|
9
10
|
constructor(storage: AbstractStorage) {
|
|
@@ -10,14 +10,10 @@ import type {
|
|
|
10
10
|
StandalonePriceUpdateAction,
|
|
11
11
|
} from "@commercetools/platform-sdk";
|
|
12
12
|
import { getBaseResourceProperties } from "../helpers";
|
|
13
|
-
import { AbstractStorage } from "../storage/abstract";
|
|
13
|
+
import type { AbstractStorage } from "../storage/abstract";
|
|
14
14
|
import type { Writable } from "../types";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
AbstractUpdateHandler,
|
|
18
|
-
RepositoryContext,
|
|
19
|
-
UpdateHandlerInterface,
|
|
20
|
-
} from "./abstract";
|
|
15
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "./abstract";
|
|
16
|
+
import { AbstractResourceRepository, AbstractUpdateHandler } from "./abstract";
|
|
21
17
|
import { createTypedMoney } from "./helpers";
|
|
22
18
|
|
|
23
19
|
export class StandAlonePriceRepository extends AbstractResourceRepository<"standalone-price"> {
|
|
@@ -14,14 +14,10 @@ import type {
|
|
|
14
14
|
StateUpdateAction,
|
|
15
15
|
} from "@commercetools/platform-sdk";
|
|
16
16
|
import { getBaseResourceProperties } from "../helpers";
|
|
17
|
-
import { AbstractStorage } from "../storage/abstract";
|
|
17
|
+
import type { AbstractStorage } from "../storage/abstract";
|
|
18
18
|
import type { Writable } from "../types";
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
AbstractUpdateHandler,
|
|
22
|
-
RepositoryContext,
|
|
23
|
-
UpdateHandlerInterface,
|
|
24
|
-
} from "./abstract";
|
|
19
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "./abstract";
|
|
20
|
+
import { AbstractResourceRepository, AbstractUpdateHandler } from "./abstract";
|
|
25
21
|
import { getReferenceFromResourceIdentifier } from "./helpers";
|
|
26
22
|
|
|
27
23
|
export class StateRepository extends AbstractResourceRepository<"state"> {
|
|
@@ -12,14 +12,10 @@ import type {
|
|
|
12
12
|
StoreUpdateAction,
|
|
13
13
|
} from "@commercetools/platform-sdk";
|
|
14
14
|
import { getBaseResourceProperties } from "../helpers";
|
|
15
|
-
import { AbstractStorage } from "../storage/abstract";
|
|
15
|
+
import type { AbstractStorage } from "../storage/abstract";
|
|
16
16
|
import type { Writable } from "../types";
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
AbstractUpdateHandler,
|
|
20
|
-
RepositoryContext,
|
|
21
|
-
UpdateHandlerInterface,
|
|
22
|
-
} from "./abstract";
|
|
17
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "./abstract";
|
|
18
|
+
import { AbstractResourceRepository, AbstractUpdateHandler } from "./abstract";
|
|
23
19
|
import {
|
|
24
20
|
createCustomFields,
|
|
25
21
|
getReferenceFromResourceIdentifier,
|
|
@@ -7,14 +7,10 @@ import type {
|
|
|
7
7
|
} from "@commercetools/platform-sdk";
|
|
8
8
|
import { CommercetoolsError } from "~src/exceptions";
|
|
9
9
|
import { getBaseResourceProperties } from "../helpers";
|
|
10
|
-
import { AbstractStorage } from "../storage/abstract";
|
|
11
|
-
import { Writable } from "../types";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
AbstractUpdateHandler,
|
|
15
|
-
RepositoryContext,
|
|
16
|
-
UpdateHandlerInterface,
|
|
17
|
-
} from "./abstract";
|
|
10
|
+
import type { AbstractStorage } from "../storage/abstract";
|
|
11
|
+
import type { Writable } from "../types";
|
|
12
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "./abstract";
|
|
13
|
+
import { AbstractResourceRepository, AbstractUpdateHandler } from "./abstract";
|
|
18
14
|
|
|
19
15
|
export class SubscriptionRepository extends AbstractResourceRepository<"subscription"> {
|
|
20
16
|
constructor(storage: AbstractStorage) {
|
|
@@ -9,7 +9,8 @@ import type {
|
|
|
9
9
|
TaxCategoryUpdateAction,
|
|
10
10
|
} from "@commercetools/platform-sdk";
|
|
11
11
|
import type { Writable } from "~src/types";
|
|
12
|
-
import {
|
|
12
|
+
import type { RepositoryContext } from "../abstract";
|
|
13
|
+
import { AbstractUpdateHandler } from "../abstract";
|
|
13
14
|
import { taxRateFromTaxRateDraft } from "./helpers";
|
|
14
15
|
|
|
15
16
|
type TaxCategoryUpdateHandlerMethod<T> = (
|
|
@@ -3,8 +3,9 @@ import type {
|
|
|
3
3
|
TaxCategoryDraft,
|
|
4
4
|
} from "@commercetools/platform-sdk";
|
|
5
5
|
import { getBaseResourceProperties } from "~src/helpers";
|
|
6
|
-
import { AbstractStorage } from "~src/storage/abstract";
|
|
7
|
-
import {
|
|
6
|
+
import type { AbstractStorage } from "~src/storage/abstract";
|
|
7
|
+
import type { RepositoryContext } from "../abstract";
|
|
8
|
+
import { AbstractResourceRepository } from "../abstract";
|
|
8
9
|
import { TaxCategoryUpdateHandler } from "./actions";
|
|
9
10
|
import { taxRateFromTaxRateDraft } from "./helpers";
|
|
10
11
|
|
|
@@ -14,7 +14,8 @@ import type {
|
|
|
14
14
|
import isEqual from "lodash.isequal";
|
|
15
15
|
import { CommercetoolsError } from "~src/exceptions";
|
|
16
16
|
import type { Writable } from "~src/types";
|
|
17
|
-
import {
|
|
17
|
+
import type { RepositoryContext } from "../abstract";
|
|
18
|
+
import { AbstractUpdateHandler } from "../abstract";
|
|
18
19
|
|
|
19
20
|
type TypeUpdateHandlerMethod<T> = (
|
|
20
21
|
context: RepositoryContext,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Type, TypeDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import { getBaseResourceProperties } from "~src/helpers";
|
|
3
|
-
import { AbstractStorage } from "~src/storage/abstract";
|
|
4
|
-
import {
|
|
3
|
+
import type { AbstractStorage } from "~src/storage/abstract";
|
|
4
|
+
import type { RepositoryContext } from "../abstract";
|
|
5
|
+
import { AbstractResourceRepository } from "../abstract";
|
|
5
6
|
import { TypeUpdateHandler } from "./actions";
|
|
6
7
|
|
|
7
8
|
export class TypeRepository extends AbstractResourceRepository<"type"> {
|
package/src/repositories/zone.ts
CHANGED
|
@@ -9,14 +9,10 @@ import type {
|
|
|
9
9
|
ZoneUpdateAction,
|
|
10
10
|
} from "@commercetools/platform-sdk";
|
|
11
11
|
import { getBaseResourceProperties } from "../helpers";
|
|
12
|
-
import { AbstractStorage } from "../storage/abstract";
|
|
12
|
+
import type { AbstractStorage } from "../storage/abstract";
|
|
13
13
|
import type { Writable } from "../types";
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
AbstractUpdateHandler,
|
|
17
|
-
RepositoryContext,
|
|
18
|
-
UpdateHandlerInterface,
|
|
19
|
-
} from "./abstract";
|
|
14
|
+
import type { RepositoryContext, UpdateHandlerInterface } from "./abstract";
|
|
15
|
+
import { AbstractResourceRepository, AbstractUpdateHandler } from "./abstract";
|
|
20
16
|
|
|
21
17
|
export class ZoneRepository extends AbstractResourceRepository<"zone"> {
|
|
22
18
|
constructor(storage: AbstractStorage) {
|
package/src/services/abstract.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Update } from "@commercetools/platform-sdk";
|
|
2
2
|
import { Router, type Request, type Response } from "express";
|
|
3
|
-
import { ParsedQs } from "qs";
|
|
3
|
+
import type { ParsedQs } from "qs";
|
|
4
4
|
import { updateRequestSchema } from "~src/schemas/update-request";
|
|
5
5
|
import { validateData } from "~src/validate";
|
|
6
6
|
import { queryParamsArray } from "../helpers";
|
|
7
|
-
import {
|
|
7
|
+
import type {
|
|
8
8
|
AbstractResourceRepository,
|
|
9
9
|
QueryParams,
|
|
10
10
|
} from "../repositories/abstract";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssociateRole } from "@commercetools/platform-sdk";
|
|
1
|
+
import type { AssociateRole } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
4
4
|
import { CommercetoolsMock } from "../ctMock";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { AssociateRoleRepository } from "../repositories/associate-role";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { AssociateRoleRepository } from "../repositories/associate-role";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class AssociateRoleServices extends AbstractService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { AttributeGroupRepository } from "../repositories/attribute-group";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { AttributeGroupRepository } from "../repositories/attribute-group";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class AttributeGroupService extends AbstractService {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BusinessUnit } from "@commercetools/platform-sdk";
|
|
1
|
+
import type { BusinessUnit } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
4
4
|
import { CommercetoolsMock } from "../ctMock";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { BusinessUnitRepository } from "../repositories/business-unit";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { BusinessUnitRepository } from "../repositories/business-unit";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class BusinessUnitServices extends AbstractService {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CartDiscount, TypeDraft } from "@commercetools/platform-sdk";
|
|
1
|
+
import type { CartDiscount, TypeDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import assert from "assert";
|
|
3
3
|
import supertest from "supertest";
|
|
4
4
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { CartDiscountRepository } from "../repositories/cart-discount";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { CartDiscountRepository } from "../repositories/cart-discount";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class CartDiscountService extends AbstractService {
|
package/src/services/category.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { CategoryRepository } from "../repositories/category/index";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { CategoryRepository } from "../repositories/category/index";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class CategoryServices extends AbstractService {
|
package/src/services/channel.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { ChannelRepository } from "../repositories/channel";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { ChannelRepository } from "../repositories/channel";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class ChannelService extends AbstractService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { CustomerGroupRepository } from "../repositories/customer-group";
|
|
1
|
+
import type { Router } from "express";
|
|
2
|
+
import type { CustomerGroupRepository } from "../repositories/customer-group";
|
|
3
3
|
import AbstractService from "./abstract";
|
|
4
4
|
|
|
5
5
|
export class CustomerGroupService extends AbstractService {
|