@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
@@ -6,7 +6,13 @@ export default async function logoutAllSessions(root: Root, _: any, context: Con
6
6
 
7
7
  log('mutation logoutAllSessions', { userId });
8
8
 
9
- const loggedOut = await modules.accounts.logout({}, context);
9
+ const loggedOut = await modules.accounts.logout(
10
+ {
11
+ loginToken: context.loginToken,
12
+ userId: context.userId,
13
+ },
14
+ context,
15
+ );
10
16
 
11
17
  if (loggedOut.error) {
12
18
  log('Error while logging out', {
@@ -1,5 +1,12 @@
1
1
  import { log } from '@unchainedshop/logger';
2
2
  import { Context, Root } from '@unchainedshop/types/api';
3
+ import {
4
+ AuthOperationFailedError,
5
+ InvalidResetTokenError,
6
+ NoEmailSetError,
7
+ ResetPasswordLinkExpiredError,
8
+ ResetPasswordLinkUnknownAddressError,
9
+ } from '../../../errors';
3
10
 
4
11
  export default async function resetPassword(
5
12
  root: Root,
@@ -13,8 +20,17 @@ export default async function resetPassword(
13
20
  if (!params.newPlainPassword) {
14
21
  throw new Error('Password is required');
15
22
  }
23
+ try {
24
+ const userWithNewPassword = await modules.accounts.resetPassword(params, context);
16
25
 
17
- const userWithNewPassword = await modules.accounts.resetPassword(params, context);
18
-
19
- return modules.accounts.createLoginToken(userWithNewPassword.id, context);
26
+ const result = await modules.accounts.createLoginToken(userWithNewPassword.id, context);
27
+ return result;
28
+ } catch (e) {
29
+ if (e.code === 'InvalidToken') throw new InvalidResetTokenError({});
30
+ if (e.code === 'ResetPasswordLinkExpired') throw new ResetPasswordLinkExpiredError({});
31
+ if (e.code === 'ResetPasswordLinkUnknownAddress​')
32
+ throw new ResetPasswordLinkUnknownAddressError({});
33
+ if (e.code === 'NoEmailSet') throw new NoEmailSetError({});
34
+ throw new AuthOperationFailedError({});
35
+ }
20
36
  }
@@ -20,13 +20,9 @@ export default async function addAssortmentFilter(
20
20
 
21
21
  if (!(await modules.filters.filterExists({ filterId }))) throw new FilterNotFoundError({ filterId });
22
22
 
23
- return modules.assortments.filters.create(
24
- {
25
- assortmentId,
26
- filterId,
27
- authorId: userId,
28
- ...assortmentFilter,
29
- },
30
- userId,
31
- );
23
+ return modules.assortments.filters.create({
24
+ assortmentId,
25
+ filterId,
26
+ ...assortmentFilter,
27
+ });
32
28
  }
@@ -1,7 +1,11 @@
1
1
  import { Context, Root } from '@unchainedshop/types/api';
2
2
  import { AssortmentLink } from '@unchainedshop/types/assortments';
3
3
  import { log } from '@unchainedshop/logger';
4
- import { AssortmentNotFoundError, InvalidIdError } from '../../../errors';
4
+ import {
5
+ AssortmentNotFoundError,
6
+ CyclicAssortmentLinkNotSupportedError,
7
+ InvalidIdError,
8
+ } from '../../../errors';
5
9
 
6
10
  export default async function addAssortmentLink(
7
11
  root: Root,
@@ -29,17 +33,21 @@ export default async function addAssortmentLink(
29
33
  throw new AssortmentNotFoundError({
30
34
  assortmentId: childAssortmentId,
31
35
  });
32
-
33
- return modules.assortments.links.create(
34
- {
35
- parentAssortmentId,
36
- childAssortmentId,
37
- authorId: userId,
38
- ...assortmentLink,
39
- },
40
- {
41
- skipInvalidation: false,
42
- },
43
- userId,
44
- );
36
+ try {
37
+ const result = await modules.assortments.links.create(
38
+ {
39
+ parentAssortmentId,
40
+ childAssortmentId,
41
+ ...assortmentLink,
42
+ },
43
+ {
44
+ skipInvalidation: false,
45
+ },
46
+ );
47
+ return result;
48
+ } catch (e) {
49
+ if (e?.message === 'CyclicGraphNotSupported')
50
+ throw new CyclicAssortmentLinkNotSupportedError({ parentAssortmentId, childAssortmentId });
51
+ throw e;
52
+ }
45
53
  }
@@ -15,16 +15,12 @@ export default async function addAssortmentMedia(root: Root, { media, assortment
15
15
  {
16
16
  directoryName: 'assortment-media',
17
17
  rawFile: media,
18
- meta: { authorId: userId },
19
- userId,
18
+ meta: {},
20
19
  },
21
20
  context,
22
21
  );
23
22
 
24
- const assortmentMedia = await modules.assortments.media.create(
25
- { assortmentId, mediaId: file._id },
26
- userId,
27
- );
23
+ const assortmentMedia = await modules.assortments.media.create({ assortmentId, mediaId: file._id });
28
24
 
29
25
  return assortmentMedia;
30
26
  }
@@ -27,10 +27,8 @@ export default async function addAssortmentProduct(
27
27
  {
28
28
  assortmentId,
29
29
  productId,
30
- authorId: userId,
31
30
  ...assortmentProduct,
32
31
  },
33
32
  { skipInvalidation: false },
34
- userId,
35
33
  );
36
34
  }
@@ -9,14 +9,10 @@ export default async function createAssortment(
9
9
  ) {
10
10
  log('mutation createAssortment', { userId });
11
11
 
12
- const assortmentId = await modules.assortments.create(
13
- {
14
- ...assortment,
15
- locale: localeContext.language,
16
- authorId: userId,
17
- },
18
- userId,
19
- );
12
+ const assortmentId = await modules.assortments.create({
13
+ ...assortment,
14
+ locale: localeContext.language,
15
+ });
20
16
 
21
17
  return modules.assortments.findAssortment({ assortmentId });
22
18
  }
@@ -14,7 +14,6 @@ export default async function prepareAssortmentMediaUpload(
14
14
  directoryName: 'assortment-media',
15
15
  fileName: mediaName,
16
16
  meta: { assortmentId },
17
- userId,
18
17
  },
19
18
  context,
20
19
  );
@@ -18,8 +18,8 @@ export default async function removeAssortmentMedia(
18
18
  });
19
19
  if (!assortmentMedia) throw new AssortmentMediaNotFoundError({ assortmentMediaId });
20
20
 
21
- await modules.files.delete(assortmentMedia.mediaId, userId);
22
- await modules.assortments.media.delete(assortmentMediaId, userId);
21
+ await modules.files.delete(assortmentMedia.mediaId);
22
+ await modules.assortments.media.delete(assortmentMediaId);
23
23
 
24
24
  return assortmentMedia;
25
25
  }
@@ -8,10 +8,7 @@ export default async function reorderAssortmentFilters(
8
8
  ) {
9
9
  log('mutation reorderAssortmentFilters', { userId });
10
10
 
11
- return modules.assortments.filters.updateManualOrder(
12
- {
13
- sortKeys: params.sortKeys,
14
- },
15
- userId,
16
- );
11
+ return modules.assortments.filters.updateManualOrder({
12
+ sortKeys: params.sortKeys,
13
+ });
17
14
  }
@@ -12,6 +12,5 @@ export default async function reorderAssortmentLinks(
12
12
  sortKeys: params.sortKeys,
13
13
  },
14
14
  { skipInvalidation: false },
15
- userId,
16
15
  );
17
16
  }
