@infrab4a/connect 4.0.0-beta.8 → 4.0.0

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 (302) hide show
  1. package/domain/catalog/helpers/index.d.ts +1 -0
  2. package/domain/catalog/helpers/round-product-price.helper.d.ts +4 -0
  3. package/domain/catalog/index.d.ts +1 -0
  4. package/domain/catalog/models/category-base.d.ts +30 -0
  5. package/domain/catalog/models/category-collection-children.d.ts +13 -0
  6. package/domain/catalog/models/category-filter.d.ts +13 -0
  7. package/domain/catalog/models/category-for-product.d.ts +5 -0
  8. package/domain/catalog/models/category.d.ts +5 -22
  9. package/domain/catalog/models/filter-option.d.ts +9 -0
  10. package/domain/catalog/models/filter.d.ts +12 -0
  11. package/domain/catalog/models/index.d.ts +5 -0
  12. package/domain/catalog/models/kit-product.d.ts +4 -4
  13. package/domain/catalog/models/product-base.d.ts +40 -0
  14. package/domain/catalog/models/product-for-category.d.ts +7 -0
  15. package/domain/catalog/models/product-for-kit.d.ts +7 -0
  16. package/domain/catalog/models/product.d.ts +5 -35
  17. package/domain/catalog/models/types/category-product.d.ts +4 -0
  18. package/domain/catalog/models/types/index.d.ts +2 -1
  19. package/domain/catalog/models/types/product-evaluation.type.d.ts +6 -0
  20. package/domain/catalog/models/types/shop-description.type.d.ts +1 -0
  21. package/domain/catalog/models/variant.d.ts +1 -2
  22. package/domain/catalog/models/wishlist.d.ts +6 -0
  23. package/domain/catalog/repositories/category-collection-children.repository.d.ts +4 -0
  24. package/domain/catalog/repositories/category-filter.repository.d.ts +6 -0
  25. package/domain/catalog/repositories/category.repository.d.ts +6 -3
  26. package/domain/catalog/repositories/filter-option.repository.d.ts +4 -0
  27. package/domain/catalog/repositories/filter.repository.d.ts +4 -0
  28. package/domain/catalog/repositories/index.d.ts +5 -0
  29. package/domain/catalog/repositories/product.repository.d.ts +4 -1
  30. package/domain/catalog/repositories/wishlist.repository.d.ts +6 -0
  31. package/domain/generic/model/base.model.d.ts +9 -5
  32. package/domain/generic/model/types/base-model-builder.type.d.ts +4 -2
  33. package/domain/generic/model/types/identifier-model.type.d.ts +6 -5
  34. package/domain/generic/model/types/model-base-structure.type.d.ts +9 -3
  35. package/domain/generic/model/types/non-function-property-name.type.d.ts +12 -3
  36. package/domain/generic/repository/find.repository.d.ts +7 -1
  37. package/domain/generic/repository/get.repository.d.ts +2 -2
  38. package/domain/generic/repository/types/repository-find-filters.type.d.ts +3 -3
  39. package/domain/generic/repository/types/repository-find-result.type.d.ts +11 -1
  40. package/domain/generic/repository/types/repository-order-by-list.type.d.ts +2 -2
  41. package/domain/generic/repository/types/repository-update-params.type.d.ts +2 -2
  42. package/domain/location/models/address.d.ts +5 -3
  43. package/domain/shop-settings/models/index.d.ts +1 -0
  44. package/domain/shop-settings/models/shop-settings.d.ts +9 -0
  45. package/domain/shop-settings/models/types/index.d.ts +6 -1
  46. package/domain/shop-settings/models/types/shop-banner.type.d.ts +12 -0
  47. package/domain/shop-settings/models/types/shop-brands.type.d.ts +10 -0
  48. package/domain/shop-settings/models/types/shop-carousel.type.d.ts +5 -0
  49. package/domain/shop-settings/models/types/shop-collection.type.d.ts +9 -0
  50. package/domain/shop-settings/models/types/shop-section.type.d.ts +9 -0
  51. package/domain/shop-settings/repositories/index.d.ts +1 -0
  52. package/domain/shop-settings/repositories/shop-settings.repository.d.ts +4 -0
  53. package/domain/shopping/models/buy-2-win.d.ts +3 -1
  54. package/domain/shopping/models/campaign-dashboard.d.ts +15 -0
  55. package/domain/shopping/models/campaign-hashtag.d.ts +18 -0
  56. package/domain/shopping/models/checkout.d.ts +5 -6
  57. package/domain/shopping/models/coupons/coupon.d.ts +34 -6
  58. package/domain/shopping/models/index.d.ts +5 -4
  59. package/domain/shopping/models/order.d.ts +1 -0
  60. package/domain/shopping/models/shipping-method.d.ts +1 -0
  61. package/domain/shopping/models/subscription/checkout.d.ts +3 -4
  62. package/domain/shopping/repositories/campaign-dashboard.repository.d.ts +4 -0
  63. package/domain/shopping/repositories/campaign-hashtag.repository.d.ts +4 -0
  64. package/domain/shopping/repositories/index.d.ts +4 -2
  65. package/domain/users/models/lead.d.ts +1 -0
  66. package/domain/users/models/subscription/subscription.d.ts +3 -3
  67. package/domain/users/models/user-address.d.ts +1 -2
  68. package/domain/users/models/user.d.ts +2 -3
  69. package/esm2020/domain/catalog/helpers/index.mjs +2 -0
  70. package/esm2020/domain/catalog/helpers/round-product-price.helper.mjs +15 -0
  71. package/esm2020/domain/catalog/index.mjs +2 -1
  72. package/esm2020/domain/catalog/models/category-base.mjs +18 -0
  73. package/esm2020/domain/catalog/models/category-collection-children.mjs +13 -0
  74. package/esm2020/domain/catalog/models/category-filter.mjs +19 -0
  75. package/esm2020/domain/catalog/models/category-for-product.mjs +7 -0
  76. package/esm2020/domain/catalog/models/category.mjs +10 -6
  77. package/esm2020/domain/catalog/models/filter-option.mjs +7 -0
  78. package/esm2020/domain/catalog/models/filter.mjs +7 -0
  79. package/esm2020/domain/catalog/models/index.mjs +6 -1
  80. package/esm2020/domain/catalog/models/kit-product.mjs +7 -7
  81. package/esm2020/domain/catalog/models/product-base.mjs +25 -0
  82. package/esm2020/domain/catalog/models/product-for-category.mjs +14 -0
  83. package/esm2020/domain/catalog/models/product-for-kit.mjs +14 -0
  84. package/esm2020/domain/catalog/models/product.mjs +8 -6
  85. package/esm2020/domain/catalog/models/types/category-product.mjs +2 -0
  86. package/esm2020/domain/catalog/models/types/index.mjs +3 -2
  87. package/esm2020/domain/catalog/models/types/product-evaluation.type.mjs +2 -0
  88. package/esm2020/domain/catalog/models/types/shop-description.type.mjs +1 -1
  89. package/esm2020/domain/catalog/models/variant.mjs +1 -4
  90. package/esm2020/domain/catalog/models/wishlist.mjs +7 -0
  91. package/esm2020/domain/catalog/repositories/category-collection-children.repository.mjs +2 -0
  92. package/esm2020/domain/catalog/repositories/category-filter.repository.mjs +2 -0
  93. package/esm2020/domain/catalog/repositories/category.repository.mjs +1 -1
  94. package/esm2020/domain/catalog/repositories/filter-option.repository.mjs +2 -0
  95. package/esm2020/domain/catalog/repositories/filter.repository.mjs +2 -0
  96. package/esm2020/domain/catalog/repositories/index.mjs +6 -1
  97. package/esm2020/domain/catalog/repositories/product.repository.mjs +1 -1
  98. package/esm2020/domain/catalog/repositories/wishlist.repository.mjs +2 -0
  99. package/esm2020/domain/generic/model/base.model.mjs +3 -2
  100. package/esm2020/domain/generic/model/types/base-model-builder.type.mjs +1 -1
  101. package/esm2020/domain/generic/model/types/identifier-model.type.mjs +1 -1
  102. package/esm2020/domain/generic/model/types/model-base-structure.type.mjs +1 -1
  103. package/esm2020/domain/generic/model/types/non-function-property-name.type.mjs +1 -1
  104. package/esm2020/domain/generic/repository/find.repository.mjs +1 -1
  105. package/esm2020/domain/generic/repository/get.repository.mjs +1 -1
  106. package/esm2020/domain/generic/repository/types/repository-find-filters.type.mjs +1 -1
  107. package/esm2020/domain/generic/repository/types/repository-find-result.type.mjs +1 -1
  108. package/esm2020/domain/generic/repository/types/repository-order-by-list.type.mjs +1 -1
  109. package/esm2020/domain/generic/repository/types/repository-update-params.type.mjs +1 -1
  110. package/esm2020/domain/location/models/address.mjs +2 -2
  111. package/esm2020/domain/shop-settings/models/index.mjs +2 -1
  112. package/esm2020/domain/shop-settings/models/shop-settings.mjs +7 -0
  113. package/esm2020/domain/shop-settings/models/types/index.mjs +7 -2
  114. package/esm2020/domain/shop-settings/models/types/shop-banner.type.mjs +2 -0
  115. package/esm2020/domain/shop-settings/models/types/shop-brands.type.mjs +2 -0
  116. package/esm2020/domain/shop-settings/models/types/shop-carousel.type.mjs +2 -0
  117. package/esm2020/domain/shop-settings/models/types/shop-collection.type.mjs +2 -0
  118. package/esm2020/domain/shop-settings/models/types/shop-section.type.mjs +2 -0
  119. package/esm2020/domain/shop-settings/repositories/index.mjs +2 -1
  120. package/esm2020/domain/shop-settings/repositories/shop-settings.repository.mjs +2 -0
  121. package/esm2020/domain/shopping/models/buy-2-win.mjs +2 -2
  122. package/esm2020/domain/shopping/models/campaign-dashboard.mjs +7 -0
  123. package/esm2020/domain/shopping/models/campaign-hashtag.mjs +7 -0
  124. package/esm2020/domain/shopping/models/checkout.mjs +6 -7
  125. package/esm2020/domain/shopping/models/coupons/coupon.mjs +16 -16
  126. package/esm2020/domain/shopping/models/index.mjs +6 -5
  127. package/esm2020/domain/shopping/models/order.mjs +1 -1
  128. package/esm2020/domain/shopping/models/shipping-method.mjs +1 -1
  129. package/esm2020/domain/shopping/models/subscription/checkout.mjs +6 -6
  130. package/esm2020/domain/shopping/repositories/campaign-dashboard.repository.mjs +2 -0
  131. package/esm2020/domain/shopping/repositories/campaign-hashtag.repository.mjs +2 -0
  132. package/esm2020/domain/shopping/repositories/index.mjs +5 -3
  133. package/esm2020/domain/users/models/lead.mjs +1 -1
  134. package/esm2020/domain/users/models/subscription/subscription.mjs +6 -6
  135. package/esm2020/domain/users/models/user-address.mjs +1 -1
  136. package/esm2020/domain/users/models/user.mjs +2 -2
  137. package/esm2020/domain/users/use-cases/authentication.mjs +2 -2
  138. package/esm2020/infra/elasticsearch/adapters/axios.adapter.mjs +28 -11
  139. package/esm2020/infra/elasticsearch/adapters/elastic-search.adapter.mjs +1 -1
  140. package/esm2020/infra/elasticsearch/indexes/products-index.mjs +63 -51
  141. package/esm2020/infra/elasticsearch/types/elastic-search-result.mjs +1 -1
  142. package/esm2020/infra/firebase/firestore/mixins/with-create-firestore.mixin.mjs +8 -4
  143. package/esm2020/infra/firebase/firestore/mixins/with-crud-firestore.mixin.mjs +1 -1
  144. package/esm2020/infra/firebase/firestore/mixins/with-delete-firestore.mixin.mjs +6 -2
  145. package/esm2020/infra/firebase/firestore/mixins/with-find-firestore.mixin.mjs +11 -8
  146. package/esm2020/infra/firebase/firestore/mixins/with-firestore.mixin.mjs +27 -4
  147. package/esm2020/infra/firebase/firestore/mixins/with-get-firestore.mixin.mjs +6 -3
  148. package/esm2020/infra/firebase/firestore/mixins/with-helpers.mixin.mjs +1 -1
  149. package/esm2020/infra/firebase/firestore/mixins/with-sub-collection.mixin.mjs +5 -3
  150. package/esm2020/infra/firebase/firestore/mixins/with-update-firestore.mixin.mjs +7 -4
  151. package/esm2020/infra/firebase/firestore/repositories/catalog/category-firestore.repository.mjs +21 -8
  152. package/esm2020/infra/firebase/firestore/repositories/catalog/product-firestore.repository.mjs +15 -7
  153. package/esm2020/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.mjs +10 -8
  154. package/esm2020/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.mjs +8 -6
  155. package/esm2020/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.mjs +36 -30
  156. package/esm2020/infra/firebase/firestore/repositories/shop-settings/index.mjs +2 -1
  157. package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.mjs +8 -6
  158. package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.mjs +14 -0
  159. package/esm2020/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.mjs +8 -6
  160. package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.mjs +14 -0
  161. package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.mjs +14 -0
  162. package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.mjs +8 -6
  163. package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.mjs +8 -6
  164. package/esm2020/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.mjs +8 -6
  165. package/esm2020/infra/firebase/firestore/repositories/shopping/index.mjs +6 -4
  166. package/esm2020/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.mjs +6 -4
  167. package/esm2020/infra/firebase/firestore/repositories/shopping/order-firestore.repository.mjs +11 -9
  168. package/esm2020/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.mjs +8 -6
  169. package/esm2020/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.mjs +8 -6
  170. package/esm2020/infra/firebase/firestore/repositories/users/lead-firestore.repository.mjs +8 -6
  171. package/esm2020/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.mjs +10 -8
  172. package/esm2020/infra/firebase/firestore/repositories/users/subscription-firestore.repository.mjs +8 -6
  173. package/esm2020/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.mjs +10 -8
  174. package/esm2020/infra/firebase/firestore/repositories/users/user-address-firestore.repository.mjs +10 -8
  175. package/esm2020/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.mjs +10 -8
  176. package/esm2020/infra/firebase/firestore/repositories/users/user-firestore.repository.mjs +8 -6
  177. package/esm2020/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.mjs +10 -8
  178. package/esm2020/infra/firebase/firestore/types/firestore-interceptors.type.mjs +2 -0
  179. package/esm2020/infra/firebase/firestore/types/firestore-sub.repository.type.mjs +1 -1
  180. package/esm2020/infra/firebase/firestore/types/firestore.helpers.type.mjs +1 -1
  181. package/esm2020/infra/firebase/firestore/types/firestore.repository.type.mjs +1 -1
  182. package/esm2020/infra/firebase/firestore/types/index.mjs +4 -3
  183. package/esm2020/infra/hasura-graphql/mixins/helpers/attribute-option.helper.mjs +3 -3
  184. package/esm2020/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.mjs +6 -5
  185. package/esm2020/infra/hasura-graphql/mixins/helpers/filter-option.helper.mjs +1 -1
  186. package/esm2020/infra/hasura-graphql/mixins/helpers/graphql-field.helper.mjs +36 -25
  187. package/esm2020/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.mjs +6 -4
  188. package/esm2020/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.mjs +1 -1
  189. package/esm2020/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.mjs +5 -3
  190. package/esm2020/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.mjs +126 -20
  191. package/esm2020/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.mjs +5 -3
  192. package/esm2020/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.mjs +40 -22
  193. package/esm2020/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.mjs +7 -5
  194. package/esm2020/infra/hasura-graphql/models/product-hasura-graphql.mjs +1 -1
  195. package/esm2020/infra/hasura-graphql/models/variant-hasura-graphql.mjs +1 -1
  196. package/esm2020/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.mjs +39 -0
  197. package/esm2020/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.mjs +107 -0
  198. package/esm2020/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.mjs +131 -14
  199. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.mjs +105 -0
  200. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.mjs +22 -0
  201. package/esm2020/infra/hasura-graphql/repositories/catalog/index.mjs +6 -1
  202. package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +70 -20
  203. package/esm2020/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.mjs +9 -7
  204. package/esm2020/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.mjs +236 -0
  205. package/esm2020/infra/hasura-graphql/types/graphql.repository.type.mjs +1 -1
  206. package/esm2020/infra/hasura-graphql/types/hasura-graphql-fields.type.mjs +1 -1
  207. package/esm2020/utils/decorators/debug.class.decorator.mjs +7 -0
  208. package/esm2020/utils/decorators/index.mjs +3 -0
  209. package/esm2020/utils/decorators/trace.method.decorator.mjs +81 -0
  210. package/esm2020/utils/helpers/class-name.helper.mjs +15 -0
  211. package/esm2020/utils/helpers/debug-decorator.helper.mjs +18 -0
  212. package/esm2020/utils/helpers/debug.helper.mjs +150 -0
  213. package/esm2020/utils/helpers/index.mjs +5 -0
  214. package/esm2020/utils/helpers/reflect.helper.mjs +165 -0
  215. package/esm2020/utils/index.mjs +6 -3
  216. package/esm2020/utils/log.utils.mjs +9 -0
  217. package/fesm2015/infrab4a-connect.mjs +1999 -417
  218. package/fesm2015/infrab4a-connect.mjs.map +1 -1
  219. package/fesm2020/infrab4a-connect.mjs +1965 -419
  220. package/fesm2020/infrab4a-connect.mjs.map +1 -1
  221. package/infra/elasticsearch/adapters/axios.adapter.d.ts +7 -5
  222. package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +3 -2
  223. package/infra/elasticsearch/indexes/products-index.d.ts +8 -10
  224. package/infra/elasticsearch/types/elastic-search-result.d.ts +2 -0
  225. package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +2 -2
  226. package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +2 -1
  227. package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +2 -2
  228. package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +2 -2
  229. package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +13 -4
  230. package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +2 -2
  231. package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +2 -2
  232. package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +8 -4
  233. package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +3 -3
  234. package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +8 -5
  235. package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +6 -5
  236. package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +3 -4
  237. package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +3 -4
  238. package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +4 -4
  239. package/infra/firebase/firestore/repositories/shop-settings/index.d.ts +1 -0
  240. package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +3 -4
  241. package/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +7 -0
  242. package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +3 -4
  243. package/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +8 -0
  244. package/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +8 -0
  245. package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +3 -4
  246. package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +3 -4
  247. package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +4 -4
  248. package/infra/firebase/firestore/repositories/shopping/index.d.ts +5 -3
  249. package/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +3 -4
  250. package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +4 -4
  251. package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +3 -4
  252. package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +3 -4
  253. package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +3 -4
  254. package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +3 -4
  255. package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +3 -4
  256. package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +3 -4
  257. package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +3 -4
  258. package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +3 -4
  259. package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +4 -4
  260. package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +3 -4
  261. package/infra/firebase/firestore/types/firestore-interceptors.type.d.ts +14 -0
  262. package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +3 -3
  263. package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +5 -5
  264. package/infra/firebase/firestore/types/firestore.repository.type.d.ts +3 -1
  265. package/infra/firebase/firestore/types/index.d.ts +3 -2
  266. package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +9 -3
  267. package/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.d.ts +5 -5
  268. package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +4 -2
  269. package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +9 -5
  270. package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +2 -1
  271. package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +3 -3
  272. package/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +1 -1
  273. package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +24 -15
  274. package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +7 -6
  275. package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +15 -3
  276. package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +2 -2
  277. package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +4 -0
  278. package/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +1 -0
  279. package/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.d.ts +10 -0
  280. package/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +12 -0
  281. package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +12 -5
  282. package/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +18 -0
  283. package/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +10 -0
  284. package/infra/hasura-graphql/repositories/catalog/index.d.ts +5 -0
  285. package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +6 -4
  286. package/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +4 -4
  287. package/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +27 -0
  288. package/infra/hasura-graphql/types/graphql.repository.type.d.ts +9 -6
  289. package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +7 -3
  290. package/package.json +2 -1
  291. package/utils/decorators/debug.class.decorator.d.ts +2 -0
  292. package/utils/decorators/index.d.ts +2 -0
  293. package/utils/decorators/trace.method.decorator.d.ts +14 -0
  294. package/utils/helpers/class-name.helper.d.ts +3 -0
  295. package/utils/helpers/debug-decorator.helper.d.ts +9 -0
  296. package/utils/helpers/debug.helper.d.ts +60 -0
  297. package/utils/helpers/index.d.ts +4 -0
  298. package/utils/helpers/reflect.helper.d.ts +50 -0
  299. package/utils/index.d.ts +5 -2
  300. package/utils/log.utils.d.ts +7 -0
  301. package/domain/catalog/models/types/category-filter.type.d.ts +0 -4
  302. package/esm2020/domain/catalog/models/types/category-filter.type.mjs +0 -2
