@reactionary/provider-commercetools 0.2.3 → 0.2.5

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/core/client.js CHANGED
@@ -11,7 +11,7 @@ import * as crypto from "crypto";
11
11
  import createDebug from "debug";
12
12
  import { RequestContextTokenCache } from "./token-cache.js";
13
13
  const debug = createDebug("reactionary:commercetools");
14
- class CommercetoolsClient {
14
+ class CommercetoolsAPI {
15
15
  constructor(config, context) {
16
16
  this.config = config;
17
17
  this.context = context;
@@ -235,5 +235,5 @@ class CommercetoolsClient {
235
235
  }
236
236
  }
237
237
  export {
238
- CommercetoolsClient
238
+ CommercetoolsAPI
239
239
  };
@@ -18,19 +18,19 @@ import {
18
18
  CommercetoolsProfileProvider,
19
19
  CommercetoolsStoreProvider
20
20
  } from "../providers/index.js";
21
- import { CommercetoolsClient } from "./client.js";
21
+ import { CommercetoolsAPI } from "./client.js";
22
22
  function withCommercetoolsCapabilities(configuration, capabilities) {
23
23
  return (cache, context) => {
24
24
  const client = {};
25
25
  const config = CommercetoolsConfigurationSchema.parse(configuration);
26
26
  const caps = CommercetoolsCapabilitiesSchema.parse(capabilities);
27
- const commercetoolsClient = new CommercetoolsClient(config, context);
27
+ const commercetoolsApi = new CommercetoolsAPI(config, context);
28
28
  if (caps.product) {
29
29
  client.product = new CommercetoolsProductProvider(
30
30
  config,
31
31
  cache,
32
32
  context,
33
- commercetoolsClient
33
+ commercetoolsApi
34
34
  );
35
35
  }
36
36
  if (caps.profile) {
@@ -38,7 +38,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
38
38
  config,
39
39
  cache,
40
40
  context,
41
- commercetoolsClient
41
+ commercetoolsApi
42
42
  );
43
43
  }
44
44
  if (caps.productSearch) {
@@ -46,7 +46,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
46
46
  config,
47
47
  cache,
48
48
  context,
49
- commercetoolsClient
49
+ commercetoolsApi
50
50
  );
51
51
  }
52
52
  if (caps.identity) {
@@ -54,7 +54,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
54
54
  config,
55
55
  cache,
56
56
  context,
57
- commercetoolsClient
57
+ commercetoolsApi
58
58
  );
59
59
  }
60
60
  if (caps.cart) {
@@ -62,7 +62,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
62
62
  config,
63
63
  cache,
64
64
  context,
65
- commercetoolsClient
65
+ commercetoolsApi
66
66
  );
67
67
  }
68
68
  if (caps.inventory) {
@@ -70,7 +70,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
70
70
  config,
71
71
  cache,
72
72
  context,
73
- commercetoolsClient
73
+ commercetoolsApi
74
74
  );
75
75
  }
76
76
  if (caps.price) {
@@ -78,7 +78,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
78
78
  config,
79
79
  cache,
80
80
  context,
81
- commercetoolsClient
81
+ commercetoolsApi
82
82
  );
83
83
  }
84
84
  if (caps.category) {
@@ -86,7 +86,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
86
86
  config,
87
87
  cache,
88
88
  context,
89
- commercetoolsClient
89
+ commercetoolsApi
90
90
  );
91
91
  }
92
92
  if (caps.checkout) {
@@ -94,7 +94,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
94
94
  config,
95
95
  cache,
96
96
  context,
97
- commercetoolsClient
97
+ commercetoolsApi
98
98
  );
99
99
  }
100
100
  if (caps.store) {
@@ -102,7 +102,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
102
102
  config,
103
103
  cache,
104
104
  context,
105
- commercetoolsClient
105
+ commercetoolsApi
106
106
  );
107
107
  }
108
108
  if (caps.order) {
@@ -110,7 +110,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
110
110
  config,
111
111
  cache,
112
112
  context,
113
- commercetoolsClient
113
+ commercetoolsApi
114
114
  );
115
115
  }