@@ -7,10 +7,7 @@ export default async function reorderAssortmentMedia(
7
7
  { modules, userId }: Context,
8
8
  ) {
9
9
  log('mutation reorderAssortmentMedia', { userId });
10
- return modules.assortments.media.updateManualOrder(
11
- {
12
- sortKeys: params.sortKeys,
13
- },
14
- userId,
15
- );
10
+ return modules.assortments.media.updateManualOrder({
11
+ sortKeys: params.sortKeys,
12
+ });
16
13
  }
@@ -12,6 +12,5 @@ export default async function reorderAssortmentProducts(
12
12
  sortKeys: params.sortKeys,
13
13
  },
14
14
  { skipInvalidation: false },
15
- userId,
16
15
  );
17
16
  }
@@ -14,7 +14,7 @@ export default async function setBaseAssortment(
14
14
  if (!(await modules.assortments.assortmentExists({ assortmentId })))
15
15
  throw new AssortmentNotFoundError({ assortmentId });
16
16
 
17
- await modules.assortments.setBase(assortmentId, userId);
17
+ await modules.assortments.setBase(assortmentId);
18
18
 
19
19
  return modules.assortments.findAssortment({ assortmentId });
20
20
  }
@@ -17,7 +17,7 @@ export default async function updateAssortment(
17
17
  if (!(await modules.assortments.assortmentExists({ assortmentId })))
18
18
  throw new AssortmentNotFoundError({ assortmentId });
19
19
 
20
- await modules.assortments.update(assortmentId, assortment, userId);
20
+ await modules.assortments.update(assortmentId, assortment);
21
21
 
22
22
  return modules.assortments.findAssortment({ assortmentId });
23
23
  }
