@unchainedshop/api 2.0.0-beta8 → 2.0.0-beta9

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 (433) hide show
  1. package/jest.config.js +9 -0
  2. package/lib/acl.d.ts +2 -0
  3. package/lib/acl.js +2 -2
  4. package/lib/acl.js.map +1 -1
  5. package/lib/api-index.d.ts +1 -0
  6. package/lib/api-index.js +1 -1
  7. package/lib/api-index.js.map +1 -1
  8. package/lib/createGraphQLServer.js +11 -17
  9. package/lib/createGraphQLServer.js.map +1 -1
  10. package/lib/errors.d.ts +20 -0
  11. package/lib/errors.js +20 -0
  12. package/lib/errors.js.map +1 -1
  13. package/lib/express/createBulkImportMiddleware.js +1 -1
  14. package/lib/express/createBulkImportMiddleware.js.map +1 -1
  15. package/lib/express/createERCMetadataMiddleware.js +2 -1
  16. package/lib/express/createERCMetadataMiddleware.js.map +1 -1
  17. package/lib/express/createSingleSignOnMiddleware.js.map +1 -1
  18. package/lib/loaders/index.js +5 -9
  19. package/lib/loaders/index.js.map +1 -1
  20. package/lib/resolvers/mutations/accounts/changePassword.js +12 -1
  21. package/lib/resolvers/mutations/accounts/changePassword.js.map +1 -1
  22. package/lib/resolvers/mutations/accounts/createUser.js +17 -3
  23. package/lib/resolvers/mutations/accounts/createUser.js.map +1 -1
  24. package/lib/resolvers/mutations/accounts/disableTOTP.js +15 -2
  25. package/lib/resolvers/mutations/accounts/disableTOTP.js.map +1 -1
  26. package/lib/resolvers/mutations/accounts/enableTOTP.js +12 -1
  27. package/lib/resolvers/mutations/accounts/enableTOTP.js.map +1 -1
  28. package/lib/resolvers/mutations/accounts/enrollUser.js +17 -4
  29. package/lib/resolvers/mutations/accounts/enrollUser.js.map +1 -1
  30. package/lib/resolvers/mutations/accounts/forgotPassword.js +11 -1
  31. package/lib/resolvers/mutations/accounts/forgotPassword.js.map +1 -1
  32. package/lib/resolvers/mutations/accounts/impersonate.js +1 -1
  33. package/lib/resolvers/mutations/accounts/impersonate.js.map +1 -1
  34. package/lib/resolvers/mutations/accounts/loginWithPassword.js +19 -1
  35. package/lib/resolvers/mutations/accounts/loginWithPassword.js.map +1 -1
  36. package/lib/resolvers/mutations/accounts/loginWithWebAuthn.js +13 -1
  37. package/lib/resolvers/mutations/accounts/loginWithWebAuthn.js.map +1 -1
  38. package/lib/resolvers/mutations/accounts/logout.d.ts +1 -1
  39. package/lib/resolvers/mutations/accounts/logout.js +6 -2
  40. package/lib/resolvers/mutations/accounts/logout.js.map +1 -1
  41. package/lib/resolvers/mutations/accounts/logoutAllSessions.js +4 -1
  42. package/lib/resolvers/mutations/accounts/logoutAllSessions.js.map +1 -1
  43. package/lib/resolvers/mutations/accounts/resetPassword.js +17 -2
  44. package/lib/resolvers/mutations/accounts/resetPassword.js.map +1 -1
  45. package/lib/resolvers/mutations/assortments/addAssortmentFilter.js +1 -2
  46. package/lib/resolvers/mutations/assortments/addAssortmentFilter.js.map +1 -1
  47. package/lib/resolvers/mutations/assortments/addAssortmentLink.js +16 -9
  48. package/lib/resolvers/mutations/assortments/addAssortmentLink.js.map +1 -1
  49. package/lib/resolvers/mutations/assortments/addAssortmentMedia.js +2 -3
  50. package/lib/resolvers/mutations/assortments/addAssortmentMedia.js.map +1 -1
  51. package/lib/resolvers/mutations/assortments/addAssortmentProduct.js +1 -2
  52. package/lib/resolvers/mutations/assortments/addAssortmentProduct.js.map +1 -1
  53. package/lib/resolvers/mutations/assortments/createAssortment.js +1 -2
  54. package/lib/resolvers/mutations/assortments/createAssortment.js.map +1 -1
  55. package/lib/resolvers/mutations/assortments/prepareAssortmentMediaUpload.js +0 -1
  56. package/lib/resolvers/mutations/assortments/prepareAssortmentMediaUpload.js.map +1 -1
  57. package/lib/resolvers/mutations/assortments/removeAssortmentMedia.js +2 -2
  58. package/lib/resolvers/mutations/assortments/removeAssortmentMedia.js.map +1 -1
  59. package/lib/resolvers/mutations/assortments/reorderAssortmentFilters.js +1 -1
  60. package/lib/resolvers/mutations/assortments/reorderAssortmentFilters.js.map +1 -1
  61. package/lib/resolvers/mutations/assortments/reorderAssortmentLinks.js +1 -1
  62. package/lib/resolvers/mutations/assortments/reorderAssortmentLinks.js.map +1 -1
  63. package/lib/resolvers/mutations/assortments/reorderAssortmentMedia.js +1 -1
  64. package/lib/resolvers/mutations/assortments/reorderAssortmentMedia.js.map +1 -1
  65. package/lib/resolvers/mutations/assortments/reorderAssortmentProducts.js +1 -1
  66. package/lib/resolvers/mutations/assortments/reorderAssortmentProducts.js.map +1 -1
  67. package/lib/resolvers/mutations/assortments/setBaseAssortment.js +1 -1
  68. package/lib/resolvers/mutations/assortments/setBaseAssortment.js.map +1 -1
  69. package/lib/resolvers/mutations/assortments/updateAssortment.js +1 -1
  70. package/lib/resolvers/mutations/assortments/updateAssortment.js.map +1 -1
  71. package/lib/resolvers/mutations/assortments/updateAssortmentMediaTexts.js +1 -1
  72. package/lib/resolvers/mutations/assortments/updateAssortmentMediaTexts.js.map +1 -1
  73. package/lib/resolvers/mutations/assortments/updateAssortmentTexts.js +1 -1
  74. package/lib/resolvers/mutations/assortments/updateAssortmentTexts.js.map +1 -1
  75. package/lib/resolvers/mutations/bookmarks/bookmark.js +2 -2
  76. package/lib/resolvers/mutations/bookmarks/bookmark.js.map +1 -1
  77. package/lib/resolvers/mutations/bookmarks/createBookmark.js +1 -1
  78. package/lib/resolvers/mutations/bookmarks/createBookmark.js.map +1 -1
  79. package/lib/resolvers/mutations/countries/createCountry.js +1 -2
  80. package/lib/resolvers/mutations/countries/createCountry.js.map +1 -1
  81. package/lib/resolvers/mutations/countries/removeCountry.js +1 -1
  82. package/lib/resolvers/mutations/countries/removeCountry.js.map +1 -1
  83. package/lib/resolvers/mutations/countries/updateCountry.js +1 -1
  84. package/lib/resolvers/mutations/countries/updateCountry.js.map +1 -1
  85. package/lib/resolvers/mutations/currencies/createCurrency.js +1 -2
  86. package/lib/resolvers/mutations/currencies/createCurrency.js.map +1 -1
  87. package/lib/resolvers/mutations/currencies/removeCurrency.js +1 -1
  88. package/lib/resolvers/mutations/currencies/removeCurrency.js.map +1 -1
  89. package/lib/resolvers/mutations/currencies/updateCurrency.js +1 -1
  90. package/lib/resolvers/mutations/currencies/updateCurrency.js.map +1 -1
  91. package/lib/resolvers/mutations/delivery/createDeliveryProvider.js +1 -2
  92. package/lib/resolvers/mutations/delivery/createDeliveryProvider.js.map +1 -1
  93. package/lib/resolvers/mutations/delivery/removeDeliveryProvider.js +1 -1
  94. package/lib/resolvers/mutations/delivery/removeDeliveryProvider.js.map +1 -1
  95. package/lib/resolvers/mutations/delivery/updateDeliveryProvider.js +1 -1
  96. package/lib/resolvers/mutations/delivery/updateDeliveryProvider.js.map +1 -1
  97. package/lib/resolvers/mutations/enrollments/activateEnrollment.js +1 -1
  98. package/lib/resolvers/mutations/enrollments/activateEnrollment.js.map +1 -1
  99. package/lib/resolvers/mutations/enrollments/terminateEnrollment.js +1 -1
  100. package/lib/resolvers/mutations/enrollments/terminateEnrollment.js.map +1 -1
  101. package/lib/resolvers/mutations/enrollments/updateEnrollment.js +5 -5
  102. package/lib/resolvers/mutations/enrollments/updateEnrollment.js.map +1 -1
  103. package/lib/resolvers/mutations/filters/createFilter.js +1 -2
  104. package/lib/resolvers/mutations/filters/createFilter.js.map +1 -1
  105. package/lib/resolvers/mutations/filters/createFilterOption.js +1 -1
  106. package/lib/resolvers/mutations/filters/createFilterOption.js.map +1 -1
  107. package/lib/resolvers/mutations/filters/removeFilter.d.ts +1 -1
  108. package/lib/resolvers/mutations/filters/removeFilter.js +3 -3
  109. package/lib/resolvers/mutations/filters/removeFilter.js.map +1 -1
  110. package/lib/resolvers/mutations/filters/updateFilter.js +1 -1
  111. package/lib/resolvers/mutations/filters/updateFilter.js.map +1 -1
  112. package/lib/resolvers/mutations/filters/updateFilterTexts.js +1 -1
  113. package/lib/resolvers/mutations/filters/updateFilterTexts.js.map +1 -1
  114. package/lib/resolvers/mutations/index.d.ts +1 -0
  115. package/lib/resolvers/mutations/index.js +2 -0
  116. package/lib/resolvers/mutations/index.js.map +1 -1
  117. package/lib/resolvers/mutations/languages/createLanguage.js +1 -2
  118. package/lib/resolvers/mutations/languages/createLanguage.js.map +1 -1
  119. package/lib/resolvers/mutations/languages/removeLanguage.js +1 -1
  120. package/lib/resolvers/mutations/languages/removeLanguage.js.map +1 -1
  121. package/lib/resolvers/mutations/languages/updateLanguage.js +1 -1
  122. package/lib/resolvers/mutations/languages/updateLanguage.js.map +1 -1
  123. package/lib/resolvers/mutations/orders/createCart.js +1 -1
  124. package/lib/resolvers/mutations/orders/createCart.js.map +1 -1
  125. package/lib/resolvers/mutations/orders/payOrder.js +1 -1
  126. package/lib/resolvers/mutations/orders/payOrder.js.map +1 -1
  127. package/lib/resolvers/mutations/orders/removeOrder.js +1 -1
  128. package/lib/resolvers/mutations/orders/removeOrder.js.map +1 -1
  129. package/lib/resolvers/mutations/payment/createPaymentProvider.js +1 -2
  130. package/lib/resolvers/mutations/payment/createPaymentProvider.js.map +1 -1
  131. package/lib/resolvers/mutations/payment/registerPaymentCredentials.js +2 -2
  132. package/lib/resolvers/mutations/payment/registerPaymentCredentials.js.map +1 -1
  133. package/lib/resolvers/mutations/payment/removePaymentProvider.js +1 -1
  134. package/lib/resolvers/mutations/payment/removePaymentProvider.js.map +1 -1
  135. package/lib/resolvers/mutations/payment/updatePaymentProvider.js +1 -1
  136. package/lib/resolvers/mutations/payment/updatePaymentProvider.js.map +1 -1
  137. package/lib/resolvers/mutations/products/addProductAssignment.js +1 -1
  138. package/lib/resolvers/mutations/products/addProductAssignment.js.map +1 -1
  139. package/lib/resolvers/mutations/products/addProductMedia.js +1 -2
  140. package/lib/resolvers/mutations/products/addProductMedia.js.map +1 -1
  141. package/lib/resolvers/mutations/products/addProductReviewVote.js +1 -1
  142. package/lib/resolvers/mutations/products/addProductReviewVote.js.map +1 -1
  143. package/lib/resolvers/mutations/products/createProduct.js +1 -2
  144. package/lib/resolvers/mutations/products/createProduct.js.map +1 -1
  145. package/lib/resolvers/mutations/products/createProductBundleItem.js +1 -1
  146. package/lib/resolvers/mutations/products/createProductBundleItem.js.map +1 -1
  147. package/lib/resolvers/mutations/products/createProductReview.js +1 -1
  148. package/lib/resolvers/mutations/products/createProductReview.js.map +1 -1
  149. package/lib/resolvers/mutations/products/createProductVariation.js +1 -2
  150. package/lib/resolvers/mutations/products/createProductVariation.js.map +1 -1
  151. package/lib/resolvers/mutations/products/createProductVariationOption.js +4 -1
  152. package/lib/resolvers/mutations/products/createProductVariationOption.js.map +1 -1
  153. package/lib/resolvers/mutations/products/prepareProductMediaUpload.js +0 -1
  154. package/lib/resolvers/mutations/products/prepareProductMediaUpload.js.map +1 -1
  155. package/lib/resolvers/mutations/products/publishProduct.js +1 -1
  156. package/lib/resolvers/mutations/products/publishProduct.js.map +1 -1
  157. package/lib/resolvers/mutations/products/removeBundleItem.js +2 -2
  158. package/lib/resolvers/mutations/products/removeBundleItem.js.map +1 -1
  159. package/lib/resolvers/mutations/products/removeProduct.js +14 -2
  160. package/lib/resolvers/mutations/products/removeProduct.js.map +1 -1
  161. package/lib/resolvers/mutations/products/removeProductAssignment.js +1 -1
  162. package/lib/resolvers/mutations/products/removeProductAssignment.js.map +1 -1
  163. package/lib/resolvers/mutations/products/removeProductMedia.js +2 -2
  164. package/lib/resolvers/mutations/products/removeProductMedia.js.map +1 -1
  165. package/lib/resolvers/mutations/products/removeProductReview.js +1 -1
  166. package/lib/resolvers/mutations/products/removeProductReview.js.map +1 -1
  167. package/lib/resolvers/mutations/products/removeProductReviewVote.js +1 -1
  168. package/lib/resolvers/mutations/products/removeProductReviewVote.js.map +1 -1
  169. package/lib/resolvers/mutations/products/removeProductVariation.js +1 -1
  170. package/lib/resolvers/mutations/products/removeProductVariation.js.map +1 -1
  171. package/lib/resolvers/mutations/products/removeProductVariationOption.js +1 -1
  172. package/lib/resolvers/mutations/products/removeProductVariationOption.js.map +1 -1
  173. package/lib/resolvers/mutations/products/reorderProductMedia.js +1 -1
  174. package/lib/resolvers/mutations/products/reorderProductMedia.js.map +1 -1
  175. package/lib/resolvers/mutations/products/unpublishProduct.js +1 -1
  176. package/lib/resolvers/mutations/products/unpublishProduct.js.map +1 -1
  177. package/lib/resolvers/mutations/products/updateProduct.js +1 -1
  178. package/lib/resolvers/mutations/products/updateProduct.js.map +1 -1
  179. package/lib/resolvers/mutations/products/updateProductCommerce.js +1 -1
  180. package/lib/resolvers/mutations/products/updateProductCommerce.js.map +1 -1
  181. package/lib/resolvers/mutations/products/updateProductMediaTexts.js +1 -1
  182. package/lib/resolvers/mutations/products/updateProductMediaTexts.js.map +1 -1
  183. package/lib/resolvers/mutations/products/updateProductPlan.js +1 -1
  184. package/lib/resolvers/mutations/products/updateProductPlan.js.map +1 -1
  185. package/lib/resolvers/mutations/products/updateProductReview.js +1 -1
  186. package/lib/resolvers/mutations/products/updateProductReview.js.map +1 -1
  187. package/lib/resolvers/mutations/products/updateProductSupply.js +1 -1
  188. package/lib/resolvers/mutations/products/updateProductSupply.js.map +1 -1
  189. package/lib/resolvers/mutations/products/updateProductTexts.js +1 -1
  190. package/lib/resolvers/mutations/products/updateProductTexts.js.map +1 -1
  191. package/lib/resolvers/mutations/products/updateProductTokenization.js +1 -1
  192. package/lib/resolvers/mutations/products/updateProductTokenization.js.map +1 -1
  193. package/lib/resolvers/mutations/products/updateProductVariationTexts.js +1 -1
  194. package/lib/resolvers/mutations/products/updateProductVariationTexts.js.map +1 -1
  195. package/lib/resolvers/mutations/products/updateProductWarehousing.js +1 -1
  196. package/lib/resolvers/mutations/products/updateProductWarehousing.js.map +1 -1
  197. package/lib/resolvers/mutations/users/prepareUserAvatarUpload.js +0 -1
  198. package/lib/resolvers/mutations/users/prepareUserAvatarUpload.js.map +1 -1
  199. package/lib/resolvers/mutations/users/removeUser.d.ts +4 -0
  200. package/lib/resolvers/mutations/users/removeUser.js +11 -0
  201. package/lib/resolvers/mutations/users/removeUser.js.map +1 -0
  202. package/lib/resolvers/mutations/users/setRoles.js +1 -1
  203. package/lib/resolvers/mutations/users/setRoles.js.map +1 -1
  204. package/lib/resolvers/mutations/users/setUserTags.js +1 -1
  205. package/lib/resolvers/mutations/users/setUserTags.js.map +1 -1
  206. package/lib/resolvers/mutations/users/updateUserAvatar.js +1 -2
  207. package/lib/resolvers/mutations/users/updateUserAvatar.js.map +1 -1
  208. package/lib/resolvers/mutations/users/updateUserProfile.js +1 -1
  209. package/lib/resolvers/mutations/users/updateUserProfile.js.map +1 -1
  210. package/lib/resolvers/mutations/utils/getOrderCart.js +1 -1
  211. package/lib/resolvers/mutations/utils/getOrderCart.js.map +1 -1
  212. package/lib/resolvers/mutations/warehousing/createWarehousingProvider.js +1 -2
  213. package/lib/resolvers/mutations/warehousing/createWarehousingProvider.js.map +1 -1
  214. package/lib/resolvers/mutations/warehousing/removeWarehousingProvider.js +1 -1
  215. package/lib/resolvers/mutations/warehousing/removeWarehousingProvider.js.map +1 -1
  216. package/lib/resolvers/mutations/warehousing/updateWarehousingProvider.js +1 -1
  217. package/lib/resolvers/mutations/warehousing/updateWarehousingProvider.js.map +1 -1
  218. package/lib/resolvers/mutations/worker/addWork.js +1 -1
  219. package/lib/resolvers/mutations/worker/addWork.js.map +1 -1
  220. package/lib/resolvers/mutations/worker/finishWork.js +1 -1
  221. package/lib/resolvers/mutations/worker/finishWork.js.map +1 -1
  222. package/lib/resolvers/mutations/worker/removeWork.js +1 -1
  223. package/lib/resolvers/mutations/worker/removeWork.js.map +1 -1
  224. package/lib/resolvers/queries/products/productCatalogPrices.js +0 -1
  225. package/lib/resolvers/queries/products/productCatalogPrices.js.map +1 -1
  226. package/lib/resolvers/queries/users/users.d.ts +2 -1
  227. package/lib/resolvers/queries/users/users.js.map +1 -1
  228. package/lib/resolvers/queries/worker/workQueue.d.ts +1 -1
  229. package/lib/resolvers/queries/worker/workQueue.js +1 -1
  230. package/lib/resolvers/queries/worker/workQueue.js.map +1 -1
  231. package/lib/resolvers/type/assortment/assortment-filter-types.js +0 -1
  232. package/lib/resolvers/type/assortment/assortment-filter-types.js.map +1 -1
  233. package/lib/resolvers/type/assortment/assortment-link-types.js +0 -2
  234. package/lib/resolvers/type/assortment/assortment-link-types.js.map +1 -1
  235. package/lib/resolvers/type/assortment/assortment-media-types.js +2 -0
  236. package/lib/resolvers/type/assortment/assortment-media-types.js.map +1 -1
  237. package/lib/resolvers/type/assortment/assortment-path-link-types.js +1 -0
  238. package/lib/resolvers/type/assortment/assortment-path-link-types.js.map +1 -1
  239. package/lib/resolvers/type/assortment/assortment-product-types.js +0 -2
  240. package/lib/resolvers/type/assortment/assortment-product-types.js.map +1 -1
  241. package/lib/resolvers/type/assortment/assortment-types.js +8 -4
  242. package/lib/resolvers/type/assortment/assortment-types.js.map +1 -1
  243. package/lib/resolvers/type/bookmark-types.js +0 -1
  244. package/lib/resolvers/type/bookmark-types.js.map +1 -1
  245. package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js +0 -1
  246. package/lib/resolvers/type/enrollment/enrollment-plan-tyes.js.map +1 -1
  247. package/lib/resolvers/type/index.d.ts +1 -0
  248. package/lib/resolvers/type/login-method-response-types.d.ts +1 -0
  249. package/lib/resolvers/type/order/order-item-types.js +0 -3
  250. package/lib/resolvers/type/order/order-item-types.js.map +1 -1
  251. package/lib/resolvers/type/product/product-assortment-path-types.js +1 -0
  252. package/lib/resolvers/type/product/product-assortment-path-types.js.map +1 -1
  253. package/lib/resolvers/type/product/product-bundle-item-types.js +0 -1
  254. package/lib/resolvers/type/product/product-bundle-item-types.js.map +1 -1
  255. package/lib/resolvers/type/product/product-configurable-types.js +1 -0
  256. package/lib/resolvers/type/product/product-configurable-types.js.map +1 -1
  257. package/lib/resolvers/type/product/product-media-types.js +2 -0
  258. package/lib/resolvers/type/product/product-media-types.js.map +1 -1
  259. package/lib/resolvers/type/product/product-plan-types.js +1 -12
  260. package/lib/resolvers/type/product/product-plan-types.js.map +1 -1
  261. package/lib/resolvers/type/product/product-review-types.js +0 -1
  262. package/lib/resolvers/type/product/product-review-types.js.map +1 -1
  263. package/lib/resolvers/type/product/product-variation-assignment-types.js +0 -1
  264. package/lib/resolvers/type/product/product-variation-assignment-types.js.map +1 -1
  265. package/lib/resolvers/type/quotation-types.js +0 -1
  266. package/lib/resolvers/type/quotation-types.js.map +1 -1
  267. package/lib/resolvers/type/token-types.js +2 -1
  268. package/lib/resolvers/type/token-types.js.map +1 -1
  269. package/lib/resolvers/type/user-types.d.ts +3 -0
  270. package/lib/resolvers/type/user-types.js +10 -9
  271. package/lib/resolvers/type/user-types.js.map +1 -1
  272. package/lib/roles/admin.js +3 -72
  273. package/lib/roles/admin.js.map +1 -1
  274. package/lib/schema/mutation.js +20 -15
  275. package/lib/schema/mutation.js.map +1 -1
  276. package/lib/schema/query.js +14 -12
  277. package/lib/schema/query.js.map +1 -1
  278. package/lib/schema/types/assortment.js +1 -0
  279. package/lib/schema/types/assortment.js.map +1 -1
  280. package/lib/schema/types/dispatch.js +0 -1
  281. package/lib/schema/types/dispatch.js.map +1 -1
  282. package/lib/schema/types/product/plan-product.js +0 -1
  283. package/lib/schema/types/product/plan-product.js.map +1 -1
  284. package/lib/schema/types/product/simple-product.js +0 -1
  285. package/lib/schema/types/product/simple-product.js.map +1 -1
  286. package/lib/schema/types/product/tokenized-product.js +0 -1
  287. package/lib/schema/types/product/tokenized-product.js.map +1 -1
  288. package/lib/schema/types/stock.js +0 -1
  289. package/lib/schema/types/stock.js.map +1 -1
  290. package/lib/schema/types/user.js +3 -0
  291. package/lib/schema/types/user.js.map +1 -1
  292. package/package.json +12 -11
  293. package/src/acl.ts +2 -2
  294. package/src/api-index.ts +1 -1
  295. package/src/createGraphQLServer.ts +13 -24
  296. package/src/errors.ts +85 -0
  297. package/src/express/createBulkImportMiddleware.ts +6 -9
  298. package/src/express/createERCMetadataMiddleware.ts +2 -1
  299. package/src/express/createSingleSignOnMiddleware.ts +3 -2
  300. package/src/loaders/index.ts +27 -35
  301. package/src/resolvers/mutations/accounts/changePassword.ts +9 -2
  302. package/src/resolvers/mutations/accounts/createUser.ts +19 -4
  303. package/src/resolvers/mutations/accounts/disableTOTP.ts +13 -3
  304. package/src/resolvers/mutations/accounts/enableTOTP.ts +9 -2
  305. package/src/resolvers/mutations/accounts/enrollUser.ts +19 -4
  306. package/src/resolvers/mutations/accounts/forgotPassword.ts +8 -1
  307. package/src/resolvers/mutations/accounts/impersonate.ts +1 -1
  308. package/src/resolvers/mutations/accounts/loginWithPassword.ts +24 -1
  309. package/src/resolvers/mutations/accounts/loginWithWebAuthn.ts +13 -2
  310. package/src/resolvers/mutations/accounts/logout.ts +9 -2
  311. package/src/resolvers/mutations/accounts/logoutAllSessions.ts +7 -1
  312. package/src/resolvers/mutations/accounts/resetPassword.ts +19 -3
  313. package/src/resolvers/mutations/assortments/addAssortmentFilter.ts +5 -9
  314. package/src/resolvers/mutations/assortments/addAssortmentLink.ts +22 -14
  315. package/src/resolvers/mutations/assortments/addAssortmentMedia.ts +2 -6
  316. package/src/resolvers/mutations/assortments/addAssortmentProduct.ts +0 -2
  317. package/src/resolvers/mutations/assortments/createAssortment.ts +4 -8
  318. package/src/resolvers/mutations/assortments/prepareAssortmentMediaUpload.ts +0 -1
  319. package/src/resolvers/mutations/assortments/removeAssortmentMedia.ts +2 -2
  320. package/src/resolvers/mutations/assortments/reorderAssortmentFilters.ts +3 -6
  321. package/src/resolvers/mutations/assortments/reorderAssortmentLinks.ts +0 -1
  322. package/src/resolvers/mutations/assortments/reorderAssortmentMedia.ts +3 -6
  323. package/src/resolvers/mutations/assortments/reorderAssortmentProducts.ts +0 -1
  324. package/src/resolvers/mutations/assortments/setBaseAssortment.ts +1 -1
  325. package/src/resolvers/mutations/assortments/updateAssortment.ts +1 -1
  326. package/src/resolvers/mutations/assortments/updateAssortmentMediaTexts.ts +1 -1
  327. package/src/resolvers/mutations/assortments/updateAssortmentTexts.ts +1 -1
  328. package/src/resolvers/mutations/bookmarks/bookmark.ts +4 -7
  329. package/src/resolvers/mutations/bookmarks/createBookmark.ts +4 -7
  330. package/src/resolvers/mutations/countries/createCountry.ts +3 -7
  331. package/src/resolvers/mutations/countries/removeCountry.ts +1 -1
  332. package/src/resolvers/mutations/countries/updateCountry.ts +1 -1
  333. package/src/resolvers/mutations/currencies/createCurrency.ts +3 -7
  334. package/src/resolvers/mutations/currencies/removeCurrency.ts +1 -1
  335. package/src/resolvers/mutations/currencies/updateCurrency.ts +1 -1
  336. package/src/resolvers/mutations/delivery/createDeliveryProvider.ts +3 -7
  337. package/src/resolvers/mutations/delivery/removeDeliveryProvider.ts +1 -1
  338. package/src/resolvers/mutations/delivery/updateDeliveryProvider.ts +1 -1
  339. package/src/resolvers/mutations/enrollments/activateEnrollment.ts +1 -1
  340. package/src/resolvers/mutations/enrollments/terminateEnrollment.ts +1 -1
  341. package/src/resolvers/mutations/enrollments/updateEnrollment.ts +5 -5
  342. package/src/resolvers/mutations/filters/createFilter.ts +0 -2
  343. package/src/resolvers/mutations/filters/createFilterOption.ts +5 -1
  344. package/src/resolvers/mutations/filters/removeFilter.ts +3 -3
  345. package/src/resolvers/mutations/filters/updateFilter.ts +1 -1
  346. package/src/resolvers/mutations/filters/updateFilterTexts.ts +1 -1
  347. package/src/resolvers/mutations/index.ts +2 -0
  348. package/src/resolvers/mutations/languages/createLanguage.ts +3 -7
  349. package/src/resolvers/mutations/languages/removeLanguage.ts +1 -1
  350. package/src/resolvers/mutations/languages/updateLanguage.ts +1 -1
  351. package/src/resolvers/mutations/orders/createCart.ts +4 -1
  352. package/src/resolvers/mutations/orders/payOrder.ts +1 -1
  353. package/src/resolvers/mutations/orders/removeOrder.ts +1 -1
  354. package/src/resolvers/mutations/payment/createPaymentProvider.ts +3 -7
  355. package/src/resolvers/mutations/payment/registerPaymentCredentials.ts +6 -2
  356. package/src/resolvers/mutations/payment/removePaymentProvider.ts +1 -1
  357. package/src/resolvers/mutations/payment/updatePaymentProvider.ts +1 -1
  358. package/src/resolvers/mutations/products/addProductAssignment.ts +4 -8
  359. package/src/resolvers/mutations/products/addProductMedia.ts +1 -2
  360. package/src/resolvers/mutations/products/addProductReviewVote.ts +1 -1
  361. package/src/resolvers/mutations/products/createProduct.ts +4 -8
  362. package/src/resolvers/mutations/products/createProductBundleItem.ts +1 -1
  363. package/src/resolvers/mutations/products/createProductReview.ts +5 -8
  364. package/src/resolvers/mutations/products/createProductVariation.ts +6 -10
  365. package/src/resolvers/mutations/products/createProductVariationOption.ts +4 -5
  366. package/src/resolvers/mutations/products/prepareProductMediaUpload.ts +0 -1
  367. package/src/resolvers/mutations/products/publishProduct.ts +1 -1
  368. package/src/resolvers/mutations/products/removeBundleItem.ts +2 -2
  369. package/src/resolvers/mutations/products/removeProduct.ts +23 -2
  370. package/src/resolvers/mutations/products/removeProductAssignment.ts +1 -1
  371. package/src/resolvers/mutations/products/removeProductMedia.ts +2 -2
  372. package/src/resolvers/mutations/products/removeProductReview.ts +1 -1
  373. package/src/resolvers/mutations/products/removeProductReviewVote.ts +1 -1
  374. package/src/resolvers/mutations/products/removeProductVariation.ts +1 -1
  375. package/src/resolvers/mutations/products/removeProductVariationOption.ts +0 -1
  376. package/src/resolvers/mutations/products/reorderProductMedia.ts +1 -1
  377. package/src/resolvers/mutations/products/unpublishProduct.ts +1 -1
  378. package/src/resolvers/mutations/products/updateProduct.ts +1 -1
  379. package/src/resolvers/mutations/products/updateProductCommerce.ts +1 -1
  380. package/src/resolvers/mutations/products/updateProductMediaTexts.ts +1 -1
  381. package/src/resolvers/mutations/products/updateProductPlan.ts +1 -1
  382. package/src/resolvers/mutations/products/updateProductReview.ts +1 -1
  383. package/src/resolvers/mutations/products/updateProductSupply.ts +1 -1
  384. package/src/resolvers/mutations/products/updateProductTexts.ts +1 -1
  385. package/src/resolvers/mutations/products/updateProductTokenization.ts +1 -1
  386. package/src/resolvers/mutations/products/updateProductVariationTexts.ts +0 -1
  387. package/src/resolvers/mutations/products/updateProductWarehousing.ts +1 -1
  388. package/src/resolvers/mutations/users/prepareUserAvatarUpload.ts +0 -1
  389. package/src/resolvers/mutations/users/removeUser.ts +19 -0
  390. package/src/resolvers/mutations/users/setRoles.ts +1 -1
  391. package/src/resolvers/mutations/users/setUserTags.ts +1 -1
  392. package/src/resolvers/mutations/users/updateUserAvatar.ts +1 -2
  393. package/src/resolvers/mutations/users/updateUserProfile.ts +1 -1
  394. package/src/resolvers/mutations/utils/getOrderCart.ts +1 -1
  395. package/src/resolvers/mutations/warehousing/createWarehousingProvider.ts +3 -7
  396. package/src/resolvers/mutations/warehousing/removeWarehousingProvider.ts +1 -1
  397. package/src/resolvers/mutations/warehousing/updateWarehousingProvider.ts +1 -1
  398. package/src/resolvers/mutations/worker/addWork.ts +1 -1
  399. package/src/resolvers/mutations/worker/finishWork.ts +8 -12
  400. package/src/resolvers/mutations/worker/removeWork.ts +1 -1
  401. package/src/resolvers/queries/products/productCatalogPrices.ts +0 -1
  402. package/src/resolvers/queries/users/users.ts +2 -1
  403. package/src/resolvers/queries/worker/workQueue.ts +1 -1
  404. package/src/resolvers/type/assortment/assortment-filter-types.ts +0 -1
  405. package/src/resolvers/type/assortment/assortment-link-types.ts +0 -2
  406. package/src/resolvers/type/assortment/assortment-media-types.ts +2 -0
  407. package/src/resolvers/type/assortment/assortment-path-link-types.ts +1 -0
  408. package/src/resolvers/type/assortment/assortment-product-types.ts +0 -2
  409. package/src/resolvers/type/assortment/assortment-types.ts +9 -4
  410. package/src/resolvers/type/bookmark-types.ts +0 -1
  411. package/src/resolvers/type/enrollment/enrollment-plan-tyes.ts +0 -1
  412. package/src/resolvers/type/order/order-item-types.ts +0 -3
  413. package/src/resolvers/type/product/product-assortment-path-types.ts +1 -0
  414. package/src/resolvers/type/product/product-bundle-item-types.ts +0 -1
  415. package/src/resolvers/type/product/product-configurable-types.ts +1 -0
  416. package/src/resolvers/type/product/product-media-types.ts +2 -0
  417. package/src/resolvers/type/product/product-plan-types.ts +2 -18
  418. package/src/resolvers/type/product/product-review-types.ts +0 -1
  419. package/src/resolvers/type/product/product-variation-assignment-types.ts +0 -1
  420. package/src/resolvers/type/quotation-types.ts +0 -1
  421. package/src/resolvers/type/token-types.ts +2 -1
  422. package/src/resolvers/type/user-types.ts +14 -10
  423. package/src/roles/admin.ts +3 -72
  424. package/src/schema/mutation.js +20 -15
  425. package/src/schema/query.js +14 -12
  426. package/src/schema/types/assortment.js +1 -0
  427. package/src/schema/types/dispatch.js +0 -1
  428. package/src/schema/types/product/plan-product.js +0 -1
  429. package/src/schema/types/product/simple-product.js +0 -1
  430. package/src/schema/types/product/tokenized-product.js +0 -1
  431. package/src/schema/types/stock.js +0 -1
  432. package/src/schema/types/user.js +3 -0
  433. package/tests/api-index.test.ts +78 -0
