@reactionary/source 0.0.41 → 0.0.48
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/.claude/settings.local.json +28 -0
- package/.env-template +8 -5
- package/.vscode/settings.json +5 -0
- package/README.md +41 -0
- package/core/package.json +3 -1
- package/core/src/cache/cache.interface.ts +14 -18
- package/core/src/cache/memory-cache.ts +56 -0
- package/core/src/cache/noop-cache.ts +5 -23
- package/core/src/cache/redis-cache.ts +28 -38
- package/core/src/client/client-builder.ts +3 -3
- package/core/src/client/client.ts +11 -9
- package/core/src/decorators/reactionary.decorator.ts +80 -8
- package/core/src/index.ts +5 -29
- package/core/src/initialization.ts +43 -0
- package/core/src/providers/analytics.provider.ts +1 -1
- package/core/src/providers/base.provider.ts +61 -25
- package/core/src/providers/cart-payment.provider.ts +57 -0
- package/core/src/providers/cart.provider.ts +131 -8
- package/core/src/providers/category.provider.ts +9 -9
- package/core/src/providers/identity.provider.ts +8 -7
- package/core/src/providers/index.ts +12 -0
- package/core/src/providers/inventory.provider.ts +4 -4
- package/core/src/providers/price.provider.ts +7 -7
- package/core/src/providers/product.provider.ts +17 -5
- package/core/src/providers/profile.provider.ts +22 -0
- package/core/src/providers/search.provider.ts +4 -4
- package/core/src/providers/store.provider.ts +14 -0
- package/core/src/schemas/capabilities.schema.ts +3 -1
- package/core/src/schemas/models/analytics.model.ts +1 -1
- package/core/src/schemas/models/cart.model.ts +16 -3
- package/core/src/schemas/models/identifiers.model.ts +90 -22
- package/core/src/schemas/models/identity.model.ts +23 -7
- package/core/src/schemas/models/index.ts +15 -0
- package/core/src/schemas/models/payment.model.ts +41 -0
- package/core/src/schemas/models/profile.model.ts +35 -0
- package/core/src/schemas/models/shipping-method.model.ts +14 -0
- package/core/src/schemas/models/store.model.ts +11 -0
- package/core/src/schemas/mutations/cart-payment.mutation.ts +21 -0
- package/core/src/schemas/mutations/cart.mutation.ts +62 -3
- package/core/src/schemas/mutations/identity.mutation.ts +8 -1
- package/core/src/schemas/mutations/index.ts +10 -0
- package/core/src/schemas/mutations/profile.mutation.ts +9 -0
- package/core/src/schemas/queries/cart-payment.query.ts +12 -0
- package/core/src/schemas/queries/cart.query.ts +1 -1
- package/core/src/schemas/queries/identity.query.ts +1 -1
- package/core/src/schemas/queries/index.ts +3 -0
- package/core/src/schemas/queries/inventory.query.ts +4 -12
- package/core/src/schemas/queries/price.query.ts +1 -1
- package/core/src/schemas/queries/profile.query.ts +7 -0
- package/core/src/schemas/queries/search.query.ts +1 -1
- package/core/src/schemas/queries/store.query.ts +11 -0
- package/core/src/schemas/session.schema.ts +31 -6
- package/eslint.config.mjs +7 -0
- package/examples/next/src/app/page.tsx +4 -12
- package/examples/node/package.json +1 -3
- package/examples/node/src/basic/basic-node-provider-model-extension.spec.ts +9 -8
- package/examples/node/src/basic/basic-node-provider-query-extension.spec.ts +4 -3
- package/examples/node/src/basic/basic-node-setup.spec.ts +4 -5
- package/nx.json +1 -0
- package/otel/src/metrics.ts +2 -1
- package/otel/src/provider-instrumentation.ts +2 -1
- package/otel/src/tracer.ts +7 -6
- package/otel/src/trpc-middleware.ts +3 -2
- package/package.json +2 -1
- package/providers/algolia/src/core/initialize.ts +4 -3
- package/providers/algolia/src/providers/product.provider.ts +15 -13
- package/providers/algolia/src/providers/search.provider.ts +9 -9
- package/providers/algolia/src/schema/capabilities.schema.ts +1 -1
- package/providers/algolia/src/test/search.provider.spec.ts +10 -10
- package/providers/algolia/src/test/test-utils.ts +9 -4
- package/providers/commercetools/README.md +27 -0
- package/providers/commercetools/src/core/client.ts +164 -117
- package/providers/commercetools/src/core/initialize.ts +24 -14
- package/providers/commercetools/src/providers/cart-payment.provider.ts +193 -0
- package/providers/commercetools/src/providers/cart.provider.ts +402 -125
- package/providers/commercetools/src/providers/category.provider.ts +35 -35
- package/providers/commercetools/src/providers/identity.provider.ts +23 -75
- package/providers/commercetools/src/providers/index.ts +2 -0
- package/providers/commercetools/src/providers/inventory.provider.ts +69 -40
- package/providers/commercetools/src/providers/price.provider.ts +79 -47
- package/providers/commercetools/src/providers/product.provider.ts +36 -30
- package/providers/commercetools/src/providers/profile.provider.ts +61 -0
- package/providers/commercetools/src/providers/search.provider.ts +16 -12
- package/providers/commercetools/src/providers/store.provider.ts +78 -0
- package/providers/commercetools/src/schema/capabilities.schema.ts +3 -1
- package/providers/commercetools/src/schema/commercetools.schema.ts +18 -0
- package/providers/commercetools/src/schema/configuration.schema.ts +2 -1
- package/providers/commercetools/src/test/cart-payment.provider.spec.ts +145 -0
- package/providers/commercetools/src/test/cart.provider.spec.ts +82 -22
- package/providers/commercetools/src/test/category.provider.spec.ts +18 -17
- package/providers/commercetools/src/test/identity.provider.spec.ts +88 -0
- package/providers/commercetools/src/test/inventory.provider.spec.ts +41 -0
- package/providers/commercetools/src/test/price.provider.spec.ts +9 -8
- package/providers/commercetools/src/test/product.provider.spec.ts +33 -5
- package/providers/commercetools/src/test/profile.provider.spec.ts +49 -0
- package/providers/commercetools/src/test/search.provider.spec.ts +8 -7
- package/providers/commercetools/src/test/store.provider.spec.ts +37 -0
- package/providers/commercetools/src/test/test-utils.ts +7 -31
- package/providers/fake/src/core/initialize.ts +96 -38
- package/providers/fake/src/providers/analytics.provider.ts +6 -5
- package/providers/fake/src/providers/cart.provider.ts +66 -19
- package/providers/fake/src/providers/category.provider.ts +12 -12
- package/providers/fake/src/providers/identity.provider.ts +22 -14
- package/providers/fake/src/providers/index.ts +1 -0
- package/providers/fake/src/providers/inventory.provider.ts +13 -13
- package/providers/fake/src/providers/price.provider.ts +13 -13
- package/providers/fake/src/providers/product.provider.ts +13 -10
- package/providers/fake/src/providers/search.provider.ts +7 -5
- package/providers/fake/src/providers/store.provider.ts +47 -0
- package/providers/fake/src/schema/capabilities.schema.ts +4 -1
- package/providers/fake/src/test/cart.provider.spec.ts +18 -18
- package/providers/fake/src/test/category.provider.spec.ts +55 -37
- package/providers/fake/src/test/price.provider.spec.ts +9 -14
- package/providers/fake/src/test/product.provider.spec.ts +27 -0
- package/providers/fake/src/test/test-utils.ts +2 -28
- package/providers/posthog/src/core/initialize.ts +3 -3
- package/providers/posthog/src/schema/capabilities.schema.ts +1 -1
- package/trpc/src/client.ts +42 -41
- package/trpc/src/index.ts +4 -3
- package/trpc/src/integration.spec.ts +11 -11
- package/trpc/src/server.ts +26 -24
- package/trpc/src/test-utils.ts +9 -4
- package/trpc/src/types.ts +24 -22
- package/core/src/cache/cache-evaluation.interface.ts +0 -19
- package/examples/node/src/test-utils.ts +0 -26
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styles from './page.module.scss';
|
|
2
|
-
import { ClientBuilder, NoOpCache, SessionSchema } from '@reactionary/core';
|
|
2
|
+
import { ClientBuilder, createInitialRequestContext, NoOpCache, SessionSchema } from '@reactionary/core';
|
|
3
3
|
import { withFakeCapabilities } from '@reactionary/provider-fake';
|
|
4
4
|
import { withCommercetoolsCapabilities } from '@reactionary/provider-commercetools';
|
|
5
5
|
|
|
@@ -23,17 +23,9 @@ export default async function Index() {
|
|
|
23
23
|
)
|
|
24
24
|
.withCache(new NoOpCache())
|
|
25
25
|
.build();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const session = SessionSchema.parse({
|
|
29
|
-
id: '1234567890',
|
|
30
|
-
languageContext: {
|
|
31
|
-
countryCode: 'US',
|
|
32
|
-
languageCode: 'en',
|
|
33
|
-
currencyCode: 'USD',
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
26
|
|
|
27
|
+
const reqCtx = createInitialRequestContext();
|
|
28
|
+
reqCtx.correlationId = 'nextjs-request-' + (new Date().getTime());
|
|
37
29
|
const search = await client.search.queryByTerm(
|
|
38
30
|
{
|
|
39
31
|
search: {
|
|
@@ -43,7 +35,7 @@ export default async function Index() {
|
|
|
43
35
|
term: 'glass',
|
|
44
36
|
},
|
|
45
37
|
},
|
|
46
|
-
|
|
38
|
+
reqCtx
|
|
47
39
|
);
|
|
48
40
|
|
|
49
41
|
return (
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Cache,
|
|
3
|
+
ProductQueryById,
|
|
4
|
+
ProductQueryBySlug} from '@reactionary/core';
|
|
1
5
|
import {
|
|
2
6
|
ClientBuilder,
|
|
3
|
-
Cache,
|
|
4
7
|
NoOpCache,
|
|
5
|
-
ProductSchema
|
|
6
|
-
ProductQueryById,
|
|
7
|
-
ProductQueryBySlug,
|
|
8
|
+
ProductSchema
|
|
8
9
|
} from '@reactionary/core';
|
|
9
10
|
import {
|
|
10
11
|
FakeProductProvider,
|
|
11
12
|
withFakeCapabilities,
|
|
12
13
|
} from '@reactionary/provider-fake';
|
|
13
|
-
import {
|
|
14
|
+
import { createInitialRequestContext } from '@reactionary/core'
|
|
14
15
|
import z from 'zod';
|
|
15
16
|
|
|
16
17
|
describe('basic node provider extension (models)', () => {
|
|
17
|
-
const
|
|
18
|
+
const reqCtx = createInitialRequestContext();
|
|
18
19
|
|
|
19
20
|
const ExtendedProductModel = ProductSchema.extend({
|
|
20
21
|
gtin: z.string().default('gtin-default'),
|
|
@@ -83,7 +84,7 @@ describe('basic node provider extension (models)', () => {
|
|
|
83
84
|
{
|
|
84
85
|
slug: '1234',
|
|
85
86
|
},
|
|
86
|
-
|
|
87
|
+
reqCtx
|
|
87
88
|
);
|
|
88
89
|
|
|
89
90
|
expect(product).toBeDefined();
|
|
@@ -95,7 +96,7 @@ describe('basic node provider extension (models)', () => {
|
|
|
95
96
|
{
|
|
96
97
|
id: '1234',
|
|
97
98
|
},
|
|
98
|
-
|
|
99
|
+
reqCtx
|
|
99
100
|
);
|
|
100
101
|
|
|
101
102
|
expect(product).toBeDefined();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { buildClient, NoOpCache, SessionSchema } from '@reactionary/core';
|
|
1
|
+
import { buildClient, createInitialRequestContext, NoOpCache, SessionSchema } from '@reactionary/core';
|
|
2
2
|
import { withFakeCapabilities } from '@reactionary/provider-fake';
|
|
3
|
-
import { createAnonymousTestSession } from '../test-utils';
|
|
4
3
|
|
|
5
4
|
describe('basic node setup', () => {
|
|
6
5
|
const client = buildClient(
|
|
@@ -25,7 +24,7 @@ describe('basic node setup', () => {
|
|
|
25
24
|
}
|
|
26
25
|
);
|
|
27
26
|
|
|
28
|
-
const
|
|
27
|
+
const reqCtx = createInitialRequestContext();
|
|
29
28
|
|
|
30
29
|
it('should only get back the enabled capabilities', async () => {
|
|
31
30
|
expect(client.product).toBeDefined();
|
|
@@ -35,9 +34,9 @@ describe('basic node setup', () => {
|
|
|
35
34
|
it('should be able to call the enabled capabilities', async () => {
|
|
36
35
|
const product = await client.product.getBySlug({
|
|
37
36
|
slug: '1234'
|
|
38
|
-
},
|
|
37
|
+
}, reqCtx);
|
|
39
38
|
|
|
40
39
|
expect(product).toBeDefined();
|
|
41
|
-
expect(product
|
|
40
|
+
expect(product!.slug).toBe('1234');
|
|
42
41
|
});
|
|
43
42
|
});
|
package/nx.json
CHANGED
package/otel/src/metrics.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meter, Counter, Histogram, UpDownCounter } from '@opentelemetry/api';
|
|
2
|
+
import { metrics } from '@opentelemetry/api';
|
|
2
3
|
|
|
3
4
|
const METER_NAME = '@reactionary/otel';
|
|
4
5
|
const METER_VERSION = '0.0.1';
|
package/otel/src/tracer.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
trace,
|
|
1
|
+
import type {
|
|
3
2
|
Tracer,
|
|
4
|
-
Span,
|
|
5
|
-
SpanStatusCode,
|
|
6
|
-
context as otelContext,
|
|
3
|
+
Span,
|
|
7
4
|
Context,
|
|
8
5
|
SpanOptions,
|
|
9
|
-
Attributes
|
|
6
|
+
Attributes} from '@opentelemetry/api';
|
|
7
|
+
import {
|
|
8
|
+
trace,
|
|
9
|
+
SpanStatusCode,
|
|
10
|
+
context as otelContext
|
|
10
11
|
} from '@opentelemetry/api';
|
|
11
12
|
|
|
12
13
|
const TRACER_NAME = '@reactionary/otel';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/source",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.48",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"dependencies": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"express-session": "^1.18.1",
|
|
40
40
|
"ioredis": "^5.6.1",
|
|
41
41
|
"next": "~15.2.4",
|
|
42
|
+
"node-object-hash": "^3.1.1",
|
|
42
43
|
"posthog-node": "^4.18.0",
|
|
43
44
|
"react": "19.0.0",
|
|
44
45
|
"react-dom": "19.0.0",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Client,
|
|
1
|
+
import type { Client, Cache } from "@reactionary/core";
|
|
2
|
+
import { ProductSchema } from "@reactionary/core";
|
|
2
3
|
import { AlgoliaProductProvider } from "../providers/product.provider";
|
|
3
4
|
import { AlgoliaSearchProvider } from "../providers/search.provider";
|
|
4
|
-
import { AlgoliaCapabilities } from "../schema/capabilities.schema";
|
|
5
|
-
import { AlgoliaConfiguration } from "../schema/configuration.schema";
|
|
5
|
+
import type { AlgoliaCapabilities } from "../schema/capabilities.schema";
|
|
6
|
+
import type { AlgoliaConfiguration } from "../schema/configuration.schema";
|
|
6
7
|
import { AlgoliaSearchResultSchema } from "../schema/search.schema";
|
|
7
8
|
|
|
8
9
|
export function withAlgoliaCapabilities(configuration: AlgoliaConfiguration, capabilities: AlgoliaCapabilities) {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Product,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Cache
|
|
1
|
+
import type {
|
|
2
|
+
Product,
|
|
3
|
+
ProductQueryById,
|
|
4
|
+
ProductQueryBySlug,
|
|
5
|
+
RequestContext,
|
|
6
|
+
Cache
|
|
8
7
|
} from '@reactionary/core';
|
|
9
|
-
import {
|
|
10
|
-
|
|
8
|
+
import {
|
|
9
|
+
ProductProvider
|
|
10
|
+
} from '@reactionary/core';
|
|
11
|
+
import type { z } from 'zod';
|
|
12
|
+
import type { AlgoliaConfiguration } from '../schema/configuration.schema';
|
|
11
13
|
|
|
12
14
|
export class AlgoliaProductProvider<
|
|
13
15
|
T extends Product = Product
|
|
@@ -22,7 +24,7 @@ export class AlgoliaProductProvider<
|
|
|
22
24
|
|
|
23
25
|
public override async getById(
|
|
24
26
|
payload: ProductQueryById,
|
|
25
|
-
|
|
27
|
+
_reqCtx: RequestContext
|
|
26
28
|
): Promise<T> {
|
|
27
29
|
// TODO: Implement Algolia product fetch by ID
|
|
28
30
|
const result = this.newModel();
|
|
@@ -34,13 +36,13 @@ export class AlgoliaProductProvider<
|
|
|
34
36
|
cache: { hit: false, key: payload.id },
|
|
35
37
|
placeholder: true
|
|
36
38
|
};
|
|
37
|
-
|
|
39
|
+
|
|
38
40
|
return this.assert(result);
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
public override async getBySlug(
|
|
42
44
|
payload: ProductQueryBySlug,
|
|
43
|
-
|
|
45
|
+
_reqCtx: RequestContext
|
|
44
46
|
): Promise<T> {
|
|
45
47
|
// TODO: Implement Algolia product fetch by slug
|
|
46
48
|
const result = this.newModel();
|
|
@@ -52,7 +54,7 @@ export class AlgoliaProductProvider<
|
|
|
52
54
|
cache: { hit: false, key: payload.slug },
|
|
53
55
|
placeholder: true
|
|
54
56
|
};
|
|
55
|
-
|
|
57
|
+
|
|
56
58
|
return this.assert(result);
|
|
57
59
|
}
|
|
58
60
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
+
type SearchQueryByTerm,
|
|
3
|
+
type SearchResult,
|
|
4
|
+
type SearchResultFacet,
|
|
5
|
+
type SearchResultProduct,
|
|
6
|
+
type RequestContext,
|
|
7
|
+
type Cache,
|
|
2
8
|
SearchProvider,
|
|
3
|
-
SearchQueryByTerm,
|
|
4
|
-
SearchResult,
|
|
5
|
-
SearchResultFacet,
|
|
6
|
-
SearchResultProduct,
|
|
7
|
-
Session,
|
|
8
|
-
Cache,
|
|
9
9
|
} from '@reactionary/core';
|
|
10
10
|
import { algoliasearch } from 'algoliasearch';
|
|
11
|
-
import { z } from 'zod';
|
|
12
|
-
import { AlgoliaConfiguration } from '../schema/configuration.schema';
|
|
11
|
+
import type { z } from 'zod';
|
|
12
|
+
import type { AlgoliaConfiguration } from '../schema/configuration.schema';
|
|
13
13
|
|
|
14
14
|
export class AlgoliaSearchProvider<
|
|
15
15
|
T extends SearchResult = SearchResult
|
|
@@ -24,7 +24,7 @@ export class AlgoliaSearchProvider<
|
|
|
24
24
|
|
|
25
25
|
public override async queryByTerm(
|
|
26
26
|
payload: SearchQueryByTerm,
|
|
27
|
-
|
|
27
|
+
_reqCtx: RequestContext
|
|
28
28
|
): Promise<SearchResult> {
|
|
29
29
|
const client = algoliasearch(this.config.appId, this.config.apiKey);
|
|
30
30
|
const remote = await client.search<unknown>({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import { createInitialRequestContext, NoOpCache, SearchResultSchema } from '@reactionary/core';
|
|
2
3
|
import { AlgoliaSearchProvider } from '../providers/search.provider';
|
|
3
|
-
import { createAnonymousTestSession } from './test-utils';
|
|
4
4
|
|
|
5
5
|
describe('Algolia Search Provider', () => {
|
|
6
6
|
const provider = new AlgoliaSearchProvider(
|
|
@@ -13,7 +13,7 @@ describe('Algolia Search Provider', () => {
|
|
|
13
13
|
new NoOpCache()
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const reqCtx = createInitialRequestContext();
|
|
17
17
|
|
|
18
18
|
it('should be able to get a result by term', async () => {
|
|
19
19
|
const result = await provider.queryByTerm({ search: {
|
|
@@ -21,7 +21,7 @@ describe('Algolia Search Provider', () => {
|
|
|
21
21
|
page: 0,
|
|
22
22
|
pageSize: 20,
|
|
23
23
|
facets: [],
|
|
24
|
-
}},
|
|
24
|
+
}}, reqCtx);
|
|
25
25
|
|
|
26
26
|
expect(result.products.length).toBeGreaterThan(0);
|
|
27
27
|
expect(result.facets.length).toBe(2);
|
|
@@ -35,14 +35,14 @@ describe('Algolia Search Provider', () => {
|
|
|
35
35
|
page: 0,
|
|
36
36
|
pageSize: 20,
|
|
37
37
|
facets: [],
|
|
38
|
-
}},
|
|
38
|
+
}}, reqCtx);
|
|
39
39
|
|
|
40
40
|
const secondPage = await provider.queryByTerm({ search: {
|
|
41
41
|
term: 'glass',
|
|
42
42
|
page: 1,
|
|
43
43
|
pageSize: 20,
|
|
44
44
|
facets: [],
|
|
45
|
-
}},
|
|
45
|
+
}}, reqCtx);
|
|
46
46
|
|
|
47
47
|
expect(firstPage.identifier.page).toBe(0);
|
|
48
48
|
expect(secondPage.identifier.page).toBe(1);
|
|
@@ -57,13 +57,13 @@ describe('Algolia Search Provider', () => {
|
|
|
57
57
|
page: 0,
|
|
58
58
|
pageSize: 2,
|
|
59
59
|
facets: [],
|
|
60
|
-
}},
|
|
60
|
+
}}, reqCtx);
|
|
61
61
|
const largePage = await provider.queryByTerm({ search: {
|
|
62
62
|
term: 'glass',
|
|
63
63
|
page: 0,
|
|
64
64
|
pageSize: 30,
|
|
65
65
|
facets: [],
|
|
66
|
-
}},
|
|
66
|
+
}}, reqCtx);
|
|
67
67
|
|
|
68
68
|
expect(smallPage.products.length).toBe(2);
|
|
69
69
|
expect(smallPage.identifier.pageSize).toBe(2);
|
|
@@ -77,14 +77,14 @@ describe('Algolia Search Provider', () => {
|
|
|
77
77
|
page: 0,
|
|
78
78
|
pageSize: 2,
|
|
79
79
|
facets: [],
|
|
80
|
-
}},
|
|
80
|
+
}}, reqCtx);
|
|
81
81
|
|
|
82
82
|
const filtered = await provider.queryByTerm({ search: {
|
|
83
83
|
term: 'glass',
|
|
84
84
|
page: 0,
|
|
85
85
|
pageSize: 2,
|
|
86
86
|
facets: [initial.facets[0].values[0].identifier],
|
|
87
|
-
}},
|
|
87
|
+
}}, reqCtx);
|
|
88
88
|
|
|
89
89
|
expect(initial.pages).toBeGreaterThan(filtered.pages);
|
|
90
90
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Session } from "@reactionary/core";
|
|
1
|
+
import type { Session } from "@reactionary/core";
|
|
2
2
|
|
|
3
3
|
export function createAnonymousTestSession(): Session {
|
|
4
4
|
return {
|
|
@@ -9,10 +9,15 @@ export function createAnonymousTestSession(): Session {
|
|
|
9
9
|
cache: { hit: false, key: '' },
|
|
10
10
|
placeholder: false,
|
|
11
11
|
},
|
|
12
|
-
id: '',
|
|
12
|
+
id: { userId: 'anonymous' },
|
|
13
13
|
token: undefined,
|
|
14
14
|
issued: new Date(),
|
|
15
|
-
expiry: new Date(new Date().getTime() + 3600 * 1000),
|
|
15
|
+
expiry: new Date(new Date().getTime() + 3600 * 1000),
|
|
16
|
+
logonId: "",
|
|
17
|
+
createdAt: "",
|
|
18
|
+
updatedAt: "",
|
|
19
|
+
keyring: [],
|
|
20
|
+
currentService: undefined
|
|
16
21
|
},
|
|
17
22
|
languageContext: {
|
|
18
23
|
locale: 'en-US',
|
|
@@ -23,4 +28,4 @@ export function createAnonymousTestSession(): Session {
|
|
|
23
28
|
key: 'the-good-store',
|
|
24
29
|
},
|
|
25
30
|
};
|
|
26
|
-
}
|
|
31
|
+
}
|
|
@@ -9,3 +9,30 @@ Run `nx build provider-commercetools` to build the library.
|
|
|
9
9
|
## Running unit tests
|
|
10
10
|
|
|
11
11
|
Run `nx test provider-commercetools` to execute the unit tests via [Jest](https://jestjs.io).
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# ASSUMPTIONS for backend config
|
|
15
|
+
|
|
16
|
+
- You will have 2 different channels for prices, one called `Offer Price` and one called `List Price`
|
|
17
|
+
- ProductVariants will all have unique SKU values.
|
|
18
|
+
- Your Supply Channels double as Store Locations
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## TODO List
|
|
23
|
+
|
|
24
|
+
### Core
|
|
25
|
+
- [ ] Figure out if we are actually running as anonymous user towards CT. It feels weird right now.
|
|
26
|
+
|
|
27
|
+
### Price
|
|
28
|
+
- [ ] PriceProvider should be able to use both embedded and standalone prices? Possible by querying through product-projection maybe?
|
|
29
|
+
- [ ] If not, using product-projection, the logic in https://docs.commercetools.com/api/pricing-and-discounts-overview#price-selection should be replicated
|
|
30
|
+
- [ ] add list price by convention. Like key: LP-<sku> or something.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Inventory
|
|
34
|
+
- [ ] Be traced and cached
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|