@unchainedshop/api 3.0.0-rc.12 → 3.0.0-rc.13
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/lib/context.d.ts +2 -1
- package/lib/context.d.ts.map +1 -1
- package/lib/loaders/index.d.ts +103 -59
- package/lib/loaders/index.d.ts.map +1 -1
- package/lib/loaders/index.js +74 -45
- package/lib/loaders/index.js.map +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortmentProduct.js +1 -1
- package/lib/resolvers/mutations/assortments/removeAssortmentProduct.js.map +1 -1
- package/lib/resolvers/mutations/products/removeProductReviewVote.d.ts +1 -1
- package/lib/resolvers/mutations/products/removeProductReviewVote.d.ts.map +1 -1
- package/lib/resolvers/queries/index.d.ts +1 -0
- package/lib/resolvers/queries/index.d.ts.map +1 -1
- package/lib/resolvers/queries/index.js +2 -0
- package/lib/resolvers/queries/index.js.map +1 -1
- package/lib/resolvers/queries/warehousing/tokens.d.ts +2 -1
- package/lib/resolvers/queries/warehousing/tokens.d.ts.map +1 -1
- package/lib/resolvers/queries/warehousing/tokens.js +2 -2
- package/lib/resolvers/queries/warehousing/tokens.js.map +1 -1
- package/lib/resolvers/queries/warehousing/tokensCount.d.ts +5 -0
- package/lib/resolvers/queries/warehousing/tokensCount.d.ts.map +1 -0
- package/lib/resolvers/queries/warehousing/tokensCount.js +6 -0
- package/lib/resolvers/queries/warehousing/tokensCount.js.map +1 -0
- package/lib/resolvers/type/assortment/assortment-path-link-types.d.ts +7 -9
- package/lib/resolvers/type/assortment/assortment-path-link-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-path-link-types.js +9 -7
- package/lib/resolvers/type/assortment/assortment-path-link-types.js.map +1 -1
- package/lib/resolvers/type/assortment/assortment-types.d.ts +1 -1
- package/lib/resolvers/type/assortment/assortment-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-types.js +9 -2
- package/lib/resolvers/type/assortment/assortment-types.js.map +1 -1
- package/lib/resolvers/type/index.d.ts +14 -8
- package/lib/resolvers/type/index.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-bundle-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-bundle-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-configurable-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-plan-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-simple-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-types.d.ts +1 -1
- package/lib/resolvers/type/product/product-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-types.js +9 -2
- package/lib/resolvers/type/product/product-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-vector.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-vector.js +4 -1
- package/lib/resolvers/type/product/product-variation-assignment-vector.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-types.js +5 -2
- package/lib/resolvers/type/product/product-variation-types.js.map +1 -1
- package/lib/schema/query.d.ts.map +1 -1
- package/lib/schema/query.js +6 -1
- package/lib/schema/query.js.map +1 -1
- package/package.json +6 -6
- package/src/context.ts +1 -1
- package/src/loaders/index.ts +202 -188
- package/src/resolvers/mutations/assortments/removeAssortmentProduct.ts +1 -1
- package/src/resolvers/queries/index.ts +2 -0
- package/src/resolvers/queries/warehousing/tokens.ts +3 -1
- package/src/resolvers/queries/warehousing/tokensCount.ts +12 -0
- package/src/resolvers/type/assortment/assortment-path-link-types.ts +14 -19
- package/src/resolvers/type/assortment/assortment-types.ts +17 -5
- package/src/resolvers/type/product/product-types.ts +17 -5
- package/src/resolvers/type/product/product-variation-assignment-vector.ts +4 -1
- package/src/resolvers/type/product/product-variation-types.ts +5 -2
- package/src/schema/query.ts +6 -1
|
@@ -18,15 +18,27 @@ export const Product = {
|
|
|
18
18
|
params: {
|
|
19
19
|
forceLocale?: string;
|
|
20
20
|
},
|
|
21
|
-
{ modules }: Context,
|
|
21
|
+
{ modules, loaders }: Context,
|
|
22
22
|
): Promise<
|
|
23
23
|
Array<{
|
|
24
24
|
links: Array<AssortmentPathLink>;
|
|
25
25
|
}>
|
|
26
26
|
> {
|
|
27
|
-
return modules.assortments.breadcrumbs(
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
return modules.assortments.breadcrumbs(
|
|
28
|
+
{
|
|
29
|
+
productId: product._id,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
resolveAssortmentProducts: async (productId) =>
|
|
33
|
+
loaders.assortmentProductsLoader.load({
|
|
34
|
+
productId,
|
|
35
|
+
}),
|
|
36
|
+
resolveAssortmentLinks: async (childAssortmentId) =>
|
|
37
|
+
loaders.assortmentLinksLoader.load({
|
|
38
|
+
childAssortmentId,
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
41
|
+
);
|
|
30
42
|
},
|
|
31
43
|
|
|
32
44
|
// TODO: Use a loader!
|
|
@@ -103,7 +115,7 @@ export const Product = {
|
|
|
103
115
|
|
|
104
116
|
if (!assortmentIds.length) return [];
|
|
105
117
|
|
|
106
|
-
const productIds = await modules.assortments.products.
|
|
118
|
+
const productIds = await modules.assortments.products.findSiblings({
|
|
107
119
|
productId,
|
|
108
120
|
assortmentIds,
|
|
109
121
|
});
|
|
@@ -22,7 +22,10 @@ export const ProductVariationAssignmentVector: ProductVariationAssignmentVectorH
|
|
|
22
22
|
key: obj.key,
|
|
23
23
|
productId: obj.product._id,
|
|
24
24
|
});
|
|
25
|
-
return
|
|
25
|
+
return {
|
|
26
|
+
_id: productVariation._id,
|
|
27
|
+
productVariationOption: obj.value,
|
|
28
|
+
};
|
|
26
29
|
},
|
|
27
30
|
|
|
28
31
|
variation: (obj, _, { modules }) => {
|
|
@@ -21,8 +21,11 @@ export interface ProductVariationHelperTypes {
|
|
|
21
21
|
texts: HelperType<{ forceLocale?: string }, Promise<ProductVariationText>>;
|
|
22
22
|
}
|
|
23
23
|
export const ProductVariation: ProductVariationHelperTypes = {
|
|
24
|
-
options: (obj
|
|
25
|
-
return (obj.options || []).map((option) =>
|
|
24
|
+
options: (obj) => {
|
|
25
|
+
return (obj.options || []).map((option) => ({
|
|
26
|
+
_id: obj._id,
|
|
27
|
+
productVariationOption: option,
|
|
28
|
+
}));
|
|
26
29
|
},
|
|
27
30
|
|
|
28
31
|
texts: async (obj, { forceLocale }, { modules, localeContext }) => {
|
package/src/schema/query.ts
CHANGED
|
@@ -211,7 +211,12 @@ export default [
|
|
|
211
211
|
"""
|
|
212
212
|
Get all tokens
|
|
213
213
|
"""
|
|
214
|
-
tokens(limit: Int = 10, offset: Int = 0): [Token!]!
|
|
214
|
+
tokens(queryString: String, limit: Int = 10, offset: Int = 0): [Token!]!
|
|
215
|
+
|
|
216
|
+
"""
|
|
217
|
+
Returns total tokens
|
|
218
|
+
"""
|
|
219
|
+
tokensCount(queryString: String): Int!
|
|
215
220
|
|
|
216
221
|
"""
|
|
217
222
|
Returns total number of payment providers, optionally filtered by type
|