@@ -3,8 +3,10 @@ import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transforme
3
3
  import { __decorate, __metadata, __awaiter, __rest } from 'tslib';
4
4
  import { parseISO } from 'date-fns';
5
5
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
6
- import { get as get$1, isString, isNil, isNumber, isDate, set, isObject, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
- export { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set } from 'lodash';
6
+ import { isNil, isArray, first, last, flatten, compact, get as get$1, isString, each, unset, isObject, isNumber, isDate, set, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
+ export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
8
+ import { Subject } from 'rxjs';
9
+ import { debug } from 'debug';
8
10
  import { CustomError } from 'ts-custom-error';
9
11
  import axios from 'axios';
10
12
  import { collection, getDoc, doc, where, orderBy, getDocs, query, startAfter, startAt, limit, addDoc, setDoc, deleteField, arrayUnion, arrayRemove, deleteDoc, Timestamp } from 'firebase/firestore';
@@ -14,7 +16,8 @@ import { mutation, query as query$1 } from 'gql-query-builder';
14
16
  class BaseModel {
15
17
  get identifier() {
16
18
  const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
17
- return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: this[field] })), {});
19
+ const data = this;
20
+ return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: data[field] })), {});
18
21
  }
19
22
  get identifiersFields() {
20
23
  return this.constructor.identifiersFields;
@@ -460,11 +463,437 @@ __decorate([
460
463
  __metadata("design:type", Payment)
461
464
  ], SubscriptionPayment.prototype, "payment", void 0);
462
465
 
463
- class Address extends BaseModel {
464
- static get identifiersFields() {
465
- return ['id'];
466
+ var DebugNamespaces;
467
+ (function (DebugNamespaces) {
468
+ DebugNamespaces["ROOT"] = "connect";
469
+ DebugNamespaces["TRACE"] = "trace";
470
+ DebugNamespaces["ERROR"] = "error";
471
+ })(DebugNamespaces || (DebugNamespaces = {}));
472
+ const Logger = debug(DebugNamespaces.ROOT);
473
+
474
+ class ReflectHelper {
475
+ static get items() {
476
+ return this._items;
477
+ }
478
+ static get keys() {
479
+ return Object.keys(ReflectHelper.items);
480
+ }
481
+ static has(key, target, property) {
482
+ return (!isNil(key) &&
483
+ !isNil(ReflectHelper.items[key]) &&
484
+ (isNil(target) ||
485
+ (!isNil(ReflectHelper.items[key][target]) &&
486
+ (isNil(property) || !isNil(ReflectHelper.items[key][target][String(property)])))));
487
+ }
488
+ static get({ key, target, property, own = true }) {
489
+ try {
490
+ if (own) {
491
+ return Reflect.getOwnMetadata(key, target, property) || null;
492
+ }
493
+ else {
494
+ return Reflect.getMetadata(key, target, property) || null;
495
+ }
496
+ }
497
+ catch (_err) {
498
+ return null;
499
+ }
500
+ }
501
+ static first({ key, target, property, own = true }) {
502
+ const values = ReflectHelper.get({ key, target, property, own });
503
+ return isArray(values) ? first(values) : values;
504
+ }
505
+ static last({ key, target, property, own = true }) {
506
+ const values = ReflectHelper.get({ key, target, property, own });
507
+ return isArray(values) ? last(values) : values;
508
+ }
509
+ static set({ key, target, property, value, propertyDescriptor }) {
510
+ Reflect.defineMetadata(key, value, target, property);
511
+ ReflectHelper.put({ key, target, property, value, propertyDescriptor });
512
+ }
513
+ static add({ key, target, property, value, propertyDescriptor }) {
514
+ let values = ReflectHelper.get({ key, target, property }) || new Array();
515
+ if (!Array.isArray(values))
516
+ values = [values];
517
+ values.push(value);
518
+ ReflectHelper.set({ key, target, property, value: values, propertyDescriptor });
519
+ }
520
+ static all({ key }) {
521
+ const items = ReflectHelper.items[key] || {};
522
+ return flatten(Object.keys(items).map((item) => flatten(this.allFrom(key, items[item]))));
523
+ }
524
+ static allFrom(key, target) {
525
+ return Object.keys(target)
526
+ .filter((property) => property !== 'object')
527
+ .map((property) => this.allValuesFrom(key, target, property));
528
+ }
529
+ static allValuesFrom(key, target, property) {
530
+ const values = target[property];
531
+ let value = values.value;
532
+ const propertyDescriptor = values.propertyDescriptor;
533
+ if (!isArray(value))
534
+ value = [value];
535
+ return flatten(value.map((val) => {
536
+ return {
537
+ key,
538
+ target: target.object,
539
+ property,
540
+ value: val,
541
+ propertyDescriptor,
542
+ };
543
+ }));
544
+ }
545
+ static delete({ key, target, property }) {
546
+ Reflect.deleteMetadata(key, target, property);
547
+ return ReflectHelper.remove(key, target, property);
548
+ }
549
+ static clear(key) {
550
+ if (!key) {
551
+ ReflectHelper.keys.forEach((storedKey) => {
552
+ ReflectHelper.clear(storedKey);
553
+ });
554
+ }
555
+ else {
556
+ if (ReflectHelper.keys.includes(key)) {
557
+ Object.values(ReflectHelper.items[key]).forEach((target) => {
558
+ if (ReflectHelper.has(key, target)) {
559
+ Object.values(ReflectHelper.items[key][target.toString()]).forEach((property) => {
560
+ ReflectHelper.delete({
561
+ key,
562
+ target: target.object,
563
+ property: String(property),
564
+ });
565
+ ReflectHelper.remove(key, target, String(property));
566
+ });
567
+ }
568
+ ReflectHelper.delete({ key, target: target.object });
569
+ ReflectHelper.remove(key, target);
570
+ });
571
+ }
572
+ }
573
+ }
574
+ static getType({ target, propertyKey }) {
575
+ return Reflect.getMetadata('design:type', target, propertyKey);
576
+ }
577
+ static getReturntype({ target, propertyKey }) {
578
+ return Reflect.getMetadata('design:returntype', target, propertyKey);
579
+ }
580
+ static getAllMethods(target) {
581
+ const props = [];
582
+ let obj = target;
583
+ do {
584
+ props.push(...Object.getOwnPropertyNames(obj));
585
+ } while ((obj = Object.getPrototypeOf(obj)));
586
+ return props.sort().filter((e, i, arr) => {
587
+ if ([
588
+ '__defineGetter__',
589
+ '__defineSetter__',
590
+ '__lookupGetter__',
591
+ '__lookupSetter__',
592
+ 'constructor',
593
+ 'hasOwnProperty',
594
+ 'isPrototypeOf',
595
+ 'propertyIsEnumerable',
596
+ 'toLocaleString',
597
+ 'toString',
598
+ 'valueOf',
599
+ ].includes(e))
600
+ return false;
601
+ if (e != arr[i + 1] && typeof target[e] === 'function')
602
+ return true;
603
+ });
604
+ }
605
+ static put({ key, target, property, value, propertyDescriptor }) {
606
+ const index = target.constructor.name;
607
+ ReflectHelper.items[key] = ReflectHelper.items[key] || {};
608
+ ReflectHelper.items[key][index] = ReflectHelper.items[key][index] || {};
609
+ ReflectHelper.items[key][index].object = target;
610
+ if (isNil(property)) {
611
+ ReflectHelper.items[key][index].value = {
612
+ value,
613
+ propertyDescriptor,
614
+ };
615
+ }
616
+ else {
617
+ ReflectHelper.items[key][index][String(property)] = ReflectHelper.items[key][index][String(property)] || {};
618
+ ReflectHelper.items[key][index][String(property)] = {
619
+ value,
620
+ propertyDescriptor,
621
+ };
622
+ }
623
+ }
624
+ static remove(key, target, property) {
625
+ if (ReflectHelper.has(key, target, property))
626
+ return delete ReflectHelper.items[key][target][String(property)];
627
+ else if (ReflectHelper.has(key, target))
628
+ return delete ReflectHelper.items[key][target];
629
+ else if (ReflectHelper.has(key))
630
+ return delete ReflectHelper.items[key];
631
+ else
632
+ return false;
633
+ }
634
+ }
635
+ ReflectHelper._items = {};
636
+
637
+ class DebugDecoratorHelper {
638
+ static set(target, options) {
639
+ ReflectHelper.add({
640
+ key: DebugDecoratorHelper.DebugNamingMetadataKey,
641
+ target,
642
+ value: options,
643
+ });
644
+ }
645
+ static get(target) {
646
+ return ReflectHelper.first({
647
+ key: DebugDecoratorHelper.DebugNamingMetadataKey,
648
+ target,
649
+ });
650
+ }
651
+ }
652
+ DebugDecoratorHelper.DebugNamingMetadataKey = 'model:naming:decorator';
653
+
654
+ class ClassNameHelper {
655
+ static get(clazz) {
656
+ if (!clazz)
657
+ return null;
658
+ const prototype = Object.getPrototypeOf(clazz);
659
+ const names = compact([
660
+ get$1(clazz, 'constructor.name'),
661
+ get$1(prototype, 'constructor.name'),
662
+ get$1(prototype, '__proto__.constructor.name'),
663
+ ]);
664
+ return names.find((name) => name !== 'class_1');
665
+ }
666
+ }
667
+
668
+ const isDebuggable = (object) => {
669
+ return 'debug' in object;
670
+ };
671
+ class DebugHelper {
672
+ constructor(...namespace) {
673
+ this.namespaces = new Set();
674
+ this.push(...namespace);
675
+ }
676
+ static namespacesFor(target) {
677
+ if (isNil(target))
678
+ return [];
679
+ const decorator = DebugDecoratorHelper.get(Object.getPrototypeOf(target));
680
+ const namespaces = get$1(decorator, 'namespaces', []);
681
+ const name = get$1(decorator, 'name', ClassNameHelper.get(target));
682
+ return [...namespaces, name];
683
+ }
684
+ static as(...namespaces) {
685
+ return new DebugHelper(...namespaces);
686
+ }
687
+ static for(target, ...namespaces) {
688
+ const targetNamespaces = this.namespacesFor(target);
689
+ return new DebugHelper(...targetNamespaces, ...namespaces);
690
+ }
691
+ static from(target, ...namespaces) {
692
+ if (this.isDebuggable(target)) {
693
+ const debug = target.debug;
694
+ if (namespaces)
695
+ debug.push(...namespaces);
696
+ return debug;
697
+ }
698
+ return DebugHelper.for(target, ...namespaces);
699
+ }
700
+ static clonedFrom(target, ...namespaces) {
701
+ if (this.isDebuggable(target)) {
702
+ namespaces.push(...target.debug.entries);
703
+ }
704
+ else if (!isNil(target)) {
705
+ namespaces.push(...this.namespacesFor(target));
706
+ }
707
+ return DebugHelper.for(target, ...namespaces);
708
+ }
709
+ static clone(target, ...namespaces) {
710
+ let original;
711
+ if (this.isDebuggable(target)) {
712
+ original = target.debug;
713
+ namespaces.push(...original.entries);
714
+ }
715
+ return {
716
+ original,
717
+ debug: DebugHelper.for(target, ...namespaces),
718
+ };
719
+ }
720
+ static replace(target, attrs) {
721
+ if (this.isDebuggable(target))
722
+ target.debug = attrs.with;
723
+ }
724
+ static mock(target, ...namespaces) {
725
+ const { original, debug } = DebugHelper.clone(target, ...namespaces);
726
+ DebugHelper.replace(target, { with: debug });
727
+ return { original, debug };
728
+ }
729
+ get entries() {
730
+ return Array.from(get$1(this, 'namespaces', []));
731
+ }
732
+ get namespace() {
733
+ return compact(flatten(this.entries)).join(':');
734
+ }
735
+ log(message, ...args) {
736
+ this.logger(JSON.stringify(message), ...args.map((element) => JSON.stringify(element)));
737
+ DebugHelper.logs$.next({ namespace: this.namespace, message, args });
738
+ return this;
739
+ }
740
+ trace(message, ...args) {
741
+ this.logger.extend(DebugNamespaces.TRACE)(message, ...args);
742
+ DebugHelper.traces$.next({ namespace: this.namespace, message, args });
743
+ return this;
744
+ }
745
+ error(error, ...args) {
746
+ this.logger.extend(DebugNamespaces.ERROR)(JSON.stringify(error), ...args.map((element) => JSON.stringify(element)));
747
+ DebugHelper.errors$.next({ namespace: this.namespace, error, args });
748
+ return this;
749
+ }
750
+ build() {
751
+ this.logger = Logger;
752
+ this.tracer = Logger;
753
+ this.err = Logger;
754
+ this.entries.forEach((namespace) => {
755
+ this.logger = this.logger.extend(namespace);
756
+ this.tracer = this.tracer.extend(namespace);
757
+ this.err = this.err.extend(namespace);
758
+ });
759
+ return this;
760
+ }
761
+ with(...namespace) {
762
+ return new DebugHelper(...this.entries, ...namespace);
763
+ }
764
+ push(...namespace) {
765
+ if (namespace) {
766
+ namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.add(item));
767
+ }
768
+ return this.build();
769
+ }
770
+ unshift(...namespace) {
771
+ if (namespace) {
772
+ return this.reset(...namespace, ...this.entries);
773
+ }
774
+ return this;
775
+ }
776
+ reset(...namespace) {
777
+ this.namespaces = new Set(flatten(compact(namespace)));
778
+ return this.build();
779
+ }
780
+ startWith(...namespace) {
781
+ const current = this.namespaces;
782
+ this.namespaces = new Set(flatten([compact(namespace), ...current]));
783
+ return this.build();
784
+ }
785
+ shift() {
786
+ const list = this.entries;
787
+ list.shift();
788
+ return this.reset(...list);
789
+ }
790
+ pop() {
791
+ const list = this.entries;
792
+ list.pop();
793
+ return this.reset(...list);
794
+ }
795
+ clear() {
796
+ return this.reset();
797
+ }
798
+ remove(...namespace) {
799
+ if (namespace) {
800
+ namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.delete(item));
801
+ }
802
+ return this.build();
466
803
  }
804
+ puts(...args) {
805
+ return [`[${this.namespace}]`, ...args].join(' ');
806
+ }
807
+ }
808
+ DebugHelper.logs$ = new Subject();
809
+ DebugHelper.traces$ = new Subject();
810
+ DebugHelper.errors$ = new Subject();
811
+ DebugHelper.isDebuggable = isDebuggable;
812
+
813
+ function Debug(opts) {
814
+ return function (target) {
815
+ DebugDecoratorHelper.set(target.prototype, opts);
816
+ };
817
+ }
818
+
819
+ const ASYNC_IDENTIFIER = 'async';
820
+ function Log(options = {}) {
821
+ return Trace(Object.assign({ level: 'log' }, options));
822
+ }
823
+ function Trace(options = {}) {
824
+ return function (target, propertyKey, propertyDescriptor) {
825
+ const method = propertyDescriptor.value;
826
+ const isPromise = method.toString().includes(ASYNC_IDENTIFIER);
827
+ const args = {
828
+ options,
829
+ method,
830
+ target,
831
+ propertyKey,
832
+ propertyDescriptor,
833
+ };
834
+ propertyDescriptor.value = isPromise ? promiseTracer(args) : functionTracer(args);
835
+ return propertyDescriptor;
836
+ };
467
837
  }
838
+ const traceCall = function ({ target, propertyKey, propertyDescriptor, args }) {
839
+ if (!target.debug)
840
+ target.debug = DebugHelper.for(target, propertyKey);
841
+ return target.debug.push(propertyKey).trace('called', { target, propertyKey, propertyDescriptor, args });
842
+ };
843
+ const promiseTracer = function ({ options, method, propertyKey, propertyDescriptor }) {
844
+ return function (...args) {
845
+ return new Promise((resolve, reject) => {
846
+ const debug = traceCall({ target: this, propertyDescriptor, propertyKey, args });
847
+ if (get$1(options, 'level', '') === 'log') {
848
+ debug.with('params').log(args);
849
+ }
850
+ return method
851
+ .apply(this, args)
852
+ .then((result) => {
853
+ if (options.callbackFn) {
854
+ options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
855
+ }
856
+ if (get$1(options, 'level', '') === 'log') {
857
+ debug.with('returns').log(result === undefined ? 'void' : result);
858
+ }
859
+ return resolve(result);
860
+ })
861
+ .catch((error) => {
862
+ debug.error(error, ...args);
863
+ debug.with('stack').error(error.stack).pop();
864
+ return reject(error);
865
+ })
866
+ .finally(() => {
867
+ return debug.trace('finally', { args }).pop();
868
+ });
869
+ });
870
+ };
871
+ };
872
+ const functionTracer = function ({ options, target, method, propertyKey, propertyDescriptor, }) {
873
+ return function (...args) {
874
+ const debug = traceCall({ target: this || target, propertyDescriptor, propertyKey, args });
875
+ if (get$1(options, 'level', '') === 'log') {
876
+ debug.with('params').log(args);
877
+ }
878
+ let result;
879
+ try {
880
+ result = method.apply(this, args);
881
+ if (options.callbackFn)
882
+ options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
883
+ if (get$1(options, 'level', '') === 'log') {
884
+ debug.with('returns').log(result === undefined ? 'void' : result);
885
+ }
886
+ return result;
887
+ }
888
+ catch (error) {
889
+ debug.error(error, ...args).pop();
890
+ throw error;
891
+ }
892
+ finally {
893
+ debug.trace('finally', { args }).pop();
894
+ }
895
+ };
896
+ };
468
897
 
469
898
  const get = (object, path, defaultValue) => get$1(object, path, defaultValue);
470
899
 
@@ -536,26 +965,28 @@ class Coupon extends BaseModel {
536
965
  static createCoupon(userId) {
537
966
  return this.toInstance({
538
967
  nickname: `${Date.now()}`,
539
- type: CouponTypes.ABSOLUTE,
540
968
  checkoutType: CheckoutTypes.ECOMMERCE,
541
- discount: 30,
969
+ discount: {
970
+ subscriber: {
971
+ type: CouponTypes.ABSOLUTE,
972
+ value: 10,
973
+ },
974
+ non_subscriber: {
975
+ type: CouponTypes.ABSOLUTE,
976
+ value: 10,
977
+ },
978
+ subscription: {
979
+ type: CouponTypes.ABSOLUTE,
980
+ value: 10,
981
+ },
982
+ },
542
983
  user: userId,
543
- useLimit: 1,
544
- useLimitPerUser: true,
545
984
  createdAt: new Date(Date.now()),
546
985
  beginAt: new Date(Date.now()),
547
986
  expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
548
987
  });
549
988
  }
550
989
  }
551
- __decorate([
552
- Expose({ name: 'checkout_type' }),
553
- __metadata("design:type", Number)
554
- ], Coupon.prototype, "checkoutType", void 0);
555
- __decorate([
556
- Expose({ name: 'exclusivity_type' }),
557
- __metadata("design:type", Number)
558
- ], Coupon.prototype, "exclusivityType", void 0);
559
990
 
560
991
  class SubscriptionPlan extends BaseModel {
561
992
  static get identifiersFields() {
@@ -595,6 +1026,18 @@ __decorate([
595
1026
  __metadata("design:type", BeautyProfile)
596
1027
  ], User.prototype, "beautyProfile", void 0);
597
1028
 
1029
+ class Address extends BaseModel {
1030
+ static get identifiersFields() {
1031
+ return ['id'];
1032
+ }
1033
+ }
1034
+
1035
+ class UserAddress extends Address {
1036
+ static get identifiersFields() {
1037
+ return ['id', 'userId'];
1038
+ }
1039
+ }
1040
+
598
1041
  class Subscription extends BaseModel {
599
1042
  static get identifiersFields() {
600
1043
  return ['id'];
@@ -609,12 +1052,12 @@ __decorate([
609
1052
  __metadata("design:type", SubscriptionPlan)
610
1053
  ], Subscription.prototype, "subscriptionPlan", void 0);
611
1054
  __decorate([
612
- Type(() => Address),
613
- __metadata("design:type", Address)
1055
+ Type(() => UserAddress),
1056
+ __metadata("design:type", UserAddress)
614
1057
  ], Subscription.prototype, "shippingAddress", void 0);
615
1058
  __decorate([
616
- Type(() => Address),
617
- __metadata("design:type", Address)
1059
+ Type(() => UserAddress),
1060
+ __metadata("design:type", UserAddress)
618
1061
  ], Subscription.prototype, "billingAddress", void 0);
619
1062
  __decorate([
620
1063
  Type(() => Coupon),
@@ -629,12 +1072,6 @@ __decorate([
629
1072
  __metadata("design:type", Array)
630
1073
  ], Subscription.prototype, "payment", void 0);
631
1074
 
632
- class UserAddress extends Address {
633
- static get identifiersFields() {
634
- return ['id', 'userId'];
635
- }
636
- }
637
-
638
1075
  class UserPaymentMethod extends BaseModel {
639
1076
  static get identifiersFields() {
640
1077
  return ['id', 'userId'];
@@ -667,7 +1104,7 @@ class Authentication {
667
1104
  return __awaiter(this, void 0, void 0, function* () {
668
1105
  const method = this.getServiceByMethod(signInMethod);
669
1106
  const userAuth = yield this.authService[method]({ email, password });
670
- const user = this.userRepository.get(userAuth);
1107
+ const user = this.userRepository.get({ id: userAuth.id });
671
1108
  if (!isNil(user))
672
1109
  return user;
673
1110
  if (/^.+@b4a.com.br$/.test(userAuth.email))
@@ -754,14 +1191,123 @@ class RecoveryPassword {
754
1191
  }
755
1192
  }
756
1193
 
757
- class Category extends BaseModel {
758
- identifierFields() {
1194
+ class Filter extends BaseModel {
1195
+ static get identifiersFields() {
1196
+ return ['id'];
1197
+ }
1198
+ }
1199
+
1200
+ class CategoryBase extends BaseModel {
1201
+ static get identifiersFields() {
1202
+ return ['id'];
1203
+ }
1204
+ }
1205
+ __decorate([
1206
+ Type(() => CategoryBase),
1207
+ __metadata("design:type", CategoryBase)
1208
+ ], CategoryBase.prototype, "parent", void 0);
1209
+ __decorate([
1210
+ Type(() => Filter),
1211
+ __metadata("design:type", Array)
1212
+ ], CategoryBase.prototype, "filters", void 0);
1213
+
1214
+ class CategoryForProduct extends CategoryBase {
1215
+ static get identifiersFields() {
1216
+ return ['id'];
1217
+ }
1218
+ }
1219
+
1220
+ class ProductBase extends BaseModel {
1221
+ get evaluation() {
1222
+ return {
1223
+ reviews: this.reviews,
1224
+ count: this.reviewsTotal,
1225
+ rating: this.rate,
1226
+ };
1227
+ }
1228
+ set evaluation(evaluation) {
1229
+ if (!evaluation) {
1230
+ this.reviews = null;
1231
+ this.reviewsTotal = null;
1232
+ this.rate = null;
1233
+ return;
1234
+ }
1235
+ this.reviews = evaluation.reviews || this.reviews;
1236
+ this.reviewsTotal = evaluation.count || this.reviewsTotal;
1237
+ this.rate = evaluation.rating || this.rate;
1238
+ }
1239
+ static get identifiersFields() {
1240
+ return ['id'];
1241
+ }
1242
+ }
1243
+
1244
+ class ProductForKit extends ProductBase {
1245
+ static get identifiersFields() {
1246
+ return ['id'];
1247
+ }
1248
+ }
1249
+ __decorate([
1250
+ Type(() => CategoryForProduct),
1251
+ __metadata("design:type", CategoryForProduct)
1252
+ ], ProductForKit.prototype, "category", void 0);
1253
+
1254
+ class KitProduct extends BaseModel {
1255
+ static get identifiersFields() {
1256
+ return ['productId', 'kitProductId'];
1257
+ }
1258
+ }
1259
+ __decorate([
1260
+ Type(() => ProductForKit),
1261
+ __metadata("design:type", ProductForKit)
1262
+ ], KitProduct.prototype, "kit", void 0);
1263
+ __decorate([
1264
+ Type(() => ProductForKit),
1265
+ __metadata("design:type", ProductForKit)
1266
+ ], KitProduct.prototype, "product", void 0);
1267
+
1268
+ class ProductForCategory extends ProductBase {
1269
+ static get identifiersFields() {
1270
+ return ['id'];
1271
+ }
1272
+ }
1273
+ __decorate([
1274
+ Type(() => KitProduct),
1275
+ __metadata("design:type", Array)
1276
+ ], ProductForCategory.prototype, "kitProducts", void 0);
1277
+
1278
+ class Category extends CategoryBase {
1279
+ static get identifiersFields() {
759
1280
  return ['id'];
760
1281
  }
1282
+ }
1283
+ __decorate([
1284
+ Type(() => ProductForCategory),
1285
+ __metadata("design:type", Array)
1286
+ ], Category.prototype, "childrenProducts", void 0);
1287
+
1288
+ class CategoryCollectionChildren extends BaseModel {
1289
+ static get identifiersFields() {
1290
+ return ['collectionId', 'categoryId'];
1291
+ }
1292
+ }
1293
+ __decorate([
1294
+ Type(() => CategoryCollectionChildren),
1295
+ __metadata("design:type", CategoryCollectionChildren)
1296
+ ], CategoryCollectionChildren.prototype, "parent", void 0);
1297
+
1298
+ class CategoryFilter extends BaseModel {
761
1299
  static get identifiersFields() {
762
1300
  return ['id'];
763
1301
  }
764
1302
  }
1303
+ __decorate([
1304
+ Type(() => Filter),
1305
+ __metadata("design:type", Filter)
1306
+ ], CategoryFilter.prototype, "filter", void 0);
1307
+ __decorate([
1308
+ Type(() => Category),
1309
+ __metadata("design:type", Category)
1310
+ ], CategoryFilter.prototype, "category", void 0);
765
1311
 
766
1312
  var GenderDestination;
767
1313
  (function (GenderDestination) {
@@ -778,53 +1324,59 @@ var Shops;
778
1324
  Shops["ALL"] = "ALL";
779
1325
  })(Shops || (Shops = {}));
780
1326
 
781
- class Product extends BaseModel {
782
- identifierFields() {
1327
+ class FilterOption extends BaseModel {
1328
+ static get identifiersFields() {
783
1329
  return ['id'];
784
1330
  }
1331
+ }
1332
+
1333
+ class Product extends ProductBase {
785
1334
  static get identifiersFields() {
786
1335
  return ['id'];
787
1336
  }
788
1337
  }
1338
+ __decorate([
1339
+ Type(() => CategoryForProduct),
1340
+ __metadata("design:type", CategoryForProduct)
1341
+ ], Product.prototype, "category", void 0);
789
1342
  __decorate([
790
1343
  Type(() => KitProduct),
791
1344
  __metadata("design:type", Array)
792
1345
  ], Product.prototype, "kitProducts", void 0);
793
1346
 
794
- class KitProduct extends BaseModel {
1347
+ class Variant extends BaseModel {
795
1348
  static get identifiersFields() {
796
- return ['productId', 'kitProducId'];
1349
+ return ['id', 'productId'];
797
1350
  }
798
1351
  }
799
- __decorate([
800
- Type(() => Product),
801
- __metadata("design:type", Product)
802
- ], KitProduct.prototype, "kit", void 0);
803
- __decorate([
804
- Type(() => Product),
805
- __metadata("design:type", Product)
806
- ], KitProduct.prototype, "product", void 0);
807
1352
 
808
- class Variant extends BaseModel {
809
- identifierFields() {
1353
+ class Wishlist extends Category {
1354
+ static get identifiersFields() {
1355
+ return ['id'];
1356
+ }
1357
+ }
1358
+
1359
+ class Buy2Win extends BaseModel {
1360
+ static get identifiersFields() {
810
1361
  return ['id'];
811
1362
  }
1363
+ }
1364
+ __decorate([
1365
+ Type(() => Category),
1366
+ __metadata("design:type", Array)
1367
+ ], Buy2Win.prototype, "categories", void 0);
1368
+
1369
+ class CampaignDashboard extends BaseModel {
812
1370
  static get identifiersFields() {
813
- return ['id', 'productId'];
1371
+ return ['id'];
814
1372
  }
815
1373
  }
816
1374
 
817
- var OrderStatus;
818
- (function (OrderStatus) {
819
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
820
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
821
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
822
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
823
- OrderStatus["ENVIADO"] = "Enviado";
824
- OrderStatus["ENTREGUE"] = "Entregue";
825
- OrderStatus["CANCELADO"] = "Cancelado";
826
- OrderStatus["CREDIT_CARD"] = "credit_card";
827
- })(OrderStatus || (OrderStatus = {}));
1375
+ class CampaignHashtag extends BaseModel {
1376
+ static get identifiersFields() {
1377
+ return ['id'];
1378
+ }
1379
+ }
828
1380
 
829
1381
  class LineItem extends Product {
830
1382
  }
@@ -849,12 +1401,12 @@ __decorate([
849
1401
  __metadata("design:type", User)
850
1402
  ], Checkout.prototype, "user", void 0);
851
1403
  __decorate([
852
- Type(() => Address),
853
- __metadata("design:type", Address)
1404
+ Type(() => UserAddress),
1405
+ __metadata("design:type", UserAddress)
854
1406
  ], Checkout.prototype, "shippingAddress", void 0);
855
1407
  __decorate([
856
- Type(() => Address),
857
- __metadata("design:type", Address)
1408
+ Type(() => UserAddress),
1409
+ __metadata("design:type", UserAddress)
858
1410
  ], Checkout.prototype, "billingAddress", void 0);
859
1411
  __decorate([
860
1412
  Type(() => ShippingMethod),
@@ -865,6 +1417,18 @@ __decorate([
865
1417
  __metadata("design:type", Coupon)
866
1418
  ], Checkout.prototype, "coupon", void 0);
867
1419
 
1420
+ var OrderStatus;
1421
+ (function (OrderStatus) {
1422
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
1423
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
1424
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
1425
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
1426
+ OrderStatus["ENVIADO"] = "Enviado";
1427
+ OrderStatus["ENTREGUE"] = "Entregue";
1428
+ OrderStatus["CANCELADO"] = "Cancelado";
1429
+ OrderStatus["CREDIT_CARD"] = "credit_card";
1430
+ })(OrderStatus || (OrderStatus = {}));
1431
+
868
1432
  class Order extends Checkout {
869
1433
  }
870
1434
  __decorate([
@@ -878,12 +1442,12 @@ class CheckoutSubscription extends BaseModel {
878
1442
  }
879
1443
  }
880
1444
  __decorate([
881
- Type(() => Address),
882
- __metadata("design:type", Address)
1445
+ Type(() => UserAddress),
1446
+ __metadata("design:type", UserAddress)
883
1447
  ], CheckoutSubscription.prototype, "shippingAddress", void 0);
884
1448
  __decorate([
885
- Type(() => Address),
886
- __metadata("design:type", Address)
1449
+ Type(() => UserAddress),
1450
+ __metadata("design:type", UserAddress)
887
1451
  ], CheckoutSubscription.prototype, "billingAddress", void 0);
888
1452
  __decorate([
889
1453
  Type(() => SubscriptionPlan),
@@ -894,15 +1458,19 @@ __decorate([
894
1458
  __metadata("design:type", Coupon)
895
1459
  ], CheckoutSubscription.prototype, "coupon", void 0);
896
1460
 
897
- class Buy2Win extends BaseModel {
898
- static get identifiersFields() {
899
- return ['id'];
1461
+ class RoundProductPricesHelper {
1462
+ static roundProductPrices(product) {
1463
+ product.price.price = Number(product.price.price.toFixed(2));
1464
+ product.price.fullPrice = Number(product.price.fullPrice.toFixed(2));
1465
+ if (product.price.subscriberPrice) {
1466
+ product.price.subscriberPrice = Number(product.price.subscriberPrice.toFixed(2));
1467
+ }
1468
+ if (product instanceof LineItem && product.pricePaid) {
1469
+ product.pricePaid = Number(product.pricePaid.toFixed(2));
1470
+ }
1471
+ return product;
900
1472
  }
901
1473
  }
902
- __decorate([
903
- Type(() => Category),
904
- __metadata("design:type", Array)
905
- ], Buy2Win.prototype, "categories", void 0);
906
1474
 
907
1475
  var FilterType;
908
1476
  (function (FilterType) {
@@ -1003,6 +1571,12 @@ class ShopMenu extends BaseModel {
1003
1571
  }
1004
1572
  }
1005
1573
 
1574
+ class ShopSettings extends BaseModel {
1575
+ static get identifiersFields() {
1576
+ return ['id'];
1577
+ }
1578
+ }
1579
+
1006
1580
  class InvalidArgumentError extends CustomError {
1007
1581
  constructor(message) {
1008
1582
  super(message);
@@ -1033,13 +1607,17 @@ class AxiosAdapter {
1033
1607
  constructor(config) {
1034
1608
  this.config = config;
1035
1609
  }
1036
- get(index) {
1610
+ get(index, id) {
1037
1611
  return __awaiter(this, void 0, void 0, function* () {
1038
1612
  try {
1039
1613
  const { data } = yield axios({
1040
- url: `${this.config.url}/${index}`,
1614
+ url: `${this.config.url}/${index}/_doc/${id}`,
1041
1615
  method: 'GET',
1042
- headers: { Authorization: `Basic ${this.config.credential}` },
1616
+ responseType: 'json',
1617
+ headers: {
1618
+ 'Content-Type': 'application/json',
1619
+ Authorization: `ApiKey ${this.config.credential}`,
1620
+ },
1043
1621
  });
1044
1622
  return data._source;
1045
1623
  }
@@ -1053,9 +1631,14 @@ class AxiosAdapter {
1053
1631
  query(index, query) {
1054
1632
  return __awaiter(this, void 0, void 0, function* () {
1055
1633
  const { data } = yield axios({
1056
- url: `${this.config.url}/${index}`,
1634
+ url: `${this.config.url}/${index}/_search`,
1057
1635
  method: 'POST',
1058
- headers: { Authorization: `Basic ${this.config.credential}` },
1636
+ responseType: 'json',
1637
+ headers: {
1638
+ Accept: 'application/vnd.elasticsearch+json;compatible-with=7',
1639
+ 'Content-Type': 'application/vnd.elasticsearch+json;compatible-with=7',
1640
+ Authorization: `ApiKey ${this.config.credential}`,
1641
+ },
1059
1642
  data: query,
1060
1643
  });
1061
1644
  return {
@@ -1067,19 +1650,29 @@ class AxiosAdapter {
1067
1650
  save(index, data) {
1068
1651
  return __awaiter(this, void 0, void 0, function* () {
1069
1652
  yield axios({
1070
- url: `${this.config.url}/${index}`,
1653
+ url: `${this.config.url}/${index}/_doc`,
1654
+ method: 'POST',
1655
+ headers: { Authorization: `ApiKey ${this.config.credential}` },
1656
+ data,
1657
+ });
1658
+ });
1659
+ }
1660
+ update(index, id, data) {
1661
+ return __awaiter(this, void 0, void 0, function* () {
1662
+ yield axios({
1663
+ url: `${this.config.url}/${index}/_update/${id}`,
1071
1664
  method: 'PUT',
1072
- headers: { Authorization: `Basic ${this.config.credential}` },
1665
+ headers: { Authorization: `ApiKey ${this.config.credential}` },
1073
1666
  data,
1074
1667
  });
1075
1668
  });
1076
1669
  }
1077
- delete(index) {
1670
+ delete(index, id) {
1078
1671
  return __awaiter(this, void 0, void 0, function* () {
1079
1672
  yield axios({
1080
- url: `${this.config.url}/${index}`,
1673
+ url: `${this.config.url}/${index}/_doc/${id}`,
1081
1674
  method: 'DELETE',
1082
- headers: { Authorization: `Basic ${this.config.credential}` },
1675
+ headers: { Authorization: `ApiKey ${this.config.credential}` },
1083
1676
  });
1084
1677
  });
1085
1678
  }
@@ -1088,16 +1681,19 @@ class AxiosAdapter {
1088
1681
  class ProductsIndex {
1089
1682
  constructor(adapter) {
1090
1683
  this.adapter = adapter;
1684
+ this.index = `products`;
1091
1685
  }
1092
- get(id) {
1686
+ getById(id) {
1093
1687
  return __awaiter(this, void 0, void 0, function* () {
1094
- const data = yield this.adapter.get(`products/_doc/${id}`);
1688
+ const data = yield this.adapter.get(this.index, id);
1095
1689
  return Product.toInstance(data);
1096
1690
  });
1097
1691
  }
1098
- findById(ids, options) {
1692
+ search(searchTerm, total, shop) {
1099
1693
  return __awaiter(this, void 0, void 0, function* () {
1694
+ const size = total || 9;
1100
1695
  const fields = [
1696
+ 'EAN',
1101
1697
  'brand',
1102
1698
  'id',
1103
1699
  'images',
@@ -1108,73 +1704,88 @@ class ProductsIndex {
1108
1704
  'stock',
1109
1705
  'slug',
1110
1706
  'reviews',
1111
- 'pricePaid',
1112
- 'isGift',
1113
- 'stock',
1114
- 'weight',
1115
- 'tags',
1116
1707
  'hasVariants',
1117
- 'type',
1708
+ 'rate',
1118
1709
  ];
1119
- const { hits } = yield this.adapter.query('products/_search', Object.assign({ _source: fields, query: {
1710
+ const filter = [{ term: { published: true } }];
1711
+ if (size > 9) {
1712
+ fields.push(...['pricePaid', 'isGift', 'stock', 'weight', 'tags']);
1713
+ }
1714
+ else {
1715
+ filter.push({ term: { tags: shop == Shops.GLAMSHOP ? 'feminino' : 'masculino' } });
1716
+ }
1717
+ const search = yield this.adapter.query(this.index, {
1718
+ size,
1719
+ _source: fields,
1720
+ query: {
1120
1721
  bool: {
1121
- filter: [
1122
- {
1123
- terms: {
1124
- _id: ids,
1125
- },
1722
+ must: {
1723
+ multi_match: {
1724
+ query: `${searchTerm}`,
1725
+ type: 'bool_prefix',
1726
+ fields: [
1727
+ 'name',
1728
+ 'name.folded',
1729
+ 'name.search',
1730
+ 'description',
1731
+ 'description.search',
1732
+ 'description.folded',
1733
+ 'brand',
1734
+ 'brand.search',
1735
+ 'brand.folded',
1736
+ ],
1737
+ fuzziness: 2,
1126
1738
  },
1127
- {
1128
- term: {
1129
- published: true,
1739
+ },
1740
+ should: {
1741
+ match_phrase_prefix: {
1742
+ 'name.search': {
1743
+ query: `${searchTerm}`,
1744
+ slop: 10,
1130
1745
  },
1131
1746
  },
1132
- ...((options === null || options === void 0 ? void 0 : options.hasStock)
1133
- ? [
1134
- {
1135
- range: {
1136
- 'stock.quantity': {
1137
- gt: 0,
1138
- },
1139
- },
1140
- },
1141
- ]
1142
- : []),
1143
- ],
1747
+ },
1748
+ filter,
1144
1749
  },
1145
- } }, ((options === null || options === void 0 ? void 0 : options.size) ? { size: options === null || options === void 0 ? void 0 : options.size } : {})));
1146
- return hits.map((hit) => Product.toInstance(hit._source));
1750
+ },
1751
+ });
1752
+ search.hits = search.hits
1753
+ .filter((e) => e._source.name !== '')
1754
+ .map((hit) => {
1755
+ RoundProductPricesHelper.roundProductPrices(hit._source);
1756
+ return hit;
1757
+ });
1758
+ return search;
1147
1759
  });
1148
1760
  }
1149
1761
  save(product) {
1150
1762
  return __awaiter(this, void 0, void 0, function* () {
1151
- delete product.createdAt;
1152
- delete product.updatedAt;
1153
- delete product.kitProducts;
1154
1763
  try {
1155
- if (!product.firestoreId)
1156
- throw new Error('Is not a product from firestore');
1157
- yield this.get(product.firestoreId);
1158
- yield this.adapter.save(`products/_doc/${product.firestoreId}`, product.toPlain());
1764
+ const { createdAt, updatedAt, kitProducts } = product, data = __rest(product, ["createdAt", "updatedAt", "kitProducts"]);
1765
+ this.adapter.save(this.index, data);
1159
1766
  }
1160
1767
  catch (error) {
1161
- if (!(error instanceof Error))
1162
- throw error;
1163
- console.error(error.message);
1164
- yield this.adapter.save(`products/_doc/${product.id}`, product.toPlain());
1768
+ console.error(error);
1165
1769
  }
1166
1770
  });
1167
1771
  }
1168
- delete(product) {
1772
+ update(product) {
1773
+ return __awaiter(this, void 0, void 0, function* () {
1774
+ try {
1775
+ yield this.adapter.update(this.index, product.id, product);
1776
+ }
1777
+ catch (error) {
1778
+ console.error(error);
1779
+ }
1780
+ });
1781
+ }
1782
+ delete(id) {
1169
1783
  return __awaiter(this, void 0, void 0, function* () {
1170
- if (!product.firestoreId)
1171
- return;
1172
1784
  try {
1173
- yield this.get(product.firestoreId);
1174
- yield this.adapter.delete(`products/_doc/${product.firestoreId}`);
1785
+ yield this.adapter.delete(this.index, id);
1175
1786
  }
1176
1787
  catch (error) {
1177
- yield this.adapter.delete(`products/_doc/${product.id}`);
1788
+ console.error(error);
1178
1789
  }
1179
1790
  });
1180
1791
  }
@@ -1202,17 +1813,39 @@ const withFirestore = (MixinBase) => {
1202
1813
  ? data[key].map((element) => (isObjectsAndNoDate(element) ? bindAllDateFromObject(element) : element))
1203
1814
  : bindDate(data[key], key) })), {});
1204
1815
  };
1816
+ const omitByRecursivelyInPlace = (value, iteratee) => {
1817
+ each(value, (v, k) => {
1818
+ if (iteratee(v, k)) {
1819
+ unset(value, k);
1820
+ }
1821
+ else if (isObject(v)) {
1822
+ omitByRecursivelyInPlace(v, iteratee);
1823
+ }
1824
+ });
1825
+ return value;
1826
+ };
1205
1827
  return class extends MixinBase {
1206
- constructor() {
1207
- super(...arguments);
1828
+ constructor(...params) {
1829
+ super(...params);
1830
+ this.fields = {};
1831
+ this.interceptors = {};
1208
1832
  this.collectionName = '';
1833
+ const options = params[0];
1834
+ this.firestore = options.firestore;
1835
+ this.collectionName = options.collectionName;
1836
+ this.model = options.model;
1837
+ this.fields = options.fields;
1838
+ this.interceptors = options.interceptors;
1209
1839
  }
1210
1840
  collection(path) {
1211
1841
  return collection(this.firestore, path || this.collectionName).withConverter(this.buildModelInstance());
1212
1842
  }
1213
1843
  buildModelInstance() {
1214
1844
  return {
1215
- toFirestore: (data) => ((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data),
1845
+ toFirestore: (data) => {
1846
+ const plain = (data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data;
1847
+ return omitByRecursivelyInPlace(plain, (value) => value === undefined);
1848
+ },
1216
1849
  fromFirestore: (snap) => {
1217
1850
  const data = snap.data();
1218
1851
  let bindedData = null;
@@ -1252,12 +1885,16 @@ const withHelpers = (MixinBase) => {
1252
1885
  const withGetFirestore = (MixinBase) => {
1253
1886
  return class GetFirestore extends MixinBase {
1254
1887
  get(identifiers) {
1888
+ var _a, _b, _c, _d;
1255
1889
  return __awaiter(this, void 0, void 0, function* () {
1256
- const docRef = yield getDoc(doc(yield this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(identifiers).shift().toString()));
1890
+ const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => (Object.assign(Object.assign({}, acc), { [field]: identifiers[field] })), {}));
1891
+ const intercepted = yield ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance }));
1892
+ const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || instance;
1893
+ const docRef = yield getDoc(doc(yield this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(builded.identifier).shift().toString()));
1257
1894
  const data = docRef.data();
1258
1895
  if (isNil(data))
1259
1896
  throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
1260
- return data;
1897
+ return ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, data, intercepted)) || data;
1261
1898
  });
1262
1899
  }
1263
1900
  buildCollectionPathForGet(identifiers) {
@@ -1295,7 +1932,7 @@ const withFindFirestore = (MixinBase) => {
1295
1932
  ], []);
1296
1933
  this.buildWhereSentence = (fieldName, options) => {
1297
1934
  if (this.isSubCollection(this) && fieldName === this.parentIdField)
1298
- [];
1935
+ return [];
1299
1936
  const value = (options === null || options === void 0 ? void 0 : options.value) || options;
1300
1937
  const object = {};
1301
1938
  set(object, fieldName, value);
@@ -1336,9 +1973,13 @@ const withFindFirestore = (MixinBase) => {
1336
1973
  return Object.keys(fieldsToOrderBy).map((fieldName) => orderBy(fieldName, fieldsToOrderBy[fieldName]));
1337
1974
  };
1338
1975
  }
1339
- find({ filters, limits, orderBy, } = {}) {
1976
+ find(find = {}) {
1977
+ var _a, _b, _c, _d, _e, _f;
1340
1978
  return __awaiter(this, void 0, void 0, function* () {
1341
- const collection = this.collection(this.buildCollectionPathForFind(filters));
1979
+ const collection = this.collection(this.buildCollectionPathForFind(find.filters));
1980
+ const enableCount = (_b = (_a = find === null || find === void 0 ? void 0 : find.options) === null || _a === void 0 ? void 0 : _a.enableCount) !== null && _b !== void 0 ? _b : true;
1981
+ const intercepted = yield ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.request) === null || _d === void 0 ? void 0 : _d.call(_c, { find }));
1982
+ const { filters, limits, orderBy } = intercepted.find || find;
1342
1983
  const queries = this.makeFirestoreWhere(filters || {});
1343
1984
  const ordination = this.makeFirestoreOrderBy(filters, orderBy);
1344
1985
  const offsets = yield this.defineLimits(filters, limits);
@@ -1346,8 +1987,8 @@ const withFindFirestore = (MixinBase) => {
1346
1987
  const docs = yield getDocs(query(collection, ...queryArgumments));
1347
1988
  const data = docs.docs.map((doc) => doc.data());
1348
1989
  return {
1349
- data,
1350
- count: this.calculateCount(data, limits),
1990
+ data: (yield ((_f = (_e = this.interceptors) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.call(_e, data, intercepted))) || data,
1991
+ count: enableCount ? this.calculateCount(data, limits) : Infinity,
1351
1992
  };
1352
1993
  });
1353
1994
  }
@@ -1359,11 +2000,12 @@ const withFindFirestore = (MixinBase) => {
1359
2000
  return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
1360
2001
  }
1361
2002
  defineLimits(filters, limits) {
2003
+ var _a;
1362
2004
  return __awaiter(this, void 0, void 0, function* () {
1363
2005
  const queries = [];
1364
2006
  if (limits === null || limits === void 0 ? void 0 : limits.offset) {
1365
2007
  if (this.model.isModel(limits.offset))
1366
- queries.push(startAfter(yield getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), limits.offset.identifier.shift()))));
2008
+ queries.push(startAfter(yield getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), (_a = Object.values(limits.offset.identifier).shift()) === null || _a === void 0 ? void 0 : _a.toString()))));
1367
2009
  else if (isNumber(limits.offset) || isString(limits.offset))
1368
2010
  queries.push(startAt(limits.offset));
1369
2011
  }
@@ -1385,16 +2027,21 @@ const withFindFirestore = (MixinBase) => {
1385
2027
  const withCreateFirestore = (MixinBase) => {
1386
2028
  return class CreateFirestore extends MixinBase {
1387
2029
  create(data) {
2030
+ var _a, _b, _c, _d;
1388
2031
  return __awaiter(this, void 0, void 0, function* () {
1389
- const docRef = yield this.save(this.model.toInstance(data));
2032
+ const instance = this.model.toInstance(data);
2033
+ const intercepted = yield ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance }));
2034
+ const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || instance;
2035
+ const docRef = yield this.save(builded);
1390
2036
  const doc = yield getDoc(docRef);
1391
- return doc.data();
2037
+ const docBuilded = (yield ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, doc.data(), intercepted))) || doc.data();
2038
+ return docBuilded;
1392
2039
  });
1393
2040
  }
1394
2041
  save(data) {
1395
2042
  var _a, _b;
1396
2043
  return __awaiter(this, void 0, void 0, function* () {
1397
- const id = (_b = data.identifier[(_a = data.identifiersFields) === null || _a === void 0 ? void 0 : _a.shift()]) === null || _b === void 0 ? void 0 : _b.toString();
2044
+ const id = (_b = (_a = Object.values(data.identifier)) === null || _a === void 0 ? void 0 : _a.shift()) === null || _b === void 0 ? void 0 : _b.toString();
1398
2045
  const collectionPath = this.buildCollectionPathForAdd(data);
1399
2046
  const collection = this.collection(collectionPath);
1400
2047
  if (isEmpty(id))
@@ -1436,13 +2083,17 @@ const withUpdateFirestore = (MixinBase) => {
1436
2083
  };
1437
2084
  return class UpdateFirestore extends MixinBase {
1438
2085
  update(data) {
2086
+ var _a, _b, _c, _d;
1439
2087
  return __awaiter(this, void 0, void 0, function* () {
1440
2088
  const model = new this.model();
1441
2089
  const keyField = model.identifiersFields.shift();
1442
2090
  const docRef = doc(this.collection(this.buildCollectionPathForUpdate(data)), getValueFromParams(data, keyField).toString());
1443
- yield setDoc(docRef, this.paramsToPlain(data), { merge: true });
1444
- const docData = yield getDoc(docRef);
1445
- return docData.data();
2091
+ const plainFromData = this.model.toInstance(this.paramsToPlain(data));
2092
+ const intercepted = yield ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance: plainFromData }));
2093
+ const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
2094
+ yield setDoc(docRef, builded.toPlain(), { merge: true });
2095
+ const docData = yield getDoc(docRef).then((doc) => doc.data());
2096
+ return ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, docData, intercepted)) || docData;
1446
2097
  });
1447
2098
  }
1448
2099
  buildCollectionPathForUpdate(identifiers) {
@@ -1462,8 +2113,13 @@ const withUpdateFirestore = (MixinBase) => {
1462
2113
  const withDeleteFirestore = (MixinBase) => {
1463
2114
  return class DeleteFirestore extends MixinBase {
1464
2115
  delete(identifiers) {
2116
+ var _a, _b, _c, _d;
1465
2117
  return __awaiter(this, void 0, void 0, function* () {
1466
- yield deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(identifiers).shift().toString()));
2118
+ const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => (Object.assign(Object.assign({}, acc), { [field]: identifiers[field] })), {}));
2119
+ const intercepted = yield ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance }));
2120
+ const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || instance;
2121
+ yield deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(builded.identifier).shift().toString()));
2122
+ yield ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, instance, intercepted));
1467
2123
  });
1468
2124
  }
1469
2125
  buildCollectionPathForRemove(identifiers) {
@@ -1476,8 +2132,10 @@ const withDeleteFirestore = (MixinBase) => {
1476
2132
 
1477
2133
  const withSubCollection = (MixinBase, ParentModel) => {
1478
2134
  return class SubCollectionMix extends MixinBase {
1479
- constructor(...args) {
1480
- super(args);
2135
+ constructor(...params) {
2136
+ const options = params[0];
2137
+ super(...params);
2138
+ this.parentIdField = options.parentIdField;
1481
2139
  }
1482
2140
  collection(path) {
1483
2141
  return super.collection(path);
@@ -1491,73 +2149,87 @@ const withCrudFirestore = (MixinBase) => {
1491
2149
  };
1492
2150
 
1493
2151
  class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1494
- constructor(firestore) {
1495
- super();
1496
- this.firestore = firestore;
1497
- this.collectionName = 'leads';
1498
- this.model = Lead;
2152
+ constructor({ firestore, interceptors }) {
2153
+ super({
2154
+ firestore,
2155
+ collectionName: 'leads',
2156
+ model: Lead,
2157
+ interceptors,
2158
+ });
1499
2159
  }
1500
2160
  }
1501
2161
 
1502
2162
  class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
1503
- constructor(firestore, parentRepository) {
1504
- super();
1505
- this.firestore = firestore;
2163
+ constructor({ firestore, interceptors }, parentRepository) {
2164
+ super({
2165
+ firestore,
2166
+ collectionName: 'editions',
2167
+ parentIdField: 'subscriptionId',
2168
+ model: Edition,
2169
+ interceptors,
2170
+ });
1506
2171
  this.parentRepository = parentRepository;
1507
- this.collectionName = 'editions';
1508
- this.parentIdField = 'subscriptionId';
1509
- this.model = Edition;
1510
2172
  }
1511
2173
  }
1512
2174
 
1513
2175
  class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1514
- constructor(firestore) {
1515
- super();
1516
- this.firestore = firestore;
1517
- this.collectionName = 'subscription';
1518
- this.model = Subscription;
2176
+ constructor({ firestore, interceptors, }) {
2177
+ super({
2178
+ firestore,
2179
+ collectionName: 'subscription',
2180
+ model: Subscription,
2181
+ interceptors,
2182
+ });
1519
2183
  }
1520
2184
  }
1521
2185
 
1522
2186
  class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
1523
- constructor(firestore, parentRepository) {
1524
- super();
1525
- this.firestore = firestore;
2187
+ constructor({ firestore, interceptors }, parentRepository) {
2188
+ super({
2189
+ firestore,
2190
+ collectionName: 'payments',
2191
+ parentIdField: 'subscriptionId',
2192
+ model: SubscriptionPayment,
2193
+ interceptors,
2194
+ });
1526
2195
  this.parentRepository = parentRepository;
1527
- this.collectionName = 'payments';
1528
- this.parentIdField = 'subscriptionId';
1529
- this.model = SubscriptionPayment;
1530
2196
  }
1531
2197
  }
1532
2198
 
1533
2199
  class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1534
- constructor(firestore, parentRepository) {
1535
- super();
1536
- this.firestore = firestore;
2200
+ constructor({ firestore, interceptors }, parentRepository) {
2201
+ super({
2202
+ firestore,
2203
+ collectionName: 'address',
2204
+ parentIdField: 'userId',
2205
+ model: UserAddress,
2206
+ interceptors,
2207
+ });
1537
2208
  this.parentRepository = parentRepository;
1538
- this.collectionName = 'address';
1539
- this.parentIdField = 'userId';
1540
- this.model = UserAddress;
1541
2209
  }
1542
2210
  }
1543
2211
 
1544
2212
  class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1545
- constructor(firestore, parentRepository) {
1546
- super();
1547
- this.firestore = firestore;
2213
+ constructor({ firestore, interceptors }, parentRepository) {
2214
+ super({
2215
+ firestore,
2216
+ collectionName: 'CX',
2217
+ parentIdField: 'userId',
2218
+ model: BeautyProfile,
2219
+ interceptors,
2220
+ });
1548
2221
  this.parentRepository = parentRepository;
1549
- this.collectionName = 'CX';
1550
- this.parentIdField = 'userId';
1551
- this.model = BeautyProfile;
1552
2222
  }
1553
2223
  }
1554
2224
 
1555
2225
  class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1556
- constructor(firestore) {
1557
- super();
1558
- this.firestore = firestore;
1559
- this.collectionName = 'users';
1560
- this.model = User;
2226
+ constructor({ firestore, interceptors }) {
2227
+ super({
2228
+ firestore,
2229
+ collectionName: 'users',
2230
+ model: User,
2231
+ interceptors,
2232
+ });
1561
2233
  }
1562
2234
  get(identifiers) {
1563
2235
  const _super = Object.create(null, {
@@ -1608,22 +2280,26 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
1608
2280
  }
1609
2281
 
1610
2282
  class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1611
- constructor(firestore, parentRepository) {
1612
- super();
1613
- this.firestore = firestore;
2283
+ constructor({ firestore, interceptors }, parentRepository) {
2284
+ super({
2285
+ firestore,
2286
+ collectionName: 'payment_method',
2287
+ parentIdField: 'userId',
2288
+ model: UserPaymentMethod,
2289
+ interceptors,
2290
+ });
1614
2291
  this.parentRepository = parentRepository;
1615
- this.collectionName = 'payment_method';
1616
- this.parentIdField = 'userId';
1617
- this.model = UserPaymentMethod;
1618
2292
  }
1619
2293
  }
1620
2294
 
1621
2295
  class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1622
- constructor(firestore) {
1623
- super();
1624
- this.firestore = firestore;
1625
- this.collectionName = 'categories';
1626
- this.model = Category;
2296
+ constructor({ firestore, interceptors }) {
2297
+ super({
2298
+ firestore,
2299
+ collectionName: 'categories',
2300
+ model: Category,
2301
+ interceptors,
2302
+ });
1627
2303
  }
1628
2304
  getCategoryBySlug(slug, shop) {
1629
2305
  return __awaiter(this, void 0, void 0, function* () {
@@ -1635,7 +2311,7 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1635
2311
  return categoryDocs.docs[0].data();
1636
2312
  });
1637
2313
  }
1638
- getCategoriesForHome(categoryIds, limit = 4) {
2314
+ getCategoriesForHome(categoryIds, limit = 4, gender) {
1639
2315
  return __awaiter(this, void 0, void 0, function* () {
1640
2316
  const categorySnap = yield getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
1641
2317
  if (categorySnap.empty)
@@ -1644,7 +2320,7 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1644
2320
  const homeSections = yield Promise.all(categories.map((category) => __awaiter(this, void 0, void 0, function* () {
1645
2321
  return ({
1646
2322
  category,
1647
- products: yield this.mountCategory(category, { limit, hasStock: true }),
2323
+ products: yield this.mountCategory(category, { limit, hasStock: true, gender }),
1648
2324
  });
1649
2325
  })));
1650
2326
  return homeSections;
@@ -1663,6 +2339,8 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1663
2339
  wheres.push(where('published', '==', true), where('id', 'in', productIds));
1664
2340
  if (options === null || options === void 0 ? void 0 : options.hasStock)
1665
2341
  wheres.push(where('stock.quantity', '>', 0));
2342
+ if (options === null || options === void 0 ? void 0 : options.gender)
2343
+ wheres.push(where('tags', 'array-contains', options === null || options === void 0 ? void 0 : options.gender));
1666
2344
  if (options === null || options === void 0 ? void 0 : options.limit)
1667
2345
  wheres.push(limit(options === null || options === void 0 ? void 0 : options.limit));
1668
2346
  const productSnap = yield getDocs(query(this.collection('productsErpVitrine'), ...wheres));
@@ -1673,15 +2351,26 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1673
2351
  return is(products);
1674
2352
  });
1675
2353
  }
2354
+ getCategoryByShop(shop) {
2355
+ return;
2356
+ }
2357
+ getChildren(parentId) {
2358
+ return;
2359
+ }
2360
+ isChild(id, parentId) {
2361
+ return;
2362
+ }
1676
2363
  }
1677
2364
 
1678
2365
  class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1679
- constructor(firestore) {
1680
- super();
1681
- this.firestore = firestore;
2366
+ constructor({ firestore, interceptors }) {
2367
+ super({
2368
+ firestore,
2369
+ collectionName: 'productsErpVitrine',
2370
+ model: Product,
2371
+ interceptors,
2372
+ });
1682
2373
  this.reviews = {};
1683
- this.collectionName = 'productsErpVitrine';
1684
- this.model = Product;
1685
2374
  }
1686
2375
  getBySlug(slug) {
1687
2376
  var _a;
@@ -1722,43 +2411,101 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
1722
2411
  return this.reviews[status];
1723
2412
  });
1724
2413
  }
2414
+ cleanShoppingCountFromIds() {
2415
+ return;
2416
+ }
2417
+ findCatalog(params) {
2418
+ return this.find(params);
2419
+ }
1725
2420
  }
1726
2421
 
1727
2422
  class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
1728
- constructor(firestore, parentRepository) {
1729
- super();
1730
- this.firestore = firestore;
2423
+ constructor({ firestore, interceptors }, parentRepository) {
2424
+ super({
2425
+ firestore,
2426
+ collectionName: 'variants',
2427
+ parentIdField: 'productId',
2428
+ model: Variant,
2429
+ interceptors,
2430
+ });
1731
2431
  this.parentRepository = parentRepository;
1732
- this.collectionName = 'variants';
1733
- this.parentIdField = 'productId';
1734
- this.model = Variant;
1735
2432
  }
1736
2433
  }
1737
2434
 
1738
2435
  class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1739
- constructor(firestore) {
1740
- super();
1741
- this.firestore = firestore;
1742
- this.collectionName = 'subscriptionProducts';
1743
- this.model = Product;
2436
+ constructor({ firestore, interceptors }) {
2437
+ super({
2438
+ firestore,
2439
+ collectionName: 'subscriptionProducts',
2440
+ model: Product,
2441
+ interceptors,
2442
+ });
2443
+ }
2444
+ }
2445
+
2446
+ class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2447
+ constructor({ firestore, interceptors }) {
2448
+ super({
2449
+ firestore,
2450
+ collectionName: 'buy2win',
2451
+ model: Buy2Win,
2452
+ interceptors,
2453
+ });
2454
+ }
2455
+ }
2456
+
2457
+ class CampaignDashboardFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2458
+ constructor({ firestore, interceptors, }) {
2459
+ super({
2460
+ firestore,
2461
+ collectionName: 'dashboardCampaignsAuto',
2462
+ model: CampaignDashboard,
2463
+ interceptors,
2464
+ });
2465
+ }
2466
+ }
2467
+
2468
+ class CampaignHashtagFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2469
+ constructor({ firestore, interceptors, }) {
2470
+ super({
2471
+ firestore,
2472
+ collectionName: 'hashtagCampaignsAuto',
2473
+ model: CampaignHashtag,
2474
+ interceptors,
2475
+ });
1744
2476
  }
1745
2477
  }
1746
2478
 
1747
2479
  class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1748
- constructor(firestore) {
1749
- super();
1750
- this.firestore = firestore;
1751
- this.collectionName = 'checkouts';
1752
- this.model = Checkout;
2480
+ constructor({ firestore, interceptors }) {
2481
+ super({
2482
+ firestore,
2483
+ collectionName: 'checkouts',
2484
+ model: Checkout,
2485
+ interceptors,
2486
+ });
2487
+ }
2488
+ }
2489
+
2490
+ class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2491
+ constructor({ firestore, interceptors, }) {
2492
+ super({
2493
+ firestore,
2494
+ collectionName: 'checkoutsSubscription',
2495
+ model: CheckoutSubscription,
2496
+ interceptors,
2497
+ });
1753
2498
  }
1754
2499
  }
1755
2500
 
1756
2501
  class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1757
- constructor(firestore) {
1758
- super();
1759
- this.firestore = firestore;
1760
- this.collectionName = 'coupons';
1761
- this.model = Coupon;
2502
+ constructor({ firestore, interceptors }) {
2503
+ super({
2504
+ firestore,
2505
+ collectionName: 'coupons',
2506
+ model: Coupon,
2507
+ interceptors,
2508
+ });
1762
2509
  }
1763
2510
  buildModelInstance() {
1764
2511
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -1780,9 +2527,16 @@ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirest
1780
2527
  }
1781
2528
 
1782
2529
  class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1783
- constructor(firestore) {
1784
- super();
1785
- this.firestore = firestore;
2530
+ constructor({ firestore, interceptors }) {
2531
+ super({
2532
+ firestore,
2533
+ collectionName: 'orders',
2534
+ model: Order,
2535
+ interceptors,
2536
+ fields: {
2537
+ status: FirestoreFieldType.String,
2538
+ },
2539
+ });
1786
2540
  this.orderFromFirestore = (order) => {
1787
2541
  var _a;
1788
2542
  if (!!((_a = order === null || order === void 0 ? void 0 : order.lineItems) === null || _a === void 0 ? void 0 : _a.length)) {
@@ -1796,11 +2550,6 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
1796
2550
  }
1797
2551
  return order;
1798
2552
  };
1799
- this.collectionName = 'orders';
1800
- this.model = Order;
1801
- this.fields = {
1802
- status: FirestoreFieldType.String,
1803
- };
1804
2553
  }
1805
2554
  buildModelInstance() {
1806
2555
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -1814,86 +2563,62 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
1814
2563
  }
1815
2564
  }
1816
2565
 
1817
- class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1818
- constructor(firestore) {
1819
- super();
1820
- this.firestore = firestore;
1821
- this.collectionName = 'payments';
1822
- this.model = Payment;
2566
+ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
2567
+ constructor({ firestore, interceptors }) {
2568
+ super({
2569
+ firestore,
2570
+ interceptors,
2571
+ });
2572
+ this.collectionName = 'legacyOrders';
1823
2573
  }
1824
2574
  }
1825
2575
 
1826
- class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1827
- constructor(firestore) {
1828
- super();
1829
- this.firestore = firestore;
1830
- this.collectionName = 'checkoutsSubscription';
1831
- this.model = CheckoutSubscription;
2576
+ class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2577
+ constructor({ firestore, interceptors }) {
2578
+ super({
2579
+ firestore,
2580
+ collectionName: 'payments',
2581
+ model: Payment,
2582
+ interceptors,
2583
+ });
1832
2584
  }
1833
2585
  }
1834
2586
 
1835
2587
  class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1836
- constructor(firestore) {
1837
- super();
1838
- this.firestore = firestore;
1839
- this.collectionName = 'subscriptionPlans';
1840
- this.model = SubscriptionPlan;
1841
- }
1842
- }
1843
-
1844
- class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1845
- constructor(firestore) {
1846
- super();
1847
- this.firestore = firestore;
1848
- this.collectionName = 'buy2win';
1849
- this.model = Buy2Win;
1850
- }
1851
- }
1852
-
1853
- class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1854
- constructor(firestore) {
1855
- super(firestore);
1856
- this.firestore = firestore;
1857
- this.collectionName = 'legacyOrders';
2588
+ constructor({ firestore, interceptors, }) {
2589
+ super({
2590
+ firestore,
2591
+ collectionName: 'subscriptionPlans',
2592
+ model: SubscriptionPlan,
2593
+ interceptors,
2594
+ });
1858
2595
  }
1859
2596
  }
1860
2597
 
1861
2598
  class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1862
- constructor(firestore) {
1863
- super();
1864
- this.firestore = firestore;
1865
- this.homeToFirestore = (home) => {
1866
- var _a;
1867
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
1868
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.homeCategoryGroupToPlain);
1869
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.homeCategoryGroupToPlain);
1870
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.homeCategoryGroupToPlain);
1871
- }
1872
- return home;
1873
- };
1874
- this.homeCategoryGroupToPlain = (homeCategoryGroup) => ({
1875
- category: homeCategoryGroup.category.toPlain(),
1876
- products: homeCategoryGroup.products.map((product) => product.toPlain()),
2599
+ constructor({ firestore, interceptors }) {
2600
+ super({
2601
+ firestore,
2602
+ collectionName: 'dms',
2603
+ model: Home,
2604
+ interceptors,
1877
2605
  });
1878
- this.homeFromFirestore = (home) => {
2606
+ this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
2607
+ var _a, _b, _c;
2608
+ return ({
2609
+ category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
2610
+ ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
2611
+ : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
2612
+ products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => ((product === null || product === void 0 ? void 0 : product.toPlain) ? product === null || product === void 0 ? void 0 : product.toPlain() : product)).filter(Boolean)) || [],
2613
+ });
2614
+ };
2615
+ this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
1879
2616
  var _a;
1880
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
1881
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
1882
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
1883
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
1884
- home.data.createdAt =
1885
- home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
1886
- home.data.expiresAt =
1887
- home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
1888
- }
1889
- return home;
2617
+ return ({
2618
+ category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
2619
+ products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
2620
+ });
1890
2621
  };
1891
- this.plainToHomeCategoryGroup = (homeCategoryGroup) => ({
1892
- category: Category.toInstance(homeCategoryGroup.category),
1893
- products: homeCategoryGroup.products.map((product) => Product.toInstance(product)),
1894
- });
1895
- this.collectionName = 'dms';
1896
- this.model = Home;
1897
2622
  }
1898
2623
  buildModelInstance() {
1899
2624
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -1908,14 +2633,49 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
1908
2633
  },
1909
2634
  };
1910
2635
  }
2636
+ homeToFirestore(home) {
2637
+ var _a, _b, _c, _d;
2638
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
2639
+ home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
2640
+ home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
2641
+ home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
2642
+ }
2643
+ return home;
2644
+ }
2645
+ homeFromFirestore(home) {
2646
+ var _a;
2647
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
2648
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
2649
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
2650
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
2651
+ home.data.createdAt =
2652
+ home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
2653
+ home.data.expiresAt =
2654
+ home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
2655
+ }
2656
+ return home;
2657
+ }
1911
2658
  }
1912
2659
 
1913
2660
  class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1914
- constructor(firestore) {
1915
- super();
1916
- this.firestore = firestore;
1917
- this.collectionName = 'shopMenus';
1918
- this.model = ShopMenu;
2661
+ constructor({ firestore, interceptors }) {
2662
+ super({
2663
+ firestore,
2664
+ collectionName: 'shopMenus',
2665
+ model: ShopMenu,
2666
+ interceptors,
2667
+ });
2668
+ }
2669
+ }
2670
+
2671
+ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2672
+ constructor({ firestore, interceptors, }) {
2673
+ super({
2674
+ firestore,
2675
+ collectionName: 'shopSettings',
2676
+ model: ShopSettings,
2677
+ interceptors,
2678
+ });
1919
2679
  }
1920
2680
  }
1921
2681
 
@@ -2005,7 +2765,7 @@ class AttributeOptionHelper {
2005
2765
  AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
2006
2766
  var _a;
2007
2767
  if (fields.includes(attributeName))
2008
- return { columnName: attributeName.toString(), attributeName };
2768
+ return { columnName: attributeName.toString(), attributeName, to: (value) => value, from: (value) => value };
2009
2769
  const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
2010
2770
  const fieldOption = (_a = is(field)) === null || _a === void 0 ? void 0 : _a[attributeName];
2011
2771
  if (isNil(fieldOption))
@@ -2014,7 +2774,7 @@ AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
2014
2774
  return { columnName: attributeName.toString(), attributeName, fields: fieldOption };
2015
2775
  return Object.assign({ attributeName, columnName: attributeName.toString() }, fieldOption);
2016
2776
  };
2017
- AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue.columnName;
2777
+ AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!(fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.columnName);
2018
2778
  AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
2019
2779
  if (fields.includes(columnName))
2020
2780
  return { columnName, attributeName: columnName };
@@ -2094,22 +2854,23 @@ BindFilterQueryHelper.MakeGraphQLWhere = (filter, fields) => Object.keys(filter)
2094
2854
  }, {});
2095
2855
  BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
2096
2856
  const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
2097
- if (!Array.isArray(options) &&
2857
+ const isNestedField = !Array.isArray(options) &&
2098
2858
  isObject(options) &&
2099
2859
  isNil(options === null || options === void 0 ? void 0 : options.operator) &&
2100
2860
  isNil(options === null || options === void 0 ? void 0 : options.value) &&
2101
- isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to))
2861
+ isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to);
2862
+ if (isNestedField)
2102
2863
  return Object.keys(options).reduce((variables, key) => {
2103
2864
  const fieldOptions = AttributeOptionHelper.FindByAttribute(key, (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || fields);
2104
2865
  const columnName = fieldOptions.columnName;
2105
2866
  const columnFields = fieldOptions.fields;
2106
- return Object.assign(Object.assign({}, variables), { [columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), columnFields || []) });
2867
+ return Object.assign(Object.assign({}, variables), { [columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || columnFields || fields) });
2107
2868
  }, {});
2108
2869
  if (!Array.isArray(options) && !isNil(fieldSentenceOptions.fields))
2109
2870
  return {
2110
2871
  [fieldSentenceOptions.fields[0]]: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
2111
2872
  };
2112
- if (isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
2873
+ if (!Array.isArray(options) && isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
2113
2874
  options = Object.values(options)[0];
2114
2875
  return Array.isArray(options)
2115
2876
  ? options.reduce((whereSentence, option) => (Object.assign(Object.assign({}, whereSentence), BindFilterQueryHelper.BuildOperatorSentence(option, fieldSentenceOptions))), {})
@@ -2141,33 +2902,18 @@ GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = (fields) => {
2141
2902
  if (field === 'affected_rows')
2142
2903
  return field;
2143
2904
  const fieldName = Object.keys(field).shift();
2144
- const fieldValue = field[fieldName];
2905
+ const fieldValue = is(field[fieldName]);
2145
2906
  if (Array.isArray(fieldValue))
2146
2907
  return { [fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue) };
2147
2908
  if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
2148
- return null;
2149
- if (fieldValue.fields)
2150
- return !fieldValue.filters
2151
- ? {
2152
- [fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2153
- }
2154
- : {
2155
- operation: fieldValue.columnName || fieldName,
2156
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2157
- variables: {
2158
- [`${fieldValue.columnName}_where`]: {
2159
- name: 'where',
2160
- type: fieldValue.filters.filterType,
2161
- value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
2162
- required: true,
2163
- },
2164
- },
2165
- };
2909
+ return;
2910
+ const isNestedField = !!fieldValue.fields;
2911
+ if (isNestedField)
2912
+ return GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields(fieldName, fieldValue);
2166
2913
  return fieldValue.columnName;
2167
2914
  }).filter((field) => !!field);
2168
2915
  };
2169
2916
  GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).reduce((result, columnName) => {
2170
- var _a;
2171
2917
  const { attributeName, fields: attributeFields, from, } = AttributeOptionHelper.FindColumnOptionFromList(columnName, fields);
2172
2918
  if (!!attributeFields && Array.isArray(attributeFields)) {
2173
2919
  if (Array.isArray(data[columnName]))
@@ -2181,7 +2927,7 @@ GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).r
2181
2927
  }
2182
2928
  if (!!from)
2183
2929
  return Object.assign(Object.assign({}, result), { [attributeName]: from(data[columnName], data) });
2184
- return Object.assign(Object.assign({}, result), { [attributeName]: parseDateTime((_a = data[columnName]) === null || _a === void 0 ? void 0 : _a.toString()) });
2930
+ return Object.assign(Object.assign({}, result), { [attributeName]: isString(data[columnName]) ? parseDateTime(data[columnName].toString()) : data[columnName] });
2185
2931
  }, {});
2186
2932
  GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2187
2933
  var _a;
@@ -2197,7 +2943,8 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2197
2943
  !Object.keys(foreignKeyColumn).filter((key) => { var _a; return !((_a = is(data[attributeName])) === null || _a === void 0 ? void 0 : _a[key]); }).length)
2198
2944
  return Object.keys(foreignKeyColumn).reduce((object, current) => {
2199
2945
  var _a;
2200
- return (Object.assign(Object.assign({}, object), { [foreignKeyColumn[current]]: (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current] }));
2946
+ const { columnName: foreignColumnName } = AttributeOptionHelper.FindByAttribute(foreignKeyColumn[current], fields);
2947
+ return Object.assign(Object.assign({}, object), { [foreignColumnName]: (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current] });
2201
2948
  }, Object.assign({}, result));
2202
2949
  if (update &&
2203
2950
  isObject(data[attributeName]) &&
@@ -2225,6 +2972,25 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2225
2972
  return Object.assign(Object.assign({}, result), { [columnName]: data[attributeName] });
2226
2973
  }, {});
2227
2974
  };
2975
+ GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields = (fieldName, fieldValue) => {
2976
+ const hasCustomFilters = !!fieldValue.filters;
2977
+ if (hasCustomFilters)
2978
+ return {
2979
+ operation: fieldValue.columnName || fieldName,
2980
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2981
+ variables: {
2982
+ [`${fieldValue.columnName}_where`]: {
2983
+ name: 'where',
2984
+ type: fieldValue.filters.filterType,
2985
+ value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
2986
+ required: true,
2987
+ },
2988
+ },
2989
+ };
2990
+ return {
2991
+ [fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2992
+ };
2993
+ };
2228
2994
 
2229
2995
  const withCreateHasuraGraphQL = (MixinBase) => {
2230
2996
  return class CreateHasuraGraphQLMixin extends MixinBase {
@@ -2236,6 +3002,7 @@ const withCreateHasuraGraphQL = (MixinBase) => {
2236
3002
  }
2237
3003
  create(data) {
2238
3004
  return __awaiter(this, void 0, void 0, function* () {
3005
+ this.logger = DebugHelper.from(this, 'create');
2239
3006
  const newData = yield this.save(this.model.toInstance(data));
2240
3007
  return this.model.toInstance(newData);
2241
3008
  });
@@ -2248,12 +3015,11 @@ const withCreateHasuraGraphQL = (MixinBase) => {
2248
3015
  const columnOptions = Object.values(field).shift();
2249
3016
  return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
2250
3017
  columnOptions.foreignKeyColumn && [
2251
- ...Object.values(columnOptions.foreignKeyColumn),
3018
+ ...Object.values(columnOptions.foreignKeyColumn).map((foreignKeyName) => { var _a; return (_a = AttributeOptionHelper.FindByAttribute(foreignKeyName, this.fields)) === null || _a === void 0 ? void 0 : _a.columnName; }),
2252
3019
  {
2253
3020
  [columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => {
2254
3021
  var _a;
2255
- return ((_a = AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions === null || columnOptions === void 0 ? void 0 : columnOptions.fields)) === null || _a === void 0 ? void 0 : _a.columnName) ||
2256
- foreignKeyField;
3022
+ return ((_a = AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions === null || columnOptions === void 0 ? void 0 : columnOptions.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || foreignKeyField;
2257
3023
  }),
2258
3024
  },
2259
3025
  ]);
@@ -2278,9 +3044,11 @@ const withDeleteHasuraGraphQL = (MixinBase) => {
2278
3044
  }
2279
3045
  delete(identifiers) {
2280
3046
  return __awaiter(this, void 0, void 0, function* () {
3047
+ this.logger = DebugHelper.from(this, 'delete');
2281
3048
  const instance = this.model.toInstance(identifiers);
2282
3049
  yield this.mutation(this.deleteGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), this.model.identifiersFields.reduce((ids, identifier) => {
2283
- if (isNil(instance[identifier]))
3050
+ const identifierBinded = identifier;
3051
+ if (isNil(instance.identifier[identifierBinded]))
2284
3052
  return ids;
2285
3053
  const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
2286
3054
  const value = columnOption.to(identifiers[identifier], instance);
@@ -2305,11 +3073,16 @@ const withHasuraGraphQL = (MixinBase) => {
2305
3073
  this.authOptions = options.authOptions;
2306
3074
  this.model = options.model;
2307
3075
  this.fields = options.fields || this.model.identifiersFields;
3076
+ this.logger = DebugHelper.from(this);
2308
3077
  }
2309
3078
  get headers() {
2310
- return Object.assign(Object.assign(Object.assign({ 'Content-Type': 'application/json' }, (isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken })), (isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret })), (isNil(this.authOptions.authRole)
3079
+ var _a, _b, _c, _d, _e, _f, _g;
3080
+ return Object.assign(Object.assign(Object.assign({ 'Content-Type': 'application/json' }, (isNil((_a = this.authOptions) === null || _a === void 0 ? void 0 : _a.authToken) ? {} : { Authorization: (_b = this.authOptions) === null || _b === void 0 ? void 0 : _b.authToken })), (isNil((_c = this.authOptions) === null || _c === void 0 ? void 0 : _c.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': (_d = this.authOptions) === null || _d === void 0 ? void 0 : _d.adminSecret })), (isNil((_e = this.authOptions) === null || _e === void 0 ? void 0 : _e.authRole)
2311
3081
  ? {}
2312
- : { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }));
3082
+ : {
3083
+ 'X-Hasura-Role': this.authOptions.authRole.role,
3084
+ 'X-Hasura-User-Id': (_g = (_f = this.authOptions) === null || _f === void 0 ? void 0 : _f.authRole) === null || _g === void 0 ? void 0 : _g.userId,
3085
+ }));
2313
3086
  }
2314
3087
  mutation(operation, fields, variables) {
2315
3088
  return __awaiter(this, void 0, void 0, function* () {
@@ -2322,30 +3095,32 @@ const withHasuraGraphQL = (MixinBase) => {
2322
3095
  });
2323
3096
  }
2324
3097
  query(operation, fields, variables) {
3098
+ var _a, _b, _c, _d;
2325
3099
  return __awaiter(this, void 0, void 0, function* () {
2326
- const resultQuery = GraphQLFieldHelper.CheckIsGraphQLParams(operation)
2327
- ? query$1(operation.map((option) => ({
2328
- operation: option.operation,
2329
- variables: option.variables,
2330
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
2331
- })))
2332
- : query$1({
2333
- operation,
2334
- variables,
2335
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
2336
- });
2337
- return this.fetch(resultQuery);
3100
+ const builded = this.buildHasuraQueryFields({
3101
+ operation,
3102
+ fields: fields,
3103
+ variables,
3104
+ });
3105
+ const interpected = (yield ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, builded))) || builded;
3106
+ const resultQuery = query$1(interpected);
3107
+ const result = yield this.fetch(resultQuery);
3108
+ return (yield ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, result, interpected))) || result;
2338
3109
  });
2339
3110
  }
2340
3111
  fetch(params) {
2341
3112
  return __awaiter(this, void 0, void 0, function* () {
3113
+ this.logger.with('params').log(params);
2342
3114
  const headers = this.headers;
2343
- const response = yield axios.post(`${this.endpoint}`, params, {
3115
+ const { data: result } = yield axios({
3116
+ url: `${this.endpoint}`,
3117
+ method: 'POST',
3118
+ data: params,
2344
3119
  headers,
2345
3120
  });
2346
- const result = yield response.data;
2347
3121
  if (!isNil(result.errors))
2348
3122
  throw new Error(JSON.stringify(result.errors));
3123
+ this.logger.with('returns').log(result);
2349
3124
  return result.data;
2350
3125
  });
2351
3126
  }
@@ -2372,13 +3147,26 @@ const withHasuraGraphQL = (MixinBase) => {
2372
3147
  return value;
2373
3148
  return date;
2374
3149
  }
2375
- convertDataFromHasura(data) {
2376
- const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
3150
+ convertDataFromHasura(data, fields) {
3151
+ const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, fields || this.fields);
2377
3152
  return this.model.toInstance(plain);
2378
3153
  }
2379
3154
  convertDataToHasura(instance, update = false) {
2380
3155
  return GraphQLFieldHelper.ConvertFieldValueTo(instance, this.fields, update);
2381
3156
  }
3157
+ buildHasuraQueryFields({ operation, fields, variables, }) {
3158
+ return GraphQLFieldHelper.CheckIsGraphQLParams(operation)
3159
+ ? operation.map((option) => ({
3160
+ operation: option.operation,
3161
+ variables: option.variables,
3162
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
3163
+ }))
3164
+ : {
3165
+ operation,
3166
+ variables,
3167
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
3168
+ };
3169
+ }
2382
3170
  };
2383
3171
  };
2384
3172
 
@@ -2402,6 +3190,7 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
2402
3190
  }
2403
3191
  update(data) {
2404
3192
  return __awaiter(this, void 0, void 0, function* () {
3193
+ this.logger = DebugHelper.from(this, 'update');
2405
3194
  const plainData = this.paramsToPlain(data);
2406
3195
  yield this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), {
2407
3196
  _set: {
@@ -2426,10 +3215,11 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
2426
3215
  const instance = this.model.toInstance(data);
2427
3216
  return this.model.identifiersFields.reduce((ids, identifier) => {
2428
3217
  var _a;
2429
- if (isNil(instance[identifier]))
3218
+ const identifierBinded = identifier;
3219
+ if (isNil(instance.identifier[identifierBinded]))
2430
3220
  return ids;
2431
- const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
2432
- const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[identifier], instance)) || data[columnOption.attributeName];
3221
+ const columnOption = AttributeOptionHelper.FindByAttribute(identifierBinded, this.fields);
3222
+ const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[identifierBinded], instance)) || data[columnOption.attributeName];
2433
3223
  return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: value });
2434
3224
  }, {});
2435
3225
  }
@@ -2445,10 +3235,12 @@ const withGetHasuraGraphQL = (MixinBase) => {
2445
3235
  }
2446
3236
  get(identifiers) {
2447
3237
  return __awaiter(this, void 0, void 0, function* () {
3238
+ this.logger = DebugHelper.from(this, 'get');
2448
3239
  const instance = this.model.toInstance(identifiers);
2449
3240
  const result = yield this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce((ids, identifier) => {
2450
3241
  var _a;
2451
- if (isNil(instance[identifier]))
3242
+ const identifierBinded = identifier;
3243
+ if (isNil(instance[identifierBinded]))
2452
3244
  return ids;
2453
3245
  const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
2454
3246
  const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, identifiers[identifier], instance)) ||
@@ -2470,10 +3262,46 @@ const withGetHasuraGraphQL = (MixinBase) => {
2470
3262
 
2471
3263
  const withFindHasuraGraphQL = (MixinBase) => {
2472
3264
  return class FindHasuraGraphQLMixin extends MixinBase {
2473
- find(options) {
3265
+ constructor() {
3266
+ super(...arguments);
3267
+ this.bindOrderByAttributes = (orderBy, fields) => Object.keys(orderBy).reduce((acc, current) => [
3268
+ ...acc,
3269
+ {
3270
+ [AttributeOptionHelper.FindByAttribute(current, fields)
3271
+ .columnName]: orderBy[current] === 'asc'
3272
+ ? 'asc_nulls_last'
3273
+ : 'desc_nulls_last',
3274
+ },
3275
+ ], []);
3276
+ this.bindAggretageAttributes = (aggregates, fields) => {
3277
+ var _a, _b;
3278
+ return [
3279
+ ...(((_a = aggregates === null || aggregates === void 0 ? void 0 : aggregates.minimal) === null || _a === void 0 ? void 0 : _a.length)
3280
+ ? [
3281
+ {
3282
+ min: this.bindAttributesToColumns(aggregates === null || aggregates === void 0 ? void 0 : aggregates.minimal, fields),
3283
+ },
3284
+ ]
3285
+ : []),
3286
+ ...(((_b = aggregates === null || aggregates === void 0 ? void 0 : aggregates.maximum) === null || _b === void 0 ? void 0 : _b.length)
3287
+ ? [
3288
+ {
3289
+ max: this.bindAttributesToColumns(aggregates === null || aggregates === void 0 ? void 0 : aggregates.maximum, fields),
3290
+ },
3291
+ ]
3292
+ : []),
3293
+ ];
3294
+ };
3295
+ this.bindDistinctAttributes = (distinct, fields) => this.bindAttributesToColumns(distinct, fields);
3296
+ this.bindAttributesToColumns = (attributes, fields) => attributes.map((attr) => { var _a; return ((_a = AttributeOptionHelper.FindByAttribute(attr.toString().split('.').pop(), fields)) === null || _a === void 0 ? void 0 : _a.columnName) || attr; });
3297
+ }
3298
+ find(params) {
3299
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2474
3300
  return __awaiter(this, void 0, void 0, function* () {
2475
- const { filters, limits, orderBy } = options || {};
2476
- const variablesCount = Object.assign(Object.assign({}, (isNil(orderBy) ? {} : { order_by: { type: `${this.tableName}_order_by!`, list: true, value: orderBy } })), (isNil(filters)
3301
+ this.logger = DebugHelper.from(this, 'find');
3302
+ const { filters, limits, orderBy, options } = params || {};
3303
+ const enableCount = (_a = options === null || options === void 0 ? void 0 : options.enableCount) !== null && _a !== void 0 ? _a : true;
3304
+ const variablesFilters = isNil(filters)
2477
3305
  ? {}
2478
3306
  : {
2479
3307
  where: {
@@ -2481,13 +3309,26 @@ const withFindHasuraGraphQL = (MixinBase) => {
2481
3309
  type: `${this.tableName}_bool_exp`,
2482
3310
  required: true,
2483
3311
  },
2484
- }));
3312
+ };
3313
+ const variablesCount = Object.assign(Object.assign({}, (isNil(orderBy)
3314
+ ? {}
3315
+ : {
3316
+ order_by: {
3317
+ type: `${this.tableName}_order_by!`,
3318
+ list: true,
3319
+ value: this.bindOrderByAttributes(orderBy, this.fields),
3320
+ },
3321
+ })), variablesFilters);
2485
3322
  const variables = Object.assign(Object.assign({}, (isNil(limits) ? {} : limits)), variablesCount);
3323
+ const aggregateFields = [
3324
+ ...(enableCount ? ['count'] : []),
3325
+ ...this.bindAggretageAttributes(params.options, this.fields),
3326
+ ];
2486
3327
  const result = yield this.query([
2487
3328
  {
2488
3329
  operation: this.tableName,
2489
- fields: options.fields
2490
- ? options.fields
3330
+ fields: params.fields
3331
+ ? params.fields
2491
3332
  .map((fieldName) => {
2492
3333
  var _a;
2493
3334
  return (_a = this.fields.find((fieldOption) => fieldOption === fieldName)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName);
@@ -2496,15 +3337,64 @@ const withFindHasuraGraphQL = (MixinBase) => {
2496
3337
  : this.fields,
2497
3338
  variables,
2498
3339
  },
2499
- {
2500
- operation: `${this.tableName}_aggregate`,
2501
- fields: [{ aggregate: ['count'] }],
2502
- variables: variablesCount,
2503
- },
3340
+ ...(aggregateFields.length > 0
3341
+ ? [
3342
+ {
3343
+ operation: `${this.tableName}_aggregate`,
3344
+ fields: [
3345
+ {
3346
+ aggregate: aggregateFields,
3347
+ },
3348
+ ],
3349
+ variables: variablesCount,
3350
+ },
3351
+ ]
3352
+ : []),
3353
+ ...((!((_b = params.limits) === null || _b === void 0 ? void 0 : _b.offset) &&
3354
+ ((_d = (_c = params.options) === null || _c === void 0 ? void 0 : _c.distinct) === null || _d === void 0 ? void 0 : _d.map((distinct) => {
3355
+ var _a, _b;
3356
+ const distinctOption = (_a = this.fields.find((fieldOption) => fieldOption === distinct)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === distinct);
3357
+ const fieldName = ((_b = Object.values(distinctOption).shift()) === null || _b === void 0 ? void 0 : _b.columnName) || distinct;
3358
+ return {
3359
+ operation: {
3360
+ name: `${this.tableName}`,
3361
+ alias: `${this.tableName}_${distinct.toString()}_distinct`,
3362
+ },
3363
+ fields: [distinctOption],
3364
+ variables: Object.assign(Object.assign({}, variablesFilters), { [`${this.tableName}_${fieldName}_distinct`]: {
3365
+ type: `${this.tableName}_select_column!`,
3366
+ list: true,
3367
+ value: fieldName,
3368
+ name: 'distinct_on',
3369
+ } }),
3370
+ };
3371
+ }))) ||
3372
+ []),
2504
3373
  ]);
2505
3374
  const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
2506
- const count = result[`${this.tableName}_aggregate`].aggregate.count;
2507
- return { count, data };
3375
+ return Object.assign(Object.assign(Object.assign({ data, count: enableCount ? result[`${this.tableName}_aggregate`].aggregate.count : Infinity }, (((_e = options === null || options === void 0 ? void 0 : options.minimal) === null || _e === void 0 ? void 0 : _e.length)
3376
+ ? {
3377
+ minimal: options.minimal.reduce((minimals, current) => {
3378
+ var _a;
3379
+ return (Object.assign(Object.assign({}, minimals), set(minimals, current, result[`${this.tableName}_aggregate`].aggregate.min[((_a = AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || current])));
3380
+ }, {}),
3381
+ }
3382
+ : {})), (((_f = options === null || options === void 0 ? void 0 : options.maximum) === null || _f === void 0 ? void 0 : _f.length)
3383
+ ? {
3384
+ maximum: options.maximum.reduce((maximums, current) => {
3385
+ var _a;
3386
+ return (Object.assign(Object.assign({}, maximums), set(maximums, current, result[`${this.tableName}_aggregate`].aggregate.max[((_a = AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || current])));
3387
+ }, {}),
3388
+ }
3389
+ : {})), (!((_g = params.limits) === null || _g === void 0 ? void 0 : _g.offset) &&
3390
+ ((_h = options === null || options === void 0 ? void 0 : options.distinct) === null || _h === void 0 ? void 0 : _h.length) && {
3391
+ distinct: options === null || options === void 0 ? void 0 : options.distinct.reduce((distinct, current) => {
3392
+ var _a, _b;
3393
+ const distinctOption = (_a = this.fields.find((fieldOption) => fieldOption === current)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === current);
3394
+ const fieldName = ((_b = Object.values(distinctOption).shift()) === null || _b === void 0 ? void 0 : _b.columnName) || current;
3395
+ return Object.assign(Object.assign({}, distinct), { [current.toString()]: result[`${this.tableName}_${current.toString()}_distinct`].map((obj) => obj[fieldName]) });
3396
+ }, {}),
3397
+ }));
2508
3398
  });
2509
3399
  }
2510
3400
  };
@@ -2544,13 +3434,154 @@ class VariantHasuraGraphQL extends Variant {
2544
3434
  }
2545
3435
  }
2546
3436
 
3437
+ class CategoryCollectionChildrenHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3438
+ constructor({ endpoint, authOptions, interceptors, }) {
3439
+ super({
3440
+ tableName: 'category_collection_children',
3441
+ model: CategoryCollectionChildren,
3442
+ endpoint,
3443
+ authOptions,
3444
+ interceptors,
3445
+ fields: [
3446
+ { collectionId: { columnName: 'collection_id' } },
3447
+ { categoryId: { columnName: 'category_id' } },
3448
+ 'name',
3449
+ 'slug',
3450
+ 'reference',
3451
+ { parentCollectionId: { columnName: 'parent_collection_id' } },
3452
+ { parentCategoryId: { columnName: 'parent_category_id' } },
3453
+ {
3454
+ parent: {
3455
+ columnName: 'parent',
3456
+ foreignKeyColumn: { collectionId: 'parentCollectionId', categoryId: 'parentCategoryId' },
3457
+ fields: [
3458
+ { collectionId: { columnName: 'collection_id' } },
3459
+ { categoryId: { columnName: 'category_id' } },
3460
+ 'name',
3461
+ 'slug',
3462
+ 'reference',
3463
+ { parentCollectionId: { columnName: 'parent_collection_id' } },
3464
+ { parentCategoryId: { columnName: 'parent_category_id' } },
3465
+ ],
3466
+ },
3467
+ },
3468
+ ],
3469
+ });
3470
+ }
3471
+ }
3472
+
3473
+ class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3474
+ constructor({ endpoint, authOptions, interceptors, }) {
3475
+ super({
3476
+ tableName: 'category_filter',
3477
+ model: CategoryFilter,
3478
+ endpoint,
3479
+ authOptions,
3480
+ interceptors,
3481
+ fields: [
3482
+ 'id',
3483
+ { filterId: { columnName: 'filter_id' } },
3484
+ { categoryId: { columnName: 'category_id' } },
3485
+ {
3486
+ filter: {
3487
+ columnName: 'filter',
3488
+ foreignKeyColumn: { id: 'filterId' },
3489
+ fields: [
3490
+ 'id',
3491
+ 'description',
3492
+ 'slug',
3493
+ 'enabled',
3494
+ { createdAt: { columnName: 'created_at' } },
3495
+ { updatedAt: { columnName: 'updated_at' } },
3496
+ {
3497
+ options: {
3498
+ columnName: 'options',
3499
+ foreignKeyColumn: { filterId: 'id' },
3500
+ fields: [
3501
+ 'id',
3502
+ { filterId: { columnName: 'filter_id' } },
3503
+ 'description',
3504
+ { createdAt: { columnName: 'created_at' } },
3505
+ { updatedAt: { columnName: 'updated_at' } },
3506
+ ],
3507
+ },
3508
+ },
3509
+ ],
3510
+ },
3511
+ },
3512
+ {
3513
+ category: {
3514
+ columnName: 'category',
3515
+ foreignKeyColumn: { id: 'categoryId' },
3516
+ fields: [
3517
+ 'id',
3518
+ 'description',
3519
+ {
3520
+ products: {
3521
+ columnName: 'products',
3522
+ fields: ['product_id'],
3523
+ from: (value) => value.map((product) => product.product_id.toString()),
3524
+ to: (productIds) => productIds.map((productId) => ({
3525
+ product_id: +productId,
3526
+ })),
3527
+ },
3528
+ },
3529
+ {
3530
+ childrenProducts: {
3531
+ columnName: 'children_products',
3532
+ foreignKeyColumn: { category_id: 'id' },
3533
+ fields: [
3534
+ 'id',
3535
+ 'name',
3536
+ 'slug',
3537
+ {
3538
+ categories: {
3539
+ columnName: 'categories',
3540
+ fields: ['category_id'],
3541
+ bindPersistData: (value) => ({
3542
+ categories: { data: value.map((category) => ({ category_id: +category })) },
3543
+ }),
3544
+ to: (categories) => categories.map((categoryId) => +categoryId),
3545
+ from: (categories) => (categories === null || categories === void 0 ? void 0 : categories.map((category) => { var _a; return (_a = category === null || category === void 0 ? void 0 : category.category_id) === null || _a === void 0 ? void 0 : _a.toString(); })) || [],
3546
+ },
3547
+ },
3548
+ ],
3549
+ },
3550
+ },
3551
+ ],
3552
+ },
3553
+ },
3554
+ ],
3555
+ });
3556
+ }
3557
+ deleteByCategory(categoryId) {
3558
+ return this.mutation('delete_category_filter', ['affected_rows'], {
3559
+ where: {
3560
+ type: 'category_filter_bool_exp',
3561
+ required: true,
3562
+ value: { category_id: { _eq: categoryId } },
3563
+ },
3564
+ });
3565
+ }
3566
+ deleteByCategoryAndFilter(categoryId, filterId) {
3567
+ return this.mutation('delete_category_filter', ['affected_rows'], {
3568
+ where: {
3569
+ type: 'category_filter_bool_exp',
3570
+ required: true,
3571
+ value: { category_id: { _eq: categoryId }, filter_id: { _eq: filterId } },
3572
+ },
3573
+ });
3574
+ }
3575
+ }
3576
+
2547
3577
  class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2548
- constructor(endpoint, authOptions, productRepository) {
3578
+ constructor({ endpoint, authOptions, interceptors, }, productRepository, categoryFilterRepository) {
2549
3579
  super({
2550
3580
  tableName: 'category',
2551
3581
  model: Category,
2552
3582
  endpoint,
2553
3583
  authOptions,
3584
+ interceptors,
2554
3585
  fields: [
2555
3586
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
2556
3587
  { firestoreId: { columnName: 'firestore_id' } },
@@ -2559,6 +3590,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2559
3590
  'image',
2560
3591
  'published',
2561
3592
  'shop',
3593
+ { shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
2562
3594
  'slug',
2563
3595
  { brandCategory: { columnName: 'brand_category' } },
2564
3596
  { brandCategoryBanner: { columnName: 'brand_banner' } },
@@ -2584,7 +3616,17 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2584
3616
  },
2585
3617
  },
2586
3618
  },
2587
- 'filters',
3619
+ {
3620
+ filters: {
3621
+ columnName: 'filters',
3622
+ foreignKeyColumn: { filter_id: 'id' },
3623
+ fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
3624
+ bindPersistData: (value) => ({
3625
+ filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
3626
+ }),
3627
+ from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter)) || [],
3628
+ },
3629
+ },
2588
3630
  { createdAt: { columnName: 'created_at' } },
2589
3631
  { updatedAt: { columnName: 'updated_at' } },
2590
3632
  {
@@ -2606,9 +3648,21 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2606
3648
  }),
2607
3649
  },
2608
3650
  },
3651
+ { isCollection: { columnName: 'is_collection' } },
3652
+ { isWishlist: { columnName: 'is_wishlist' } },
3653
+ 'reference',
3654
+ { parentId: { columnName: 'parent_id' } },
3655
+ {
3656
+ parent: {
3657
+ columnName: 'parent',
3658
+ foreignKeyColumn: { id: 'parentId' },
3659
+ fields: ['id', 'name', 'reference', 'slug'],
3660
+ },
3661
+ },
2609
3662
  ],
2610
3663
  });
2611
3664
  this.productRepository = productRepository;
3665
+ this.categoryFilterRepository = categoryFilterRepository;
2612
3666
  }
2613
3667
  create(params) {
2614
3668
  const _super = Object.create(null, {
@@ -2616,7 +3670,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2616
3670
  });
2617
3671
  return __awaiter(this, void 0, void 0, function* () {
2618
3672
  const { metadata } = params, data = __rest(params, ["metadata"]);
2619
- return _super.create.call(this, Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }));
3673
+ return _super.create.call(this, Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
2620
3674
  });
2621
3675
  }
2622
3676
  get(identifiers) {
@@ -2626,7 +3680,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2626
3680
  var _a;
2627
3681
  return __awaiter(this, void 0, void 0, function* () {
2628
3682
  return Number.isNaN(+identifiers.id)
2629
- ? (_a = (yield this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
3683
+ ? (_a = (yield this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data) === null || _a === void 0 ? void 0 : _a[0]
2630
3684
  : _super.get.call(this, identifiers);
2631
3685
  });
2632
3686
  }
@@ -2635,12 +3689,13 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2635
3689
  update: { get: () => super.update }
2636
3690
  });
2637
3691
  return __awaiter(this, void 0, void 0, function* () {
2638
- const { products, id: checkId, metadata } = params, data = __rest(params, ["products", "id", "metadata"]);
3692
+ const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
2639
3693
  const plainData = this.paramsToPlain({ id: checkId });
2640
3694
  const id = yield this.getId(plainData.id);
2641
- const category = yield _super.update.call(this, Object.assign({ id }, data));
3695
+ const category = yield _super.update.call(this, Object.assign(Object.assign({ id }, data), { isWishlist: false }));
2642
3696
  category.products = products && (yield this.updateProducts(+id, { products }));
2643
3697
  category.metadata = metadata && (yield this.updateMetadata(+id, { metadata }));
3698
+ category.filters = filters && (yield this.updateFilters(+id, { filters }));
2644
3699
  return category;
2645
3700
  });
2646
3701
  }
@@ -2648,15 +3703,42 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2648
3703
  return __awaiter(this, void 0, void 0, function* () {
2649
3704
  if (!slug)
2650
3705
  return null;
2651
- const { data, count } = yield this.find({ filters: { slug, shop, published: true } });
2652
- if (count > 1)
2653
- throw new DuplicatedResultsError('Query returned duplicated values');
2654
- if (!count)
3706
+ const { data } = yield this.find({
3707
+ filters: {
3708
+ slug,
3709
+ shops: { operator: Where.IN, value: [shop] },
3710
+ published: { operator: Where.EQUALS, value: true },
3711
+ isWishlist: { operator: Where.EQUALS, value: false },
3712
+ },
3713
+ options: {
3714
+ enableCount: false,
3715
+ },
3716
+ });
3717
+ if (!data.length)
2655
3718
  throw new NotFoundError(`Category with slug ${slug} not found`);
3719
+ if (data.length > 1)
3720
+ throw new DuplicatedResultsError('Query returned duplicated values');
2656
3721
  return data.shift();
2657
3722
  });
2658
3723
  }
2659
- getCategoriesForHome(categoryIds, limit = 4) {
3724
+ getCategoryByShop(shop) {
3725
+ return __awaiter(this, void 0, void 0, function* () {
3726
+ if (!shop)
3727
+ return;
3728
+ const { data } = yield this.find({
3729
+ filters: {
3730
+ shops: { operator: Where.IN, value: [shop] },
3731
+ published: { operator: Where.EQUALS, value: true },
3732
+ isWishlist: { operator: Where.EQUALS, value: false },
3733
+ },
3734
+ options: {
3735
+ enableCount: false,
3736
+ },
3737
+ });
3738
+ return data;
3739
+ });
3740
+ }
3741
+ getCategoriesForHome(categoryIds, limit = 4, gender) {
2660
3742
  return __awaiter(this, void 0, void 0, function* () {
2661
3743
  if (!(categoryIds === null || categoryIds === void 0 ? void 0 : categoryIds.length))
2662
3744
  return [];
@@ -2676,7 +3758,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2676
3758
  const homeSections = yield Promise.all(categories.map((category) => __awaiter(this, void 0, void 0, function* () {
2677
3759
  return ({
2678
3760
  category,
2679
- products: yield this.mountCategory(category, { limit, hasStock: true }),
3761
+ products: yield this.mountCategory(category, { limit, hasStock: true, gender }),
2680
3762
  });
2681
3763
  })));
2682
3764
  return homeSections;
@@ -2688,7 +3770,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2688
3770
  if (!((_a = category === null || category === void 0 ? void 0 : category.products) === null || _a === void 0 ? void 0 : _a.length))
2689
3771
  return [];
2690
3772
  const products = [];
2691
- const { data: productsData } = yield this.productRepository.find(Object.assign({ filters: Object.assign({ id: { operator: Where.IN, value: category.products }, published: true }, ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {})), fields: [
3773
+ const { data: productsData } = yield this.productRepository.find(Object.assign(Object.assign({ filters: Object.assign(Object.assign({ id: { operator: Where.IN, value: category.products }, published: true }, ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {})), ((options === null || options === void 0 ? void 0 : options.gender) ? { tags: { operator: Where.IN, value: [options === null || options === void 0 ? void 0 : options.gender] } } : {})), fields: [
2692
3774
  'id',
2693
3775
  'name',
2694
3776
  'slug',
@@ -2712,7 +3794,9 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2712
3794
  'tags',
2713
3795
  'type',
2714
3796
  'shoppingCount',
2715
- ] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})));
3797
+ 'gender',
3798
+ 'createdAt',
3799
+ ] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})), { options: { enableCount: false } }));
2716
3800
  products.push(...productsData);
2717
3801
  return products;
2718
3802
  });
@@ -2722,7 +3806,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2722
3806
  return __awaiter(this, void 0, void 0, function* () {
2723
3807
  if (!Number.isNaN(+id))
2724
3808
  return id;
2725
- const { data } = yield this.find({ filters: { firestoreId: id } });
3809
+ const { data } = yield this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
2726
3810
  if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
2727
3811
  return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
2728
3812
  throw new NotFoundError(`Category with id ${id} not found`);
@@ -2780,15 +3864,220 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2780
3864
  return plainData.metadata;
2781
3865
  });
2782
3866
  }
3867
+ updateFilters(categoryId, { filters }) {
3868
+ return __awaiter(this, void 0, void 0, function* () {
3869
+ if ('action' in filters && filters.action === 'remove' && filters.value.length) {
3870
+ for (let i = 0; i < filters.value.length; i++) {
3871
+ yield this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filters.value[i].id);
3872
+ }
3873
+ return [];
3874
+ }
3875
+ if ('action' in filters && filters.action === 'merge' && filters.value.length) {
3876
+ let filtersList = [];
3877
+ const currentFilters = yield this.categoryFilterRepository
3878
+ .find({
3879
+ filters: {
3880
+ categoryId,
3881
+ },
3882
+ })
3883
+ .then((res) => res.data);
3884
+ const currentFiltersId = currentFilters.map((f) => f.id);
3885
+ const filtersUpdatedId = filters.value.map((f) => f.id);
3886
+ const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
3887
+ const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
3888
+ for (const filter of filterToBeDeleted) {
3889
+ const index = currentFilters.findIndex((f) => f.id == filter);
3890
+ if (index != -1) {
3891
+ currentFilters.splice(index, 1);
3892
+ }
3893
+ yield this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
3894
+ }
3895
+ for (const filter of filterToBeInserted) {
3896
+ const newCategoryFilter = yield this.categoryFilterRepository.create({
3897
+ filterId: filter,
3898
+ categoryId,
3899
+ });
3900
+ filtersList.push(filter);
3901
+ }
3902
+ return filters.value;
3903
+ }
3904
+ if (Array.isArray(filters) && filters.length) {
3905
+ yield this.categoryFilterRepository.deleteByCategory(categoryId);
3906
+ let filtersList = [];
3907
+ for (let i = 0; i < filters.length; i++) {
3908
+ const newCategoryFilter = yield this.categoryFilterRepository.create({
3909
+ filterId: filters[i].id,
3910
+ categoryId,
3911
+ });
3912
+ filtersList.push(newCategoryFilter);
3913
+ }
3914
+ return filters;
3915
+ }
3916
+ });
3917
+ }
3918
+ getChildren(parentId) {
3919
+ return __awaiter(this, void 0, void 0, function* () {
3920
+ const { category_tree } = yield this.query('category_tree', ['id', 'name', 'parent_id'], {
3921
+ args: {
3922
+ type: 'category_tree_args',
3923
+ value: { parentid: parentId },
3924
+ required: true,
3925
+ },
3926
+ });
3927
+ return category_tree.map((category) => Category.toInstance(category));
3928
+ });
3929
+ }
3930
+ isChild(id, parentId) {
3931
+ return __awaiter(this, void 0, void 0, function* () {
3932
+ const categoryTree = yield this.getChildren(parentId);
3933
+ return categoryTree.some((c) => c.id == id.toString());
3934
+ });
3935
+ }
3936
+ }
3937
+
3938
+ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3939
+ constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
3940
+ super({
3941
+ tableName: 'filter',
3942
+ model: Filter,
3943
+ endpoint,
3944
+ authOptions,
3945
+ interceptors,
3946
+ fields: [
3947
+ 'id',
3948
+ 'description',
3949
+ 'slug',
3950
+ 'enabled',
3951
+ { createdAt: { columnName: 'created_at' } },
3952
+ { updatedAt: { columnName: 'updated_at' } },
3953
+ {
3954
+ options: {
3955
+ columnName: 'options',
3956
+ foreignKeyColumn: { filterId: 'id' },
3957
+ fields: [
3958
+ 'id',
3959
+ { filterId: { columnName: 'filter_id' } },
3960
+ 'description',
3961
+ { createdAt: { columnName: 'created_at' } },
3962
+ { updatedAt: { columnName: 'updated_at' } },
3963
+ ],
3964
+ },
3965
+ },
3966
+ ],
3967
+ });
3968
+ this.filterOptionRepository = filterOptionRepository;
3969
+ this.categoryFilterRepository = categoryFilterRepository;
3970
+ }
3971
+ update(params) {
3972
+ const _super = Object.create(null, {
3973
+ update: { get: () => super.update }
3974
+ });
3975
+ return __awaiter(this, void 0, void 0, function* () {
3976
+ const { options } = params, data = __rest(params, ["options"]);
3977
+ const filter = yield _super.update.call(this, data);
3978
+ filter.options = yield this.updateOptions(+data.id, { options });
3979
+ return filter;
3980
+ });
3981
+ }
3982
+ updateOptions(filterId, { options }) {
3983
+ return __awaiter(this, void 0, void 0, function* () {
3984
+ if (!options)
3985
+ return [];
3986
+ if ('action' in options && options.action === 'remove' && options.value.length) {
3987
+ for (let i = 0; i < options.value.length; i++) {
3988
+ yield this.filterOptionRepository.delete({ id: options.value[i].id });
3989
+ }
3990
+ return [];
3991
+ }
3992
+ if ('action' in options && options.action === 'merge' && options.value.length) {
3993
+ let filterOptions = [];
3994
+ for (let i = 0; i < options.value.length; i++) {
3995
+ try {
3996
+ const hasFilter = yield this.filterOptionRepository.get({ id: options.value[i].id });
3997
+ if (hasFilter)
3998
+ filterOptions.push(hasFilter);
3999
+ }
4000
+ catch (error) {
4001
+ const newOption = yield this.filterOptionRepository.create(Object.assign(Object.assign({}, options.value[i]), { filterId }));
4002
+ filterOptions.push(newOption);
4003
+ }
4004
+ }
4005
+ return filterOptions;
4006
+ }
4007
+ if (Array.isArray(options) && options.length) {
4008
+ let filterOptions = [];
4009
+ for (let i = 0; i < options.length; i++) {
4010
+ try {
4011
+ const hasFilter = yield this.filterOptionRepository.get({ id: options[i].id });
4012
+ if (hasFilter)
4013
+ filterOptions.push(hasFilter);
4014
+ }
4015
+ catch (error) {
4016
+ const newOption = yield this.filterOptionRepository.create(Object.assign(Object.assign({}, options[i]), { filterId }));
4017
+ filterOptions.push(newOption);
4018
+ }
4019
+ }
4020
+ }
4021
+ return [];
4022
+ });
4023
+ }
4024
+ delete(params) {
4025
+ const _super = Object.create(null, {
4026
+ delete: { get: () => super.delete }
4027
+ });
4028
+ return __awaiter(this, void 0, void 0, function* () {
4029
+ const { data: categoryFilters } = yield this.categoryFilterRepository.find({
4030
+ filters: {
4031
+ filterId: params.id,
4032
+ },
4033
+ });
4034
+ if (categoryFilters.length)
4035
+ throw new Error('Erro: o filtro está associado a uma ou mais categoria(s)');
4036
+ yield this.deleteOptions(+params.id);
4037
+ yield _super.delete.call(this, { id: +params.id });
4038
+ return;
4039
+ });
4040
+ }
4041
+ deleteOptions(filterId) {
4042
+ return __awaiter(this, void 0, void 0, function* () {
4043
+ yield this.mutation('delete_filter_option', ['affected_rows'], {
4044
+ where: {
4045
+ type: 'filter_option_bool_exp',
4046
+ required: true,
4047
+ value: { filter_id: { _eq: filterId } },
4048
+ },
4049
+ });
4050
+ });
4051
+ }
4052
+ }
4053
+
4054
+ class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
4055
+ constructor({ endpoint, authOptions, interceptors, }) {
4056
+ super({
4057
+ tableName: 'filter_option',
4058
+ model: FilterOption,
4059
+ endpoint,
4060
+ authOptions,
4061
+ interceptors,
4062
+ fields: [
4063
+ 'id',
4064
+ 'description',
4065
+ { filterId: { columnName: 'filter_id' } },
4066
+ { createdAt: { columnName: 'created_at' } },
4067
+ { updatedAt: { columnName: 'updated_at' } },
4068
+ ],
4069
+ });
4070
+ }
2783
4071
  }
2784
4072
 
2785
4073
  class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2786
- constructor(endpoint, authOptions) {
4074
+ constructor({ endpoint, authOptions, interceptors, }) {
2787
4075
  super({
2788
4076
  tableName: 'product',
2789
4077
  model: ProductHasuraGraphQL,
2790
4078
  endpoint,
2791
4079
  authOptions,
4080
+ interceptors,
2792
4081
  fields: [],
2793
4082
  });
2794
4083
  this.bindReviewToModel = (plain) => (Object.assign(Object.assign({}, is(omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id']))), { createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at, updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at, personId: plain.person_id, orderId: plain.order_id }));
@@ -2811,26 +4100,29 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
2811
4100
  whoMustUse: data.who_must_use,
2812
4101
  howToUse: data.how_to_use,
2813
4102
  brand: data.brand_description,
4103
+ ingredients: data.ingredients,
2814
4104
  }),
2815
- bindFindFilter: (sentence) => {
2816
- const filters = Object.values(sentence).shift();
2817
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((filters === null || filters === void 0 ? void 0 : filters.description) && { description: filters.description })), (filters.differentials && { differentials: filters.differentials })), (filters.whoMustUse && {
4105
+ bindFindFilter: (filters) => {
4106
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((filters === null || filters === void 0 ? void 0 : filters.description) && { description: filters.description })), (filters.differentials && { differentials: filters.differentials })), (filters.whoMustUse && {
2818
4107
  who_must_use: filters.whoMustUse,
2819
4108
  })), (filters.howToUse && {
2820
4109
  how_to_use: filters.howToUse,
2821
4110
  })), (filters.brand && {
2822
4111
  brand_description: filters.brand,
4112
+ })), (filters.ingredients && {
4113
+ ingredients: filters.ingredients,
2823
4114
  }));
2824
4115
  },
2825
- bindPersistData: (descriptionData) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((descriptionData === null || descriptionData === void 0 ? void 0 : descriptionData.description) && { description: descriptionData.description })), (descriptionData.differentials && { differentials: descriptionData.differentials })), (descriptionData.whoMustUse && {
4116
+ bindPersistData: (descriptionData) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((descriptionData === null || descriptionData === void 0 ? void 0 : descriptionData.description) && { description: descriptionData.description })), (descriptionData.differentials && { differentials: descriptionData.differentials })), (descriptionData.whoMustUse && {
2826
4117
  who_must_use: descriptionData.whoMustUse,
2827
- })), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand }))),
4118
+ })), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand })), (descriptionData.ingredients && { ingredients: descriptionData.ingredients }))),
2828
4119
  },
