@reactionary/examples-node 0.6.1 → 0.6.2
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/package.json +7 -7
- package/src/basic/basic-node-provider-model-extension.spec.ts +10 -4
- package/src/basic/basic-node-provider-query-extension.spec.ts +8 -2
- package/src/basic/basic-node-setup.spec.ts +5 -1
- package/src/basic/client-creation.spec.ts +3 -3
- package/src/utils.ts +41 -41
- package/tsconfig.lib.json +2 -1
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/examples-node",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@reactionary/core": "0.6.
|
|
8
|
-
"@reactionary/provider-commercetools": "0.6.
|
|
9
|
-
"@reactionary/provider-algolia": "0.6.
|
|
10
|
-
"@reactionary/provider-medusa": "0.6.
|
|
11
|
-
"@reactionary/provider-meilisearch": "0.6.
|
|
12
|
-
"@reactionary/provider-fake": "0.6.
|
|
7
|
+
"@reactionary/core": "0.6.2",
|
|
8
|
+
"@reactionary/provider-commercetools": "0.6.2",
|
|
9
|
+
"@reactionary/provider-algolia": "0.6.2",
|
|
10
|
+
"@reactionary/provider-medusa": "0.6.2",
|
|
11
|
+
"@reactionary/provider-meilisearch": "0.6.2",
|
|
12
|
+
"@reactionary/provider-fake": "0.6.2"
|
|
13
13
|
},
|
|
14
14
|
"type": "module"
|
|
15
15
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ProductSchema
|
|
8
8
|
} from '@reactionary/core';
|
|
9
9
|
import {
|
|
10
|
+
FakeProductFactory,
|
|
10
11
|
FakeProductProvider,
|
|
11
12
|
withFakeCapabilities,
|
|
12
13
|
} from '@reactionary/provider-fake';
|
|
@@ -23,9 +24,9 @@ describe('basic node provider extension (models)', () => {
|
|
|
23
24
|
type ExtendedProduct = z.infer<typeof ExtendedProductModel>;
|
|
24
25
|
|
|
25
26
|
class ExtendedProductProvider extends FakeProductProvider {
|
|
26
|
-
protected override
|
|
27
|
+
protected override composeSingle(body: string): ExtendedProduct {
|
|
27
28
|
const result = {
|
|
28
|
-
...super.
|
|
29
|
+
...super.composeSingle(body),
|
|
29
30
|
gtin: 'gtin-1234'
|
|
30
31
|
} satisfies ExtendedProduct;
|
|
31
32
|
|
|
@@ -44,7 +45,8 @@ describe('basic node provider extension (models)', () => {
|
|
|
44
45
|
search: 1
|
|
45
46
|
} },
|
|
46
47
|
cache,
|
|
47
|
-
context
|
|
48
|
+
context,
|
|
49
|
+
new FakeProductFactory(ExtendedProductModel)
|
|
48
50
|
),
|
|
49
51
|
};
|
|
50
52
|
|
|
@@ -66,7 +68,11 @@ describe('basic node provider extension (models)', () => {
|
|
|
66
68
|
search: 1
|
|
67
69
|
}
|
|
68
70
|
},
|
|
69
|
-
{
|
|
71
|
+
{
|
|
72
|
+
productSearch: { enabled: true },
|
|
73
|
+
product: { enabled: false },
|
|
74
|
+
identity: { enabled: false },
|
|
75
|
+
}
|
|
70
76
|
)
|
|
71
77
|
)
|
|
72
78
|
.withCapability(withExtendedCapabilities())
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
ProductSchema
|
|
10
10
|
} from '@reactionary/core';
|
|
11
11
|
import {
|
|
12
|
+
FakeProductFactory,
|
|
12
13
|
FakeProductProvider,
|
|
13
14
|
withFakeCapabilities,
|
|
14
15
|
} from '@reactionary/provider-fake';
|
|
@@ -60,7 +61,8 @@ describe('basic node provider extension (models)', () => {
|
|
|
60
61
|
search: 1
|
|
61
62
|
}},
|
|
62
63
|
cache,
|
|
63
|
-
context
|
|
64
|
+
context,
|
|
65
|
+
new FakeProductFactory(ProductSchema)
|
|
64
66
|
),
|
|
65
67
|
};
|
|
66
68
|
|
|
@@ -83,7 +85,11 @@ describe('basic node provider extension (models)', () => {
|
|
|
83
85
|
search: 1
|
|
84
86
|
}
|
|
85
87
|
},
|
|
86
|
-
{
|
|
88
|
+
{
|
|
89
|
+
productSearch: { enabled: true },
|
|
90
|
+
product: { enabled: false },
|
|
91
|
+
identity: { enabled: false },
|
|
92
|
+
}
|
|
87
93
|
)
|
|
88
94
|
)
|
|
89
95
|
.withCapability(withExtendedCapabilities())
|
|
@@ -29,7 +29,11 @@ describe('basic node setup', () => {
|
|
|
29
29
|
search: 1,
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
-
{
|
|
32
|
+
{
|
|
33
|
+
productSearch: { enabled: true },
|
|
34
|
+
product: { enabled: true },
|
|
35
|
+
identity: { enabled: false },
|
|
36
|
+
}
|
|
33
37
|
)
|
|
34
38
|
)
|
|
35
39
|
.withCache(new NoOpCache())
|
|
@@ -21,7 +21,7 @@ describe('client creation', () => {
|
|
|
21
21
|
search: 1,
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
|
-
{ product: true }
|
|
24
|
+
{ product: { enabled: true } }
|
|
25
25
|
)
|
|
26
26
|
)
|
|
27
27
|
.withCapability(
|
|
@@ -34,14 +34,14 @@ describe('client creation', () => {
|
|
|
34
34
|
projectKey: '',
|
|
35
35
|
scopes: [],
|
|
36
36
|
facetFieldsForSearch: []
|
|
37
|
-
}, { cart: true })
|
|
37
|
+
}, { cart: { enabled: true } })
|
|
38
38
|
)
|
|
39
39
|
.withCapability(
|
|
40
40
|
withAlgoliaCapabilities({
|
|
41
41
|
apiKey: '',
|
|
42
42
|
appId: '',
|
|
43
43
|
indexName: ''
|
|
44
|
-
}, { productSearch: true })
|
|
44
|
+
}, { productSearch: { enabled: true } })
|
|
45
45
|
)
|
|
46
46
|
.withCache(new NoOpCache())
|
|
47
47
|
.build();
|
package/src/utils.ts
CHANGED
|
@@ -99,20 +99,20 @@ export function createClient(provider: PrimaryProvider) {
|
|
|
99
99
|
if (provider === PrimaryProvider.MEDUSA) {
|
|
100
100
|
builder = builder.withCapability(
|
|
101
101
|
withMedusaCapabilities( getMedusaTestConfiguration(), {
|
|
102
|
-
cart: true,
|
|
103
|
-
product: true,
|
|
104
|
-
category: true,
|
|
105
|
-
checkout: true,
|
|
106
|
-
identity: true,
|
|
107
|
-
inventory: true,
|
|
108
|
-
order: true,
|
|
109
|
-
price: true,
|
|
110
|
-
productSearch: true,
|
|
111
|
-
productRecommendations: true,
|
|
112
|
-
productAssociations: true,
|
|
113
|
-
orderSearch: true,
|
|
114
|
-
store: true,
|
|
115
|
-
profile: true,
|
|
102
|
+
cart: { enabled: true },
|
|
103
|
+
product: { enabled: true },
|
|
104
|
+
category: { enabled: true },
|
|
105
|
+
checkout: { enabled: true },
|
|
106
|
+
identity: { enabled: true },
|
|
107
|
+
inventory: { enabled: true },
|
|
108
|
+
order: { enabled: true },
|
|
109
|
+
price: { enabled: true },
|
|
110
|
+
productSearch: { enabled: true },
|
|
111
|
+
productRecommendations: { enabled: true },
|
|
112
|
+
productAssociations: { enabled: true },
|
|
113
|
+
orderSearch: { enabled: true },
|
|
114
|
+
store: { enabled: true },
|
|
115
|
+
profile: { enabled: true },
|
|
116
116
|
})
|
|
117
117
|
);
|
|
118
118
|
}
|
|
@@ -120,11 +120,11 @@ export function createClient(provider: PrimaryProvider) {
|
|
|
120
120
|
if (provider === PrimaryProvider.FAKE) {
|
|
121
121
|
builder = builder.withCapability(
|
|
122
122
|
withFakeCapabilities( getFakeConfiguration() , {
|
|
123
|
-
price: true,
|
|
124
|
-
inventory: true,
|
|
125
|
-
product: true,
|
|
126
|
-
productReviews: true,
|
|
127
|
-
productAssociations: true,
|
|
123
|
+
price: { enabled: true },
|
|
124
|
+
inventory: { enabled: true },
|
|
125
|
+
product: { enabled: true },
|
|
126
|
+
productReviews: { enabled: true },
|
|
127
|
+
productAssociations: { enabled: true },
|
|
128
128
|
}
|
|
129
129
|
))
|
|
130
130
|
}
|
|
@@ -132,21 +132,21 @@ export function createClient(provider: PrimaryProvider) {
|
|
|
132
132
|
if (provider === PrimaryProvider.COMMERCETOOLS) {
|
|
133
133
|
builder = builder.withCapability(
|
|
134
134
|
withCommercetoolsCapabilities(getCommercetoolsTestConfiguration(), {
|
|
135
|
-
cart: true,
|
|
136
|
-
product: true,
|
|
137
|
-
category: true,
|
|
138
|
-
checkout: true,
|
|
139
|
-
identity: true,
|
|
140
|
-
inventory: true,
|
|
141
|
-
order: true,
|
|
142
|
-
price: true,
|
|
143
|
-
productSearch: true,
|
|
144
|
-
productAssociations: true,
|
|
145
|
-
productReviews: true,
|
|
146
|
-
productList: true,
|
|
147
|
-
orderSearch: true,
|
|
148
|
-
store: true,
|
|
149
|
-
profile: true,
|
|
135
|
+
cart: { enabled: true },
|
|
136
|
+
product: { enabled: true },
|
|
137
|
+
category: { enabled: true },
|
|
138
|
+
checkout: { enabled: true },
|
|
139
|
+
identity: { enabled: true },
|
|
140
|
+
inventory: { enabled: true },
|
|
141
|
+
order: { enabled: true },
|
|
142
|
+
price: { enabled: true },
|
|
143
|
+
productSearch: { enabled: true },
|
|
144
|
+
productAssociations: { enabled: true },
|
|
145
|
+
productReviews: { enabled: true },
|
|
146
|
+
productList: { enabled: true },
|
|
147
|
+
orderSearch: { enabled: true },
|
|
148
|
+
store: { enabled: true },
|
|
149
|
+
profile: { enabled: true },
|
|
150
150
|
})
|
|
151
151
|
);
|
|
152
152
|
}
|
|
@@ -155,8 +155,8 @@ export function createClient(provider: PrimaryProvider) {
|
|
|
155
155
|
if (provider === PrimaryProvider.ALGOLIA) {
|
|
156
156
|
builder = builder.withCapability(
|
|
157
157
|
withAlgoliaCapabilities(getAlgoliaTestConfiguration(), {
|
|
158
|
-
productSearch: true,
|
|
159
|
-
productRecommendations: true,
|
|
158
|
+
productSearch: { enabled: true },
|
|
159
|
+
productRecommendations: { enabled: true },
|
|
160
160
|
})
|
|
161
161
|
);
|
|
162
162
|
}
|
|
@@ -164,15 +164,15 @@ export function createClient(provider: PrimaryProvider) {
|
|
|
164
164
|
if (provider === PrimaryProvider.MEILISEARCH) {
|
|
165
165
|
builder = builder.withCapability(
|
|
166
166
|
withMeilisearchCapabilities(getMeilisearchTestConfiguration(), {
|
|
167
|
-
productSearch: true,
|
|
168
|
-
orderSearch: true,
|
|
169
|
-
productRecommendations: true,
|
|
167
|
+
productSearch: { enabled: true },
|
|
168
|
+
orderSearch: { enabled: true },
|
|
169
|
+
productRecommendations: { enabled: true },
|
|
170
170
|
}),
|
|
171
171
|
);
|
|
172
172
|
builder = builder.withCapability(
|
|
173
173
|
withMedusaCapabilities(getMedusaTestConfiguration(), {
|
|
174
|
-
cart: true,
|
|
175
|
-
identity: true,
|
|
174
|
+
cart: { enabled: true },
|
|
175
|
+
identity: { enabled: true },
|
|
176
176
|
})
|
|
177
177
|
);
|
|
178
178
|
}
|