@infrab4a/connect 4.0.0-beta.49 → 4.0.0-beta.5

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 (303) hide show
  1. package/domain/catalog/index.d.ts +0 -1
  2. package/domain/catalog/models/category.d.ts +22 -5
  3. package/domain/catalog/models/index.d.ts +0 -5
  4. package/domain/catalog/models/kit-product.d.ts +4 -4
  5. package/domain/catalog/models/product.d.ts +35 -5
  6. package/domain/catalog/models/types/category-filter.type.d.ts +4 -0
  7. package/domain/catalog/models/types/index.d.ts +1 -2
  8. package/domain/catalog/models/types/shop-description.type.d.ts +0 -1
  9. package/domain/catalog/models/variant.d.ts +2 -1
  10. package/domain/catalog/repositories/category.repository.d.ts +3 -6
  11. package/domain/catalog/repositories/index.d.ts +0 -5
  12. package/domain/catalog/repositories/product.repository.d.ts +1 -4
  13. package/domain/generic/model/base.model.d.ts +5 -9
  14. package/domain/generic/model/types/base-model-builder.type.d.ts +2 -4
  15. package/domain/generic/model/types/identifier-model.type.d.ts +5 -6
  16. package/domain/generic/model/types/model-base-structure.type.d.ts +3 -9
  17. package/domain/generic/model/types/non-function-property-name.type.d.ts +3 -12
  18. package/domain/generic/repository/find.repository.d.ts +1 -6
  19. package/domain/generic/repository/get.repository.d.ts +2 -2
  20. package/domain/generic/repository/types/repository-find-filters.type.d.ts +3 -3
  21. package/domain/generic/repository/types/repository-find-result.type.d.ts +1 -8
  22. package/domain/generic/repository/types/repository-order-by-list.type.d.ts +2 -2
  23. package/domain/generic/repository/types/repository-update-params.type.d.ts +2 -2
  24. package/domain/location/models/address.d.ts +3 -5
  25. package/domain/shop-settings/models/index.d.ts +0 -1
  26. package/domain/shop-settings/models/types/index.d.ts +1 -6
  27. package/domain/shop-settings/repositories/index.d.ts +0 -1
  28. package/domain/shopping/models/buy-2-win.d.ts +1 -3
  29. package/domain/shopping/models/checkout.d.ts +6 -5
  30. package/domain/shopping/models/coupons/coupon.d.ts +6 -34
  31. package/domain/shopping/models/index.d.ts +4 -5
  32. package/domain/shopping/models/order.d.ts +0 -1
  33. package/domain/shopping/models/shipping-method.d.ts +0 -1
  34. package/domain/shopping/models/subscription/checkout.d.ts +4 -3
  35. package/domain/shopping/repositories/index.d.ts +2 -4
  36. package/domain/users/models/lead.d.ts +0 -1
  37. package/domain/users/models/subscription/subscription.d.ts +3 -3
  38. package/domain/users/models/user-address.d.ts +2 -1
  39. package/domain/users/models/user.d.ts +3 -2
  40. package/esm2020/domain/catalog/index.mjs +1 -2
  41. package/esm2020/domain/catalog/models/category.mjs +6 -10
  42. package/esm2020/domain/catalog/models/index.mjs +1 -6
  43. package/esm2020/domain/catalog/models/kit-product.mjs +7 -7
  44. package/esm2020/domain/catalog/models/product.mjs +6 -8
  45. package/esm2020/domain/catalog/models/types/category-filter.type.mjs +2 -0
  46. package/esm2020/domain/catalog/models/types/index.mjs +2 -3
  47. package/esm2020/domain/catalog/models/types/shop-description.type.mjs +1 -1
  48. package/esm2020/domain/catalog/models/variant.mjs +4 -1
  49. package/esm2020/domain/catalog/repositories/category.repository.mjs +1 -1
  50. package/esm2020/domain/catalog/repositories/index.mjs +1 -6
  51. package/esm2020/domain/catalog/repositories/product.repository.mjs +1 -1
  52. package/esm2020/domain/generic/model/base.model.mjs +2 -3
  53. package/esm2020/domain/generic/model/types/base-model-builder.type.mjs +1 -1
  54. package/esm2020/domain/generic/model/types/identifier-model.type.mjs +1 -1
  55. package/esm2020/domain/generic/model/types/model-base-structure.type.mjs +1 -1
  56. package/esm2020/domain/generic/model/types/non-function-property-name.type.mjs +1 -1
  57. package/esm2020/domain/generic/repository/find.repository.mjs +1 -1
  58. package/esm2020/domain/generic/repository/get.repository.mjs +1 -1
  59. package/esm2020/domain/generic/repository/types/repository-find-filters.type.mjs +1 -1
  60. package/esm2020/domain/generic/repository/types/repository-find-result.type.mjs +1 -1
  61. package/esm2020/domain/generic/repository/types/repository-order-by-list.type.mjs +1 -1
  62. package/esm2020/domain/generic/repository/types/repository-update-params.type.mjs +1 -1
  63. package/esm2020/domain/location/models/address.mjs +2 -2
  64. package/esm2020/domain/shop-settings/models/index.mjs +1 -2
  65. package/esm2020/domain/shop-settings/models/types/index.mjs +2 -7
  66. package/esm2020/domain/shop-settings/repositories/index.mjs +1 -2
  67. package/esm2020/domain/shopping/models/buy-2-win.mjs +2 -2
  68. package/esm2020/domain/shopping/models/checkout.mjs +7 -6
  69. package/esm2020/domain/shopping/models/coupons/coupon.mjs +16 -16
  70. package/esm2020/domain/shopping/models/index.mjs +5 -6
  71. package/esm2020/domain/shopping/models/order.mjs +1 -1
  72. package/esm2020/domain/shopping/models/shipping-method.mjs +1 -1
  73. package/esm2020/domain/shopping/models/subscription/checkout.mjs +6 -6
  74. package/esm2020/domain/shopping/repositories/index.mjs +3 -5
  75. package/esm2020/domain/users/models/lead.mjs +1 -1
  76. package/esm2020/domain/users/models/subscription/subscription.mjs +6 -6
  77. package/esm2020/domain/users/models/user-address.mjs +1 -1
  78. package/esm2020/domain/users/models/user.mjs +2 -2
  79. package/esm2020/domain/users/use-cases/authentication.mjs +2 -2
  80. package/esm2020/infra/elasticsearch/adapters/axios.adapter.mjs +11 -28
  81. package/esm2020/infra/elasticsearch/adapters/elastic-search.adapter.mjs +1 -1
  82. package/esm2020/infra/elasticsearch/indexes/products-index.mjs +51 -63
  83. package/esm2020/infra/elasticsearch/types/elastic-search-result.mjs +1 -1
  84. package/esm2020/infra/firebase/auth/authentication-firebase-auth.service.mjs +1 -1
  85. package/esm2020/infra/firebase/firestore/mixins/with-create-firestore.mixin.mjs +4 -8
  86. package/esm2020/infra/firebase/firestore/mixins/with-crud-firestore.mixin.mjs +1 -1
  87. package/esm2020/infra/firebase/firestore/mixins/with-delete-firestore.mixin.mjs +2 -6
  88. package/esm2020/infra/firebase/firestore/mixins/with-find-firestore.mixin.mjs +8 -11
  89. package/esm2020/infra/firebase/firestore/mixins/with-firestore.mixin.mjs +4 -27
  90. package/esm2020/infra/firebase/firestore/mixins/with-get-firestore.mixin.mjs +3 -6
  91. package/esm2020/infra/firebase/firestore/mixins/with-helpers.mixin.mjs +1 -1
  92. package/esm2020/infra/firebase/firestore/mixins/with-sub-collection.mixin.mjs +3 -5
  93. package/esm2020/infra/firebase/firestore/mixins/with-update-firestore.mixin.mjs +4 -7
  94. package/esm2020/infra/firebase/firestore/repositories/catalog/category-firestore.repository.mjs +8 -21
  95. package/esm2020/infra/firebase/firestore/repositories/catalog/product-firestore.repository.mjs +7 -15
  96. package/esm2020/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.mjs +8 -10
  97. package/esm2020/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.mjs +6 -8
  98. package/esm2020/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.mjs +30 -36
  99. package/esm2020/infra/firebase/firestore/repositories/shop-settings/index.mjs +1 -2
  100. package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.mjs +6 -8
  101. package/esm2020/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.mjs +6 -8
  102. package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.mjs +6 -8
  103. package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.mjs +6 -8
  104. package/esm2020/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.mjs +6 -8
  105. package/esm2020/infra/firebase/firestore/repositories/shopping/index.mjs +4 -6
  106. package/esm2020/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.mjs +4 -6
  107. package/esm2020/infra/firebase/firestore/repositories/shopping/order-firestore.repository.mjs +9 -11
  108. package/esm2020/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.mjs +6 -8
  109. package/esm2020/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.mjs +6 -8
  110. package/esm2020/infra/firebase/firestore/repositories/users/lead-firestore.repository.mjs +6 -8
  111. package/esm2020/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.mjs +8 -10
  112. package/esm2020/infra/firebase/firestore/repositories/users/subscription-firestore.repository.mjs +6 -8
  113. package/esm2020/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.mjs +8 -10
  114. package/esm2020/infra/firebase/firestore/repositories/users/user-address-firestore.repository.mjs +8 -10
  115. package/esm2020/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.mjs +8 -10
  116. package/esm2020/infra/firebase/firestore/repositories/users/user-firestore.repository.mjs +6 -8
  117. package/esm2020/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.mjs +8 -10
  118. package/esm2020/infra/firebase/firestore/types/firestore-sub.repository.type.mjs +1 -1
  119. package/esm2020/infra/firebase/firestore/types/firestore.helpers.type.mjs +1 -1
  120. package/esm2020/infra/firebase/firestore/types/firestore.repository.type.mjs +1 -1
  121. package/esm2020/infra/firebase/firestore/types/index.mjs +3 -4
  122. package/esm2020/infra/hasura-graphql/mixins/helpers/attribute-option.helper.mjs +3 -3
  123. package/esm2020/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.mjs +5 -6
  124. package/esm2020/infra/hasura-graphql/mixins/helpers/filter-option.helper.mjs +1 -1
  125. package/esm2020/infra/hasura-graphql/mixins/helpers/graphql-field.helper.mjs +25 -36
  126. package/esm2020/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.mjs +4 -6
  127. package/esm2020/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.mjs +1 -1
  128. package/esm2020/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.mjs +3 -5
  129. package/esm2020/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.mjs +15 -84
  130. package/esm2020/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.mjs +3 -5
  131. package/esm2020/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.mjs +24 -40
  132. package/esm2020/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.mjs +5 -7
  133. package/esm2020/infra/hasura-graphql/models/product-hasura-graphql.mjs +1 -1
  134. package/esm2020/infra/hasura-graphql/models/variant-hasura-graphql.mjs +1 -1
  135. package/esm2020/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.mjs +14 -131
  136. package/esm2020/infra/hasura-graphql/repositories/catalog/index.mjs +1 -6
  137. package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +20 -70
  138. package/esm2020/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.mjs +7 -9
  139. package/esm2020/infra/hasura-graphql/types/graphql.repository.type.mjs +1 -1
  140. package/esm2020/infra/hasura-graphql/types/hasura-graphql-fields.type.mjs +1 -1
  141. package/esm2020/utils/index.mjs +4 -6
  142. package/fesm2015/infrab4a-connect.mjs +421 -1969
  143. package/fesm2015/infrab4a-connect.mjs.map +1 -1
  144. package/fesm2020/infrab4a-connect.mjs +422 -1926
  145. package/fesm2020/infrab4a-connect.mjs.map +1 -1
  146. package/infra/elasticsearch/adapters/axios.adapter.d.ts +5 -7
  147. package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +2 -3
  148. package/infra/elasticsearch/indexes/products-index.d.ts +10 -8
  149. package/infra/elasticsearch/types/elastic-search-result.d.ts +0 -2
  150. package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +2 -2
  151. package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +1 -2
  152. package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +2 -2
  153. package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +2 -2
  154. package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +4 -13
  155. package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +2 -2
  156. package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +2 -2
  157. package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +4 -8
  158. package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +3 -3
  159. package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +5 -8
  160. package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +5 -6
  161. package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +4 -3
  162. package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +4 -3
  163. package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +4 -4
  164. package/infra/firebase/firestore/repositories/shop-settings/index.d.ts +0 -1
  165. package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +4 -3
  166. package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +4 -3
  167. package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +4 -3
  168. package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +4 -3
  169. package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +4 -4
  170. package/infra/firebase/firestore/repositories/shopping/index.d.ts +3 -5
  171. package/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +4 -3
  172. package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +4 -4
  173. package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +4 -3
  174. package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +4 -3
  175. package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +4 -3
  176. package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +4 -3
  177. package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +4 -3
  178. package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +4 -3
  179. package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +4 -3
  180. package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +4 -3
  181. package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +4 -4
  182. package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +4 -3
  183. package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +3 -3
  184. package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +5 -5
  185. package/infra/firebase/firestore/types/firestore.repository.type.d.ts +1 -3
  186. package/infra/firebase/firestore/types/index.d.ts +2 -3
  187. package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +3 -9
  188. package/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.d.ts +5 -5
  189. package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +2 -4
  190. package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +5 -8
  191. package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +1 -2
  192. package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +3 -3
  193. package/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +1 -1
  194. package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +15 -23
  195. package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +6 -7
  196. package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +3 -14
  197. package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +2 -2
  198. package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +0 -4
  199. package/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +0 -1
  200. package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +5 -12
  201. package/infra/hasura-graphql/repositories/catalog/index.d.ts +0 -5
  202. package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +4 -6
  203. package/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +4 -4
  204. package/infra/hasura-graphql/types/graphql.repository.type.d.ts +5 -7
  205. package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +3 -7
  206. package/package.json +1 -2
  207. package/utils/index.d.ts +22 -5
  208. package/domain/catalog/helpers/index.d.ts +0 -1
  209. package/domain/catalog/helpers/round-product-price.helper.d.ts +0 -4
  210. package/domain/catalog/models/category-base.d.ts +0 -30
  211. package/domain/catalog/models/category-collection-children.d.ts +0 -13
  212. package/domain/catalog/models/category-filter.d.ts +0 -13
  213. package/domain/catalog/models/category-for-product.d.ts +0 -5
  214. package/domain/catalog/models/filter-option.d.ts +0 -9
  215. package/domain/catalog/models/filter.d.ts +0 -12
  216. package/domain/catalog/models/product-base.d.ts +0 -40
  217. package/domain/catalog/models/product-for-category.d.ts +0 -7
  218. package/domain/catalog/models/product-for-kit.d.ts +0 -7
  219. package/domain/catalog/models/types/category-product.d.ts +0 -4
  220. package/domain/catalog/models/types/product-evaluation.type.d.ts +0 -6
  221. package/domain/catalog/models/wishlist.d.ts +0 -6
  222. package/domain/catalog/repositories/category-collection-children.repository.d.ts +0 -4
  223. package/domain/catalog/repositories/category-filter.repository.d.ts +0 -6
  224. package/domain/catalog/repositories/filter-option.repository.d.ts +0 -4
  225. package/domain/catalog/repositories/filter.repository.d.ts +0 -4
  226. package/domain/catalog/repositories/wishlist.repository.d.ts +0 -6
  227. package/domain/shop-settings/models/shop-settings.d.ts +0 -9
  228. package/domain/shop-settings/models/types/shop-banner.type.d.ts +0 -12
  229. package/domain/shop-settings/models/types/shop-brands.type.d.ts +0 -10
  230. package/domain/shop-settings/models/types/shop-carousel.type.d.ts +0 -5
  231. package/domain/shop-settings/models/types/shop-collection.type.d.ts +0 -9
  232. package/domain/shop-settings/models/types/shop-section.type.d.ts +0 -9
  233. package/domain/shop-settings/repositories/shop-settings.repository.d.ts +0 -4
  234. package/domain/shopping/models/campaign-dashboard.d.ts +0 -15
  235. package/domain/shopping/models/campaign-hashtag.d.ts +0 -18
  236. package/domain/shopping/repositories/campaign-dashboard.repository.d.ts +0 -4
  237. package/domain/shopping/repositories/campaign-hashtag.repository.d.ts +0 -4
  238. package/esm2020/domain/catalog/helpers/index.mjs +0 -2
  239. package/esm2020/domain/catalog/helpers/round-product-price.helper.mjs +0 -15
  240. package/esm2020/domain/catalog/models/category-base.mjs +0 -18
  241. package/esm2020/domain/catalog/models/category-collection-children.mjs +0 -13
  242. package/esm2020/domain/catalog/models/category-filter.mjs +0 -19
  243. package/esm2020/domain/catalog/models/category-for-product.mjs +0 -7
  244. package/esm2020/domain/catalog/models/filter-option.mjs +0 -7
  245. package/esm2020/domain/catalog/models/filter.mjs +0 -7
  246. package/esm2020/domain/catalog/models/product-base.mjs +0 -25
  247. package/esm2020/domain/catalog/models/product-for-category.mjs +0 -14
  248. package/esm2020/domain/catalog/models/product-for-kit.mjs +0 -14
  249. package/esm2020/domain/catalog/models/types/category-product.mjs +0 -2
  250. package/esm2020/domain/catalog/models/types/product-evaluation.type.mjs +0 -2
  251. package/esm2020/domain/catalog/models/wishlist.mjs +0 -7
  252. package/esm2020/domain/catalog/repositories/category-collection-children.repository.mjs +0 -2
  253. package/esm2020/domain/catalog/repositories/category-filter.repository.mjs +0 -2
  254. package/esm2020/domain/catalog/repositories/filter-option.repository.mjs +0 -2
  255. package/esm2020/domain/catalog/repositories/filter.repository.mjs +0 -2
  256. package/esm2020/domain/catalog/repositories/wishlist.repository.mjs +0 -2
  257. package/esm2020/domain/shop-settings/models/shop-settings.mjs +0 -7
  258. package/esm2020/domain/shop-settings/models/types/shop-banner.type.mjs +0 -2
  259. package/esm2020/domain/shop-settings/models/types/shop-brands.type.mjs +0 -2
  260. package/esm2020/domain/shop-settings/models/types/shop-carousel.type.mjs +0 -2
  261. package/esm2020/domain/shop-settings/models/types/shop-collection.type.mjs +0 -2
  262. package/esm2020/domain/shop-settings/models/types/shop-section.type.mjs +0 -2
  263. package/esm2020/domain/shop-settings/repositories/shop-settings.repository.mjs +0 -2
  264. package/esm2020/domain/shopping/models/campaign-dashboard.mjs +0 -7
  265. package/esm2020/domain/shopping/models/campaign-hashtag.mjs +0 -7
  266. package/esm2020/domain/shopping/repositories/campaign-dashboard.repository.mjs +0 -2
  267. package/esm2020/domain/shopping/repositories/campaign-hashtag.repository.mjs +0 -2
  268. package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.mjs +0 -14
  269. package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.mjs +0 -14
  270. package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.mjs +0 -14
  271. package/esm2020/infra/firebase/firestore/types/firestore-interceptors.type.mjs +0 -2
  272. package/esm2020/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.mjs +0 -39
  273. package/esm2020/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.mjs +0 -107
  274. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.mjs +0 -105
  275. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.mjs +0 -22
  276. package/esm2020/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.mjs +0 -236
  277. package/esm2020/utils/decorators/debug.class.decorator.mjs +0 -7
  278. package/esm2020/utils/decorators/index.mjs +0 -3
  279. package/esm2020/utils/decorators/trace.method.decorator.mjs +0 -81
  280. package/esm2020/utils/helpers/class-name.helper.mjs +0 -15
  281. package/esm2020/utils/helpers/debug-decorator.helper.mjs +0 -18
  282. package/esm2020/utils/helpers/debug.helper.mjs +0 -150
  283. package/esm2020/utils/helpers/index.mjs +0 -5
  284. package/esm2020/utils/helpers/reflect.helper.mjs +0 -165
  285. package/esm2020/utils/log.utils.mjs +0 -9
  286. package/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +0 -7
  287. package/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +0 -8
  288. package/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +0 -8
  289. package/infra/firebase/firestore/types/firestore-interceptors.type.d.ts +0 -14
  290. package/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.d.ts +0 -10
  291. package/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +0 -12
  292. package/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +0 -18
  293. package/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +0 -10
  294. package/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +0 -27
  295. package/utils/decorators/debug.class.decorator.d.ts +0 -2
  296. package/utils/decorators/index.d.ts +0 -2
  297. package/utils/decorators/trace.method.decorator.d.ts +0 -14
  298. package/utils/helpers/class-name.helper.d.ts +0 -3
  299. package/utils/helpers/debug-decorator.helper.d.ts +0 -9
  300. package/utils/helpers/debug.helper.d.ts +0 -60
  301. package/utils/helpers/index.d.ts +0 -4
  302. package/utils/helpers/reflect.helper.d.ts +0 -50
  303. package/utils/log.utils.d.ts +0 -7
