@unchainedshop/api 3.1.8 → 3.1.9

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 (260) hide show
  1. package/lib/loaders/assortmentLinkLoader.d.ts +12 -0
  2. package/lib/loaders/assortmentLinkLoader.d.ts.map +1 -0
  3. package/lib/loaders/assortmentLinkLoader.js +23 -0
  4. package/lib/loaders/assortmentLinkLoader.js.map +1 -0
  5. package/lib/loaders/assortmentLinksLoader.d.ts +14 -0
  6. package/lib/loaders/assortmentLinksLoader.d.ts.map +1 -0
  7. package/lib/loaders/assortmentLinksLoader.js +38 -0
  8. package/lib/loaders/assortmentLinksLoader.js.map +1 -0
  9. package/lib/loaders/assortmentLoader.d.ts +10 -0
  10. package/lib/loaders/assortmentLoader.d.ts.map +1 -0
  11. package/lib/loaders/assortmentLoader.js +15 -0
  12. package/lib/loaders/assortmentLoader.js.map +1 -0
  13. package/lib/loaders/assortmentMediaTextLoader.d.ts +12 -0
  14. package/lib/loaders/assortmentMediaTextLoader.d.ts.map +1 -0
  15. package/lib/loaders/assortmentMediaTextLoader.js +20 -0
  16. package/lib/loaders/assortmentMediaTextLoader.js.map +1 -0
  17. package/lib/loaders/assortmentMediasLoader.d.ts +10 -0
  18. package/lib/loaders/assortmentMediasLoader.d.ts.map +1 -0
  19. package/lib/loaders/assortmentMediasLoader.js +18 -0
  20. package/lib/loaders/assortmentMediasLoader.js.map +1 -0
  21. package/lib/loaders/assortmentProductLoader.d.ts +12 -0
  22. package/lib/loaders/assortmentProductLoader.d.ts.map +1 -0
  23. package/lib/loaders/assortmentProductLoader.js +14 -0
  24. package/lib/loaders/assortmentProductLoader.js.map +1 -0
  25. package/lib/loaders/assortmentProductsLoader.d.ts +10 -0
  26. package/lib/loaders/assortmentProductsLoader.d.ts.map +1 -0
  27. package/lib/loaders/assortmentProductsLoader.js +18 -0
  28. package/lib/loaders/assortmentProductsLoader.js.map +1 -0
  29. package/lib/loaders/assortmentTextLoader.d.ts +12 -0
  30. package/lib/loaders/assortmentTextLoader.d.ts.map +1 -0
  31. package/lib/loaders/assortmentTextLoader.js +20 -0
  32. package/lib/loaders/assortmentTextLoader.js.map +1 -0
  33. package/lib/loaders/buildTextMap.d.ts +6 -0
  34. package/lib/loaders/buildTextMap.d.ts.map +1 -0
  35. package/lib/loaders/buildTextMap.js +16 -0
  36. package/lib/loaders/buildTextMap.js.map +1 -0
  37. package/lib/loaders/countryLoader.d.ts +10 -0
  38. package/lib/loaders/countryLoader.d.ts.map +1 -0
  39. package/lib/loaders/countryLoader.js +14 -0
  40. package/lib/loaders/countryLoader.js.map +1 -0
  41. package/lib/loaders/currencyLoader copy.d.ts +10 -0
  42. package/lib/loaders/currencyLoader copy.d.ts.map +1 -0
  43. package/lib/loaders/currencyLoader copy.js +14 -0
  44. package/lib/loaders/currencyLoader copy.js.map +1 -0
  45. package/lib/loaders/currencyLoader.d.ts +10 -0
  46. package/lib/loaders/currencyLoader.d.ts.map +1 -0
  47. package/lib/loaders/currencyLoader.js +14 -0
  48. package/lib/loaders/currencyLoader.js.map +1 -0
  49. package/lib/loaders/currencyLoaderByIsoCode.d.ts +10 -0
  50. package/lib/loaders/currencyLoaderByIsoCode.d.ts.map +1 -0
  51. package/lib/loaders/currencyLoaderByIsoCode.js +13 -0
  52. package/lib/loaders/currencyLoaderByIsoCode.js.map +1 -0
  53. package/lib/loaders/fileLoader.d.ts +10 -0
  54. package/lib/loaders/fileLoader.d.ts.map +1 -0
  55. package/lib/loaders/fileLoader.js +13 -0
  56. package/lib/loaders/fileLoader.js.map +1 -0
  57. package/lib/loaders/filterLoader.d.ts +10 -0
  58. package/lib/loaders/filterLoader.d.ts.map +1 -0
  59. package/lib/loaders/filterLoader.js +14 -0
  60. package/lib/loaders/filterLoader.js.map +1 -0
  61. package/lib/loaders/filterTextLoader.d.ts +14 -0
  62. package/lib/loaders/filterTextLoader.d.ts.map +1 -0
  63. package/lib/loaders/filterTextLoader.js +20 -0
  64. package/lib/loaders/filterTextLoader.js.map +1 -0
  65. package/lib/loaders/index.d.ts.map +1 -1
  66. package/lib/loaders/index.js +6 -35
  67. package/lib/loaders/index.js.map +1 -1
  68. package/lib/loaders/productLoader.d.ts +10 -0
  69. package/lib/loaders/productLoader.d.ts.map +1 -0
  70. package/lib/loaders/productLoader.js +16 -0
  71. package/lib/loaders/productLoader.js.map +1 -0
  72. package/lib/loaders/productLoaderBySKU.d.ts +10 -0
  73. package/lib/loaders/productLoaderBySKU.d.ts.map +1 -0
  74. package/lib/loaders/productLoaderBySKU.js +16 -0
  75. package/lib/loaders/productLoaderBySKU.js.map +1 -0
  76. package/lib/loaders/productMediaTextLoader.d.ts +12 -0
  77. package/lib/loaders/productMediaTextLoader.d.ts.map +1 -0
  78. package/lib/loaders/productMediaTextLoader.js +20 -0
  79. package/lib/loaders/productMediaTextLoader.js.map +1 -0
  80. package/lib/loaders/productMediasLoader.d.ts +10 -0
  81. package/lib/loaders/productMediasLoader.d.ts.map +1 -0
  82. package/lib/loaders/productMediasLoader.js +18 -0
  83. package/lib/loaders/productMediasLoader.js.map +1 -0
  84. package/lib/loaders/productTextLoader.d.ts +12 -0
  85. package/lib/loaders/productTextLoader.d.ts.map +1 -0
  86. package/lib/loaders/productTextLoader.js +20 -0
  87. package/lib/loaders/productTextLoader.js.map +1 -0
  88. package/lib/loaders/userLoader copy.d.ts +10 -0
  89. package/lib/loaders/userLoader copy.d.ts.map +1 -0
  90. package/lib/loaders/userLoader copy.js +13 -0
  91. package/lib/loaders/userLoader copy.js.map +1 -0
  92. package/lib/loaders/userLoader.d.ts +10 -0
  93. package/lib/loaders/userLoader.d.ts.map +1 -0
  94. package/lib/loaders/userLoader.js +13 -0
  95. package/lib/loaders/userLoader.js.map +1 -0
  96. package/lib/loaders/utils.d.ts +7 -0
  97. package/lib/loaders/utils.d.ts.map +1 -0
  98. package/lib/loaders/utils.js +30 -0
  99. package/lib/loaders/utils.js.map +1 -0
  100. package/lib/resolvers/type/assortment/assortment-types.d.ts +1 -1
  101. package/lib/resolvers/type/assortment/assortment-types.d.ts.map +1 -1
  102. package/lib/resolvers/type/assortment/assortment-types.js +1 -1
  103. package/lib/resolvers/type/assortment/assortment-types.js.map +1 -1
  104. package/lib/resolvers/type/bookmark-types.d.ts.map +1 -1
  105. package/lib/resolvers/type/bookmark-types.js +1 -0
  106. package/lib/resolvers/type/bookmark-types.js.map +1 -1
  107. package/lib/resolvers/type/country-types.d.ts.map +1 -1
  108. package/lib/resolvers/type/country-types.js +1 -0
  109. package/lib/resolvers/type/country-types.js.map +1 -1
  110. package/lib/resolvers/type/delivery-provider-types.d.ts.map +1 -1
  111. package/lib/resolvers/type/delivery-provider-types.js +1 -0
  112. package/lib/resolvers/type/delivery-provider-types.js.map +1 -1
  113. package/lib/resolvers/type/enrollment/enrollment-delivery-types.d.ts.map +1 -1
  114. package/lib/resolvers/type/enrollment/enrollment-delivery-types.js +1 -0
  115. package/lib/resolvers/type/enrollment/enrollment-delivery-types.js.map +1 -1
  116. package/lib/resolvers/type/enrollment/enrollment-payment-types.d.ts.map +1 -1
  117. package/lib/resolvers/type/enrollment/enrollment-payment-types.js +1 -0
  118. package/lib/resolvers/type/enrollment/enrollment-payment-types.js.map +1 -1
  119. package/lib/resolvers/type/enrollment/enrollment-period-types.d.ts.map +1 -1
  120. package/lib/resolvers/type/enrollment/enrollment-period-types.js +1 -0
  121. package/lib/resolvers/type/enrollment/enrollment-period-types.js.map +1 -1
  122. package/lib/resolvers/type/enrollment/enrollment-types.d.ts.map +1 -1
  123. package/lib/resolvers/type/enrollment/enrollment-types.js +3 -0
  124. package/lib/resolvers/type/enrollment/enrollment-types.js.map +1 -1
  125. package/lib/resolvers/type/index.d.ts +1 -1
  126. package/lib/resolvers/type/index.d.ts.map +1 -1
  127. package/lib/resolvers/type/order/order-delivery-discount-types.d.ts.map +1 -1
  128. package/lib/resolvers/type/order/order-delivery-discount-types.js +1 -0
  129. package/lib/resolvers/type/order/order-delivery-discount-types.js.map +1 -1
  130. package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts.map +1 -1
  131. package/lib/resolvers/type/order/order-delivery-pickup-types.js +3 -0
  132. package/lib/resolvers/type/order/order-delivery-pickup-types.js.map +1 -1
  133. package/lib/resolvers/type/order/order-delivery-shipping-types.d.ts.map +1 -1
  134. package/lib/resolvers/type/order/order-delivery-shipping-types.js +2 -0
  135. package/lib/resolvers/type/order/order-delivery-shipping-types.js.map +1 -1
  136. package/lib/resolvers/type/order/order-delivery-types.d.ts.map +1 -1
  137. package/lib/resolvers/type/order/order-delivery-types.js +1 -0
  138. package/lib/resolvers/type/order/order-delivery-types.js.map +1 -1
  139. package/lib/resolvers/type/order/order-discount-types.d.ts.map +1 -1
  140. package/lib/resolvers/type/order/order-discount-types.js +3 -0
  141. package/lib/resolvers/type/order/order-discount-types.js.map +1 -1
  142. package/lib/resolvers/type/order/order-global-discount-types.d.ts.map +1 -1
  143. package/lib/resolvers/type/order/order-global-discount-types.js +1 -0
  144. package/lib/resolvers/type/order/order-global-discount-types.js.map +1 -1
  145. package/lib/resolvers/type/order/order-item-discount-types.d.ts.map +1 -1
  146. package/lib/resolvers/type/order/order-item-discount-types.js +1 -0
  147. package/lib/resolvers/type/order/order-item-discount-types.js.map +1 -1
  148. package/lib/resolvers/type/order/order-item-types.d.ts.map +1 -1
  149. package/lib/resolvers/type/order/order-item-types.js +8 -0
  150. package/lib/resolvers/type/order/order-item-types.js.map +1 -1
  151. package/lib/resolvers/type/order/order-payment-card-types.d.ts.map +1 -1
  152. package/lib/resolvers/type/order/order-payment-card-types.js +2 -0
  153. package/lib/resolvers/type/order/order-payment-card-types.js.map +1 -1
  154. package/lib/resolvers/type/order/order-payment-discount-types.d.ts.map +1 -1
  155. package/lib/resolvers/type/order/order-payment-discount-types.js +3 -1
  156. package/lib/resolvers/type/order/order-payment-discount-types.js.map +1 -1
  157. package/lib/resolvers/type/order/order-payment-generic-types.d.ts.map +1 -1
  158. package/lib/resolvers/type/order/order-payment-generic-types.js +2 -0
  159. package/lib/resolvers/type/order/order-payment-generic-types.js.map +1 -1
  160. package/lib/resolvers/type/order/order-payment-invoice-types.d.ts.map +1 -1
  161. package/lib/resolvers/type/order/order-payment-invoice-types.js +2 -0
  162. package/lib/resolvers/type/order/order-payment-invoice-types.js.map +1 -1
  163. package/lib/resolvers/type/order/order-payment-types.d.ts.map +1 -1
  164. package/lib/resolvers/type/order/order-payment-types.js +1 -0
  165. package/lib/resolvers/type/order/order-payment-types.js.map +1 -1
  166. package/lib/resolvers/type/order/order-types.d.ts.map +1 -1
  167. package/lib/resolvers/type/order/order-types.js +8 -0
  168. package/lib/resolvers/type/order/order-types.js.map +1 -1
  169. package/lib/resolvers/type/payment/payment-credentials-types.d.ts.map +1 -1
  170. package/lib/resolvers/type/payment/payment-credentials-types.js +3 -0
  171. package/lib/resolvers/type/payment/payment-credentials-types.js.map +1 -1
  172. package/lib/resolvers/type/payment/payment-provider-types.d.ts.map +1 -1
  173. package/lib/resolvers/type/payment/payment-provider-types.js +1 -0
  174. package/lib/resolvers/type/payment/payment-provider-types.js.map +1 -1
  175. package/lib/resolvers/type/product/product-bundle-types.d.ts.map +1 -1
  176. package/lib/resolvers/type/product/product-catalog-price-types.d.ts.map +1 -1
  177. package/lib/resolvers/type/product/product-catalog-price-types.js +2 -0
  178. package/lib/resolvers/type/product/product-catalog-price-types.js.map +1 -1
  179. package/lib/resolvers/type/product/product-configurable-types.d.ts.map +1 -1
  180. package/lib/resolvers/type/product/product-configurable-types.js +1 -0
  181. package/lib/resolvers/type/product/product-configurable-types.js.map +1 -1
  182. package/lib/resolvers/type/product/product-plan-types.d.ts.map +1 -1
  183. package/lib/resolvers/type/product/product-review-types.d.ts.map +1 -1
  184. package/lib/resolvers/type/product/product-review-types.js +1 -0
  185. package/lib/resolvers/type/product/product-review-types.js.map +1 -1
  186. package/lib/resolvers/type/product/product-simple-types.d.ts.map +1 -1
  187. package/lib/resolvers/type/product/product-simple-types.js +2 -0
  188. package/lib/resolvers/type/product/product-simple-types.js.map +1 -1
  189. package/lib/resolvers/type/product/product-tokenized-types.d.ts.map +1 -1
  190. package/lib/resolvers/type/product/product-tokenized-types.js +2 -0
  191. package/lib/resolvers/type/product/product-tokenized-types.js.map +1 -1
  192. package/lib/resolvers/type/product/product-types.d.ts.map +1 -1
  193. package/lib/resolvers/type/product/product-types.js +2 -0
  194. package/lib/resolvers/type/product/product-types.js.map +1 -1
  195. package/lib/resolvers/type/product/product-variation-assignment-vector.d.ts.map +1 -1
  196. package/lib/resolvers/type/product/product-variation-assignment-vector.js +2 -0
  197. package/lib/resolvers/type/product/product-variation-assignment-vector.js.map +1 -1
  198. package/lib/resolvers/type/product/product-variation-option-types.d.ts.map +1 -1
  199. package/lib/resolvers/type/product/product-variation-option-types.js +1 -0
  200. package/lib/resolvers/type/product/product-variation-option-types.js.map +1 -1
  201. package/lib/resolvers/type/product/product-variation-types.d.ts.map +1 -1
  202. package/lib/resolvers/type/product/product-variation-types.js +1 -0
  203. package/lib/resolvers/type/product/product-variation-types.js.map +1 -1
  204. package/lib/resolvers/type/product-search-result-types.d.ts.map +1 -1
  205. package/lib/resolvers/type/quotation-types.d.ts.map +1 -1
  206. package/lib/resolvers/type/quotation-types.js +3 -0
  207. package/lib/resolvers/type/quotation-types.js.map +1 -1
  208. package/lib/resolvers/type/shop-types.d.ts.map +1 -1
  209. package/lib/resolvers/type/shop-types.js +2 -0
  210. package/lib/resolvers/type/shop-types.js.map +1 -1
  211. package/lib/resolvers/type/token-types.d.ts.map +1 -1
  212. package/lib/resolvers/type/token-types.js +7 -0
  213. package/lib/resolvers/type/token-types.js.map +1 -1
  214. package/lib/resolvers/type/user-types.d.ts.map +1 -1
  215. package/lib/resolvers/type/user-types.js +9 -0
  216. package/lib/resolvers/type/user-types.js.map +1 -1
  217. package/lib/resolvers/type/work-types.d.ts.map +1 -1
  218. package/lib/resolvers/type/work-types.js +1 -0
  219. package/lib/resolvers/type/work-types.js.map +1 -1
  220. package/package.json +1 -1
  221. package/src/loaders/buildTextMap.ts +19 -0
  222. package/src/loaders/index.ts +6 -40
  223. package/src/resolvers/type/assortment/assortment-types.ts +1 -1
  224. package/src/resolvers/type/bookmark-types.ts +1 -0
  225. package/src/resolvers/type/country-types.ts +1 -0
  226. package/src/resolvers/type/delivery-provider-types.ts +2 -0
  227. package/src/resolvers/type/enrollment/enrollment-delivery-types.ts +1 -0
  228. package/src/resolvers/type/enrollment/enrollment-payment-types.ts +1 -0
  229. package/src/resolvers/type/enrollment/enrollment-period-types.ts +1 -0
  230. package/src/resolvers/type/enrollment/enrollment-types.ts +3 -0
  231. package/src/resolvers/type/order/order-delivery-discount-types.ts +1 -0
  232. package/src/resolvers/type/order/order-delivery-pickup-types.ts +3 -0
  233. package/src/resolvers/type/order/order-delivery-shipping-types.ts +2 -0
  234. package/src/resolvers/type/order/order-delivery-types.ts +1 -0
  235. package/src/resolvers/type/order/order-discount-types.ts +3 -0
  236. package/src/resolvers/type/order/order-global-discount-types.ts +1 -0
  237. package/src/resolvers/type/order/order-item-discount-types.ts +1 -0
  238. package/src/resolvers/type/order/order-item-types.ts +9 -0
  239. package/src/resolvers/type/order/order-payment-card-types.ts +3 -0
  240. package/src/resolvers/type/order/order-payment-discount-types.ts +1 -0
  241. package/src/resolvers/type/order/order-payment-generic-types.ts +2 -0
  242. package/src/resolvers/type/order/order-payment-invoice-types.ts +2 -0
  243. package/src/resolvers/type/order/order-payment-types.ts +1 -0
  244. package/src/resolvers/type/order/order-types.ts +8 -0
  245. package/src/resolvers/type/payment/payment-credentials-types.ts +3 -0
  246. package/src/resolvers/type/payment/payment-provider-types.ts +2 -0
  247. package/src/resolvers/type/product/product-catalog-price-types.ts +2 -0
  248. package/src/resolvers/type/product/product-configurable-types.ts +1 -0
  249. package/src/resolvers/type/product/product-review-types.ts +1 -0
  250. package/src/resolvers/type/product/product-simple-types.ts +2 -0
  251. package/src/resolvers/type/product/product-tokenized-types.ts +2 -0
  252. package/src/resolvers/type/product/product-types.ts +2 -0
  253. package/src/resolvers/type/product/product-variation-assignment-vector.ts +2 -0
  254. package/src/resolvers/type/product/product-variation-option-types.ts +1 -0
  255. package/src/resolvers/type/product/product-variation-types.ts +1 -0
  256. package/src/resolvers/type/quotation-types.ts +3 -0
  257. package/src/resolvers/type/shop-types.ts +2 -0
  258. package/src/resolvers/type/token-types.ts +7 -0
  259. package/src/resolvers/type/user-types.ts +18 -0
  260. package/src/resolvers/type/work-types.ts +2 -0