@@ -20,5 +20,5 @@ export default async function updateAssortmentMediaTexts(
20
20
 
21
21
  if (!assortmentMedia) throw new AssortmentMediaNotFoundError({ assortmentMediaId });
22
22
 
23
- return modules.assortments.media.texts.updateMediaTexts(assortmentMediaId, texts, userId);
23
+ return modules.assortments.media.texts.updateMediaTexts(assortmentMediaId, texts);
24
24
  }
@@ -15,5 +15,5 @@ export default async function updateAssortmentTexts(
15
15
  if (!(await modules.assortments.assortmentExists({ assortmentId })))
16
16
  throw new AssortmentNotFoundError({ assortmentId });
17
17
 
18
- return modules.assortments.texts.updateTexts(assortmentId, texts, userId);
18
+ return modules.assortments.texts.updateTexts(assortmentId, texts);
19
19
  }
@@ -22,13 +22,10 @@ export default async function bookmark(
22
22
  if (bookmarked) {
23
23
  if (foundBookmark) return foundBookmark;
24
24
 
25
- const bookmarkId = await modules.bookmarks.create(
26
- {
27
- productId,
28
- userId,
29
- },
25
+ const bookmarkId = await modules.bookmarks.create({
26
+ productId,
30
27
  userId,
31
- );
28
+ });
32
29
 
33
30
  return modules.bookmarks.findById(bookmarkId);
34
31
  }
@@ -37,7 +34,7 @@ export default async function bookmark(
37
34
  throw new BookmarkNotFoundError({ productId, userId });
38
35
  }
39
36
 
40
- await modules.bookmarks.delete(foundBookmark._id, userId);
37
+ await modules.bookmarks.delete(foundBookmark._id);
41
38
 
42
39
  return foundBookmark;
43
40
  }
@@ -22,13 +22,10 @@ export default async function createBookmark(
22
22
 
23
23
  if (bookmark) throw new BookmarkAlreadyExistsError({ bookmarkId: bookmark._id });
24
24
 
25
- const bookmarkId = await modules.bookmarks.create(
26
- {
27
- userId,
28
- productId,
29
- },
30
- currenctUserId,
31
- );
25
+ const bookmarkId = await modules.bookmarks.create({
26
+ userId,
27
+ productId,
28
+ });
32
29
 
33
30
  return modules.bookmarks.findById(bookmarkId);
34
31
  }
@@ -9,13 +9,9 @@ export default async function createCountry(
9
9
  ) {
10
10
  log('mutation createCountry', { userId });
11
11
 
12
- const countryId = await modules.countries.create(
13
- {
14
- ...country,
15
- authorId: userId,
16
- },
17
- userId,
18
- );
12
+ const countryId = await modules.countries.create({
13
+ ...country,
14
+ });
19
15
 
20
16
  return modules.countries.findCountry({ countryId });
21
17
  }
@@ -14,7 +14,7 @@ export default async function removeCountry(
14
14
  if (!(await modules.countries.countryExists({ countryId })))
15
15
  throw new CountryNotFoundError({ countryId });
16
16
 
17
- await modules.countries.delete(countryId, userId);
17
+ await modules.countries.delete(countryId);
18
18
 
19
19
  return modules.countries.findCountry({ countryId });
20
20
  }
