@infrab4a/connect 4.0.0-beta.29 → 4.0.0-beta.3

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 (278) hide show
  1. package/domain/catalog/index.d.ts +0 -1
  2. package/domain/catalog/models/category.d.ts +5 -10
  3. package/domain/catalog/models/index.d.ts +0 -4
  4. package/domain/catalog/models/kit-product.d.ts +1 -1
  5. package/domain/catalog/models/product.d.ts +3 -8
  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/variant.d.ts +2 -1
  9. package/domain/catalog/repositories/category.repository.d.ts +3 -4
  10. package/domain/catalog/repositories/index.d.ts +0 -4
  11. package/domain/catalog/repositories/product.repository.d.ts +0 -1
  12. package/domain/generic/model/base.model.d.ts +5 -9
  13. package/domain/generic/model/types/base-model-builder.type.d.ts +2 -4
  14. package/domain/generic/model/types/identifier-model.type.d.ts +5 -6
  15. package/domain/generic/model/types/model-base-structure.type.d.ts +3 -9
  16. package/domain/generic/model/types/non-function-property-name.type.d.ts +3 -12
  17. package/domain/generic/repository/find.repository.d.ts +0 -3
  18. package/domain/generic/repository/get.repository.d.ts +2 -2
  19. package/domain/generic/repository/types/repository-find-filters.type.d.ts +3 -3
  20. package/domain/generic/repository/types/repository-order-by-list.type.d.ts +2 -2
  21. package/domain/generic/repository/types/repository-update-params.type.d.ts +2 -2
  22. package/domain/location/models/address.d.ts +3 -5
  23. package/domain/shop-settings/models/index.d.ts +0 -1
  24. package/domain/shop-settings/models/types/index.d.ts +1 -6
  25. package/domain/shop-settings/repositories/index.d.ts +0 -1
  26. package/domain/shopping/models/buy-2-win.d.ts +1 -3
  27. package/domain/shopping/models/checkout.d.ts +6 -5
  28. package/domain/shopping/models/index.d.ts +4 -5
  29. package/domain/shopping/models/subscription/checkout.d.ts +4 -3
  30. package/domain/shopping/repositories/index.d.ts +2 -4
  31. package/domain/users/models/lead.d.ts +0 -1
  32. package/domain/users/models/subscription/subscription.d.ts +3 -3
  33. package/domain/users/models/user-address.d.ts +2 -1
  34. package/domain/users/models/user.d.ts +3 -2
  35. package/esm2020/domain/catalog/index.mjs +1 -2
  36. package/esm2020/domain/catalog/models/category.mjs +4 -12
  37. package/esm2020/domain/catalog/models/index.mjs +1 -5
  38. package/esm2020/domain/catalog/models/kit-product.mjs +2 -2
  39. package/esm2020/domain/catalog/models/product.mjs +3 -23
  40. package/esm2020/domain/catalog/models/types/category-filter.type.mjs +2 -0
  41. package/esm2020/domain/catalog/models/types/index.mjs +2 -3
  42. package/esm2020/domain/catalog/models/variant.mjs +4 -1
  43. package/esm2020/domain/catalog/repositories/category.repository.mjs +1 -1
  44. package/esm2020/domain/catalog/repositories/index.mjs +1 -5
  45. package/esm2020/domain/catalog/repositories/product.repository.mjs +1 -1
  46. package/esm2020/domain/generic/model/base.model.mjs +2 -3
  47. package/esm2020/domain/generic/model/types/base-model-builder.type.mjs +1 -1
  48. package/esm2020/domain/generic/model/types/identifier-model.type.mjs +1 -1
  49. package/esm2020/domain/generic/model/types/model-base-structure.type.mjs +1 -1
  50. package/esm2020/domain/generic/model/types/non-function-property-name.type.mjs +1 -1
  51. package/esm2020/domain/generic/repository/find.repository.mjs +1 -1
  52. package/esm2020/domain/generic/repository/get.repository.mjs +1 -1
  53. package/esm2020/domain/generic/repository/types/repository-find-filters.type.mjs +1 -1
  54. package/esm2020/domain/generic/repository/types/repository-order-by-list.type.mjs +1 -1
  55. package/esm2020/domain/generic/repository/types/repository-update-params.type.mjs +1 -1
  56. package/esm2020/domain/location/models/address.mjs +2 -2
  57. package/esm2020/domain/shop-settings/models/index.mjs +1 -2
  58. package/esm2020/domain/shop-settings/models/types/index.mjs +2 -7
  59. package/esm2020/domain/shop-settings/repositories/index.mjs +1 -2
  60. package/esm2020/domain/shopping/models/buy-2-win.mjs +2 -2
  61. package/esm2020/domain/shopping/models/checkout.mjs +7 -6
  62. package/esm2020/domain/shopping/models/index.mjs +5 -6
  63. package/esm2020/domain/shopping/models/order.mjs +1 -1
  64. package/esm2020/domain/shopping/models/subscription/checkout.mjs +6 -6
  65. package/esm2020/domain/shopping/repositories/index.mjs +3 -5
  66. package/esm2020/domain/users/models/lead.mjs +1 -1
  67. package/esm2020/domain/users/models/subscription/edition.mjs +1 -1
  68. package/esm2020/domain/users/models/subscription/payment.mjs +1 -1
  69. package/esm2020/domain/users/models/subscription/subscription.mjs +6 -6
  70. package/esm2020/domain/users/models/user-address.mjs +1 -1
  71. package/esm2020/domain/users/models/user-payment-method.mjs +1 -1
  72. package/esm2020/domain/users/models/user.mjs +2 -2
  73. package/esm2020/domain/users/use-cases/authentication.mjs +2 -2
  74. package/esm2020/infra/elasticsearch/adapters/axios.adapter.mjs +11 -28
  75. package/esm2020/infra/elasticsearch/adapters/elastic-search.adapter.mjs +1 -1
  76. package/esm2020/infra/elasticsearch/indexes/products-index.mjs +51 -58
  77. package/esm2020/infra/elasticsearch/types/elastic-search-result.mjs +1 -1
  78. package/esm2020/infra/firebase/firestore/mixins/with-create-firestore.mixin.mjs +4 -8
  79. package/esm2020/infra/firebase/firestore/mixins/with-crud-firestore.mixin.mjs +1 -1
  80. package/esm2020/infra/firebase/firestore/mixins/with-delete-firestore.mixin.mjs +2 -6
  81. package/esm2020/infra/firebase/firestore/mixins/with-find-firestore.mixin.mjs +7 -10
  82. package/esm2020/infra/firebase/firestore/mixins/with-firestore.mixin.mjs +4 -27
  83. package/esm2020/infra/firebase/firestore/mixins/with-get-firestore.mixin.mjs +3 -6
  84. package/esm2020/infra/firebase/firestore/mixins/with-helpers.mixin.mjs +1 -1
  85. package/esm2020/infra/firebase/firestore/mixins/with-sub-collection.mixin.mjs +3 -5
  86. package/esm2020/infra/firebase/firestore/mixins/with-update-firestore.mixin.mjs +4 -7
  87. package/esm2020/infra/firebase/firestore/repositories/catalog/category-firestore.repository.mjs +8 -15
  88. package/esm2020/infra/firebase/firestore/repositories/catalog/product-firestore.repository.mjs +6 -11
  89. package/esm2020/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.mjs +8 -10
  90. package/esm2020/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.mjs +6 -8
  91. package/esm2020/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.mjs +30 -36
  92. package/esm2020/infra/firebase/firestore/repositories/shop-settings/index.mjs +1 -2
  93. package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.mjs +6 -8
  94. package/esm2020/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.mjs +6 -8
  95. package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.mjs +6 -8
  96. package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.mjs +6 -8
  97. package/esm2020/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.mjs +6 -8
  98. package/esm2020/infra/firebase/firestore/repositories/shopping/index.mjs +4 -6
  99. package/esm2020/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.mjs +4 -6
  100. package/esm2020/infra/firebase/firestore/repositories/shopping/order-firestore.repository.mjs +9 -11
  101. package/esm2020/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.mjs +6 -8
  102. package/esm2020/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.mjs +6 -8
  103. package/esm2020/infra/firebase/firestore/repositories/users/lead-firestore.repository.mjs +6 -8
  104. package/esm2020/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.mjs +8 -10
  105. package/esm2020/infra/firebase/firestore/repositories/users/subscription-firestore.repository.mjs +6 -8
  106. package/esm2020/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.mjs +8 -10
  107. package/esm2020/infra/firebase/firestore/repositories/users/user-address-firestore.repository.mjs +8 -10
  108. package/esm2020/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.mjs +8 -10
  109. package/esm2020/infra/firebase/firestore/repositories/users/user-firestore.repository.mjs +6 -8
  110. package/esm2020/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.mjs +8 -10
  111. package/esm2020/infra/firebase/firestore/types/firestore-sub.repository.type.mjs +1 -1
  112. package/esm2020/infra/firebase/firestore/types/firestore.helpers.type.mjs +1 -1
  113. package/esm2020/infra/firebase/firestore/types/firestore.repository.type.mjs +1 -1
  114. package/esm2020/infra/firebase/firestore/types/index.mjs +3 -4
  115. package/esm2020/infra/hasura-graphql/mixins/helpers/attribute-option.helper.mjs +2 -2
  116. package/esm2020/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.mjs +4 -5
  117. package/esm2020/infra/hasura-graphql/mixins/helpers/filter-option.helper.mjs +1 -1
  118. package/esm2020/infra/hasura-graphql/mixins/helpers/graphql-field.helper.mjs +25 -36
  119. package/esm2020/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.mjs +4 -6
  120. package/esm2020/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.mjs +1 -1
  121. package/esm2020/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.mjs +3 -5
  122. package/esm2020/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.mjs +15 -36
  123. package/esm2020/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.mjs +3 -5
  124. package/esm2020/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.mjs +24 -40
  125. package/esm2020/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.mjs +5 -7
  126. package/esm2020/infra/hasura-graphql/models/product-hasura-graphql.mjs +1 -1
  127. package/esm2020/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.mjs +12 -130
  128. package/esm2020/infra/hasura-graphql/repositories/catalog/index.mjs +1 -5
  129. package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +16 -43
  130. package/esm2020/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.mjs +7 -8
  131. package/esm2020/infra/hasura-graphql/types/graphql.repository.type.mjs +1 -1
  132. package/esm2020/infra/hasura-graphql/types/hasura-graphql-fields.type.mjs +1 -1
  133. package/esm2020/utils/index.mjs +4 -6
  134. package/fesm2015/infrab4a-connect.mjs +385 -1497
  135. package/fesm2015/infrab4a-connect.mjs.map +1 -1
  136. package/fesm2020/infrab4a-connect.mjs +391 -1473
  137. package/fesm2020/infrab4a-connect.mjs.map +1 -1
  138. package/infra/elasticsearch/adapters/axios.adapter.d.ts +5 -7
  139. package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +2 -3
  140. package/infra/elasticsearch/indexes/products-index.d.ts +10 -8
  141. package/infra/elasticsearch/types/elastic-search-result.d.ts +0 -2
  142. package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +2 -2
  143. package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +1 -2
  144. package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +2 -2
  145. package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +2 -2
  146. package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +4 -13
  147. package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +2 -2
  148. package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +2 -2
  149. package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +4 -8
  150. package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +3 -3
  151. package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +5 -6
  152. package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +4 -4
  153. package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +4 -3
  154. package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +4 -3
  155. package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +4 -4
  156. package/infra/firebase/firestore/repositories/shop-settings/index.d.ts +0 -1
  157. package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +4 -3
  158. package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +4 -3
  159. package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +4 -3
  160. package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +4 -3
  161. package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +4 -4
  162. package/infra/firebase/firestore/repositories/shopping/index.d.ts +3 -5
  163. package/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +4 -3
  164. package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +4 -4
  165. package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +4 -3
  166. package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +4 -3
  167. package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +4 -3
  168. package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +4 -3
  169. package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +4 -3
  170. package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +4 -3
  171. package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +4 -3
  172. package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +4 -3
  173. package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +4 -4
  174. package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +4 -3
  175. package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +3 -3
  176. package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +5 -5
  177. package/infra/firebase/firestore/types/firestore.repository.type.d.ts +1 -3
  178. package/infra/firebase/firestore/types/index.d.ts +2 -3
  179. package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +3 -9
  180. package/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.d.ts +5 -5
  181. package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +2 -4
  182. package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +5 -8
  183. package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +1 -2
  184. package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +3 -3
  185. package/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +1 -1
  186. package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +15 -12
  187. package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +6 -7
  188. package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +3 -14
  189. package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +2 -2
  190. package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +0 -1
  191. package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +5 -10
  192. package/infra/hasura-graphql/repositories/catalog/index.d.ts +0 -4
  193. package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +3 -4
  194. package/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +4 -4
  195. package/infra/hasura-graphql/types/graphql.repository.type.d.ts +5 -7
  196. package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +3 -7
  197. package/package.json +1 -2
  198. package/utils/index.d.ts +22 -5
  199. package/domain/catalog/helpers/RoundProdutcPriceHelper.d.ts +0 -4
  200. package/domain/catalog/helpers/index.d.ts +0 -1
  201. package/domain/catalog/models/category-collection-children.d.ts +0 -13
  202. package/domain/catalog/models/category-filter.d.ts +0 -11
  203. package/domain/catalog/models/filter-option.d.ts +0 -9
  204. package/domain/catalog/models/filter.d.ts +0 -12
  205. package/domain/catalog/models/types/category-product.d.ts +0 -4
  206. package/domain/catalog/models/types/product-evaluation.type.d.ts +0 -6
  207. package/domain/catalog/repositories/category-collection-children.repository.d.ts +0 -4
  208. package/domain/catalog/repositories/category-filter.repository.d.ts +0 -5
  209. package/domain/catalog/repositories/filter-option.repository.d.ts +0 -4
  210. package/domain/catalog/repositories/filter.repository.d.ts +0 -4
  211. package/domain/shop-settings/models/shop-settings.d.ts +0 -9
  212. package/domain/shop-settings/models/types/shop-banner.type.d.ts +0 -12
  213. package/domain/shop-settings/models/types/shop-brands.type.d.ts +0 -10
  214. package/domain/shop-settings/models/types/shop-carousel.type.d.ts +0 -5
  215. package/domain/shop-settings/models/types/shop-collection.type.d.ts +0 -9
  216. package/domain/shop-settings/models/types/shop-section.type.d.ts +0 -9
  217. package/domain/shop-settings/repositories/shop-settings.repository.d.ts +0 -4
  218. package/domain/shopping/models/campaign-dashboard.d.ts +0 -15
  219. package/domain/shopping/models/campaign-hashtag.d.ts +0 -18
  220. package/domain/shopping/repositories/campaign-dashboard.repository.d.ts +0 -4
  221. package/domain/shopping/repositories/campaign-hashtag.repository.d.ts +0 -4
  222. package/esm2020/domain/catalog/helpers/RoundProdutcPriceHelper.mjs +0 -15
  223. package/esm2020/domain/catalog/helpers/index.mjs +0 -2
  224. package/esm2020/domain/catalog/models/category-collection-children.mjs +0 -13
  225. package/esm2020/domain/catalog/models/category-filter.mjs +0 -14
  226. package/esm2020/domain/catalog/models/filter-option.mjs +0 -7
  227. package/esm2020/domain/catalog/models/filter.mjs +0 -7
  228. package/esm2020/domain/catalog/models/types/category-product.mjs +0 -2
  229. package/esm2020/domain/catalog/models/types/product-evaluation.type.mjs +0 -2
  230. package/esm2020/domain/catalog/repositories/category-collection-children.repository.mjs +0 -2
  231. package/esm2020/domain/catalog/repositories/category-filter.repository.mjs +0 -2
  232. package/esm2020/domain/catalog/repositories/filter-option.repository.mjs +0 -2
  233. package/esm2020/domain/catalog/repositories/filter.repository.mjs +0 -2
  234. package/esm2020/domain/shop-settings/models/shop-settings.mjs +0 -7
  235. package/esm2020/domain/shop-settings/models/types/shop-banner.type.mjs +0 -2
  236. package/esm2020/domain/shop-settings/models/types/shop-brands.type.mjs +0 -2
  237. package/esm2020/domain/shop-settings/models/types/shop-carousel.type.mjs +0 -2
  238. package/esm2020/domain/shop-settings/models/types/shop-collection.type.mjs +0 -2
  239. package/esm2020/domain/shop-settings/models/types/shop-section.type.mjs +0 -2
  240. package/esm2020/domain/shop-settings/repositories/shop-settings.repository.mjs +0 -2
  241. package/esm2020/domain/shopping/models/campaign-dashboard.mjs +0 -7
  242. package/esm2020/domain/shopping/models/campaign-hashtag.mjs +0 -7
  243. package/esm2020/domain/shopping/repositories/campaign-dashboard.repository.mjs +0 -2
  244. package/esm2020/domain/shopping/repositories/campaign-hashtag.repository.mjs +0 -2
  245. package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.mjs +0 -14
  246. package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.mjs +0 -14
  247. package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.mjs +0 -14
  248. package/esm2020/infra/firebase/firestore/types/firestore-interceptors.type.mjs +0 -2
  249. package/esm2020/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.mjs +0 -38
  250. package/esm2020/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.mjs +0 -56
  251. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.mjs +0 -105
  252. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.mjs +0 -22
  253. package/esm2020/utils/decorators/debug.class.decorator.mjs +0 -7
  254. package/esm2020/utils/decorators/index.mjs +0 -3
  255. package/esm2020/utils/decorators/trace.method.decorator.mjs +0 -81
  256. package/esm2020/utils/helpers/class-name.helper.mjs +0 -15
  257. package/esm2020/utils/helpers/debug-decorator.helper.mjs +0 -18
  258. package/esm2020/utils/helpers/debug.helper.mjs +0 -150
  259. package/esm2020/utils/helpers/index.mjs +0 -5
  260. package/esm2020/utils/helpers/reflect.helper.mjs +0 -165
  261. package/esm2020/utils/log.utils.mjs +0 -9
  262. package/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +0 -7
  263. package/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +0 -8
  264. package/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +0 -8
  265. package/infra/firebase/firestore/types/firestore-interceptors.type.d.ts +0 -14
  266. package/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.d.ts +0 -10
  267. package/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +0 -11
  268. package/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +0 -18
  269. package/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +0 -10
  270. package/utils/decorators/debug.class.decorator.d.ts +0 -2
  271. package/utils/decorators/index.d.ts +0 -2
  272. package/utils/decorators/trace.method.decorator.d.ts +0 -14
  273. package/utils/helpers/class-name.helper.d.ts +0 -3
  274. package/utils/helpers/debug-decorator.helper.d.ts +0 -9
  275. package/utils/helpers/debug.helper.d.ts +0 -60
  276. package/utils/helpers/index.d.ts +0 -4
  277. package/utils/helpers/reflect.helper.d.ts +0 -50
  278. package/utils/log.utils.d.ts +0 -7