2829
4120
  },
2830
4121
  { differentials: { columnName: 'differentials' } },
2831
4122
  { whoMustUse: { columnName: 'who_must_use' } },
2832
4123
  { howToUse: { columnName: 'how_to_use' } },
2833
4124
  { brandDescription: { columnName: 'brand_description' } },
4125
+ { ingredients: { columnName: 'ingredients' } },
2834
4126
  { hasVariants: { columnName: 'has_variants' } },
2835
4127
  {
2836
4128
  images: {
@@ -2854,8 +4146,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
2854
4146
  subscriberDiscountPercentage: data.subscriber_discount_percentage,
2855
4147
  subscriberPrice: data.subscriber_price,
2856
4148
  }),
2857
- bindFindFilter: (sentence) => {
2858
- const filters = Object.values(sentence).shift();
4149
+ bindFindFilter: (filters) => {
2859
4150
  return Object.assign(Object.assign(Object.assign(Object.assign({}, (((filters === null || filters === void 0 ? void 0 : filters.price) || (filters === null || filters === void 0 ? void 0 : filters.price) === 0) && { price: filters.price })), ((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice })), ((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
2860
4151
  subscriber_discount_percentage: filters.subscriberDiscountPercentage,
2861
4152
  })), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
@@ -2879,27 +4170,29 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
2879
4170
  to: (value) => (isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity),
2880
4171
  },
2881
4172
  },
4173
+ { hasStock: { columnName: 'has_stock' } },
2882
4174
  'slug',
2883
4175
  'type',
2884
4176
  'video',
2885
4177
  'weight',
2886
4178
  'gender',
4179
+ { intGender: { columnName: 'int_gender' } },
2887
4180
  { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
4181
+ { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
2888
4182
  { isKit: { columnName: 'is_kit' } },
2889
4183
  { createdAt: { columnName: 'created_at' } },
2890
4184
  { updatedAt: { columnName: 'updated_at' } },
4185
+ { rate: { columnName: 'rating' } },
4186
+ { reviewsTotal: { columnName: 'reviews_total' } },
4187
+ { shoppingCount: { columnName: 'shopping_count' } },
4188
+ { categoryId: { columnName: 'category_id' } },
2891
4189
  {
2892
- rate: {
2893
- columnName: 'reviews_aggregate',
2894
- filters: {
2895
- filters: { status: true },
2896
- filterType: 'product_review_bool_exp',
2897
- },
2898
- fields: [{ aggregate: [{ avg: ['rate'] }] }],
2899
- from: (value) => value.aggregate.avg.rate,
4190
+ category: {
4191
+ columnName: 'category',
4192
+ foreignKeyColumn: { id: 'categoryId' },
4193
+ fields: ['id', 'name', 'reference', 'slug'],
2900
4194
  },
2901
4195
  },
2902
- { shoppingCount: { columnName: 'shopping_count' } },
2903
4196
  ];
2904
4197
  this.fields = [
2905
4198
  ...commonFields,
@@ -2986,7 +4279,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
2986
4279
  var _a;
2987
4280
  return __awaiter(this, void 0, void 0, function* () {
2988
4281
  const product = Number.isNaN(+identifiers.id)
2989
- ? (_a = (yield this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
4282
+ ? (_a = (yield this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data) === null || _a === void 0 ? void 0 : _a[0]
2990
4283
  : yield _super.get.call(this, identifiers);
2991
4284
  if (product.productId)
2992
4285
  throw new NotFoundError('Product not found, it is a variant');
@@ -2998,13 +4291,29 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
2998
4291
  const _super = Object.create(null, {
2999
4292
  find: { get: () => super.find }
3000
4293
  });
4294
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3001
4295
  return __awaiter(this, void 0, void 0, function* () {
3002
- const _a = params || {}, { filters, fields } = _a, options = __rest(_a, ["filters", "fields"]);
4296
+ const _o = params || {}, { filters, fields } = _o, options = __rest(_o, ["filters", "fields"]);
3003
4297
  const bindFields = fields ||
3004
4298
  this.fields
3005
4299
  .map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
3006
4300
  .filter((field) => field !== 'reviews');
3007
- return _super.find.call(this, Object.assign(Object.assign({}, options), { filters: Object.assign(Object.assign({}, filters), { productId: { operator: Where.ISNULL } }), fields: bindFields }));
4301
+ if ((_b = (_a = options.options) === null || _a === void 0 ? void 0 : _a.minimal) === null || _b === void 0 ? void 0 : _b.includes('price'))
4302
+ (_c = options.options) === null || _c === void 0 ? void 0 : _c.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
4303
+ if ((_e = (_d = options.options) === null || _d === void 0 ? void 0 : _d.maximum) === null || _e === void 0 ? void 0 : _e.includes('price'))
4304
+ (_f = options.options) === null || _f === void 0 ? void 0 : _f.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
4305
+ (_h = (_g = options.options) === null || _g === void 0 ? void 0 : _g.minimal) === null || _h === void 0 ? void 0 : _h.splice((_j = options.options) === null || _j === void 0 ? void 0 : _j.minimal.indexOf('price'), 1);
4306
+ (_l = (_k = options.options) === null || _k === void 0 ? void 0 : _k.maximum) === null || _l === void 0 ? void 0 : _l.splice((_m = options.options) === null || _m === void 0 ? void 0 : _m.maximum.indexOf('price'), 1);
4307
+ return _super.find.call(this, Object.assign(Object.assign({}, options), { filters: Object.assign(Object.assign({}, filters), { productId: { operator: Where.ISNULL } }), fields: [
4308
+ ...bindFields,
4309
+ ...(bindFields.includes('price')
4310
+ ? [
4311
+ 'subscriberPrice',
4312
+ 'subscriberDiscountPercentage',
4313
+ 'fullPrice',
4314
+ ]
4315
+ : []),
4316
+ ] }));
3008
4317
  });
3009
4318
  }
3010
4319
  getBySlug(slug) {
@@ -3014,9 +4323,13 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3014
4323
  filters: {
3015
4324
  slug,
3016
4325
  },
4326
+ fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
4327
+ options: {
4328
+ enableCount: false,
4329
+ },
3017
4330
  });
3018
4331
  const product = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
3019
- product.reviews = yield this.findReviewsByProduct(+product.id);
4332
+ RoundProductPricesHelper.roundProductPrices(product);
3020
4333
  return product;
3021
4334
  });
3022
4335
  }
@@ -3056,6 +4369,11 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3056
4369
  ], []);
3057
4370
  });