@@ -15,7 +15,7 @@ export default async function updateCountry(
15
15
  if (!(await modules.countries.countryExists({ countryId })))
16
16
  throw new CountryNotFoundError({ countryId });
17
17
 
18
- await modules.countries.update(countryId, country, userId);
18
+ await modules.countries.update(countryId, country);
19
19
 
20
20
  return modules.countries.findCountry({ countryId });
21
21
  }
@@ -8,13 +8,9 @@ export default async function createCurrency(
8
8
  { userId, modules }: Context,
9
9
  ) {
10
10
  log('mutation createCurrency', { userId });
11
- const currencyId = await modules.currencies.create(
12
- {
13
- ...currency,
14
- authorId: userId,
15
- },
16
- userId,
17
- );
11
+ const currencyId = await modules.currencies.create({
12
+ ...currency,
13
+ });
18
14
 
19
15
  return modules.currencies.findCurrency({ currencyId });
20
16
  }
@@ -14,7 +14,7 @@ export default async function removeCurrency(
14
14
  if (!(await modules.currencies.currencyExists({ currencyId })))
15
15
  throw new CurrencyNotFoundError({ currencyId });
16
16
 
17
- await modules.currencies.delete(currencyId, userId);
17
+ await modules.currencies.delete(currencyId);
18
18
 
19
19
  return modules.currencies.findCurrency({ currencyId });
20
20
  }
@@ -14,7 +14,7 @@ export default async function updateCurrency(
14
14
  if (!(await modules.currencies.currencyExists({ currencyId })))
15
15
  throw new CurrencyNotFoundError({ currencyId });
16
16
 
17
- await modules.currencies.update(currencyId, currency, userId);
17
+ await modules.currencies.update(currencyId, currency);
18
18
 
19
19
  return modules.currencies.findCurrency({ currencyId });
20
20
  }
@@ -10,13 +10,9 @@ export default async function createDeliveryProvider(
10
10
  ) {
11
11
  log('mutation createDeliveryProvider', { userId });
12
12
 
13
- const provider = await modules.delivery.create(
14
- {
15
- ...deliveryProvider,
16
- authorId: userId,
17
- },
18
- userId,
19
- );
13
+ const provider = await modules.delivery.create({
14
+ ...deliveryProvider,
15
+ });
20
16
 
21
17
  if (!provider) throw new ProviderConfigurationInvalid(deliveryProvider);
22
18
 
@@ -14,5 +14,5 @@ export default async function removeDeliveryProvider(
14
14
  const provider = await modules.delivery.findProvider({ deliveryProviderId });
15
15
  if (!provider) throw new DeliverProviderNotFoundError({ deliveryProviderId });
16
16
 
17
- return modules.delivery.delete(deliveryProviderId, userId);
17
+ return modules.delivery.delete(deliveryProviderId);
18
18
  }
@@ -17,5 +17,5 @@ export default async function updateDeliveryProvider(
17
17
  if (!(await modules.delivery.providerExists({ deliveryProviderId })))
18
18
  throw new DeliverProviderNotFoundError({ deliveryProviderId });
19
19
 
20
- return modules.delivery.update(deliveryProviderId, deliveryProvider, userId);
20
+ return modules.delivery.update(deliveryProviderId, deliveryProvider);
21
21
  }
@@ -28,5 +28,5 @@ export default async function activateEnrollment(
28
28
  throw new EnrollmentWrongStatusError({ status: enrollment.status });
29
29
  }
30
30
 
31
- return modules.enrollments.activateEnrollment(enrollment, {}, context);
31
+ return modules.enrollments.activateEnrollment(enrollment, context);
32
32
  }
@@ -25,5 +25,5 @@ export default async function terminateEnrollment(
25
25
  throw new EnrollmentWrongStatusError({ status: enrollment.status });
26
26
  }
27
27
 
28
- return modules.enrollments.terminateEnrollment(enrollment, {}, context);
28
+ return modules.enrollments.terminateEnrollment(enrollment, context);
29
29
  }