@@ -3,21 +3,19 @@ import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transforme
3
3
  import { __decorate, __metadata } 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 { 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';
6
+ import * as lodash from 'lodash';
7
+ import { get as get$1, isString as isString$1 } from 'lodash';
10
8
  import { CustomError } from 'ts-custom-error';
11
9
  import axios from 'axios';
12
10
  import { collection, getDoc, doc, where, orderBy, getDocs, query, startAfter, startAt, limit, addDoc, setDoc, deleteField, arrayUnion, arrayRemove, deleteDoc, Timestamp } from 'firebase/firestore';
13
11
  import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
14
12
  import { mutation, query as query$1 } from 'gql-query-builder';
13
+ import fetch from 'node-fetch';
15
14
 
16
15
  class BaseModel {
17
16
  get identifier() {
18
17
  const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
19
- const data = this;
20
- return fields.reduce((object, field) => ({ ...object, [field]: data[field] }), {});
18
+ return fields.reduce((object, field) => ({ ...object, [field]: this[field] }), {});
21
19
  }
22
20
  get identifiersFields() {
23
21
  return this.constructor.identifiersFields;
@@ -463,437 +461,11 @@ __decorate([
463
461
  __metadata("design:type", Payment)
464
462
  ], SubscriptionPayment.prototype, "payment", void 0);
465
463
 
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();
803
- }
804
- puts(...args) {
805
- return [`[${this.namespace}]`, ...args].join(' ');
464
+ class Address extends BaseModel {
465
+ static get identifiersFields() {
466
+ return ['id'];
806
467
  }
807
468
  }
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({ 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
- };
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
- };
897
469
 
898
470
  const get = (object, path, defaultValue) => get$1(object, path, defaultValue);
899
471
 
@@ -901,7 +473,7 @@ function is(value) {
901
473
  return value;
902
474
  }
903
475
 
904
- const isUUID = (value) => isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
476
+ const isUUID = (value) => isString$1(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
905
477
 
906
478
  class Base {
907
479
  constructor(...args) {
@@ -910,7 +482,7 @@ class Base {
910
482
  }
911
483
 
912
484
  const parseDateTime = (value) => {
913
- if (!isString(value))
485
+ if (!isString$1(value))
914
486
  return value;
915
487
  if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
916
488
  !/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T\d{2}:\d{2}:\d{2}/.test(value))
@@ -921,6 +493,8 @@ const parseDateTime = (value) => {
921
493
  return date;
922
494
  };
923
495
 
496
+ const { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN: isNaN$1, isNil, isNumber, isObject, isString, now, omit, pick, set, } = lodash;
497
+
924
498
  var CheckoutTypes;
925
499
  (function (CheckoutTypes) {
926
500
  CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
@@ -965,28 +539,26 @@ class Coupon extends BaseModel {
965
539
  static createCoupon(userId) {
966
540
  return this.toInstance({
967
541
  nickname: `${Date.now()}`,
542
+ type: CouponTypes.ABSOLUTE,
968
543
  checkoutType: CheckoutTypes.ECOMMERCE,
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
- },
544
+ discount: 30,
983
545
  user: userId,
546
+ useLimit: 1,
547
+ useLimitPerUser: true,
984
548
  createdAt: new Date(Date.now()),
985
549
  beginAt: new Date(Date.now()),
986
550
  expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
987
551
  });
988
552
  }
989
553
  }
554
+ __decorate([
555
+ Expose({ name: 'checkout_type' }),
556
+ __metadata("design:type", Number)
557
+ ], Coupon.prototype, "checkoutType", void 0);
558
+ __decorate([
559
+ Expose({ name: 'exclusivity_type' }),
560
+ __metadata("design:type", Number)
561
+ ], Coupon.prototype, "exclusivityType", void 0);
990
562
 
991
563
  class SubscriptionPlan extends BaseModel {
992
564
  static get identifiersFields() {
@@ -1026,18 +598,6 @@ __decorate([
1026
598
  __metadata("design:type", BeautyProfile)
1027
599
  ], User.prototype, "beautyProfile", void 0);
1028
600
 
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
-
1041
601
  class Subscription extends BaseModel {
1042
602
  static get identifiersFields() {
1043
603
  return ['id'];
@@ -1052,12 +612,12 @@ __decorate([
1052
612
  __metadata("design:type", SubscriptionPlan)
1053
613
  ], Subscription.prototype, "subscriptionPlan", void 0);
1054
614
  __decorate([
1055
- Type(() => UserAddress),
1056
- __metadata("design:type", UserAddress)
615
+ Type(() => Address),
616
+ __metadata("design:type", Address)
1057
617
  ], Subscription.prototype, "shippingAddress", void 0);
1058
618
  __decorate([
1059
- Type(() => UserAddress),
1060
- __metadata("design:type", UserAddress)
619
+ Type(() => Address),
620
+ __metadata("design:type", Address)
1061
621
  ], Subscription.prototype, "billingAddress", void 0);
1062
622
  __decorate([
1063
623
  Type(() => Coupon),
@@ -1072,6 +632,12 @@ __decorate([
1072
632
  __metadata("design:type", Array)
1073
633
  ], Subscription.prototype, "payment", void 0);
1074
634
 
635
+ class UserAddress extends Address {
636
+ static get identifiersFields() {
637
+ return ['id', 'userId'];
638
+ }
639
+ }
640
+
1075
641
  class UserPaymentMethod extends BaseModel {
1076
642
  static get identifiersFields() {
1077
643
  return ['id', 'userId'];
@@ -1103,7 +669,7 @@ class Authentication {
1103
669
  async signIn({ email, password }, signInMethod) {
1104
670
  const method = this.getServiceByMethod(signInMethod);
1105
671
  const userAuth = await this.authService[method]({ email, password });
1106
- const user = this.userRepository.get({ id: userAuth.id });
672
+ const user = this.userRepository.get(userAuth);
1107
673
  if (!isNil(user))
1108
674
  return user;
1109
675
  if (/^.+@b4a.com.br$/.test(userAuth.email))
@@ -1196,123 +762,14 @@ class RecoveryPassword {
1196
762
  }
1197
763
  }
1198
764
 
1199
- class Filter extends BaseModel {
1200
- static get identifiersFields() {
765
+ class Category extends BaseModel {
766
+ identifierFields() {
1201
767
  return ['id'];
1202
768
  }
1203
- }
1204
-
1205
- class CategoryBase extends BaseModel {
1206
769
  static get identifiersFields() {
1207
770
  return ['id'];
1208
771
  }
1209
772
  }
1210
- __decorate([
1211
- Type(() => CategoryBase),
1212
- __metadata("design:type", CategoryBase)
1213
- ], CategoryBase.prototype, "parent", void 0);
1214
- __decorate([
1215
- Type(() => Filter),
1216
- __metadata("design:type", Array)
1217
- ], CategoryBase.prototype, "filters", void 0);
1218
-
1219
- class CategoryForProduct extends CategoryBase {
1220
- static get identifiersFields() {
1221
- return ['id'];
1222
- }
1223
- }
1224
-
1225
- class ProductBase extends BaseModel {
1226
- get evaluation() {
1227
- return {
1228
- reviews: this.reviews,
1229
- count: this.reviewsTotal,
1230
- rating: this.rate,
1231
- };
1232
- }
1233
- set evaluation(evaluation) {
1234
- if (!evaluation) {
1235
- this.reviews = null;
1236
- this.reviewsTotal = null;
1237
- this.rate = null;
1238
- return;
1239
- }
1240
- this.reviews = evaluation.reviews || this.reviews;
1241
- this.reviewsTotal = evaluation.count || this.reviewsTotal;
1242
- this.rate = evaluation.rating || this.rate;
1243
- }
1244
- static get identifiersFields() {
1245
- return ['id'];
1246
- }
1247
- }
1248
-
1249
- class ProductForKit extends ProductBase {
1250
- static get identifiersFields() {
1251
- return ['id'];
1252
- }
1253
- }
1254
- __decorate([
1255
- Type(() => CategoryForProduct),
1256
- __metadata("design:type", CategoryForProduct)
1257
- ], ProductForKit.prototype, "category", void 0);
1258
-
1259
- class KitProduct extends BaseModel {
1260
- static get identifiersFields() {
1261
- return ['productId', 'kitProductId'];
1262
- }
1263
- }
1264
- __decorate([
1265
- Type(() => ProductForKit),
1266
- __metadata("design:type", ProductForKit)
1267
- ], KitProduct.prototype, "kit", void 0);
1268
- __decorate([
1269
- Type(() => ProductForKit),
1270
- __metadata("design:type", ProductForKit)
1271
- ], KitProduct.prototype, "product", void 0);
1272
-
1273
- class ProductForCategory extends ProductBase {
1274
- static get identifiersFields() {
1275
- return ['id'];
1276
- }
1277
- }
1278
- __decorate([
1279
- Type(() => KitProduct),
1280
- __metadata("design:type", Array)
1281
- ], ProductForCategory.prototype, "kitProducts", void 0);
1282
-
1283
- class Category extends CategoryBase {
1284
- static get identifiersFields() {
1285
- return ['id'];
1286
- }
1287
- }
1288
- __decorate([
1289
- Type(() => ProductForCategory),
1290
- __metadata("design:type", Array)
1291
- ], Category.prototype, "childrenProducts", void 0);
1292
-
1293
- class CategoryCollectionChildren extends BaseModel {
1294
- static get identifiersFields() {
1295
- return ['collectionId', 'categoryId'];
1296
- }
1297
- }
1298
- __decorate([
1299
- Type(() => CategoryCollectionChildren),
1300
- __metadata("design:type", CategoryCollectionChildren)
1301
- ], CategoryCollectionChildren.prototype, "parent", void 0);
1302
-
1303
- class CategoryFilter extends BaseModel {
1304
- static get identifiersFields() {
1305
- return ['id'];
1306
- }
1307
- }
1308
- __decorate([
1309
- Type(() => Filter),
1310
- __metadata("design:type", Filter)
1311
- ], CategoryFilter.prototype, "filter", void 0);
1312
- __decorate([
1313
- Type(() => Category),
1314
- __metadata("design:type", Category)
1315
- ], CategoryFilter.prototype, "category", void 0);
1316
773
 
1317
774
  var GenderDestination;
1318
775
  (function (GenderDestination) {
@@ -1329,60 +786,54 @@ var Shops;
1329
786
  Shops["ALL"] = "ALL";
1330
787
  })(Shops || (Shops = {}));
1331
788
 
1332
- class FilterOption extends BaseModel {
1333
- static get identifiersFields() {
789
+ class Product extends BaseModel {
790
+ identifierFields() {
1334
791
  return ['id'];
1335
792
  }
1336
- }
1337
-
1338
- class Product extends ProductBase {
1339
793
  static get identifiersFields() {
1340
794
  return ['id'];
1341
795
  }
1342
796
  }
1343
- __decorate([
1344
- Type(() => CategoryForProduct),
1345
- __metadata("design:type", CategoryForProduct)
1346
- ], Product.prototype, "category", void 0);
1347
797
  __decorate([
1348
798
  Type(() => KitProduct),
1349
799
  __metadata("design:type", Array)
1350
800
  ], Product.prototype, "kitProducts", void 0);
1351
801
 
1352
- class Variant extends BaseModel {
1353
- static get identifiersFields() {
1354
- return ['id', 'productId'];
1355
- }
1356
- }
1357
-
1358
- class Wishlist extends Category {
1359
- static get identifiersFields() {
1360
- return ['id'];
1361
- }
1362
- }
1363
-
1364
- class Buy2Win extends BaseModel {
802
+ class KitProduct extends BaseModel {
1365
803
  static get identifiersFields() {
1366
- return ['id'];
804
+ return ['productId', 'kitProducId'];
1367
805
  }
1368
806
  }
1369
807
  __decorate([
1370
- Type(() => Category),
1371
- __metadata("design:type", Array)
1372
- ], Buy2Win.prototype, "categories", void 0);
808
+ Type(() => Product),
809
+ __metadata("design:type", Product)
810
+ ], KitProduct.prototype, "kit", void 0);
811
+ __decorate([
812
+ Type(() => Product),
813
+ __metadata("design:type", Product)
814
+ ], KitProduct.prototype, "product", void 0);
1373
815
 
1374
- class CampaignDashboard extends BaseModel {
1375
- static get identifiersFields() {
816
+ class Variant extends BaseModel {
817
+ identifierFields() {
1376
818
  return ['id'];
1377
819
  }
1378
- }
1379
-
1380
- class CampaignHashtag extends BaseModel {
1381
820
  static get identifiersFields() {
1382
- return ['id'];
821
+ return ['id', 'productId'];
1383
822
  }
1384
823
  }
1385
824
 
825
+ var OrderStatus;
826
+ (function (OrderStatus) {
827
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
828
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
829
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
830
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
831
+ OrderStatus["ENVIADO"] = "Enviado";
832
+ OrderStatus["ENTREGUE"] = "Entregue";
833
+ OrderStatus["CANCELADO"] = "Cancelado";
834
+ OrderStatus["CREDIT_CARD"] = "credit_card";
835
+ })(OrderStatus || (OrderStatus = {}));
836
+
1386
837
  class LineItem extends Product {
1387
838
  }
1388
839
 
@@ -1406,12 +857,12 @@ __decorate([
1406
857
  __metadata("design:type", User)
1407
858
  ], Checkout.prototype, "user", void 0);
1408
859
  __decorate([
1409
- Type(() => UserAddress),
1410
- __metadata("design:type", UserAddress)
860
+ Type(() => Address),
861
+ __metadata("design:type", Address)
1411
862
  ], Checkout.prototype, "shippingAddress", void 0);
1412
863
  __decorate([
1413
- Type(() => UserAddress),
1414
- __metadata("design:type", UserAddress)
864
+ Type(() => Address),
865
+ __metadata("design:type", Address)
1415
866
  ], Checkout.prototype, "billingAddress", void 0);
1416
867
  __decorate([
1417
868
  Type(() => ShippingMethod),
@@ -1422,18 +873,6 @@ __decorate([
1422
873
  __metadata("design:type", Coupon)
1423
874
  ], Checkout.prototype, "coupon", void 0);
1424
875
 
1425
- var OrderStatus;
1426
- (function (OrderStatus) {
1427
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
1428
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
1429
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
1430
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
1431
- OrderStatus["ENVIADO"] = "Enviado";
1432
- OrderStatus["ENTREGUE"] = "Entregue";
1433
- OrderStatus["CANCELADO"] = "Cancelado";
1434
- OrderStatus["CREDIT_CARD"] = "credit_card";
1435
- })(OrderStatus || (OrderStatus = {}));
1436
-
1437
876
  class Order extends Checkout {
1438
877
  }
1439
878
  __decorate([
@@ -1447,12 +886,12 @@ class CheckoutSubscription extends BaseModel {
1447
886
  }
1448
887
  }
1449
888
  __decorate([
1450
- Type(() => UserAddress),
1451
- __metadata("design:type", UserAddress)
889
+ Type(() => Address),
890
+ __metadata("design:type", Address)
1452
891
  ], CheckoutSubscription.prototype, "shippingAddress", void 0);
1453
892
  __decorate([
1454
- Type(() => UserAddress),
1455
- __metadata("design:type", UserAddress)
893
+ Type(() => Address),
894
+ __metadata("design:type", Address)
1456
895
  ], CheckoutSubscription.prototype, "billingAddress", void 0);
1457
896
  __decorate([
1458
897
  Type(() => SubscriptionPlan),
@@ -1463,19 +902,15 @@ __decorate([
1463
902
  __metadata("design:type", Coupon)
1464
903
  ], CheckoutSubscription.prototype, "coupon", void 0);
1465
904
 
1466
- class RoundProductPricesHelper {
1467
- static roundProductPrices(product) {
1468
- product.price.price = Number(product.price.price.toFixed(2));
1469
- product.price.fullPrice = Number(product.price.fullPrice.toFixed(2));
1470
- if (product.price.subscriberPrice) {
1471
- product.price.subscriberPrice = Number(product.price.subscriberPrice.toFixed(2));
1472
- }
1473
- if (product instanceof LineItem && product.pricePaid) {
1474
- product.pricePaid = Number(product.pricePaid.toFixed(2));
1475
- }
1476
- return product;
905
+ class Buy2Win extends BaseModel {
906
+ static get identifiersFields() {
907
+ return ['id'];
1477
908
  }
1478
909
  }
910
+ __decorate([
911
+ Type(() => Category),
912
+ __metadata("design:type", Array)
913
+ ], Buy2Win.prototype, "categories", void 0);
1479
914
 
1480
915
  var FilterType;
1481
916
  (function (FilterType) {
@@ -1576,12 +1011,6 @@ class ShopMenu extends BaseModel {
1576
1011
  }
1577
1012
  }
1578
1013
 
1579
- class ShopSettings extends BaseModel {
1580
- static get identifiersFields() {
1581
- return ['id'];
1582
- }
1583
- }
1584
-
1585
1014
  class InvalidArgumentError extends CustomError {
1586
1015
  constructor(message) {
1587
1016
  super(message);
@@ -1612,16 +1041,12 @@ class AxiosAdapter {
1612
1041
  constructor(config) {
1613
1042
  this.config = config;
1614
1043
  }
1615
- async get(index, id) {
1044
+ async get(index) {
1616
1045
  try {
1617
1046
  const { data } = await axios({
1618
- url: `${this.config.url}/${index}/_doc/${id}`,
1047
+ url: `${this.config.url}/${index}`,
1619
1048
  method: 'GET',
1620
- responseType: 'json',
1621
- headers: {
1622
- 'Content-Type': 'application/json',
1623
- Authorization: `ApiKey ${this.config.credential}`,
1624
- },
1049
+ headers: { Authorization: `Basic ${this.config.credential}` },
1625
1050
  });
1626
1051
  return data._source;
1627
1052
  }
@@ -1633,14 +1058,9 @@ class AxiosAdapter {
1633
1058
  }
1634
1059
  async query(index, query) {
1635
1060
  const { data } = await axios({
1636
- url: `${this.config.url}/${index}/_search`,
1061
+ url: `${this.config.url}/${index}`,
1637
1062
  method: 'POST',
1638
- responseType: 'json',
1639
- headers: {
1640
- Accept: 'application/vnd.elasticsearch+json;compatible-with=7',
1641
- 'Content-Type': 'application/vnd.elasticsearch+json;compatible-with=7',
1642
- Authorization: `ApiKey ${this.config.credential}`,
1643
- },
1063
+ headers: { Authorization: `Basic ${this.config.credential}` },
1644
1064
  data: query,
1645
1065
  });
1646
1066
  return {
@@ -1650,25 +1070,17 @@ class AxiosAdapter {
1650
1070
  }
1651
1071
  async save(index, data) {
1652
1072
  await axios({
1653
- url: `${this.config.url}/${index}/_doc`,
1654
- method: 'POST',
1655
- headers: { Authorization: `ApiKey ${this.config.credential}` },
1656
- data,
1657
- });
1658
- }
1659
- async update(index, id, data) {
1660
- await axios({
1661
- url: `${this.config.url}/${index}/_update/${id}`,
1073
+ url: `${this.config.url}/${index}`,
1662
1074
  method: 'PUT',
1663
- headers: { Authorization: `ApiKey ${this.config.credential}` },
1075
+ headers: { Authorization: `Basic ${this.config.credential}` },
1664
1076
  data,
1665
1077
  });
1666
1078
  }
1667
- async delete(index, id) {
1079
+ async delete(index) {
1668
1080
  await axios({
1669
- url: `${this.config.url}/${index}/_doc/${id}`,
1081
+ url: `${this.config.url}/${index}`,
1670
1082
  method: 'DELETE',
1671
- headers: { Authorization: `ApiKey ${this.config.credential}` },
1083
+ headers: { Authorization: `Basic ${this.config.credential}` },
1672
1084
  });
1673
1085
  }
1674
1086
  }
@@ -1676,16 +1088,13 @@ class AxiosAdapter {
1676
1088
  class ProductsIndex {
1677
1089
  constructor(adapter) {
1678
1090
  this.adapter = adapter;
1679
- this.index = `products`;
1680
1091
  }
1681
- async getById(id) {
1682
- const data = await this.adapter.get(this.index, id);
1092
+ async get(id) {
1093
+ const data = await this.adapter.get(`products/_doc/${id}`);
1683
1094
  return Product.toInstance(data);
1684
1095
  }
1685
- async search(searchTerm, total, shop) {
1686
- const size = total || 9;
1096
+ async findById(ids, options) {
1687
1097
  const fields = [
1688
- 'EAN',
1689
1098
  'brand',
1690
1099
  'id',
1691
1100
  'images',
@@ -1696,82 +1105,73 @@ class ProductsIndex {
1696
1105
  'stock',
1697
1106
  'slug',
1698
1107
  'reviews',
1108
+ 'pricePaid',
1109
+ 'isGift',
1110
+ 'stock',
1111
+ 'weight',
1112
+ 'tags',
1699
1113
  'hasVariants',
1700
- 'rate',
1114
+ 'type',
1701
1115
  ];
1702
- const filter = [{ term: { published: true } }];
1703
- if (size > 9) {
1704
- fields.push(...['pricePaid', 'isGift', 'stock', 'weight', 'tags']);
1705
- }
1706
- else {
1707
- filter.push({ term: { tags: shop == Shops.GLAMSHOP ? 'feminino' : 'masculino' } });
1708
- }
1709
- const search = await this.adapter.query(this.index, {
1710
- size,
1116
+ const { hits } = await this.adapter.query('products/_search', {
1711
1117
  _source: fields,
1712
1118
  query: {
1713
1119
  bool: {
1714
- must: {
1715
- multi_match: {
1716
- query: `${searchTerm}`,
1717
- type: 'bool_prefix',
1718
- fields: [
1719
- 'name',
1720
- 'name.folded',
1721
- 'name.search',
1722
- 'description',
1723
- 'description.search',
1724
- 'description.folded',
1725
- 'brand',
1726
- 'brand.search',
1727
- 'brand.folded',
1728
- ],
1729
- fuzziness: 2,
1120
+ filter: [
1121
+ {
1122
+ terms: {
1123
+ _id: ids,
1124
+ },
1730
1125
  },
1731
- },
1732
- should: {
1733
- match_phrase_prefix: {
1734
- 'name.search': {
1735
- query: `${searchTerm}`,
1736
- slop: 10,
1126
+ {
1127
+ term: {
1128
+ published: true,
1737
1129
  },
1738
1130
  },
1739
- },
1740
- filter,
1131
+ ...(options?.hasStock
1132
+ ? [
1133
+ {
1134
+ range: {
1135
+ 'stock.quantity': {
1136
+ gt: 0,
1137
+ },
1138
+ },
1139
+ },
1140
+ ]
1141
+ : []),
1142
+ ],
1741
1143
  },
1742
1144
  },
1145
+ ...(options?.size ? { size: options?.size } : {}),
1743
1146
  });
1744
- search.hits = search.hits
1745
- .filter((e) => e._source.name !== '')
1746
- .map((hit) => {
1747
- RoundProductPricesHelper.roundProductPrices(hit._source);
1748
- return hit;
1749
- });
1750
- return search;
1147
+ return hits.map((hit) => Product.toInstance(hit._source));
1751
1148
  }
1752
1149
  async save(product) {
1150
+ delete product.createdAt;
1151
+ delete product.updatedAt;
1152
+ delete product.kitProducts;
1753
1153
  try {
1754
- const { createdAt, updatedAt, kitProducts, ...data } = product;
1755
- this.adapter.save(this.index, data);
1756
- }
1757
- catch (error) {
1758
- console.error(error);
1759
- }
1760
- }
1761
- async update(product) {
1762
- try {
1763
- await this.adapter.update(this.index, product.id, product);
1154
+ if (!product.firestoreId)
1155
+ throw new Error('Is not a product from firestore');
1156
+ await this.get(product.firestoreId);
1157
+ await this.adapter.save(`products/_doc/${product.firestoreId}`, product.toPlain());
1764
1158
  }
1765
1159
  catch (error) {
1766
- console.error(error);
1160
+ if (!(error instanceof Error))
1161
+ throw error;
1162
+ console.error(error.message);
1163
+ await this.adapter.save(`products/_doc/${product.id}`, product.toPlain());
1767
1164
  }
1768
1165
  }
1769
- async delete(id) {
1166
+ async delete(product) {
1167
+ if (!product.firestoreId)
1168
+ return;
1770
1169
  try {
1771
- await this.adapter.delete(this.index, id);
1170
+ await this.get(product.firestoreId);
1171
+ await this.adapter.delete(`products/_doc/${product.firestoreId}`);
1772
1172
  }
1773
1173
  catch (error) {
1774
- console.error(error);
1174
+ await this.adapter.delete(`products/_doc/${product.id}`);
1775
1175
  }
1776
1176
  }
1777
1177
  }
@@ -1799,41 +1199,19 @@ const withFirestore = (MixinBase) => {
1799
1199
  : Array.isArray(data[key])
1800
1200
  ? data[key].map((element) => (isObjectsAndNoDate(element) ? bindAllDateFromObject(element) : element))
1801
1201
  : bindDate(data[key], key),
1802
- }), {});
1803
- };
1804
- const omitByRecursivelyInPlace = (value, iteratee) => {
1805
- each(value, (v, k) => {
1806
- if (iteratee(v, k)) {
1807
- unset(value, k);
1808
- }
1809
- else if (isObject(v)) {
1810
- omitByRecursivelyInPlace(v, iteratee);
1811
- }
1812
- });
1813
- return value;
1202
+ }), {});
1814
1203
  };
1815
1204
  return class extends MixinBase {
1816
- constructor(...params) {
1817
- super(...params);
1818
- this.fields = {};
1819
- this.interceptors = {};
1205
+ constructor() {
1206
+ super(...arguments);
1820
1207
  this.collectionName = '';
1821
- const options = params[0];
1822
- this.firestore = options.firestore;
1823
- this.collectionName = options.collectionName;
1824
- this.model = options.model;
1825
- this.fields = options.fields;
1826
- this.interceptors = options.interceptors;
1827
1208
  }
1828
1209
  collection(path) {
1829
1210
  return collection(this.firestore, path || this.collectionName).withConverter(this.buildModelInstance());
1830
1211
  }
1831
1212
  buildModelInstance() {
1832
1213
  return {
1833
- toFirestore: (data) => {
1834
- const plain = data?.toPlain ? data.toPlain() : data;
1835
- return omitByRecursivelyInPlace(plain, (value) => value === undefined);
1836
- },
1214
+ toFirestore: (data) => (data?.toPlain ? data.toPlain() : data),
1837
1215
  fromFirestore: (snap) => {
1838
1216
  const data = snap.data();
1839
1217
  let bindedData = null;
@@ -1873,14 +1251,11 @@ const withHelpers = (MixinBase) => {
1873
1251
  const withGetFirestore = (MixinBase) => {
1874
1252
  return class GetFirestore extends MixinBase {
1875
1253
  async get(identifiers) {
1876
- const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => ({ ...acc, [field]: identifiers[field] }), {}));
1877
- const intercepted = await this.interceptors?.request?.({ instance });
1878
- const builded = intercepted?.instance || instance;
1879
- const docRef = await getDoc(doc(await this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(builded.identifier).shift().toString()));
1254
+ const docRef = await getDoc(doc(await this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(identifiers).shift().toString()));
1880
1255
  const data = docRef.data();
1881
1256
  if (isNil(data))
1882
1257
  throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
1883
- return this.interceptors?.response?.(data, intercepted) || data;
1258
+ return data;
1884
1259
  }
1885
1260
  buildCollectionPathForGet(identifiers) {
1886
1261
  return this.isSubCollection(this)
@@ -1917,7 +1292,7 @@ const withFindFirestore = (MixinBase) => {
1917
1292
  ], []);
1918
1293
  this.buildWhereSentence = (fieldName, options) => {
1919
1294
  if (this.isSubCollection(this) && fieldName === this.parentIdField)
1920
- return [];
1295
+ [];
1921
1296
  const value = options?.value || options;
1922
1297
  const object = {};
1923
1298
  set(object, fieldName, value);
@@ -1961,11 +1336,8 @@ const withFindFirestore = (MixinBase) => {
1961
1336
  return Object.keys(fieldsToOrderBy).map((fieldName) => orderBy(fieldName, fieldsToOrderBy[fieldName]));
1962
1337
  };
1963
1338
  }
1964
- async find(find = {}) {
1965
- const collection = this.collection(this.buildCollectionPathForFind(find.filters));
1966
- const enableCount = find?.options?.enableCount ?? true;
1967
- const intercepted = await this.interceptors?.request?.({ find });
1968
- const { filters, limits, orderBy } = intercepted.find || find;
1339
+ async find({ filters, limits, orderBy, } = {}) {
1340
+ const collection = this.collection(this.buildCollectionPathForFind(filters));
1969
1341
  const queries = this.makeFirestoreWhere(filters || {});
1970
1342
  const ordination = this.makeFirestoreOrderBy(filters, orderBy);
1971
1343
  const offsets = await this.defineLimits(filters, limits);
@@ -1973,8 +1345,8 @@ const withFindFirestore = (MixinBase) => {
1973
1345
  const docs = await getDocs(query(collection, ...queryArgumments));
1974
1346
  const data = docs.docs.map((doc) => doc.data());
1975
1347
  return {
1976
- data: (await this.interceptors?.response?.(data, intercepted)) || data,
1977
- count: enableCount ? this.calculateCount(data, limits) : Infinity,
1348
+ data,
1349
+ count: this.calculateCount(data, limits),
1978
1350
  };
1979
1351
  }
1980
1352
  buildCollectionPathForFind(filters) {
@@ -1988,7 +1360,7 @@ const withFindFirestore = (MixinBase) => {
1988
1360
  const queries = [];
1989
1361
  if (limits?.offset) {
1990
1362
  if (this.model.isModel(limits.offset))
1991
- queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), Object.values(limits.offset.identifier).shift()?.toString()))));
1363
+ queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), limits.offset.identifier.shift()))));
1992
1364
  else if (isNumber(limits.offset) || isString(limits.offset))
1993
1365
  queries.push(startAt(limits.offset));
1994
1366
  }
@@ -2009,16 +1381,12 @@ const withFindFirestore = (MixinBase) => {
2009
1381
  const withCreateFirestore = (MixinBase) => {
2010
1382
  return class CreateFirestore extends MixinBase {
2011
1383
  async create(data) {
2012
- const instance = this.model.toInstance(data);
2013
- const intercepted = await this.interceptors?.request?.({ instance });
2014
- const builded = intercepted?.instance || instance;
2015
- const docRef = await this.save(builded);
1384
+ const docRef = await this.save(this.model.toInstance(data));
2016
1385
  const doc = await getDoc(docRef);
2017
- const docBuilded = (await this.interceptors?.response?.(doc.data(), intercepted)) || doc.data();
2018
- return docBuilded;
1386
+ return doc.data();
2019
1387
  }
2020
1388
  async save(data) {
2021
- const id = Object.values(data.identifier)?.shift()?.toString();
1389
+ const id = data.identifier[data.identifiersFields?.shift()]?.toString();
2022
1390
  const collectionPath = this.buildCollectionPathForAdd(data);
2023
1391
  const collection = this.collection(collectionPath);
2024
1392
  if (isEmpty(id))
@@ -2059,12 +1427,9 @@ const withUpdateFirestore = (MixinBase) => {
2059
1427
  const model = new this.model();
2060
1428
  const keyField = model.identifiersFields.shift();
2061
1429
  const docRef = doc(this.collection(this.buildCollectionPathForUpdate(data)), getValueFromParams(data, keyField).toString());
2062
- const plainFromData = this.model.toInstance(this.paramsToPlain(data));
2063
- const intercepted = await this.interceptors?.request?.({ instance: plainFromData });
2064
- const builded = intercepted?.instance || plainFromData;
2065
- await setDoc(docRef, builded.toPlain(), { merge: true });
2066
- const docData = await getDoc(docRef).then((doc) => doc.data());
2067
- return this.interceptors?.response?.(docData, intercepted) || docData;
1430
+ await setDoc(docRef, this.paramsToPlain(data), { merge: true });
1431
+ const docData = await getDoc(docRef);
1432
+ return docData.data();
2068
1433
  }
2069
1434
  buildCollectionPathForUpdate(identifiers) {
2070
1435
  return this.isSubCollection(this)
@@ -2086,11 +1451,7 @@ const withUpdateFirestore = (MixinBase) => {
2086
1451
  const withDeleteFirestore = (MixinBase) => {
2087
1452
  return class DeleteFirestore extends MixinBase {
2088
1453
  async delete(identifiers) {
2089
- const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => ({ ...acc, [field]: identifiers[field] }), {}));
2090
- const intercepted = await this.interceptors?.request?.({ instance });
2091
- const builded = intercepted?.instance || instance;
2092
- await deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(builded.identifier).shift().toString()));
2093
- await this.interceptors?.response?.(instance, intercepted);
1454
+ await deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(identifiers).shift().toString()));
2094
1455
  }
2095
1456
  buildCollectionPathForRemove(identifiers) {
2096
1457
  return this.isSubCollection(this)
@@ -2102,10 +1463,8 @@ const withDeleteFirestore = (MixinBase) => {
2102
1463
 
2103
1464
  const withSubCollection = (MixinBase, ParentModel) => {
2104
1465
  return class SubCollectionMix extends MixinBase {
2105
- constructor(...params) {
2106
- const options = params[0];
2107
- super(...params);
2108
- this.parentIdField = options.parentIdField;
1466
+ constructor(...args) {
1467
+ super(args);
2109
1468
  }
2110
1469
  collection(path) {
2111
1470
  return super.collection(path);
@@ -2119,87 +1478,73 @@ const withCrudFirestore = (MixinBase) => {
2119
1478
  };
2120
1479
 
2121
1480
  class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2122
- constructor({ firestore, interceptors }) {
2123
- super({
2124
- firestore,
2125
- collectionName: 'leads',
2126
- model: Lead,
2127
- interceptors,
2128
- });
1481
+ constructor(firestore) {
1482
+ super();
1483
+ this.firestore = firestore;
1484
+ this.collectionName = 'leads';
1485
+ this.model = Lead;
2129
1486
  }
2130
1487
  }
2131
1488
 
2132
1489
  class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
2133
- constructor({ firestore, interceptors }, parentRepository) {
2134
- super({
2135
- firestore,
2136
- collectionName: 'editions',
2137
- parentIdField: 'subscriptionId',
2138
- model: Edition,
2139
- interceptors,
2140
- });
1490
+ constructor(firestore, parentRepository) {
1491
+ super();
1492
+ this.firestore = firestore;
2141
1493
  this.parentRepository = parentRepository;
1494
+ this.collectionName = 'editions';
1495
+ this.parentIdField = 'subscriptionId';
1496
+ this.model = Edition;
2142
1497
  }
2143
1498
  }
2144
1499
 
2145
1500
  class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2146
- constructor({ firestore, interceptors, }) {
2147
- super({
2148
- firestore,
2149
- collectionName: 'subscription',
2150
- model: Subscription,
2151
- interceptors,
2152
- });
1501
+ constructor(firestore) {
1502
+ super();
1503
+ this.firestore = firestore;
1504
+ this.collectionName = 'subscription';
1505
+ this.model = Subscription;
2153
1506
  }
2154
1507
  }
2155
1508
 
2156
1509
  class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
2157
- constructor({ firestore, interceptors }, parentRepository) {
2158
- super({
2159
- firestore,
2160
- collectionName: 'payments',
2161
- parentIdField: 'subscriptionId',
2162
- model: SubscriptionPayment,
2163
- interceptors,
2164
- });
1510
+ constructor(firestore, parentRepository) {
1511
+ super();
1512
+ this.firestore = firestore;
2165
1513
  this.parentRepository = parentRepository;
1514
+ this.collectionName = 'payments';
1515
+ this.parentIdField = 'subscriptionId';
1516
+ this.model = SubscriptionPayment;
2166
1517
  }
2167
1518
  }
2168
1519
 
2169
1520
  class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
2170
- constructor({ firestore, interceptors }, parentRepository) {
2171
- super({
2172
- firestore,
2173
- collectionName: 'address',
2174
- parentIdField: 'userId',
2175
- model: UserAddress,
2176
- interceptors,
2177
- });
1521
+ constructor(firestore, parentRepository) {
1522
+ super();
1523
+ this.firestore = firestore;
2178
1524
  this.parentRepository = parentRepository;
1525
+ this.collectionName = 'address';
1526
+ this.parentIdField = 'userId';
1527
+ this.model = UserAddress;
2179
1528
  }
2180
1529
  }
2181
1530
 
2182
1531
  class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
2183
- constructor({ firestore, interceptors }, parentRepository) {
2184
- super({
2185
- firestore,
2186
- collectionName: 'CX',
2187
- parentIdField: 'userId',
2188
- model: BeautyProfile,
2189
- interceptors,
2190
- });
1532
+ constructor(firestore, parentRepository) {
1533
+ super();
1534
+ this.firestore = firestore;
2191
1535
  this.parentRepository = parentRepository;
1536
+ this.collectionName = 'CX';
1537
+ this.parentIdField = 'userId';
1538
+ this.model = BeautyProfile;
2192
1539
  }
2193
1540
  }
2194
1541
 
2195
1542
  class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2196
- constructor({ firestore, interceptors }) {
2197
- super({
2198
- firestore,
2199
- collectionName: 'users',
2200
- model: User,
2201
- interceptors,
2202
- });
1543
+ constructor(firestore) {
1544
+ super();
1545
+ this.firestore = firestore;
1546
+ this.collectionName = 'users';
1547
+ this.model = User;
2203
1548
  }
2204
1549
  async get(identifiers) {
2205
1550
  const user = await super.get({ id: identifiers.id });
@@ -2239,26 +1584,22 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
2239
1584
  }
2240
1585
 
2241
1586
  class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
2242
- constructor({ firestore, interceptors }, parentRepository) {
2243
- super({
2244
- firestore,
2245
- collectionName: 'payment_method',
2246
- parentIdField: 'userId',
2247
- model: UserPaymentMethod,
2248
- interceptors,
2249
- });
1587
+ constructor(firestore, parentRepository) {
1588
+ super();
1589
+ this.firestore = firestore;
2250
1590
  this.parentRepository = parentRepository;
1591
+ this.collectionName = 'payment_method';
1592
+ this.parentIdField = 'userId';
1593
+ this.model = UserPaymentMethod;
2251
1594
  }
2252
1595
  }
2253
1596
 
2254
1597
  class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2255
- constructor({ firestore, interceptors }) {
2256
- super({
2257
- firestore,
2258
- collectionName: 'categories',
2259
- model: Category,
2260
- interceptors,
2261
- });
1598
+ constructor(firestore) {
1599
+ super();
1600
+ this.firestore = firestore;
1601
+ this.collectionName = 'categories';
1602
+ this.model = Category;
2262
1603
  }
2263
1604
  async getCategoryBySlug(slug, shop) {
2264
1605
  const categoryDocs = await getDocs(query(this.collection(this.collectionName), where('slug', '==', slug), where('shop', '==', shop), where('published', '==', true)));
@@ -2268,14 +1609,14 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
2268
1609
  throw new NotFoundError(`Document with slug ${slug} not found`);
2269
1610
  return categoryDocs.docs[0].data();
2270
1611
  }
2271
- async getCategoriesForHome(categoryIds, limit = 4, gender) {
1612
+ async getCategoriesForHome(categoryIds, limit = 4) {
2272
1613
  const categorySnap = await getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
2273
1614
  if (categorySnap.empty)
2274
1615
  throw new NotFoundError('Categories not found');
2275
1616
  const categories = categorySnap.docs.map((doc) => doc.data());
2276
1617
  const homeSections = await Promise.all(categories.map(async (category) => ({
2277
1618
  category,
2278
- products: await this.mountCategory(category, { limit, hasStock: true, gender }),
1619
+ products: await this.mountCategory(category, { limit, hasStock: true }),
2279
1620
  })));
2280
1621
  return homeSections;
2281
1622
  }
@@ -2291,8 +1632,6 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
2291
1632
  wheres.push(where('published', '==', true), where('id', 'in', productIds));
2292
1633
  if (options?.hasStock)
2293
1634
  wheres.push(where('stock.quantity', '>', 0));
2294
- if (options?.gender)
2295
- wheres.push(where('tags', 'array-contains', options?.gender));
2296
1635
  if (options?.limit)
2297
1636
  wheres.push(limit(options?.limit));
2298
1637
  const productSnap = await getDocs(query(this.collection('productsErpVitrine'), ...wheres));
@@ -2302,26 +1641,15 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
2302
1641
  }
2303
1642
  return is(products);
2304
1643
  }
2305
- getCategoryByShop(shop) {
2306
- return;
2307
- }
2308
- getChildren(parentId) {
2309
- return;
2310
- }
2311
- isChild(id, parentId) {
2312
- return;
2313
- }
2314
1644
  }
2315
1645
 
2316
1646
  class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2317
- constructor({ firestore, interceptors }) {
2318
- super({
2319
- firestore,
2320
- collectionName: 'productsErpVitrine',
2321
- model: Product,
2322
- interceptors,
2323
- });
1647
+ constructor(firestore) {
1648
+ super();
1649
+ this.firestore = firestore;
2324
1650
  this.reviews = {};
1651
+ this.collectionName = 'productsErpVitrine';
1652
+ this.model = Product;
2325
1653
  }
2326
1654
  async getBySlug(slug) {
2327
1655
  const result = await this.find({
@@ -2356,101 +1684,43 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
2356
1684
  });
2357
1685
  return this.reviews[status];
2358
1686
  }
2359
- cleanShoppingCountFromIds() {
2360
- return;
2361
- }
2362
- findCatalog(params) {
2363
- return this.find(params);
2364
- }
2365
1687
  }
2366
1688
 
2367
1689
  class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
2368
- constructor({ firestore, interceptors }, parentRepository) {
2369
- super({
2370
- firestore,
2371
- collectionName: 'variants',
2372
- parentIdField: 'productId',
2373
- model: Variant,
2374
- interceptors,
2375
- });
1690
+ constructor(firestore, parentRepository) {
1691
+ super();
1692
+ this.firestore = firestore;
2376
1693
  this.parentRepository = parentRepository;
1694
+ this.collectionName = 'variants';
1695
+ this.parentIdField = 'productId';
1696
+ this.model = Variant;
2377
1697
  }
2378
1698
  }
2379
1699
 
2380
1700
  class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2381
- constructor({ firestore, interceptors }) {
2382
- super({
2383
- firestore,
2384
- collectionName: 'subscriptionProducts',
2385
- model: Product,
2386
- interceptors,
2387
- });
2388
- }
2389
- }
2390
-
2391
- class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2392
- constructor({ firestore, interceptors }) {
2393
- super({
2394
- firestore,
2395
- collectionName: 'buy2win',
2396
- model: Buy2Win,
2397
- interceptors,
2398
- });
2399
- }
2400
- }
2401
-
2402
- class CampaignDashboardFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2403
- constructor({ firestore, interceptors, }) {
2404
- super({
2405
- firestore,
2406
- collectionName: 'dashboardCampaignsAuto',
2407
- model: CampaignDashboard,
2408
- interceptors,
2409
- });
2410
- }
2411
- }
2412
-
2413
- class CampaignHashtagFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2414
- constructor({ firestore, interceptors, }) {
2415
- super({
2416
- firestore,
2417
- collectionName: 'hashtagCampaignsAuto',
2418
- model: CampaignHashtag,
2419
- interceptors,
2420
- });
1701
+ constructor(firestore) {
1702
+ super();
1703
+ this.firestore = firestore;
1704
+ this.collectionName = 'subscriptionProducts';
1705
+ this.model = Product;
2421
1706
  }
2422
1707
  }
2423
1708
 
2424
1709
  class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2425
- constructor({ firestore, interceptors }) {
2426
- super({
2427
- firestore,
2428
- collectionName: 'checkouts',
2429
- model: Checkout,
2430
- interceptors,
2431
- });
2432
- }
2433
- }
2434
-
2435
- class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2436
- constructor({ firestore, interceptors, }) {
2437
- super({
2438
- firestore,
2439
- collectionName: 'checkoutsSubscription',
2440
- model: CheckoutSubscription,
2441
- interceptors,
2442
- });
1710
+ constructor(firestore) {
1711
+ super();
1712
+ this.firestore = firestore;
1713
+ this.collectionName = 'checkouts';
1714
+ this.model = Checkout;
2443
1715
  }
2444
1716
  }
2445
1717
 
2446
1718
  class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2447
- constructor({ firestore, interceptors }) {
2448
- super({
2449
- firestore,
2450
- collectionName: 'coupons',
2451
- model: Coupon,
2452
- interceptors,
2453
- });
1719
+ constructor(firestore) {
1720
+ super();
1721
+ this.firestore = firestore;
1722
+ this.collectionName = 'coupons';
1723
+ this.model = Coupon;
2454
1724
  }
2455
1725
  buildModelInstance() {
2456
1726
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -2472,16 +1742,9 @@ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirest
2472
1742
  }
2473
1743
 
2474
1744
  class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2475
- constructor({ firestore, interceptors }) {
2476
- super({
2477
- firestore,
2478
- collectionName: 'orders',
2479
- model: Order,
2480
- interceptors,
2481
- fields: {
2482
- status: FirestoreFieldType.String,
2483
- },
2484
- });
1745
+ constructor(firestore) {
1746
+ super();
1747
+ this.firestore = firestore;
2485
1748
  this.orderFromFirestore = (order) => {
2486
1749
  if (!!order?.lineItems?.length) {
2487
1750
  order.lineItems = order.lineItems.map((lineItem) => {
@@ -2494,6 +1757,11 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
2494
1757
  }
2495
1758
  return order;
2496
1759
  };
1760
+ this.collectionName = 'orders';
1761
+ this.model = Order;
1762
+ this.fields = {
1763
+ status: FirestoreFieldType.String,
1764
+ };
2497
1765
  }
2498
1766
  buildModelInstance() {
2499
1767
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -2507,58 +1775,84 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
2507
1775
  }
2508
1776
  }
2509
1777
 
2510
- class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
2511
- constructor({ firestore, interceptors }) {
2512
- super({
2513
- firestore,
2514
- interceptors,
2515
- });
2516
- this.collectionName = 'legacyOrders';
1778
+ class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1779
+ constructor(firestore) {
1780
+ super();
1781
+ this.firestore = firestore;
1782
+ this.collectionName = 'payments';
1783
+ this.model = Payment;
2517
1784
  }
2518
1785
  }
2519
1786
 
2520
- class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2521
- constructor({ firestore, interceptors }) {
2522
- super({
2523
- firestore,
2524
- collectionName: 'payments',
2525
- model: Payment,
2526
- interceptors,
2527
- });
1787
+ class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1788
+ constructor(firestore) {
1789
+ super();
1790
+ this.firestore = firestore;
1791
+ this.collectionName = 'checkoutsSubscription';
1792
+ this.model = CheckoutSubscription;
2528
1793
  }
2529
1794
  }
2530
1795
 
2531
1796
  class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2532
- constructor({ firestore, interceptors, }) {
2533
- super({
2534
- firestore,
2535
- collectionName: 'subscriptionPlans',
2536
- model: SubscriptionPlan,
2537
- interceptors,
2538
- });
1797
+ constructor(firestore) {
1798
+ super();
1799
+ this.firestore = firestore;
1800
+ this.collectionName = 'subscriptionPlans';
1801
+ this.model = SubscriptionPlan;
1802
+ }
1803
+ }
1804
+
1805
+ class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1806
+ constructor(firestore) {
1807
+ super();
1808
+ this.firestore = firestore;
1809
+ this.collectionName = 'buy2win';
1810
+ this.model = Buy2Win;
1811
+ }
1812
+ }
1813
+
1814
+ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1815
+ constructor(firestore) {
1816
+ super(firestore);
1817
+ this.firestore = firestore;
1818
+ this.collectionName = 'legacyOrders';
2539
1819
  }
2540
1820
  }
2541
1821
 
2542
1822
  class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2543
- constructor({ firestore, interceptors }) {
2544
- super({
2545
- firestore,
2546
- collectionName: 'dms',
2547
- model: Home,
2548
- interceptors,
2549
- });
1823
+ constructor(firestore) {
1824
+ super();
1825
+ this.firestore = firestore;
1826
+ this.homeToFirestore = (home) => {
1827
+ if (home.data?.data) {
1828
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.homeCategoryGroupToPlain);
1829
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.homeCategoryGroupToPlain);
1830
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.homeCategoryGroupToPlain);
1831
+ }
1832
+ return home;
1833
+ };
2550
1834
  this.homeCategoryGroupToPlain = (homeCategoryGroup) => ({
2551
- category: homeCategoryGroup?.category?.toPlain
2552
- ? homeCategoryGroup?.category?.toPlain()
2553
- : homeCategoryGroup?.category,
2554
- products: homeCategoryGroup?.products
2555
- ?.map((product) => (product?.toPlain ? product?.toPlain() : product))
2556
- .filter(Boolean) || [],
2557
- });
1835
+ category: homeCategoryGroup.category.toPlain(),
1836
+ products: homeCategoryGroup.products.map((product) => product.toPlain()),
1837
+ });
1838
+ this.homeFromFirestore = (home) => {
1839
+ if (home.data?.data) {
1840
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
1841
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
1842
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
1843
+ home.data.createdAt =
1844
+ home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
1845
+ home.data.expiresAt =
1846
+ home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
1847
+ }
1848
+ return home;
1849
+ };
2558
1850
  this.plainToHomeCategoryGroup = (homeCategoryGroup) => ({
2559
- category: Category.toInstance(homeCategoryGroup?.category),
2560
- products: homeCategoryGroup.products?.map((product) => Product.toInstance(product)),
1851
+ category: Category.toInstance(homeCategoryGroup.category),
1852
+ products: homeCategoryGroup.products.map((product) => Product.toInstance(product)),
2561
1853
  });
1854
+ this.collectionName = 'dms';
1855
+ this.model = Home;
2562
1856
  }
2563
1857
  buildModelInstance() {
2564
1858
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -2573,47 +1867,14 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
2573
1867
  },
2574
1868
  };
2575
1869
  }
2576
- homeToFirestore(home) {
2577
- if (home.data?.data) {
2578
- home.data.data.discoverProducts = home.data.data.discoverProducts?.map(this.homeCategoryGroupToPlain) || [];
2579
- home.data.data.featuredProducts = home.data.data.featuredProducts?.map(this.homeCategoryGroupToPlain) || [];
2580
- home.data.data.verticalProducts = home.data.data.verticalProducts?.map(this.homeCategoryGroupToPlain) || [];
2581
- }
2582
- return home;
2583
- }
2584
- homeFromFirestore(home) {
2585
- if (home.data?.data) {
2586
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
2587
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
2588
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
2589
- home.data.createdAt =
2590
- home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
2591
- home.data.expiresAt =
2592
- home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
2593
- }
2594
- return home;
2595
- }
2596
1870
  }
2597
1871
 
2598
1872
  class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2599
- constructor({ firestore, interceptors }) {
2600
- super({
2601
- firestore,
2602
- collectionName: 'shopMenus',
2603
- model: ShopMenu,
2604
- interceptors,
2605
- });
2606
- }
2607
- }
2608
-
2609
- class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2610
- constructor({ firestore, interceptors, }) {
2611
- super({
2612
- firestore,
2613
- collectionName: 'shopSettings',
2614
- model: ShopSettings,
2615
- interceptors,
2616
- });
1873
+ constructor(firestore) {
1874
+ super();
1875
+ this.firestore = firestore;
1876
+ this.collectionName = 'shopMenus';
1877
+ this.model = ShopMenu;
2617
1878
  }
2618
1879
  }
2619
1880
 
@@ -2690,7 +1951,7 @@ class AttributeOptionHelper {
2690
1951
  }
2691
1952
  AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
2692
1953
  if (fields.includes(attributeName))
2693
- return { columnName: attributeName.toString(), attributeName, to: (value) => value, from: (value) => value };
1954
+ return { columnName: attributeName.toString(), attributeName };
2694
1955
  const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
2695
1956
  const fieldOption = is(field)?.[attributeName];
2696
1957
  if (isNil(fieldOption))
@@ -2699,7 +1960,7 @@ AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
2699
1960
  return { columnName: attributeName.toString(), attributeName, fields: fieldOption };
2700
1961
  return { attributeName, columnName: attributeName.toString(), ...fieldOption };
2701
1962
  };
2702
- AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue?.columnName;
1963
+ AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue.columnName;
2703
1964
  AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
2704
1965
  if (fields.includes(columnName))
2705
1966
  return { columnName, attributeName: columnName };
@@ -2792,26 +2053,25 @@ BindFilterQueryHelper.MakeGraphQLWhere = (filter, fields) => Object.keys(filter)
2792
2053
  }, {});
2793
2054
  BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
2794
2055
  const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
2795
- const isNestedField = !Array.isArray(options) &&
2056
+ if (!Array.isArray(options) &&
2796
2057
  isObject(options) &&
2797
2058
  isNil(options?.operator) &&
2798
2059
  isNil(options?.value) &&
2799
- isNil(fieldSentenceOptions?.to);
2800
- if (isNestedField)
2060
+ isNil(fieldSentenceOptions?.to))
2801
2061
  return Object.keys(options).reduce((variables, key) => {
2802
2062
  const fieldOptions = AttributeOptionHelper.FindByAttribute(key, fieldSentenceOptions?.fields || fields);
2803
2063
  const columnName = fieldOptions.columnName;
2804
2064
  const columnFields = fieldOptions.fields;
2805
2065
  return {
2806
2066
  ...variables,
2807
- [columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), fieldSentenceOptions?.fields || columnFields || fields),
2067
+ [columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), columnFields || []),
2808
2068
  };
2809
2069
  }, {});
2810
2070
  if (!Array.isArray(options) && !isNil(fieldSentenceOptions.fields))
2811
2071
  return {
2812
2072
  [fieldSentenceOptions.fields[0]]: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
2813
2073
  };
2814
- if (!Array.isArray(options) && isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
2074
+ if (isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
2815
2075
  options = Object.values(options)[0];
2816
2076
  return Array.isArray(options)
2817
2077
  ? options.reduce((whereSentence, option) => ({
@@ -2847,14 +2107,28 @@ GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = (fields) => {
2847
2107
  if (field === 'affected_rows')
2848
2108
  return field;
2849
2109
  const fieldName = Object.keys(field).shift();
2850
- const fieldValue = is(field[fieldName]);
2110
+ const fieldValue = field[fieldName];
2851
2111
  if (Array.isArray(fieldValue))
2852
2112
  return { [fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue) };
2853
2113
  if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
2854
- return;
2855
- const isNestedField = !!fieldValue.fields;
2856
- if (isNestedField)
2857
- return GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields(fieldName, fieldValue);
2114
+ return null;
2115
+ if (fieldValue.fields)
2116
+ return !fieldValue.filters
2117
+ ? {
2118
+ [fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2119
+ }
2120
+ : {
2121
+ operation: fieldValue.columnName || fieldName,
2122
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2123
+ variables: {
2124
+ [`${fieldValue.columnName}_where`]: {
2125
+ name: 'where',
2126
+ type: fieldValue.filters.filterType,
2127
+ value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
2128
+ required: true,
2129
+ },
2130
+ },
2131
+ };
2858
2132
  return fieldValue.columnName;
2859
2133
  })
2860
2134
  .filter((field) => !!field);
@@ -2879,10 +2153,7 @@ GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).r
2879
2153
  }
2880
2154
  if (!!from)
2881
2155
  return { ...result, [attributeName]: from(data[columnName], data) };
2882
- return {
2883
- ...result,
2884
- [attributeName]: isString(data[columnName]) ? parseDateTime(data[columnName].toString()) : data[columnName],
2885
- };
2156
+ return { ...result, [attributeName]: parseDateTime(data[columnName].toString()) };
2886
2157
  }, {});
2887
2158
  GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2888
2159
  const data = instance.toPlain?.() || instance;
@@ -2898,13 +2169,10 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2898
2169
  if (!!foreignKeyColumn &&
2899
2170
  !isEmpty(foreignKeyColumn) &&
2900
2171
  !Object.keys(foreignKeyColumn).filter((key) => !is(data[attributeName])?.[key]).length)
2901
- return Object.keys(foreignKeyColumn).reduce((object, current) => {
2902
- const { columnName: foreignColumnName } = AttributeOptionHelper.FindByAttribute(foreignKeyColumn[current], fields);
2903
- return {
2904
- ...object,
2905
- [foreignColumnName]: data[attributeName]?.[current],
2906
- };
2907
- }, { ...result });
2172
+ return Object.keys(foreignKeyColumn).reduce((object, current) => ({
2173
+ ...object,
2174
+ [foreignKeyColumn[current]]: data[attributeName]?.[current],
2175
+ }), { ...result });
2908
2176
  if (update &&
2909
2177
  isObject(data[attributeName]) &&
2910
2178
  !isNil(attributeFields) &&
@@ -2937,25 +2205,6 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2937
2205
  return { ...result, [columnName]: data[attributeName] };
2938
2206
  }, {});
2939
2207
  };
2940
- GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields = (fieldName, fieldValue) => {
2941
- const hasCustomFilters = !!fieldValue.filters;
2942
- if (hasCustomFilters)
2943
- return {
2944
- operation: fieldValue.columnName || fieldName,
2945
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2946
- variables: {
2947
- [`${fieldValue.columnName}_where`]: {
2948
- name: 'where',
2949
- type: fieldValue.filters.filterType,
2950
- value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
2951
- required: true,
2952
- },
2953
- },
2954
- };
2955
- return {
2956
- [fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2957
- };
2958
- };
2959
2208
 
2960
2209
  const withCreateHasuraGraphQL = (MixinBase) => {
2961
2210
  return class CreateHasuraGraphQLMixin extends MixinBase {
@@ -2966,7 +2215,6 @@ const withCreateHasuraGraphQL = (MixinBase) => {
2966
2215
  this.insertGraphQLObjectType = options?.insertGraphQLObjectType || `${this.tableName}_insert_input`;
2967
2216
  }
2968
2217
  async create(data) {
2969
- this.logger = DebugHelper.from(this, 'create');
2970
2218
  const newData = await this.save(this.model.toInstance(data));
2971
2219
  return this.model.toInstance(newData);
2972
2220
  }
@@ -2977,10 +2225,10 @@ const withCreateHasuraGraphQL = (MixinBase) => {
2977
2225
  const columnOptions = Object.values(field).shift();
2978
2226
  return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
2979
2227
  columnOptions.foreignKeyColumn && [
2980
- ...Object.values(columnOptions.foreignKeyColumn).map((foreignKeyName) => AttributeOptionHelper.FindByAttribute(foreignKeyName, this.fields)?.columnName),
2228
+ ...Object.values(columnOptions.foreignKeyColumn),
2981
2229
  {
2982
- [columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions?.fields)
2983
- ?.columnName || foreignKeyField),
2230
+ [columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions?.fields)?.columnName ||
2231
+ foreignKeyField),
2984
2232
  },
2985
2233
  ]);
2986
2234
  })
@@ -3002,11 +2250,9 @@ const withDeleteHasuraGraphQL = (MixinBase) => {
3002
2250
  this.deleteGraphQLOperation = options?.deleteGraphQLOperation || `delete_${this.tableName}_by_pk`;
3003
2251
  }
3004
2252
  async delete(identifiers) {
3005
- this.logger = DebugHelper.from(this, 'delete');
3006
2253
  const instance = this.model.toInstance(identifiers);
3007
2254
  await this.mutation(this.deleteGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), this.model.identifiersFields.reduce((ids, identifier) => {
3008
- const identifierBinded = identifier;
3009
- if (isNil(instance.identifier[identifierBinded]))
2255
+ if (isNil(instance[identifier]))
3010
2256
  return ids;
3011
2257
  const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
3012
2258
  const value = columnOption.to(identifiers[identifier], instance);
@@ -3033,19 +2279,15 @@ const withHasuraGraphQL = (MixinBase) => {
3033
2279
  this.authOptions = options.authOptions;
3034
2280
  this.model = options.model;
3035
2281
  this.fields = options.fields || this.model.identifiersFields;
3036
- this.logger = DebugHelper.from(this);
3037
2282
  }
3038
2283
  get headers() {
3039
2284
  return {
3040
2285
  'Content-Type': 'application/json',
3041
- ...(isNil(this.authOptions?.authToken) ? {} : { Authorization: this.authOptions?.authToken }),
3042
- ...(isNil(this.authOptions?.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions?.adminSecret }),
3043
- ...(isNil(this.authOptions?.authRole)
2286
+ ...(isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken }),
2287
+ ...(isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret }),
2288
+ ...(isNil(this.authOptions.authRole)
3044
2289
  ? {}
3045
- : {
3046
- 'X-Hasura-Role': this.authOptions.authRole.role,
3047
- 'X-Hasura-User-Id': this.authOptions?.authRole?.userId,
3048
- }),
2290
+ : { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }),
3049
2291
  };
3050
2292
  }
3051
2293
  async mutation(operation, fields, variables) {
@@ -3057,28 +2299,29 @@ const withHasuraGraphQL = (MixinBase) => {
3057
2299
  return this.fetch(resultQuery);
3058
2300
  }
3059
2301
  async query(operation, fields, variables) {
3060
- const builded = this.buildHasuraQueryFields({
3061
- operation,
3062
- fields: fields,
3063
- variables,
3064
- });
3065
- const interpected = (await this.interceptors?.request?.(builded)) || builded;
3066
- const resultQuery = query$1(interpected);
3067
- const result = await this.fetch(resultQuery);
3068
- return (await this.interceptors?.response?.(result, interpected)) || result;
2302
+ const resultQuery = GraphQLFieldHelper.CheckIsGraphQLParams(operation)
2303
+ ? query$1(operation.map((option) => ({
2304
+ operation: option.operation,
2305
+ variables: option.variables,
2306
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
2307
+ })))
2308
+ : query$1({
2309
+ operation,
2310
+ variables,
2311
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
2312
+ });
2313
+ return this.fetch(resultQuery);
3069
2314
  }
3070
2315
  async fetch(params) {
3071
- this.logger.with('params').log(params);
3072
2316
  const headers = this.headers;
3073
- const { data: result } = await axios({
3074
- url: `${this.endpoint}`,
2317
+ const response = await fetch(`${this.endpoint}`, {
3075
2318
  method: 'POST',
3076
- data: params,
2319
+ body: JSON.stringify(params),
3077
2320
  headers,
3078
2321
  });
2322
+ const result = await response.json();
3079
2323
  if (!isNil(result.errors))
3080
2324
  throw new Error(JSON.stringify(result.errors));
3081
- this.logger.with('returns').log(result);
3082
2325
  return result.data;
3083
2326
  }
3084
2327
  getAttributeGraphQLTypeOf(value) {
@@ -3104,26 +2347,13 @@ const withHasuraGraphQL = (MixinBase) => {
3104
2347
  return value;
3105
2348
  return date;
3106
2349
  }
3107
- convertDataFromHasura(data, fields) {
3108
- const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, fields || this.fields);
2350
+ convertDataFromHasura(data) {
2351
+ const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
3109
2352
  return this.model.toInstance(plain);
3110
2353
  }
3111
2354
  convertDataToHasura(instance, update = false) {
3112
2355
  return GraphQLFieldHelper.ConvertFieldValueTo(instance, this.fields, update);
3113
2356
  }
3114
- buildHasuraQueryFields({ operation, fields, variables, }) {
3115
- return GraphQLFieldHelper.CheckIsGraphQLParams(operation)
3116
- ? operation.map((option) => ({
3117
- operation: option.operation,
3118
- variables: option.variables,
3119
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
3120
- }))
3121
- : {
3122
- operation,
3123
- variables,
3124
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
3125
- };
3126
- }
3127
2357
  };
3128
2358
  };
3129
2359
 
@@ -3146,7 +2376,6 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
3146
2376
  this.updateGraphQLPKType = options?.updateGraphQLPKType || `${this.tableName}_pk_columns_input`;
3147
2377
  }
3148
2378
  async update(data) {
3149
- this.logger = DebugHelper.from(this, 'update');
3150
2379
  const plainData = this.paramsToPlain(data);
3151
2380
  await this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), {
3152
2381
  _set: {
@@ -3172,11 +2401,10 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
3172
2401
  getUpdateModelKeys(data) {
3173
2402
  const instance = this.model.toInstance(data);
3174
2403
  return this.model.identifiersFields.reduce((ids, identifier) => {
3175
- const identifierBinded = identifier;
3176
- if (isNil(instance.identifier[identifierBinded]))
2404
+ if (isNil(instance[identifier]))
3177
2405
  return ids;
3178
- const columnOption = AttributeOptionHelper.FindByAttribute(identifierBinded, this.fields);
3179
- const value = columnOption?.to?.(data[identifierBinded], instance) || data[columnOption.attributeName];
2406
+ const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
2407
+ const value = columnOption?.to?.(data[identifier], instance) || data[columnOption.attributeName];
3180
2408
  return {
3181
2409
  ...ids,
3182
2410
  [columnOption.columnName]: value,
@@ -3194,11 +2422,9 @@ const withGetHasuraGraphQL = (MixinBase) => {
3194
2422
  this.getGraphQLOperation = options?.getGraphQLOperation || `${this.tableName}_by_pk`;
3195
2423
  }
3196
2424
  async get(identifiers) {
3197
- this.logger = DebugHelper.from(this, 'get');
3198
2425
  const instance = this.model.toInstance(identifiers);
3199
2426
  const result = await this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce((ids, identifier) => {
3200
- const identifierBinded = identifier;
3201
- if (isNil(instance[identifierBinded]))
2427
+ if (isNil(instance[identifier]))
3202
2428
  return ids;
3203
2429
  const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
3204
2430
  const value = columnOption?.to?.(identifiers[identifier], instance) ||
@@ -3222,49 +2448,10 @@ const withGetHasuraGraphQL = (MixinBase) => {
3222
2448
 
3223
2449
  const withFindHasuraGraphQL = (MixinBase) => {
3224
2450
  return class FindHasuraGraphQLMixin extends MixinBase {
3225
- constructor() {
3226
- super(...arguments);
3227
- this.bindOrderByAttributes = (orderBy, fields) => Object.keys(orderBy).reduce((acc, current) => [
3228
- ...acc,
3229
- {
3230
- [AttributeOptionHelper.FindByAttribute(current, fields)
3231
- .columnName]: orderBy[current] === 'asc'
3232
- ? 'asc_nulls_last'
3233
- : 'desc_nulls_last',
3234
- },
3235
- ], []);
3236
- this.bindAggretageAttributes = (aggregates, fields) => [
3237
- ...(aggregates?.minimal?.length
3238
- ? [
3239
- {
3240
- min: this.bindAttributesToColumns(aggregates?.minimal, fields),
3241
- },
3242
- ]
3243
- : []),
3244
- ...(aggregates?.maximum?.length
3245
- ? [
3246
- {
3247
- max: this.bindAttributesToColumns(aggregates?.maximum, fields),
3248
- },
3249
- ]
3250
- : []),
3251
- ];
3252
- this.bindAttributesToColumns = (attributes, fields) => attributes.map((attr) => AttributeOptionHelper.FindByAttribute(attr.toString().split('.').pop(), fields)?.columnName || attr);
3253
- }
3254
- async find(params) {
3255
- this.logger = DebugHelper.from(this, 'find');
3256
- const { filters, limits, orderBy, options } = params || {};
3257
- const enableCount = options?.enableCount ?? true;
2451
+ async find(options) {
2452
+ const { filters, limits, orderBy } = options || {};
3258
2453
  const variablesCount = {
3259
- ...(isNil(orderBy)
3260
- ? {}
3261
- : {
3262
- order_by: {
3263
- type: `${this.tableName}_order_by!`,
3264
- list: true,
3265
- value: this.bindOrderByAttributes(orderBy, this.fields),
3266
- },
3267
- }),
2454
+ ...(isNil(orderBy) ? {} : { order_by: { type: `${this.tableName}_order_by!`, list: true, value: orderBy } }),
3268
2455
  ...(isNil(filters)
3269
2456
  ? {}
3270
2457
  : {
@@ -3279,56 +2466,26 @@ const withFindHasuraGraphQL = (MixinBase) => {
3279
2466
  ...(isNil(limits) ? {} : limits),
3280
2467
  ...variablesCount,
3281
2468
  };
3282
- const aggregateFields = [
3283
- ...(enableCount ? ['count'] : []),
3284
- ...this.bindAggretageAttributes(params.options, this.fields),
3285
- ];
3286
2469
  const result = await this.query([
3287
2470
  {
3288
2471
  operation: this.tableName,
3289
- fields: params.fields
3290
- ? params.fields
2472
+ fields: options.fields
2473
+ ? options.fields
3291
2474
  .map((fieldName) => this.fields.find((fieldOption) => fieldOption === fieldName) ??
3292
2475
  this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName))
3293
2476
  .filter(Boolean)
3294
2477
  : this.fields,
3295
2478
  variables,
3296
2479
  },
3297
- ...(aggregateFields.length > 0
3298
- ? [
3299
- {
3300
- operation: `${this.tableName}_aggregate`,
3301
- fields: [
3302
- {
3303
- aggregate: aggregateFields,
3304
- },
3305
- ],
3306
- variables: variablesCount,
3307
- },
3308
- ]
3309
- : []),
2480
+ {
2481
+ operation: `${this.tableName}_aggregate`,
2482
+ fields: [{ aggregate: ['count'] }],
2483
+ variables: variablesCount,
2484
+ },
3310
2485
  ]);
3311
2486
  const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
3312
- return {
3313
- data,
3314
- count: enableCount ? result[`${this.tableName}_aggregate`].aggregate.count : Infinity,
3315
- ...(options?.minimal?.length
3316
- ? {
3317
- minimal: options.minimal.reduce((minimals, current) => ({
3318
- ...minimals,
3319
- ...set(minimals, current, result[`${this.tableName}_aggregate`].aggregate.min[AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)?.columnName || current]),
3320
- }), {}),
3321
- }
3322
- : {}),
3323
- ...(options?.maximum?.length
3324
- ? {
3325
- maximum: options.maximum.reduce((maximums, current) => ({
3326
- ...maximums,
3327
- ...set(maximums, current, result[`${this.tableName}_aggregate`].aggregate.max[AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)?.columnName || current]),
3328
- }), {}),
3329
- }
3330
- : {}),
3331
- };
2487
+ const count = result[`${this.tableName}_aggregate`].aggregate.count;
2488
+ return { count, data };
3332
2489
  }
3333
2490
  };
3334
2491
  };
@@ -3367,154 +2524,13 @@ class VariantHasuraGraphQL extends Variant {
3367
2524
  }
3368
2525
  }
3369
2526
 
3370
- class CategoryCollectionChildrenHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3371
- constructor({ endpoint, authOptions, interceptors, }) {
3372
- super({
3373
- tableName: 'category_collection_children',
3374
- model: CategoryCollectionChildren,
3375
- endpoint,
3376
- authOptions,
3377
- interceptors,
3378
- fields: [
3379
- { collectionId: { columnName: 'collection_id' } },
3380
- { categoryId: { columnName: 'category_id' } },
3381
- 'name',
3382
- 'slug',
3383
- 'reference',
3384
- { parentCollectionId: { columnName: 'parent_collection_id' } },
3385
- { parentCategoryId: { columnName: 'parent_category_id' } },
3386
- {
3387
- parent: {
3388
- columnName: 'parent',
3389
- foreignKeyColumn: { collectionId: 'parentCollectionId', categoryId: 'parentCategoryId' },
3390
- fields: [
3391
- { collectionId: { columnName: 'collection_id' } },
3392
- { categoryId: { columnName: 'category_id' } },
3393
- 'name',
3394
- 'slug',
3395
- 'reference',
3396
- { parentCollectionId: { columnName: 'parent_collection_id' } },
3397
- { parentCategoryId: { columnName: 'parent_category_id' } },
3398
- ],
3399
- },
3400
- },
3401
- ],
3402
- });
3403
- }
3404
- }
3405
-
3406
- class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3407
- constructor({ endpoint, authOptions, interceptors, }) {
3408
- super({
3409
- tableName: 'category_filter',
3410
- model: CategoryFilter,
3411
- endpoint,
3412
- authOptions,
3413
- interceptors,
3414
- fields: [
3415
- 'id',
3416
- { filterId: { columnName: 'filter_id' } },
3417
- { categoryId: { columnName: 'category_id' } },
3418
- {
3419
- filter: {
3420
- columnName: 'filter',
3421
- foreignKeyColumn: { id: 'filterId' },
3422
- fields: [
3423
- 'id',
3424
- 'description',
3425
- 'slug',
3426
- 'enabled',
3427
- { createdAt: { columnName: 'created_at' } },
3428
- { updatedAt: { columnName: 'updated_at' } },
3429
- {
3430
- options: {
3431
- columnName: 'options',
3432
- foreignKeyColumn: { filterId: 'id' },
3433
- fields: [
3434
- 'id',
3435
- { filterId: { columnName: 'filter_id' } },
3436
- 'description',
3437
- { createdAt: { columnName: 'created_at' } },
3438
- { updatedAt: { columnName: 'updated_at' } },
3439
- ],
3440
- },
3441
- },
3442
- ],
3443
- },
3444
- },
3445
- {
3446
- category: {
3447
- columnName: 'category',
3448
- foreignKeyColumn: { id: 'categoryId' },
3449
- fields: [
3450
- 'id',
3451
- 'description',
3452
- {
3453
- products: {
3454
- columnName: 'products',
3455
- fields: ['product_id'],
3456
- from: (value) => value.map((product) => product.product_id.toString()),
3457
- to: (productIds) => productIds.map((productId) => ({
3458
- product_id: +productId,
3459
- })),
3460
- },
3461
- },
3462
- {
3463
- childrenProducts: {
3464
- columnName: 'children_products',
3465
- foreignKeyColumn: { category_id: 'id' },
3466
- fields: [
3467
- 'id',
3468
- 'name',
3469
- 'slug',
3470
- {
3471
- categories: {
3472
- columnName: 'categories',
3473
- fields: ['category_id'],
3474
- bindPersistData: (value) => ({
3475
- categories: { data: value.map((category) => ({ category_id: +category })) },
3476
- }),
3477
- to: (categories) => categories.map((categoryId) => +categoryId),
3478
- from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
3479
- },
3480
- },
3481
- ],
3482
- },
3483
- },
3484
- ],
3485
- },
3486
- },
3487
- ],
3488
- });
3489
- }
3490
- deleteByCategory(categoryId) {
3491
- return this.mutation('delete_category_filter', ['affected_rows'], {
3492
- where: {
3493
- type: 'category_filter_bool_exp',
3494
- required: true,
3495
- value: { category_id: { _eq: categoryId } },
3496
- },
3497
- });
3498
- }
3499
- deleteByCategoryAndFilter(categoryId, filterId) {
3500
- return this.mutation('delete_category_filter', ['affected_rows'], {
3501
- where: {
3502
- type: 'category_filter_bool_exp',
3503
- required: true,
3504
- value: { category_id: { _eq: categoryId }, filter_id: { _eq: filterId } },
3505
- },
3506
- });
3507
- }
3508
- }
3509
-
3510
2527
  class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3511
- constructor({ endpoint, authOptions, interceptors, }, productRepository, categoryFilterRepository) {
2528
+ constructor(endpoint, authOptions, productRepository) {
3512
2529
  super({
3513
2530
  tableName: 'category',
3514
2531
  model: Category,
3515
2532
  endpoint,
3516
2533
  authOptions,
3517
- interceptors,
3518
2534
  fields: [
3519
2535
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
3520
2536
  { firestoreId: { columnName: 'firestore_id' } },
@@ -3523,7 +2539,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3523
2539
  'image',
3524
2540
  'published',
3525
2541
  'shop',
3526
- { shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
3527
2542
  'slug',
3528
2543
  { brandCategory: { columnName: 'brand_category' } },
3529
2544
  { brandCategoryBanner: { columnName: 'brand_banner' } },
@@ -3552,17 +2567,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3552
2567
  },
3553
2568
  },
3554
2569
  },
3555
- {
3556
- filters: {
3557
- columnName: 'filters',
3558
- foreignKeyColumn: { filter_id: 'id' },
3559
- fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
3560
- bindPersistData: (value) => ({
3561
- filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
3562
- }),
3563
- from: (filters) => filters?.map((filter) => filter?.filter) || [],
3564
- },
3565
- },
2570
+ 'filters',
3566
2571
  { createdAt: { columnName: 'created_at' } },
3567
2572
  { updatedAt: { columnName: 'updated_at' } },
3568
2573
  {
@@ -3584,77 +2589,39 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3584
2589
  }),
3585
2590
  },
3586
2591
  },
3587
- { isCollection: { columnName: 'is_collection' } },
3588
- { isWishlist: { columnName: 'is_wishlist' } },
3589
- 'reference',
3590
- { parentId: { columnName: 'parent_id' } },
3591
- {
3592
- parent: {
3593
- columnName: 'parent',
3594
- foreignKeyColumn: { id: 'parentId' },
3595
- fields: ['id', 'name', 'reference', 'slug'],
3596
- },
3597
- },
3598
2592
  ],
3599
2593
  });
3600
2594
  this.productRepository = productRepository;
3601
- this.categoryFilterRepository = categoryFilterRepository;
3602
2595
  }
3603
2596
  async create(params) {
3604
2597
  const { metadata, ...data } = params;
3605
- return super.create({ ...data, isWishlist: false, metadata: metadata || { description: null, title: null } });
2598
+ return super.create({ ...data, metadata: metadata || { description: null, title: null } });
3606
2599
  }
3607
2600
  async get(identifiers) {
3608
2601
  return Number.isNaN(+identifiers.id)
3609
- ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data?.[0]
2602
+ ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
3610
2603
  : super.get(identifiers);
3611
2604
  }
3612
2605
  async update(params) {
3613
- const { products, id: checkId, metadata, filters, ...data } = params;
2606
+ const { products, id: checkId, metadata, ...data } = params;
3614
2607
  const plainData = this.paramsToPlain({ id: checkId });
3615
2608
  const id = await this.getId(plainData.id);
3616
- const category = await super.update({ id, ...data, isWishlist: false });
2609
+ const category = await super.update({ id, ...data });
3617
2610
  category.products = products && (await this.updateProducts(+id, { products }));
3618
2611
  category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
3619
- category.filters = filters && (await this.updateFilters(+id, { filters }));
3620
2612
  return category;
3621
2613
  }
3622
2614
  async getCategoryBySlug(slug, shop) {
3623
2615
  if (!slug)
3624
2616
  return null;
3625
- const { data } = await this.find({
3626
- filters: {
3627
- slug,
3628
- shops: { operator: Where.IN, value: [shop] },
3629
- published: { operator: Where.EQUALS, value: true },
3630
- isWishlist: { operator: Where.EQUALS, value: false },
3631
- },
3632
- options: {
3633
- enableCount: false,
3634
- },
3635
- });
3636
- if (!data.length)
3637
- throw new NotFoundError(`Category with slug ${slug} not found`);
3638
- if (data.length > 1)
2617
+ const { data, count } = await this.find({ filters: { slug, shop, published: true } });
2618
+ if (count > 1)
3639
2619
  throw new DuplicatedResultsError('Query returned duplicated values');
3640
- return data.shift();
3641
- }
3642
- async getCategoryByShop(shop) {
3643
- if (!shop)
3644
- return;
3645
- const { data } = await this.find({
3646
- filters: {
3647
- shops: { operator: Where.IN, value: [shop] },
3648
- published: { operator: Where.EQUALS, value: true },
3649
- isWishlist: { operator: Where.EQUALS, value: false },
3650
- },
3651
- options: {
3652
- enableCount: false,
3653
- },
3654
- });
3655
- return data;
2620
+ if (!count)
2621
+ throw new NotFoundError(`Category with slug ${slug} not found`);
2622
+ return data.shift();
3656
2623
  }
3657
- async getCategoriesForHome(categoryIds, limit = 4, gender) {
2624
+ async getCategoriesForHome(categoryIds, limit = 4) {
3658
2625
  if (!categoryIds?.length)
3659
2626
  return [];
3660
2627
  const categoriesFirestore = categoryIds.filter((categoryId) => Number.isNaN(+categoryId));
@@ -3672,7 +2639,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3672
2639
  return [];
3673
2640
  const homeSections = await Promise.all(categories.map(async (category) => ({
3674
2641
  category,
3675
- products: await this.mountCategory(category, { limit, hasStock: true, gender }),
2642
+ products: await this.mountCategory(category, { limit, hasStock: true }),
3676
2643
  })));
3677
2644
  return homeSections;
3678
2645
  }
@@ -3685,7 +2652,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3685
2652
  id: { operator: Where.IN, value: category.products },
3686
2653
  published: true,
3687
2654
  ...(options?.hasStock ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {}),
3688
- ...(options?.gender ? { tags: { operator: Where.IN, value: [options?.gender] } } : {}),
3689
2655
  },
3690
2656
  fields: [
3691
2657
  'id',
@@ -3711,11 +2677,8 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3711
2677
  'tags',
3712
2678
  'type',
3713
2679
  'shoppingCount',
3714
- 'gender',
3715
- 'createdAt',
3716
2680
  ],
3717
2681
  ...(options?.limit ? { limits: { limit: options?.limit } } : {}),
3718
- options: { enableCount: false },
3719
2682
  });
3720
2683
  products.push(...productsData);
3721
2684
  return products;
@@ -3723,7 +2686,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3723
2686
  async getId(id) {
3724
2687
  if (!Number.isNaN(+id))
3725
2688
  return id;
3726
- const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
2689
+ const { data } = await this.find({ filters: { firestoreId: id } });
3727
2690
  if (data?.[0]?.id)
3728
2691
  return data?.[0]?.id;
3729
2692
  throw new NotFoundError(`Category with id ${id} not found`);
@@ -3776,200 +2739,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3776
2739
  });
3777
2740
  return plainData.metadata;
3778
2741
  }
3779
- async updateFilters(categoryId, { filters }) {
3780
- if ('action' in filters && filters.action === 'remove' && filters.value.length) {
3781
- for (let i = 0; i < filters.value.length; i++) {
3782
- await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filters.value[i].id);
3783
- }
3784
- return [];
3785
- }
3786
- if ('action' in filters && filters.action === 'merge' && filters.value.length) {
3787
- let filtersList = [];
3788
- const currentFilters = await this.categoryFilterRepository
3789
- .find({
3790
- filters: {
3791
- categoryId,
3792
- },
3793
- })
3794
- .then((res) => res.data);
3795
- const currentFiltersId = currentFilters.map((f) => f.id);
3796
- const filtersUpdatedId = filters.value.map((f) => f.id);
3797
- const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
3798
- const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
3799
- for (const filter of filterToBeDeleted) {
3800
- const index = currentFilters.findIndex((f) => f.id == filter);
3801
- if (index != -1) {
3802
- currentFilters.splice(index, 1);
3803
- }
3804
- await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
3805
- }
3806
- for (const filter of filterToBeInserted) {
3807
- const newCategoryFilter = await this.categoryFilterRepository.create({
3808
- filterId: filter,
3809
- categoryId,
3810
- });
3811
- filtersList.push(filter);
3812
- }
3813
- return filters.value;
3814
- }
3815
- if (Array.isArray(filters) && filters.length) {
3816
- await this.categoryFilterRepository.deleteByCategory(categoryId);
3817
- let filtersList = [];
3818
- for (let i = 0; i < filters.length; i++) {
3819
- const newCategoryFilter = await this.categoryFilterRepository.create({
3820
- filterId: filters[i].id,
3821
- categoryId,
3822
- });
3823
- filtersList.push(newCategoryFilter);
3824
- }
3825
- return filters;
3826
- }
3827
- }
3828
- async getChildren(parentId) {
3829
- const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id'], {
3830
- args: {
3831
- type: 'category_tree_args',
3832
- value: { parentid: parentId },
3833
- required: true,
3834
- },
3835
- });
3836
- return category_tree.map((category) => Category.toInstance(category));
3837
- }
3838
- async isChild(id, parentId) {
3839
- const categoryTree = await this.getChildren(parentId);
3840
- return categoryTree.some((c) => c.id == id.toString());
3841
- }
3842
- }
3843
-
3844
- class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3845
- constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
3846
- super({
3847
- tableName: 'filter',
3848
- model: Filter,
3849
- endpoint,
3850
- authOptions,
3851
- interceptors,
3852
- fields: [
3853
- 'id',
3854
- 'description',
3855
- 'slug',
3856
- 'enabled',
3857
- { createdAt: { columnName: 'created_at' } },
3858
- { updatedAt: { columnName: 'updated_at' } },
3859
- {
3860
- options: {
3861
- columnName: 'options',
3862
- foreignKeyColumn: { filterId: 'id' },
3863
- fields: [
3864
- 'id',
3865
- { filterId: { columnName: 'filter_id' } },
3866
- 'description',
3867
- { createdAt: { columnName: 'created_at' } },
3868
- { updatedAt: { columnName: 'updated_at' } },
3869
- ],
3870
- },
3871
- },
3872
- ],
3873
- });
3874
- this.filterOptionRepository = filterOptionRepository;
3875
- this.categoryFilterRepository = categoryFilterRepository;
3876
- }
3877
- async update(params) {
3878
- const { options, ...data } = params;
3879
- const filter = await super.update(data);
3880
- filter.options = await this.updateOptions(+data.id, { options });
3881
- return filter;
3882
- }
3883
- async updateOptions(filterId, { options }) {
3884
- if (!options)
3885
- return [];
3886
- if ('action' in options && options.action === 'remove' && options.value.length) {
3887
- for (let i = 0; i < options.value.length; i++) {
3888
- await this.filterOptionRepository.delete({ id: options.value[i].id });
3889
- }
3890
- return [];
3891
- }
3892
- if ('action' in options && options.action === 'merge' && options.value.length) {
3893
- let filterOptions = [];
3894
- for (let i = 0; i < options.value.length; i++) {
3895
- try {
3896
- const hasFilter = await this.filterOptionRepository.get({ id: options.value[i].id });
3897
- if (hasFilter)
3898
- filterOptions.push(hasFilter);
3899
- }
3900
- catch (error) {
3901
- const newOption = await this.filterOptionRepository.create({ ...options.value[i], filterId });
3902
- filterOptions.push(newOption);
3903
- }
3904
- }
3905
- return filterOptions;
3906
- }
3907
- if (Array.isArray(options) && options.length) {
3908
- let filterOptions = [];
3909
- for (let i = 0; i < options.length; i++) {
3910
- try {
3911
- const hasFilter = await this.filterOptionRepository.get({ id: options[i].id });
3912
- if (hasFilter)
3913
- filterOptions.push(hasFilter);
3914
- }
3915
- catch (error) {
3916
- const newOption = await this.filterOptionRepository.create({ ...options[i], filterId });
3917
- filterOptions.push(newOption);
3918
- }
3919
- }
3920
- }
3921
- return [];
3922
- }
3923
- async delete(params) {
3924
- const { data: categoryFilters } = await this.categoryFilterRepository.find({
3925
- filters: {
3926
- filterId: params.id,
3927
- },
3928
- });
3929
- if (categoryFilters.length)
3930
- throw new Error('Erro: o filtro está associado a uma ou mais categoria(s)');
3931
- await this.deleteOptions(+params.id);
3932
- await super.delete({ id: +params.id });
3933
- return;
3934
- }
3935
- async deleteOptions(filterId) {
3936
- await this.mutation('delete_filter_option', ['affected_rows'], {
3937
- where: {
3938
- type: 'filter_option_bool_exp',
3939
- required: true,
3940
- value: { filter_id: { _eq: filterId } },
3941
- },
3942
- });
3943
- }
3944
- }
3945
-
3946
- class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3947
- constructor({ endpoint, authOptions, interceptors, }) {
3948
- super({
3949
- tableName: 'filter_option',
3950
- model: FilterOption,
3951
- endpoint,
3952
- authOptions,
3953
- interceptors,
3954
- fields: [
3955
- 'id',
3956
- 'description',
3957
- { filterId: { columnName: 'filter_id' } },
3958
- { createdAt: { columnName: 'created_at' } },
3959
- { updatedAt: { columnName: 'updated_at' } },
3960
- ],
3961
- });
3962
- }
3963
2742
  }
3964
2743
 
3965
2744
  class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3966
- constructor({ endpoint, authOptions, interceptors, }) {
2745
+ constructor(endpoint, authOptions) {
3967
2746
  super({
3968
2747
  tableName: 'product',
3969
2748
  model: ProductHasuraGraphQL,
3970
2749
  endpoint,
3971
2750
  authOptions,
3972
- interceptors,
3973
2751
  fields: [],
3974
2752
  });
3975
2753
  this.bindReviewToModel = (plain) => ({
@@ -4002,9 +2780,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4002
2780
  whoMustUse: data.who_must_use,
4003
2781
  howToUse: data.how_to_use,
4004
2782
  brand: data.brand_description,
4005
- ingredients: data.ingredients,
4006
2783
  }),
4007
- bindFindFilter: (filters) => {
2784
+ bindFindFilter: (sentence) => {
2785
+ const filters = Object.values(sentence).shift();
4008
2786
  return {
4009
2787
  ...(filters?.description && { description: filters.description }),
4010
2788
  ...(filters.differentials && { differentials: filters.differentials }),
@@ -4017,9 +2795,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4017
2795
  ...(filters.brand && {
4018
2796
  brand_description: filters.brand,
4019
2797
  }),
4020
- ...(filters.ingredients && {
4021
- ingredients: filters.ingredients,
4022
- }),
4023
2798
  };
4024
2799
  },
4025
2800
  bindPersistData: (descriptionData) => ({
@@ -4030,7 +2805,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4030
2805
  }),
4031
2806
  ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
4032
2807
  ...(descriptionData.brand && { brand_description: descriptionData.brand }),
4033
- ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
4034
2808
  }),
4035
2809
  },
4036
2810
  },
@@ -4038,7 +2812,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4038
2812
  { whoMustUse: { columnName: 'who_must_use' } },
4039
2813
  { howToUse: { columnName: 'how_to_use' } },
4040
2814
  { brandDescription: { columnName: 'brand_description' } },
4041
- { ingredients: { columnName: 'ingredients' } },
4042
2815
  { hasVariants: { columnName: 'has_variants' } },
4043
2816
  {
4044
2817
  images: {
@@ -4062,7 +2835,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4062
2835
  subscriberDiscountPercentage: data.subscriber_discount_percentage,
4063
2836
  subscriberPrice: data.subscriber_price,
4064
2837
  }),
4065
- bindFindFilter: (filters) => {
2838
+ bindFindFilter: (sentence) => {
2839
+ const filters = Object.values(sentence).shift();
4066
2840
  return {
4067
2841
  ...((filters?.price || filters?.price === 0) && { price: filters.price }),
4068
2842
  ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
@@ -4096,29 +2870,27 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4096
2870
  to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
4097
2871
  },
4098
2872
  },
4099
- { hasStock: { columnName: 'has_stock' } },
4100
2873
  'slug',
4101
2874
  'type',
4102
2875
  'video',
4103
2876
  'weight',
4104
2877
  'gender',
4105
- { intGender: { columnName: 'int_gender' } },
4106
2878
  { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
4107
- { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
4108
2879
  { isKit: { columnName: 'is_kit' } },
4109
2880
  { createdAt: { columnName: 'created_at' } },
4110
2881
  { updatedAt: { columnName: 'updated_at' } },
4111
- { rate: { columnName: 'rating' } },
4112
- { reviewsTotal: { columnName: 'reviews_total' } },
4113
- { shoppingCount: { columnName: 'shopping_count' } },
4114
- { categoryId: { columnName: 'category_id' } },
4115
2882
  {
4116
- category: {
4117
- columnName: 'category',
4118
- foreignKeyColumn: { id: 'categoryId' },
4119
- fields: ['id', 'name', 'reference', 'slug'],
2883
+ rate: {
2884
+ columnName: 'reviews_aggregate',
2885
+ filters: {
2886
+ filters: { status: true },
2887
+ filterType: 'product_review_bool_exp',
2888
+ },
2889
+ fields: [{ aggregate: [{ avg: ['rate'] }] }],
2890
+ from: (value) => value.aggregate.avg.rate,
4120
2891
  },
4121
2892
  },
2893
+ { shoppingCount: { columnName: 'shopping_count' } },
4122
2894
  ];
4123
2895
  this.fields = [
4124
2896
  ...commonFields,
@@ -4195,7 +2967,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4195
2967
  }
4196
2968
  async get(identifiers) {
4197
2969
  const product = Number.isNaN(+identifiers.id)
4198
- ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data?.[0]
2970
+ ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
4199
2971
  : await super.get(identifiers);
4200
2972
  if (product.productId)
4201
2973
  throw new NotFoundError('Product not found, it is a variant');
@@ -4208,25 +2980,10 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4208
2980
  this.fields
4209
2981
  .map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
4210
2982
  .filter((field) => field !== 'reviews');
4211
- if (options.options?.minimal?.includes('price'))
4212
- options.options?.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
4213
- if (options.options?.maximum?.includes('price'))
4214
- options.options?.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
4215
- options.options?.minimal?.splice(options.options?.minimal.indexOf('price'), 1);
4216
- options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
4217
2983
  return super.find({
4218
2984
  ...options,
4219
2985
  filters: { ...filters, productId: { operator: Where.ISNULL } },
4220
- fields: [
4221
- ...bindFields,
4222
- ...(bindFields.includes('price')
4223
- ? [
4224
- 'subscriberPrice',
4225
- 'subscriberDiscountPercentage',
4226
- 'fullPrice',
4227
- ]
4228
- : []),
4229
- ],
2986
+ fields: bindFields,
4230
2987
  });
4231
2988
  }
4232
2989
  async getBySlug(slug) {
@@ -4234,13 +2991,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4234
2991
  filters: {
4235
2992
  slug,
4236
2993
  },
4237
- fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
4238
- options: {
4239
- enableCount: false,
4240
- },
4241
2994
  });
4242
2995
  const product = result?.data?.shift();
4243
- RoundProductPricesHelper.roundProductPrices(product);
2996
+ product.reviews = await this.findReviewsByProduct(+product.id);
4244
2997
  return product;
4245
2998
  }
4246
2999
  async update(params) {
@@ -4277,17 +3030,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4277
3030
  })),
4278
3031
  ], []);
4279
3032
  }
4280
- async findCatalog(params, mainGender) {
4281
- return this.find({
4282
- ...params,
4283
- filters: { ...params.filters, published: true },
4284
- orderBy: {
4285
- hasStock: 'desc',
4286
- ...(!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' }),
4287
- ...omit(params.orderBy, ['hasStock', 'intGender']),
4288
- },
4289
- });
4290
- }
4291
3033
  async updateCategories(productId, { categories }) {
4292
3034
  if ('action' in categories && categories.action === 'remove') {
4293
3035
  await this.mutation('delete_category_product', ['affected_rows'], {
@@ -4401,7 +3143,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4401
3143
  async getId(id) {
4402
3144
  if (!Number.isNaN(+id))
4403
3145
  return id;
4404
- const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3146
+ const { data } = await this.find({ filters: { firestoreId: id } });
4405
3147
  if (data?.[0]?.id)
4406
3148
  return data?.[0]?.id;
4407
3149
  throw new NotFoundError(`Product with id ${id} not found`);
@@ -4457,29 +3199,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4457
3199
  });
4458
3200
  return data && data[0] && this.bindReviewToModel(data[0]);
4459
3201
  }
4460
- async cleanShoppingCountFromIds(ids) {
4461
- return await this.mutation('update_product', ['affected_rows'], {
4462
- where: {
4463
- value: { id: { _nin: ids } },
4464
- type: 'product_bool_exp',
4465
- required: true,
4466
- },
4467
- _set: {
4468
- value: { shopping_count: 0 },
4469
- type: 'product_set_input',
4470
- },
4471
- });
4472
- }
4473
3202
  }
4474
3203
 
4475
3204
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
4476
- constructor({ endpoint, authOptions, interceptors, }) {
3205
+ constructor(endpoint, authOptions) {
4477
3206
  super({
4478
3207
  tableName: 'product',
4479
3208
  model: VariantHasuraGraphQL,
4480
3209
  endpoint,
4481
3210
  authOptions,
4482
- interceptors,
4483
3211
  fields: [
4484
3212
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
4485
3213
  { firestoreId: { columnName: 'firestore_id' } },
@@ -4515,12 +3243,12 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4515
3243
  };
4516
3244
  },
4517
3245
  bindPersistData: (priceData) => ({
4518
- ...((priceData?.price || 0) >= 0 && { price: priceData.price }),
4519
- ...((priceData?.fullPrice || 0) >= 0 && { full_price: priceData.fullPrice }),
4520
- ...((priceData?.subscriberDiscountPercentage || 0) >= 0 && {
3246
+ ...(priceData?.price >= 0 && { price: priceData.price }),
3247
+ ...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
3248
+ ...(priceData.subscriberDiscountPercentage >= 0 && {
4521
3249
  subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
4522
3250
  }),
4523
- ...((priceData?.subscriberPrice || 0) >= 0 && { subscriber_price: priceData.subscriberPrice }),
3251
+ ...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
4524
3252
  }),
4525
3253
  },
4526
3254
  },
@@ -4535,7 +3263,6 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4535
3263
  to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
4536
3264
  },
4537
3265
  },
4538
- { hasStock: { columnName: 'has_stock' } },
4539
3266
  'weight',
4540
3267
  { name: { to: () => '', from: () => undefined } },
4541
3268
  { hasVariants: { columnName: 'has_variants', to: () => false, from: () => undefined } },
@@ -4573,247 +3300,16 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4573
3300
  async getId(id) {
4574
3301
  if (!Number.isNaN(+id))
4575
3302
  return id;
4576
- const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3303
+ const { data } = await this.find({ filters: { firestoreId: id } });
4577
3304
  if (data?.[0]?.id)
4578
3305
  return data?.[0]?.id;
4579
3306
  throw new NotFoundError(`Product with id ${id} not found`);
4580
3307
  }
4581
3308
  }
4582
3309
 
4583
- class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
4584
- constructor({ endpoint, authOptions, interceptors, }, categoryFilterRepository) {
4585
- super({
4586
- tableName: 'category',
4587
- model: Wishlist,
4588
- endpoint,
4589
- authOptions,
4590
- interceptors,
4591
- fields: [
4592
- { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
4593
- { firestoreId: { columnName: 'firestore_id' } },
4594
- 'name',
4595
- 'description',
4596
- 'image',
4597
- 'published',
4598
- 'shop',
4599
- { shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
4600
- 'slug',
4601
- { brandCategory: { columnName: 'brand_category' } },
4602
- { brandCategoryBanner: { columnName: 'brand_banner' } },
4603
- { brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
4604
- { brandLogo: { columnName: 'brand_logo' } },
4605
- { brandCondition: { columnName: 'brand_condition' } },
4606
- {
4607
- conditions: {
4608
- columnName: 'tag_condition',
4609
- type: HasuraGraphQLColumnType.Jsonb,
4610
- from: (tags, row) => ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }),
4611
- bindPersistData: (value) => {
4612
- return {
4613
- brand_condition: value.brand,
4614
- tag_condition: value?.tags || [],
4615
- };
4616
- },
4617
- bindFindFilter: (sentence) => {
4618
- return {
4619
- ...(sentence.brand ? { brand_condition: sentence.brand } : {}),
4620
- ...(sentence.tags ? { tag_condition: sentence.tags } : {}),
4621
- };
4622
- },
4623
- },
4624
- },
4625
- {
4626
- filters: {
4627
- columnName: 'filters',
4628
- foreignKeyColumn: { filter_id: 'id' },
4629
- fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
4630
- bindPersistData: (value) => ({
4631
- filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
4632
- }),
4633
- from: (filters) => filters?.map((filter) => filter?.filter) || [],
4634
- },
4635
- },
4636
- { createdAt: { columnName: 'created_at' } },
4637
- { updatedAt: { columnName: 'updated_at' } },
4638
- {
4639
- products: {
4640
- columnName: 'products',
4641
- fields: ['product_id'],
4642
- from: (value) => value.map((product) => product.product_id.toString()),
4643
- to: (productIds) => productIds.map((productId) => ({
4644
- product_id: +productId,
4645
- })),
4646
- },
4647
- },
4648
- {
4649
- metadata: {
4650
- columnName: 'metadata',
4651
- fields: ['title', 'description'],
4652
- bindPersistData: (value) => ({
4653
- metadata: { data: value },
4654
- }),
4655
- },
4656
- },
4657
- { isCollection: { columnName: 'is_collection' } },
4658
- { isWishlist: { columnName: 'is_wishlist' } },
4659
- 'reference',
4660
- { parentId: { columnName: 'parent_id' } },
4661
- {
4662
- parent: {
4663
- columnName: 'parent',
4664
- foreignKeyColumn: { id: 'parentId' },
4665
- fields: ['id', 'name', 'reference', 'slug'],
4666
- },
4667
- },
4668
- { personId: { columnName: 'person_id' } },
4669
- ],
4670
- });
4671
- this.categoryFilterRepository = categoryFilterRepository;
4672
- }
4673
- async create(params) {
4674
- const { metadata, ...data } = params;
4675
- return super.create({
4676
- ...data,
4677
- isWishlist: true,
4678
- isCollection: true,
4679
- brandCategory: false,
4680
- metadata: metadata || { description: data.description, title: data.name },
4681
- });
4682
- }
4683
- async get(identifiers) {
4684
- const data = await super.get(identifiers);
4685
- if (!data.isWishlist)
4686
- throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
4687
- return data;
4688
- }
4689
- async update(params) {
4690
- const { products, id: checkId, metadata, filters, ...data } = params;
4691
- const plainData = this.paramsToPlain({ id: checkId });
4692
- const id = plainData.id;
4693
- const category = await super.update({ id, ...data, isWishlist: true, isCollection: true, brandCategory: false });
4694
- category.products = products && (await this.updateProducts(+id, { products }));
4695
- category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
4696
- return category;
4697
- }
4698
- async getWishlistBySlug(slug) {
4699
- if (!slug)
4700
- return;
4701
- const { data } = await this.find({
4702
- filters: {
4703
- slug,
4704
- isWishlist: { operator: Where.EQUALS, value: true },
4705
- },
4706
- options: {
4707
- enableCount: false,
4708
- },
4709
- });
4710
- if (!data.length)
4711
- throw new NotFoundError(`Wishlist with slug ${slug} not found`);
4712
- if (data.length > 1)
4713
- throw new DuplicatedResultsError('Query returned duplicated values');
4714
- return data.shift();
4715
- }
4716
- async getWishlistByPerson(personId) {
4717
- if (!personId)
4718
- return;
4719
- const { data } = await this.find({
4720
- filters: {
4721
- personId: { operator: Where.EQUALS, value: personId },
4722
- isWishlist: { operator: Where.EQUALS, value: true },
4723
- },
4724
- options: {
4725
- enableCount: false,
4726
- },
4727
- });
4728
- if (!data.length)
4729
- throw new NotFoundError(`Wishlists from person ${personId} not found`);
4730
- return data;
4731
- }
4732
- async updateProducts(categoryId, { products }) {
4733
- if ('action' in products && products.action === 'remove') {
4734
- await this.mutation('delete_category_product', ['affected_rows'], {
4735
- where: {
4736
- type: 'category_product_bool_exp',
4737
- required: true,
4738
- value: { category_id: { _eq: categoryId } },
4739
- },
4740
- });
4741
- await this.categoryFilterRepository.deleteByCategory(categoryId);
4742
- return [];
4743
- }
4744
- const plainData = this.paramsToPlain({ products });
4745
- if (!plainData.products || plainData.products.length <= 0)
4746
- return [];
4747
- await this.mutation('delete_category_product', ['affected_rows'], {
4748
- where: {
4749
- type: 'category_product_bool_exp',
4750
- required: true,
4751
- value: { category_id: { _eq: categoryId } },
4752
- },
4753
- });
4754
- await this.categoryFilterRepository.deleteByCategory(categoryId);
4755
- await this.mutation('insert_category_product', ['affected_rows'], {
4756
- objects: {
4757
- type: '[category_product_insert_input!]',
4758
- required: true,
4759
- value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
4760
- },
4761
- });
4762
- return plainData.products;
4763
- }
4764
- async updateMetadata(categoryId, { metadata }) {
4765
- const plainData = this.paramsToPlain({ metadata });
4766
- if (!plainData.metadata)
4767
- return;
4768
- await this.mutation('update_category_metadata_by_pk', ['category_id'], {
4769
- pk_columns: {
4770
- value: { category_id: categoryId },
4771
- type: 'category_metadata_pk_columns_input',
4772
- required: true,
4773
- },
4774
- _set: {
4775
- value: omit(metadata, ['category_id']),
4776
- type: 'category_metadata_set_input',
4777
- required: true,
4778
- },
4779
- });
4780
- return plainData.metadata;
4781
- }
4782
- getCategoryBySlug(slug, _shop) {
4783
- return this.getWishlistBySlug(slug);
4784
- }
4785
- async getCategoryByShop(shop) {
4786
- if (!shop)
4787
- return;
4788
- const { data } = await this.find({
4789
- filters: {
4790
- shops: { operator: Where.IN, value: [shop] },
4791
- published: { operator: Where.EQUALS, value: true },
4792
- isWishlist: { operator: Where.EQUALS, value: true },
4793
- },
4794
- options: {
4795
- enableCount: false,
4796
- },
4797
- });
4798
- return data;
4799
- }
4800
- getCategoriesForHome(categoryIds, limit, gender) {
4801
- return;
4802
- }
4803
- mountCategory(category, options) {
4804
- return;
4805
- }
4806
- getChildren(parentId) {
4807
- return;
4808
- }
4809
- isChild(id, parentId) {
4810
- return;
4811
- }
4812
- }
4813
-
4814
3310
  /**
4815
3311
  * Generated bundle index. Do not edit.
4816
3312
  */
4817
3313
 
4818
- 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 };
3314
+ 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, chunk, get, is, isBoolean, isDate, isEmpty, isInteger, isNaN$1 as isNaN, isNil, isNumber, isObject, isString, isUUID, now, omit, parseDateTime, pick, set, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
4819
3315
  //# sourceMappingURL=infrab4a-connect.mjs.map