@@ -3,21 +3,19 @@ import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transforme
3
3
  import { __decorate, __metadata } from 'tslib';
4
4
  import { parseISO } from 'date-fns';
5
5
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
6
- import { isNil, isArray, first, last, flatten, compact, get as get$1, isString, each, unset, isObject, isNumber, isDate, set, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
- export { chunk, each, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
8
- import { Subject } from 'rxjs';
9
- import { debug } from 'debug';
6
+ import * as lodash from 'lodash';
7
+ import { get as get$1, isString as isString$1 } from 'lodash';
10
8
  import { CustomError } from 'ts-custom-error';
11
9
  import axios from 'axios';
12
10
  import { collection, getDoc, doc, where, orderBy, getDocs, query, startAfter, startAt, limit, addDoc, setDoc, deleteField, arrayUnion, arrayRemove, deleteDoc, Timestamp } from 'firebase/firestore';
13
11
  import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
14
12
  import { mutation, query as query$1 } from 'gql-query-builder';
13
+ import fetch from 'node-fetch';
15
14
 
16
15
  class BaseModel {
17
16
  get identifier() {
18
17
  const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
19
- const data = this;
20
- return fields.reduce((object, field) => ({ ...object, [field]: data[field] }), {});
18
+ return fields.reduce((object, field) => ({ ...object, [field]: this[field] }), {});
21
19
  }
22
20
  get identifiersFields() {
23
21
  return this.constructor.identifiersFields;
@@ -463,437 +461,11 @@ __decorate([
463
461
  __metadata("design:type", Payment)
464
462
  ], SubscriptionPayment.prototype, "payment", void 0);
465
463
 
466
- var DebugNamespaces;
467
- (function (DebugNamespaces) {
468
- DebugNamespaces["ROOT"] = "connect";
469
- DebugNamespaces["TRACE"] = "trace";
470
- DebugNamespaces["ERROR"] = "error";
471
- })(DebugNamespaces || (DebugNamespaces = {}));
472
- const Logger = debug(DebugNamespaces.ROOT);
473
-
474
- class ReflectHelper {
475
- static get items() {
476
- return this._items;
477
- }
478
- static get keys() {
479
- return Object.keys(ReflectHelper.items);
480
- }
481
- static has(key, target, property) {
482
- return (!isNil(key) &&
483
- !isNil(ReflectHelper.items[key]) &&
484
- (isNil(target) ||
485
- (!isNil(ReflectHelper.items[key][target]) &&
486
- (isNil(property) || !isNil(ReflectHelper.items[key][target][String(property)])))));
487
- }
488
- static get({ key, target, property, own = true }) {
489
- try {
490
- if (own) {
491
- return Reflect.getOwnMetadata(key, target, property) || null;
492
- }
493
- else {
494
- return Reflect.getMetadata(key, target, property) || null;
495
- }
496
- }
497
- catch (_err) {
498
- return null;
499
- }
500
- }
501
- static first({ key, target, property, own = true }) {
502
- const values = ReflectHelper.get({ key, target, property, own });
503
- return isArray(values) ? first(values) : values;
504
- }
505
- static last({ key, target, property, own = true }) {
506
- const values = ReflectHelper.get({ key, target, property, own });
507
- return isArray(values) ? last(values) : values;
508
- }
509
- static set({ key, target, property, value, propertyDescriptor }) {
510
- Reflect.defineMetadata(key, value, target, property);
511
- ReflectHelper.put({ key, target, property, value, propertyDescriptor });
512
- }
513
- static add({ key, target, property, value, propertyDescriptor }) {
514
- let values = ReflectHelper.get({ key, target, property }) || new Array();
515
- if (!Array.isArray(values))
516
- values = [values];
517
- values.push(value);
518
- ReflectHelper.set({ key, target, property, value: values, propertyDescriptor });
519
- }
520
- static all({ key }) {
521
- const items = ReflectHelper.items[key] || {};
522
- return flatten(Object.keys(items).map((item) => flatten(this.allFrom(key, items[item]))));
523
- }
524
- static allFrom(key, target) {
525
- return Object.keys(target)
526
- .filter((property) => property !== 'object')
527
- .map((property) => this.allValuesFrom(key, target, property));
528
- }
529
- static allValuesFrom(key, target, property) {
530
- const values = target[property];
531
- let value = values.value;
532
- const propertyDescriptor = values.propertyDescriptor;
533
- if (!isArray(value))
534
- value = [value];
535
- return flatten(value.map((val) => {
536
- return {
537
- key,
538
- target: target.object,
539
- property,
540
- value: val,
541
- propertyDescriptor,
542
- };
543
- }));
544
- }
545
- static delete({ key, target, property }) {
546
- Reflect.deleteMetadata(key, target, property);
547
- return ReflectHelper.remove(key, target, property);
548
- }
549
- static clear(key) {
550
- if (!key) {
551
- ReflectHelper.keys.forEach((storedKey) => {
552
- ReflectHelper.clear(storedKey);
553
- });
554
- }
555
- else {
556
- if (ReflectHelper.keys.includes(key)) {
557
- Object.values(ReflectHelper.items[key]).forEach((target) => {
558
- if (ReflectHelper.has(key, target)) {
559
- Object.values(ReflectHelper.items[key][target.toString()]).forEach((property) => {
560
- ReflectHelper.delete({
561
- key,
562
- target: target.object,
563
- property: String(property),
564
- });
565
- ReflectHelper.remove(key, target, String(property));
566
- });
567
- }
568
- ReflectHelper.delete({ key, target: target.object });
569
- ReflectHelper.remove(key, target);
570
- });
571
- }
572
- }
573
- }
574
- static getType({ target, propertyKey }) {
575
- return Reflect.getMetadata('design:type', target, propertyKey);
576
- }
577
- static getReturntype({ target, propertyKey }) {
578
- return Reflect.getMetadata('design:returntype', target, propertyKey);
579
- }
580
- static getAllMethods(target) {
581
- const props = [];
582
- let obj = target;
583
- do {
584
- props.push(...Object.getOwnPropertyNames(obj));
585
- } while ((obj = Object.getPrototypeOf(obj)));
586
- return props.sort().filter((e, i, arr) => {
587
- if ([
588
- '__defineGetter__',
589
- '__defineSetter__',
590
- '__lookupGetter__',
591
- '__lookupSetter__',
592
- 'constructor',
593
- 'hasOwnProperty',
594
- 'isPrototypeOf',
595
- 'propertyIsEnumerable',
596
- 'toLocaleString',
597
- 'toString',
598
- 'valueOf',
599
- ].includes(e))
600
- return false;
601
- if (e != arr[i + 1] && typeof target[e] === 'function')
602
- return true;
603
- });
604
- }
605
- static put({ key, target, property, value, propertyDescriptor }) {
606
- const index = target.constructor.name;
607
- ReflectHelper.items[key] = ReflectHelper.items[key] || {};
608
- ReflectHelper.items[key][index] = ReflectHelper.items[key][index] || {};
609
- ReflectHelper.items[key][index].object = target;
610
- if (isNil(property)) {
611
- ReflectHelper.items[key][index].value = {
612
- value,
613
- propertyDescriptor,
614
- };
615
- }
616
- else {
617
- ReflectHelper.items[key][index][String(property)] = ReflectHelper.items[key][index][String(property)] || {};
618
- ReflectHelper.items[key][index][String(property)] = {
619
- value,
620
- propertyDescriptor,
621
- };
622
- }
623
- }
624
- static remove(key, target, property) {
625
- if (ReflectHelper.has(key, target, property))
626
- return delete ReflectHelper.items[key][target][String(property)];
627
- else if (ReflectHelper.has(key, target))
628
- return delete ReflectHelper.items[key][target];
629
- else if (ReflectHelper.has(key))
630
- return delete ReflectHelper.items[key];
631
- else
632
- return false;
633
- }
634
- }
635
- ReflectHelper._items = {};
636
-
637
- class DebugDecoratorHelper {
638
- static set(target, options) {
639
- ReflectHelper.add({
640
- key: DebugDecoratorHelper.DebugNamingMetadataKey,
641
- target,
642
- value: options,
643
- });
644
- }
645
- static get(target) {
646
- return ReflectHelper.first({
647
- key: DebugDecoratorHelper.DebugNamingMetadataKey,
648
- target,
649
- });
650
- }
651
- }
652
- DebugDecoratorHelper.DebugNamingMetadataKey = 'model:naming:decorator';
653
-
654
- class ClassNameHelper {
655
- static get(clazz) {
656
- if (!clazz)
657
- return null;
658
- const prototype = Object.getPrototypeOf(clazz);
659
- const names = compact([
660
- get$1(clazz, 'constructor.name'),
661
- get$1(prototype, 'constructor.name'),
662
- get$1(prototype, '__proto__.constructor.name'),
663
- ]);
664
- return names.find((name) => name !== 'class_1');
665
- }
666
- }
667
-
668
- const isDebuggable = (object) => {
669
- return 'debug' in object;
670
- };
671
- class DebugHelper {
672
- constructor(...namespace) {
673
- this.namespaces = new Set();
674
- this.push(...namespace);
675
- }
676
- static namespacesFor(target) {
677
- if (isNil(target))
678
- return [];
679
- const decorator = DebugDecoratorHelper.get(Object.getPrototypeOf(target));
680
- const namespaces = get$1(decorator, 'namespaces', []);
681
- const name = get$1(decorator, 'name', ClassNameHelper.get(target));
682
- return [...namespaces, name];
683
- }
684
- static as(...namespaces) {
685
- return new DebugHelper(...namespaces);
686
- }
687
- static for(target, ...namespaces) {
688
- const targetNamespaces = this.namespacesFor(target);
689
- return new DebugHelper(...targetNamespaces, ...namespaces);
690
- }
691
- static from(target, ...namespaces) {
692
- if (this.isDebuggable(target)) {
693
- const debug = target.debug;
694
- if (namespaces)
695
- debug.push(...namespaces);
696
- return debug;
697
- }
698
- return DebugHelper.for(target, ...namespaces);
699
- }
700
- static clonedFrom(target, ...namespaces) {
701
- if (this.isDebuggable(target)) {
702
- namespaces.push(...target.debug.entries);
703
- }
704
- else if (!isNil(target)) {
705
- namespaces.push(...this.namespacesFor(target));
706
- }
707
- return DebugHelper.for(target, ...namespaces);
708
- }
709
- static clone(target, ...namespaces) {
710
- let original;
711
- if (this.isDebuggable(target)) {
712
- original = target.debug;
713
- namespaces.push(...original.entries);
714
- }
715
- return {
716
- original,
717
- debug: DebugHelper.for(target, ...namespaces),
718
- };
719
- }
720
- static replace(target, attrs) {
721
- if (this.isDebuggable(target))
722
- target.debug = attrs.with;
723
- }
724
- static mock(target, ...namespaces) {
725
- const { original, debug } = DebugHelper.clone(target, ...namespaces);
726
- DebugHelper.replace(target, { with: debug });
727
- return { original, debug };
728
- }
729
- get entries() {
730
- return Array.from(get$1(this, 'namespaces', []));
731
- }
732
- get namespace() {
733
- return compact(flatten(this.entries)).join(':');
734
- }
735
- log(message, ...args) {
736
- this.logger(JSON.stringify(message), ...args.map((element) => JSON.stringify(element)));
737
- DebugHelper.logs$.next({ namespace: this.namespace, message, args });
738
- return this;
739
- }
740
- trace(message, ...args) {
741
- this.logger.extend(DebugNamespaces.TRACE)(message, ...args);
742
- DebugHelper.traces$.next({ namespace: this.namespace, message, args });
743
- return this;
744
- }
745
- error(error, ...args) {
746
- this.logger.extend(DebugNamespaces.ERROR)(JSON.stringify(error), ...args.map((element) => JSON.stringify(element)));
747
- DebugHelper.errors$.next({ namespace: this.namespace, error, args });
748
- return this;
749
- }
750
- build() {
751
- this.logger = Logger;
752
- this.tracer = Logger;
753
- this.err = Logger;
754
- this.entries.forEach((namespace) => {
755
- this.logger = this.logger.extend(namespace);
756
- this.tracer = this.tracer.extend(namespace);
757
- this.err = this.err.extend(namespace);
758
- });
759
- return this;
760
- }
761
- with(...namespace) {
762
- return new DebugHelper(...this.entries, ...namespace);
763
- }
764
- push(...namespace) {
765
- if (namespace) {
766
- namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.add(item));
767
- }
768
- return this.build();
769
- }
770
- unshift(...namespace) {
771
- if (namespace) {
772
- return this.reset(...namespace, ...this.entries);
773
- }
774
- return this;
775
- }
776
- reset(...namespace) {
777
- this.namespaces = new Set(flatten(compact(namespace)));
778
- return this.build();
779
- }
780
- startWith(...namespace) {
781
- const current = this.namespaces;
782
- this.namespaces = new Set(flatten([compact(namespace), ...current]));
783
- return this.build();
784
- }
785
- shift() {
786
- const list = this.entries;
787
- list.shift();
788
- return this.reset(...list);
789
- }
790
- pop() {
791
- const list = this.entries;
792
- list.pop();
793
- return this.reset(...list);
794
- }
795
- clear() {
796
- return this.reset();
797
- }
798
- remove(...namespace) {
799
- if (namespace) {
800
- namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.delete(item));
801
- }
802
- return this.build();
803
- }
804
- puts(...args) {
805
- return [`[${this.namespace}]`, ...args].join(' ');
464
+ class Address extends BaseModel {
465
+ static get identifiersFields() {
466
+ return ['id'];
806
467
  }
807
468
  }
808
- DebugHelper.logs$ = new Subject();
809
- DebugHelper.traces$ = new Subject();
810
- DebugHelper.errors$ = new Subject();
811
- DebugHelper.isDebuggable = isDebuggable;
812
-
813
- function Debug(opts) {
814
- return function (target) {
815
- DebugDecoratorHelper.set(target.prototype, opts);
816
- };
817
- }
818
-
819
- const ASYNC_IDENTIFIER = 'async';
820
- function Log(options = {}) {
821
- return Trace({ level: 'log', ...options });
822
- }
823
- function Trace(options = {}) {
824
- return function (target, propertyKey, propertyDescriptor) {
825
- const method = propertyDescriptor.value;
826
- const isPromise = method.toString().includes(ASYNC_IDENTIFIER);
827
- const args = {
828
- options,
829
- method,
830
- target,
831
- propertyKey,
832
- propertyDescriptor,
833
- };
834
- propertyDescriptor.value = isPromise ? promiseTracer(args) : functionTracer(args);
835
- return propertyDescriptor;
836
- };
837
- }
838
- const traceCall = function ({ target, propertyKey, propertyDescriptor, args }) {
839
- if (!target.debug)
840
- target.debug = DebugHelper.for(target, propertyKey);
841
- return target.debug.push(propertyKey).trace('called', { target, propertyKey, propertyDescriptor, args });
842
- };
843
- const promiseTracer = function ({ options, method, propertyKey, propertyDescriptor }) {
844
- return function (...args) {
845
- return new Promise((resolve, reject) => {
846
- const debug = traceCall({ target: this, propertyDescriptor, propertyKey, args });
847
- if (get$1(options, 'level', '') === 'log') {
848
- debug.with('params').log(args);
849
- }
850
- return method
851
- .apply(this, args)
852
- .then((result) => {
853
- if (options.callbackFn) {
854
- options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
855
- }
856
- if (get$1(options, 'level', '') === 'log') {
857
- debug.with('returns').log(result === undefined ? 'void' : result);
858
- }
859
- return resolve(result);
860
- })
861
- .catch((error) => {
862
- debug.error(error, ...args);
863
- debug.with('stack').error(error.stack).pop();
864
- return reject(error);
865
- })
866
- .finally(() => {
867
- return debug.trace('finally', { args }).pop();
868
- });
869
- });
870
- };
871
- };
872
- const functionTracer = function ({ options, target, method, propertyKey, propertyDescriptor, }) {
873
- return function (...args) {
874
- const debug = traceCall({ target: this || target, propertyDescriptor, propertyKey, args });
875
- if (get$1(options, 'level', '') === 'log') {
876
- debug.with('params').log(args);
877
- }
878
- let result;
879
- try {
880
- result = method.apply(this, args);
881
- if (options.callbackFn)
882
- options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
883
- if (get$1(options, 'level', '') === 'log') {
884
- debug.with('returns').log(result === undefined ? 'void' : result);
885
- }
886
- return result;
887
- }
888
- catch (error) {
889
- debug.error(error, ...args).pop();
890
- throw error;
891
- }
892
- finally {
893
- debug.trace('finally', { args }).pop();
894
- }
895
- };
896
- };
897
469
 
898
470
  const get = (object, path, defaultValue) => get$1(object, path, defaultValue);
899
471
 
@@ -901,7 +473,7 @@ function is(value) {
901
473
  return value;
902
474
  }
903
475
 
904
- const isUUID = (value) => isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
476
+ const isUUID = (value) => isString$1(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
905
477
 
906
478
  class Base {
907
479
  constructor(...args) {
@@ -910,7 +482,7 @@ class Base {
910
482
  }
911
483
 
912
484
  const parseDateTime = (value) => {
913
- if (!isString(value))
485
+ if (!isString$1(value))
914
486
  return value;
915
487
  if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
916
488
  !/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T\d{2}:\d{2}:\d{2}/.test(value))
@@ -921,6 +493,8 @@ const parseDateTime = (value) => {
921
493
  return date;
922
494
  };
923
495
 
496
+ const { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN: isNaN$1, isNil, isNumber, isObject, isString, now, omit, pick, set, } = lodash;
497
+
924
498
  var CheckoutTypes;
925
499
  (function (CheckoutTypes) {
926
500
  CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
@@ -1024,18 +598,6 @@ __decorate([
1024
598
  __metadata("design:type", BeautyProfile)
1025
599
  ], User.prototype, "beautyProfile", void 0);
1026
600
 
1027
- class Address extends BaseModel {
1028
- static get identifiersFields() {
1029
- return ['id'];
1030
- }
1031
- }
1032
-
1033
- class UserAddress extends Address {
1034
- static get identifiersFields() {
1035
- return ['id', 'userId'];
1036
- }
1037
- }
1038
-
1039
601
  class Subscription extends BaseModel {
1040
602
  static get identifiersFields() {
1041
603
  return ['id'];
@@ -1050,12 +612,12 @@ __decorate([
1050
612
  __metadata("design:type", SubscriptionPlan)
1051
613
  ], Subscription.prototype, "subscriptionPlan", void 0);
1052
614
  __decorate([
1053
- Type(() => UserAddress),
1054
- __metadata("design:type", UserAddress)
615
+ Type(() => Address),
616
+ __metadata("design:type", Address)
1055
617
  ], Subscription.prototype, "shippingAddress", void 0);
1056
618
  __decorate([
1057
- Type(() => UserAddress),
1058
- __metadata("design:type", UserAddress)
619
+ Type(() => Address),
620
+ __metadata("design:type", Address)
1059
621
  ], Subscription.prototype, "billingAddress", void 0);
1060
622
  __decorate([
1061
623
  Type(() => Coupon),
@@ -1070,6 +632,12 @@ __decorate([
1070
632
  __metadata("design:type", Array)
1071
633
  ], Subscription.prototype, "payment", void 0);
1072
634
 
635
+ class UserAddress extends Address {
636
+ static get identifiersFields() {
637
+ return ['id', 'userId'];
638
+ }
639
+ }
640
+
1073
641
  class UserPaymentMethod extends BaseModel {
1074
642
  static get identifiersFields() {
1075
643
  return ['id', 'userId'];
@@ -1101,7 +669,7 @@ class Authentication {
1101
669
  async signIn({ email, password }, signInMethod) {
1102
670
  const method = this.getServiceByMethod(signInMethod);
1103
671
  const userAuth = await this.authService[method]({ email, password });
1104
- const user = this.userRepository.get({ id: userAuth.id });
672
+ const user = this.userRepository.get(userAuth);
1105
673
  if (!isNil(user))
1106
674
  return user;
1107
675
  if (/^.+@b4a.com.br$/.test(userAuth.email))
@@ -1194,45 +762,14 @@ class RecoveryPassword {
1194
762
  }
1195
763
  }
1196
764
 
1197
- class Filter extends BaseModel {
1198
- static get identifiersFields() {
1199
- return ['id'];
1200
- }
1201
- }
1202
-
1203
765
  class Category extends BaseModel {
1204
- static get identifiersFields() {
766
+ identifierFields() {
1205
767
  return ['id'];
1206
768
  }
1207
- }
1208
- __decorate([
1209
- Type(() => Category),
1210
- __metadata("design:type", Category)
1211
- ], Category.prototype, "parent", void 0);
1212
- __decorate([
1213
- Type(() => Filter),
1214
- __metadata("design:type", Array)
1215
- ], Category.prototype, "filters", void 0);
1216
-
1217
- class CategoryCollectionChildren extends BaseModel {
1218
- static get identifiersFields() {
1219
- return ['collectionId', 'categoryId'];
1220
- }
1221
- }
1222
- __decorate([
1223
- Type(() => CategoryCollectionChildren),
1224
- __metadata("design:type", CategoryCollectionChildren)
1225
- ], CategoryCollectionChildren.prototype, "parent", void 0);
1226
-
1227
- class CategoryFilter extends BaseModel {
1228
769
  static get identifiersFields() {
1229
770
  return ['id'];
1230
771
  }
1231
772
  }
1232
- __decorate([
1233
- Type(() => Filter),
1234
- __metadata("design:type", Filter)
1235
- ], CategoryFilter.prototype, "filter", void 0);
1236
773
 
1237
774
  var GenderDestination;
1238
775
  (function (GenderDestination) {
@@ -1249,39 +786,14 @@ var Shops;
1249
786
  Shops["ALL"] = "ALL";
1250
787
  })(Shops || (Shops = {}));
1251
788
 
1252
- class FilterOption extends BaseModel {
1253
- static get identifiersFields() {
1254
- return ['id'];
1255
- }
1256
- }
1257
-
1258
789
  class Product extends BaseModel {
1259
- get evaluation() {
1260
- return {
1261
- reviews: this.reviews,
1262
- count: this.reviewsTotal,
1263
- rating: this.rate,
1264
- };
1265
- }
1266
- set evaluation(evaluation) {
1267
- if (!evaluation) {
1268
- this.reviews = null;
1269
- this.reviewsTotal = null;
1270
- this.rate = null;
1271
- return;
1272
- }
1273
- this.reviews = evaluation.reviews || this.reviews;
1274
- this.reviewsTotal = evaluation.count || this.reviewsTotal;
1275
- this.rate = evaluation.rating || this.rate;
790
+ identifierFields() {
791
+ return ['id'];
1276
792
  }
1277
793
  static get identifiersFields() {
1278
794
  return ['id'];
1279
795
  }
1280
796
  }
1281
- __decorate([
1282
- Type(() => Category),
1283
- __metadata("design:type", Category)
1284
- ], Product.prototype, "category", void 0);
1285
797
  __decorate([
1286
798
  Type(() => KitProduct),
1287
799
  __metadata("design:type", Array)
@@ -1289,7 +801,7 @@ __decorate([
1289
801
 
1290
802
  class KitProduct extends BaseModel {
1291
803
  static get identifiersFields() {
1292
- return ['productId', 'kitProductId'];
804
+ return ['productId', 'kitProducId'];
1293
805
  }
1294
806
  }
1295
807
  __decorate([
@@ -1302,32 +814,25 @@ __decorate([
1302
814
  ], KitProduct.prototype, "product", void 0);
1303
815
 
1304
816
  class Variant extends BaseModel {
1305
- static get identifiersFields() {
1306
- return ['id', 'productId'];
1307
- }
1308
- }
1309
-
1310
- class Buy2Win extends BaseModel {
1311
- static get identifiersFields() {
817
+ identifierFields() {
1312
818
  return ['id'];
1313
819
  }
1314
- }
1315
- __decorate([
1316
- Type(() => Category),
1317
- __metadata("design:type", Array)
1318
- ], Buy2Win.prototype, "categories", void 0);
1319
-
1320
- class CampaignDashboard extends BaseModel {
1321
820
  static get identifiersFields() {
1322
- return ['id'];
821
+ return ['id', 'productId'];
1323
822
  }
1324
823
  }
1325
824
 
1326
- class CampaignHashtag extends BaseModel {
1327
- static get identifiersFields() {
1328
- return ['id'];
1329
- }
1330
- }
825
+ var OrderStatus;
826
+ (function (OrderStatus) {
827
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
828
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
829
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
830
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
831
+ OrderStatus["ENVIADO"] = "Enviado";
832
+ OrderStatus["ENTREGUE"] = "Entregue";
833
+ OrderStatus["CANCELADO"] = "Cancelado";
834
+ OrderStatus["CREDIT_CARD"] = "credit_card";
835
+ })(OrderStatus || (OrderStatus = {}));
1331
836
 
1332
837
  class LineItem extends Product {
1333
838
  }
@@ -1352,12 +857,12 @@ __decorate([
1352
857
  __metadata("design:type", User)
1353
858
  ], Checkout.prototype, "user", void 0);
1354
859
  __decorate([
1355
- Type(() => UserAddress),
1356
- __metadata("design:type", UserAddress)
860
+ Type(() => Address),
861
+ __metadata("design:type", Address)
1357
862
  ], Checkout.prototype, "shippingAddress", void 0);
1358
863
  __decorate([
1359
- Type(() => UserAddress),
1360
- __metadata("design:type", UserAddress)
864
+ Type(() => Address),
865
+ __metadata("design:type", Address)
1361
866
  ], Checkout.prototype, "billingAddress", void 0);
1362
867
  __decorate([
1363
868
  Type(() => ShippingMethod),
@@ -1368,18 +873,6 @@ __decorate([
1368
873
  __metadata("design:type", Coupon)
1369
874
  ], Checkout.prototype, "coupon", void 0);
1370
875
 
1371
- var OrderStatus;
1372
- (function (OrderStatus) {
1373
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
1374
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
1375
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
1376
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
1377
- OrderStatus["ENVIADO"] = "Enviado";
1378
- OrderStatus["ENTREGUE"] = "Entregue";
1379
- OrderStatus["CANCELADO"] = "Cancelado";
1380
- OrderStatus["CREDIT_CARD"] = "credit_card";
1381
- })(OrderStatus || (OrderStatus = {}));
1382
-
1383
876
  class Order extends Checkout {
1384
877
  }
1385
878
  __decorate([
@@ -1393,12 +886,12 @@ class CheckoutSubscription extends BaseModel {
1393
886
  }
1394
887
  }
1395
888
  __decorate([
1396
- Type(() => UserAddress),
1397
- __metadata("design:type", UserAddress)
889
+ Type(() => Address),
890
+ __metadata("design:type", Address)
1398
891
  ], CheckoutSubscription.prototype, "shippingAddress", void 0);
1399
892
  __decorate([
1400
- Type(() => UserAddress),
1401
- __metadata("design:type", UserAddress)
893
+ Type(() => Address),
894
+ __metadata("design:type", Address)
1402
895
  ], CheckoutSubscription.prototype, "billingAddress", void 0);
1403
896
  __decorate([
1404
897
  Type(() => SubscriptionPlan),
@@ -1409,19 +902,15 @@ __decorate([
1409
902
  __metadata("design:type", Coupon)
1410
903
  ], CheckoutSubscription.prototype, "coupon", void 0);
1411
904
 
1412
- class RoundProductPricesHelper {
1413
- static roundProductPrices(product) {
1414
- product.price.price = Number(product.price.price.toFixed(2));
1415
- product.price.fullPrice = Number(product.price.fullPrice.toFixed(2));
1416
- if (product.price.subscriberPrice) {
1417
- product.price.subscriberPrice = Number(product.price.subscriberPrice.toFixed(2));
1418
- }
1419
- if (product instanceof LineItem && product.pricePaid) {
1420
- product.pricePaid = Number(product.pricePaid.toFixed(2));
1421
- }
1422
- return product;
905
+ class Buy2Win extends BaseModel {
906
+ static get identifiersFields() {
907
+ return ['id'];
1423
908
  }
1424
909
  }
910
+ __decorate([
911
+ Type(() => Category),
912
+ __metadata("design:type", Array)
913
+ ], Buy2Win.prototype, "categories", void 0);
1425
914
 
1426
915
  var FilterType;
1427
916
  (function (FilterType) {
@@ -1522,12 +1011,6 @@ class ShopMenu extends BaseModel {
1522
1011
  }
1523
1012
  }
1524
1013
 
1525
- class ShopSettings extends BaseModel {
1526
- static get identifiersFields() {
1527
- return ['id'];
1528
- }
1529
- }
1530
-
1531
1014
  class InvalidArgumentError extends CustomError {
1532
1015
  constructor(message) {
1533
1016
  super(message);
@@ -1558,16 +1041,12 @@ class AxiosAdapter {
1558
1041
  constructor(config) {
1559
1042
  this.config = config;
1560
1043
  }
1561
- async get(index, id) {
1044
+ async get(index) {
1562
1045
  try {
1563
1046
  const { data } = await axios({
1564
- url: `${this.config.url}/${index}/_doc/${id}`,
1047
+ url: `${this.config.url}/${index}`,
1565
1048
  method: 'GET',
1566
- responseType: 'json',
1567
- headers: {
1568
- 'Content-Type': 'application/json',
1569
- Authorization: `ApiKey ${this.config.credential}`,
1570
- },
1049
+ headers: { Authorization: `Basic ${this.config.credential}` },
1571
1050
  });
1572
1051
  return data._source;
1573
1052
  }
@@ -1579,14 +1058,9 @@ class AxiosAdapter {
1579
1058
  }
1580
1059
  async query(index, query) {
1581
1060
  const { data } = await axios({
1582
- url: `${this.config.url}/${index}/_search`,
1061
+ url: `${this.config.url}/${index}`,
1583
1062
  method: 'POST',
1584
- responseType: 'json',
1585
- headers: {
1586
- Accept: 'application/vnd.elasticsearch+json;compatible-with=7',
1587
- 'Content-Type': 'application/vnd.elasticsearch+json;compatible-with=7',
1588
- Authorization: `ApiKey ${this.config.credential}`,
1589
- },
1063
+ headers: { Authorization: `Basic ${this.config.credential}` },
1590
1064
  data: query,
1591
1065
  });
1592
1066
  return {
@@ -1596,25 +1070,17 @@ class AxiosAdapter {
1596
1070
  }
1597
1071
  async save(index, data) {
1598
1072
  await axios({
1599
- url: `${this.config.url}/${index}/_doc`,
1600
- method: 'POST',
1601
- headers: { Authorization: `ApiKey ${this.config.credential}` },
1602
- data,
1603
- });
1604
- }
1605
- async update(index, id, data) {
1606
- await axios({
1607
- url: `${this.config.url}/${index}/_update/${id}`,
1073
+ url: `${this.config.url}/${index}`,
1608
1074
  method: 'PUT',
1609
- headers: { Authorization: `ApiKey ${this.config.credential}` },
1075
+ headers: { Authorization: `Basic ${this.config.credential}` },
1610
1076
  data,
1611
1077
  });
1612
1078
  }
1613
- async delete(index, id) {
1079
+ async delete(index) {
1614
1080
  await axios({
1615
- url: `${this.config.url}/${index}/_doc/${id}`,
1081
+ url: `${this.config.url}/${index}`,
1616
1082
  method: 'DELETE',
1617
- headers: { Authorization: `ApiKey ${this.config.credential}` },
1083
+ headers: { Authorization: `Basic ${this.config.credential}` },
1618
1084
  });
1619
1085
  }
1620
1086
  }
@@ -1622,16 +1088,13 @@ class AxiosAdapter {
1622
1088
  class ProductsIndex {
1623
1089
  constructor(adapter) {
1624
1090
  this.adapter = adapter;
1625
- this.index = `products`;
1626
1091
  }
1627
- async getById(id) {
1628
- const data = await this.adapter.get(this.index, id);
1092
+ async get(id) {
1093
+ const data = await this.adapter.get(`products/_doc/${id}`);
1629
1094
  return Product.toInstance(data);
1630
1095
  }
1631
- async search(searchTerm, total, shop) {
1632
- const size = total >= 10 ? 500 : 9;
1096
+ async findById(ids, options) {
1633
1097
  const fields = [
1634
- 'EAN',
1635
1098
  'brand',
1636
1099
  'id',
1637
1100
  'images',
@@ -1642,77 +1105,73 @@ class ProductsIndex {
1642
1105
  'stock',
1643
1106
  'slug',
1644
1107
  'reviews',
1108
+ 'pricePaid',
1109
+ 'isGift',
1110
+ 'stock',
1111
+ 'weight',
1112
+ 'tags',
1645
1113
  'hasVariants',
1646
- 'rate',
1114
+ 'type',
1647
1115
  ];
1648
- const filter = [{ term: { published: true } }];
1649
- if (size > 9) {
1650
- fields.push(...['pricePaid', 'isGift', 'stock', 'weight', 'tags']);
1651
- }
1652
- else {
1653
- filter.push({ term: { tags: shop == Shops.GLAMSHOP ? 'feminino' : 'masculino' } });
1654
- }
1655
- const search = await this.adapter.query(this.index, {
1656
- size,
1116
+ const { hits } = await this.adapter.query('products/_search', {
1657
1117
  _source: fields,
1658
1118
  query: {
1659
1119
  bool: {
1660
- must: {
1661
- multi_match: {
1662
- query: `${searchTerm}`,
1663
- type: 'bool_prefix',
1664
- fields: [
1665
- 'name',
1666
- 'name.folded',
1667
- 'name.search',
1668
- 'description',
1669
- 'description.search',
1670
- 'description.folded',
1671
- 'brand',
1672
- 'brand.search',
1673
- 'brand.folded',
1674
- ],
1675
- fuzziness: 2,
1120
+ filter: [
1121
+ {
1122
+ terms: {
1123
+ _id: ids,
1124
+ },
1676
1125
  },
1677
- },
1678
- should: {
1679
- match_phrase_prefix: {
1680
- 'name.search': {
1681
- query: `${searchTerm}`,
1682
- slop: 10,
1126
+ {
1127
+ term: {
1128
+ published: true,
1683
1129
  },
1684
1130
  },
1685
- },
1686
- filter,
1131
+ ...(options?.hasStock
1132
+ ? [
1133
+ {
1134
+ range: {
1135
+ 'stock.quantity': {
1136
+ gt: 0,
1137
+ },
1138
+ },
1139
+ },
1140
+ ]
1141
+ : []),
1142
+ ],
1687
1143
  },
1688
1144
  },
1145
+ ...(options?.size ? { size: options?.size } : {}),
1689
1146
  });
1690
- search.hits = search.hits.filter((e) => e._source.name !== '');
1691
- return search;
1147
+ return hits.map((hit) => Product.toInstance(hit._source));
1692
1148
  }
1693
1149
  async save(product) {
1150
+ delete product.createdAt;
1151
+ delete product.updatedAt;
1152
+ delete product.kitProducts;
1694
1153
  try {
1695
- const { createdAt, updatedAt, kitProducts, ...data } = product;
1696
- this.adapter.save(this.index, data);
1697
- }
1698
- catch (error) {
1699
- console.error(error);
1700
- }
1701
- }
1702
- async update(product) {
1703
- try {
1704
- await this.adapter.update(this.index, product.id, product);
1154
+ if (!product.firestoreId)
1155
+ throw new Error('Is not a product from firestore');
1156
+ await this.get(product.firestoreId);
1157
+ await this.adapter.save(`products/_doc/${product.firestoreId}`, product.toPlain());
1705
1158
  }
1706
1159
  catch (error) {
1707
- console.error(error);
1160
+ if (!(error instanceof Error))
1161
+ throw error;
1162
+ console.error(error.message);
1163
+ await this.adapter.save(`products/_doc/${product.id}`, product.toPlain());
1708
1164
  }
1709
1165
  }
1710
- async delete(id) {
1166
+ async delete(product) {
1167
+ if (!product.firestoreId)
1168
+ return;
1711
1169
  try {
1712
- await this.adapter.delete(this.index, id);
1170
+ await this.get(product.firestoreId);
1171
+ await this.adapter.delete(`products/_doc/${product.firestoreId}`);
1713
1172
  }
1714
1173
  catch (error) {
1715
- console.error(error);
1174
+ await this.adapter.delete(`products/_doc/${product.id}`);
1716
1175
  }
1717
1176
  }
1718
1177
  }
@@ -1742,39 +1201,17 @@ const withFirestore = (MixinBase) => {
1742
1201
  : bindDate(data[key], key),
1743
1202
  }), {});
1744
1203
  };
1745
- const omitByRecursivelyInPlace = (value, iteratee) => {
1746
- each(value, (v, k) => {
1747
- if (iteratee(v, k)) {
1748
- unset(value, k);
1749
- }
1750
- else if (isObject(v)) {
1751
- omitByRecursivelyInPlace(v, iteratee);
1752
- }
1753
- });
1754
- return value;
1755
- };
1756
1204
  return class extends MixinBase {
1757
- constructor(...params) {
1758
- const options = params[0];
1759
- super(...params);
1760
- this.fields = {};
1761
- this.interceptors = {};
1205
+ constructor() {
1206
+ super(...arguments);
1762
1207
  this.collectionName = '';
1763
- this.firestore = options.firestore;
1764
- this.collectionName = options.collectionName;
1765
- this.model = options.model;
1766
- this.fields = options.fields;
1767
- this.interceptors = options.interceptors;
1768
1208
  }
1769
1209
  collection(path) {
1770
1210
  return collection(this.firestore, path || this.collectionName).withConverter(this.buildModelInstance());
1771
1211
  }
1772
1212
  buildModelInstance() {
1773
1213
  return {
1774
- toFirestore: (data) => {
1775
- const plain = data?.toPlain ? data.toPlain() : data;
1776
- return omitByRecursivelyInPlace(plain, (value) => value === undefined);
1777
- },
1214
+ toFirestore: (data) => (data?.toPlain ? data.toPlain() : data),
1778
1215
  fromFirestore: (snap) => {
1779
1216
  const data = snap.data();
1780
1217
  let bindedData = null;
@@ -1814,14 +1251,11 @@ const withHelpers = (MixinBase) => {
1814
1251
  const withGetFirestore = (MixinBase) => {
1815
1252
  return class GetFirestore extends MixinBase {
1816
1253
  async get(identifiers) {
1817
- const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => ({ ...acc, [field]: identifiers[field] }), {}));
1818
- const intercepted = await this.interceptors?.request?.({ instance });
1819
- const builded = intercepted?.instance || instance;
1820
- const docRef = await getDoc(doc(await this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(builded.identifier).shift().toString()));
1254
+ const docRef = await getDoc(doc(await this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(identifiers).shift().toString()));
1821
1255
  const data = docRef.data();
1822
1256
  if (isNil(data))
1823
1257
  throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
1824
- return this.interceptors?.response?.(data, intercepted) || data;
1258
+ return data;
1825
1259
  }
1826
1260
  buildCollectionPathForGet(identifiers) {
1827
1261
  return this.isSubCollection(this)
@@ -1902,11 +1336,8 @@ const withFindFirestore = (MixinBase) => {
1902
1336
  return Object.keys(fieldsToOrderBy).map((fieldName) => orderBy(fieldName, fieldsToOrderBy[fieldName]));
1903
1337
  };
1904
1338
  }
1905
- async find(find = {}) {
1906
- const collection = this.collection(this.buildCollectionPathForFind(find.filters));
1907
- const enableCount = find?.options?.enableCount ?? true;
1908
- const intercepted = await this.interceptors?.request?.({ find });
1909
- const { filters, limits, orderBy } = intercepted.find || find;
1339
+ async find({ filters, limits, orderBy, } = {}) {
1340
+ const collection = this.collection(this.buildCollectionPathForFind(filters));
1910
1341
  const queries = this.makeFirestoreWhere(filters || {});
1911
1342
  const ordination = this.makeFirestoreOrderBy(filters, orderBy);
1912
1343
  const offsets = await this.defineLimits(filters, limits);
@@ -1914,8 +1345,8 @@ const withFindFirestore = (MixinBase) => {
1914
1345
  const docs = await getDocs(query(collection, ...queryArgumments));
1915
1346
  const data = docs.docs.map((doc) => doc.data());
1916
1347
  return {
1917
- data: (await this.interceptors?.response?.(data, intercepted)) || data,
1918
- count: enableCount ? this.calculateCount(data, limits) : Infinity,
1348
+ data,
1349
+ count: this.calculateCount(data, limits),
1919
1350
  };
1920
1351
  }
1921
1352
  buildCollectionPathForFind(filters) {
@@ -1929,7 +1360,7 @@ const withFindFirestore = (MixinBase) => {
1929
1360
  const queries = [];
1930
1361
  if (limits?.offset) {
1931
1362
  if (this.model.isModel(limits.offset))
1932
- queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), Object.values(limits.offset.identifier).shift()?.toString()))));
1363
+ queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), limits.offset.identifier.shift()))));
1933
1364
  else if (isNumber(limits.offset) || isString(limits.offset))
1934
1365
  queries.push(startAt(limits.offset));
1935
1366
  }
@@ -1950,16 +1381,12 @@ const withFindFirestore = (MixinBase) => {
1950
1381
  const withCreateFirestore = (MixinBase) => {
1951
1382
  return class CreateFirestore extends MixinBase {
1952
1383
  async create(data) {
1953
- const instance = this.model.toInstance(data);
1954
- const intercepted = await this.interceptors?.request?.({ instance });
1955
- const builded = intercepted?.instance || instance;
1956
- const docRef = await this.save(builded);
1384
+ const docRef = await this.save(this.model.toInstance(data));
1957
1385
  const doc = await getDoc(docRef);
1958
- const docBuilded = (await this.interceptors?.response?.(doc.data(), intercepted)) || doc.data();
1959
- return docBuilded;
1386
+ return doc.data();
1960
1387
  }
1961
1388
  async save(data) {
1962
- const id = Object.values(data.identifier)?.shift()?.toString();
1389
+ const id = data.identifier[data.identifiersFields?.shift()]?.toString();
1963
1390
  const collectionPath = this.buildCollectionPathForAdd(data);
1964
1391
  const collection = this.collection(collectionPath);
1965
1392
  if (isEmpty(id))
@@ -2000,12 +1427,9 @@ const withUpdateFirestore = (MixinBase) => {
2000
1427
  const model = new this.model();
2001
1428
  const keyField = model.identifiersFields.shift();
2002
1429
  const docRef = doc(this.collection(this.buildCollectionPathForUpdate(data)), getValueFromParams(data, keyField).toString());
2003
- const plainFromData = this.model.toInstance(this.paramsToPlain(data));
2004
- const intercepted = await this.interceptors?.request?.({ instance: plainFromData });
2005
- const builded = intercepted?.instance || plainFromData;
2006
- await setDoc(docRef, builded.toPlain(), { merge: true });
2007
- const docData = await getDoc(docRef).then((doc) => doc.data());
2008
- return this.interceptors?.response?.(docData, intercepted) || docData;
1430
+ await setDoc(docRef, this.paramsToPlain(data), { merge: true });
1431
+ const docData = await getDoc(docRef);
1432
+ return docData.data();
2009
1433
  }
2010
1434
  buildCollectionPathForUpdate(identifiers) {
2011
1435
  return this.isSubCollection(this)
@@ -2027,11 +1451,7 @@ const withUpdateFirestore = (MixinBase) => {
2027
1451
  const withDeleteFirestore = (MixinBase) => {
2028
1452
  return class DeleteFirestore extends MixinBase {
2029
1453
  async delete(identifiers) {
2030
- const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => ({ ...acc, [field]: identifiers[field] }), {}));
2031
- const intercepted = await this.interceptors?.request?.({ instance });
2032
- const builded = intercepted?.instance || instance;
2033
- await deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(builded.identifier).shift().toString()));
2034
- await this.interceptors?.response?.(instance, intercepted);
1454
+ await deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(identifiers).shift().toString()));
2035
1455
  }
2036
1456
  buildCollectionPathForRemove(identifiers) {
2037
1457
  return this.isSubCollection(this)
@@ -2043,10 +1463,8 @@ const withDeleteFirestore = (MixinBase) => {
2043
1463
 
2044
1464
  const withSubCollection = (MixinBase, ParentModel) => {
2045
1465
  return class SubCollectionMix extends MixinBase {
2046
- constructor(...params) {
2047
- const options = params[0];
2048
- super(...params);
2049
- this.parentIdField = options.parentIdField;
1466
+ constructor(...args) {
1467
+ super(args);
2050
1468
  }
2051
1469
  collection(path) {
2052
1470
  return super.collection(path);
@@ -2060,87 +1478,73 @@ const withCrudFirestore = (MixinBase) => {
2060
1478
  };
2061
1479
 
2062
1480
  class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2063
- constructor({ firestore, interceptors }) {
2064
- super({
2065
- firestore,
2066
- collectionName: 'leads',
2067
- model: Lead,
2068
- interceptors,
2069
- });
1481
+ constructor(firestore) {
1482
+ super();
1483
+ this.firestore = firestore;
1484
+ this.collectionName = 'leads';
1485
+ this.model = Lead;
2070
1486
  }
2071
1487
  }
2072
1488
 
2073
1489
  class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
2074
- constructor({ firestore, interceptors }, parentRepository) {
2075
- super({
2076
- firestore,
2077
- collectionName: 'editions',
2078
- parentIdField: 'subscriptionId',
2079
- model: Edition,
2080
- interceptors,
2081
- });
1490
+ constructor(firestore, parentRepository) {
1491
+ super();
1492
+ this.firestore = firestore;
2082
1493
  this.parentRepository = parentRepository;
1494
+ this.collectionName = 'editions';
1495
+ this.parentIdField = 'subscriptionId';
1496
+ this.model = Edition;
2083
1497
  }
2084
1498
  }
2085
1499
 
2086
1500
  class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2087
- constructor({ firestore, interceptors, }) {
2088
- super({
2089
- firestore,
2090
- collectionName: 'subscription',
2091
- model: Subscription,
2092
- interceptors,
2093
- });
1501
+ constructor(firestore) {
1502
+ super();
1503
+ this.firestore = firestore;
1504
+ this.collectionName = 'subscription';
1505
+ this.model = Subscription;
2094
1506
  }
2095
1507
  }
2096
1508
 
2097
1509
  class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
2098
- constructor({ firestore, interceptors }, parentRepository) {
2099
- super({
2100
- firestore,
2101
- collectionName: 'payments',
2102
- parentIdField: 'subscriptionId',
2103
- model: SubscriptionPayment,
2104
- interceptors,
2105
- });
1510
+ constructor(firestore, parentRepository) {
1511
+ super();
1512
+ this.firestore = firestore;
2106
1513
  this.parentRepository = parentRepository;
1514
+ this.collectionName = 'payments';
1515
+ this.parentIdField = 'subscriptionId';
1516
+ this.model = SubscriptionPayment;
2107
1517
  }
2108
1518
  }
2109
1519
 
2110
1520
  class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
2111
- constructor({ firestore, interceptors }, parentRepository) {
2112
- super({
2113
- firestore,
2114
- collectionName: 'address',
2115
- parentIdField: 'userId',
2116
- model: UserAddress,
2117
- interceptors,
2118
- });
1521
+ constructor(firestore, parentRepository) {
1522
+ super();
1523
+ this.firestore = firestore;
2119
1524
  this.parentRepository = parentRepository;
1525
+ this.collectionName = 'address';
1526
+ this.parentIdField = 'userId';
1527
+ this.model = UserAddress;
2120
1528
  }
2121
1529
  }
2122
1530
 
2123
1531
  class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
2124
- constructor({ firestore, interceptors }, parentRepository) {
2125
- super({
2126
- firestore,
2127
- collectionName: 'CX',
2128
- parentIdField: 'userId',
2129
- model: BeautyProfile,
2130
- interceptors,
2131
- });
1532
+ constructor(firestore, parentRepository) {
1533
+ super();
1534
+ this.firestore = firestore;
2132
1535
  this.parentRepository = parentRepository;
1536
+ this.collectionName = 'CX';
1537
+ this.parentIdField = 'userId';
1538
+ this.model = BeautyProfile;
2133
1539
  }
2134
1540
  }
2135
1541
 
2136
1542
  class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2137
- constructor({ firestore, interceptors }) {
2138
- super({
2139
- firestore,
2140
- collectionName: 'users',
2141
- model: User,
2142
- interceptors,
2143
- });
1543
+ constructor(firestore) {
1544
+ super();
1545
+ this.firestore = firestore;
1546
+ this.collectionName = 'users';
1547
+ this.model = User;
2144
1548
  }
2145
1549
  async get(identifiers) {
2146
1550
  const user = await super.get({ id: identifiers.id });
@@ -2180,26 +1584,22 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
2180
1584
  }
2181
1585
 
2182
1586
  class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
2183
- constructor({ firestore, interceptors }, parentRepository) {
2184
- super({
2185
- firestore,
2186
- collectionName: 'payment_method',
2187
- parentIdField: 'userId',
2188
- model: UserPaymentMethod,
2189
- interceptors,
2190
- });
1587
+ constructor(firestore, parentRepository) {
1588
+ super();
1589
+ this.firestore = firestore;
2191
1590
  this.parentRepository = parentRepository;
1591
+ this.collectionName = 'payment_method';
1592
+ this.parentIdField = 'userId';
1593
+ this.model = UserPaymentMethod;
2192
1594
  }
2193
1595
  }
2194
1596
 
2195
1597
  class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2196
- constructor({ firestore, interceptors }) {
2197
- super({
2198
- firestore,
2199
- collectionName: 'categories',
2200
- model: Category,
2201
- interceptors,
2202
- });
1598
+ constructor(firestore) {
1599
+ super();
1600
+ this.firestore = firestore;
1601
+ this.collectionName = 'categories';
1602
+ this.model = Category;
2203
1603
  }
2204
1604
  async getCategoryBySlug(slug, shop) {
2205
1605
  const categoryDocs = await getDocs(query(this.collection(this.collectionName), where('slug', '==', slug), where('shop', '==', shop), where('published', '==', true)));
@@ -2209,14 +1609,14 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
2209
1609
  throw new NotFoundError(`Document with slug ${slug} not found`);
2210
1610
  return categoryDocs.docs[0].data();
2211
1611
  }
2212
- async getCategoriesForHome(categoryIds, limit = 4, gender) {
1612
+ async getCategoriesForHome(categoryIds, limit = 4) {
2213
1613
  const categorySnap = await getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
2214
1614
  if (categorySnap.empty)
2215
1615
  throw new NotFoundError('Categories not found');
2216
1616
  const categories = categorySnap.docs.map((doc) => doc.data());
2217
1617
  const homeSections = await Promise.all(categories.map(async (category) => ({
2218
1618
  category,
2219
- products: await this.mountCategory(category, { limit, hasStock: true, gender }),
1619
+ products: await this.mountCategory(category, { limit, hasStock: true }),
2220
1620
  })));
2221
1621
  return homeSections;
2222
1622
  }
@@ -2232,8 +1632,6 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
2232
1632
  wheres.push(where('published', '==', true), where('id', 'in', productIds));
2233
1633
  if (options?.hasStock)
2234
1634
  wheres.push(where('stock.quantity', '>', 0));
2235
- if (options?.gender)
2236
- wheres.push(where('tags', 'array-contains', options?.gender));
2237
1635
  if (options?.limit)
2238
1636
  wheres.push(limit(options?.limit));
2239
1637
  const productSnap = await getDocs(query(this.collection('productsErpVitrine'), ...wheres));
@@ -2243,20 +1641,15 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
2243
1641
  }
2244
1642
  return is(products);
2245
1643
  }
2246
- getCategoryByShop(shop) {
2247
- return;
2248
- }
2249
1644
  }
2250
1645
 
2251
1646
  class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2252
- constructor({ firestore, interceptors }) {
2253
- super({
2254
- firestore,
2255
- collectionName: 'productsErpVitrine',
2256
- model: Product,
2257
- interceptors,
2258
- });
1647
+ constructor(firestore) {
1648
+ super();
1649
+ this.firestore = firestore;
2259
1650
  this.reviews = {};
1651
+ this.collectionName = 'productsErpVitrine';
1652
+ this.model = Product;
2260
1653
  }
2261
1654
  async getBySlug(slug) {
2262
1655
  const result = await this.find({
@@ -2291,98 +1684,43 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
2291
1684
  });
2292
1685
  return this.reviews[status];
2293
1686
  }
2294
- cleanShoppingCountFromIds() {
2295
- return;
2296
- }
2297
1687
  }
2298
1688
 
2299
1689
  class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
2300
- constructor({ firestore, interceptors }, parentRepository) {
2301
- super({
2302
- firestore,
2303
- collectionName: 'variants',
2304
- parentIdField: 'productId',
2305
- model: Variant,
2306
- interceptors,
2307
- });
2308
- this.parentRepository = parentRepository;
2309
- }
2310
- }
2311
-
2312
- class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2313
- constructor({ firestore, interceptors }) {
2314
- super({
2315
- firestore,
2316
- collectionName: 'subscriptionProducts',
2317
- model: Product,
2318
- interceptors,
2319
- });
2320
- }
2321
- }
2322
-
2323
- class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2324
- constructor({ firestore, interceptors }) {
2325
- super({
2326
- firestore,
2327
- collectionName: 'buy2win',
2328
- model: Buy2Win,
2329
- interceptors,
2330
- });
2331
- }
2332
- }
2333
-
2334
- class CampaignDashboardFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2335
- constructor({ firestore, interceptors, }) {
2336
- super({
2337
- firestore,
2338
- collectionName: 'dashboardCampaignsAuto',
2339
- model: CampaignDashboard,
2340
- interceptors,
2341
- });
2342
- }
2343
- }
2344
-
2345
- class CampaignHashtagFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2346
- constructor({ firestore, interceptors, }) {
2347
- super({
2348
- firestore,
2349
- collectionName: 'hashtagCampaignsAuto',
2350
- model: CampaignHashtag,
2351
- interceptors,
2352
- });
1690
+ constructor(firestore, parentRepository) {
1691
+ super();
1692
+ this.firestore = firestore;
1693
+ this.parentRepository = parentRepository;
1694
+ this.collectionName = 'variants';
1695
+ this.parentIdField = 'productId';
1696
+ this.model = Variant;
2353
1697
  }
2354
1698
  }
2355
1699
 
2356
- class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2357
- constructor({ firestore, interceptors }) {
2358
- super({
2359
- firestore,
2360
- collectionName: 'checkouts',
2361
- model: Checkout,
2362
- interceptors,
2363
- });
1700
+ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1701
+ constructor(firestore) {
1702
+ super();
1703
+ this.firestore = firestore;
1704
+ this.collectionName = 'subscriptionProducts';
1705
+ this.model = Product;
2364
1706
  }
2365
1707
  }
2366
1708
 
2367
- class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2368
- constructor({ firestore, interceptors, }) {
2369
- super({
2370
- firestore,
2371
- collectionName: 'checkoutsSubscription',
2372
- model: CheckoutSubscription,
2373
- interceptors,
2374
- });
1709
+ class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1710
+ constructor(firestore) {
1711
+ super();
1712
+ this.firestore = firestore;
1713
+ this.collectionName = 'checkouts';
1714
+ this.model = Checkout;
2375
1715
  }
2376
1716
  }
2377
1717
 
2378
1718
  class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2379
- constructor({ firestore, interceptors }) {
2380
- super({
2381
- firestore,
2382
- collectionName: 'coupons',
2383
- model: Coupon,
2384
- interceptors,
2385
- });
1719
+ constructor(firestore) {
1720
+ super();
1721
+ this.firestore = firestore;
1722
+ this.collectionName = 'coupons';
1723
+ this.model = Coupon;
2386
1724
  }
2387
1725
  buildModelInstance() {
2388
1726
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -2404,16 +1742,9 @@ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirest
2404
1742
  }
2405
1743
 
2406
1744
  class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2407
- constructor({ firestore, interceptors }) {
2408
- super({
2409
- firestore,
2410
- collectionName: 'orders',
2411
- model: Order,
2412
- interceptors,
2413
- fields: {
2414
- status: FirestoreFieldType.String,
2415
- },
2416
- });
1745
+ constructor(firestore) {
1746
+ super();
1747
+ this.firestore = firestore;
2417
1748
  this.orderFromFirestore = (order) => {
2418
1749
  if (!!order?.lineItems?.length) {
2419
1750
  order.lineItems = order.lineItems.map((lineItem) => {
@@ -2426,6 +1757,11 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
2426
1757
  }
2427
1758
  return order;
2428
1759
  };
1760
+ this.collectionName = 'orders';
1761
+ this.model = Order;
1762
+ this.fields = {
1763
+ status: FirestoreFieldType.String,
1764
+ };
2429
1765
  }
2430
1766
  buildModelInstance() {
2431
1767
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -2439,58 +1775,84 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
2439
1775
  }
2440
1776
  }
2441
1777
 
2442
- class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
2443
- constructor({ firestore, interceptors }) {
2444
- super({
2445
- firestore,
2446
- interceptors,
2447
- });
2448
- this.collectionName = 'legacyOrders';
1778
+ class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1779
+ constructor(firestore) {
1780
+ super();
1781
+ this.firestore = firestore;
1782
+ this.collectionName = 'payments';
1783
+ this.model = Payment;
2449
1784
  }
2450
1785
  }
2451
1786
 
2452
- class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2453
- constructor({ firestore, interceptors }) {
2454
- super({
2455
- firestore,
2456
- collectionName: 'payments',
2457
- model: Payment,
2458
- interceptors,
2459
- });
1787
+ class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1788
+ constructor(firestore) {
1789
+ super();
1790
+ this.firestore = firestore;
1791
+ this.collectionName = 'checkoutsSubscription';
1792
+ this.model = CheckoutSubscription;
2460
1793
  }
2461
1794
  }
2462
1795
 
2463
1796
  class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2464
- constructor({ firestore, interceptors, }) {
2465
- super({
2466
- firestore,
2467
- collectionName: 'subscriptionPlans',
2468
- model: SubscriptionPlan,
2469
- interceptors,
2470
- });
1797
+ constructor(firestore) {
1798
+ super();
1799
+ this.firestore = firestore;
1800
+ this.collectionName = 'subscriptionPlans';
1801
+ this.model = SubscriptionPlan;
1802
+ }
1803
+ }
1804
+
1805
+ class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1806
+ constructor(firestore) {
1807
+ super();
1808
+ this.firestore = firestore;
1809
+ this.collectionName = 'buy2win';
1810
+ this.model = Buy2Win;
1811
+ }
1812
+ }
1813
+
1814
+ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1815
+ constructor(firestore) {
1816
+ super(firestore);
1817
+ this.firestore = firestore;
1818
+ this.collectionName = 'legacyOrders';
2471
1819
  }
2472
1820
  }
2473
1821
 
2474
1822
  class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2475
- constructor({ firestore, interceptors }) {
2476
- super({
2477
- firestore,
2478
- collectionName: 'dms',
2479
- model: Home,
2480
- interceptors,
2481
- });
1823
+ constructor(firestore) {
1824
+ super();
1825
+ this.firestore = firestore;
1826
+ this.homeToFirestore = (home) => {
1827
+ if (home.data?.data) {
1828
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.homeCategoryGroupToPlain);
1829
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.homeCategoryGroupToPlain);
1830
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.homeCategoryGroupToPlain);
1831
+ }
1832
+ return home;
1833
+ };
2482
1834
  this.homeCategoryGroupToPlain = (homeCategoryGroup) => ({
2483
- category: homeCategoryGroup?.category?.toPlain
2484
- ? homeCategoryGroup?.category?.toPlain()
2485
- : homeCategoryGroup?.category,
2486
- products: homeCategoryGroup?.products
2487
- ?.map((product) => (product?.toPlain ? product?.toPlain() : product))
2488
- .filter(Boolean) || [],
2489
- });
1835
+ category: homeCategoryGroup.category.toPlain(),
1836
+ products: homeCategoryGroup.products.map((product) => product.toPlain()),
1837
+ });
1838
+ this.homeFromFirestore = (home) => {
1839
+ if (home.data?.data) {
1840
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
1841
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
1842
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
1843
+ home.data.createdAt =
1844
+ home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
1845
+ home.data.expiresAt =
1846
+ home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
1847
+ }
1848
+ return home;
1849
+ };
2490
1850
  this.plainToHomeCategoryGroup = (homeCategoryGroup) => ({
2491
- category: Category.toInstance(homeCategoryGroup?.category),
2492
- products: homeCategoryGroup.products?.map((product) => Product.toInstance(product)),
1851
+ category: Category.toInstance(homeCategoryGroup.category),
1852
+ products: homeCategoryGroup.products.map((product) => Product.toInstance(product)),
2493
1853
  });
1854
+ this.collectionName = 'dms';
1855
+ this.model = Home;
2494
1856
  }
2495
1857
  buildModelInstance() {
2496
1858
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -2505,47 +1867,14 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
2505
1867
  },
2506
1868
  };
2507
1869
  }
2508
- homeToFirestore(home) {
2509
- if (home.data?.data) {
2510
- home.data.data.discoverProducts = home.data.data.discoverProducts?.map(this.homeCategoryGroupToPlain) || [];
2511
- home.data.data.featuredProducts = home.data.data.featuredProducts?.map(this.homeCategoryGroupToPlain) || [];
2512
- home.data.data.verticalProducts = home.data.data.verticalProducts?.map(this.homeCategoryGroupToPlain) || [];
2513
- }
2514
- return home;
2515
- }
2516
- homeFromFirestore(home) {
2517
- if (home.data?.data) {
2518
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
2519
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
2520
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
2521
- home.data.createdAt =
2522
- home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
2523
- home.data.expiresAt =
2524
- home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
2525
- }
2526
- return home;
2527
- }
2528
1870
  }
2529
1871
 
2530
1872
  class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2531
- constructor({ firestore, interceptors }) {
2532
- super({
2533
- firestore,
2534
- collectionName: 'shopMenus',
2535
- model: ShopMenu,
2536
- interceptors,
2537
- });
2538
- }
2539
- }
2540
-
2541
- class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2542
- constructor({ firestore, interceptors, }) {
2543
- super({
2544
- firestore,
2545
- collectionName: 'shopSettings',
2546
- model: ShopSettings,
2547
- interceptors,
2548
- });
1873
+ constructor(firestore) {
1874
+ super();
1875
+ this.firestore = firestore;
1876
+ this.collectionName = 'shopMenus';
1877
+ this.model = ShopMenu;
2549
1878
  }
2550
1879
  }
2551
1880
 
@@ -2622,7 +1951,7 @@ class AttributeOptionHelper {
2622
1951
  }
2623
1952
  AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
2624
1953
  if (fields.includes(attributeName))
2625
- return { columnName: attributeName.toString(), attributeName, to: (value) => value, from: (value) => value };
1954
+ return { columnName: attributeName.toString(), attributeName };
2626
1955
  const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
2627
1956
  const fieldOption = is(field)?.[attributeName];
2628
1957
  if (isNil(fieldOption))
@@ -2724,12 +2053,11 @@ BindFilterQueryHelper.MakeGraphQLWhere = (filter, fields) => Object.keys(filter)
2724
2053
  }, {});
2725
2054
  BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
2726
2055
  const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
2727
- const isNestedField = !Array.isArray(options) &&
2056
+ if (!Array.isArray(options) &&
2728
2057
  isObject(options) &&
2729
2058
  isNil(options?.operator) &&
2730
2059
  isNil(options?.value) &&
2731
- isNil(fieldSentenceOptions?.to);
2732
- if (isNestedField)
2060
+ isNil(fieldSentenceOptions?.to))
2733
2061
  return Object.keys(options).reduce((variables, key) => {
2734
2062
  const fieldOptions = AttributeOptionHelper.FindByAttribute(key, fieldSentenceOptions?.fields || fields);
2735
2063
  const columnName = fieldOptions.columnName;
@@ -2743,7 +2071,7 @@ BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
2743
2071
  return {
2744
2072
  [fieldSentenceOptions.fields[0]]: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
2745
2073
  };
2746
- if (!Array.isArray(options) && isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
2074
+ if (isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
2747
2075
  options = Object.values(options)[0];
2748
2076
  return Array.isArray(options)
2749
2077
  ? options.reduce((whereSentence, option) => ({
@@ -2779,14 +2107,28 @@ GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = (fields) => {
2779
2107
  if (field === 'affected_rows')
2780
2108
  return field;
2781
2109
  const fieldName = Object.keys(field).shift();
2782
- const fieldValue = is(field[fieldName]);
2110
+ const fieldValue = field[fieldName];
2783
2111
  if (Array.isArray(fieldValue))
2784
2112
  return { [fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue) };
2785
2113
  if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
2786
- return;
2787
- const isNestedField = !!fieldValue.fields;
2788
- if (isNestedField)
2789
- return GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields(fieldName, fieldValue);
2114
+ return null;
2115
+ if (fieldValue.fields)
2116
+ return !fieldValue.filters
2117
+ ? {
2118
+ [fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2119
+ }
2120
+ : {
2121
+ operation: fieldValue.columnName || fieldName,
2122
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2123
+ variables: {
2124
+ [`${fieldValue.columnName}_where`]: {
2125
+ name: 'where',
2126
+ type: fieldValue.filters.filterType,
2127
+ value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
2128
+ required: true,
2129
+ },
2130
+ },
2131
+ };
2790
2132
  return fieldValue.columnName;
2791
2133
  })
2792
2134
  .filter((field) => !!field);
@@ -2811,10 +2153,7 @@ GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).r
2811
2153
  }
2812
2154
  if (!!from)
2813
2155
  return { ...result, [attributeName]: from(data[columnName], data) };
2814
- return {
2815
- ...result,
2816
- [attributeName]: isString(data[columnName]) ? parseDateTime(data[columnName].toString()) : data[columnName],
2817
- };
2156
+ return { ...result, [attributeName]: parseDateTime(data[columnName].toString()) };
2818
2157
  }, {});
2819
2158
  GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2820
2159
  const data = instance.toPlain?.() || instance;
@@ -2830,13 +2169,10 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2830
2169
  if (!!foreignKeyColumn &&
2831
2170
  !isEmpty(foreignKeyColumn) &&
2832
2171
  !Object.keys(foreignKeyColumn).filter((key) => !is(data[attributeName])?.[key]).length)
2833
- return Object.keys(foreignKeyColumn).reduce((object, current) => {
2834
- const { columnName: foreignColumnName } = AttributeOptionHelper.FindByAttribute(foreignKeyColumn[current], fields);
2835
- return {
2836
- ...object,
2837
- [foreignColumnName]: data[attributeName]?.[current],
2838
- };
2839
- }, { ...result });
2172
+ return Object.keys(foreignKeyColumn).reduce((object, current) => ({
2173
+ ...object,
2174
+ [foreignKeyColumn[current]]: data[attributeName]?.[current],
2175
+ }), { ...result });
2840
2176
  if (update &&
2841
2177
  isObject(data[attributeName]) &&
2842
2178
  !isNil(attributeFields) &&
@@ -2869,25 +2205,6 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2869
2205
  return { ...result, [columnName]: data[attributeName] };
2870
2206
  }, {});
2871
2207
  };
2872
- GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields = (fieldName, fieldValue) => {
2873
- const hasCustomFilters = !!fieldValue.filters;
2874
- if (hasCustomFilters)
2875
- return {
2876
- operation: fieldValue.columnName || fieldName,
2877
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2878
- variables: {
2879
- [`${fieldValue.columnName}_where`]: {
2880
- name: 'where',
2881
- type: fieldValue.filters.filterType,
2882
- value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
2883
- required: true,
2884
- },
2885
- },
2886
- };
2887
- return {
2888
- [fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2889
- };
2890
- };
2891
2208
 
2892
2209
  const withCreateHasuraGraphQL = (MixinBase) => {
2893
2210
  return class CreateHasuraGraphQLMixin extends MixinBase {
@@ -2898,7 +2215,6 @@ const withCreateHasuraGraphQL = (MixinBase) => {
2898
2215
  this.insertGraphQLObjectType = options?.insertGraphQLObjectType || `${this.tableName}_insert_input`;
2899
2216
  }
2900
2217
  async create(data) {
2901
- this.logger = DebugHelper.from(this, 'create');
2902
2218
  const newData = await this.save(this.model.toInstance(data));
2903
2219
  return this.model.toInstance(newData);
2904
2220
  }
@@ -2909,10 +2225,10 @@ const withCreateHasuraGraphQL = (MixinBase) => {
2909
2225
  const columnOptions = Object.values(field).shift();
2910
2226
  return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
2911
2227
  columnOptions.foreignKeyColumn && [
2912
- ...Object.values(columnOptions.foreignKeyColumn).map((foreignKeyName) => AttributeOptionHelper.FindByAttribute(foreignKeyName, this.fields)?.columnName),
2228
+ ...Object.values(columnOptions.foreignKeyColumn),
2913
2229
  {
2914
- [columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions?.fields)
2915
- ?.columnName || foreignKeyField),
2230
+ [columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions?.fields)?.columnName ||
2231
+ foreignKeyField),
2916
2232
  },
2917
2233
  ]);
2918
2234
  })
@@ -2934,11 +2250,9 @@ const withDeleteHasuraGraphQL = (MixinBase) => {
2934
2250
  this.deleteGraphQLOperation = options?.deleteGraphQLOperation || `delete_${this.tableName}_by_pk`;
2935
2251
  }
2936
2252
  async delete(identifiers) {
2937
- this.logger = DebugHelper.from(this, 'delete');
2938
2253
  const instance = this.model.toInstance(identifiers);
2939
2254
  await this.mutation(this.deleteGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), this.model.identifiersFields.reduce((ids, identifier) => {
2940
- const identifierBinded = identifier;
2941
- if (isNil(instance.identifier[identifierBinded]))
2255
+ if (isNil(instance[identifier]))
2942
2256
  return ids;
2943
2257
  const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
2944
2258
  const value = columnOption.to(identifiers[identifier], instance);
@@ -2965,19 +2279,15 @@ const withHasuraGraphQL = (MixinBase) => {
2965
2279
  this.authOptions = options.authOptions;
2966
2280
  this.model = options.model;
2967
2281
  this.fields = options.fields || this.model.identifiersFields;
2968
- this.logger = DebugHelper.from(this);
2969
2282
  }
2970
2283
  get headers() {
2971
2284
  return {
2972
2285
  'Content-Type': 'application/json',
2973
- ...(isNil(this.authOptions?.authToken) ? {} : { Authorization: this.authOptions?.authToken }),
2974
- ...(isNil(this.authOptions?.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions?.adminSecret }),
2975
- ...(isNil(this.authOptions?.authRole)
2286
+ ...(isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken }),
2287
+ ...(isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret }),
2288
+ ...(isNil(this.authOptions.authRole)
2976
2289
  ? {}
2977
- : {
2978
- 'X-Hasura-Role': this.authOptions.authRole.role,
2979
- 'X-Hasura-User-Id': this.authOptions?.authRole?.userId,
2980
- }),
2290
+ : { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }),
2981
2291
  };
2982
2292
  }
2983
2293
  async mutation(operation, fields, variables) {
@@ -2989,28 +2299,29 @@ const withHasuraGraphQL = (MixinBase) => {
2989
2299
  return this.fetch(resultQuery);
2990
2300
  }
2991
2301
  async query(operation, fields, variables) {
2992
- const builded = this.buildHasuraQueryFields({
2993
- operation,
2994
- fields: fields,
2995
- variables,
2996
- });
2997
- const interpected = (await this.interceptors?.request?.(builded)) || builded;
2998
- const resultQuery = query$1(interpected);
2999
- const result = await this.fetch(resultQuery);
3000
- return (await this.interceptors?.response?.(result, interpected)) || result;
2302
+ const resultQuery = GraphQLFieldHelper.CheckIsGraphQLParams(operation)
2303
+ ? query$1(operation.map((option) => ({
2304
+ operation: option.operation,
2305
+ variables: option.variables,
2306
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
2307
+ })))
2308
+ : query$1({
2309
+ operation,
2310
+ variables,
2311
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
2312
+ });
2313
+ return this.fetch(resultQuery);
3001
2314
  }
3002
2315
  async fetch(params) {
3003
- this.logger.with('params').log(params);
3004
2316
  const headers = this.headers;
3005
- const { data: result } = await axios({
3006
- url: `${this.endpoint}`,
2317
+ const response = await fetch(`${this.endpoint}`, {
3007
2318
  method: 'POST',
3008
- data: params,
2319
+ body: JSON.stringify(params),
3009
2320
  headers,
3010
2321
  });
2322
+ const result = await response.json();
3011
2323
  if (!isNil(result.errors))
3012
2324
  throw new Error(JSON.stringify(result.errors));
3013
- this.logger.with('returns').log(result);
3014
2325
  return result.data;
3015
2326
  }
3016
2327
  getAttributeGraphQLTypeOf(value) {
@@ -3036,26 +2347,13 @@ const withHasuraGraphQL = (MixinBase) => {
3036
2347
  return value;
3037
2348
  return date;
3038
2349
  }
3039
- convertDataFromHasura(data, fields) {
3040
- const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, fields || this.fields);
2350
+ convertDataFromHasura(data) {
2351
+ const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
3041
2352
  return this.model.toInstance(plain);
3042
2353
  }
3043
2354
  convertDataToHasura(instance, update = false) {
3044
2355
  return GraphQLFieldHelper.ConvertFieldValueTo(instance, this.fields, update);
3045
2356
  }
3046
- buildHasuraQueryFields({ operation, fields, variables, }) {
3047
- return GraphQLFieldHelper.CheckIsGraphQLParams(operation)
3048
- ? operation.map((option) => ({
3049
- operation: option.operation,
3050
- variables: option.variables,
3051
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
3052
- }))
3053
- : {
3054
- operation,
3055
- variables,
3056
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
3057
- };
3058
- }
3059
2357
  };
3060
2358
  };
3061
2359
 
@@ -3078,7 +2376,6 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
3078
2376
  this.updateGraphQLPKType = options?.updateGraphQLPKType || `${this.tableName}_pk_columns_input`;
3079
2377
  }
3080
2378
  async update(data) {
3081
- this.logger = DebugHelper.from(this, 'update');
3082
2379
  const plainData = this.paramsToPlain(data);
3083
2380
  await this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), {
3084
2381
  _set: {
@@ -3104,11 +2401,10 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
3104
2401
  getUpdateModelKeys(data) {
3105
2402
  const instance = this.model.toInstance(data);
3106
2403
  return this.model.identifiersFields.reduce((ids, identifier) => {
3107
- const identifierBinded = identifier;
3108
- if (isNil(instance.identifier[identifierBinded]))
2404
+ if (isNil(instance[identifier]))
3109
2405
  return ids;
3110
- const columnOption = AttributeOptionHelper.FindByAttribute(identifierBinded, this.fields);
3111
- const value = columnOption?.to?.(data[identifierBinded], instance) || data[columnOption.attributeName];
2406
+ const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
2407
+ const value = columnOption?.to?.(data[identifier], instance) || data[columnOption.attributeName];
3112
2408
  return {
3113
2409
  ...ids,
3114
2410
  [columnOption.columnName]: value,
@@ -3126,11 +2422,9 @@ const withGetHasuraGraphQL = (MixinBase) => {
3126
2422
  this.getGraphQLOperation = options?.getGraphQLOperation || `${this.tableName}_by_pk`;
3127
2423
  }
3128
2424
  async get(identifiers) {
3129
- this.logger = DebugHelper.from(this, 'get');
3130
2425
  const instance = this.model.toInstance(identifiers);
3131
2426
  const result = await this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce((ids, identifier) => {
3132
- const identifierBinded = identifier;
3133
- if (isNil(instance[identifierBinded]))
2427
+ if (isNil(instance[identifier]))
3134
2428
  return ids;
3135
2429
  const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
3136
2430
  const value = columnOption?.to?.(identifiers[identifier], instance) ||
@@ -3154,28 +2448,10 @@ const withGetHasuraGraphQL = (MixinBase) => {
3154
2448
 
3155
2449
  const withFindHasuraGraphQL = (MixinBase) => {
3156
2450
  return class FindHasuraGraphQLMixin extends MixinBase {
3157
- constructor() {
3158
- super(...arguments);
3159
- this.bindOrderByAttributes = (orderBy, fields) => Object.keys(orderBy).reduce((acc, current) => ({
3160
- ...acc,
3161
- [AttributeOptionHelper.FindByAttribute(current, fields)
3162
- .columnName]: orderBy[current],
3163
- }), {});
3164
- }
3165
- async find(params) {
3166
- this.logger = DebugHelper.from(this, 'find');
3167
- const { filters, limits, orderBy, options } = params || {};
3168
- const enableCount = options?.enableCount ?? true;
2451
+ async find(options) {
2452
+ const { filters, limits, orderBy } = options || {};
3169
2453
  const variablesCount = {
3170
- ...(isNil(orderBy)
3171
- ? {}
3172
- : {
3173
- order_by: {
3174
- type: `${this.tableName}_order_by!`,
3175
- list: true,
3176
- value: this.bindOrderByAttributes(orderBy, this.fields),
3177
- },
3178
- }),
2454
+ ...(isNil(orderBy) ? {} : { order_by: { type: `${this.tableName}_order_by!`, list: true, value: orderBy } }),
3179
2455
  ...(isNil(filters)
3180
2456
  ? {}
3181
2457
  : {
@@ -3193,26 +2469,23 @@ const withFindHasuraGraphQL = (MixinBase) => {
3193
2469
  const result = await this.query([
3194
2470
  {
3195
2471
  operation: this.tableName,
3196
- fields: params.fields
3197
- ? params.fields
2472
+ fields: options.fields
2473
+ ? options.fields
3198
2474
  .map((fieldName) => this.fields.find((fieldOption) => fieldOption === fieldName) ??
3199
2475
  this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName))
3200
2476
  .filter(Boolean)
3201
2477
  : this.fields,
3202
2478
  variables,
3203
2479
  },
3204
- ...(enableCount
3205
- ? [
3206
- {
3207
- operation: `${this.tableName}_aggregate`,
3208
- fields: [{ aggregate: ['count'] }],
3209
- variables: variablesCount,
3210
- },
3211
- ]
3212
- : []),
2480
+ {
2481
+ operation: `${this.tableName}_aggregate`,
2482
+ fields: [{ aggregate: ['count'] }],
2483
+ variables: variablesCount,
2484
+ },
3213
2485
  ]);
3214
2486
  const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
3215
- return { data, count: enableCount ? result[`${this.tableName}_aggregate`].aggregate.count : Infinity };
2487
+ const count = result[`${this.tableName}_aggregate`].aggregate.count;
2488
+ return { count, data };
3216
2489
  }
3217
2490
  };
3218
2491
  };
@@ -3251,102 +2524,13 @@ class VariantHasuraGraphQL extends Variant {
3251
2524
  }
3252
2525
  }
3253
2526
 
3254
- class CategoryCollectionChildrenHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3255
- constructor(endpoint, authOptions) {
3256
- super({
3257
- tableName: 'category_collection_children',
3258
- model: CategoryCollectionChildren,
3259
- endpoint,
3260
- authOptions,
3261
- fields: [
3262
- { collectionId: { columnName: 'collection_id' } },
3263
- { categoryId: { columnName: 'category_id' } },
3264
- 'name',
3265
- 'slug',
3266
- 'reference',
3267
- { parentCollectionId: { columnName: 'parent_collection_id' } },
3268
- { parentCategoryId: { columnName: 'parent_category_id' } },
3269
- {
3270
- parent: {
3271
- columnName: 'parent',
3272
- foreignKeyColumn: { collectionId: 'parentCollectionId', categoryId: 'parentCategoryId' },
3273
- fields: [
3274
- { collectionId: { columnName: 'collection_id' } },
3275
- { categoryId: { columnName: 'category_id' } },
3276
- 'name',
3277
- 'slug',
3278
- 'reference',
3279
- { parentCollectionId: { columnName: 'parent_collection_id' } },
3280
- { parentCategoryId: { columnName: 'parent_category_id' } },
3281
- ],
3282
- },
3283
- },
3284
- ],
3285
- });
3286
- }
3287
- }
3288
-
3289
- class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3290
- constructor({ endpoint, authOptions, interceptors, }) {
3291
- super({
3292
- tableName: 'category_filter',
3293
- model: CategoryFilter,
3294
- endpoint,
3295
- authOptions,
3296
- interceptors,
3297
- fields: [
3298
- 'id',
3299
- { filterId: { columnName: 'filter_id' } },
3300
- { categoryId: { columnName: 'category_id' } },
3301
- {
3302
- filter: {
3303
- columnName: 'filter',
3304
- foreignKeyColumn: { id: 'filterId' },
3305
- fields: [
3306
- 'id',
3307
- 'description',
3308
- 'slug',
3309
- 'enabled',
3310
- { createdAt: { columnName: 'created_at' } },
3311
- { updatedAt: { columnName: 'updated_at' } },
3312
- {
3313
- options: {
3314
- columnName: 'options',
3315
- foreignKeyColumn: { filterId: 'id' },
3316
- fields: [
3317
- 'id',
3318
- { filterId: { columnName: 'filter_id' } },
3319
- 'description',
3320
- { createdAt: { columnName: 'created_at' } },
3321
- { updatedAt: { columnName: 'updated_at' } },
3322
- ],
3323
- },
3324
- },
3325
- ],
3326
- },
3327
- },
3328
- ],
3329
- });
3330
- }
3331
- deleteByCategoryAndFilter(categoryId, filterId) {
3332
- return this.mutation('delete_category_filter', ['affected_rows'], {
3333
- where: {
3334
- type: 'category_filter_bool_exp',
3335
- required: true,
3336
- value: { category_id: { _eq: categoryId }, filter_id: { _eq: filterId } },
3337
- },
3338
- });
3339
- }
3340
- }
3341
-
3342
2527
  class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3343
- constructor({ endpoint, authOptions, interceptors, }, productRepository, categoryFilterRepository) {
2528
+ constructor(endpoint, authOptions, productRepository) {
3344
2529
  super({
3345
2530
  tableName: 'category',
3346
2531
  model: Category,
3347
2532
  endpoint,
3348
2533
  authOptions,
3349
- interceptors,
3350
2534
  fields: [
3351
2535
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
3352
2536
  { firestoreId: { columnName: 'firestore_id' } },
@@ -3355,7 +2539,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3355
2539
  'image',
3356
2540
  'published',
3357
2541
  'shop',
3358
- { shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
3359
2542
  'slug',
3360
2543
  { brandCategory: { columnName: 'brand_category' } },
3361
2544
  { brandCategoryBanner: { columnName: 'brand_banner' } },
@@ -3384,17 +2567,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3384
2567
  },
3385
2568
  },
3386
2569
  },
3387
- {
3388
- filters: {
3389
- columnName: 'filters',
3390
- foreignKeyColumn: { filter_id: 'id' },
3391
- fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
3392
- bindPersistData: (value) => ({
3393
- filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
3394
- }),
3395
- from: (filters) => filters?.map((filter) => filter?.filter) || [],
3396
- },
3397
- },
2570
+ 'filters',
3398
2571
  { createdAt: { columnName: 'created_at' } },
3399
2572
  { updatedAt: { columnName: 'updated_at' } },
3400
2573
  {
@@ -3416,20 +2589,9 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3416
2589
  }),
3417
2590
  },
3418
2591
  },
3419
- { isCollection: { columnName: 'is_collection' } },
3420
- 'reference',
3421
- { parentId: { columnName: 'parent_id' } },
3422
- {
3423
- parent: {
3424
- columnName: 'parent',
3425
- foreignKeyColumn: { id: 'parentId' },
3426
- fields: ['id', 'name', 'reference', 'slug'],
3427
- },
3428
- },
3429
2592
  ],
3430
2593
  });
3431
2594
  this.productRepository = productRepository;
3432
- this.categoryFilterRepository = categoryFilterRepository;
3433
2595
  }
3434
2596
  async create(params) {
3435
2597
  const { metadata, ...data } = params;
@@ -3437,53 +2599,29 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3437
2599
  }
3438
2600
  async get(identifiers) {
3439
2601
  return Number.isNaN(+identifiers.id)
3440
- ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data?.[0]
2602
+ ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
3441
2603
  : super.get(identifiers);
3442
2604
  }
3443
2605
  async update(params) {
3444
- const { products, id: checkId, metadata, filters, ...data } = params;
2606
+ const { products, id: checkId, metadata, ...data } = params;
3445
2607
  const plainData = this.paramsToPlain({ id: checkId });
3446
2608
  const id = await this.getId(plainData.id);
3447
2609
  const category = await super.update({ id, ...data });
3448
2610
  category.products = products && (await this.updateProducts(+id, { products }));
3449
2611
  category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
3450
- category.filters = filters && (await this.updateFilters(+id, { filters }));
3451
2612
  return category;
3452
2613
  }
3453
2614
  async getCategoryBySlug(slug, shop) {
3454
2615
  if (!slug)
3455
2616
  return null;
3456
- const { data } = await this.find({
3457
- filters: {
3458
- slug,
3459
- shops: { operator: Where.IN, value: [shop] },
3460
- published: { operator: Where.EQUALS, value: true },
3461
- },
3462
- options: {
3463
- enableCount: false,
3464
- },
3465
- });
3466
- if (!data.length)
3467
- throw new NotFoundError(`Category with slug ${slug} not found`);
3468
- if (data.length > 1)
2617
+ const { data, count } = await this.find({ filters: { slug, shop, published: true } });
2618
+ if (count > 1)
3469
2619
  throw new DuplicatedResultsError('Query returned duplicated values');
2620
+ if (!count)
2621
+ throw new NotFoundError(`Category with slug ${slug} not found`);
3470
2622
  return data.shift();
3471
2623
  }
3472
- async getCategoryByShop(shop) {
3473
- if (!shop)
3474
- return;
3475
- const { data } = await this.find({
3476
- filters: {
3477
- shops: { operator: Where.IN, value: [shop] },
3478
- published: { operator: Where.EQUALS, value: true },
3479
- },
3480
- options: {
3481
- enableCount: false,
3482
- },
3483
- });
3484
- return data;
3485
- }
3486
- async getCategoriesForHome(categoryIds, limit = 4, gender) {
2624
+ async getCategoriesForHome(categoryIds, limit = 4) {
3487
2625
  if (!categoryIds?.length)
3488
2626
  return [];
3489
2627
  const categoriesFirestore = categoryIds.filter((categoryId) => Number.isNaN(+categoryId));
@@ -3501,7 +2639,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3501
2639
  return [];
3502
2640
  const homeSections = await Promise.all(categories.map(async (category) => ({
3503
2641
  category,
3504
- products: await this.mountCategory(category, { limit, hasStock: true, gender }),
2642
+ products: await this.mountCategory(category, { limit, hasStock: true }),
3505
2643
  })));
3506
2644
  return homeSections;
3507
2645
  }
@@ -3514,7 +2652,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3514
2652
  id: { operator: Where.IN, value: category.products },
3515
2653
  published: true,
3516
2654
  ...(options?.hasStock ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {}),
3517
- ...(options?.gender ? { tags: { operator: Where.IN, value: [options?.gender] } } : {}),
3518
2655
  },
3519
2656
  fields: [
3520
2657
  'id',
@@ -3540,11 +2677,8 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3540
2677
  'tags',
3541
2678
  'type',
3542
2679
  'shoppingCount',
3543
- 'gender',
3544
- 'createdAt',
3545
2680
  ],
3546
2681
  ...(options?.limit ? { limits: { limit: options?.limit } } : {}),
3547
- options: { enableCount: false },
3548
2682
  });
3549
2683
  products.push(...productsData);
3550
2684
  return products;
@@ -3552,7 +2686,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3552
2686
  async getId(id) {
3553
2687
  if (!Number.isNaN(+id))
3554
2688
  return id;
3555
- const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
2689
+ const { data } = await this.find({ filters: { firestoreId: id } });
3556
2690
  if (data?.[0]?.id)
3557
2691
  return data?.[0]?.id;
3558
2692
  throw new NotFoundError(`Category with id ${id} not found`);
@@ -3605,204 +2739,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3605
2739
  });
3606
2740
  return plainData.metadata;
3607
2741
  }
3608
- async updateFilters(categoryId, { filters }) {
3609
- if ('action' in filters && filters.action === 'remove' && filters.value.length) {
3610
- for (let i = 0; i < filters.value.length; i++) {
3611
- await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filters.value[i].id);
3612
- }
3613
- return [];
3614
- }
3615
- if ('action' in filters && filters.action === 'merge' && filters.value.length) {
3616
- let filtersList = [];
3617
- for (let i = 0; i < filters.value.length; i++) {
3618
- try {
3619
- const hasFilter = await this.categoryFilterRepository
3620
- .find({
3621
- filters: {
3622
- categoryId,
3623
- filterId: filters.value[i].id,
3624
- },
3625
- })
3626
- .then((data) => data.data.shift()?.filter);
3627
- if (hasFilter) {
3628
- filtersList.push(hasFilter);
3629
- }
3630
- else {
3631
- await this.categoryFilterRepository.create({
3632
- filterId: filters.value[i].id,
3633
- categoryId,
3634
- });
3635
- filtersList.push(filters.value[i]);
3636
- }
3637
- }
3638
- catch (error) {
3639
- console.log('catch error: ', error);
3640
- }
3641
- }
3642
- return filtersList;
3643
- }
3644
- if (Array.isArray(filters) && filters.length) {
3645
- let filtersList = [];
3646
- for (let i = 0; i < filters.length; i++) {
3647
- try {
3648
- const hasFilter = await this.categoryFilterRepository
3649
- .find({
3650
- filters: {
3651
- categoryId,
3652
- filterId: filters[i].id,
3653
- },
3654
- })
3655
- .then((data) => data.data.shift()?.filter);
3656
- if (hasFilter) {
3657
- filtersList.push(hasFilter);
3658
- }
3659
- else {
3660
- await this.categoryFilterRepository.create({
3661
- filterId: filters[i].id,
3662
- categoryId,
3663
- });
3664
- filtersList.push(filters[i]);
3665
- }
3666
- }
3667
- catch (error) {
3668
- console.log('catch error: ', error);
3669
- }
3670
- }
3671
- return filtersList;
3672
- }
3673
- return [];
3674
- }
3675
- }
3676
-
3677
- class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3678
- constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
3679
- super({
3680
- tableName: 'filter',
3681
- model: Filter,
3682
- endpoint,
3683
- authOptions,
3684
- interceptors,
3685
- fields: [
3686
- 'id',
3687
- 'description',
3688
- 'slug',
3689
- 'enabled',
3690
- { createdAt: { columnName: 'created_at' } },
3691
- { updatedAt: { columnName: 'updated_at' } },
3692
- {
3693
- options: {
3694
- columnName: 'options',
3695
- foreignKeyColumn: { filterId: 'id' },
3696
- fields: [
3697
- 'id',
3698
- { filterId: { columnName: 'filter_id' } },
3699
- 'description',
3700
- { createdAt: { columnName: 'created_at' } },
3701
- { updatedAt: { columnName: 'updated_at' } },
3702
- ],
3703
- },
3704
- },
3705
- ],
3706
- });
3707
- this.filterOptionRepository = filterOptionRepository;
3708
- this.categoryFilterRepository = categoryFilterRepository;
3709
- }
3710
- async update(params) {
3711
- const { options, ...data } = params;
3712
- const filter = await super.update(data);
3713
- filter.options = await this.updateOptions(+data.id, { options });
3714
- return filter;
3715
- }
3716
- async updateOptions(filterId, { options }) {
3717
- if (!options)
3718
- return [];
3719
- if ('action' in options && options.action === 'remove' && options.value.length) {
3720
- for (let i = 0; i < options.value.length; i++) {
3721
- await this.filterOptionRepository.delete({ id: options.value[i].id });
3722
- }
3723
- return [];
3724
- }
3725
- if ('action' in options && options.action === 'merge' && options.value.length) {
3726
- let filterOptions = [];
3727
- for (let i = 0; i < options.value.length; i++) {
3728
- try {
3729
- const hasFilter = await this.filterOptionRepository.get({ id: options.value[i].id });
3730
- if (hasFilter)
3731
- filterOptions.push(hasFilter);
3732
- }
3733
- catch (error) {
3734
- const newOption = await this.filterOptionRepository.create({ ...options.value[i], filterId });
3735
- filterOptions.push(newOption);
3736
- }
3737
- }
3738
- return filterOptions;
3739
- }
3740
- if (Array.isArray(options) && options.length) {
3741
- let filterOptions = [];
3742
- for (let i = 0; i < options.length; i++) {
3743
- try {
3744
- const hasFilter = await this.filterOptionRepository.get({ id: options[i].id });
3745
- if (hasFilter)
3746
- filterOptions.push(hasFilter);
3747
- }
3748
- catch (error) {
3749
- const newOption = await this.filterOptionRepository.create({ ...options[i], filterId });
3750
- filterOptions.push(newOption);
3751
- }
3752
- }
3753
- }
3754
- return [];
3755
- }
3756
- async delete(params) {
3757
- const { data: categoryFilters } = await this.categoryFilterRepository.find({
3758
- filters: {
3759
- filterId: params.id,
3760
- },
3761
- });
3762
- if (categoryFilters.length)
3763
- throw new Error('Erro: o filtro está associado a uma ou mais categoria(s)');
3764
- await this.deleteOptions(+params.id);
3765
- await super.delete({ id: +params.id });
3766
- return;
3767
- }
3768
- async deleteOptions(filterId) {
3769
- await this.mutation('delete_filter_option', ['affected_rows'], {
3770
- where: {
3771
- type: 'filter_option_bool_exp',
3772
- required: true,
3773
- value: { filter_id: { _eq: filterId } },
3774
- },
3775
- });
3776
- }
3777
- }
3778
-
3779
- class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3780
- constructor({ endpoint, authOptions, interceptors, }) {
3781
- super({
3782
- tableName: 'filter_option',
3783
- model: FilterOption,
3784
- endpoint,
3785
- authOptions,
3786
- interceptors,
3787
- fields: [
3788
- 'id',
3789
- 'description',
3790
- { filterId: { columnName: 'filter_id' } },
3791
- { createdAt: { columnName: 'created_at' } },
3792
- { updatedAt: { columnName: 'updated_at' } },
3793
- ],
3794
- });
3795
- }
3796
2742
  }
3797
2743
 
3798
2744
  class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3799
- constructor({ endpoint, authOptions, interceptors, }) {
2745
+ constructor(endpoint, authOptions) {
3800
2746
  super({
3801
2747
  tableName: 'product',
3802
2748
  model: ProductHasuraGraphQL,
3803
2749
  endpoint,
3804
2750
  authOptions,
3805
- interceptors,
3806
2751
  fields: [],
3807
2752
  });
3808
2753
  this.bindReviewToModel = (plain) => ({
@@ -3931,21 +2876,21 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3931
2876
  'weight',
3932
2877
  'gender',
3933
2878
  { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
3934
- { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
3935
2879
  { isKit: { columnName: 'is_kit' } },
3936
2880
  { createdAt: { columnName: 'created_at' } },
3937
2881
  { updatedAt: { columnName: 'updated_at' } },
3938
- { rate: { columnName: 'rating' } },
3939
- { reviewsTotal: { columnName: 'reviews_total' } },
3940
- { shoppingCount: { columnName: 'shopping_count' } },
3941
- { categoryId: { columnName: 'category_id' } },
3942
2882
  {
3943
- category: {
3944
- columnName: 'category',
3945
- foreignKeyColumn: { id: 'categoryId' },
3946
- fields: ['id', 'name', 'reference', 'slug'],
2883
+ rate: {
2884
+ columnName: 'reviews_aggregate',
2885
+ filters: {
2886
+ filters: { status: true },
2887
+ filterType: 'product_review_bool_exp',
2888
+ },
2889
+ fields: [{ aggregate: [{ avg: ['rate'] }] }],
2890
+ from: (value) => value.aggregate.avg.rate,
3947
2891
  },
3948
2892
  },
2893
+ { shoppingCount: { columnName: 'shopping_count' } },
3949
2894
  ];
3950
2895
  this.fields = [
3951
2896
  ...commonFields,
@@ -4022,7 +2967,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4022
2967
  }
4023
2968
  async get(identifiers) {
4024
2969
  const product = Number.isNaN(+identifiers.id)
4025
- ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data?.[0]
2970
+ ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
4026
2971
  : await super.get(identifiers);
4027
2972
  if (product.productId)
4028
2973
  throw new NotFoundError('Product not found, it is a variant');
@@ -4038,16 +2983,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4038
2983
  return super.find({
4039
2984
  ...options,
4040
2985
  filters: { ...filters, productId: { operator: Where.ISNULL } },
4041
- fields: [
4042
- ...bindFields,
4043
- ...(bindFields.includes('price')
4044
- ? [
4045
- 'subscriberPrice',
4046
- 'subscriberDiscountPercentage',
4047
- 'fullPrice',
4048
- ]
4049
- : []),
4050
- ],
2986
+ fields: bindFields,
4051
2987
  });
4052
2988
  }
4053
2989
  async getBySlug(slug) {
@@ -4055,13 +2991,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4055
2991
  filters: {
4056
2992
  slug,
4057
2993
  },
4058
- fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
4059
- options: {
4060
- enableCount: false,
4061
- },
4062
2994
  });
4063
2995
  const product = result?.data?.shift();
4064
- RoundProductPricesHelper.roundProductPrices(product);
2996
+ product.reviews = await this.findReviewsByProduct(+product.id);
4065
2997
  return product;
4066
2998
  }
4067
2999
  async update(params) {
@@ -4211,7 +3143,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4211
3143
  async getId(id) {
4212
3144
  if (!Number.isNaN(+id))
4213
3145
  return id;
4214
- const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3146
+ const { data } = await this.find({ filters: { firestoreId: id } });
4215
3147
  if (data?.[0]?.id)
4216
3148
  return data?.[0]?.id;
4217
3149
  throw new NotFoundError(`Product with id ${id} not found`);
@@ -4267,29 +3199,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4267
3199
  });
4268
3200
  return data && data[0] && this.bindReviewToModel(data[0]);
4269
3201
  }
4270
- async cleanShoppingCountFromIds(ids) {
4271
- return await this.mutation('update_product', ['affected_rows'], {
4272
- where: {
4273
- value: { id: { _nin: ids } },
4274
- type: 'product_bool_exp',
4275
- required: true,
4276
- },
4277
- _set: {
4278
- value: { shopping_count: 0 },
4279
- type: 'product_set_input',
4280
- },
4281
- });
4282
- }
4283
3202
  }
4284
3203
 
4285
3204
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
4286
- constructor({ endpoint, authOptions, interceptors, }) {
3205
+ constructor(endpoint, authOptions) {
4287
3206
  super({
4288
3207
  tableName: 'product',
4289
3208
  model: VariantHasuraGraphQL,
4290
3209
  endpoint,
4291
3210
  authOptions,
4292
- interceptors,
4293
3211
  fields: [
4294
3212
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
4295
3213
  { firestoreId: { columnName: 'firestore_id' } },
@@ -4325,12 +3243,12 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4325
3243
  };
4326
3244
  },
4327
3245
  bindPersistData: (priceData) => ({
4328
- ...((priceData?.price || 0) >= 0 && { price: priceData.price }),
4329
- ...((priceData?.fullPrice || 0) >= 0 && { full_price: priceData.fullPrice }),
4330
- ...((priceData?.subscriberDiscountPercentage || 0) >= 0 && {
3246
+ ...(priceData?.price >= 0 && { price: priceData.price }),
3247
+ ...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
3248
+ ...(priceData.subscriberDiscountPercentage >= 0 && {
4331
3249
  subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
4332
3250
  }),
4333
- ...((priceData?.subscriberPrice || 0) >= 0 && { subscriber_price: priceData.subscriberPrice }),
3251
+ ...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
4334
3252
  }),
4335
3253
  },
4336
3254
  },
@@ -4382,7 +3300,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4382
3300
  async getId(id) {
4383
3301
  if (!Number.isNaN(+id))
4384
3302
  return id;
4385
- const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3303
+ const { data } = await this.find({ filters: { firestoreId: id } });
4386
3304
  if (data?.[0]?.id)
4387
3305
  return data?.[0]?.id;
4388
3306
  throw new NotFoundError(`Product with id ${id} not found`);
@@ -4393,5 +3311,5 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4393
3311
  * Generated bundle index. Do not edit.
4394
3312
  */
4395
3313
 
4396
- 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, get, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
3314
+ export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, chunk, get, is, isBoolean, isDate, isEmpty, isInteger, isNaN$1 as isNaN, isNil, isNumber, isObject, isString, isUUID, now, omit, parseDateTime, pick, set, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
4397
3315
  //# sourceMappingURL=infrab4a-connect.mjs.map