@infrab4a/connect 4.0.0-beta.50 → 4.0.0-beta.6

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 -7
  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 -11
  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 +20 -126
  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 -2000
  143. package/fesm2015/infrab4a-connect.mjs.map +1 -1
  144. package/fesm2020/infrab4a-connect.mjs +425 -1967
  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 -9
  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 -24
  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 -15
  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 +6 -9
  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,18 @@ 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 lodash, { get as get$1, isString as isString$1 } from 'lodash';
10
7
  import { CustomError } from 'ts-custom-error';
11
8
  import axios from 'axios';
12
9
  import { collection, getDoc, doc, where, orderBy, getDocs, query, startAfter, startAt, limit, addDoc, setDoc, deleteField, arrayUnion, arrayRemove, deleteDoc, Timestamp } from 'firebase/firestore';
13
10
  import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
14
11
  import { mutation, query as query$1 } from 'gql-query-builder';
12
+ import fetch from 'node-fetch';
15
13
 
16
14
  class BaseModel {
17
15
  get identifier() {
18
16
  const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
19
- const data = this;
20
- return fields.reduce((object, field) => ({ ...object, [field]: data[field] }), {});
17
+ return fields.reduce((object, field) => ({ ...object, [field]: this[field] }), {});
21
18
  }
22
19
  get identifiersFields() {
23
20
  return this.constructor.identifiersFields;
@@ -463,437 +460,11 @@ __decorate([
463
460
  __metadata("design:type", Payment)
464
461
  ], SubscriptionPayment.prototype, "payment", void 0);
465
462
 
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(' ');
463
+ class Address extends BaseModel {
464
+ static get identifiersFields() {
465
+ return ['id'];
806
466
  }
807
467
  }
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
468
 
898
469
  const get = (object, path, defaultValue) => get$1(object, path, defaultValue);
899
470
 
@@ -901,7 +472,7 @@ function is(value) {
901
472
  return value;
902
473
  }
903
474
 
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);
475
+ 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
476
 
906
477
  class Base {
907
478
  constructor(...args) {
@@ -910,7 +481,7 @@ class Base {
910
481
  }
911
482
 
912
483
  const parseDateTime = (value) => {
913
- if (!isString(value))
484
+ if (!isString$1(value))
914
485
  return value;
915
486
  if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
916
487
  !/^\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 +492,8 @@ const parseDateTime = (value) => {
921
492
  return date;
922
493
  };
923
494
 
495
+ const { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN: isNaN$1, isNil, isNumber, isObject, isString, now, omit, pick, set, } = lodash;
496
+
924
497
  var CheckoutTypes;
925
498
  (function (CheckoutTypes) {
926
499
  CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
@@ -965,28 +538,26 @@ class Coupon extends BaseModel {
965
538
  static createCoupon(userId) {
966
539
  return this.toInstance({
967
540
  nickname: `${Date.now()}`,
541
+ type: CouponTypes.ABSOLUTE,
968
542
  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
- },
543
+ discount: 30,
983
544
  user: userId,
545
+ useLimit: 1,
546
+ useLimitPerUser: true,
984
547
  createdAt: new Date(Date.now()),
985
548
  beginAt: new Date(Date.now()),
986
549
  expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
987
550
  });
988
551
  }
989
552
  }
553
+ __decorate([
554
+ Expose({ name: 'checkout_type' }),
555
+ __metadata("design:type", Number)
556
+ ], Coupon.prototype, "checkoutType", void 0);
557
+ __decorate([
558
+ Expose({ name: 'exclusivity_type' }),
559
+ __metadata("design:type", Number)
560
+ ], Coupon.prototype, "exclusivityType", void 0);
990
561
 
991
562
  class SubscriptionPlan extends BaseModel {
992
563
  static get identifiersFields() {
@@ -1026,18 +597,6 @@ __decorate([
1026
597
  __metadata("design:type", BeautyProfile)
1027
598
  ], User.prototype, "beautyProfile", void 0);
1028
599
 
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
600
  class Subscription extends BaseModel {
1042
601
  static get identifiersFields() {
1043
602
  return ['id'];
@@ -1052,12 +611,12 @@ __decorate([
1052
611
  __metadata("design:type", SubscriptionPlan)
1053
612
  ], Subscription.prototype, "subscriptionPlan", void 0);
1054
613
  __decorate([
1055
- Type(() => UserAddress),
1056
- __metadata("design:type", UserAddress)
614
+ Type(() => Address),
615
+ __metadata("design:type", Address)
1057
616
  ], Subscription.prototype, "shippingAddress", void 0);
1058
617
  __decorate([
1059
- Type(() => UserAddress),
1060
- __metadata("design:type", UserAddress)
618
+ Type(() => Address),
619
+ __metadata("design:type", Address)
1061
620
  ], Subscription.prototype, "billingAddress", void 0);
1062
621
  __decorate([
1063
622
  Type(() => Coupon),
@@ -1072,6 +631,12 @@ __decorate([
1072
631
  __metadata("design:type", Array)
1073
632
  ], Subscription.prototype, "payment", void 0);
1074
633
 
634
+ class UserAddress extends Address {
635
+ static get identifiersFields() {
636
+ return ['id', 'userId'];
637
+ }
638
+ }
639
+
1075
640
  class UserPaymentMethod extends BaseModel {
1076
641
  static get identifiersFields() {
1077
642
  return ['id', 'userId'];
@@ -1103,7 +668,7 @@ class Authentication {
1103
668
  async signIn({ email, password }, signInMethod) {
1104
669
  const method = this.getServiceByMethod(signInMethod);
1105
670
  const userAuth = await this.authService[method]({ email, password });
1106
- const user = this.userRepository.get({ id: userAuth.id });
671
+ const user = this.userRepository.get(userAuth);
1107
672
  if (!isNil(user))
1108
673
  return user;
1109
674
  if (/^.+@b4a.com.br$/.test(userAuth.email))
@@ -1196,123 +761,14 @@ class RecoveryPassword {
1196
761
  }
1197
762
  }
1198
763
 
1199
- class Filter extends BaseModel {
1200
- static get identifiersFields() {
1201
- return ['id'];
1202
- }
1203
- }
1204
-
1205
- class CategoryBase extends BaseModel {
1206
- static get identifiersFields() {
1207
- return ['id'];
1208
- }
1209
- }
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() {
764
+ class Category extends BaseModel {
765
+ identifierFields() {
1275
766
  return ['id'];
1276
767
  }
1277
- }
1278
- __decorate([
1279
- Type(() => KitProduct),
1280
- __metadata("design:type", Array)
1281
- ], ProductForCategory.prototype, "kitProducts", void 0);
1282
-
1283
- class Category extends CategoryBase {
1284
768
  static get identifiersFields() {
1285
769
  return ['id'];
1286
770
  }
1287
771
  }
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
772
 
1317
773
  var GenderDestination;
1318
774
  (function (GenderDestination) {
@@ -1329,60 +785,54 @@ var Shops;
1329
785
  Shops["ALL"] = "ALL";
1330
786
  })(Shops || (Shops = {}));
1331
787
 
1332
- class FilterOption extends BaseModel {
1333
- static get identifiersFields() {
788
+ class Product extends BaseModel {
789
+ identifierFields() {
1334
790
  return ['id'];
1335
791
  }
1336
- }
1337
-
1338
- class Product extends ProductBase {
1339
792
  static get identifiersFields() {
1340
793
  return ['id'];
1341
794
  }
1342
795
  }
1343
- __decorate([
1344
- Type(() => CategoryForProduct),
1345
- __metadata("design:type", CategoryForProduct)
1346
- ], Product.prototype, "category", void 0);
1347
796
  __decorate([
1348
797
  Type(() => KitProduct),
1349
798
  __metadata("design:type", Array)
1350
799
  ], Product.prototype, "kitProducts", void 0);
1351
800
 
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 {
801
+ class KitProduct extends BaseModel {
1365
802
  static get identifiersFields() {
1366
- return ['id'];
803
+ return ['productId', 'kitProducId'];
1367
804
  }
1368
805
  }
1369
806
  __decorate([
1370
- Type(() => Category),
1371
- __metadata("design:type", Array)
1372
- ], Buy2Win.prototype, "categories", void 0);
807
+ Type(() => Product),
808
+ __metadata("design:type", Product)
809
+ ], KitProduct.prototype, "kit", void 0);
810
+ __decorate([
811
+ Type(() => Product),
812
+ __metadata("design:type", Product)
813
+ ], KitProduct.prototype, "product", void 0);
1373
814
 
1374
- class CampaignDashboard extends BaseModel {
1375
- static get identifiersFields() {
815
+ class Variant extends BaseModel {
816
+ identifierFields() {
1376
817
  return ['id'];
1377
818
  }
1378
- }
1379
-
1380
- class CampaignHashtag extends BaseModel {
1381
819
  static get identifiersFields() {
1382
- return ['id'];
820
+ return ['id', 'productId'];
1383
821
  }
1384
822
  }
1385
823
 
824
+ var OrderStatus;
825
+ (function (OrderStatus) {
826
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
827
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
828
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
829
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
830
+ OrderStatus["ENVIADO"] = "Enviado";
831
+ OrderStatus["ENTREGUE"] = "Entregue";
832
+ OrderStatus["CANCELADO"] = "Cancelado";
833
+ OrderStatus["CREDIT_CARD"] = "credit_card";
834
+ })(OrderStatus || (OrderStatus = {}));
835
+
1386
836
  class LineItem extends Product {
1387
837
  }
1388
838
 
@@ -1406,12 +856,12 @@ __decorate([
1406
856
  __metadata("design:type", User)
1407
857
  ], Checkout.prototype, "user", void 0);
1408
858
  __decorate([
1409
- Type(() => UserAddress),
1410
- __metadata("design:type", UserAddress)
859
+ Type(() => Address),
860
+ __metadata("design:type", Address)
1411
861
  ], Checkout.prototype, "shippingAddress", void 0);
1412
862
  __decorate([
1413
- Type(() => UserAddress),
1414
- __metadata("design:type", UserAddress)
863
+ Type(() => Address),
864
+ __metadata("design:type", Address)
1415
865
  ], Checkout.prototype, "billingAddress", void 0);
1416
866
  __decorate([
1417
867
  Type(() => ShippingMethod),
@@ -1422,18 +872,6 @@ __decorate([
1422
872
  __metadata("design:type", Coupon)
1423
873
  ], Checkout.prototype, "coupon", void 0);
1424
874
 
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
875
  class Order extends Checkout {
1438
876
  }
1439
877
  __decorate([
@@ -1447,12 +885,12 @@ class CheckoutSubscription extends BaseModel {
1447
885
  }
1448
886
  }
1449
887
  __decorate([
1450
- Type(() => UserAddress),
1451
- __metadata("design:type", UserAddress)
888
+ Type(() => Address),
889
+ __metadata("design:type", Address)
1452
890
  ], CheckoutSubscription.prototype, "shippingAddress", void 0);
1453
891
  __decorate([
1454
- Type(() => UserAddress),
1455
- __metadata("design:type", UserAddress)
892
+ Type(() => Address),
893
+ __metadata("design:type", Address)
1456
894
  ], CheckoutSubscription.prototype, "billingAddress", void 0);
1457
895
  __decorate([
1458
896
  Type(() => SubscriptionPlan),
@@ -1463,19 +901,15 @@ __decorate([
1463
901
  __metadata("design:type", Coupon)
1464
902
  ], CheckoutSubscription.prototype, "coupon", void 0);
1465
903
 
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;
904
+ class Buy2Win extends BaseModel {
905
+ static get identifiersFields() {
906
+ return ['id'];
1477
907
  }
1478
908
  }
909
+ __decorate([
910
+ Type(() => Category),
911
+ __metadata("design:type", Array)
912
+ ], Buy2Win.prototype, "categories", void 0);
1479
913
 
1480
914
  var FilterType;
1481
915
  (function (FilterType) {
@@ -1576,12 +1010,6 @@ class ShopMenu extends BaseModel {
1576
1010
  }
1577
1011
  }
1578
1012
 
1579
- class ShopSettings extends BaseModel {
1580
- static get identifiersFields() {
1581
- return ['id'];
1582
- }
1583
- }
1584
-
1585
1013
  class InvalidArgumentError extends CustomError {
1586
1014
  constructor(message) {
1587
1015
  super(message);
@@ -1612,16 +1040,12 @@ class AxiosAdapter {
1612
1040
  constructor(config) {
1613
1041
  this.config = config;
1614
1042
  }
1615
- async get(index, id) {
1043
+ async get(index) {
1616
1044
  try {
1617
1045
  const { data } = await axios({
1618
- url: `${this.config.url}/${index}/_doc/${id}`,
1046
+ url: `${this.config.url}/${index}`,
1619
1047
  method: 'GET',
1620
- responseType: 'json',
1621
- headers: {
1622
- 'Content-Type': 'application/json',
1623
- Authorization: `ApiKey ${this.config.credential}`,
1624
- },
1048
+ headers: { Authorization: `Basic ${this.config.credential}` },
1625
1049
  });
1626
1050
  return data._source;
1627
1051
  }
@@ -1633,14 +1057,9 @@ class AxiosAdapter {
1633
1057
  }
1634
1058
  async query(index, query) {
1635
1059
  const { data } = await axios({
1636
- url: `${this.config.url}/${index}/_search`,
1060
+ url: `${this.config.url}/${index}`,
1637
1061
  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
- },
1062
+ headers: { Authorization: `Basic ${this.config.credential}` },
1644
1063
  data: query,
1645
1064
  });
1646
1065
  return {
@@ -1650,25 +1069,17 @@ class AxiosAdapter {
1650
1069
  }
1651
1070
  async save(index, data) {
1652
1071
  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}`,
1072
+ url: `${this.config.url}/${index}`,
1662
1073
  method: 'PUT',
1663
- headers: { Authorization: `ApiKey ${this.config.credential}` },
1074
+ headers: { Authorization: `Basic ${this.config.credential}` },
1664
1075
  data,
1665
1076
  });
1666
1077
  }
1667
- async delete(index, id) {
1078
+ async delete(index) {
1668
1079
  await axios({
1669
- url: `${this.config.url}/${index}/_doc/${id}`,
1080
+ url: `${this.config.url}/${index}`,
1670
1081
  method: 'DELETE',
1671
- headers: { Authorization: `ApiKey ${this.config.credential}` },
1082
+ headers: { Authorization: `Basic ${this.config.credential}` },
1672
1083
  });
1673
1084
  }
1674
1085
  }
@@ -1676,16 +1087,13 @@ class AxiosAdapter {
1676
1087
  class ProductsIndex {
1677
1088
  constructor(adapter) {
1678
1089
  this.adapter = adapter;
1679
- this.index = `products`;
1680
1090
  }
1681
- async getById(id) {
1682
- const data = await this.adapter.get(this.index, id);
1091
+ async get(id) {
1092
+ const data = await this.adapter.get(`products/_doc/${id}`);
1683
1093
  return Product.toInstance(data);
1684
1094
  }
1685
- async search(searchTerm, total, shop) {
1686
- const size = total || 9;
1095
+ async findById(ids, options) {
1687
1096
  const fields = [
1688
- 'EAN',
1689
1097
  'brand',
1690
1098
  'id',
1691
1099
  'images',
@@ -1696,82 +1104,73 @@ class ProductsIndex {
1696
1104
  'stock',
1697
1105
  'slug',
1698
1106
  'reviews',
1107
+ 'pricePaid',
1108
+ 'isGift',
1109
+ 'stock',
1110
+ 'weight',
1111
+ 'tags',
1699
1112
  'hasVariants',
1700
- 'rate',
1113
+ 'type',
1701
1114
  ];
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,
1115
+ const { hits } = await this.adapter.query('products/_search', {
1711
1116
  _source: fields,
1712
1117
  query: {
1713
1118
  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,
1119
+ filter: [
1120
+ {
1121
+ terms: {
1122
+ _id: ids,
1123
+ },
1730
1124
  },
1731
- },
1732
- should: {
1733
- match_phrase_prefix: {
1734
- 'name.search': {
1735
- query: `${searchTerm}`,
1736
- slop: 10,
1125
+ {
1126
+ term: {
1127
+ published: true,
1737
1128
  },
1738
1129
  },
1739
- },
1740
- filter,
1130
+ ...(options?.hasStock
1131
+ ? [
1132
+ {
1133
+ range: {
1134
+ 'stock.quantity': {
1135
+ gt: 0,
1136
+ },
1137
+ },
1138
+ },
1139
+ ]
1140
+ : []),
1141
+ ],
1741
1142
  },
1742
1143
  },
1144
+ ...(options?.size ? { size: options?.size } : {}),
1743
1145
  });
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;
1146
+ return hits.map((hit) => Product.toInstance(hit._source));
1751
1147
  }
1752
1148
  async save(product) {
1149
+ delete product.createdAt;
1150
+ delete product.updatedAt;
1151
+ delete product.kitProducts;
1753
1152
  try {
1754
- const { createdAt, updatedAt, kitProducts, ...data } = product;
1755
- this.adapter.save(this.index, data);
1153
+ if (!product.firestoreId)
1154
+ throw new Error('Is not a product from firestore');
1155
+ await this.get(product.firestoreId);
1156
+ await this.adapter.save(`products/_doc/${product.firestoreId}`, product.toPlain());
1756
1157
  }
1757
1158
  catch (error) {
1758
- console.error(error);
1759
- }
1760
- }
1761
- async update(product) {
1762
- try {
1763
- await this.adapter.update(this.index, product.id, product);
1764
- }
1765
- catch (error) {
1766
- console.error(error);
1159
+ if (!(error instanceof Error))
1160
+ throw error;
1161
+ console.error(error.message);
1162
+ await this.adapter.save(`products/_doc/${product.id}`, product.toPlain());
1767
1163
  }
1768
1164
  }
1769
- async delete(id) {
1165
+ async delete(product) {
1166
+ if (!product.firestoreId)
1167
+ return;
1770
1168
  try {
1771
- await this.adapter.delete(this.index, id);
1169
+ await this.get(product.firestoreId);
1170
+ await this.adapter.delete(`products/_doc/${product.firestoreId}`);
1772
1171
  }
1773
1172
  catch (error) {
1774
- console.error(error);
1173
+ await this.adapter.delete(`products/_doc/${product.id}`);
1775
1174
  }
1776
1175
  }
1777
1176
  }
@@ -1801,39 +1200,17 @@ const withFirestore = (MixinBase) => {
1801
1200
  : bindDate(data[key], key),
1802
1201
  }), {});
1803
1202
  };
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;
1814
- };
1815
1203
  return class extends MixinBase {
1816
- constructor(...params) {
1817
- super(...params);
1818
- this.fields = {};
1819
- this.interceptors = {};
1204
+ constructor() {
1205
+ super(...arguments);
1820
1206
  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
1207
  }
1828
1208
  collection(path) {
1829
1209
  return collection(this.firestore, path || this.collectionName).withConverter(this.buildModelInstance());
1830
1210
  }
1831
1211
  buildModelInstance() {
1832
1212
  return {
1833
- toFirestore: (data) => {
1834
- const plain = data?.toPlain ? data.toPlain() : data;
1835
- return omitByRecursivelyInPlace(plain, (value) => value === undefined);
1836
- },
1213
+ toFirestore: (data) => (data?.toPlain ? data.toPlain() : data),
1837
1214
  fromFirestore: (snap) => {
1838
1215
  const data = snap.data();
1839
1216
  let bindedData = null;
@@ -1873,14 +1250,11 @@ const withHelpers = (MixinBase) => {
1873
1250
  const withGetFirestore = (MixinBase) => {
1874
1251
  return class GetFirestore extends MixinBase {
1875
1252
  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()));
1253
+ const docRef = await getDoc(doc(await this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(identifiers).shift().toString()));
1880
1254
  const data = docRef.data();
1881
1255
  if (isNil(data))
1882
1256
  throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
1883
- return this.interceptors?.response?.(data, intercepted) || data;
1257
+ return data;
1884
1258
  }
1885
1259
  buildCollectionPathForGet(identifiers) {
1886
1260
  return this.isSubCollection(this)
@@ -1917,7 +1291,7 @@ const withFindFirestore = (MixinBase) => {
1917
1291
  ], []);
1918
1292
  this.buildWhereSentence = (fieldName, options) => {
1919
1293
  if (this.isSubCollection(this) && fieldName === this.parentIdField)
1920
- return [];
1294
+ [];
1921
1295
  const value = options?.value || options;
1922
1296
  const object = {};
1923
1297
  set(object, fieldName, value);
@@ -1961,11 +1335,8 @@ const withFindFirestore = (MixinBase) => {
1961
1335
  return Object.keys(fieldsToOrderBy).map((fieldName) => orderBy(fieldName, fieldsToOrderBy[fieldName]));
1962
1336
  };
1963
1337
  }
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;
1338
+ async find({ filters, limits, orderBy, } = {}) {
1339
+ const collection = this.collection(this.buildCollectionPathForFind(filters));
1969
1340
  const queries = this.makeFirestoreWhere(filters || {});
1970
1341
  const ordination = this.makeFirestoreOrderBy(filters, orderBy);
1971
1342
  const offsets = await this.defineLimits(filters, limits);
@@ -1973,8 +1344,8 @@ const withFindFirestore = (MixinBase) => {
1973
1344
  const docs = await getDocs(query(collection, ...queryArgumments));
1974
1345
  const data = docs.docs.map((doc) => doc.data());
1975
1346
  return {
1976
- data: (await this.interceptors?.response?.(data, intercepted)) || data,
1977
- count: enableCount ? this.calculateCount(data, limits) : Infinity,
1347
+ data,
1348
+ count: this.calculateCount(data, limits),
1978
1349
  };
1979
1350
  }
1980
1351
  buildCollectionPathForFind(filters) {
@@ -1988,7 +1359,7 @@ const withFindFirestore = (MixinBase) => {
1988
1359
  const queries = [];
1989
1360
  if (limits?.offset) {
1990
1361
  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()))));
1362
+ queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), limits.offset.identifier.shift()))));
1992
1363
  else if (isNumber(limits.offset) || isString(limits.offset))
1993
1364
  queries.push(startAt(limits.offset));
1994
1365
  }
@@ -2009,16 +1380,12 @@ const withFindFirestore = (MixinBase) => {
2009
1380
  const withCreateFirestore = (MixinBase) => {
2010
1381
  return class CreateFirestore extends MixinBase {
2011
1382
  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);
1383
+ const docRef = await this.save(this.model.toInstance(data));
2016
1384
  const doc = await getDoc(docRef);
2017
- const docBuilded = (await this.interceptors?.response?.(doc.data(), intercepted)) || doc.data();
2018
- return docBuilded;
1385
+ return doc.data();
2019
1386
  }
2020
1387
  async save(data) {
2021
- const id = Object.values(data.identifier)?.shift()?.toString();
1388
+ const id = data.identifier[data.identifiersFields?.shift()]?.toString();
2022
1389
  const collectionPath = this.buildCollectionPathForAdd(data);
2023
1390
  const collection = this.collection(collectionPath);
2024
1391
  if (isEmpty(id))
@@ -2059,12 +1426,9 @@ const withUpdateFirestore = (MixinBase) => {
2059
1426
  const model = new this.model();
2060
1427
  const keyField = model.identifiersFields.shift();
2061
1428
  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;
1429
+ await setDoc(docRef, this.paramsToPlain(data), { merge: true });
1430
+ const docData = await getDoc(docRef);
1431
+ return docData.data();
2068
1432
  }
2069
1433
  buildCollectionPathForUpdate(identifiers) {
2070
1434
  return this.isSubCollection(this)
@@ -2086,11 +1450,7 @@ const withUpdateFirestore = (MixinBase) => {
2086
1450
  const withDeleteFirestore = (MixinBase) => {
2087
1451
  return class DeleteFirestore extends MixinBase {
2088
1452
  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);
1453
+ await deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(identifiers).shift().toString()));
2094
1454
  }
2095
1455
  buildCollectionPathForRemove(identifiers) {
2096
1456
  return this.isSubCollection(this)
@@ -2102,10 +1462,8 @@ const withDeleteFirestore = (MixinBase) => {
2102
1462
 
2103
1463
  const withSubCollection = (MixinBase, ParentModel) => {
2104
1464
  return class SubCollectionMix extends MixinBase {
2105
- constructor(...params) {
2106
- const options = params[0];
2107
- super(...params);
2108
- this.parentIdField = options.parentIdField;
1465
+ constructor(...args) {
1466
+ super(args);
2109
1467
  }
2110
1468
  collection(path) {
2111
1469
  return super.collection(path);
@@ -2119,87 +1477,73 @@ const withCrudFirestore = (MixinBase) => {
2119
1477
  };
2120
1478
 
2121
1479
  class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2122
- constructor({ firestore, interceptors }) {
2123
- super({
2124
- firestore,
2125
- collectionName: 'leads',
2126
- model: Lead,
2127
- interceptors,
2128
- });
1480
+ constructor(firestore) {
1481
+ super();
1482
+ this.firestore = firestore;
1483
+ this.collectionName = 'leads';
1484
+ this.model = Lead;
2129
1485
  }
2130
1486
  }
2131
1487
 
2132
1488
  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
- });
1489
+ constructor(firestore, parentRepository) {
1490
+ super();
1491
+ this.firestore = firestore;
2141
1492
  this.parentRepository = parentRepository;
1493
+ this.collectionName = 'editions';
1494
+ this.parentIdField = 'subscriptionId';
1495
+ this.model = Edition;
2142
1496
  }
2143
1497
  }
2144
1498
 
2145
1499
  class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2146
- constructor({ firestore, interceptors, }) {
2147
- super({
2148
- firestore,
2149
- collectionName: 'subscription',
2150
- model: Subscription,
2151
- interceptors,
2152
- });
1500
+ constructor(firestore) {
1501
+ super();
1502
+ this.firestore = firestore;
1503
+ this.collectionName = 'subscription';
1504
+ this.model = Subscription;
2153
1505
  }
2154
1506
  }
2155
1507
 
2156
1508
  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
- });
1509
+ constructor(firestore, parentRepository) {
1510
+ super();
1511
+ this.firestore = firestore;
2165
1512
  this.parentRepository = parentRepository;
1513
+ this.collectionName = 'payments';
1514
+ this.parentIdField = 'subscriptionId';
1515
+ this.model = SubscriptionPayment;
2166
1516
  }
2167
1517
  }
2168
1518
 
2169
1519
  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
- });
1520
+ constructor(firestore, parentRepository) {
1521
+ super();
1522
+ this.firestore = firestore;
2178
1523
  this.parentRepository = parentRepository;
1524
+ this.collectionName = 'address';
1525
+ this.parentIdField = 'userId';
1526
+ this.model = UserAddress;
2179
1527
  }
2180
1528
  }
2181
1529
 
2182
1530
  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
- });
1531
+ constructor(firestore, parentRepository) {
1532
+ super();
1533
+ this.firestore = firestore;
2191
1534
  this.parentRepository = parentRepository;
1535
+ this.collectionName = 'CX';
1536
+ this.parentIdField = 'userId';
1537
+ this.model = BeautyProfile;
2192
1538
  }
2193
1539
  }
2194
1540
 
2195
1541
  class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2196
- constructor({ firestore, interceptors }) {
2197
- super({
2198
- firestore,
2199
- collectionName: 'users',
2200
- model: User,
2201
- interceptors,
2202
- });
1542
+ constructor(firestore) {
1543
+ super();
1544
+ this.firestore = firestore;
1545
+ this.collectionName = 'users';
1546
+ this.model = User;
2203
1547
  }
2204
1548
  async get(identifiers) {
2205
1549
  const user = await super.get({ id: identifiers.id });
@@ -2239,26 +1583,22 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
2239
1583
  }
2240
1584
 
2241
1585
  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
- });
1586
+ constructor(firestore, parentRepository) {
1587
+ super();
1588
+ this.firestore = firestore;
2250
1589
  this.parentRepository = parentRepository;
1590
+ this.collectionName = 'payment_method';
1591
+ this.parentIdField = 'userId';
1592
+ this.model = UserPaymentMethod;
2251
1593
  }
2252
1594
  }
2253
1595
 
2254
1596
  class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2255
- constructor({ firestore, interceptors }) {
2256
- super({
2257
- firestore,
2258
- collectionName: 'categories',
2259
- model: Category,
2260
- interceptors,
2261
- });
1597
+ constructor(firestore) {
1598
+ super();
1599
+ this.firestore = firestore;
1600
+ this.collectionName = 'categories';
1601
+ this.model = Category;
2262
1602
  }
2263
1603
  async getCategoryBySlug(slug, shop) {
2264
1604
  const categoryDocs = await getDocs(query(this.collection(this.collectionName), where('slug', '==', slug), where('shop', '==', shop), where('published', '==', true)));
@@ -2268,14 +1608,14 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
2268
1608
  throw new NotFoundError(`Document with slug ${slug} not found`);
2269
1609
  return categoryDocs.docs[0].data();
2270
1610
  }
2271
- async getCategoriesForHome(categoryIds, limit = 4, gender) {
1611
+ async getCategoriesForHome(categoryIds, limit = 4) {
2272
1612
  const categorySnap = await getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
2273
1613
  if (categorySnap.empty)
2274
1614
  throw new NotFoundError('Categories not found');
2275
1615
  const categories = categorySnap.docs.map((doc) => doc.data());
2276
1616
  const homeSections = await Promise.all(categories.map(async (category) => ({
2277
1617
  category,
2278
- products: await this.mountCategory(category, { limit, hasStock: true, gender }),
1618
+ products: await this.mountCategory(category, { limit, hasStock: true }),
2279
1619
  })));
2280
1620
  return homeSections;
2281
1621
  }
@@ -2291,8 +1631,6 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
2291
1631
  wheres.push(where('published', '==', true), where('id', 'in', productIds));
2292
1632
  if (options?.hasStock)
2293
1633
  wheres.push(where('stock.quantity', '>', 0));
2294
- if (options?.gender)
2295
- wheres.push(where('tags', 'array-contains', options?.gender));
2296
1634
  if (options?.limit)
2297
1635
  wheres.push(limit(options?.limit));
2298
1636
  const productSnap = await getDocs(query(this.collection('productsErpVitrine'), ...wheres));
@@ -2302,26 +1640,15 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
2302
1640
  }
2303
1641
  return is(products);
2304
1642
  }
2305
- getCategoryByShop(shop) {
2306
- return;
2307
- }
2308
- getChildren(parentId) {
2309
- return;
2310
- }
2311
- isChild(id, parentId) {
2312
- return;
2313
- }
2314
1643
  }
2315
1644
 
2316
1645
  class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2317
- constructor({ firestore, interceptors }) {
2318
- super({
2319
- firestore,
2320
- collectionName: 'productsErpVitrine',
2321
- model: Product,
2322
- interceptors,
2323
- });
1646
+ constructor(firestore) {
1647
+ super();
1648
+ this.firestore = firestore;
2324
1649
  this.reviews = {};
1650
+ this.collectionName = 'productsErpVitrine';
1651
+ this.model = Product;
2325
1652
  }
2326
1653
  async getBySlug(slug) {
2327
1654
  const result = await this.find({
@@ -2356,101 +1683,43 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
2356
1683
  });
2357
1684
  return this.reviews[status];
2358
1685
  }
2359
- cleanShoppingCountFromIds() {
2360
- return;
2361
- }
2362
- findCatalog(params) {
2363
- return this.find(params);
2364
- }
2365
1686
  }
2366
1687
 
2367
1688
  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
- });
1689
+ constructor(firestore, parentRepository) {
1690
+ super();
1691
+ this.firestore = firestore;
2376
1692
  this.parentRepository = parentRepository;
1693
+ this.collectionName = 'variants';
1694
+ this.parentIdField = 'productId';
1695
+ this.model = Variant;
2377
1696
  }
2378
1697
  }
2379
1698
 
2380
1699
  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
- });
1700
+ constructor(firestore) {
1701
+ super();
1702
+ this.firestore = firestore;
1703
+ this.collectionName = 'subscriptionProducts';
1704
+ this.model = Product;
2421
1705
  }
2422
1706
  }
2423
1707
 
2424
1708
  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
- });
1709
+ constructor(firestore) {
1710
+ super();
1711
+ this.firestore = firestore;
1712
+ this.collectionName = 'checkouts';
1713
+ this.model = Checkout;
2443
1714
  }
2444
1715
  }
2445
1716
 
2446
1717
  class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2447
- constructor({ firestore, interceptors }) {
2448
- super({
2449
- firestore,
2450
- collectionName: 'coupons',
2451
- model: Coupon,
2452
- interceptors,
2453
- });
1718
+ constructor(firestore) {
1719
+ super();
1720
+ this.firestore = firestore;
1721
+ this.collectionName = 'coupons';
1722
+ this.model = Coupon;
2454
1723
  }
2455
1724
  buildModelInstance() {
2456
1725
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -2472,16 +1741,9 @@ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirest
2472
1741
  }
2473
1742
 
2474
1743
  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
- });
1744
+ constructor(firestore) {
1745
+ super();
1746
+ this.firestore = firestore;
2485
1747
  this.orderFromFirestore = (order) => {
2486
1748
  if (!!order?.lineItems?.length) {
2487
1749
  order.lineItems = order.lineItems.map((lineItem) => {
@@ -2494,6 +1756,11 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
2494
1756
  }
2495
1757
  return order;
2496
1758
  };
1759
+ this.collectionName = 'orders';
1760
+ this.model = Order;
1761
+ this.fields = {
1762
+ status: FirestoreFieldType.String,
1763
+ };
2497
1764
  }
2498
1765
  buildModelInstance() {
2499
1766
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -2507,58 +1774,84 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
2507
1774
  }
2508
1775
  }
2509
1776
 
2510
- class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
2511
- constructor({ firestore, interceptors }) {
2512
- super({
2513
- firestore,
2514
- interceptors,
2515
- });
2516
- this.collectionName = 'legacyOrders';
1777
+ class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1778
+ constructor(firestore) {
1779
+ super();
1780
+ this.firestore = firestore;
1781
+ this.collectionName = 'payments';
1782
+ this.model = Payment;
2517
1783
  }
2518
1784
  }
2519
1785
 
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
- });
1786
+ class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1787
+ constructor(firestore) {
1788
+ super();
1789
+ this.firestore = firestore;
1790
+ this.collectionName = 'checkoutsSubscription';
1791
+ this.model = CheckoutSubscription;
2528
1792
  }
2529
1793
  }
2530
1794
 
2531
1795
  class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2532
- constructor({ firestore, interceptors, }) {
2533
- super({
2534
- firestore,
2535
- collectionName: 'subscriptionPlans',
2536
- model: SubscriptionPlan,
2537
- interceptors,
2538
- });
1796
+ constructor(firestore) {
1797
+ super();
1798
+ this.firestore = firestore;
1799
+ this.collectionName = 'subscriptionPlans';
1800
+ this.model = SubscriptionPlan;
1801
+ }
1802
+ }
1803
+
1804
+ class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1805
+ constructor(firestore) {
1806
+ super();
1807
+ this.firestore = firestore;
1808
+ this.collectionName = 'buy2win';
1809
+ this.model = Buy2Win;
1810
+ }
1811
+ }
1812
+
1813
+ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1814
+ constructor(firestore) {
1815
+ super(firestore);
1816
+ this.firestore = firestore;
1817
+ this.collectionName = 'legacyOrders';
2539
1818
  }
2540
1819
  }
2541
1820
 
2542
1821
  class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2543
- constructor({ firestore, interceptors }) {
2544
- super({
2545
- firestore,
2546
- collectionName: 'dms',
2547
- model: Home,
2548
- interceptors,
2549
- });
1822
+ constructor(firestore) {
1823
+ super();
1824
+ this.firestore = firestore;
1825
+ this.homeToFirestore = (home) => {
1826
+ if (home.data?.data) {
1827
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.homeCategoryGroupToPlain);
1828
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.homeCategoryGroupToPlain);
1829
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.homeCategoryGroupToPlain);
1830
+ }
1831
+ return home;
1832
+ };
2550
1833
  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
- });
1834
+ category: homeCategoryGroup.category.toPlain(),
1835
+ products: homeCategoryGroup.products.map((product) => product.toPlain()),
1836
+ });
1837
+ this.homeFromFirestore = (home) => {
1838
+ if (home.data?.data) {
1839
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
1840
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
1841
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
1842
+ home.data.createdAt =
1843
+ home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
1844
+ home.data.expiresAt =
1845
+ home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
1846
+ }
1847
+ return home;
1848
+ };
2558
1849
  this.plainToHomeCategoryGroup = (homeCategoryGroup) => ({
2559
- category: Category.toInstance(homeCategoryGroup?.category),
2560
- products: homeCategoryGroup.products?.map((product) => Product.toInstance(product)),
1850
+ category: Category.toInstance(homeCategoryGroup.category),
1851
+ products: homeCategoryGroup.products.map((product) => Product.toInstance(product)),
2561
1852
  });
1853
+ this.collectionName = 'dms';
1854
+ this.model = Home;
2562
1855
  }
2563
1856
  buildModelInstance() {
2564
1857
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -2573,47 +1866,14 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
2573
1866
  },
2574
1867
  };
2575
1868
  }
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
1869
  }
2597
1870
 
2598
1871
  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
- });
1872
+ constructor(firestore) {
1873
+ super();
1874
+ this.firestore = firestore;
1875
+ this.collectionName = 'shopMenus';
1876
+ this.model = ShopMenu;
2617
1877
  }
2618
1878
  }
2619
1879
 
@@ -2690,7 +1950,7 @@ class AttributeOptionHelper {
2690
1950
  }
2691
1951
  AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
2692
1952
  if (fields.includes(attributeName))
2693
- return { columnName: attributeName.toString(), attributeName, to: (value) => value, from: (value) => value };
1953
+ return { columnName: attributeName.toString(), attributeName };
2694
1954
  const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
2695
1955
  const fieldOption = is(field)?.[attributeName];
2696
1956
  if (isNil(fieldOption))
@@ -2699,7 +1959,7 @@ AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
2699
1959
  return { columnName: attributeName.toString(), attributeName, fields: fieldOption };
2700
1960
  return { attributeName, columnName: attributeName.toString(), ...fieldOption };
2701
1961
  };
2702
- AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue?.columnName;
1962
+ AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue.columnName;
2703
1963
  AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
2704
1964
  if (fields.includes(columnName))
2705
1965
  return { columnName, attributeName: columnName };
@@ -2792,26 +2052,25 @@ BindFilterQueryHelper.MakeGraphQLWhere = (filter, fields) => Object.keys(filter)
2792
2052
  }, {});
2793
2053
  BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
2794
2054
  const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
2795
- const isNestedField = !Array.isArray(options) &&
2055
+ if (!Array.isArray(options) &&
2796
2056
  isObject(options) &&
2797
2057
  isNil(options?.operator) &&
2798
2058
  isNil(options?.value) &&
2799
- isNil(fieldSentenceOptions?.to);
2800
- if (isNestedField)
2059
+ isNil(fieldSentenceOptions?.to))
2801
2060
  return Object.keys(options).reduce((variables, key) => {
2802
2061
  const fieldOptions = AttributeOptionHelper.FindByAttribute(key, fieldSentenceOptions?.fields || fields);
2803
2062
  const columnName = fieldOptions.columnName;
2804
2063
  const columnFields = fieldOptions.fields;
2805
2064
  return {
2806
2065
  ...variables,
2807
- [columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), fieldSentenceOptions?.fields || columnFields || fields),
2066
+ [columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), columnFields || []),
2808
2067
  };
2809
2068
  }, {});
2810
2069
  if (!Array.isArray(options) && !isNil(fieldSentenceOptions.fields))
2811
2070
  return {
2812
2071
  [fieldSentenceOptions.fields[0]]: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
2813
2072
  };
2814
- if (!Array.isArray(options) && isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
2073
+ if (isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
2815
2074
  options = Object.values(options)[0];
2816
2075
  return Array.isArray(options)
2817
2076
  ? options.reduce((whereSentence, option) => ({
@@ -2847,14 +2106,28 @@ GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = (fields) => {
2847
2106
  if (field === 'affected_rows')
2848
2107
  return field;
2849
2108
  const fieldName = Object.keys(field).shift();
2850
- const fieldValue = is(field[fieldName]);
2109
+ const fieldValue = field[fieldName];
2851
2110
  if (Array.isArray(fieldValue))
2852
2111
  return { [fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue) };
2853
2112
  if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
2854
- return;
2855
- const isNestedField = !!fieldValue.fields;
2856
- if (isNestedField)
2857
- return GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields(fieldName, fieldValue);
2113
+ return null;
2114
+ if (fieldValue.fields)
2115
+ return !fieldValue.filters
2116
+ ? {
2117
+ [fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2118
+ }
2119
+ : {
2120
+ operation: fieldValue.columnName || fieldName,
2121
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2122
+ variables: {
2123
+ [`${fieldValue.columnName}_where`]: {
2124
+ name: 'where',
2125
+ type: fieldValue.filters.filterType,
2126
+ value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
2127
+ required: true,
2128
+ },
2129
+ },
2130
+ };
2858
2131
  return fieldValue.columnName;
2859
2132
  })
2860
2133
  .filter((field) => !!field);
@@ -2879,10 +2152,7 @@ GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).r
2879
2152
  }
2880
2153
  if (!!from)
2881
2154
  return { ...result, [attributeName]: from(data[columnName], data) };
2882
- return {
2883
- ...result,
2884
- [attributeName]: isString(data[columnName]) ? parseDateTime(data[columnName].toString()) : data[columnName],
2885
- };
2155
+ return { ...result, [attributeName]: parseDateTime(data[columnName].toString()) };
2886
2156
  }, {});
2887
2157
  GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2888
2158
  const data = instance.toPlain?.() || instance;
@@ -2898,13 +2168,10 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2898
2168
  if (!!foreignKeyColumn &&
2899
2169
  !isEmpty(foreignKeyColumn) &&
2900
2170
  !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 });
2171
+ return Object.keys(foreignKeyColumn).reduce((object, current) => ({
2172
+ ...object,
2173
+ [foreignKeyColumn[current]]: data[attributeName]?.[current],
2174
+ }), { ...result });
2908
2175
  if (update &&
2909
2176
  isObject(data[attributeName]) &&
2910
2177
  !isNil(attributeFields) &&
@@ -2937,25 +2204,6 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2937
2204
  return { ...result, [columnName]: data[attributeName] };
2938
2205
  }, {});
2939
2206
  };
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
2207
 
2960
2208
  const withCreateHasuraGraphQL = (MixinBase) => {
2961
2209
  return class CreateHasuraGraphQLMixin extends MixinBase {
@@ -2966,7 +2214,6 @@ const withCreateHasuraGraphQL = (MixinBase) => {
2966
2214
  this.insertGraphQLObjectType = options?.insertGraphQLObjectType || `${this.tableName}_insert_input`;
2967
2215
  }
2968
2216
  async create(data) {
2969
- this.logger = DebugHelper.from(this, 'create');
2970
2217
  const newData = await this.save(this.model.toInstance(data));
2971
2218
  return this.model.toInstance(newData);
2972
2219
  }
@@ -2977,10 +2224,10 @@ const withCreateHasuraGraphQL = (MixinBase) => {
2977
2224
  const columnOptions = Object.values(field).shift();
2978
2225
  return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
2979
2226
  columnOptions.foreignKeyColumn && [
2980
- ...Object.values(columnOptions.foreignKeyColumn).map((foreignKeyName) => AttributeOptionHelper.FindByAttribute(foreignKeyName, this.fields)?.columnName),
2227
+ ...Object.values(columnOptions.foreignKeyColumn),
2981
2228
  {
2982
- [columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions?.fields)
2983
- ?.columnName || foreignKeyField),
2229
+ [columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions?.fields)?.columnName ||
2230
+ foreignKeyField),
2984
2231
  },
2985
2232
  ]);
2986
2233
  })
@@ -3002,11 +2249,9 @@ const withDeleteHasuraGraphQL = (MixinBase) => {
3002
2249
  this.deleteGraphQLOperation = options?.deleteGraphQLOperation || `delete_${this.tableName}_by_pk`;
3003
2250
  }
3004
2251
  async delete(identifiers) {
3005
- this.logger = DebugHelper.from(this, 'delete');
3006
2252
  const instance = this.model.toInstance(identifiers);
3007
2253
  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]))
2254
+ if (isNil(instance[identifier]))
3010
2255
  return ids;
3011
2256
  const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
3012
2257
  const value = columnOption.to(identifiers[identifier], instance);
@@ -3033,19 +2278,15 @@ const withHasuraGraphQL = (MixinBase) => {
3033
2278
  this.authOptions = options.authOptions;
3034
2279
  this.model = options.model;
3035
2280
  this.fields = options.fields || this.model.identifiersFields;
3036
- this.logger = DebugHelper.from(this);
3037
2281
  }
3038
2282
  get headers() {
3039
2283
  return {
3040
2284
  '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)
2285
+ ...(isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken }),
2286
+ ...(isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret }),
2287
+ ...(isNil(this.authOptions.authRole)
3044
2288
  ? {}
3045
- : {
3046
- 'X-Hasura-Role': this.authOptions.authRole.role,
3047
- 'X-Hasura-User-Id': this.authOptions?.authRole?.userId,
3048
- }),
2289
+ : { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }),
3049
2290
  };
3050
2291
  }
3051
2292
  async mutation(operation, fields, variables) {
@@ -3057,28 +2298,29 @@ const withHasuraGraphQL = (MixinBase) => {
3057
2298
  return this.fetch(resultQuery);
3058
2299
  }
3059
2300
  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;
2301
+ const resultQuery = GraphQLFieldHelper.CheckIsGraphQLParams(operation)
2302
+ ? query$1(operation.map((option) => ({
2303
+ operation: option.operation,
2304
+ variables: option.variables,
2305
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
2306
+ })))
2307
+ : query$1({
2308
+ operation,
2309
+ variables,
2310
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
2311
+ });
2312
+ return this.fetch(resultQuery);
3069
2313
  }
3070
2314
  async fetch(params) {
3071
- this.logger.with('params').log(params);
3072
2315
  const headers = this.headers;
3073
- const { data: result } = await axios({
3074
- url: `${this.endpoint}`,
2316
+ const response = await fetch(`${this.endpoint}`, {
3075
2317
  method: 'POST',
3076
- data: params,
2318
+ body: JSON.stringify(params),
3077
2319
  headers,
3078
2320
  });
2321
+ const result = await response.json();
3079
2322
  if (!isNil(result.errors))
3080
2323
  throw new Error(JSON.stringify(result.errors));
3081
- this.logger.with('returns').log(result);
3082
2324
  return result.data;
3083
2325
  }
3084
2326
  getAttributeGraphQLTypeOf(value) {
@@ -3104,26 +2346,13 @@ const withHasuraGraphQL = (MixinBase) => {
3104
2346
  return value;
3105
2347
  return date;
3106
2348
  }
3107
- convertDataFromHasura(data, fields) {
3108
- const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, fields || this.fields);
2349
+ convertDataFromHasura(data) {
2350
+ const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
3109
2351
  return this.model.toInstance(plain);
3110
2352
  }
3111
2353
  convertDataToHasura(instance, update = false) {
3112
2354
  return GraphQLFieldHelper.ConvertFieldValueTo(instance, this.fields, update);
3113
2355
  }
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
2356
  };
3128
2357
  };
3129
2358
 
@@ -3146,7 +2375,6 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
3146
2375
  this.updateGraphQLPKType = options?.updateGraphQLPKType || `${this.tableName}_pk_columns_input`;
3147
2376
  }
3148
2377
  async update(data) {
3149
- this.logger = DebugHelper.from(this, 'update');
3150
2378
  const plainData = this.paramsToPlain(data);
3151
2379
  await this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), {
3152
2380
  _set: {
@@ -3172,11 +2400,10 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
3172
2400
  getUpdateModelKeys(data) {
3173
2401
  const instance = this.model.toInstance(data);
3174
2402
  return this.model.identifiersFields.reduce((ids, identifier) => {
3175
- const identifierBinded = identifier;
3176
- if (isNil(instance.identifier[identifierBinded]))
2403
+ if (isNil(instance[identifier]))
3177
2404
  return ids;
3178
- const columnOption = AttributeOptionHelper.FindByAttribute(identifierBinded, this.fields);
3179
- const value = columnOption?.to?.(data[identifierBinded], instance) || data[columnOption.attributeName];
2405
+ const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
2406
+ const value = columnOption?.to?.(data[identifier], instance) || data[columnOption.attributeName];
3180
2407
  return {
3181
2408
  ...ids,
3182
2409
  [columnOption.columnName]: value,
@@ -3194,11 +2421,9 @@ const withGetHasuraGraphQL = (MixinBase) => {
3194
2421
  this.getGraphQLOperation = options?.getGraphQLOperation || `${this.tableName}_by_pk`;
3195
2422
  }
3196
2423
  async get(identifiers) {
3197
- this.logger = DebugHelper.from(this, 'get');
3198
2424
  const instance = this.model.toInstance(identifiers);
3199
2425
  const result = await this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce((ids, identifier) => {
3200
- const identifierBinded = identifier;
3201
- if (isNil(instance[identifierBinded]))
2426
+ if (isNil(instance[identifier]))
3202
2427
  return ids;
3203
2428
  const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
3204
2429
  const value = columnOption?.to?.(identifiers[identifier], instance) ||
@@ -3222,150 +2447,44 @@ const withGetHasuraGraphQL = (MixinBase) => {
3222
2447
 
3223
2448
  const withFindHasuraGraphQL = (MixinBase) => {
3224
2449
  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.bindDistinctAttributes = (distinct, fields) => this.bindAttributesToColumns(distinct, fields);
3253
- this.bindAttributesToColumns = (attributes, fields) => attributes.map((attr) => AttributeOptionHelper.FindByAttribute(attr.toString().split('.').pop(), fields)?.columnName || attr);
3254
- }
3255
- async find(params) {
3256
- this.logger = DebugHelper.from(this, 'find');
3257
- const { filters, limits, orderBy, options } = params || {};
3258
- const enableCount = options?.enableCount ?? true;
3259
- const variablesFilters = isNil(filters)
3260
- ? {}
3261
- : {
3262
- where: {
3263
- value: BindFilterQueryHelper.MakeGraphQLWhere(filters, this.fields),
3264
- type: `${this.tableName}_bool_exp`,
3265
- required: true,
3266
- },
3267
- };
2450
+ async find(options) {
2451
+ const { filters, limits, orderBy } = options || {};
3268
2452
  const variablesCount = {
3269
- ...(isNil(orderBy)
2453
+ ...(isNil(orderBy) ? {} : { order_by: { type: `${this.tableName}_order_by!`, list: true, value: orderBy } }),
2454
+ ...(isNil(filters)
3270
2455
  ? {}
3271
2456
  : {
3272
- order_by: {
3273
- type: `${this.tableName}_order_by!`,
3274
- list: true,
3275
- value: this.bindOrderByAttributes(orderBy, this.fields),
2457
+ where: {
2458
+ value: BindFilterQueryHelper.MakeGraphQLWhere(filters, this.fields),
2459
+ type: `${this.tableName}_bool_exp`,
2460
+ required: true,
3276
2461
  },
3277
2462
  }),
3278
- ...variablesFilters,
3279
2463
  };
3280
2464
  const variables = {
3281
2465
  ...(isNil(limits) ? {} : limits),
3282
2466
  ...variablesCount,
3283
2467
  };
3284
- const aggregateFields = [
3285
- ...(enableCount ? ['count'] : []),
3286
- ...this.bindAggretageAttributes(params.options, this.fields),
3287
- ];
3288
2468
  const result = await this.query([
3289
2469
  {
3290
2470
  operation: this.tableName,
3291
- fields: params.fields
3292
- ? params.fields
2471
+ fields: options.fields
2472
+ ? options.fields
3293
2473
  .map((fieldName) => this.fields.find((fieldOption) => fieldOption === fieldName) ??
3294
2474
  this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName))
3295
2475
  .filter(Boolean)
3296
2476
  : this.fields,
3297
2477
  variables,
3298
2478
  },
3299
- ...(aggregateFields.length > 0
3300
- ? [
3301
- {
3302
- operation: `${this.tableName}_aggregate`,
3303
- fields: [
3304
- {
3305
- aggregate: aggregateFields,
3306
- },
3307
- ],
3308
- variables: variablesCount,
3309
- },
3310
- ]
3311
- : []),
3312
- ...((!params.limits?.offset &&
3313
- params.options?.distinct?.map((distinct) => {
3314
- const distinctOption = this.fields.find((fieldOption) => fieldOption === distinct) ??
3315
- this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === distinct);
3316
- const fieldName = Object.values(distinctOption).shift()?.columnName || distinct;
3317
- return {
3318
- operation: {
3319
- name: `${this.tableName}`,
3320
- alias: `${this.tableName}_${distinct.toString()}_distinct`,
3321
- },
3322
- fields: [distinctOption],
3323
- variables: {
3324
- ...variablesFilters,
3325
- [`${this.tableName}_${fieldName}_distinct`]: {
3326
- type: `${this.tableName}_select_column!`,
3327
- list: true,
3328
- value: fieldName,
3329
- name: 'distinct_on',
3330
- },
3331
- },
3332
- };
3333
- })) ||
3334
- []),
2479
+ {
2480
+ operation: `${this.tableName}_aggregate`,
2481
+ fields: [{ aggregate: ['count'] }],
2482
+ variables: variablesCount,
2483
+ },
3335
2484
  ]);
3336
2485
  const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
3337
- return {
3338
- data,
3339
- count: enableCount ? result[`${this.tableName}_aggregate`].aggregate.count : Infinity,
3340
- ...(options?.minimal?.length
3341
- ? {
3342
- minimal: options.minimal.reduce((minimals, current) => ({
3343
- ...minimals,
3344
- ...set(minimals, current, result[`${this.tableName}_aggregate`].aggregate.min[AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)?.columnName || current]),
3345
- }), {}),
3346
- }
3347
- : {}),
3348
- ...(options?.maximum?.length
3349
- ? {
3350
- maximum: options.maximum.reduce((maximums, current) => ({
3351
- ...maximums,
3352
- ...set(maximums, current, result[`${this.tableName}_aggregate`].aggregate.max[AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)?.columnName || current]),
3353
- }), {}),
3354
- }
3355
- : {}),
3356
- ...(!params.limits?.offset &&
3357
- options?.distinct?.length && {
3358
- distinct: options?.distinct.reduce((distinct, current) => {
3359
- const distinctOption = this.fields.find((fieldOption) => fieldOption === current) ??
3360
- this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === current);
3361
- const fieldName = Object.values(distinctOption).shift()?.columnName || current;
3362
- return {
3363
- ...distinct,
3364
- [current.toString()]: result[`${this.tableName}_${current.toString()}_distinct`].map((obj) => obj[fieldName]),
3365
- };
3366
- }, {}),
3367
- }),
3368
- };
2486
+ const count = result[`${this.tableName}_aggregate`].aggregate.count;
2487
+ return { count, data };
3369
2488
  }
3370
2489
  };
3371
2490
  };
@@ -3404,154 +2523,13 @@ class VariantHasuraGraphQL extends Variant {
3404
2523
  }
3405
2524
  }
3406
2525
 
3407
- class CategoryCollectionChildrenHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3408
- constructor({ endpoint, authOptions, interceptors, }) {
3409
- super({
3410
- tableName: 'category_collection_children',
3411
- model: CategoryCollectionChildren,
3412
- endpoint,
3413
- authOptions,
3414
- interceptors,
3415
- fields: [
3416
- { collectionId: { columnName: 'collection_id' } },
3417
- { categoryId: { columnName: 'category_id' } },
3418
- 'name',
3419
- 'slug',
3420
- 'reference',
3421
- { parentCollectionId: { columnName: 'parent_collection_id' } },
3422
- { parentCategoryId: { columnName: 'parent_category_id' } },
3423
- {
3424
- parent: {
3425
- columnName: 'parent',
3426
- foreignKeyColumn: { collectionId: 'parentCollectionId', categoryId: 'parentCategoryId' },
3427
- fields: [
3428
- { collectionId: { columnName: 'collection_id' } },
3429
- { categoryId: { columnName: 'category_id' } },
3430
- 'name',
3431
- 'slug',
3432
- 'reference',
3433
- { parentCollectionId: { columnName: 'parent_collection_id' } },
3434
- { parentCategoryId: { columnName: 'parent_category_id' } },
3435
- ],
3436
- },
3437
- },
3438
- ],
3439
- });
3440
- }
3441
- }
3442
-
3443
- class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3444
- constructor({ endpoint, authOptions, interceptors, }) {
3445
- super({
3446
- tableName: 'category_filter',
3447
- model: CategoryFilter,
3448
- endpoint,
3449
- authOptions,
3450
- interceptors,
3451
- fields: [
3452
- 'id',
3453
- { filterId: { columnName: 'filter_id' } },
3454
- { categoryId: { columnName: 'category_id' } },
3455
- {
3456
- filter: {
3457
- columnName: 'filter',
3458
- foreignKeyColumn: { id: 'filterId' },
3459
- fields: [
3460
- 'id',
3461
- 'description',
3462
- 'slug',
3463
- 'enabled',
3464
- { createdAt: { columnName: 'created_at' } },
3465
- { updatedAt: { columnName: 'updated_at' } },
3466
- {
3467
- options: {
3468
- columnName: 'options',
3469
- foreignKeyColumn: { filterId: 'id' },
3470
- fields: [
3471
- 'id',
3472
- { filterId: { columnName: 'filter_id' } },
3473
- 'description',
3474
- { createdAt: { columnName: 'created_at' } },
3475
- { updatedAt: { columnName: 'updated_at' } },
3476
- ],
3477
- },
3478
- },
3479
- ],
3480
- },
3481
- },
3482
- {
3483
- category: {
3484
- columnName: 'category',
3485
- foreignKeyColumn: { id: 'categoryId' },
3486
- fields: [
3487
- 'id',
3488
- 'description',
3489
- {
3490
- products: {
3491
- columnName: 'products',
3492
- fields: ['product_id'],
3493
- from: (value) => value.map((product) => product.product_id.toString()),
3494
- to: (productIds) => productIds.map((productId) => ({
3495
- product_id: +productId,
3496
- })),
3497
- },
3498
- },
3499
- {
3500
- childrenProducts: {
3501
- columnName: 'children_products',
3502
- foreignKeyColumn: { category_id: 'id' },
3503
- fields: [
3504
- 'id',
3505
- 'name',
3506
- 'slug',
3507
- {
3508
- categories: {
3509
- columnName: 'categories',
3510
- fields: ['category_id'],
3511
- bindPersistData: (value) => ({
3512
- categories: { data: value.map((category) => ({ category_id: +category })) },
3513
- }),
3514
- to: (categories) => categories.map((categoryId) => +categoryId),
3515
- from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
3516
- },
3517
- },
3518
- ],
3519
- },
3520
- },
3521
- ],
3522
- },
3523
- },
3524
- ],
3525
- });
3526
- }
3527
- deleteByCategory(categoryId) {
3528
- return this.mutation('delete_category_filter', ['affected_rows'], {
3529
- where: {
3530
- type: 'category_filter_bool_exp',
3531
- required: true,
3532
- value: { category_id: { _eq: categoryId } },
3533
- },
3534
- });
3535
- }
3536
- deleteByCategoryAndFilter(categoryId, filterId) {
3537
- return this.mutation('delete_category_filter', ['affected_rows'], {
3538
- where: {
3539
- type: 'category_filter_bool_exp',
3540
- required: true,
3541
- value: { category_id: { _eq: categoryId }, filter_id: { _eq: filterId } },
3542
- },
3543
- });
3544
- }
3545
- }
3546
-
3547
2526
  class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3548
- constructor({ endpoint, authOptions, interceptors, }, productRepository, categoryFilterRepository) {
2527
+ constructor(endpoint, authOptions, productRepository) {
3549
2528
  super({
3550
2529
  tableName: 'category',
3551
2530
  model: Category,
3552
2531
  endpoint,
3553
2532
  authOptions,
3554
- interceptors,
3555
2533
  fields: [
3556
2534
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
3557
2535
  { firestoreId: { columnName: 'firestore_id' } },
@@ -3560,7 +2538,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3560
2538
  'image',
3561
2539
  'published',
3562
2540
  'shop',
3563
- { shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
3564
2541
  'slug',
3565
2542
  { brandCategory: { columnName: 'brand_category' } },
3566
2543
  { brandCategoryBanner: { columnName: 'brand_banner' } },
@@ -3589,17 +2566,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3589
2566
  },
3590
2567
  },
3591
2568
  },
3592
- {
3593
- filters: {
3594
- columnName: 'filters',
3595
- foreignKeyColumn: { filter_id: 'id' },
3596
- fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
3597
- bindPersistData: (value) => ({
3598
- filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
3599
- }),
3600
- from: (filters) => filters?.map((filter) => filter?.filter) || [],
3601
- },
3602
- },
2569
+ 'filters',
3603
2570
  { createdAt: { columnName: 'created_at' } },
3604
2571
  { updatedAt: { columnName: 'updated_at' } },
3605
2572
  {
@@ -3621,77 +2588,39 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3621
2588
  }),
3622
2589
  },
3623
2590
  },
3624
- { isCollection: { columnName: 'is_collection' } },
3625
- { isWishlist: { columnName: 'is_wishlist' } },
3626
- 'reference',
3627
- { parentId: { columnName: 'parent_id' } },
3628
- {
3629
- parent: {
3630
- columnName: 'parent',
3631
- foreignKeyColumn: { id: 'parentId' },
3632
- fields: ['id', 'name', 'reference', 'slug'],
3633
- },
3634
- },
3635
2591
  ],
3636
2592
  });
3637
2593
  this.productRepository = productRepository;
3638
- this.categoryFilterRepository = categoryFilterRepository;
3639
2594
  }
3640
2595
  async create(params) {
3641
2596
  const { metadata, ...data } = params;
3642
- return super.create({ ...data, isWishlist: false, metadata: metadata || { description: null, title: null } });
2597
+ return super.create({ ...data, metadata: metadata || { description: null, title: null } });
3643
2598
  }
3644
2599
  async get(identifiers) {
3645
2600
  return Number.isNaN(+identifiers.id)
3646
- ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data?.[0]
2601
+ ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
3647
2602
  : super.get(identifiers);
3648
2603
  }
3649
2604
  async update(params) {
3650
- const { products, id: checkId, metadata, filters, ...data } = params;
2605
+ const { products, id: checkId, metadata, ...data } = params;
3651
2606
  const plainData = this.paramsToPlain({ id: checkId });
3652
2607
  const id = await this.getId(plainData.id);
3653
- const category = await super.update({ id, ...data, isWishlist: false });
2608
+ const category = await super.update({ id, ...data });
3654
2609
  category.products = products && (await this.updateProducts(+id, { products }));
3655
2610
  category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
3656
- category.filters = filters && (await this.updateFilters(+id, { filters }));
3657
2611
  return category;
3658
2612
  }
3659
2613
  async getCategoryBySlug(slug, shop) {
3660
2614
  if (!slug)
3661
2615
  return null;
3662
- const { data } = await this.find({
3663
- filters: {
3664
- slug,
3665
- shops: { operator: Where.IN, value: [shop] },
3666
- published: { operator: Where.EQUALS, value: true },
3667
- isWishlist: { operator: Where.EQUALS, value: false },
3668
- },
3669
- options: {
3670
- enableCount: false,
3671
- },
3672
- });
3673
- if (!data.length)
3674
- throw new NotFoundError(`Category with slug ${slug} not found`);
3675
- if (data.length > 1)
2616
+ const { data, count } = await this.find({ filters: { slug, shop, published: true } });
2617
+ if (count > 1)
3676
2618
  throw new DuplicatedResultsError('Query returned duplicated values');
3677
- return data.shift();
3678
- }
3679
- async getCategoryByShop(shop) {
3680
- if (!shop)
3681
- return;
3682
- const { data } = await this.find({
3683
- filters: {
3684
- shops: { operator: Where.IN, value: [shop] },
3685
- published: { operator: Where.EQUALS, value: true },
3686
- isWishlist: { operator: Where.EQUALS, value: false },
3687
- },
3688
- options: {
3689
- enableCount: false,
3690
- },
3691
- });
3692
- return data;
2619
+ if (!count)
2620
+ throw new NotFoundError(`Category with slug ${slug} not found`);
2621
+ return data.shift();
3693
2622
  }
3694
- async getCategoriesForHome(categoryIds, limit = 4, gender) {
2623
+ async getCategoriesForHome(categoryIds, limit = 4) {
3695
2624
  if (!categoryIds?.length)
3696
2625
  return [];
3697
2626
  const categoriesFirestore = categoryIds.filter((categoryId) => Number.isNaN(+categoryId));
@@ -3709,7 +2638,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3709
2638
  return [];
3710
2639
  const homeSections = await Promise.all(categories.map(async (category) => ({
3711
2640
  category,
3712
- products: await this.mountCategory(category, { limit, hasStock: true, gender }),
2641
+ products: await this.mountCategory(category, { limit, hasStock: true }),
3713
2642
  })));
3714
2643
  return homeSections;
3715
2644
  }
@@ -3722,7 +2651,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3722
2651
  id: { operator: Where.IN, value: category.products },
3723
2652
  published: true,
3724
2653
  ...(options?.hasStock ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {}),
3725
- ...(options?.gender ? { tags: { operator: Where.IN, value: [options?.gender] } } : {}),
3726
2654
  },
3727
2655
  fields: [
3728
2656
  'id',
@@ -3748,11 +2676,8 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3748
2676
  'tags',
3749
2677
  'type',
3750
2678
  'shoppingCount',
3751
- 'gender',
3752
- 'createdAt',
3753
2679
  ],
3754
2680
  ...(options?.limit ? { limits: { limit: options?.limit } } : {}),
3755
- options: { enableCount: false },
3756
2681
  });
3757
2682
  products.push(...productsData);
3758
2683
  return products;
@@ -3760,7 +2685,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3760
2685
  async getId(id) {
3761
2686
  if (!Number.isNaN(+id))
3762
2687
  return id;
3763
- const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
2688
+ const { data } = await this.find({ filters: { firestoreId: id } });
3764
2689
  if (data?.[0]?.id)
3765
2690
  return data?.[0]?.id;
3766
2691
  throw new NotFoundError(`Category with id ${id} not found`);
@@ -3813,200 +2738,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3813
2738
  });
3814
2739
  return plainData.metadata;
3815
2740
  }
3816
- async updateFilters(categoryId, { filters }) {
3817
- if ('action' in filters && filters.action === 'remove' && filters.value.length) {
3818
- for (let i = 0; i < filters.value.length; i++) {
3819
- await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filters.value[i].id);
3820
- }
3821
- return [];
3822
- }
3823
- if ('action' in filters && filters.action === 'merge' && filters.value.length) {
3824
- let filtersList = [];
3825
- const currentFilters = await this.categoryFilterRepository
3826
- .find({
3827
- filters: {
3828
- categoryId,
3829
- },
3830
- })
3831
- .then((res) => res.data);
3832
- const currentFiltersId = currentFilters.map((f) => f.id);
3833
- const filtersUpdatedId = filters.value.map((f) => f.id);
3834
- const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
3835
- const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
3836
- for (const filter of filterToBeDeleted) {
3837
- const index = currentFilters.findIndex((f) => f.id == filter);
3838
- if (index != -1) {
3839
- currentFilters.splice(index, 1);
3840
- }
3841
- await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
3842
- }
3843
- for (const filter of filterToBeInserted) {
3844
- const newCategoryFilter = await this.categoryFilterRepository.create({
3845
- filterId: filter,
3846
- categoryId,
3847
- });
3848
- filtersList.push(filter);
3849
- }
3850
- return filters.value;
3851
- }
3852
- if (Array.isArray(filters) && filters.length) {
3853
- await this.categoryFilterRepository.deleteByCategory(categoryId);
3854
- let filtersList = [];
3855
- for (let i = 0; i < filters.length; i++) {
3856
- const newCategoryFilter = await this.categoryFilterRepository.create({
3857
- filterId: filters[i].id,
3858
- categoryId,
3859
- });
3860
- filtersList.push(newCategoryFilter);
3861
- }
3862
- return filters;
3863
- }
3864
- }
3865
- async getChildren(parentId) {
3866
- const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id'], {
3867
- args: {
3868
- type: 'category_tree_args',
3869
- value: { parentid: parentId },
3870
- required: true,
3871
- },
3872
- });
3873
- return category_tree.map((category) => Category.toInstance(category));
3874
- }
3875
- async isChild(id, parentId) {
3876
- const categoryTree = await this.getChildren(parentId);
3877
- return categoryTree.some((c) => c.id == id.toString());
3878
- }
3879
- }
3880
-
3881
- class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3882
- constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
3883
- super({
3884
- tableName: 'filter',
3885
- model: Filter,
3886
- endpoint,
3887
- authOptions,
3888
- interceptors,
3889
- fields: [
3890
- 'id',
3891
- 'description',
3892
- 'slug',
3893
- 'enabled',
3894
- { createdAt: { columnName: 'created_at' } },
3895
- { updatedAt: { columnName: 'updated_at' } },
3896
- {
3897
- options: {
3898
- columnName: 'options',
3899
- foreignKeyColumn: { filterId: 'id' },
3900
- fields: [
3901
- 'id',
3902
- { filterId: { columnName: 'filter_id' } },
3903
- 'description',
3904
- { createdAt: { columnName: 'created_at' } },
3905
- { updatedAt: { columnName: 'updated_at' } },
3906
- ],
3907
- },
3908
- },
3909
- ],
3910
- });
3911
- this.filterOptionRepository = filterOptionRepository;
3912
- this.categoryFilterRepository = categoryFilterRepository;
3913
- }
3914
- async update(params) {
3915
- const { options, ...data } = params;
3916
- const filter = await super.update(data);
3917
- filter.options = await this.updateOptions(+data.id, { options });
3918
- return filter;
3919
- }
3920
- async updateOptions(filterId, { options }) {
3921
- if (!options)
3922
- return [];
3923
- if ('action' in options && options.action === 'remove' && options.value.length) {
3924
- for (let i = 0; i < options.value.length; i++) {
3925
- await this.filterOptionRepository.delete({ id: options.value[i].id });
3926
- }
3927
- return [];
3928
- }
3929
- if ('action' in options && options.action === 'merge' && options.value.length) {
3930
- let filterOptions = [];
3931
- for (let i = 0; i < options.value.length; i++) {
3932
- try {
3933
- const hasFilter = await this.filterOptionRepository.get({ id: options.value[i].id });
3934
- if (hasFilter)
3935
- filterOptions.push(hasFilter);
3936
- }
3937
- catch (error) {
3938
- const newOption = await this.filterOptionRepository.create({ ...options.value[i], filterId });
3939
- filterOptions.push(newOption);
3940
- }
3941
- }
3942
- return filterOptions;
3943
- }
3944
- if (Array.isArray(options) && options.length) {
3945
- let filterOptions = [];
3946
- for (let i = 0; i < options.length; i++) {
3947
- try {
3948
- const hasFilter = await this.filterOptionRepository.get({ id: options[i].id });
3949
- if (hasFilter)
3950
- filterOptions.push(hasFilter);
3951
- }
3952
- catch (error) {
3953
- const newOption = await this.filterOptionRepository.create({ ...options[i], filterId });
3954
- filterOptions.push(newOption);
3955
- }
3956
- }
3957
- }
3958
- return [];
3959
- }
3960
- async delete(params) {
3961
- const { data: categoryFilters } = await this.categoryFilterRepository.find({
3962
- filters: {
3963
- filterId: params.id,
3964
- },
3965
- });
3966
- if (categoryFilters.length)
3967
- throw new Error('Erro: o filtro está associado a uma ou mais categoria(s)');
3968
- await this.deleteOptions(+params.id);
3969
- await super.delete({ id: +params.id });
3970
- return;
3971
- }
3972
- async deleteOptions(filterId) {
3973
- await this.mutation('delete_filter_option', ['affected_rows'], {
3974
- where: {
3975
- type: 'filter_option_bool_exp',
3976
- required: true,
3977
- value: { filter_id: { _eq: filterId } },
3978
- },
3979
- });
3980
- }
3981
- }
3982
-
3983
- class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3984
- constructor({ endpoint, authOptions, interceptors, }) {
3985
- super({
3986
- tableName: 'filter_option',
3987
- model: FilterOption,
3988
- endpoint,
3989
- authOptions,
3990
- interceptors,
3991
- fields: [
3992
- 'id',
3993
- 'description',
3994
- { filterId: { columnName: 'filter_id' } },
3995
- { createdAt: { columnName: 'created_at' } },
3996
- { updatedAt: { columnName: 'updated_at' } },
3997
- ],
3998
- });
3999
- }
4000
2741
  }
4001
2742
 
4002
2743
  class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
4003
- constructor({ endpoint, authOptions, interceptors, }) {
2744
+ constructor(endpoint, authOptions) {
4004
2745
  super({
4005
2746
  tableName: 'product',
4006
2747
  model: ProductHasuraGraphQL,
4007
2748
  endpoint,
4008
2749
  authOptions,
4009
- interceptors,
4010
2750
  fields: [],
4011
2751
  });
4012
2752
  this.bindReviewToModel = (plain) => ({
@@ -4039,9 +2779,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4039
2779
  whoMustUse: data.who_must_use,
4040
2780
  howToUse: data.how_to_use,
4041
2781
  brand: data.brand_description,
4042
- ingredients: data.ingredients,
4043
2782
  }),
4044
- bindFindFilter: (filters) => {
2783
+ bindFindFilter: (sentence) => {
2784
+ const filters = Object.values(sentence).shift();
4045
2785
  return {
4046
2786
  ...(filters?.description && { description: filters.description }),
4047
2787
  ...(filters.differentials && { differentials: filters.differentials }),
@@ -4054,9 +2794,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4054
2794
  ...(filters.brand && {
4055
2795
  brand_description: filters.brand,
4056
2796
  }),
4057
- ...(filters.ingredients && {
4058
- ingredients: filters.ingredients,
4059
- }),
4060
2797
  };
4061
2798
  },
4062
2799
  bindPersistData: (descriptionData) => ({
@@ -4067,7 +2804,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4067
2804
  }),
4068
2805
  ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
4069
2806
  ...(descriptionData.brand && { brand_description: descriptionData.brand }),
4070
- ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
4071
2807
  }),
4072
2808
  },
4073
2809
  },
@@ -4075,7 +2811,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4075
2811
  { whoMustUse: { columnName: 'who_must_use' } },
4076
2812
  { howToUse: { columnName: 'how_to_use' } },
4077
2813
  { brandDescription: { columnName: 'brand_description' } },
4078
- { ingredients: { columnName: 'ingredients' } },
4079
2814
  { hasVariants: { columnName: 'has_variants' } },
4080
2815
  {
4081
2816
  images: {
@@ -4099,7 +2834,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4099
2834
  subscriberDiscountPercentage: data.subscriber_discount_percentage,
4100
2835
  subscriberPrice: data.subscriber_price,
4101
2836
  }),
4102
- bindFindFilter: (filters) => {
2837
+ bindFindFilter: (sentence) => {
2838
+ const filters = Object.values(sentence).shift();
4103
2839
  return {
4104
2840
  ...((filters?.price || filters?.price === 0) && { price: filters.price }),
4105
2841
  ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
@@ -4133,29 +2869,27 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4133
2869
  to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
4134
2870
  },
4135
2871
  },
4136
- { hasStock: { columnName: 'has_stock' } },
4137
2872
  'slug',
4138
2873
  'type',
4139
2874
  'video',
4140
2875
  'weight',
4141
2876
  'gender',
4142
- { intGender: { columnName: 'int_gender' } },
4143
2877
  { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
4144
- { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
4145
2878
  { isKit: { columnName: 'is_kit' } },
4146
2879
  { createdAt: { columnName: 'created_at' } },
4147
2880
  { updatedAt: { columnName: 'updated_at' } },
4148
- { rate: { columnName: 'rating' } },
4149
- { reviewsTotal: { columnName: 'reviews_total' } },
4150
- { shoppingCount: { columnName: 'shopping_count' } },
4151
- { categoryId: { columnName: 'category_id' } },
4152
2881
  {
4153
- category: {
4154
- columnName: 'category',
4155
- foreignKeyColumn: { id: 'categoryId' },
4156
- fields: ['id', 'name', 'reference', 'slug'],
2882
+ rate: {
2883
+ columnName: 'reviews_aggregate',
2884
+ filters: {
2885
+ filters: { status: true },
2886
+ filterType: 'product_review_bool_exp',
2887
+ },
2888
+ fields: [{ aggregate: [{ avg: ['rate'] }] }],
2889
+ from: (value) => value.aggregate.avg.rate,
4157
2890
  },
4158
2891
  },
2892
+ { shoppingCount: { columnName: 'shopping_count' } },
4159
2893
  ];
4160
2894
  this.fields = [
4161
2895
  ...commonFields,
@@ -4232,7 +2966,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4232
2966
  }
4233
2967
  async get(identifiers) {
4234
2968
  const product = Number.isNaN(+identifiers.id)
4235
- ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data?.[0]
2969
+ ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
4236
2970
  : await super.get(identifiers);
4237
2971
  if (product.productId)
4238
2972
  throw new NotFoundError('Product not found, it is a variant');
@@ -4245,25 +2979,10 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4245
2979
  this.fields
4246
2980
  .map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
4247
2981
  .filter((field) => field !== 'reviews');
4248
- if (options.options?.minimal?.includes('price'))
4249
- options.options?.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
4250
- if (options.options?.maximum?.includes('price'))
4251
- options.options?.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
4252
- options.options?.minimal?.splice(options.options?.minimal.indexOf('price'), 1);
4253
- options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
4254
2982
  return super.find({
4255
2983
  ...options,
4256
2984
  filters: { ...filters, productId: { operator: Where.ISNULL } },
4257
- fields: [
4258
- ...bindFields,
4259
- ...(bindFields.includes('price')
4260
- ? [
4261
- 'subscriberPrice',
4262
- 'subscriberDiscountPercentage',
4263
- 'fullPrice',
4264
- ]
4265
- : []),
4266
- ],
2985
+ fields: bindFields,
4267
2986
  });
4268
2987
  }
4269
2988
  async getBySlug(slug) {
@@ -4271,13 +2990,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4271
2990
  filters: {
4272
2991
  slug,
4273
2992
  },
4274
- fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
4275
- options: {
4276
- enableCount: false,
4277
- },
4278
2993
  });
4279
2994
  const product = result?.data?.shift();
4280
- RoundProductPricesHelper.roundProductPrices(product);
2995
+ product.reviews = await this.findReviewsByProduct(+product.id);
4281
2996
  return product;
4282
2997
  }
4283
2998
  async update(params) {
@@ -4314,17 +3029,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4314
3029
  })),
4315
3030
  ], []);
4316
3031
  }
4317
- async findCatalog(params, mainGender) {
4318
- return this.find({
4319
- ...params,
4320
- filters: { ...params.filters, published: true },
4321
- orderBy: {
4322
- hasStock: 'desc',
4323
- ...(!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' }),
4324
- ...omit(params.orderBy, ['hasStock', 'intGender']),
4325
- },
4326
- });
4327
- }
4328
3032
  async updateCategories(productId, { categories }) {
4329
3033
  if ('action' in categories && categories.action === 'remove') {
4330
3034
  await this.mutation('delete_category_product', ['affected_rows'], {
@@ -4438,7 +3142,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4438
3142
  async getId(id) {
4439
3143
  if (!Number.isNaN(+id))
4440
3144
  return id;
4441
- const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3145
+ const { data } = await this.find({ filters: { firestoreId: id } });
4442
3146
  if (data?.[0]?.id)
4443
3147
  return data?.[0]?.id;
4444
3148
  throw new NotFoundError(`Product with id ${id} not found`);
@@ -4494,29 +3198,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4494
3198
  });
4495
3199
  return data && data[0] && this.bindReviewToModel(data[0]);
4496
3200
  }
4497
- async cleanShoppingCountFromIds(ids) {
4498
- return await this.mutation('update_product', ['affected_rows'], {
4499
- where: {
4500
- value: { id: { _nin: ids } },
4501
- type: 'product_bool_exp',
4502
- required: true,
4503
- },
4504
- _set: {
4505
- value: { shopping_count: 0 },
4506
- type: 'product_set_input',
4507
- },
4508
- });
4509
- }
4510
3201
  }
4511
3202
 
4512
3203
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
4513
- constructor({ endpoint, authOptions, interceptors, }) {
3204
+ constructor(endpoint, authOptions) {
4514
3205
  super({
4515
3206
  tableName: 'product',
4516
3207
  model: VariantHasuraGraphQL,
4517
3208
  endpoint,
4518
3209
  authOptions,
4519
- interceptors,
4520
3210
  fields: [
4521
3211
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
4522
3212
  { firestoreId: { columnName: 'firestore_id' } },
@@ -4552,12 +3242,12 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4552
3242
  };
4553
3243
  },
4554
3244
  bindPersistData: (priceData) => ({
4555
- ...((priceData?.price || 0) >= 0 && { price: priceData.price }),
4556
- ...((priceData?.fullPrice || 0) >= 0 && { full_price: priceData.fullPrice }),
4557
- ...((priceData?.subscriberDiscountPercentage || 0) >= 0 && {
3245
+ ...(priceData?.price >= 0 && { price: priceData.price }),
3246
+ ...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
3247
+ ...(priceData.subscriberDiscountPercentage >= 0 && {
4558
3248
  subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
4559
3249
  }),
4560
- ...((priceData?.subscriberPrice || 0) >= 0 && { subscriber_price: priceData.subscriberPrice }),
3250
+ ...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
4561
3251
  }),
4562
3252
  },
4563
3253
  },
@@ -4572,7 +3262,6 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4572
3262
  to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
4573
3263
  },
4574
3264
  },
4575
- { hasStock: { columnName: 'has_stock' } },
4576
3265
  'weight',
4577
3266
  { name: { to: () => '', from: () => undefined } },
4578
3267
  { hasVariants: { columnName: 'has_variants', to: () => false, from: () => undefined } },
@@ -4610,247 +3299,16 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4610
3299
  async getId(id) {
4611
3300
  if (!Number.isNaN(+id))
4612
3301
  return id;
4613
- const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3302
+ const { data } = await this.find({ filters: { firestoreId: id } });
4614
3303
  if (data?.[0]?.id)
4615
3304
  return data?.[0]?.id;
4616
3305
  throw new NotFoundError(`Product with id ${id} not found`);
4617
3306
  }
4618
3307
  }
4619
3308
 
4620
- class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
4621
- constructor({ endpoint, authOptions, interceptors, }, categoryFilterRepository) {
4622
- super({
4623
- tableName: 'category',
4624
- model: Wishlist,
4625
- endpoint,
4626
- authOptions,
4627
- interceptors,
4628
- fields: [
4629
- { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
4630
- { firestoreId: { columnName: 'firestore_id' } },
4631
- 'name',
4632
- 'description',
4633
- 'image',
4634
- 'published',
4635
- 'shop',
4636
- { shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
4637
- 'slug',
4638
- { brandCategory: { columnName: 'brand_category' } },
4639
- { brandCategoryBanner: { columnName: 'brand_banner' } },
4640
- { brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
4641
- { brandLogo: { columnName: 'brand_logo' } },
4642
- { brandCondition: { columnName: 'brand_condition' } },
4643
- {
4644
- conditions: {
4645
- columnName: 'tag_condition',
4646
- type: HasuraGraphQLColumnType.Jsonb,
4647
- from: (tags, row) => ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }),
4648
- bindPersistData: (value) => {
4649
- return {
4650
- brand_condition: value.brand,
4651
- tag_condition: value?.tags || [],
4652
- };
4653
- },
4654
- bindFindFilter: (sentence) => {
4655
- return {
4656
- ...(sentence.brand ? { brand_condition: sentence.brand } : {}),
4657
- ...(sentence.tags ? { tag_condition: sentence.tags } : {}),
4658
- };
4659
- },
4660
- },
4661
- },
4662
- {
4663
- filters: {
4664
- columnName: 'filters',
4665
- foreignKeyColumn: { filter_id: 'id' },
4666
- fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
4667
- bindPersistData: (value) => ({
4668
- filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
4669
- }),
4670
- from: (filters) => filters?.map((filter) => filter?.filter) || [],
4671
- },
4672
- },
4673
- { createdAt: { columnName: 'created_at' } },
4674
- { updatedAt: { columnName: 'updated_at' } },
4675
- {
4676
- products: {
4677
- columnName: 'products',
4678
- fields: ['product_id'],
4679
- from: (value) => value.map((product) => product.product_id.toString()),
4680
- to: (productIds) => productIds.map((productId) => ({
4681
- product_id: +productId,
4682
- })),
4683
- },
4684
- },
4685
- {
4686
- metadata: {
4687
- columnName: 'metadata',
4688
- fields: ['title', 'description'],
4689
- bindPersistData: (value) => ({
4690
- metadata: { data: value },
4691
- }),
4692
- },
4693
- },
4694
- { isCollection: { columnName: 'is_collection' } },
4695
- { isWishlist: { columnName: 'is_wishlist' } },
4696
- 'reference',
4697
- { parentId: { columnName: 'parent_id' } },
4698
- {
4699
- parent: {
4700
- columnName: 'parent',
4701
- foreignKeyColumn: { id: 'parentId' },
4702
- fields: ['id', 'name', 'reference', 'slug'],
4703
- },
4704
- },
4705
- { personId: { columnName: 'person_id' } },
4706
- ],
4707
- });
4708
- this.categoryFilterRepository = categoryFilterRepository;
4709
- }
4710
- async create(params) {
4711
- const { metadata, ...data } = params;
4712
- return super.create({
4713
- ...data,
4714
- isWishlist: true,
4715
- isCollection: true,
4716
- brandCategory: false,
4717
- metadata: metadata || { description: data.description, title: data.name },
4718
- });
4719
- }
4720
- async get(identifiers) {
4721
- const data = await super.get(identifiers);
4722
- if (!data.isWishlist)
4723
- throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
4724
- return data;
4725
- }
4726
- async update(params) {
4727
- const { products, id: checkId, metadata, filters, ...data } = params;
4728
- const plainData = this.paramsToPlain({ id: checkId });
4729
- const id = plainData.id;
4730
- const category = await super.update({ id, ...data, isWishlist: true, isCollection: true, brandCategory: false });
4731
- category.products = products && (await this.updateProducts(+id, { products }));
4732
- category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
4733
- return category;
4734
- }
4735
- async getWishlistBySlug(slug) {
4736
- if (!slug)
4737
- return;
4738
- const { data } = await this.find({
4739
- filters: {
4740
- slug,
4741
- isWishlist: { operator: Where.EQUALS, value: true },
4742
- },
4743
- options: {
4744
- enableCount: false,
4745
- },
4746
- });
4747
- if (!data.length)
4748
- throw new NotFoundError(`Wishlist with slug ${slug} not found`);
4749
- if (data.length > 1)
4750
- throw new DuplicatedResultsError('Query returned duplicated values');
4751
- return data.shift();
4752
- }
4753
- async getWishlistByPerson(personId) {
4754
- if (!personId)
4755
- return;
4756
- const { data } = await this.find({
4757
- filters: {
4758
- personId: { operator: Where.EQUALS, value: personId },
4759
- isWishlist: { operator: Where.EQUALS, value: true },
4760
- },
4761
- options: {
4762
- enableCount: false,
4763
- },
4764
- });
4765
- if (!data.length)
4766
- throw new NotFoundError(`Wishlists from person ${personId} not found`);
4767
- return data;
4768
- }
4769
- async updateProducts(categoryId, { products }) {
4770
- if ('action' in products && products.action === 'remove') {
4771
- await this.mutation('delete_category_product', ['affected_rows'], {
4772
- where: {
4773
- type: 'category_product_bool_exp',
4774
- required: true,
4775
- value: { category_id: { _eq: categoryId } },
4776
- },
4777
- });
4778
- await this.categoryFilterRepository.deleteByCategory(categoryId);
4779
- return [];
4780
- }
4781
- const plainData = this.paramsToPlain({ products });
4782
- if (!plainData.products || plainData.products.length <= 0)
4783
- return [];
4784
- await this.mutation('delete_category_product', ['affected_rows'], {
4785
- where: {
4786
- type: 'category_product_bool_exp',
4787
- required: true,
4788
- value: { category_id: { _eq: categoryId } },
4789
- },
4790
- });
4791
- await this.categoryFilterRepository.deleteByCategory(categoryId);
4792
- await this.mutation('insert_category_product', ['affected_rows'], {
4793
- objects: {
4794
- type: '[category_product_insert_input!]',
4795
- required: true,
4796
- value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
4797
- },
4798
- });
4799
- return plainData.products;
4800
- }
4801
- async updateMetadata(categoryId, { metadata }) {
4802
- const plainData = this.paramsToPlain({ metadata });
4803
- if (!plainData.metadata)
4804
- return;
4805
- await this.mutation('update_category_metadata_by_pk', ['category_id'], {
4806
- pk_columns: {
4807
- value: { category_id: categoryId },
4808
- type: 'category_metadata_pk_columns_input',
4809
- required: true,
4810
- },
4811
- _set: {
4812
- value: omit(metadata, ['category_id']),
4813
- type: 'category_metadata_set_input',
4814
- required: true,
4815
- },
4816
- });
4817
- return plainData.metadata;
4818
- }
4819
- getCategoryBySlug(slug, _shop) {
4820
- return this.getWishlistBySlug(slug);
4821
- }
4822
- async getCategoryByShop(shop) {
4823
- if (!shop)
4824
- return;
4825
- const { data } = await this.find({
4826
- filters: {
4827
- shops: { operator: Where.IN, value: [shop] },
4828
- published: { operator: Where.EQUALS, value: true },
4829
- isWishlist: { operator: Where.EQUALS, value: true },
4830
- },
4831
- options: {
4832
- enableCount: false,
4833
- },
4834
- });
4835
- return data;
4836
- }
4837
- getCategoriesForHome(categoryIds, limit, gender) {
4838
- return;
4839
- }
4840
- mountCategory(category, options) {
4841
- return;
4842
- }
4843
- getChildren(parentId) {
4844
- return;
4845
- }
4846
- isChild(id, parentId) {
4847
- return;
4848
- }
4849
- }
4850
-
4851
3309
  /**
4852
3310
  * Generated bundle index. Do not edit.
4853
3311
  */
4854
3312
 
4855
- 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 };
3313
+ 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 };
4856
3314
  //# sourceMappingURL=infrab4a-connect.mjs.map