@unchainedshop/api 3.0.0-rc.11 → 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.
Files changed (68) hide show
  1. package/lib/context.d.ts +2 -1
  2. package/lib/context.d.ts.map +1 -1
  3. package/lib/loaders/index.d.ts +103 -59
  4. package/lib/loaders/index.d.ts.map +1 -1
  5. package/lib/loaders/index.js +74 -45
  6. package/lib/loaders/index.js.map +1 -1
  7. package/lib/resolvers/mutations/assortments/removeAssortmentProduct.js +1 -1
  8. package/lib/resolvers/mutations/assortments/removeAssortmentProduct.js.map +1 -1
  9. package/lib/resolvers/mutations/products/removeProductReviewVote.d.ts +1 -1
  10. package/lib/resolvers/mutations/products/removeProductReviewVote.d.ts.map +1 -1
  11. package/lib/resolvers/queries/index.d.ts +1 -0
  12. package/lib/resolvers/queries/index.d.ts.map +1 -1
  13. package/lib/resolvers/queries/index.js +2 -0
  14. package/lib/resolvers/queries/index.js.map +1 -1
  15. package/lib/resolvers/queries/warehousing/tokens.d.ts +2 -1
  16. package/lib/resolvers/queries/warehousing/tokens.d.ts.map +1 -1
  17. package/lib/resolvers/queries/warehousing/tokens.js +2 -2
  18. package/lib/resolvers/queries/warehousing/tokens.js.map +1 -1
  19. package/lib/resolvers/queries/warehousing/tokensCount.d.ts +5 -0
  20. package/lib/resolvers/queries/warehousing/tokensCount.d.ts.map +1 -0
  21. package/lib/resolvers/queries/warehousing/tokensCount.js +6 -0
  22. package/lib/resolvers/queries/warehousing/tokensCount.js.map +1 -0
  23. package/lib/resolvers/type/assortment/assortment-path-link-types.d.ts +7 -9
  24. package/lib/resolvers/type/assortment/assortment-path-link-types.d.ts.map +1 -1
  25. package/lib/resolvers/type/assortment/assortment-path-link-types.js +9 -7
  26. package/lib/resolvers/type/assortment/assortment-path-link-types.js.map +1 -1
  27. package/lib/resolvers/type/assortment/assortment-types.d.ts +1 -1
  28. package/lib/resolvers/type/assortment/assortment-types.d.ts.map +1 -1
  29. package/lib/resolvers/type/assortment/assortment-types.js +9 -2
  30. package/lib/resolvers/type/assortment/assortment-types.js.map +1 -1
  31. package/lib/resolvers/type/index.d.ts +14 -8
  32. package/lib/resolvers/type/index.d.ts.map +1 -1
  33. package/lib/resolvers/type/product/product-bundle-types.d.ts +1 -1
  34. package/lib/resolvers/type/product/product-bundle-types.d.ts.map +1 -1
  35. package/lib/resolvers/type/product/product-configurable-types.d.ts +1 -1
  36. package/lib/resolvers/type/product/product-configurable-types.d.ts.map +1 -1
  37. package/lib/resolvers/type/product/product-plan-types.d.ts +1 -1
  38. package/lib/resolvers/type/product/product-plan-types.d.ts.map +1 -1
  39. package/lib/resolvers/type/product/product-simple-types.d.ts +1 -1
  40. package/lib/resolvers/type/product/product-simple-types.d.ts.map +1 -1
  41. package/lib/resolvers/type/product/product-tokenized-types.d.ts +1 -1
  42. package/lib/resolvers/type/product/product-tokenized-types.d.ts.map +1 -1
  43. package/lib/resolvers/type/product/product-types.d.ts +1 -1
  44. package/lib/resolvers/type/product/product-types.d.ts.map +1 -1
  45. package/lib/resolvers/type/product/product-types.js +9 -2
  46. package/lib/resolvers/type/product/product-types.js.map +1 -1
  47. package/lib/resolvers/type/product/product-variation-assignment-vector.d.ts.map +1 -1
  48. package/lib/resolvers/type/product/product-variation-assignment-vector.js +4 -1
  49. package/lib/resolvers/type/product/product-variation-assignment-vector.js.map +1 -1
  50. package/lib/resolvers/type/product/product-variation-types.d.ts.map +1 -1
  51. package/lib/resolvers/type/product/product-variation-types.js +5 -2
  52. package/lib/resolvers/type/product/product-variation-types.js.map +1 -1
  53. package/lib/schema/query.d.ts.map +1 -1
  54. package/lib/schema/query.js +6 -1
  55. package/lib/schema/query.js.map +1 -1
  56. package/package.json +6 -6
  57. package/src/context.ts +1 -1
  58. package/src/loaders/index.ts +202 -188
  59. package/src/resolvers/mutations/assortments/removeAssortmentProduct.ts +1 -1
  60. package/src/resolvers/queries/index.ts +2 -0
  61. package/src/resolvers/queries/warehousing/tokens.ts +3 -1
  62. package/src/resolvers/queries/warehousing/tokensCount.ts +12 -0
  63. package/src/resolvers/type/assortment/assortment-path-link-types.ts +14 -19
  64. package/src/resolvers/type/assortment/assortment-types.ts +17 -5
  65. package/src/resolvers/type/product/product-types.ts +17 -5
  66. package/src/resolvers/type/product/product-variation-assignment-vector.ts +4 -1
  67. package/src/resolvers/type/product/product-variation-types.ts +5 -2
  68. 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
- productId: product._id,
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.findProductSiblings({
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 modules.products.variations.option(productVariation, obj.value);
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, _, { modules }) => {
25
- return (obj.options || []).map((option) => modules.products.variations.option(obj, 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 }) => {
@@ -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