@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.
Files changed (52) hide show
  1. package/core/package.json +1 -1
  2. package/core/src/decorators/reactionary.decorator.ts +16 -0
  3. package/core/src/index.ts +2 -0
  4. package/core/src/schemas/capabilities.schema.ts +1 -1
  5. package/core/src/schemas/models/base.model.ts +5 -5
  6. package/core/src/schemas/models/cart.model.ts +1 -1
  7. package/core/src/schemas/models/identifiers.model.ts +12 -12
  8. package/core/src/schemas/models/price.model.ts +1 -1
  9. package/core/src/schemas/models/product.model.ts +2 -2
  10. package/core/src/schemas/models/search.model.ts +3 -3
  11. package/core/src/schemas/mutations/base.mutation.ts +1 -1
  12. package/core/src/schemas/mutations/cart.mutation.ts +6 -6
  13. package/core/src/schemas/mutations/inventory.mutation.ts +0 -4
  14. package/core/src/schemas/mutations/price.mutation.ts +0 -4
  15. package/core/src/schemas/mutations/product.mutation.ts +0 -4
  16. package/core/src/schemas/mutations/search.mutation.ts +0 -4
  17. package/core/src/schemas/queries/analytics.query.ts +0 -4
  18. package/core/src/schemas/queries/base.query.ts +1 -1
  19. package/core/src/schemas/queries/cart.query.ts +0 -1
  20. package/core/src/schemas/queries/inventory.query.ts +0 -4
  21. package/examples/next/src/app/page.tsx +20 -15
  22. package/examples/node/package.json +3 -1
  23. package/examples/node/src/basic/basic-node-provider-model-extension.spec.ts +13 -5
  24. package/examples/node/src/basic/basic-node-provider-query-extension.spec.ts +11 -1
  25. package/examples/node/src/basic/basic-node-setup.spec.ts +7 -3
  26. package/examples/node/src/test-utils.ts +26 -0
  27. package/otel/src/trace-decorator.ts +6 -5
  28. package/package.json +5 -4
  29. package/providers/algolia/package.json +1 -1
  30. package/providers/algolia/src/schema/configuration.schema.ts +1 -1
  31. package/providers/algolia/src/test/search.provider.spec.ts +29 -20
  32. package/providers/algolia/src/test/test-utils.ts +26 -0
  33. package/providers/commercetools/package.json +2 -2
  34. package/providers/commercetools/src/core/client.ts +26 -2
  35. package/providers/commercetools/src/core/initialize.ts +32 -6
  36. package/providers/commercetools/src/providers/cart.provider.ts +6 -4
  37. package/providers/commercetools/src/providers/category.provider.ts +2 -2
  38. package/providers/commercetools/src/providers/price.provider.ts +2 -1
  39. package/providers/commercetools/src/providers/search.provider.ts +33 -12
  40. package/providers/commercetools/src/schema/configuration.schema.ts +1 -1
  41. package/providers/commercetools/src/test/category.provider.spec.ts +1 -14
  42. package/providers/fake/package.json +1 -1
  43. package/providers/fake/src/core/initialize.ts +6 -8
  44. package/providers/fake/src/schema/configuration.schema.ts +3 -3
  45. package/providers/fake/src/test/category.provider.spec.ts +1 -3
  46. package/providers/posthog/package.json +1 -1
  47. package/providers/posthog/src/schema/configuration.schema.ts +1 -1
  48. package/trpc/package.json +1 -1
  49. package/trpc/src/integration.spec.ts +24 -23
  50. package/trpc/src/test-utils.ts +26 -0
  51. package/trpc/src/transparent-client.spec.ts +22 -26
  52. package/providers/algolia/src/test/product.provider.spec.ts +0 -18
@@ -1,6 +1,7 @@
1
- import { buildClient, NoOpCache, SessionSchema } from '@reactionary/core';
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 = buildClient(
14
- [
15
- withFakeCapabilities(
16
- {
17
- jitter: {
18
- mean: 0,
19
- deviation: 0,
20
- },
21
- seeds: {
22
- product: 12345,
23
- category: 12345,
24
- cart: 12345,
25
- search: 0
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
- { search: true, product: true, identity: false, cart: true }
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
- describe('TRPC Transparent Client Core Functionality', () => {
37
+ xdescribe('TRPC Transparent Client Core Functionality', () => {
40
38
 
41
- const session = SessionSchema.parse({
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
- });