@@ -13,11 +13,13 @@ export interface AssortmentMediaHelperTypes {
13
13
  }
14
14
 
15
15
  export const AssortmentMedia: AssortmentMediaHelperTypes = {
16
+ // TODO: Loader for assortment media texts!
16
17
  texts: (obj, { forceLocale }, { modules, localeContext }) =>
17
18
  modules.assortments.media.texts.findLocalizedMediaText({
18
19
  assortmentMediaId: obj._id,
19
20
  locale: forceLocale || localeContext.normalized,
20
21
  }),
21
22
 
23
+ // TODO: Loader for files!
22
24
  file: (obj, _, { modules }) => modules.files.findFile({ fileId: obj.mediaId }),
23
25
  };
@@ -14,6 +14,7 @@ export interface AssortmentPathLinkHelperTypes {
14
14
 
15
15
  export const AssortmentPathLink: AssortmentPathLinkHelperTypes = {
16
16
  link: async ({ assortmentId, childAssortmentId }, _, { modules }) => {
17
+ // TODO: Loader
17
18
  return modules.assortments.links.findLink({
18
19
  parentAssortmentId: assortmentId,
19
20
  childAssortmentId,
@@ -16,7 +16,6 @@ export const AssortmentProduct: AssortmentProductHelperTypes = {
16
16
  assortment: async (obj, _, { loaders }) => {
17
17
  const assortment = await loaders.assortmentLoader.load({
18
18
  assortmentId: obj.assortmentId,
19
- includeInactive: true,
20
19
  });
21
20
  return assortment;
22
21
  },
@@ -24,7 +23,6 @@ export const AssortmentProduct: AssortmentProductHelperTypes = {
24
23
  product: async (obj, _, { loaders }) => {
25
24
  const product = await loaders.productLoader.load({
26
25
  productId: obj.productId,
27
- includeDrafts: true,
28
26
  });
29
27
  return product;
30
28
  },
@@ -62,10 +62,11 @@ export const Assortment: AssortmentHelperTypes = {
62
62
  },
63
63
 
64
64
  childrenCount: async (assortment, { includeInactive = false }, { modules }) => {
65
- const assortmentChildrenIds = await modules.assortments.links.findLinks({
65
+ // TODO: Loader
66
+ const assortmentChildLinks = await modules.assortments.links.findLinks({
66
67
  parentAssortmentId: assortment._id,
67
68
  });
68
- const assortmentIds = assortmentChildrenIds.map(({ childAssortmentId }) => childAssortmentId);
69
+ const assortmentIds = assortmentChildLinks.map(({ childAssortmentId }) => childAssortmentId);
69
70
 
70
71
  const selector: Query = {
71
72
  assortmentIds,
@@ -77,6 +78,7 @@ export const Assortment: AssortmentHelperTypes = {
77
78
  },
78
79
 
79
80
  filterAssignments: async (obj, _, { modules }) => {
81
+ // TODO: Loader & move default sort to module
80
82
  return modules.assortments.filters.findFilters(
81
83
  {
82
84
  assortmentId: obj._id,
@@ -87,7 +89,8 @@ export const Assortment: AssortmentHelperTypes = {
87
89
  );
88
90
  },
89
91
 
90
- linkedAssortments: async (obj, _, { modules }) => {
92
+ async linkedAssortments(obj, _, { modules }) {
93
+ // TODO: Loader
91
94
  return modules.assortments.links.findLinks({
92
95
  assortmentId: obj._id,
93
96
  });
@@ -100,7 +103,8 @@ export const Assortment: AssortmentHelperTypes = {
100
103
  });
101
104
  },
102
105
 
103
- productAssignments: async (obj, _, { modules }) => {
106
+ async productAssignments(obj, _, { modules }) {
107
+ // TODO: Loader & move default sort to core module
104
108
  return modules.assortments.products.findProducts(
105
109
  {
106
110
  assortmentId: obj._id,
@@ -124,6 +128,7 @@ export const Assortment: AssortmentHelperTypes = {
124
128
  assortmentId: obj._id,
125
129
  ignoreChildAssortments: query.ignoreChildAssortments,
126
130
  });
131
+
127
132
  const filterIds = await context.modules.assortments.filters.findFilterIds({
128
133
  assortmentId: obj._id,
129
134
  });
@@ -14,7 +14,6 @@ export const Bookmark: BookmarkHelperTypes = {
14
14
  product: async (obj, _, { loaders }) => {
15
15
  const product = await loaders.productLoader.load({
16
16
  productId: obj.productId,
17
- includeDrafts: true,
18
17
  });
19
18
  return product;
20
19
  },
@@ -12,7 +12,6 @@ export const EnrollmentPlan: EnrollmentPlanHelperTypes = {
12
12
  product: async (plan, _, { loaders }) => {
13
13
  const product = await loaders.productLoader.load({
14
14
  productId: plan.productId,
15
- includeDrafts: true,
16
15
  });
17
16
  return product;
18
17
  },
@@ -70,7 +70,6 @@ export const OrderItem: OrderItemHelperTypes = {
70
70
  });
71
71
  const product = await loaders.productLoader.load({
72
72
  productId: obj.productId,
73
- includeDrafts: true,
74
73
  });
75
74
 
76
75
  return Promise.all(
@@ -103,7 +102,6 @@ export const OrderItem: OrderItemHelperTypes = {
103
102
  originalProduct: async (obj, _, { loaders }) => {
104
103
  const product = await loaders.productLoader.load({
105
104
  productId: obj.originalProductId,
106
- includeDrafts: true,
107
105
  });
108
106
  return product;
109
107
  },
@@ -111,7 +109,6 @@ export const OrderItem: OrderItemHelperTypes = {
111
109
  product: async (obj, _, { loaders }) => {
112
110
  const product = await loaders.productLoader.load({
113
111
  productId: obj.productId,
114
- includeDrafts: true,
115
112
  });
116
113
  return product;
117
114
  },
@@ -2,6 +2,7 @@ import { ProductAssortmentPathHelperTypes } from '@unchainedshop/types/products'
2
2
 
3
3
  export const ProductAssortmentPath: ProductAssortmentPathHelperTypes = {
4
4
  assortmentProduct: async ({ _id }, _, { modules }) => {
5
+ // TODO: Loader
5
6
  return modules.assortments.products.findProduct({
6
7
  assortmentProductId: _id,
7
8
  });
@@ -4,7 +4,6 @@ export const ProductBundleItem: ProductBundleItemHelperTypes = {
4
4
  product: async (productItem, _, { loaders }) => {
5
5
  const product = await loaders.productLoader.load({
6
6
  productId: productItem.productId,
7
- includeDrafts: true,
8
7
  });
9
8
  return product;
10
9
  },
@@ -64,6 +64,7 @@ export const ConfigurableProduct: ConfigurableProductHelperTypes = {
64
64
  {
65
65
  quantity,
66
66
  currency,
67
+ userId: requestContext.userId,
67
68
  country: countryContext,
68
69
  useNetPrice,
69
70
  vectors,
@@ -1,6 +1,7 @@
1
1
  import { ProductMediaHelperTypes } from '@unchainedshop/types/products.media';
2
2
 
3
3
  export const ProductMedia: ProductMediaHelperTypes = {
4
+ // TODO: Loader for product media texts!
4
5
  texts: async (obj, { forceLocale }, { modules, localeContext }) => {
5
6
  return modules.products.media.texts.findLocalizedMediaText({
6
7
  productMediaId: obj._id,
@@ -9,6 +10,7 @@ export const ProductMedia: ProductMediaHelperTypes = {
9
10
  },
10
11
 
11
12
  file: async (obj, _, { modules }) => {
13
+ // TODO: Loader
12
14
  return modules.files.findFile({ fileId: obj.mediaId });
13
15
  },
14
16
  };
@@ -1,4 +1,4 @@
1
- import { PlanProductHelperTypes, ProductPrice } from '@unchainedshop/types/products';
1
+ import { PlanProductHelperTypes } from '@unchainedshop/types/products';
2
2
  import { Product } from './product-types';
3
3
 
4
4
  export const PlanProduct: PlanProductHelperTypes = {
@@ -37,7 +37,7 @@ export const PlanProduct: PlanProductHelperTypes = {
37
37
  ));
38
38
  return modules.products.prices.userPrice(
39
39
  obj,
40
- { quantity, currency, country: countryContext, useNetPrice },
40
+ { quantity, userId: requestContext.userId, currency, country: countryContext, useNetPrice },
41
41
  requestContext,
42
42
  );
43
43
  },
@@ -55,22 +55,6 @@ export const PlanProduct: PlanProductHelperTypes = {
55
55
  return modules.products.prices.catalogPricesLeveled(obj, { currency, country: countryContext });
56
56
  },
57
57
 
58
- simulatedDiscounts: async () => {
59
- // const { modules, countryContext } = requestContext;
60
- // return modules.products.prices.userDiscounts(
61
- // {
62
- // quantity,
63
- // country: countryContext,
64
- // },
65
- // requestContext
66
- // );
67
- return [] as Array<{
68
- _id: string;
69
- interface: any;
70
- total: ProductPrice;
71
- }>;
72
- },
73
-
74
58
  salesUnit(obj) {
75
59
  return obj.commerce && obj.commerce.salesUnit;
76
60
  },
@@ -23,7 +23,6 @@ export const ProductReview: ProductReviewHelperTypes = {
23
23
  product: async (review, _, { loaders }) => {
24
24
  const product = await loaders.productLoader.load({
25
25
  productId: review.productId,
26
- includeDrafts: true,
27
26
  });
28
27
  return product;
29
28
  },
@@ -14,7 +14,6 @@ export const ProductVariationAssignment: ProductVariationAssignmentHelperTypes =
14
14
  product: async ({ assignment }, _, { loaders }) => {
15
15
  const product = await loaders.productLoader.load({
16
16
  productId: assignment.productId,
17
- includeDrafts: true,
18
17
  });
19
18
  return product;
20
19
  },
@@ -27,7 +27,6 @@ export const Quotation: QuotationHelperTypes = {
27
27
  product: async (obj, _, { loaders }) => {
28
28
  const product = await loaders.productLoader.load({
29
29
  productId: obj.productId,
30
- includeDrafts: true,
31
30
  });
32
31
  return product;
33
32
  },
@@ -50,9 +50,10 @@ export const Token: TokenHelperTypes = {
50
50
  {
51
51
  token,
52
52
  product,
53
+ locale: new Locale(forceLocale),
53
54
  referenceDate: new Date(),
54
55
  },
55
- { ...context, localeContext: new Locale(forceLocale) },
56
+ context,
56
57
  );
57
58
 
58
59
  return ercMetadata;
@@ -17,6 +17,7 @@ import {
17
17
  } from '@unchainedshop/types/user';
18
18
  import type { Locale } from 'locale';
19
19
  import { TokenSurrogate } from '@unchainedshop/types/warehousing';
20
+ import { Roles, permissions } from '@unchainedshop/roles';
20
21
  import { checkAction, checkTypeResolver } from '../../acl';
21
22
  import { actions } from '../../roles';
22
23
 
@@ -24,6 +25,9 @@ type HelperType<P, T> = (user: UserType, params: P, context: Context) => Promise
24
25
 
25
26
  export interface UserHelperTypes {
26
27
  _id: HelperType<any, boolean>;
28
+ created: HelperType<any, Date>;
29
+ updated: HelperType<any, Date>;
30
+ deleted: HelperType<any, Date>;
27
31
  avatar: HelperType<{ localeContext: Locale }, File>;
28
32
  bookmarks: HelperType<any, Array<Bookmark>>;
29
33
  cart: HelperType<{ orderNumber?: string }, Order>;
@@ -70,6 +74,9 @@ const getPrimaryEmail = (user: UserType) => {
70
74
 
71
75
  export const User: UserHelperTypes = {
72
76
  _id: checkTypeResolver(viewUserPublicInfos, '_id'),
77
+ created: checkTypeResolver(viewUserPrivateInfos, 'created'),
78
+ updated: checkTypeResolver(viewUserPrivateInfos, 'updated'),
79
+ deleted: checkTypeResolver(viewUserPrivateInfos, 'deleted'),
73
80
  emails: checkTypeResolver(viewUserPrivateInfos, 'emails'),
74
81
  lastBillingAddress: checkTypeResolver(viewUserPrivateInfos, 'lastBillingAddress'),
75
82
  lastContact: checkTypeResolver(viewUserPrivateInfos, 'lastContact'),
@@ -134,7 +141,7 @@ export const User: UserHelperTypes = {
134
141
 
135
142
  country: async (user, params, context) => {
136
143
  await checkAction(context, viewUserPrivateInfos, [user, params]);
137
- return context.services.users.getUserCountry(user, params, context);
144
+ return context.services.users.getUserCountry(user, context);
138
145
  },
139
146
 
140
147
  enrollments: async (user, params, context) => {
@@ -146,18 +153,15 @@ export const User: UserHelperTypes = {
146
153
 
147
154
  language: async (user, params, context) => {
148
155
  await checkAction(context, viewUserPrivateInfos, [user, params]);
149
- return context.services.users.getUserLanguage(user, params, context);
156
+ return context.services.users.getUserLanguage(user, context);
150
157
  },
151
158
 
152
159
  allowedActions: async (user, params, context) => {
153
160
  await checkAction(context, viewUserPrivateInfos, [user, params]);
154
- return context.services.users.getUserRoleActions(user, context);
155
- },
156
161
 
157
- // locale: async (user, params, context) => {
158
- // await checkAction(context, viewUserPrivateInfos, [user, params, context]);
159
- // return context.modules.users.userLocale(user, params);
160
- // },
162
+ const userRoles = Roles.getUserRoles(user?._id, user.roles, true);
163
+ return permissions(userRoles, context.roles) as Promise<string[]>;
164
+ },
161
165
 
162
166
  orders: async (user, params, context) => {
163
167
  await checkAction(context, viewUserOrders, [user, params]);
@@ -183,12 +187,12 @@ export const User: UserHelperTypes = {
183
187
 
184
188
  webAuthnCredentials: async (user, params, context) => {
185
189
  await checkAction(context, viewUserPrivateInfos, [user, params]);
186
- return user.services.webAuthn || [];
190
+ return user.services?.webAuthn || [];
187
191
  },
188
192
 
189
193
  web3Addresses: async (user, params, context) => {
190
194
  await checkAction(context, viewUserPrivateInfos, [user, params]);
191
- return user.services.web3 || [];
195
+ return user.services?.web3 || [];
192
196
  },
193
197
 
194
198
  quotations: async (user, params, context) => {
@@ -1,74 +1,5 @@
1
1
  export const admin = (role, actions) => {
2
- role.allow(actions.viewEvent, () => true);
3
- role.allow(actions.viewEvents, () => true);
4
- role.allow(actions.viewUser, () => true);
5
- role.allow(actions.viewUsers, () => true);
6
- role.allow(actions.viewPaymentProviders, () => true);
7
- role.allow(actions.viewPaymentProvider, () => true);
8
- role.allow(actions.viewPaymentInterfaces, () => true);
9
- role.allow(actions.viewDeliveryProviders, () => true);
10
- role.allow(actions.viewDeliveryProvider, () => true);
11
- role.allow(actions.viewDeliveryInterfaces, () => true);
12
- role.allow(actions.viewWarehousingProviders, () => true);
13
- role.allow(actions.viewWarehousingProvider, () => true);
14
- role.allow(actions.viewWarehousingInterfaces, () => true);
15
- role.allow(actions.viewTranslations, () => true);
16
- role.allow(actions.viewOrders, () => true);
17
- role.allow(actions.viewOrder, () => true);
18
- role.allow(actions.viewProducts, () => true);
19
- role.allow(actions.manageLanguages, () => true);
20
- role.allow(actions.manageCountries, () => true);
21
- role.allow(actions.manageProducts, () => true);
22
- role.allow(actions.manageCurrencies, () => true);
23
- role.allow(actions.managePaymentProviders, () => true);
24
- role.allow(actions.manageDeliveryProviders, () => true);
25
- role.allow(actions.manageWarehousingProviders, () => true);
26
- role.allow(actions.updateToken, () => true);
27
- role.allow(actions.viewToken, () => true);
28
- role.allow(actions.manageUsers, () => true);
29
- role.allow(actions.updateUser, () => true);
30
- role.allow(actions.updateUsername, () => true);
31
- role.allow(actions.manageAssortments, () => true);
32
- role.allow(actions.manageFilters, () => true);
33
- role.allow(actions.updateCart, () => true);
34
- role.allow(actions.createCart, () => true);
35
- role.allow(actions.sendEmail, () => true);
36
- role.allow(actions.updateOrder, () => true);
37
- role.allow(actions.updateOrderDiscount, () => true);
38
- role.allow(actions.updateOrderItem, () => true);
39
- role.allow(actions.updateOrderDelivery, () => true);
40
- role.allow(actions.updateOrderPayment, () => true);
41
- role.allow(actions.markOrderConfirmed, () => true);
42
- role.allow(actions.markOrderRejected, () => true);
43
- role.allow(actions.markOrderPaid, () => true);
44
- role.allow(actions.markOrderDelivered, () => true);
45
- role.allow(actions.viewLogs, () => true);
46
- role.allow(actions.viewUserRoles, () => true);
47
- role.allow(actions.viewUserOrders, () => true);
48
- role.allow(actions.viewUserQuotations, () => true);
49
- role.allow(actions.viewUserPublicInfos, () => true);
50
- role.allow(actions.viewUserPrivateInfos, () => true);
51
- role.allow(actions.viewUserEnrollments, () => true);
52
- role.allow(actions.viewUserTokens, () => true);
53
- role.allow(actions.reviewProduct, () => true);
54
- role.allow(actions.updateProductReview, () => true);
55
- role.allow(actions.manageProductReviews, () => true);
56
- role.allow(actions.requestQuotation, () => true);
57
- role.allow(actions.viewQuotations, () => true);
58
- role.allow(actions.viewQuotation, () => true);
59
- role.allow(actions.manageQuotations, () => true);
60
- role.allow(actions.answerQuotation, () => true);
61
- role.allow(actions.bookmarkProduct, () => true);
62
- role.allow(actions.manageBookmarks, () => true);
63
- role.allow(actions.voteProductReview, () => true);
64
- role.allow(actions.manageWorker, () => true);
65
- role.allow(actions.viewEnrollments, () => true);
66
- role.allow(actions.viewEnrollment, () => true);
67
- role.allow(actions.updateEnrollment, () => true);
68
- role.allow(actions.registerPaymentCredentials, () => true);
69
- role.allow(actions.managePaymentCredentials, () => true);
70
- role.allow(actions.bulkImport, () => true);
71
- role.allow(actions.authTwoFactor, () => true);
72
- role.allow(actions.manageTwoFactor, () => true);
73
- role.allow(actions.impersonate, () => true);
2
+ Object.values(actions).forEach((action) => {
3
+ role.allow(action, () => true);
4
+ });
74
5
  };
@@ -20,9 +20,9 @@ export default [
20
20
  """
21
21
  Web3
22
22
  """
23
- addWeb3Address(address: String!): User
24
- verifyWeb3Address(address: String!, hash: String!): User
25
- removeWeb3Address(address: String!): User
23
+ addWeb3Address(address: String!): User!
24
+ verifyWeb3Address(address: String!, hash: String!): User!
25
+ removeWeb3Address(address: String!): User!
26
26
 
27
27
  """
28
28
  Create a new user.
@@ -40,7 +40,7 @@ export default [
40
40
  login and logged in user IP address, locale and country where they
41
41
  accessed the system)
42
42
  """
43
- heartbeat: User
43
+ heartbeat: User!
44
44
 
45
45
  """
46
46
  Change the current user's password. Must be logged in.
@@ -90,12 +90,12 @@ export default [
90
90
  """
91
91
  In order to activate 2nd factor (TOTP), generate a secret and return
92
92
  """
93
- enableTOTP(secretBase32: String!, code: String!): User
93
+ enableTOTP(secretBase32: String!, code: String!): User!
94
94
 
95
95
  """
96
96
  Disable the 2nd factor (TOTP)
97
97
  """
98
- disableTOTP(code: String!, userId: ID): User
98
+ disableTOTP(code: String!, userId: ID): User!
99
99
 
100
100
  """
101
101
  Create WebAuthn PublicKeyCredentialCreationOptions to use for Registering a new WebAuthn Device
@@ -309,32 +309,37 @@ export default [
309
309
  """
310
310
  Update E-Mail address of any user or logged in user if userId is not provided
311
311
  """
312
- addEmail(email: String!, userId: ID): User
312
+ addEmail(email: String!, userId: ID): User!
313
313
 
314
314
  """
315
315
  Update E-Mail address of any user or logged in user if userId is not provided
316
316
  """
317
- removeEmail(email: String!, userId: ID): User
317
+ removeEmail(email: String!, userId: ID): User!
318
318
 
319
319
  """
320
320
  Update Avatar of any user or logged in user if userId is not provided
321
321
  """
322
- updateUserAvatar(avatar: Upload!, userId: ID): User
322
+ updateUserAvatar(avatar: Upload!, userId: ID): User!
323
323
 
324
324
  """
325
325
  Set tags of user
326
326
  """
327
- setUserTags(tags: [LowerCaseString]!, userId: ID!): User
327
+ setUserTags(tags: [LowerCaseString]!, userId: ID!): User!
328
328
 
329
329
  """
330
330
  Update Profile of any user or logged in user if userId is not provided
331
331
  """
332
- updateUserProfile(profile: UserProfileInput, meta: JSON, userId: ID): User
332
+ updateUserProfile(profile: UserProfileInput, meta: JSON, userId: ID): User!
333
+
334
+ """
335
+ Remove any user or logged in user if userId is not provided
336
+ """
337
+ removeUser(userId: ID): User!
333
338
 
334
339
  """
335
340
  Enroll a new user, setting enroll to true will let the user choose his password (e-mail gets sent)
336
341
  """
337
- enrollUser(profile: UserProfileInput!, email: String!, plainPassword: String): User
342
+ enrollUser(profile: UserProfileInput!, email: String!, plainPassword: String): User!
338
343
 
339
344
  """
340
345
  Forcefully trigger an enrollment email for already added users by e-mail
@@ -344,17 +349,17 @@ export default [
344
349
  """
345
350
  Set username for a specific user
346
351
  """
347
- setUsername(username: String!, userId: ID!): User
352
+ setUsername(username: String!, userId: ID!): User!
348
353
 
349
354
  """
350
355
  Set a new password for a specific user
351
356
  """
352
- setPassword(newPlainPassword: String, userId: ID!): User
357
+ setPassword(newPlainPassword: String, userId: ID!): User!
353
358
 
354
359
  """
355
360
  Set roles of a user
356
361
  """
357
- setRoles(roles: [String!]!, userId: ID!): User
362
+ setRoles(roles: [String!]!, userId: ID!): User!
358
363
 
359
364
  """
360
365
  Create a new product
@@ -7,13 +7,14 @@ export default [
7
7
  me: User
8
8
 
9
9
  """
10
- Get list of users
10
+ Get list of users, by default sorted by creation date (ascending) unless a queryString is set
11
11
  """
12
12
  users(
13
13
  limit: Int = 20
14
14
  offset: Int = 0
15
15
  includeGuests: Boolean = false
16
16
  queryString: String
17
+ sort: [SortOptionInput!]
17
18
  ): [User!]!
18
19
 
19
20
  """
@@ -40,6 +41,7 @@ export default [
40
41
  """
41
42
  Simple list of published products filtered either by tags or explicit slugs
42
43
  If a slug is provided, limit and offset don't have any effect on the result
44
+ By default sorted by sequence (ascending) and published (ascending) unless a queryString is set
43
45
  """
44
46
  products(
45
47
  queryString: String
@@ -88,7 +90,7 @@ export default [
88
90
  @cacheControl(maxAge: 180)
89
91
 
90
92
  """
91
- Get all languages
93
+ Get all languages, by default sorted by creation date (ascending)
92
94
  """
93
95
  languages(
94
96
  limit: Int = 50
@@ -104,7 +106,7 @@ export default [
104
106
  language(languageId: ID!): Language
105
107
 
106
108
  """
107
- Get all countries
109
+ Get all countries, by default sorted by creation date (ascending)
108
110
  """
109
111
  countries(
110
112
  limit: Int = 50
@@ -132,7 +134,7 @@ export default [
132
134
  @cacheControl(maxAge: 180)
133
135
 
134
136
  """
135
- Get all currencies
137
+ Get all currencies, by default sorted by creation date (ascending)
136
138
  """
137
139
  currencies(
138
140
  limit: Int = 50
@@ -227,7 +229,7 @@ export default [
227
229
  ordersCount(includeCarts: Boolean = false, queryString: String): Int!
228
230
 
229
231
  """
230
- Get all orders
232
+ Get all orders, by default sorted by creation date (descending)
231
233
  """
232
234
  orders(
233
235
  limit: Int = 10
@@ -248,7 +250,7 @@ export default [
248
250
  shopInfo: Shop!
249
251
 
250
252
  """
251
- Get all root assortments
253
+ Get all root assortments, by default sorted by sequence (ascending)
252
254
  """
253
255
  assortments(
254
256
  queryString: String
@@ -302,7 +304,7 @@ export default [
302
304
  @cacheControl(maxAge: 180)
303
305
 
304
306
  """
305
- Get all filters
307
+ Get all filters, by default sorted by creation date (ascending)
306
308
  """
307
309
  filters(
308
310
  limit: Int = 10
@@ -323,7 +325,7 @@ export default [
323
325
  productReviewsCount(queryString: String): Int! @cacheControl(scope: PRIVATE, maxAge: 0)
324
326
 
325
327
  """
326
- Get all product reviews
328
+ Get all product reviews, by default sorted by creation date (descending)
327
329
  """
328
330
  productReviews(
329
331
  limit: Int = 10
@@ -343,7 +345,7 @@ export default [
343
345
  quotationsCount(queryString: String): Int!
344
346
 
345
347
  """
346
- Get all quotations
348
+ Get all quotations, by default sorted by creation date (ascending)
347
349
  """
348
350
  quotations(
349
351
  limit: Int = 10
@@ -363,7 +365,7 @@ export default [
363
365
  enrollmentsCount(queryString: String, status: [String!]): Int!
364
366
 
365
367
  """
366
- Get all enrollments
368
+ Get all enrollments, by default sorted by creation date (ascending)
367
369
  """
368
370
  enrollments(
369
371
  limit: Int = 10
@@ -401,7 +403,7 @@ export default [
401
403
  ): AssortmentSearchResult!
402
404
 
403
405
  """
404
- Get all work from the queue
406
+ Get all work from the queue, by default sorted by start date (desc), priority (desc), originalWorkId (asc) and created (asc)
405
407
  """
406
408
  workQueue(
407
409
  limit: Int = 10
@@ -438,7 +440,7 @@ export default [
438
440
  event(eventId: ID!): Event
439
441
 
440
442
  """
441
- Get all emitted events
443
+ Get all emitted events, by default sorted by creation date (desc)
442
444
  """
443
445
  events(
444
446
  types: [String!]
@@ -22,6 +22,7 @@ export default [
22
22
  _id: ID!
23
23
  created: DateTime
24
24
  updated: DateTime
25
+ deleted: DateTime
25
26
  isActive: Boolean
26
27
  isBase: Boolean
27
28
  isRoot: Boolean
@@ -1,4 +1,3 @@
1
- // TODO: Cache?
2
1
  export default [
3
2
  /* GraphQL */ `
4
3
  type Dispatch {
@@ -46,7 +46,6 @@ export default [
46
46
  leveledCatalogPrices(currency: String): [PriceLevel!]!
47
47
  simulatedPrice(currency: String, useNetPrice: Boolean = false, quantity: Int = 1): Price
48
48
  @cacheControl(scope: PRIVATE)
49
- simulatedDiscounts(quantity: Int = 1): [ProductDiscount!] @cacheControl(scope: PRIVATE)
50
49
  assortmentPaths(forceLocale: String): [ProductAssortmentPath!]!
51
50
  siblings(
52
51
  assortmentId: ID
@@ -17,7 +17,6 @@ export default [
17
17
  leveledCatalogPrices(currency: String): [PriceLevel!]!
18
18
  simulatedPrice(currency: String, useNetPrice: Boolean = false, quantity: Int = 1): Price
19
19
  @cacheControl(scope: PRIVATE, maxAge: 10)
20
- simulatedDiscounts(quantity: Int = 1): [ProductDiscount!] @cacheControl(scope: PRIVATE, maxAge: 10)
21
20
  simulatedDispatches(
22
21
  deliveryProviderType: DeliveryProviderType = SHIPPING
23
22
  referenceDate: Timestamp
@@ -36,7 +36,6 @@ export default [
36
36
  leveledCatalogPrices(currency: String): [PriceLevel!]!
37
37
  simulatedPrice(currency: String, useNetPrice: Boolean = false, quantity: Int = 1): Price
38
38
  @cacheControl(scope: PRIVATE, maxAge: 10)
39
- simulatedDiscounts(quantity: Int = 1): [ProductDiscount!] @cacheControl(scope: PRIVATE, maxAge: 10)
40
39
  simulatedStocks(referenceDate: Timestamp): [Stock!] @cacheControl(scope: PRIVATE, maxAge: 10)
41
40
  assortmentPaths(forceLocale: String): [ProductAssortmentPath!]!
42
41
  siblings(