3058
4371
  }
4372
+ findCatalog(params, mainGender) {
4373
+ return __awaiter(this, void 0, void 0, function* () {
4374
+ return this.find(Object.assign(Object.assign({}, params), { filters: Object.assign(Object.assign({}, params.filters), { published: true }), orderBy: Object.assign(Object.assign({ hasStock: 'desc' }, (!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' })), omit(params.orderBy, ['hasStock', 'intGender'])) }));
4375
+ });
4376
+ }
3059
4377
  updateCategories(productId, { categories }) {
3060
4378
  return __awaiter(this, void 0, void 0, function* () {
3061
4379
  if ('action' in categories && categories.action === 'remove') {
@@ -3179,7 +4497,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3179
4497
  return __awaiter(this, void 0, void 0, function* () {
3180
4498
  if (!Number.isNaN(+id))
3181
4499
  return id;
3182
- const { data } = yield this.find({ filters: { firestoreId: id } });
4500
+ const { data } = yield this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3183
4501
  if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
3184
4502
  return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
3185
4503
  throw new NotFoundError(`Product with id ${id} not found`);
@@ -3235,15 +4553,31 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3235
4553
  return data && data[0] && this.bindReviewToModel(data[0]);
3236
4554
  });
3237
4555
  }
4556
+ cleanShoppingCountFromIds(ids) {
4557
+ return __awaiter(this, void 0, void 0, function* () {
4558
+ return yield this.mutation('update_product', ['affected_rows'], {
4559
+ where: {
4560
+ value: { id: { _nin: ids } },
4561
+ type: 'product_bool_exp',
4562
+ required: true,
4563
+ },
4564
+ _set: {
4565
+ value: { shopping_count: 0 },
4566
+ type: 'product_set_input',
4567
+ },
4568
+ });
4569
+ });
4570
+ }
3238
4571
  }
3239
4572
 
3240
4573
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3241
- constructor(endpoint, authOptions) {
4574
+ constructor({ endpoint, authOptions, interceptors, }) {
3242
4575
  super({
3243
4576
  tableName: 'product',
3244
4577
  model: VariantHasuraGraphQL,
3245
4578
  endpoint,
3246
4579
  authOptions,
4580
+ interceptors,
3247
4581
  fields: [
3248
4582
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
3249
4583
  { firestoreId: { columnName: 'firestore_id' } },
@@ -3273,9 +4607,9 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3273
4607
  subscriber_price: filters.subscriberPrice,
3274
4608
  }));
3275
4609
  },
3276
- bindPersistData: (priceData) => (Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) >= 0 && { price: priceData.price })), (priceData.fullPrice >= 0 && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage >= 0 && {
4610
+ bindPersistData: (priceData) => (Object.assign(Object.assign(Object.assign(Object.assign({}, (((priceData === null || priceData === void 0 ? void 0 : priceData.price) || 0) >= 0 && { price: priceData.price })), (((priceData === null || priceData === void 0 ? void 0 : priceData.fullPrice) || 0) >= 0 && { full_price: priceData.fullPrice })), (((priceData === null || priceData === void 0 ? void 0 : priceData.subscriberDiscountPercentage) || 0) >= 0 && {
3277
4611
  subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
3278
- })), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }))),
4612
+ })), (((priceData === null || priceData === void 0 ? void 0 : priceData.subscriberPrice) || 0) >= 0 && { subscriber_price: priceData.subscriberPrice }))),
3279
4613
  },
3280
4614
  },