116
116
  if (caps.orderSearch) {
@@ -118,7 +118,7 @@ function withCommercetoolsCapabilities(configuration, capabilities) {
118
118
  config,
119
119
  cache,
120
120
  context,
121
- commercetoolsClient
121
+ commercetoolsApi
122
122
  );
123
123
  }
124
124
  return client;
@@ -1,11 +1,12 @@
1
1
  import { CommercetoolsSessionSchema } from "../schema/session.schema.js";
2
+ const PROVIDER_COMMERCETOOLS_SESSION_KEY = "PROVIDER_COMMERCETOOLS";
2
3
  class RequestContextTokenCache {
3
4
  constructor(context) {
4
5
  this.context = context;
5
6
  }
6
7
  async get(tokenCacheOptions) {
7
8
  const session = CommercetoolsSessionSchema.parse(
8
- this.context.session["PROVIDER_COMMERCETOOLS"] || {}
9
+ this.context.session[PROVIDER_COMMERCETOOLS_SESSION_KEY] || {}
9
10
  );
10
11
  if (!session) {
11
12
  return {
@@ -22,14 +23,15 @@ class RequestContextTokenCache {
22
23
  }
23
24
  async set(cache, tokenCacheOptions) {
24
25
  const session = CommercetoolsSessionSchema.parse(
25
- this.context.session["PROVIDER_COMMERCETOOLS"] || {}
26
+ this.context.session[PROVIDER_COMMERCETOOLS_SESSION_KEY] || {}
26
27
  );
27
- this.context.session["PROVIDER_COMMERCETOOLS"] = session;
28
+ this.context.session[PROVIDER_COMMERCETOOLS_SESSION_KEY] = session;
28
29
  session.refreshToken = cache.refreshToken;
29
30
  session.token = cache.token;
30
31
  session.expirationTime = cache.expirationTime;
31
32
  }
32
33
  }
33
34
  export {
35
+ PROVIDER_COMMERCETOOLS_SESSION_KEY,
34
36
  RequestContextTokenCache
35
37
  };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@reactionary/provider-commercetools",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "dependencies": {
7
- "@reactionary/core": "0.2.3",
7
+ "@reactionary/core": "0.2.5",
8
8
  "debug": "^4.4.3",
9
9
  "zod": "4.1.9",
10
10
  "@commercetools/ts-client": "^4.2.1",
@@ -30,10 +30,10 @@ import {
30
30
  } from "@reactionary/core";
31
31
  import { CommercetoolsCartIdentifierSchema } from "../schema/commercetools.schema.js";
32
32
  class CommercetoolsCartProvider extends CartProvider {
33
- constructor(config, cache, context, client) {
33
+ constructor(config, cache, context, commercetools) {
34
34
  super(cache, context);
35
35
  this.config = config;
36
- this.client = client;
36
+ this.commercetools = commercetools;
37
37
  }
38
38
  async getById(payload) {
39
39
  const client = await this.getClient();
@@ -229,7 +229,7 @@ class CommercetoolsCartProvider extends CartProvider {
229
229
  * In the future, maybe we can delay this upgrade until we actually need it.
230
230
  */
231
231
  async getClient() {
232
- const client = await this.client.getClient();
232
+ const client = await this.commercetools.getClient();
233
233
  const clientWithProject = client.withProjectKey({
234
234
  projectKey: this.config.projectKey
235
235
  });
@@ -24,13 +24,13 @@ import {
24
24
  } from "@reactionary/core";
25
25
  import z from "zod";
26
26
  class CommercetoolsCategoryProvider extends CategoryProvider {
27
- constructor(config, cache, context, client) {
27
+ constructor(config, cache, context, commercetools) {
28
28
  super(cache, context);
29
29
  this.config = config;
30
- this.client = client;
30
+ this.commercetools = commercetools;
31
31
  }
32
32
  async getClient() {
33
- const client = await this.client.getClient();
33
+ const client = await this.commercetools.getClient();
34
34
  return client.withProjectKey({ projectKey: this.config.projectKey }).categories();
35
35
  }
36
36
  async getById(payload) {
@@ -42,13 +42,13 @@ class CheckoutNotReadyForFinalizationError extends Error {
42
42
  }
43
43
  }
44
44
  class CommercetoolsCheckoutProvider extends CheckoutProvider {
45
- constructor(config, cache, context, client) {
45
+ constructor(config, cache, context, commercetools) {
46
46
  super(cache, context);
47
47
  this.config = config;
48
- this.client = client;
48
+ this.commercetools = commercetools;
49
49
  }
50
50
  async getClient() {
51
- const client = await this.client.getClient();
51
+ const client = await this.commercetools.getClient();
52
52
  return {
53
53
  payments: client.withProjectKey({ projectKey: this.config.projectKey }).me().payments(),
54
54
  carts: client.withProjectKey({ projectKey: this.config.projectKey }).me().carts(),
@@ -19,28 +19,28 @@ import {
19
19
  success
20
20
  } from "@reactionary/core";
21
21
  class CommercetoolsIdentityProvider extends IdentityProvider {
22
- constructor(config, cache, context, client) {
22
+ constructor(config, cache, context, commercetools) {
23
23
  super(cache, context);
24
24
  this.config = config;
25
- this.client = client;
25
+ this.commercetools = commercetools;
26
26
  }
27
27
  async getSelf(payload) {
28
- const identity = await this.client.introspect();
28
+ const identity = await this.commercetools.introspect();
29
29
  return success(identity);
30
30
  }
31
31
  async login(payload) {
32
- const identity = await this.client.login(
32
+ const identity = await this.commercetools.login(
33
33
  payload.username,
34
34
  payload.password
35
35
  );
36
36
  return success(identity);
37
37
  }
38
38
  async logout(payload) {
39
- const identity = await this.client.logout();
39
+ const identity = await this.commercetools.logout();
40
40
  return success(identity);
41
41
  }
42
42
  async register(payload) {
43
- const identity = await this.client.register(
43
+ const identity = await this.commercetools.register(
44
44
  payload.username,
45
45
  payload.password
46
46
  );
@@ -11,13 +11,13 @@ var __decorateClass = (decorators, target, key, kind) => {
11
11
  };
12
12
  import { InventoryProvider, InventoryQueryBySKUSchema, InventorySchema, Reactionary, success, error } from "@reactionary/core";
13
13
  class CommercetoolsInventoryProvider extends InventoryProvider {
14
- constructor(config, cache, context, client) {
14
+ constructor(config, cache, context, commercetools) {
15
15
  super(cache, context);
16
16
  this.config = config;
17
- this.client = client;
17
+ this.commercetools = commercetools;
18
18
  }
19
19
  async getClient() {
20
- const client = await this.client.getClient();
20
+ const client = await this.commercetools.getClient();
21
21
  return client.withProjectKey({ projectKey: this.config.projectKey });
22
22
  }
23
23
  async getBySKU(payload) {
@@ -19,13 +19,13 @@ import {
19
19
  import createDebug from "debug";
20
20
  const debug = createDebug("reactionary:commercetools:order-search");
21
21
  class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
22
- constructor(config, cache, context, client) {
22
+ constructor(config, cache, context, commercetools) {
23
23
  super(cache, context);
24
24
  this.config = config;
25
- this.client = client;
25
+ this.commercetools = commercetools;
26
26
  }
27
27
  async getClient() {
28
- const client = await this.client.getClient();
28
+ const client = await this.commercetools.getClient();
29
29
  return client.withProjectKey({ projectKey: this.config.projectKey }).me().orders();
30
30
  }
31
31
  async queryByTerm(payload) {
@@ -12,13 +12,13 @@ var __decorateClass = (decorators, target, key, kind) => {
12
12
  import { OrderProvider, OrderQueryByIdSchema, OrderSchema, Reactionary, success, error } from "@reactionary/core";
13
13
  import {} from "../schema/commercetools.schema.js";
14
14
  class CommercetoolsOrderProvider extends OrderProvider {
15
- constructor(config, cache, context, client) {
15
+ constructor(config, cache, context, commercetools) {
16
16
  super(cache, context);
17
17
  this.config = config;
18
- this.client = client;
18
+ this.commercetools = commercetools;
19
19
  }
20
20
  async getClient() {
21
- const client = await this.client.getClient();
21
+ const client = await this.commercetools.getClient();
22
22
  return client.withProjectKey({ projectKey: this.config.projectKey }).me().orders();
23
23
  }
24
24
  async getById(payload) {
@@ -18,10 +18,10 @@ import {
18
18
  success
19
19
  } from "@reactionary/core";
20
20
  class CommercetoolsPriceProvider extends PriceProvider {
21
- constructor(config, cache, context, client) {
21
+ constructor(config, cache, context, commercetools) {
22
22
  super(cache, context);
23
23
  this.config = config;
24
- this.client = client;
24
+ this.commercetools = commercetools;
25
25
  }
26
26
  async getCustomerPrice(payload) {
27
27
  const client = await this.getClient();
@@ -66,7 +66,7 @@ class CommercetoolsPriceProvider extends PriceProvider {
66
66
  return success(this.parseSingle(sku));
67
67
  }
68
68
  async getClient() {
69
- const client = await this.client.getClient();
69
+ const client = await this.commercetools.getClient();
70
70
  return client.withProjectKey({ projectKey: this.config.projectKey });
71
71
  }
72
72
  parseSingle(_body, options = { includeDiscounts: false }) {
@@ -99,7 +99,7 @@ class CommercetoolsPriceProvider extends PriceProvider {
99
99
  return result;
100
100
  }
101
101
  async getChannels() {
102
- const adminClient = await this.client.getAdminClient();
102
+ const adminClient = await this.commercetools.getAdminClient();
103
103
  const offerPriceChannelPromise = adminClient.withProjectKey({ projectKey: this.config.projectKey }).channels().withKey({ key: "Offer Price" }).get().execute();
104
104
  const listPriceChannelPromise = adminClient.withProjectKey({ projectKey: this.config.projectKey }).channels().withKey({ key: "List Price" }).get().execute();
105
105
  const [offerChannel, listChannel] = await Promise.all([
@@ -30,13 +30,13 @@ import createDebug from "debug";
30
30
  import { CommercetoolsCategoryLookupSchema, CommercetoolsResolveCategoryQueryByIdSchema, CommercetoolsResolveCategoryQueryByKeySchema } from "../schema/commercetools.schema.js";
31
31
  const debug = createDebug("reactionary:commercetools:search");
32
32
  class CommercetoolsSearchProvider extends ProductSearchProvider {
33
- constructor(config, cache, context, client) {
33
+ constructor(config, cache, context, commercetools) {
34
34
  super(cache, context);
35
35
  this.config = config;
36
- this.client = client;
36
+ this.commercetools = commercetools;
37
37
  }
38
38
  async getClient() {
39
- const client = await this.client.getClient();
39
+ const client = await this.commercetools.getClient();
40
40
  return client.withProjectKey({ projectKey: this.config.projectKey }).products();
41
41
  }
42
42
  async getFacetQuery(payload, selectedFacetValue) {
@@ -58,7 +58,7 @@ class CommercetoolsSearchProvider extends ProductSearchProvider {
58
58
  };
59
59
  }
60
60
  async resolveCategoryFromId(payload) {
61
- const client = (await this.client.getClient()).withProjectKey({ projectKey: this.config.projectKey });
61
+ const client = (await this.commercetools.getClient()).withProjectKey({ projectKey: this.config.projectKey });
62
62
  const response = await client.categories().withId({ ID: payload.id }).get().execute();
63
63
  if (!response.body || !response.body.name) {
64
64
  throw new Error(`Category with ID ${payload.id} not found`);
@@ -78,7 +78,7 @@ class CommercetoolsSearchProvider extends ProductSearchProvider {
78
78
  return result;
79
79
  }
80
80
  async resolveCategoryFromKey(payload) {
81
- const client = (await this.client.getClient()).withProjectKey({ projectKey: this.config.projectKey });
81
+ const client = (await this.commercetools.getClient()).withProjectKey({ projectKey: this.config.projectKey });
82
82
  const response = await client.categories().withKey({ key: payload.key }).get().execute();
83
83
  if (!response.body || !response.body.name) {
84
84
  throw new Error(`Category with key ${payload.key} not found`);
@@ -25,13 +25,13 @@ import {
25
25
  error
26
26
  } from "@reactionary/core";
27
27
  class CommercetoolsProductProvider extends ProductProvider {
28
- constructor(config, cache, context, client) {
28
+ constructor(config, cache, context, commercetools) {
29
29
  super(cache, context);
30
30
  this.config = config;
31
- this.client = client;
31
+ this.commercetools = commercetools;
32
32
  }
33
33
  async getClient() {
34
- const client = await this.client.getClient();
34
+ const client = await this.commercetools.getClient();
35
35
  return client.withProjectKey({ projectKey: this.config.projectKey }).productProjections();
36
36
  }
37
37
  async getById(payload) {
@@ -21,13 +21,13 @@ import {
21
21
  ProfileMutationAddShippingAddressSchema
22
22
  } from "@reactionary/core";
23
23
  class CommercetoolsProfileProvider extends ProfileProvider {
24
- constructor(config, cache, context, client) {
24
+ constructor(config, cache, context, commercetools) {
25
25
  super(cache, context);
26
26
  this.config = config;
27
- this.client = client;
27
+ this.commercetools = commercetools;
28
28
  }
29
29
  async getClient() {
30
- const client = await this.client.getClient();
30
+ const client = await this.commercetools.getClient();
31
31
  return client.withProjectKey({ projectKey: this.config.projectKey });
32
32
  }
33
33
  async getById(payload) {
@@ -12,13 +12,13 @@ var __decorateClass = (decorators, target, key, kind) => {
12
12
  import { Reactionary, StoreProvider, StoreQueryByProximitySchema, StoreSchema, success, error } from "@reactionary/core";
13
13
  import z from "zod";
14
14
  class CommercetoolsStoreProvider extends StoreProvider {
15
- constructor(config, cache, context, client) {
15
+ constructor(config, cache, context, commercetools) {
16
16
  super(cache, context);
17
17
  this.config = config;
18
- this.client = client;
18
+ this.commercetools = commercetools;
19
19
  }
20
20
  async getClient() {
21
- const client = await this.client.getClient();
21
+ const client = await this.commercetools.getClient();
22
22
  return client.withProjectKey({ projectKey: this.config.projectKey });
23
23
  }
24
24
  async queryByProximity(payload) {
@@ -3,7 +3,7 @@ import { type ApiRoot } from '@commercetools/platform-sdk';
3
3
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
4
4
  import { type AnonymousIdentity, type GuestIdentity, type RegisteredIdentity, type RequestContext } from '@reactionary/core';
5
5
  import { RequestContextTokenCache } from './token-cache.js';
6
- export declare class CommercetoolsClient {
6
+ export declare class CommercetoolsAPI {
7
7
  protected config: CommercetoolsConfiguration;
8
8
  protected context: RequestContext;
9
9
  protected cache: RequestContextTokenCache;
@@ -1,5 +1,6 @@
1
1
  import type { TokenCache, TokenCacheOptions, TokenStore } from "@commercetools/ts-client";
2
2
  import type { RequestContext } from "@reactionary/core";
3
+ export declare const PROVIDER_COMMERCETOOLS_SESSION_KEY = "PROVIDER_COMMERCETOOLS";
3
4
  export declare class RequestContextTokenCache implements TokenCache {
4
5
  protected context: RequestContext;
5
6
  constructor(context: RequestContext);
@@ -2,11 +2,11 @@ import { CartProvider } from '@reactionary/core';
2
2
  import type { CartItem, CartMutationItemAdd, CartMutationItemQuantityChange, CartMutationItemRemove, CartQueryById, CartIdentifier, CartMutationApplyCoupon, CartMutationDeleteCart, CartMutationRemoveCoupon, CartMutationChangeCurrency, RequestContext, Cart, Cache, Result, NotFoundError } from '@reactionary/core';
3
3
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
4
4
  import type { Cart as CTCart, LineItem, MyCartUpdateAction } from '@commercetools/platform-sdk';
5
- import type { CommercetoolsClient } from '../core/client.js';
5
+ import type { CommercetoolsAPI } from '../core/client.js';
6
6
  export declare class CommercetoolsCartProvider extends CartProvider {
7
7
  protected config: CommercetoolsConfiguration;
8
- protected client: CommercetoolsClient;
9
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
8
+ protected commercetools: CommercetoolsAPI;
9
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
10
10
  getById(payload: CartQueryById): Promise<Result<Cart, NotFoundError>>;
11
11
  add(payload: CartMutationItemAdd): Promise<Result<Cart>>;
12
12
  remove(payload: CartMutationItemRemove): Promise<Result<Cart>>;
@@ -2,11 +2,11 @@ import { CategoryProvider } from '@reactionary/core';
2
2
  import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext, Cache, Category, Result, NotFoundError } from '@reactionary/core';
3
3
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
4
4
  import type { ByProjectKeyCategoriesRequestBuilder } from '@commercetools/platform-sdk';
5
- import type { CommercetoolsClient } from '../core/client.js';
5
+ import type { CommercetoolsAPI } from '../core/client.js';
6
6
  export declare class CommercetoolsCategoryProvider extends CategoryProvider {
7
7
  protected config: CommercetoolsConfiguration;
8
- protected client: CommercetoolsClient;
9
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
8
+ protected commercetools: CommercetoolsAPI;
9
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
10
10
  protected getClient(): Promise<ByProjectKeyCategoriesRequestBuilder>;
11
11
  /**
12
12
  * Look it up by the category ID (key in commercetools), and if not there, return a placeholder.
@@ -1,7 +1,7 @@
1
1
  import type { Address as CTAddress, Cart as CTCart, Payment as CTPayment, LineItem, MyCartUpdateAction } from '@commercetools/platform-sdk';
2
2
  import type { Address, Cache, Checkout, CheckoutIdentifier, CheckoutItem, CheckoutMutationAddPaymentInstruction, CheckoutMutationFinalizeCheckout, CheckoutMutationInitiateCheckout, CheckoutMutationRemovePaymentInstruction, CheckoutMutationSetShippingAddress, CheckoutMutationSetShippingInstruction, CheckoutQueryById, CheckoutQueryForAvailablePaymentMethods, CheckoutQueryForAvailableShippingMethods, CostBreakDown, NotFoundError, PaymentInstruction, PaymentMethod, RequestContext, Result, ShippingInstruction, ShippingMethod } from '@reactionary/core';
3
3
  import { CheckoutProvider } from '@reactionary/core';
4
- import type { CommercetoolsClient } from '../core/client.js';
4
+ import type { CommercetoolsAPI } from '../core/client.js';
5
5
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
6
6
  export declare class CheckoutNotReadyForFinalizationError extends Error {
7
7
  checkoutIdentifier: CheckoutIdentifier;
@@ -9,8 +9,8 @@ export declare class CheckoutNotReadyForFinalizationError extends Error {
9
9
  }
10
10
  export declare class CommercetoolsCheckoutProvider extends CheckoutProvider {
11
11
  protected config: CommercetoolsConfiguration;
12
- protected client: CommercetoolsClient;
13
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
12
+ protected commercetools: CommercetoolsAPI;
13
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
14
14
  protected getClient(): Promise<{
15
15
  payments: import("@commercetools/platform-sdk").ByProjectKeyMePaymentsRequestBuilder;
16
16
  carts: import("@commercetools/platform-sdk").ByProjectKeyMeCartsRequestBuilder;
@@ -1,10 +1,10 @@
1
1
  import { type Identity, type IdentityMutationLogin, type IdentityQuerySelf, type RequestContext, type Cache, IdentityProvider, type IdentityMutationRegister, type Result } from '@reactionary/core';
2
2
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
3
- import type { CommercetoolsClient } from '../core/client.js';
3
+ import type { CommercetoolsAPI } from '../core/client.js';
4
4
  export declare class CommercetoolsIdentityProvider extends IdentityProvider {
5
5
  protected config: CommercetoolsConfiguration;
6
- protected client: CommercetoolsClient;
7
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
6
+ protected commercetools: CommercetoolsAPI;
7
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
8
8
  getSelf(payload: IdentityQuerySelf): Promise<Result<Identity>>;
9
9
  login(payload: IdentityMutationLogin): Promise<Result<Identity>>;
10
10
  logout(payload: Record<string, never>): Promise<Result<Identity>>;
@@ -2,11 +2,11 @@ import type { Inventory, RequestContext, Cache, InventoryQueryBySKU, Result, Not
2
2
  import { InventoryProvider } from '@reactionary/core';
3
3
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
4
4
  import type { InventoryEntry } from '@commercetools/platform-sdk';
5
- import type { CommercetoolsClient } from '../core/client.js';
5
+ import type { CommercetoolsAPI } from '../core/client.js';
6
6
  export declare class CommercetoolsInventoryProvider extends InventoryProvider {
7
7
  protected config: CommercetoolsConfiguration;
8
- protected client: CommercetoolsClient;
9
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
8
+ protected commercetools: CommercetoolsAPI;
9
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
10
10
  protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyRequestBuilder>;
11
11
  getBySKU(payload: InventoryQueryBySKU): Promise<Result<Inventory, NotFoundError>>;
12
12
  protected parseSingle(body: InventoryEntry): Inventory;
@@ -1,12 +1,12 @@
1
1
  import type { RequestContext, Cache, OrderSearchQueryByTerm, OrderSearchResult, Result } from '@reactionary/core';
2
2
  import { OrderSearchProvider } from '@reactionary/core';
3
3
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
4
- import type { CommercetoolsClient } from '../core/client.js';
4
+ import type { CommercetoolsAPI } from '../core/client.js';
5
5
  import type { Order as CTOrder, Address as CTAddress, OrderPagedQueryResponse } from '@commercetools/platform-sdk';
6
6
  export declare class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
7
7
  protected config: CommercetoolsConfiguration;
8
- protected client: CommercetoolsClient;
9
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
8
+ protected commercetools: CommercetoolsAPI;
9
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
10
10
  protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyMeOrdersRequestBuilder>;
11
11
  queryByTerm(payload: OrderSearchQueryByTerm): Promise<Result<OrderSearchResult>>;
12
12
  protected parseAddress(remote: CTAddress): {
@@ -1,11 +1,11 @@
1
1
  import type { RequestContext, Cache, Order, OrderQueryById, Result, NotFoundError } from '@reactionary/core';
2
2
  import { OrderProvider } from '@reactionary/core';
3
3
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
4
- import type { CommercetoolsClient } from '../core/client.js';
4
+ import type { CommercetoolsAPI } from '../core/client.js';
5
5
  export declare class CommercetoolsOrderProvider extends OrderProvider {
6
6
  protected config: CommercetoolsConfiguration;
7
- protected client: CommercetoolsClient;
8
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
7
+ protected commercetools: CommercetoolsAPI;
8
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
9
9
  protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyMeOrdersRequestBuilder>;
10
10
  getById(payload: OrderQueryById): Promise<Result<Order, NotFoundError>>;
11
11
  protected parseSingle(_body: unknown): Order;
@@ -1,11 +1,11 @@
1
1
  import { PriceProvider } from '@reactionary/core';
2
2
  import type { RequestContext, Price, Cache, CustomerPriceQuery, ListPriceQuery, Result } from '@reactionary/core';
3
3
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
4
- import type { CommercetoolsClient } from '../core/client.js';
4
+ import type { CommercetoolsAPI } from '../core/client.js';
5
5
  export declare class CommercetoolsPriceProvider extends PriceProvider {
6
6
  protected config: CommercetoolsConfiguration;
7
- protected client: CommercetoolsClient;
8
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
7
+ protected commercetools: CommercetoolsAPI;
8
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
9
9
  getCustomerPrice(payload: CustomerPriceQuery): Promise<Result<Price>>;
10
10
  getListPrice(payload: ListPriceQuery): Promise<Result<Price>>;
11
11
  protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyRequestBuilder>;
@@ -2,12 +2,12 @@ import type { ProductSearchFacetResult as CTProductSearchFacetResult, ProductVar
2
2
  import type { Cache, FacetIdentifier, FacetValueIdentifier, ProductSearchQueryByTerm, ProductSearchQueryCreateNavigationFilter, ProductSearchResult, ProductSearchResultFacet, ProductSearchResultFacetValue, ProductSearchResultItemVariant, RequestContext, Result } from '@reactionary/core';
3
3
  import { ProductSearchProvider } from '@reactionary/core';
4
4
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
5
- import type { CommercetoolsClient } from '../core/client.js';
5
+ import type { CommercetoolsAPI } from '../core/client.js';
6
6
  import { type CommercetoolsCategoryLookup, type CommercetoolsResolveCategoryQueryById, type CommercetoolsResolveCategoryQueryByKey } from '../schema/commercetools.schema.js';
7
7
  export declare class CommercetoolsSearchProvider extends ProductSearchProvider {
8
8
  protected config: CommercetoolsConfiguration;
9
- protected client: CommercetoolsClient;
10
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
9
+ protected commercetools: CommercetoolsAPI;
10
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
11
11
  protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyProductsRequestBuilder>;
12
12
  protected getFacetQuery(payload: ProductSearchQueryByTerm, selectedFacetValue: FacetValueIdentifier): Promise<{
13
13
  exact: {
@@ -3,12 +3,12 @@ import type { CommercetoolsConfiguration } from '../schema/configuration.schema.
3
3
  import type { ProductProjection, ProductVariant as CTProductVariant, Attribute as CTAttribute } from '@commercetools/platform-sdk';
4
4
  import type { Product, ProductVariant, ProductQueryById, ProductQueryBySKU, ProductQueryBySlug, RequestContext, ProductAttribute, ProductAttributeValue, Result } from '@reactionary/core';
5
5
  import type { Cache } from '@reactionary/core';
6
- import type { CommercetoolsClient } from '../core/client.js';
6
+ import type { CommercetoolsAPI } from '../core/client.js';
7
7
  import type { NotFoundError } from '@reactionary/core';
8
8
  export declare class CommercetoolsProductProvider extends ProductProvider {
9
9
  protected config: CommercetoolsConfiguration;
10
- protected client: CommercetoolsClient;
11
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
10
+ protected commercetools: CommercetoolsAPI;
11
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
12
12
  protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyProductProjectionsRequestBuilder>;
13
13
  getById(payload: ProductQueryById): Promise<Result<Product>>;
14
14
  getBySlug(payload: ProductQueryBySlug): Promise<Result<Product, NotFoundError>>;
@@ -3,11 +3,11 @@ import { ProfileProvider } from '@reactionary/core';
3
3
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
4
4
  import type { Cache } from '@reactionary/core';
5
5
  import type { Customer, Address as CTAddress } from '@commercetools/platform-sdk';
6
- import type { CommercetoolsClient } from '../core/client.js';
6
+ import type { CommercetoolsAPI } from '../core/client.js';
7
7
  export declare class CommercetoolsProfileProvider extends ProfileProvider {
8
8
  protected config: CommercetoolsConfiguration;
9
- protected client: CommercetoolsClient;
10
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
9
+ protected commercetools: CommercetoolsAPI;
10
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
11
11
  protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyRequestBuilder>;
12
12
  getById(payload: ProfileQuerySelf): Promise<Result<Profile, NotFoundError>>;
13
13
  addShippingAddress(payload: ProfileMutationAddShippingAddress): Promise<Result<Profile, NotFoundError>>;
@@ -2,11 +2,11 @@ import type { RequestContext, Cache, StoreQueryByProximity, Store, Result } from
2
2
  import { StoreProvider } from '@reactionary/core';
3
3
  import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
4
4
  import type { Channel } from '@commercetools/platform-sdk';
5
- import type { CommercetoolsClient } from '../core/client.js';
5
+ import type { CommercetoolsAPI } from '../core/client.js';
6
6
  export declare class CommercetoolsStoreProvider extends StoreProvider {
7
7
  protected config: CommercetoolsConfiguration;
8
- protected client: CommercetoolsClient;
9
- constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, client: CommercetoolsClient);
8
+ protected commercetools: CommercetoolsAPI;
9
+ constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI);
10
10
  protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyRequestBuilder>;
11
11
  queryByProximity(payload: StoreQueryByProximity): Promise<Result<Array<Store>>>;
12
12
  protected parseSingle(body: Channel): Store;