@reactionary/source 0.0.51 → 0.0.52
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/package.json +4 -3
- package/core/src/cache/cache.interface.ts +1 -1
- package/core/src/cache/memory-cache.ts +2 -2
- package/core/src/cache/noop-cache.ts +1 -1
- package/core/src/cache/redis-cache.ts +1 -1
- package/core/src/client/client-builder.ts +4 -4
- package/core/src/client/client.ts +11 -11
- package/core/src/decorators/reactionary.decorator.ts +22 -2
- package/core/src/index.ts +14 -14
- package/core/src/initialization.ts +1 -1
- package/core/src/providers/analytics.provider.ts +2 -2
- package/core/src/providers/base.provider.ts +5 -5
- package/core/src/providers/cart.provider.ts +6 -6
- package/core/src/providers/category.provider.ts +4 -9
- package/core/src/providers/checkout.provider.ts +5 -5
- package/core/src/providers/identity.provider.ts +5 -5
- package/core/src/providers/index.ts +13 -13
- package/core/src/providers/inventory.provider.ts +4 -4
- package/core/src/providers/order.provider.ts +4 -4
- package/core/src/providers/price.provider.ts +5 -5
- package/core/src/providers/product.provider.ts +4 -4
- package/core/src/providers/profile.provider.ts +5 -5
- package/core/src/providers/search.provider.ts +4 -4
- package/core/src/providers/store.provider.ts +4 -4
- package/core/src/schemas/models/analytics.model.ts +1 -1
- package/core/src/schemas/models/cart.model.ts +3 -9
- package/core/src/schemas/models/category.model.ts +2 -2
- package/core/src/schemas/models/checkout.model.ts +6 -8
- package/core/src/schemas/models/cost.model.ts +1 -1
- package/core/src/schemas/models/identity.model.ts +2 -2
- package/core/src/schemas/models/index.ts +19 -19
- package/core/src/schemas/models/inventory.model.ts +2 -2
- package/core/src/schemas/models/order.model.ts +6 -7
- package/core/src/schemas/models/payment.model.ts +3 -3
- package/core/src/schemas/models/price.model.ts +3 -3
- package/core/src/schemas/models/product.model.ts +2 -2
- package/core/src/schemas/models/profile.model.ts +2 -2
- package/core/src/schemas/models/search.model.ts +2 -3
- package/core/src/schemas/models/shipping-method.model.ts +4 -4
- package/core/src/schemas/models/store.model.ts +2 -2
- package/core/src/schemas/mutations/analytics.mutation.ts +2 -2
- package/core/src/schemas/mutations/cart.mutation.ts +5 -5
- package/core/src/schemas/mutations/checkout.mutation.ts +2 -2
- package/core/src/schemas/mutations/identity.mutation.ts +1 -1
- package/core/src/schemas/mutations/index.ts +10 -10
- package/core/src/schemas/mutations/profile.mutation.ts +1 -1
- package/core/src/schemas/queries/cart.query.ts +2 -2
- package/core/src/schemas/queries/category.query.ts +3 -3
- package/core/src/schemas/queries/checkout.query.ts +2 -2
- package/core/src/schemas/queries/identity.query.ts +1 -1
- package/core/src/schemas/queries/index.ts +13 -13
- package/core/src/schemas/queries/inventory.query.ts +2 -2
- package/core/src/schemas/queries/order.query.ts +2 -2
- package/core/src/schemas/queries/price.query.ts +2 -2
- package/core/src/schemas/queries/product.query.ts +2 -2
- package/core/src/schemas/queries/profile.query.ts +1 -1
- package/core/src/schemas/queries/search.query.ts +2 -2
- package/core/src/schemas/queries/store.query.ts +1 -1
- package/core/src/schemas/session.schema.ts +3 -3
- package/core/tsconfig.json +3 -2
- package/examples/next/next.config.js +17 -6
- package/examples/next/src/app/page.tsx +1 -2
- package/examples/node/package.json +2 -1
- package/examples/node/src/basic/basic-node-setup.spec.ts +1 -1
- package/examples/node/tsconfig.json +2 -1
- package/examples/node/tsconfig.spec.json +3 -2
- package/package.json +1 -1
- package/providers/algolia/package.json +2 -1
- package/providers/algolia/src/core/initialize.ts +5 -5
- package/providers/algolia/src/index.ts +5 -5
- package/providers/algolia/src/providers/product.provider.ts +1 -1
- package/providers/algolia/src/providers/search.provider.ts +1 -1
- package/providers/algolia/src/test/search.provider.spec.ts +1 -1
- package/providers/algolia/tsconfig.json +2 -1
- package/providers/algolia/tsconfig.spec.json +3 -2
- package/providers/commercetools/{jest.config.ts → jest.config.cjs} +1 -1
- package/providers/commercetools/package.json +2 -2
- package/providers/commercetools/src/core/client.ts +1 -1
- package/providers/commercetools/src/core/initialize.ts +10 -10
- package/providers/commercetools/src/index.ts +10 -10
- package/providers/commercetools/src/providers/cart.provider.ts +4 -18
- package/providers/commercetools/src/providers/category.provider.ts +3 -12
- package/providers/commercetools/src/providers/checkout.provider.ts +5 -5
- package/providers/commercetools/src/providers/identity.provider.ts +2 -2
- package/providers/commercetools/src/providers/index.ts +11 -11
- package/providers/commercetools/src/providers/inventory.provider.ts +2 -4
- package/providers/commercetools/src/providers/order.provider.ts +4 -6
- package/providers/commercetools/src/providers/price.provider.ts +2 -2
- package/providers/commercetools/src/providers/product.provider.ts +2 -7
- package/providers/commercetools/src/providers/profile.provider.ts +2 -2
- package/providers/commercetools/src/providers/search.provider.ts +3 -5
- package/providers/commercetools/src/providers/store.provider.ts +3 -3
- package/providers/commercetools/src/schema/commercetools.schema.ts +1 -1
- package/providers/commercetools/src/test/cart.provider.spec.ts +4 -4
- package/providers/commercetools/src/test/category.provider.spec.ts +3 -3
- package/providers/commercetools/src/test/checkout.provider.spec.ts +4 -4
- package/providers/commercetools/src/test/identity.provider.spec.ts +3 -3
- package/providers/commercetools/src/test/inventory.provider.spec.ts +2 -2
- package/providers/commercetools/src/test/price.provider.spec.ts +3 -3
- package/providers/commercetools/src/test/product.provider.spec.ts +3 -3
- package/providers/commercetools/src/test/profile.provider.spec.ts +3 -3
- package/providers/commercetools/src/test/search.provider.spec.ts +2 -2
- package/providers/commercetools/src/test/store.provider.spec.ts +2 -2
- package/providers/commercetools/tsconfig.json +2 -1
- package/providers/commercetools/tsconfig.spec.json +4 -3
- package/providers/fake/{jest.config.ts → jest.config.cjs} +1 -1
- package/providers/fake/package.json +2 -2
- package/providers/fake/src/core/initialize.ts +6 -6
- package/providers/fake/src/index.ts +4 -4
- package/providers/fake/src/providers/analytics.provider.ts +1 -1
- package/providers/fake/src/providers/cart.provider.ts +2 -2
- package/providers/fake/src/providers/category.provider.ts +2 -2
- package/providers/fake/src/providers/identity.provider.ts +1 -1
- package/providers/fake/src/providers/index.ts +9 -9
- package/providers/fake/src/providers/inventory.provider.ts +1 -1
- package/providers/fake/src/providers/price.provider.ts +1 -1
- package/providers/fake/src/providers/product.provider.ts +1 -1
- package/providers/fake/src/providers/search.provider.ts +2 -5
- package/providers/fake/src/providers/store.provider.ts +2 -3
- package/providers/fake/src/test/cart.provider.spec.ts +3 -3
- package/providers/fake/src/test/category.provider.spec.ts +2 -2
- package/providers/fake/src/test/price.provider.spec.ts +2 -2
- package/providers/fake/src/test/product.provider.spec.ts +3 -3
- package/providers/fake/src/test/test-utils.ts +1 -1
- package/providers/fake/tsconfig.json +2 -1
- package/providers/fake/tsconfig.spec.json +1 -3
- package/providers/posthog/package.json +4 -4
- package/providers/posthog/project.json +2 -2
- package/providers/posthog/src/core/initialize.ts +2 -2
- package/providers/posthog/src/index.ts +3 -3
- package/providers/posthog/tsconfig.json +2 -1
- package/tsconfig.base.json +3 -4
- package/otel/README.md +0 -227
- package/otel/eslint.config.mjs +0 -23
- package/otel/package.json +0 -11
- package/otel/pnpm-lock.yaml +0 -805
- package/otel/project.json +0 -33
- package/otel/src/index.ts +0 -22
- package/otel/src/metrics.ts +0 -76
- package/otel/src/provider-instrumentation.ts +0 -108
- package/otel/src/test/otel.spec.ts +0 -8
- package/otel/src/trace-decorator.ts +0 -226
- package/otel/src/tracer.ts +0 -83
- package/otel/src/trpc-middleware.ts +0 -128
- package/otel/tsconfig.json +0 -23
- package/otel/tsconfig.lib.json +0 -23
- package/otel/tsconfig.spec.json +0 -28
- package/otel/vite.config.ts +0 -24
- package/trpc/README.md +0 -7
- package/trpc/__mocks__/superjson.js +0 -25
- package/trpc/eslint.config.mjs +0 -19
- package/trpc/jest.config.ts +0 -14
- package/trpc/package.json +0 -14
- package/trpc/project.json +0 -31
- package/trpc/src/client.ts +0 -175
- package/trpc/src/index.ts +0 -44
- package/trpc/src/integration.spec.ts +0 -223
- package/trpc/src/server.ts +0 -125
- package/trpc/src/transparent-client.spec.ts +0 -161
- package/trpc/src/types.ts +0 -144
- package/trpc/tsconfig.json +0 -16
- package/trpc/tsconfig.lib.json +0 -10
- package/trpc/tsconfig.spec.json +0 -15
|
@@ -20,20 +20,19 @@ import type {
|
|
|
20
20
|
Cache
|
|
21
21
|
} from '@reactionary/core';
|
|
22
22
|
|
|
23
|
-
import type { CommercetoolsConfiguration } from '../schema/configuration.schema';
|
|
23
|
+
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
24
24
|
import type { z } from 'zod';
|
|
25
|
-
import { CommercetoolsClient } from '../core/client';
|
|
25
|
+
import { CommercetoolsClient } from '../core/client.js';
|
|
26
26
|
import type {
|
|
27
27
|
Cart as CTCart,
|
|
28
28
|
MyCartUpdateAction,
|
|
29
29
|
} from '@commercetools/platform-sdk';
|
|
30
|
-
import { traced } from '@reactionary/otel';
|
|
31
30
|
import type {
|
|
32
|
-
CommercetoolsCartIdentifier} from '../schema/commercetools.schema';
|
|
31
|
+
CommercetoolsCartIdentifier} from '../schema/commercetools.schema.js';
|
|
33
32
|
import {
|
|
34
33
|
CommercetoolsCartIdentifierSchema,
|
|
35
34
|
CommercetoolsOrderIdentifierSchema,
|
|
36
|
-
} from '../schema/commercetools.schema';
|
|
35
|
+
} from '../schema/commercetools.schema.js';
|
|
37
36
|
|
|
38
37
|
export class CommercetoolsCartProvider<
|
|
39
38
|
T extends Cart = Cart
|
|
@@ -49,7 +48,6 @@ export class CommercetoolsCartProvider<
|
|
|
49
48
|
this.config = config;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
@traced()
|
|
53
51
|
public override async getById(
|
|
54
52
|
payload: CartQueryById,
|
|
55
53
|
reqCtx: RequestContext
|
|
@@ -67,7 +65,6 @@ export class CommercetoolsCartProvider<
|
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
|
|
70
|
-
@traced()
|
|
71
68
|
public override async add(
|
|
72
69
|
payload: CartMutationItemAdd,
|
|
73
70
|
reqCtx: RequestContext
|
|
@@ -95,7 +92,6 @@ export class CommercetoolsCartProvider<
|
|
|
95
92
|
);
|
|
96
93
|
}
|
|
97
94
|
|
|
98
|
-
@traced()
|
|
99
95
|
public override async remove(
|
|
100
96
|
payload: CartMutationItemRemove,
|
|
101
97
|
reqCtx: RequestContext
|
|
@@ -115,7 +111,6 @@ export class CommercetoolsCartProvider<
|
|
|
115
111
|
);
|
|
116
112
|
}
|
|
117
113
|
|
|
118
|
-
@traced()
|
|
119
114
|
public override async changeQuantity(
|
|
120
115
|
payload: CartMutationItemQuantityChange,
|
|
121
116
|
reqCtx: RequestContext
|
|
@@ -142,7 +137,6 @@ export class CommercetoolsCartProvider<
|
|
|
142
137
|
);
|
|
143
138
|
}
|
|
144
139
|
|
|
145
|
-
@traced()
|
|
146
140
|
public override async getActiveCartId(
|
|
147
141
|
reqCtx: RequestContext
|
|
148
142
|
): Promise<CartIdentifier> {
|
|
@@ -165,7 +159,6 @@ export class CommercetoolsCartProvider<
|
|
|
165
159
|
}
|
|
166
160
|
}
|
|
167
161
|
|
|
168
|
-
@traced()
|
|
169
162
|
public override async deleteCart(
|
|
170
163
|
payload: CartMutationDeleteCart,
|
|
171
164
|
reqCtx: RequestContext
|
|
@@ -189,7 +182,6 @@ export class CommercetoolsCartProvider<
|
|
|
189
182
|
return this.getById({ cart: activeCartId }, reqCtx);
|
|
190
183
|
}
|
|
191
184
|
|
|
192
|
-
@traced()
|
|
193
185
|
public override async setShippingInfo(
|
|
194
186
|
payload: CartMutationSetShippingInfo,
|
|
195
187
|
reqCtx: RequestContext
|
|
@@ -226,7 +218,6 @@ export class CommercetoolsCartProvider<
|
|
|
226
218
|
return this.applyActions(payload.cart, actions, reqCtx);
|
|
227
219
|
}
|
|
228
220
|
|
|
229
|
-
@traced()
|
|
230
221
|
public override setBillingAddress(
|
|
231
222
|
payload: CartMutationSetBillingAddress,
|
|
232
223
|
reqCtx: RequestContext
|
|
@@ -261,7 +252,6 @@ export class CommercetoolsCartProvider<
|
|
|
261
252
|
);
|
|
262
253
|
}
|
|
263
254
|
|
|
264
|
-
@traced()
|
|
265
255
|
public override applyCouponCode(
|
|
266
256
|
payload: CartMutationApplyCoupon,
|
|
267
257
|
reqCtx: RequestContext
|
|
@@ -281,7 +271,6 @@ export class CommercetoolsCartProvider<
|
|
|
281
271
|
);
|
|
282
272
|
}
|
|
283
273
|
|
|
284
|
-
@traced()
|
|
285
274
|
public override removeCouponCode(
|
|
286
275
|
payload: CartMutationRemoveCoupon,
|
|
287
276
|
reqCtx: RequestContext
|
|
@@ -304,7 +293,6 @@ export class CommercetoolsCartProvider<
|
|
|
304
293
|
);
|
|
305
294
|
}
|
|
306
295
|
|
|
307
|
-
@traced()
|
|
308
296
|
public override async checkout(
|
|
309
297
|
payload: CartMutationCheckout,
|
|
310
298
|
reqCtx: RequestContext
|
|
@@ -328,7 +316,6 @@ export class CommercetoolsCartProvider<
|
|
|
328
316
|
});
|
|
329
317
|
}
|
|
330
318
|
|
|
331
|
-
@traced()
|
|
332
319
|
public override async changeCurrency(
|
|
333
320
|
payload: CartMutationChangeCurrency,
|
|
334
321
|
reqCtx: RequestContext
|
|
@@ -448,7 +435,6 @@ export class CommercetoolsCartProvider<
|
|
|
448
435
|
* @param anonymousCall
|
|
449
436
|
* @returns
|
|
450
437
|
*/
|
|
451
|
-
@traced()
|
|
452
438
|
protected async getClient(reqCtx: RequestContext) {
|
|
453
439
|
const client = await new CommercetoolsClient(this.config).getClient(reqCtx);
|
|
454
440
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { CategoryProvider, createPaginatedResponseSchema } from "@reactionary/core";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext , Cache, Category} from "@reactionary/core";
|
|
3
3
|
import type z from "zod";
|
|
4
|
-
import type { CommercetoolsConfiguration } from "../schema/configuration.schema";
|
|
5
|
-
import { CommercetoolsClient } from "../core/client";
|
|
4
|
+
import type { CommercetoolsConfiguration } from "../schema/configuration.schema.js";
|
|
5
|
+
import { CommercetoolsClient } from "../core/client.js";
|
|
6
6
|
import type { ByProjectKeyCategoriesRequestBuilder, CategoryPagedQueryResponse, Category as CTCategory } from "@commercetools/platform-sdk";
|
|
7
|
-
import { traced } from "@reactionary/otel";
|
|
8
7
|
|
|
9
8
|
export class CommercetoolsCategoryProvider<
|
|
10
9
|
T extends Category = Category,
|
|
@@ -29,7 +28,6 @@ export class CommercetoolsCategoryProvider<
|
|
|
29
28
|
* @param session
|
|
30
29
|
* @returns
|
|
31
30
|
*/
|
|
32
|
-
@traced()
|
|
33
31
|
public override async getById(payload: CategoryQueryById, reqCtx: RequestContext): Promise<T> {
|
|
34
32
|
const client = await this.getClient(reqCtx);
|
|
35
33
|
try {
|
|
@@ -49,7 +47,6 @@ export class CommercetoolsCategoryProvider<
|
|
|
49
47
|
* @param session
|
|
50
48
|
* @returns
|
|
51
49
|
*/
|
|
52
|
-
@traced()
|
|
53
50
|
public override async getBySlug(payload: CategoryQueryBySlug, reqCtx: RequestContext): Promise<T | null> {
|
|
54
51
|
const client = await this.getClient(reqCtx);
|
|
55
52
|
try {
|
|
@@ -79,7 +76,6 @@ export class CommercetoolsCategoryProvider<
|
|
|
79
76
|
* @param session
|
|
80
77
|
* @returns
|
|
81
78
|
*/
|
|
82
|
-
@traced()
|
|
83
79
|
public override async getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb, reqCtx: RequestContext): Promise<T[]> {
|
|
84
80
|
const client = await this.getClient(reqCtx);
|
|
85
81
|
const path: T[] = [];
|
|
@@ -116,7 +112,6 @@ export class CommercetoolsCategoryProvider<
|
|
|
116
112
|
* @param session
|
|
117
113
|
* @returns
|
|
118
114
|
*/
|
|
119
|
-
@traced()
|
|
120
115
|
public override async findChildCategories(payload: CategoryQueryForChildCategories, reqCtx: RequestContext) {
|
|
121
116
|
|
|
122
117
|
// ok, so for Commercetools we can't actually query by the parents key, so we have to first resolve the key to an ID, then query by that.
|
|
@@ -155,7 +150,6 @@ export class CommercetoolsCategoryProvider<
|
|
|
155
150
|
return createPaginatedResponseSchema(this.schema).parse({});
|
|
156
151
|
}
|
|
157
152
|
|
|
158
|
-
@traced()
|
|
159
153
|
public override async findTopCategories(payload: CategoryQueryForTopCategories, reqCtx: RequestContext) {
|
|
160
154
|
|
|
161
155
|
const client = await this.getClient(reqCtx);
|
|
@@ -190,7 +184,6 @@ export class CommercetoolsCategoryProvider<
|
|
|
190
184
|
* Handler for parsing a response from a remote provider and converting it
|
|
191
185
|
* into the typed domain model.
|
|
192
186
|
*/
|
|
193
|
-
@traced()
|
|
194
187
|
protected override parseSingle(_body: unknown, reqCtx: RequestContext): T {
|
|
195
188
|
const body = _body as CTCategory;
|
|
196
189
|
const languageContext = reqCtx.languageContext;
|
|
@@ -221,8 +214,6 @@ export class CommercetoolsCategoryProvider<
|
|
|
221
214
|
return this.assert(model);
|
|
222
215
|
}
|
|
223
216
|
|
|
224
|
-
|
|
225
|
-
@traced()
|
|
226
217
|
protected override parsePaginatedResult(_body: unknown, reqCtx: RequestContext) {
|
|
227
218
|
const body = _body as CategoryPagedQueryResponse;
|
|
228
219
|
|
|
@@ -19,12 +19,12 @@ import type {
|
|
|
19
19
|
ShippingInstruction,
|
|
20
20
|
PaymentInstruction
|
|
21
21
|
} from "@reactionary/core";
|
|
22
|
-
import { AddressSchema, CheckoutItemSchema, CheckoutProvider,
|
|
22
|
+
import { AddressSchema, CheckoutItemSchema, CheckoutProvider, PaymentInstructionIdentifierSchema, PaymentInstructionSchema, PaymentMethodIdentifierSchema, ShippingInstructionSchema, ShippingMethodSchema } from "@reactionary/core";
|
|
23
23
|
import type z from "zod";
|
|
24
|
-
import { CommercetoolsClient } from "../core/client";
|
|
25
|
-
import type { CommercetoolsConfiguration } from "../schema/configuration.schema";
|
|
26
|
-
import type { MyCartUpdateAction
|
|
27
|
-
import { CommercetoolsCartIdentifierSchema, CommercetoolsCheckoutIdentifierSchema, CommercetoolsOrderIdentifierSchema, type CommercetoolsCheckoutIdentifier } from "../schema/commercetools.schema";
|
|
24
|
+
import { CommercetoolsClient } from "../core/client.js";
|
|
25
|
+
import type { CommercetoolsConfiguration } from "../schema/configuration.schema.js";
|
|
26
|
+
import type { MyCartUpdateAction } from "@commercetools/platform-sdk";
|
|
27
|
+
import { CommercetoolsCartIdentifierSchema, CommercetoolsCheckoutIdentifierSchema, CommercetoolsOrderIdentifierSchema, type CommercetoolsCheckoutIdentifier } from "../schema/commercetools.schema.js";
|
|
28
28
|
import type { Address as CTAddress, Payment as CTPayment, Cart as CTCart, ShippingMethod as CTShippingMethod } from "@commercetools/platform-sdk";
|
|
29
29
|
|
|
30
30
|
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
IdentityProvider,
|
|
8
8
|
type IdentityMutationRegister,
|
|
9
9
|
} from '@reactionary/core';
|
|
10
|
-
import type { CommercetoolsConfiguration } from '../schema/configuration.schema';
|
|
10
|
+
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
11
11
|
import type z from 'zod';
|
|
12
|
-
import { CommercetoolsClient } from '../core/client';
|
|
12
|
+
import { CommercetoolsClient } from '../core/client.js';
|
|
13
13
|
|
|
14
14
|
export class CommercetoolsIdentityProvider<
|
|
15
15
|
T extends Identity = Identity
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from './cart.provider';
|
|
2
|
-
export * from './category.provider';
|
|
3
|
-
export * from './identity.provider';
|
|
4
|
-
export * from './inventory.provider';
|
|
5
|
-
export * from './price.provider';
|
|
6
|
-
export * from './product.provider';
|
|
7
|
-
export * from './profile.provider';
|
|
8
|
-
export * from './search.provider';
|
|
9
|
-
export * from './store.provider';
|
|
1
|
+
export * from './cart.provider.js';
|
|
2
|
+
export * from './category.provider.js';
|
|
3
|
+
export * from './identity.provider.js';
|
|
4
|
+
export * from './inventory.provider.js';
|
|
5
|
+
export * from './price.provider.js';
|
|
6
|
+
export * from './product.provider.js';
|
|
7
|
+
export * from './profile.provider.js';
|
|
8
|
+
export * from './search.provider.js';
|
|
9
|
+
export * from './store.provider.js';
|
|
10
10
|
|
|
11
|
-
export * from './order.provider';
|
|
12
|
-
export * from './checkout.provider';
|
|
11
|
+
export * from './order.provider.js';
|
|
12
|
+
export * from './checkout.provider.js';
|
|
@@ -6,12 +6,10 @@ import type {
|
|
|
6
6
|
} from '@reactionary/core';
|
|
7
7
|
import { InventoryProvider } from '@reactionary/core';
|
|
8
8
|
import type z from 'zod';
|
|
9
|
-
import type { CommercetoolsConfiguration } from '../schema/configuration.schema';
|
|
10
|
-
import { CommercetoolsClient } from '../core/client';
|
|
9
|
+
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
10
|
+
import { CommercetoolsClient } from '../core/client.js';
|
|
11
11
|
import type {
|
|
12
12
|
InventoryEntry,
|
|
13
|
-
ProductVariant,
|
|
14
|
-
ProductVariantAvailability,
|
|
15
13
|
} from '@commercetools/platform-sdk';
|
|
16
14
|
export class CommercetoolsInventoryProvider<
|
|
17
15
|
T extends Inventory = Inventory
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
Inventory,
|
|
3
2
|
RequestContext,
|
|
4
3
|
Cache,
|
|
5
|
-
InventoryQueryBySKU,
|
|
6
4
|
Order,
|
|
7
5
|
OrderQueryById,
|
|
8
6
|
Currency} from '@reactionary/core';
|
|
9
|
-
import {
|
|
7
|
+
import { OrderItemSchema, OrderProvider } from '@reactionary/core';
|
|
10
8
|
import type z from 'zod';
|
|
11
|
-
import type { CommercetoolsConfiguration } from '../schema/configuration.schema';
|
|
12
|
-
import { CommercetoolsClient } from '../core/client';
|
|
9
|
+
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
10
|
+
import { CommercetoolsClient } from '../core/client.js';
|
|
13
11
|
import type { Order as CTOrder } from '@commercetools/platform-sdk';
|
|
14
|
-
import { CommercetoolsOrderIdentifierSchema } from '../schema/commercetools.schema';
|
|
12
|
+
import { CommercetoolsOrderIdentifierSchema } from '../schema/commercetools.schema.js';
|
|
15
13
|
export class CommercetoolsOrderProvider<
|
|
16
14
|
T extends Order = Order
|
|
17
15
|
> extends OrderProvider<T> {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PriceProvider, TieredPriceSchema } from '@reactionary/core';
|
|
2
2
|
import type { PriceQueryBySku, RequestContext , Price, Cache, Currency, TieredPrice } from '@reactionary/core';
|
|
3
3
|
import type z from 'zod';
|
|
4
|
-
import type { CommercetoolsConfiguration } from '../schema/configuration.schema';
|
|
5
|
-
import { CommercetoolsClient } from '../core/client';
|
|
4
|
+
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
5
|
+
import { CommercetoolsClient } from '../core/client.js';
|
|
6
6
|
import type { Price as CTPrice, ProductVariant as CTProductVariant } from '@commercetools/platform-sdk';
|
|
7
7
|
export class CommercetoolsPriceProvider<
|
|
8
8
|
T extends Price = Price
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProductProvider
|
|
3
3
|
} from '@reactionary/core';
|
|
4
|
-
import { CommercetoolsClient } from '../core/client';
|
|
4
|
+
import { CommercetoolsClient } from '../core/client.js';
|
|
5
5
|
import type { z } from 'zod';
|
|
6
|
-
import type { CommercetoolsConfiguration } from '../schema/configuration.schema';
|
|
6
|
+
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
7
7
|
import type { ProductProjection } from '@commercetools/platform-sdk';
|
|
8
|
-
import { traced } from '@reactionary/otel';
|
|
9
8
|
import type { Product, ProductQueryById, ProductQueryBySKU, ProductQueryBySlug, RequestContext } from '@reactionary/core';
|
|
10
9
|
import type { Cache } from '@reactionary/core';
|
|
11
10
|
|
|
@@ -26,7 +25,6 @@ export class CommercetoolsProductProvider<
|
|
|
26
25
|
return client.withProjectKey({ projectKey: this.config.projectKey }).productProjections();
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
@traced()
|
|
30
28
|
public override async getById(
|
|
31
29
|
payload: ProductQueryById,
|
|
32
30
|
reqCtx: RequestContext
|
|
@@ -45,7 +43,6 @@ export class CommercetoolsProductProvider<
|
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
@traced()
|
|
49
46
|
public override async getBySlug(
|
|
50
47
|
payload: ProductQueryBySlug,
|
|
51
48
|
reqCtx: RequestContext
|
|
@@ -67,8 +64,6 @@ export class CommercetoolsProductProvider<
|
|
|
67
64
|
return this.parseSingle(remote.body.results[0], reqCtx);
|
|
68
65
|
}
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
@traced()
|
|
72
67
|
public override async getBySKU(
|
|
73
68
|
payload: ProductQueryBySKU,
|
|
74
69
|
reqCtx: RequestContext
|
|
@@ -6,8 +6,8 @@ import type {
|
|
|
6
6
|
} from '@reactionary/core';
|
|
7
7
|
import { ProfileProvider } from '@reactionary/core';
|
|
8
8
|
import type z from 'zod';
|
|
9
|
-
import { CommercetoolsClient } from '../core/client';
|
|
10
|
-
import type { CommercetoolsConfiguration } from '../schema/configuration.schema';
|
|
9
|
+
import { CommercetoolsClient } from '../core/client.js';
|
|
10
|
+
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
11
11
|
import type { Cache } from '@reactionary/core';
|
|
12
12
|
import type { Customer } from '@commercetools/platform-sdk';
|
|
13
13
|
|
|
@@ -4,13 +4,12 @@ import type {
|
|
|
4
4
|
SearchResultProduct,
|
|
5
5
|
Cache,
|
|
6
6
|
SearchQueryByTerm,
|
|
7
|
-
|
|
7
|
+
RequestContext,
|
|
8
8
|
} from '@reactionary/core';
|
|
9
9
|
|
|
10
|
-
import { CommercetoolsClient } from '../core/client';
|
|
10
|
+
import { CommercetoolsClient } from '../core/client.js';
|
|
11
11
|
import type z from 'zod';
|
|
12
|
-
import type { CommercetoolsConfiguration } from '../schema/configuration.schema';
|
|
13
|
-
import { traced } from '@reactionary/otel';
|
|
12
|
+
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
14
13
|
|
|
15
14
|
export class CommercetoolsSearchProvider<
|
|
16
15
|
T extends SearchResult = SearchResult
|
|
@@ -27,7 +26,6 @@ export class CommercetoolsSearchProvider<
|
|
|
27
26
|
this.config = config;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
@traced()
|
|
31
29
|
protected async getClient(reqCtx: RequestContext) {
|
|
32
30
|
const client = await new CommercetoolsClient(this.config).getClient(reqCtx);
|
|
33
31
|
return client.withProjectKey({ projectKey: this.config.projectKey }).productProjections();
|
|
@@ -5,9 +5,9 @@ import type {
|
|
|
5
5
|
} from '@reactionary/core';
|
|
6
6
|
import { StoreProvider } from '@reactionary/core';
|
|
7
7
|
import type z from 'zod';
|
|
8
|
-
import type { CommercetoolsConfiguration } from '../schema/configuration.schema';
|
|
9
|
-
import { CommercetoolsClient } from '../core/client';
|
|
10
|
-
import type { Channel
|
|
8
|
+
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
9
|
+
import { CommercetoolsClient } from '../core/client.js';
|
|
10
|
+
import type { Channel } from '@commercetools/platform-sdk';
|
|
11
11
|
import type { Store } from '@reactionary/core';
|
|
12
12
|
|
|
13
13
|
export class CommercetoolsStoreProvider<
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CartIdentifierSchema, CheckoutIdentifierSchema, OrderIdentifierSchema
|
|
1
|
+
import { CartIdentifierSchema, CheckoutIdentifierSchema, OrderIdentifierSchema } from "@reactionary/core";
|
|
2
2
|
import z from "zod";
|
|
3
3
|
|
|
4
4
|
export const CommercetoolsCartIdentifierSchema = CartIdentifierSchema.extend({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
2
|
import type { RequestContext} from '@reactionary/core';
|
|
3
3
|
import { CartSchema, IdentitySchema, NoOpCache, ProductSchema, createInitialRequestContext } from '@reactionary/core';
|
|
4
|
-
import { getCommercetoolsTestConfiguration } from './test-utils';
|
|
5
|
-
import { CommercetoolsCartProvider } from '../providers/cart.provider';
|
|
6
|
-
import { CommercetoolsIdentityProvider } from '../providers/identity.provider';
|
|
7
|
-
import { CommercetoolsProductProvider } from '../providers/product.provider';
|
|
4
|
+
import { getCommercetoolsTestConfiguration } from './test-utils.js';
|
|
5
|
+
import { CommercetoolsCartProvider } from '../providers/cart.provider.js';
|
|
6
|
+
import { CommercetoolsIdentityProvider } from '../providers/identity.provider.js';
|
|
7
|
+
import { CommercetoolsProductProvider } from '../providers/product.provider.js';
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
const testData = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'dotenv/config'
|
|
2
2
|
import type { RequestContext} from '@reactionary/core';
|
|
3
|
-
import { CategorySchema, NoOpCache
|
|
4
|
-
import { CommercetoolsCategoryProvider } from '../providers/category.provider';
|
|
5
|
-
import { getCommercetoolsTestConfiguration } from './test-utils';
|
|
3
|
+
import { CategorySchema, NoOpCache , createInitialRequestContext} from '@reactionary/core';
|
|
4
|
+
import { CommercetoolsCategoryProvider } from '../providers/category.provider.js';
|
|
5
|
+
import { getCommercetoolsTestConfiguration } from './test-utils.js';
|
|
6
6
|
|
|
7
7
|
const testData = {
|
|
8
8
|
topCategories: [
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
ShippingInstructionSchema,
|
|
10
10
|
createInitialRequestContext,
|
|
11
11
|
} from '@reactionary/core';
|
|
12
|
-
import { getCommercetoolsTestConfiguration } from './test-utils';
|
|
13
|
-
import { CommercetoolsCartProvider } from '../providers/cart.provider';
|
|
14
|
-
import { CommercetoolsIdentityProvider } from '../providers/identity.provider';
|
|
15
|
-
import { CommercetoolsCheckoutProvider } from '../providers/checkout.provider';
|
|
12
|
+
import { getCommercetoolsTestConfiguration } from './test-utils.js';
|
|
13
|
+
import { CommercetoolsCartProvider } from '../providers/cart.provider.js';
|
|
14
|
+
import { CommercetoolsIdentityProvider } from '../providers/identity.provider.js';
|
|
15
|
+
import { CommercetoolsCheckoutProvider } from '../providers/checkout.provider.js';
|
|
16
16
|
|
|
17
17
|
const testData = {
|
|
18
18
|
skuWithoutTiers: 'SGB-01',
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
NoOpCache,
|
|
7
7
|
createInitialRequestContext,
|
|
8
8
|
} from '@reactionary/core';
|
|
9
|
-
import { getCommercetoolsTestConfiguration } from './test-utils';
|
|
10
|
-
import { CommercetoolsIdentityProvider } from '../providers/identity.provider';
|
|
11
|
-
import { CommercetoolsCartProvider } from '../providers/cart.provider';
|
|
9
|
+
import { getCommercetoolsTestConfiguration } from './test-utils.js';
|
|
10
|
+
import { CommercetoolsIdentityProvider } from '../providers/identity.provider.js';
|
|
11
|
+
import { CommercetoolsCartProvider } from '../providers/cart.provider.js';
|
|
12
12
|
|
|
13
13
|
describe('Commercetools Identity Provider', () => {
|
|
14
14
|
let provider: CommercetoolsIdentityProvider;
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
NoOpCache,
|
|
6
6
|
createInitialRequestContext,
|
|
7
7
|
} from '@reactionary/core';
|
|
8
|
-
import { getCommercetoolsTestConfiguration } from './test-utils';
|
|
9
|
-
import { CommercetoolsInventoryProvider } from '../providers/inventory.provider';
|
|
8
|
+
import { getCommercetoolsTestConfiguration } from './test-utils.js';
|
|
9
|
+
import { CommercetoolsInventoryProvider } from '../providers/inventory.provider.js';
|
|
10
10
|
|
|
11
11
|
describe('Commercetools Inventory Provider', () => {
|
|
12
12
|
let provider: CommercetoolsInventoryProvider;
|
|
@@ -2,10 +2,10 @@ import 'dotenv/config';
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import type { RequestContext} from '@reactionary/core';
|
|
5
|
-
import { NoOpCache, PriceSchema,
|
|
6
|
-
import { getCommercetoolsTestConfiguration } from './test-utils';
|
|
5
|
+
import { NoOpCache, PriceSchema, createInitialRequestContext,} from '@reactionary/core';
|
|
6
|
+
import { getCommercetoolsTestConfiguration } from './test-utils.js';
|
|
7
7
|
|
|
8
|
-
import { CommercetoolsPriceProvider } from '../providers/price.provider';
|
|
8
|
+
import { CommercetoolsPriceProvider } from '../providers/price.provider.js';
|
|
9
9
|
|
|
10
10
|
const testData = {
|
|
11
11
|
skuWithoutTiers: 'SGB-01',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
2
|
import type { RequestContext} from '@reactionary/core';
|
|
3
|
-
import { NoOpCache, ProductSchema,
|
|
4
|
-
import { CommercetoolsProductProvider } from '../providers/product.provider';
|
|
5
|
-
import { getCommercetoolsTestConfiguration } from './test-utils';
|
|
3
|
+
import { NoOpCache, ProductSchema, createInitialRequestContext } from '@reactionary/core';
|
|
4
|
+
import { CommercetoolsProductProvider } from '../providers/product.provider.js';
|
|
5
|
+
import { getCommercetoolsTestConfiguration } from './test-utils.js';
|
|
6
6
|
|
|
7
7
|
const testData = {
|
|
8
8
|
product : {
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
ProfileSchema,
|
|
7
7
|
createInitialRequestContext,
|
|
8
8
|
} from '@reactionary/core';
|
|
9
|
-
import { getCommercetoolsTestConfiguration } from './test-utils';
|
|
10
|
-
import { CommercetoolsProfileProvider } from '../providers/profile.provider';
|
|
11
|
-
import { CommercetoolsIdentityProvider } from '../providers/identity.provider';
|
|
9
|
+
import { getCommercetoolsTestConfiguration } from './test-utils.js';
|
|
10
|
+
import { CommercetoolsProfileProvider } from '../providers/profile.provider.js';
|
|
11
|
+
import { CommercetoolsIdentityProvider } from '../providers/identity.provider.js';
|
|
12
12
|
|
|
13
13
|
describe('Commercetools Profile Provider', () => {
|
|
14
14
|
let provider: CommercetoolsProfileProvider;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
2
|
import type { RequestContext} from '@reactionary/core';
|
|
3
3
|
import { NoOpCache, SearchResultSchema, createInitialRequestContext } from '@reactionary/core';
|
|
4
|
-
import { CommercetoolsSearchProvider } from '../providers/search.provider';
|
|
5
|
-
import { getCommercetoolsTestConfiguration } from './test-utils';
|
|
4
|
+
import { CommercetoolsSearchProvider } from '../providers/search.provider.js';
|
|
5
|
+
import { getCommercetoolsTestConfiguration } from './test-utils.js';
|
|
6
6
|
|
|
7
7
|
const testData = {
|
|
8
8
|
searchTerm: 'bowl'
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
StoreSchema,
|
|
6
6
|
createInitialRequestContext,
|
|
7
7
|
} from '@reactionary/core';
|
|
8
|
-
import { getCommercetoolsTestConfiguration } from './test-utils';
|
|
9
|
-
import { CommercetoolsStoreProvider } from '../providers/store.provider';
|
|
8
|
+
import { getCommercetoolsTestConfiguration } from './test-utils.js';
|
|
9
|
+
import { CommercetoolsStoreProvider } from '../providers/store.provider.js';
|
|
10
10
|
|
|
11
11
|
describe('Commercetools Store Provider', () => {
|
|
12
12
|
let provider: CommercetoolsStoreProvider;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "./tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
4
|
"module": "commonjs",
|
|
6
|
-
"moduleResolution": "
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"verbatimModuleSyntax": false,
|
|
7
|
+
"outDir": "../../dist/out-tsc",
|
|
7
8
|
"types": ["jest", "node"]
|
|
8
9
|
},
|
|
9
10
|
"include": [
|
|
10
|
-
"jest.config.
|
|
11
|
+
"jest.config.cjs",
|
|
11
12
|
"src/**/*.test.ts",
|
|
12
13
|
"src/**/*.spec.ts",
|
|
13
14
|
"src/**/*.d.ts"
|
|
@@ -18,17 +18,17 @@ import {
|
|
|
18
18
|
StoreSchema,
|
|
19
19
|
PriceSchema,
|
|
20
20
|
} from '@reactionary/core';
|
|
21
|
-
import { FakeProductProvider } from '../providers/product.provider';
|
|
22
|
-
import { FakeSearchProvider } from '../providers/search.provider';
|
|
23
|
-
import type { FakeConfiguration } from '../schema/configuration.schema';
|
|
24
|
-
import type { FakeCapabilities } from '../schema/capabilities.schema';
|
|
25
|
-
import { FakeCategoryProvider } from '../providers/category.provider';
|
|
21
|
+
import { FakeProductProvider } from '../providers/product.provider.js';
|
|
22
|
+
import { FakeSearchProvider } from '../providers/search.provider.js';
|
|
23
|
+
import type { FakeConfiguration } from '../schema/configuration.schema.js';
|
|
24
|
+
import type { FakeCapabilities } from '../schema/capabilities.schema.js';
|
|
25
|
+
import { FakeCategoryProvider } from '../providers/category.provider.js';
|
|
26
26
|
import {
|
|
27
27
|
FakeCartProvider,
|
|
28
28
|
FakeInventoryProvider,
|
|
29
29
|
FakePriceProvider,
|
|
30
30
|
FakeStoreProvider,
|
|
31
|
-
} from '../providers';
|
|
31
|
+
} from '../providers/index.js';
|
|
32
32
|
|
|
33
33
|
type FakeClient<T extends FakeCapabilities> = (T['cart'] extends true
|
|
34
34
|
? { cart: CartProvider }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './core/initialize';
|
|
1
|
+
export * from './core/initialize.js';
|
|
2
2
|
|
|
3
|
-
export * from './providers/'
|
|
4
|
-
export * from './schema/capabilities.schema';
|
|
5
|
-
export * from './schema/configuration.schema';
|
|
3
|
+
export * from './providers/index.js'
|
|
4
|
+
export * from './schema/capabilities.schema.js';
|
|
5
|
+
export * from './schema/configuration.schema.js';
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
AnalyticsProvider
|
|
6
6
|
} from '@reactionary/core';
|
|
7
7
|
import type z from 'zod';
|
|
8
|
-
import type { FakeConfiguration } from '../schema/configuration.schema';
|
|
8
|
+
import type { FakeConfiguration } from '../schema/configuration.schema.js';
|
|
9
9
|
|
|
10
10
|
export class FakeAnalyticsProvider<
|
|
11
11
|
T extends BaseModel = BaseModel
|