@@ -29,6 +29,8 @@ export const PaymentProvider = {
29
29
  requestContext: Context,
30
30
  ) {
31
31
  const { modules, countryContext: country, user } = requestContext;
32
+
33
+ // TODO: use loader
32
34
  const order = await modules.orders.findOrder({ orderId });
33
35
  const currency = currencyCode || order?.currency || requestContext.currencyContext;
34
36
  const pricingContext = {
@@ -26,9 +26,11 @@ export const ProductCatalogPrice: ProductCatalogPriceHelperTypes = {
26
26
  return isNetPrice || false;
27
27
  },
28
28
  country: async ({ countryCode }, _, { modules }) => {
29
+ // TODO: use loader
29
30
  return modules.countries.findCountry({ isoCode: countryCode });
30
31
  },
31
32
  currency: async ({ currencyCode }, _, { modules }) => {
33
+ // TODO: use loader
32
34
  return modules.currencies.findCurrency({ isoCode: currencyCode });
33
35
  },
34
36
  };
@@ -79,6 +79,7 @@ export const ConfigurableProduct = {
79
79
  },
80
80
  { modules }: Context,
81
81
  ): Promise<Array<ProductVariation>> {
82
+ // TODO: use loader?
82
83
  return modules.products.variations.findProductVariations({
83
84
  productId: product._id,
84
85
  limit,
@@ -17,6 +17,7 @@ export interface ProductReviewHelperTypes {
17
17
  }
18
18
  export const ProductReview: ProductReviewHelperTypes = {
19
19
  author: async (obj, _, { modules }) => {
20
+ // TODO: use loader
20
21
  return modules.users.findUserById(obj.authorId);
21
22
  },
22
23
 
@@ -23,6 +23,7 @@ export const SimpleProduct = {
23
23
  const { referenceDate, quantity } = params;
24
24
  const { services, modules } = requestContext;
25
25
 
26
+ // TODO: use loader?
26
27
  const deliveryProviders = await modules.delivery.findProviders({});
27
28
 
28
29
  return services.products.simulateProductDispatching({
@@ -50,6 +51,7 @@ export const SimpleProduct = {
50
51
  const { modules, services } = requestContext;
51
52
  const { referenceDate, deliveryProviderType } = params;
52
53
 
54
+ // TODO: use loader?
53
55
  const deliveryProviders = await modules.delivery.findProviders({
54
56
  type: deliveryProviderType,
55
57
  });
@@ -47,6 +47,7 @@ export const TokenizedProduct = {
47
47
  const { modules, services } = requestContext;
48
48
  const { referenceDate } = params;
49
49
 
50
+ // TODO: use loader?
50
51
  const deliveryProviders = await modules.delivery.findProviders({});
51
52
 
52
53
  return services.products.simulateProductInventory({
@@ -59,6 +60,7 @@ export const TokenizedProduct = {
59
60
  async tokens(product: Product, params: never, requestContext: Context) {
60
61
  await checkAction(requestContext, actions.viewTokens, [undefined, params]);
61
62
 
63
+ // TODO: use loader?
62
64
  const tokens = await requestContext.modules.warehousing.findTokens({
63
65
  productId: product._id,
64
66
  });
@@ -78,6 +78,7 @@ export const Product = {
78
78
  },
79
79
  { modules }: Context,
80
80
  ): Promise<Array<ProductReview>> {
81
+ // TODO: use loader?
81
82
  return modules.products.reviews.findProductReviews({
82
83
  productId: product._id,
83
84
  limit,
@@ -96,6 +97,7 @@ export const Product = {
96
97
  return modules.products.reviews.count({ ...params, productId: product._id });
97
98
  },
98
99
 
100
+ // TODO: slow!
99
101
  async siblings(
100
102
  product: ProductType,
101
103
  params: {
@@ -18,6 +18,7 @@ export const ProductVariationAssignmentVector: ProductVariationAssignmentVectorH
18
18
  _id: ({ product, key, value }) => `${product._id}:${key}=${value}`,
19
19
 
20
20
  option: async (obj, _, { modules }) => {
21
+ // TODO: use loader?
21
22
  const productVariation = await modules.products.variations.findProductVariationByKey({
22
23
  key: obj.key,
23
24
  productId: obj.product._id,
@@ -29,6 +30,7 @@ export const ProductVariationAssignmentVector: ProductVariationAssignmentVectorH
29
30
  },
30
31
 
31
32
  variation: (obj, _, { modules }) => {
33
+ // TODO: use loader?
32
34
  return modules.products.variations.findProductVariationByKey({
33
35
  productId: obj?.product?._id,
34
36
  key: obj?.key,
@@ -21,6 +21,7 @@ export const ProductVariationOption: ProductVariationOptionHelperTypes = {
21
21
  },
22
22
 
23
23
  texts: async (obj, { forceLocale }, { modules, localeContext }) => {
24
+ // TODO: use loader
24
25
  return modules.products.variations.texts.findLocalizedVariationText({
25
26
  locale: forceLocale || localeContext.baseName,
26
27
  productVariationId: obj._id,
@@ -29,6 +29,7 @@ export const ProductVariation: ProductVariationHelperTypes = {
29
29
  },
30
30
 
31
31
  texts: async (obj, { forceLocale }, { modules, localeContext }) => {
32
+ // TODO: use loader
32
33
  return modules.products.variations.texts.findLocalizedVariationText({
33
34
  productVariationId: obj._id,
34
35
  locale: forceLocale || localeContext.baseName,
@@ -17,8 +17,10 @@ type QuotationHelperTypes = {
17
17
  };
18
18
 
19
19
  export const Quotation: QuotationHelperTypes = {
20
+ // TODO: use loader
20
21
  country: async (obj, _, { modules }) => modules.countries.findCountry({ isoCode: obj.countryCode }),
21
22
 
23
+ // TODO: use loader
22
24
  currency: async (obj, _, { modules }) => modules.currencies.findCurrency({ isoCode: obj.currency }),
23
25
 
24
26
  isExpired: (obj, { referenceDate }, { modules }) =>
@@ -33,5 +35,6 @@ export const Quotation: QuotationHelperTypes = {
33
35
 
34
36
  status: (obj, _, { modules }) => modules.quotations.normalizedStatus(obj),
35
37
 
38
+ // TODO: use loader
36
39
  user: (obj, _, { modules }) => modules.users.findUserById(obj.userId),
37
40
  };
@@ -19,9 +19,11 @@ export const Shop: ShopHelperTypes = {
19
19
  },
20
20
 
21
21
  language: async (_root, _params, { localeContext, modules }) => {
22
+ // TODO: use loader
22
23
  return modules.languages.findLanguage({ isoCode: localeContext.language });
23
24
  },
24
25
  country: async (_root, _params, { countryContext, modules }) => {
26
+ // TODO: use loader
25
27
  return modules.countries.findCountry({ isoCode: countryContext });
26
28
  },
27
29
 
@@ -7,11 +7,13 @@ import { WarehousingDirector } from '@unchainedshop/core';
7
7
 
8
8
  export const Token = {
9
9
  product: async (token: TokenSurrogate, params: never, { modules }: Context) => {
10
+ // TODO: use loader
10
11
  return modules.products.findProduct({ productId: token.productId });
11
12
  },
12
13
 
13
14
  user: async (token: TokenSurrogate, params: never, { modules }: Context) => {
14
15
  if (!token.userId) return null;
16
+ // TODO: use loader
15
17
  return modules.users.findUserById(token.userId);
16
18
  },
17
19
 
@@ -19,6 +21,7 @@ export const Token = {
19
21
  if (token.walletAddress && !token.userId) {
20
22
  return TokenStatus.DECENTRALIZED;
21
23
  }
24
+ // TODO: use loader?
22
25
  const workItems = await modules.worker.findWorkQueue({
23
26
  types: ['EXPORT_TOKEN'],
24
27
  status: [WorkStatus.NEW, WorkStatus.ALLOCATED],
@@ -33,8 +36,10 @@ export const Token = {
33
36
  context: Context,
34
37
  ) => {
35
38
  const { modules } = context;
39
+ // TODO: use loader
36
40
  const product = await modules.products.findProduct({ productId: token.productId });
37
41
 
42
+ // TODO: use loader
38
43
  const virtualProviders = await context.modules.warehousing.findProviders({
39
44
  type: WarehousingProviderType.VIRTUAL,
40
45
  });
@@ -54,8 +59,10 @@ export const Token = {
54
59
 
55
60
  isInvalidateable: async (token: TokenSurrogate, _params: never, context: Context) => {
56
61
  const { modules } = context;
62
+ // TODO: use loader
57
63
  const product = await modules.products.findProduct({ productId: token.productId });
58
64
 
65
+ // TODO: use loader
59
66
  const virtualProviders = await context.modules.warehousing.findProviders({
60
67
  type: WarehousingProviderType.VIRTUAL,
61
68
  });
@@ -169,6 +169,8 @@ export const User: UserHelperTypes = {
169
169
 
170
170
  bookmarks: async (user, params, context) => {
171
171
  await checkAction(context, viewUserPrivateInfos, [user, params]);
172
+
173
+ // TODO: use loader?
172
174
  return context.modules.bookmarks.findBookmarksByUserId(user._id);
173
175
  },
174
176
 
@@ -188,6 +190,8 @@ export const User: UserHelperTypes = {
188
190
  user.services?.web3?.flatMap((service) => {
189
191
  return service.verified ? [service.address] : [];
190
192
  }) || [];
193
+
194
+ // TODO: use loader?
191
195
  return context.modules.warehousing.findTokensForUser({
192
196
  userId: user._id,
193
197
  walletAddresses,
@@ -197,6 +201,8 @@ export const User: UserHelperTypes = {
197
201
  async country(user, params, context) {
198
202
  await checkAction(context, viewUserPrivateInfos, [user, params]);
199
203
  const userLocale = context.modules.users.userLocale(user);
204
+
205
+ // TODO: use loader
200
206
  return context.modules.countries.findCountry({
201
207
  isoCode: userLocale.region?.toUpperCase(),
202
208
  });
@@ -204,6 +210,8 @@ export const User: UserHelperTypes = {
204
210
 
205
211
  async enrollments(user, params, context) {
206
212
  await checkAction(context, viewUserEnrollments, [user, params]);
213
+
214
+ // TODO: use loader?
207
215
  return context.modules.enrollments.findEnrollments({
208
216
  ...(params || {}),
209
217
  userId: user._id,
@@ -213,6 +221,8 @@ export const User: UserHelperTypes = {
213
221
  language: async (user, params, context) => {
214
222
  await checkAction(context, viewUserPrivateInfos, [user, params]);
215
223
  const userLocale = context.modules.users.userLocale(user);
224
+
225
+ // TODO: use loader
216
226
  return context.modules.languages.findLanguage({
217
227
  isoCode: userLocale.language,
218
228
  });
@@ -227,6 +237,8 @@ export const User: UserHelperTypes = {
227
237
 
228
238
  orders: async (user, params, context) => {
229
239
  await checkAction(context, viewUserOrders, [user, params]);
240
+
241
+ // TODO: use loader?
230
242
  return context.modules.orders.findOrders({
231
243
  ...(params || {}),
232
244
  userId: user._id,
@@ -235,6 +247,8 @@ export const User: UserHelperTypes = {
235
247
 
236
248
  paymentCredentials: async (user, params, context) => {
237
249
  await checkAction(context, viewUserPrivateInfos, [user, params]);
250
+
251
+ // TODO: use loader?
238
252
  return context.modules.payment.paymentCredentials.findPaymentCredentials(
239
253
  { ...params.selector, userId: user._id },
240
254
  {
@@ -256,6 +270,8 @@ export const User: UserHelperTypes = {
256
270
  },
257
271
  quotations: async (user, params, context) => {
258
272
  await checkAction(context, viewUserQuotations, [user, params]);
273
+
274
+ // TODO: use loader?
259
275
  return context.modules.quotations.findQuotations({
260
276
  ...(params || {}),
261
277
  userId: user._id,
@@ -273,6 +289,8 @@ export const User: UserHelperTypes = {
273
289
  async reviews(user, params, context) {
274
290
  const { modules } = context;
275
291
  await checkAction(context, viewUserProductReviews, [user, params]);
292
+
293
+ // TODO: use loader?
276
294
  return modules.products.reviews.findProductReviews({
277
295
  ...(params || {}),
278
296
  authorId: user._id,
@@ -28,6 +28,8 @@ export const Work: WorkHelperTypes = {
28
28
 
29
29
  original: async (obj, _, { modules }) => {
30
30
  if (!obj.originalWorkId) return null;
31
+
32
+ // TODO: use loader
31
33
  return modules.worker.findWork({ workId: obj.originalWorkId });
32
34
  },
33
35