@@ -38,23 +38,23 @@ export default async function updateEnrollment(
38
38
  }
39
39
 
40
40
  if (meta) {
41
- enrollment = await modules.enrollments.updateContext(enrollmentId, meta, userId);
41
+ enrollment = await modules.enrollments.updateContext(enrollmentId, meta);
42
42
  }
43
43
 
44
44
  if (billingAddress) {
45
- enrollment = await modules.enrollments.updateBillingAddress(enrollmentId, billingAddress, userId);
45
+ enrollment = await modules.enrollments.updateBillingAddress(enrollmentId, billingAddress);
46
46
  }
47
47
 
48
48
  if (contact) {
49
- enrollment = await modules.enrollments.updateContact(enrollmentId, contact, userId);
49
+ enrollment = await modules.enrollments.updateContact(enrollmentId, contact);
50
50
  }
51
51
 
52
52
  if (payment) {
53
- enrollment = await modules.enrollments.updatePayment(enrollmentId, payment, userId);
53
+ enrollment = await modules.enrollments.updatePayment(enrollmentId, payment);
54
54
  }
55
55
 
56
56
  if (delivery) {
57
- enrollment = await modules.enrollments.updateDelivery(enrollmentId, delivery, userId);
57
+ enrollment = await modules.enrollments.updateDelivery(enrollmentId, delivery);
58
58
  }
59
59
 
60
60
  if (plan) {
@@ -14,10 +14,8 @@ export default async function createFilter(
14
14
  {
15
15
  ...filter,
16
16
  locale: localeContext.language,
17
- authorId: userId,
18
17
  },
19
18
  context,
20
19
  { skipInvalidation: false },
21
- userId,
22
20
  );
23
21
  }
@@ -16,6 +16,10 @@ export default async function createFilterOption(
16
16
 
17
17
  if (!(await modules.filters.filterExists({ filterId }))) throw new FilterNotFoundError({ filterId });
18
18
 
19
- const filter = await modules.filters.createFilterOption(filterId, option, context);
19
+ const filter = await modules.filters.createFilterOption(
20
+ filterId,
21
+ { ...option, locale: context.localeContext.language },
22
+ context,
23
+ );
20
24
  return filter;
21
25
  }
