@reactionary/source 0.0.39 → 0.0.41
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 +1 -1
- package/core/src/decorators/reactionary.decorator.ts +16 -0
- package/core/src/index.ts +2 -0
- package/core/src/schemas/capabilities.schema.ts +1 -1
- package/core/src/schemas/models/base.model.ts +5 -5
- package/core/src/schemas/models/cart.model.ts +1 -1
- package/core/src/schemas/models/identifiers.model.ts +12 -12
- package/core/src/schemas/models/price.model.ts +1 -1
- package/core/src/schemas/models/product.model.ts +2 -2
- package/core/src/schemas/models/search.model.ts +3 -3
- package/core/src/schemas/mutations/base.mutation.ts +1 -1
- package/core/src/schemas/mutations/cart.mutation.ts +6 -6
- package/core/src/schemas/mutations/inventory.mutation.ts +0 -4
- package/core/src/schemas/mutations/price.mutation.ts +0 -4
- package/core/src/schemas/mutations/product.mutation.ts +0 -4
- package/core/src/schemas/mutations/search.mutation.ts +0 -4
- package/core/src/schemas/queries/analytics.query.ts +0 -4
- package/core/src/schemas/queries/base.query.ts +1 -1
- package/core/src/schemas/queries/cart.query.ts +0 -1
- package/core/src/schemas/queries/inventory.query.ts +0 -4
- package/examples/next/src/app/page.tsx +20 -15
- package/examples/node/package.json +3 -1
- package/examples/node/src/basic/basic-node-provider-model-extension.spec.ts +13 -5
- package/examples/node/src/basic/basic-node-provider-query-extension.spec.ts +11 -1
- package/examples/node/src/basic/basic-node-setup.spec.ts +7 -3
- package/examples/node/src/test-utils.ts +26 -0
- package/otel/src/trace-decorator.ts +6 -5
- package/package.json +5 -4
- package/providers/algolia/package.json +1 -1
- package/providers/algolia/src/schema/configuration.schema.ts +1 -1
- package/providers/algolia/src/test/search.provider.spec.ts +29 -20
- package/providers/algolia/src/test/test-utils.ts +26 -0
- package/providers/commercetools/package.json +2 -2
- package/providers/commercetools/src/core/client.ts +26 -2
- package/providers/commercetools/src/core/initialize.ts +32 -6
- package/providers/commercetools/src/providers/cart.provider.ts +6 -4
- package/providers/commercetools/src/providers/category.provider.ts +2 -2
- package/providers/commercetools/src/providers/price.provider.ts +2 -1
- package/providers/commercetools/src/providers/search.provider.ts +33 -12
- package/providers/commercetools/src/schema/configuration.schema.ts +1 -1
- package/providers/commercetools/src/test/category.provider.spec.ts +1 -14
- package/providers/fake/package.json +1 -1
- package/providers/fake/src/core/initialize.ts +6 -8
- package/providers/fake/src/schema/configuration.schema.ts +3 -3
- package/providers/fake/src/test/category.provider.spec.ts +1 -3
- package/providers/posthog/package.json +1 -1
- package/providers/posthog/src/schema/configuration.schema.ts +1 -1
- package/trpc/package.json +1 -1
- package/trpc/src/integration.spec.ts +24 -23
- package/trpc/src/test-utils.ts +26 -0
- package/trpc/src/transparent-client.spec.ts +22 -26
- package/providers/algolia/src/test/product.provider.spec.ts +0 -18
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClientBuilder, NoOpCache } from '@reactionary/core';
|
|
2
2
|
import { withFakeCapabilities } from '@reactionary/provider-fake';
|
|
3
3
|
import { createTRPCServerRouter, introspectClient } from './index';
|
|
4
|
+
import { createAnonymousTestSession } from './test-utils';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Test suite for TRPC transparent client functionality
|
|
@@ -10,37 +11,32 @@ import { createTRPCServerRouter, introspectClient } from './index';
|
|
|
10
11
|
// Jest test framework is now available
|
|
11
12
|
|
|
12
13
|
// Create the server-side client using the same pattern as examples/node
|
|
13
|
-
const serverClient =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
const serverClient = new ClientBuilder()
|
|
15
|
+
.withCapability(
|
|
16
|
+
withFakeCapabilities(
|
|
17
|
+
{
|
|
18
|
+
jitter: {
|
|
19
|
+
mean: 0,
|
|
20
|
+
deviation: 0,
|
|
21
|
+
},
|
|
22
|
+
seeds: {
|
|
23
|
+
category: 1,
|
|
24
|
+
product: 1,
|
|
25
|
+
search: 1
|
|
26
|
+
}
|
|
26
27
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
cache: new NoOpCache(),
|
|
33
|
-
}
|
|
34
|
-
);
|
|
28
|
+
{ search: true, product: true, identity: false }
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
.withCache(new NoOpCache())
|
|
32
|
+
.build();
|
|
35
33
|
|
|
36
34
|
// Create TRPC router from the client
|
|
37
35
|
const router = createTRPCServerRouter(serverClient);
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
xdescribe('TRPC Transparent Client Core Functionality', () => {
|
|
40
38
|
|
|
41
|
-
const session =
|
|
42
|
-
id: '1234567890',
|
|
43
|
-
});
|
|
39
|
+
const session = createAnonymousTestSession();
|
|
44
40
|
|
|
45
41
|
describe('Client Introspection', () => {
|
|
46
42
|
it('should correctly introspect client methods', () => {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ProductSchema } from '@reactionary/core';
|
|
2
|
-
import { AlgoliaProductProvider } from '../providers/product.provider';
|
|
3
|
-
|
|
4
|
-
describe('Algolia Product Provider', () => {
|
|
5
|
-
it('should be able to get a product by id', async () => {
|
|
6
|
-
const provider = new AlgoliaProductProvider({
|
|
7
|
-
apiKey: process.env['ALGOLIA_API_KEY'] || '',
|
|
8
|
-
appId: process.env['ALGOLIA_APP_ID'] || '',
|
|
9
|
-
indexName: process.env['ALGOLIA_INDEX'] || ''
|
|
10
|
-
}, ProductSchema);
|
|
11
|
-
|
|
12
|
-
const result = await provider.get({ id: '4d28f98d-c446-446e-b59a-d9f718e5b98a'});
|
|
13
|
-
|
|
14
|
-
expect(result.identifier.key).toBe('4d28f98d-c446-446e-b59a-d9f718e5b98a');
|
|
15
|
-
expect(result.name).toBe('Sunnai Glass Bowl');
|
|
16
|
-
expect(result.image).toBe('https://res.cloudinary.com/dfke2ip5c/image/upload/c_thumb,w_200,g_face/v1744117881/6d189e9017e385a6a465b9099227ccae.jpeg');
|
|
17
|
-
});
|
|
18
|
-
});
|