3281
4615
  { fullPrice: { columnName: 'full_price' } },
@@ -3289,6 +4623,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3289
4623
  to: (value) => (isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity),
3290
4624
  },
3291
4625
  },
4626
+ { hasStock: { columnName: 'has_stock' } },
3292
4627
  'weight',
3293
4628
  { name: { to: () => '', from: () => undefined } },
3294
4629
  { hasVariants: { columnName: 'has_variants', to: () => false, from: () => undefined } },
@@ -3344,7 +4679,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3344
4679
  return __awaiter(this, void 0, void 0, function* () {
3345
4680
  if (!Number.isNaN(+id))
3346
4681
  return id;
3347
- const { data } = yield this.find({ filters: { firestoreId: id } });
4682
+ const { data } = yield this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3348
4683
  if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
3349
4684
  return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
3350
4685
  throw new NotFoundError(`Product with id ${id} not found`);
@@ -3352,9 +4687,256 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3352
4687
  }
3353
4688
  }
3354
4689
 
4690
+ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
4691
+ constructor({ endpoint, authOptions, interceptors, }, categoryFilterRepository) {
4692
+ super({
4693
+ tableName: 'category',
4694
+ model: Wishlist,
4695
+ endpoint,
4696
+ authOptions,
4697
+ interceptors,
4698
+ fields: [
4699
+ { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
4700
+ { firestoreId: { columnName: 'firestore_id' } },
4701
+ 'name',
4702
+ 'description',
4703
+ 'image',
4704
+ 'published',
4705
+ 'shop',
4706
+ { shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
4707
+ 'slug',
4708
+ { brandCategory: { columnName: 'brand_category' } },
4709
+ { brandCategoryBanner: { columnName: 'brand_banner' } },
4710
+ { brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
4711
+ { brandLogo: { columnName: 'brand_logo' } },
4712
+ { brandCondition: { columnName: 'brand_condition' } },
4713
+ {
4714
+ conditions: {
4715
+ columnName: 'tag_condition',
4716
+ type: HasuraGraphQLColumnType.Jsonb,
4717
+ from: (tags, row) => ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }),
4718
+ bindPersistData: (value) => {
4719
+ return {
4720
+ brand_condition: value.brand,
4721
+ tag_condition: (value === null || value === void 0 ? void 0 : value.tags) || [],
4722
+ };
4723
+ },
4724
+ bindFindFilter: (sentence) => {
4725
+ return Object.assign(Object.assign({}, (sentence.brand ? { brand_condition: sentence.brand } : {})), (sentence.tags ? { tag_condition: sentence.tags } : {}));
4726
+ },
4727
+ },
4728
+ },
4729
+ {
4730
+ filters: {
4731
+ columnName: 'filters',
4732
+ foreignKeyColumn: { filter_id: 'id' },
4733
+ fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
4734
+ bindPersistData: (value) => ({
4735
+ filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
4736
+ }),
4737
+ from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter)) || [],
4738
+ },
4739
+ },
4740
+ { createdAt: { columnName: 'created_at' } },
4741
+ { updatedAt: { columnName: 'updated_at' } },
4742
+ {
4743
+ products: {
4744
+ columnName: 'products',
4745
+ fields: ['product_id'],
4746
+ from: (value) => value.map((product) => product.product_id.toString()),
4747
+ to: (productIds) => productIds.map((productId) => ({
4748
+ product_id: +productId,
4749
+ })),
4750
+ },
4751
+ },
4752
+ {
4753
+ metadata: {
4754
+ columnName: 'metadata',
4755
+ fields: ['title', 'description'],
4756
+ bindPersistData: (value) => ({
4757
+ metadata: { data: value },
4758
+ }),
4759
+ },
4760
+ },
4761
+ { isCollection: { columnName: 'is_collection' } },
4762
+ { isWishlist: { columnName: 'is_wishlist' } },
4763
+ 'reference',
4764
+ { parentId: { columnName: 'parent_id' } },
4765
+ {
4766
+ parent: {
4767
+ columnName: 'parent',
4768
+ foreignKeyColumn: { id: 'parentId' },
4769
+ fields: ['id', 'name', 'reference', 'slug'],
4770
+ },
4771
+ },
4772
+ { personId: { columnName: 'person_id' } },
4773
+ ],
4774
+ });
4775
+ this.categoryFilterRepository = categoryFilterRepository;
4776
+ }
4777
+ create(params) {
4778
+ const _super = Object.create(null, {
4779
+ create: { get: () => super.create }
4780
+ });
4781
+ return __awaiter(this, void 0, void 0, function* () {
4782
+ const { metadata } = params, data = __rest(params, ["metadata"]);
4783
+ return _super.create.call(this, Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
4784
+ });
4785
+ }
4786
+ get(identifiers) {
4787
+ const _super = Object.create(null, {
4788
+ get: { get: () => super.get }
4789
+ });
4790
+ return __awaiter(this, void 0, void 0, function* () {
4791
+ const data = yield _super.get.call(this, identifiers);
4792
+ if (!data.isWishlist)
4793
+ throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
4794
+ return data;
4795
+ });
4796
+ }
4797
+ update(params) {
4798
+ const _super = Object.create(null, {
4799
+ update: { get: () => super.update }
4800
+ });
4801
+ return __awaiter(this, void 0, void 0, function* () {
4802
+ const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
4803
+ const plainData = this.paramsToPlain({ id: checkId });
4804
+ const id = plainData.id;
4805
+ const category = yield _super.update.call(this, Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
4806
+ category.products = products && (yield this.updateProducts(+id, { products }));
4807
+ category.metadata = metadata && (yield this.updateMetadata(+id, { metadata }));
4808
+ return category;
4809
+ });
4810
+ }
4811
+ getWishlistBySlug(slug) {
4812
+ return __awaiter(this, void 0, void 0, function* () {
4813
+ if (!slug)
4814
+ return;
4815
+ const { data } = yield this.find({
4816
+ filters: {
4817
+ slug,
4818
+ isWishlist: { operator: Where.EQUALS, value: true },
4819
+ },
4820
+ options: {
4821
+ enableCount: false,
4822
+ },
4823
+ });
4824
+ if (!data.length)
4825
+ throw new NotFoundError(`Wishlist with slug ${slug} not found`);
4826
+ if (data.length > 1)
4827
+ throw new DuplicatedResultsError('Query returned duplicated values');
4828
+ return data.shift();
4829
+ });
4830
+ }
4831
+ getWishlistByPerson(personId) {
4832
+ return __awaiter(this, void 0, void 0, function* () {
4833
+ if (!personId)
4834
+ return;
4835
+ const { data } = yield this.find({
4836
+ filters: {
4837
+ personId: { operator: Where.EQUALS, value: personId },
4838
+ isWishlist: { operator: Where.EQUALS, value: true },
4839
+ },
4840
+ options: {
4841
+ enableCount: false,
4842
+ },
4843
+ });
4844
+ if (!data.length)
4845
+ throw new NotFoundError(`Wishlists from person ${personId} not found`);
4846
+ return data;
4847
+ });
4848
+ }
4849
+ updateProducts(categoryId, { products }) {
4850
+ return __awaiter(this, void 0, void 0, function* () {
4851
+ if ('action' in products && products.action === 'remove') {
4852
+ yield this.mutation('delete_category_product', ['affected_rows'], {
4853
+ where: {
4854
+ type: 'category_product_bool_exp',
4855
+ required: true,
4856
+ value: { category_id: { _eq: categoryId } },
4857
+ },
4858
+ });
4859
+ yield this.categoryFilterRepository.deleteByCategory(categoryId);
4860
+ return [];
4861
+ }
4862
+ const plainData = this.paramsToPlain({ products });
4863
+ if (!plainData.products || plainData.products.length <= 0)
4864
+ return [];
4865
+ yield this.mutation('delete_category_product', ['affected_rows'], {
4866
+ where: {
4867
+ type: 'category_product_bool_exp',
4868
+ required: true,
4869
+ value: { category_id: { _eq: categoryId } },
4870
+ },
4871
+ });
4872
+ yield this.categoryFilterRepository.deleteByCategory(categoryId);
4873
+ yield this.mutation('insert_category_product', ['affected_rows'], {
4874
+ objects: {
4875
+ type: '[category_product_insert_input!]',
4876
+ required: true,
4877
+ value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
4878
+ },
4879
+ });
4880
+ return plainData.products;
4881
+ });
4882
+ }
4883
+ updateMetadata(categoryId, { metadata }) {
4884
+ return __awaiter(this, void 0, void 0, function* () {
4885
+ const plainData = this.paramsToPlain({ metadata });
4886
+ if (!plainData.metadata)
4887
+ return;
4888
+ yield this.mutation('update_category_metadata_by_pk', ['category_id'], {
4889
+ pk_columns: {
4890
+ value: { category_id: categoryId },
4891
+ type: 'category_metadata_pk_columns_input',
4892
+ required: true,
4893
+ },
4894
+ _set: {
4895
+ value: omit(metadata, ['category_id']),
4896
+ type: 'category_metadata_set_input',
4897
+ required: true,
4898
+ },
4899
+ });
4900
+ return plainData.metadata;
4901
+ });
4902
+ }
4903
+ getCategoryBySlug(slug, _shop) {
4904
+ return this.getWishlistBySlug(slug);
4905
+ }
4906
+ getCategoryByShop(shop) {
4907
+ return __awaiter(this, void 0, void 0, function* () {
4908
+ if (!shop)
4909
+ return;
4910
+ const { data } = yield this.find({
4911
+ filters: {
4912
+ shops: { operator: Where.IN, value: [shop] },
4913
+ published: { operator: Where.EQUALS, value: true },
4914
+ isWishlist: { operator: Where.EQUALS, value: true },
4915
+ },
4916
+ options: {
4917
+ enableCount: false,
4918
+ },
4919
+ });
4920
+ return data;
4921
+ });
4922
+ }
4923
+ getCategoriesForHome(categoryIds, limit, gender) {
4924
+ return;
4925
+ }
4926
+ mountCategory(category, options) {
4927
+ return;
4928
+ }
4929
+ getChildren(parentId) {
4930
+ return;
4931
+ }
4932
+ isChild(id, parentId) {
4933
+ return;
4934
+ }
4935
+ }
4936
+
3355
4937
  /**
3356
4938
  * Generated bundle index. Do not edit.
3357
4939
  */
3358
4940
 
3359
- export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, get, is, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
4941
+ export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
3360
4942
  //# sourceMappingURL=infrab4a-connect.mjs.map