@@ -5,9 +5,9 @@ import { FilterNotFoundError, InvalidIdError } from '../../../errors';
5
5
  export default async function removeFilter(
6
6
  root: Root,
7
7
  { filterId }: { filterId: string },
8
- requestContext: Context,
8
+ context: Context,
9
9
  ) {
10
- const { modules, userId } = requestContext;
10
+ const { modules, userId } = context;
11
11
  log(`mutation removeFilter ${filterId}`, { userId });
12
12
 
13
13
  if (!filterId) throw new InvalidIdError({ filterId });
@@ -16,7 +16,7 @@ export default async function removeFilter(
16
16
  if (!filter) throw new FilterNotFoundError({ filterId });
17
17
 
18
18
  await modules.assortments.filters.deleteMany({ filterId });
19
- await modules.filters.delete(filterId, userId);
19
+ await modules.filters.delete(filterId);
20
20
 
21
21
  return filter;
22
22
  }
@@ -16,7 +16,7 @@ export default async function updateFilter(
16
16
 
17
17
  if (!(await modules.filters.filterExists({ filterId }))) throw new FilterNotFoundError({ filterId });
18
18
 
19
- await modules.filters.update(filterId, filter, context, { skipInvalidation: false }, userId);
19
+ await modules.filters.update(filterId, filter, context, { skipInvalidation: false });
20
20
 
21
21
  return modules.filters.findFilter({ filterId });
22
22
  }
@@ -22,5 +22,5 @@ export default async function updateFilterTexts(
22
22
  const filter = await modules.filters.findFilter({ filterId });
23
23
  if (!filter) throw new FilterNotFoundError({ filterId });
24
24
 
25
- return modules.filters.texts.updateTexts({ filterId, filterOptionValue }, texts, userId);
25
+ return modules.filters.texts.updateTexts({ filterId, filterOptionValue }, texts);
26
26
  }
@@ -28,6 +28,7 @@ import removeWeb3Address from './accounts/removeWeb3Address';
28
28
  import verifyWeb3Address from './accounts/verifyWeb3Address';
29
29
  import updateUserAvatar from './users/updateUserAvatar';
30
30
  import updateUserProfile from './users/updateUserProfile';
31
+ import removeUser from './users/removeUser';
31
32
  import setUserTags from './users/setUserTags';
32
33
  import createLanguage from './languages/createLanguage';
33
34
  import updateLanguage from './languages/updateLanguage';
@@ -186,6 +187,7 @@ export default {
186
187
  updateUserAvatar: acl(actions.updateUser)(updateUserAvatar),
187
188
  prepareUserAvatarUpload: acl(actions.updateUser)(prepareUserAvatarUpload),
188
189
  updateUserProfile: acl(actions.updateUser)(updateUserProfile),
190
+ removeUser: acl(actions.updateUser)(removeUser),
189
191
  setUserTags: acl(actions.manageUsers)(setUserTags),
190
192
  setPassword: acl(actions.manageUsers)(setPassword),
191
193
  setUsername: acl(actions.updateUsername)(setUsername),
@@ -9,13 +9,9 @@ export default async function createLanguage(
9
9
  ) {
10
10
  log('mutation createLanguage', { userId });
11
11
 
12
- const languageId = await modules.languages.create(
13
- {
14
- ...language,
15
- authorId: userId,
16
- },
17
- userId,
18
- );
12
+ const languageId = await modules.languages.create({
13
+ ...language,
14
+ });
19
15
 
20
16
  return modules.languages.findLanguage({ languageId });
21
17
  }
@@ -14,7 +14,7 @@ export default async function removeLanguage(
14
14
  if (!(await modules.languages.languageExists({ languageId })))
15
15
  throw new LanguageNotFoundError({ languageId });
16
16
 
17
- await modules.languages.delete(languageId, userId);
17
+ await modules.languages.delete(languageId);
18
18
 
19
19
  return modules.languages.findLanguage({ languageId });
20
20
  }
@@ -15,7 +15,7 @@ export default async function updateLanguage(
15
15
  if (!(await modules.languages.languageExists({ languageId })))
16
16
  throw new LanguageNotFoundError({ languageId });
17
17
 
18
- await modules.languages.update(languageId, language, userId);
18
+ await modules.languages.update(languageId, language);
19
19
 
20
20
  return modules.languages.findLanguage({ languageId });
21
21
  }
@@ -13,5 +13,8 @@ export default async function createCart(
13
13
  const order = await modules.orders.findOrder({ orderNumber });
14
14
  if (order) throw new OrderNumberAlreadyExistsError({ orderNumber });
15
15
 
16
- return services.orders.createUserCart({ user, orderNumber }, context);
16
+ return services.orders.createUserCart(
17
+ { user, orderNumber, countryCode: context.countryContext },
18
+ context,
19
+ );
17
20
  }
@@ -32,6 +32,6 @@ export default async function payOrder(root: Root, { orderId }: { orderId: strin
32
32
  });
33
33
  }
34
34
 
35
- await modules.orders.payments.markAsPaid(payment, null, userId);
35
+ await modules.orders.payments.markAsPaid(payment, null);
36
36
  return modules.orders.processOrder(order, {}, context);
37
37
  }
@@ -18,7 +18,7 @@ export default async function removeOrder(
18
18
  throw new OrderWrongStatusError({ status: order.status });
19
19
  }
20
20
 
21
- await modules.orders.delete(orderId, userId);
21
+ await modules.orders.delete(orderId);
22
22
 
23
23
  return order;
24
24
  }
@@ -10,13 +10,9 @@ export default async (
10
10
  ) => {
11
11
  log('mutation createPaymentProvider', { userId });
12
12
 
13
- const provider = await modules.payment.paymentProviders.create(
14
- {
15
- ...paymentProvider,
16
- authorId: userId,
17
- },
18
- userId,
19
- );
13
+ const provider = await modules.payment.paymentProviders.create({
14
+ ...paymentProvider,
15
+ });
20
16
 
21
17
  if (!provider) throw new ProviderConfigurationInvalid(paymentProvider);
22
18