@infrab4a/connect 3.15.0 → 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/domain/catalog/index.d.ts +0 -1
- package/domain/catalog/models/category.d.ts +22 -5
- package/domain/catalog/models/index.d.ts +0 -5
- package/domain/catalog/models/kit-product.d.ts +4 -4
- package/domain/catalog/models/product.d.ts +35 -5
- package/domain/catalog/models/types/category-filter.type.d.ts +4 -0
- package/domain/catalog/models/types/index.d.ts +1 -2
- package/domain/catalog/models/types/shop-description.type.d.ts +0 -1
- package/domain/catalog/models/variant.d.ts +2 -1
- package/domain/catalog/repositories/category.repository.d.ts +3 -6
- package/domain/catalog/repositories/index.d.ts +0 -5
- package/domain/catalog/repositories/product.repository.d.ts +1 -4
- package/domain/generic/model/base.model.d.ts +5 -9
- package/domain/generic/model/types/base-model-builder.type.d.ts +2 -4
- package/domain/generic/model/types/identifier-model.type.d.ts +5 -6
- package/domain/generic/model/types/model-base-structure.type.d.ts +3 -9
- package/domain/generic/model/types/non-function-property-name.type.d.ts +3 -12
- package/domain/generic/repository/create.repository.d.ts +2 -2
- package/domain/generic/repository/find.repository.d.ts +1 -7
- package/domain/generic/repository/get.repository.d.ts +2 -2
- package/domain/generic/repository/types/repository-find-filters.type.d.ts +3 -3
- package/domain/generic/repository/types/repository-find-result.type.d.ts +1 -11
- package/domain/generic/repository/types/repository-order-by-list.type.d.ts +2 -2
- package/domain/generic/repository/types/repository-update-params.type.d.ts +2 -2
- package/domain/location/models/address.d.ts +3 -5
- package/domain/shop-settings/models/index.d.ts +0 -1
- package/domain/shop-settings/models/types/index.d.ts +1 -6
- package/domain/shop-settings/repositories/index.d.ts +0 -1
- package/domain/shopping/models/buy-2-win.d.ts +1 -3
- package/domain/shopping/models/checkout.d.ts +6 -5
- package/domain/shopping/models/coupons/coupon.d.ts +6 -34
- package/domain/shopping/models/index.d.ts +4 -5
- package/domain/shopping/models/order.d.ts +0 -1
- package/domain/shopping/models/shipping-method.d.ts +0 -1
- package/domain/shopping/models/subscription/checkout.d.ts +4 -3
- package/domain/shopping/repositories/index.d.ts +2 -4
- package/domain/users/errors/unauthorized.error.d.ts +1 -2
- package/domain/users/errors/user-already-registered.error.d.ts +1 -2
- package/domain/users/errors/weak-password.error.d.ts +0 -1
- package/domain/users/models/lead.d.ts +0 -1
- package/domain/users/models/subscription/subscription.d.ts +3 -3
- package/domain/users/models/user-address.d.ts +1 -1
- package/domain/users/models/user.d.ts +4 -3
- package/domain/users/use-cases/authentication.d.ts +1 -1
- package/errors/duplicated-results.error.d.ts +1 -2
- package/errors/invalid-argument.error.d.ts +1 -2
- package/errors/not-found.error.d.ts +1 -2
- package/{esm2015/domain/catalog/index.js → esm2020/domain/catalog/index.mjs} +1 -2
- package/esm2020/domain/catalog/models/category.mjs +10 -0
- package/esm2020/domain/catalog/models/index.mjs +7 -0
- package/esm2020/domain/catalog/models/kit-product.mjs +18 -0
- package/esm2020/domain/catalog/models/product.mjs +17 -0
- package/esm2020/domain/catalog/models/types/category-filter.type.mjs +2 -0
- package/esm2020/domain/catalog/models/types/index.mjs +11 -0
- package/{esm2015/domain/catalog/models/types/shop-description.type.js → esm2020/domain/catalog/models/types/shop-description.type.mjs} +1 -1
- package/esm2020/domain/catalog/models/variant.mjs +10 -0
- package/esm2020/domain/catalog/repositories/category.repository.mjs +2 -0
- package/esm2020/domain/catalog/repositories/index.mjs +5 -0
- package/esm2020/domain/catalog/repositories/product.repository.mjs +2 -0
- package/esm2020/domain/generic/model/base.model.mjs +23 -0
- package/esm2020/domain/generic/model/types/base-model-builder.type.mjs +2 -0
- package/esm2020/domain/generic/model/types/identifier-model.type.mjs +2 -0
- package/esm2020/domain/generic/model/types/model-base-structure.type.mjs +2 -0
- package/esm2020/domain/generic/model/types/non-function-property-name.type.mjs +2 -0
- package/esm2020/domain/generic/repository/create.repository.mjs +2 -0
- package/esm2020/domain/generic/repository/find.repository.mjs +2 -0
- package/esm2020/domain/generic/repository/get.repository.mjs +2 -0
- package/esm2020/domain/generic/repository/types/repository-find-filters.type.mjs +2 -0
- package/esm2020/domain/generic/repository/types/repository-find-result.type.mjs +2 -0
- package/{esm2015/domain/generic/repository/types/repository-order-by-list.type.js → esm2020/domain/generic/repository/types/repository-order-by-list.type.mjs} +1 -1
- package/esm2020/domain/generic/repository/types/repository-update-params.type.mjs +2 -0
- package/esm2020/domain/location/models/address.mjs +7 -0
- package/{esm2015/domain/shop-settings/helpers/beauty-questions.helper.js → esm2020/domain/shop-settings/helpers/beauty-questions.helper.mjs} +3 -2
- package/{esm2015/domain/shop-settings/models/index.js → esm2020/domain/shop-settings/models/index.mjs} +1 -2
- package/esm2020/domain/shop-settings/models/types/index.mjs +6 -0
- package/{esm2015/domain/shop-settings/repositories/index.js → esm2020/domain/shop-settings/repositories/index.mjs} +1 -2
- package/esm2020/domain/shopping/models/buy-2-win.mjs +14 -0
- package/esm2020/domain/shopping/models/checkout.mjs +38 -0
- package/esm2020/domain/shopping/models/coupons/coupon.mjs +38 -0
- package/esm2020/domain/shopping/models/index.mjs +12 -0
- package/{esm2015/domain/shopping/models/order.js → esm2020/domain/shopping/models/order.mjs} +1 -1
- package/{esm2015/domain/shopping/models/payment.js → esm2020/domain/shopping/models/payment.mjs} +1 -1
- package/{esm2015/domain/shopping/models/shipping-method.js → esm2020/domain/shopping/models/shipping-method.mjs} +1 -1
- package/esm2020/domain/shopping/models/subscription/checkout.mjs +28 -0
- package/esm2020/domain/shopping/repositories/index.mjs +8 -0
- package/{esm2015/domain/users/errors/unauthorized.error.js → esm2020/domain/users/errors/unauthorized.error.mjs} +1 -2
- package/{esm2015/domain/users/errors/user-already-registered.error.js → esm2020/domain/users/errors/user-already-registered.error.mjs} +1 -2
- package/{esm2015/domain/users/errors/weak-password.error.js → esm2020/domain/users/errors/weak-password.error.mjs} +1 -2
- package/esm2020/domain/users/models/beauty-profile.mjs +12 -0
- package/{esm2015/domain/users/models/lead.js → esm2020/domain/users/models/lead.mjs} +1 -1
- package/{esm2015/domain/users/models/subscription/payment.js → esm2020/domain/users/models/subscription/payment.mjs} +1 -1
- package/esm2020/domain/users/models/subscription/subscription.mjs +43 -0
- package/{esm2015/domain/users/models/user-address.js → esm2020/domain/users/models/user-address.mjs} +1 -1
- package/esm2020/domain/users/models/user.mjs +26 -0
- package/esm2020/domain/users/use-cases/authentication.mjs +43 -0
- package/esm2020/domain/users/use-cases/recovery-password.mjs +9 -0
- package/esm2020/domain/users/use-cases/register.mjs +38 -0
- package/esm2020/domain/users/use-cases/signout.mjs +9 -0
- package/{esm2015/errors/duplicated-results.error.js → esm2020/errors/duplicated-results.error.mjs} +1 -2
- package/{esm2015/errors/invalid-argument.error.js → esm2020/errors/invalid-argument.error.mjs} +1 -2
- package/{esm2015/errors/not-found.error.js → esm2020/errors/not-found.error.mjs} +1 -2
- package/esm2020/infra/elasticsearch/adapters/axios.adapter.mjs +50 -0
- package/{esm2015/infra/elasticsearch/adapters/elastic-search.adapter.js → esm2020/infra/elasticsearch/adapters/elastic-search.adapter.mjs} +1 -1
- package/esm2020/infra/elasticsearch/indexes/products-index.mjs +92 -0
- package/{esm2015/infra/elasticsearch/types/elastic-search-result.js → esm2020/infra/elasticsearch/types/elastic-search-result.mjs} +1 -1
- package/esm2020/infra/firebase/auth/authentication-firebase-auth.service.mjs +41 -0
- package/esm2020/infra/firebase/auth/register-firebase-auth.service.mjs +33 -0
- package/{esm2015/infra/firebase/auth/types/firebase-user-with-id.type.js → esm2020/infra/firebase/auth/types/firebase-user-with-id.type.mjs} +1 -1
- package/esm2020/infra/firebase/firestore/mixins/with-create-firestore.mixin.mjs +27 -0
- package/esm2020/infra/firebase/firestore/mixins/with-crud-firestore.mixin.mjs +10 -0
- package/esm2020/infra/firebase/firestore/mixins/with-delete-firestore.mixin.mjs +14 -0
- package/esm2020/infra/firebase/firestore/mixins/with-find-firestore.mixin.mjs +107 -0
- package/esm2020/infra/firebase/firestore/mixins/with-firestore.mixin.mjs +57 -0
- package/esm2020/infra/firebase/firestore/mixins/with-get-firestore.mixin.mjs +20 -0
- package/esm2020/infra/firebase/firestore/mixins/with-helpers.mixin.mjs +17 -0
- package/esm2020/infra/firebase/firestore/mixins/with-sub-collection.mixin.mjs +11 -0
- package/esm2020/infra/firebase/firestore/mixins/with-update-firestore.mixin.mjs +48 -0
- package/esm2020/infra/firebase/firestore/repositories/catalog/category-firestore.repository.mjs +54 -0
- package/esm2020/infra/firebase/firestore/repositories/catalog/product-firestore.repository.mjs +46 -0
- package/esm2020/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.mjs +14 -0
- package/esm2020/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.mjs +12 -0
- package/esm2020/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.mjs +54 -0
- package/{esm2015/infra/firebase/firestore/repositories/shop-settings/index.js → esm2020/infra/firebase/firestore/repositories/shop-settings/index.mjs} +1 -2
- package/{esm2015/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.mjs} +1 -1
- package/{esm2015/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.mjs} +2 -2
- package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.mjs +12 -0
- package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.mjs +12 -0
- package/{esm2015/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.mjs} +2 -2
- package/esm2020/infra/firebase/firestore/repositories/shopping/index.mjs +9 -0
- package/esm2020/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.mjs +9 -0
- package/esm2020/infra/firebase/firestore/repositories/shopping/order-firestore.repository.mjs +38 -0
- package/esm2020/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.mjs +12 -0
- package/{esm2015/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.mjs} +2 -2
- package/esm2020/infra/firebase/firestore/repositories/users/lead-firestore.repository.mjs +12 -0
- package/esm2020/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.mjs +14 -0
- package/{esm2015/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/users/subscription-firestore.repository.mjs} +2 -2
- package/esm2020/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.mjs +14 -0
- package/esm2020/infra/firebase/firestore/repositories/users/user-address-firestore.repository.mjs +14 -0
- package/esm2020/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.mjs +14 -0
- package/esm2020/infra/firebase/firestore/repositories/users/user-firestore.repository.mjs +48 -0
- package/esm2020/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.mjs +14 -0
- package/esm2020/infra/firebase/firestore/types/firestore-sub.repository.type.mjs +2 -0
- package/esm2020/infra/firebase/firestore/types/firestore.helpers.type.mjs +2 -0
- package/esm2020/infra/firebase/firestore/types/firestore.repository.type.mjs +2 -0
- package/{esm2015/infra/hasura-graphql/enums/hasura-graphql-where.enum.js → esm2020/infra/hasura-graphql/enums/hasura-graphql-where.enum.mjs} +3 -1
- package/esm2020/infra/hasura-graphql/mixins/helpers/attribute-option.helper.mjs +35 -0
- package/esm2020/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.mjs +70 -0
- package/esm2020/infra/hasura-graphql/mixins/helpers/filter-option.helper.mjs +22 -0
- package/esm2020/infra/hasura-graphql/mixins/helpers/graphql-field.helper.mjs +114 -0
- package/esm2020/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.mjs +37 -0
- package/{esm2015/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.js → esm2020/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.mjs} +1 -1
- package/esm2020/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.mjs +29 -0
- package/esm2020/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.mjs +46 -0
- package/esm2020/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.mjs +35 -0
- package/esm2020/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.mjs +92 -0
- package/esm2020/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.mjs +60 -0
- package/{esm2015/infra/hasura-graphql/models/kit-product-hasura-graphql.js → esm2020/infra/hasura-graphql/models/kit-product-hasura-graphql.mjs} +1 -1
- package/esm2020/infra/hasura-graphql/models/product-hasura-graphql.mjs +11 -0
- package/{esm2015/infra/hasura-graphql/models/variant-hasura-graphql.js → esm2020/infra/hasura-graphql/models/variant-hasura-graphql.mjs} +1 -1
- package/esm2020/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.mjs +222 -0
- package/esm2020/infra/hasura-graphql/repositories/catalog/index.mjs +4 -0
- package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +466 -0
- package/esm2020/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.mjs +112 -0
- package/esm2020/infra/hasura-graphql/types/graphql.repository.type.mjs +2 -0
- package/esm2020/infra/hasura-graphql/types/hasura-graphql-fields.type.mjs +2 -0
- package/esm2020/utils/index.mjs +10 -0
- package/esm2020/utils/is.mjs +4 -0
- package/{esm2015/utils/mixins/merge-constructor-params.type.js → esm2020/utils/mixins/merge-constructor-params.type.mjs} +1 -1
- package/fesm2015/{infrab4a-connect.js → infrab4a-connect.mjs} +445 -1894
- package/fesm2015/infrab4a-connect.mjs.map +1 -0
- package/fesm2020/infrab4a-connect.mjs +3313 -0
- package/fesm2020/infrab4a-connect.mjs.map +1 -0
- package/infra/elasticsearch/adapters/axios.adapter.d.ts +5 -7
- package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +2 -3
- package/infra/elasticsearch/indexes/products-index.d.ts +10 -8
- package/infra/elasticsearch/types/elastic-search-result.d.ts +0 -2
- package/infra/firebase/auth/authentication-firebase-auth.service.d.ts +2 -2
- package/infra/firebase/auth/register-firebase-auth.service.d.ts +2 -2
- package/infra/firebase/auth/types/firebase-user-with-id.type.d.ts +3 -1
- package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +2 -2
- package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +2 -2
- package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +2 -2
- package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +3 -3
- package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +1 -1
- package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +2 -2
- package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +3 -3
- package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +4 -4
- package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +3 -3
- package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +5 -9
- package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +5 -7
- package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/shop-settings/index.d.ts +0 -1
- package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/shopping/index.d.ts +3 -5
- package/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +3 -3
- package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +5 -5
- package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +5 -5
- package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +4 -4
- package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +3 -3
- package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +5 -5
- package/infra/firebase/firestore/types/firestore.repository.type.d.ts +3 -3
- package/infra/hasura-graphql/enums/hasura-graphql-where.enum.d.ts +3 -1
- package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +3 -5
- package/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.d.ts +5 -5
- package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +2 -4
- package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +5 -6
- package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +1 -2
- package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +2 -2
- package/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +1 -1
- package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +15 -24
- package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +6 -7
- package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +2 -2
- package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +3 -3
- package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +0 -4
- package/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +0 -1
- package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +2 -9
- package/infra/hasura-graphql/repositories/catalog/index.d.ts +0 -5
- package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +1 -3
- package/infra/hasura-graphql/types/graphql.repository.type.d.ts +6 -9
- package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +3 -7
- package/package.json +21 -9
- package/utils/index.d.ts +46 -6
- package/utils/is.d.ts +1 -0
- package/utils/mixins/merge-constructor-params.type.d.ts +2 -2
- package/bundles/infrab4a-connect.umd.js +0 -7159
- package/bundles/infrab4a-connect.umd.js.map +0 -1
- package/domain/catalog/helpers/index.d.ts +0 -1
- package/domain/catalog/helpers/round-product-price.helper.d.ts +0 -4
- package/domain/catalog/models/category-base.d.ts +0 -30
- package/domain/catalog/models/category-collection-children.d.ts +0 -13
- package/domain/catalog/models/category-filter.d.ts +0 -13
- package/domain/catalog/models/category-for-product.d.ts +0 -5
- package/domain/catalog/models/filter-option.d.ts +0 -9
- package/domain/catalog/models/filter.d.ts +0 -12
- package/domain/catalog/models/product-base.d.ts +0 -40
- package/domain/catalog/models/product-for-category.d.ts +0 -7
- package/domain/catalog/models/product-for-kit.d.ts +0 -7
- package/domain/catalog/models/types/category-product.d.ts +0 -4
- package/domain/catalog/models/types/product-evaluation.type.d.ts +0 -6
- package/domain/catalog/models/wishlist.d.ts +0 -6
- package/domain/catalog/repositories/category-collection-children.repository.d.ts +0 -4
- package/domain/catalog/repositories/category-filter.repository.d.ts +0 -6
- package/domain/catalog/repositories/filter-option.repository.d.ts +0 -4
- package/domain/catalog/repositories/filter.repository.d.ts +0 -4
- package/domain/catalog/repositories/wishlist.repository.d.ts +0 -6
- package/domain/shop-settings/models/shop-settings.d.ts +0 -9
- package/domain/shop-settings/models/types/shop-banner.type.d.ts +0 -12
- package/domain/shop-settings/models/types/shop-brands.type.d.ts +0 -10
- package/domain/shop-settings/models/types/shop-carousel.type.d.ts +0 -5
- package/domain/shop-settings/models/types/shop-collection.type.d.ts +0 -9
- package/domain/shop-settings/models/types/shop-section.type.d.ts +0 -9
- package/domain/shop-settings/repositories/shop-settings.repository.d.ts +0 -4
- package/domain/shopping/models/campaign-dashboard.d.ts +0 -15
- package/domain/shopping/models/campaign-hashtag.d.ts +0 -18
- package/domain/shopping/repositories/campaign-dashboard.repository.d.ts +0 -4
- package/domain/shopping/repositories/campaign-hashtag.repository.d.ts +0 -4
- package/esm2015/domain/catalog/helpers/index.js +0 -2
- package/esm2015/domain/catalog/helpers/round-product-price.helper.js +0 -15
- package/esm2015/domain/catalog/models/category-base.js +0 -18
- package/esm2015/domain/catalog/models/category-collection-children.js +0 -13
- package/esm2015/domain/catalog/models/category-filter.js +0 -19
- package/esm2015/domain/catalog/models/category-for-product.js +0 -7
- package/esm2015/domain/catalog/models/category.js +0 -14
- package/esm2015/domain/catalog/models/filter-option.js +0 -7
- package/esm2015/domain/catalog/models/filter.js +0 -7
- package/esm2015/domain/catalog/models/index.js +0 -12
- package/esm2015/domain/catalog/models/kit-product.js +0 -18
- package/esm2015/domain/catalog/models/product-base.js +0 -25
- package/esm2015/domain/catalog/models/product-for-category.js +0 -14
- package/esm2015/domain/catalog/models/product-for-kit.js +0 -14
- package/esm2015/domain/catalog/models/product.js +0 -19
- package/esm2015/domain/catalog/models/types/category-product.js +0 -2
- package/esm2015/domain/catalog/models/types/index.js +0 -12
- package/esm2015/domain/catalog/models/types/product-evaluation.type.js +0 -2
- package/esm2015/domain/catalog/models/variant.js +0 -7
- package/esm2015/domain/catalog/models/wishlist.js +0 -7
- package/esm2015/domain/catalog/repositories/category-collection-children.repository.js +0 -2
- package/esm2015/domain/catalog/repositories/category-filter.repository.js +0 -2
- package/esm2015/domain/catalog/repositories/category.repository.js +0 -2
- package/esm2015/domain/catalog/repositories/filter-option.repository.js +0 -2
- package/esm2015/domain/catalog/repositories/filter.repository.js +0 -2
- package/esm2015/domain/catalog/repositories/index.js +0 -10
- package/esm2015/domain/catalog/repositories/product.repository.js +0 -2
- package/esm2015/domain/catalog/repositories/wishlist.repository.js +0 -2
- package/esm2015/domain/generic/model/base.model.js +0 -24
- package/esm2015/domain/generic/model/types/base-model-builder.type.js +0 -2
- package/esm2015/domain/generic/model/types/identifier-model.type.js +0 -2
- package/esm2015/domain/generic/model/types/model-base-structure.type.js +0 -2
- package/esm2015/domain/generic/model/types/non-function-property-name.type.js +0 -2
- package/esm2015/domain/generic/repository/create.repository.js +0 -2
- package/esm2015/domain/generic/repository/find.repository.js +0 -2
- package/esm2015/domain/generic/repository/get.repository.js +0 -2
- package/esm2015/domain/generic/repository/types/repository-find-filters.type.js +0 -2
- package/esm2015/domain/generic/repository/types/repository-find-result.type.js +0 -2
- package/esm2015/domain/generic/repository/types/repository-update-params.type.js +0 -2
- package/esm2015/domain/location/models/address.js +0 -7
- package/esm2015/domain/shop-settings/models/shop-settings.js +0 -7
- package/esm2015/domain/shop-settings/models/types/index.js +0 -11
- package/esm2015/domain/shop-settings/models/types/shop-banner.type.js +0 -2
- package/esm2015/domain/shop-settings/models/types/shop-brands.type.js +0 -2
- package/esm2015/domain/shop-settings/models/types/shop-carousel.type.js +0 -2
- package/esm2015/domain/shop-settings/models/types/shop-collection.type.js +0 -2
- package/esm2015/domain/shop-settings/models/types/shop-section.type.js +0 -2
- package/esm2015/domain/shop-settings/repositories/shop-settings.repository.js +0 -2
- package/esm2015/domain/shopping/models/buy-2-win.js +0 -14
- package/esm2015/domain/shopping/models/campaign-dashboard.js +0 -7
- package/esm2015/domain/shopping/models/campaign-hashtag.js +0 -7
- package/esm2015/domain/shopping/models/checkout.js +0 -37
- package/esm2015/domain/shopping/models/coupons/coupon.js +0 -38
- package/esm2015/domain/shopping/models/index.js +0 -13
- package/esm2015/domain/shopping/models/subscription/checkout.js +0 -28
- package/esm2015/domain/shopping/repositories/campaign-dashboard.repository.js +0 -2
- package/esm2015/domain/shopping/repositories/campaign-hashtag.repository.js +0 -2
- package/esm2015/domain/shopping/repositories/index.js +0 -10
- package/esm2015/domain/users/models/beauty-profile.js +0 -12
- package/esm2015/domain/users/models/subscription/subscription.js +0 -43
- package/esm2015/domain/users/models/user.js +0 -26
- package/esm2015/domain/users/use-cases/authentication.js +0 -40
- package/esm2015/domain/users/use-cases/recovery-password.js +0 -12
- package/esm2015/domain/users/use-cases/register.js +0 -34
- package/esm2015/domain/users/use-cases/signout.js +0 -12
- package/esm2015/infra/elasticsearch/adapters/axios.adapter.js +0 -76
- package/esm2015/infra/elasticsearch/indexes/products-index.js +0 -115
- package/esm2015/infra/firebase/auth/authentication-firebase-auth.service.js +0 -52
- package/esm2015/infra/firebase/auth/register-firebase-auth.service.js +0 -26
- package/esm2015/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +0 -31
- package/esm2015/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +0 -10
- package/esm2015/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +0 -18
- package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +0 -98
- package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +0 -64
- package/esm2015/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +0 -24
- package/esm2015/infra/firebase/firestore/mixins/with-helpers.mixin.js +0 -17
- package/esm2015/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +0 -11
- package/esm2015/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +0 -45
- package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +0 -82
- package/esm2015/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +0 -58
- package/esm2015/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +0 -56
- package/esm2015/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/index.js +0 -11
- package/esm2015/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.js +0 -9
- package/esm2015/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +0 -40
- package/esm2015/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/users/lead-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/users/user-firestore.repository.js +0 -68
- package/esm2015/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/types/firestore-sub.repository.type.js +0 -2
- package/esm2015/infra/firebase/firestore/types/firestore.helpers.type.js +0 -2
- package/esm2015/infra/firebase/firestore/types/firestore.repository.type.js +0 -2
- package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +0 -31
- package/esm2015/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.js +0 -58
- package/esm2015/infra/hasura-graphql/mixins/helpers/filter-option.helper.js +0 -22
- package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +0 -95
- package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +0 -61
- package/esm2015/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.js +0 -31
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +0 -139
- package/esm2015/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.js +0 -37
- package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +0 -97
- package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +0 -58
- package/esm2015/infra/hasura-graphql/models/product-hasura-graphql.js +0 -11
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.js +0 -38
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.js +0 -106
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +0 -363
- package/esm2015/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.js +0 -123
- package/esm2015/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.js +0 -21
- package/esm2015/infra/hasura-graphql/repositories/catalog/index.js +0 -9
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +0 -506
- package/esm2015/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.js +0 -117
- package/esm2015/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.js +0 -252
- package/esm2015/infra/hasura-graphql/types/graphql.repository.type.js +0 -2
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +0 -2
- package/esm2015/utils/decorators/debug.class.decorator.js +0 -7
- package/esm2015/utils/decorators/index.js +0 -3
- package/esm2015/utils/decorators/trace.method.decorator.js +0 -81
- package/esm2015/utils/helpers/class-name.helper.js +0 -15
- package/esm2015/utils/helpers/debug-decorator.helper.js +0 -18
- package/esm2015/utils/helpers/debug.helper.js +0 -150
- package/esm2015/utils/helpers/index.js +0 -5
- package/esm2015/utils/helpers/reflect.helper.js +0 -165
- package/esm2015/utils/index.js +0 -11
- package/esm2015/utils/log.utils.js +0 -9
- package/fesm2015/infrab4a-connect.js.map +0 -1
- package/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +0 -9
- package/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +0 -9
- package/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.d.ts +0 -10
- package/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +0 -12
- package/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +0 -18
- package/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +0 -10
- package/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +0 -27
- package/infrab4a-connect.d.ts +0 -5
- package/utils/decorators/debug.class.decorator.d.ts +0 -2
- package/utils/decorators/index.d.ts +0 -2
- package/utils/decorators/trace.method.decorator.d.ts +0 -14
- package/utils/helpers/class-name.helper.d.ts +0 -3
- package/utils/helpers/debug-decorator.helper.d.ts +0 -9
- package/utils/helpers/debug.helper.d.ts +0 -60
- package/utils/helpers/index.d.ts +0 -4
- package/utils/helpers/reflect.helper.d.ts +0 -50
- package/utils/log.utils.d.ts +0 -7
- /package/{esm2015/domain/catalog/models/enums/index.js → esm2020/domain/catalog/models/enums/index.mjs} +0 -0
- /package/{esm2015/domain/catalog/models/enums/product-genders.enum.js → esm2020/domain/catalog/models/enums/product-genders.enum.mjs} +0 -0
- /package/{esm2015/domain/catalog/models/enums/shops.enum.js → esm2020/domain/catalog/models/enums/shops.enum.mjs} +0 -0
- /package/{esm2015/domain/catalog/models/types/category-condition.type.js → esm2020/domain/catalog/models/types/category-condition.type.mjs} +0 -0
- /package/{esm2015/domain/catalog/models/types/category-metadata.type.js → esm2020/domain/catalog/models/types/category-metadata.type.mjs} +0 -0
- /package/{esm2015/domain/catalog/models/types/product-gender.type.js → esm2020/domain/catalog/models/types/product-gender.type.mjs} +0 -0
- /package/{esm2015/domain/catalog/models/types/product-metadata.type.js → esm2020/domain/catalog/models/types/product-metadata.type.mjs} +0 -0
- /package/{esm2015/domain/catalog/models/types/product-review.type.js → esm2020/domain/catalog/models/types/product-review.type.mjs} +0 -0
- /package/{esm2015/domain/catalog/models/types/shop-price.type.js → esm2020/domain/catalog/models/types/shop-price.type.mjs} +0 -0
- /package/{esm2015/domain/catalog/models/types/stock.type.js → esm2020/domain/catalog/models/types/stock.type.mjs} +0 -0
- /package/{esm2015/domain/catalog/models/types/variant-grade.type.js → esm2020/domain/catalog/models/types/variant-grade.type.mjs} +0 -0
- /package/{esm2015/domain/catalog/repositories/subscription-product.repository.js → esm2020/domain/catalog/repositories/subscription-product.repository.mjs} +0 -0
- /package/{esm2015/domain/catalog/repositories/variant.repository.js → esm2020/domain/catalog/repositories/variant.repository.mjs} +0 -0
- /package/{esm2015/domain/generic/index.js → esm2020/domain/generic/index.mjs} +0 -0
- /package/{esm2015/domain/generic/model/identifier-fields.js → esm2020/domain/generic/model/identifier-fields.mjs} +0 -0
- /package/{esm2015/domain/generic/model/index.js → esm2020/domain/generic/model/index.mjs} +0 -0
- /package/{esm2015/domain/generic/model/types/index.js → esm2020/domain/generic/model/types/index.mjs} +0 -0
- /package/{esm2015/domain/generic/model/types/non-function-properties.type.js → esm2020/domain/generic/model/types/non-function-properties.type.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/crud.repository.js → esm2020/domain/generic/repository/crud.repository.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/delete.repository.js → esm2020/domain/generic/repository/delete.repository.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/enums/index.js → esm2020/domain/generic/repository/enums/index.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/enums/update-option-actions.enum.js → esm2020/domain/generic/repository/enums/update-option-actions.enum.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/enums/where.enum.js → esm2020/domain/generic/repository/enums/where.enum.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/index.js → esm2020/domain/generic/repository/index.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/read.repository.js → esm2020/domain/generic/repository/read.repository.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/types/index.js → esm2020/domain/generic/repository/types/index.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/types/repository-limit-options.type.js → esm2020/domain/generic/repository/types/repository-limit-options.type.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/types/where-options.type.js → esm2020/domain/generic/repository/types/where-options.type.mjs} +0 -0
- /package/{esm2015/domain/generic/repository/update.repository.js → esm2020/domain/generic/repository/update.repository.mjs} +0 -0
- /package/{esm2015/domain/index.js → esm2020/domain/index.mjs} +0 -0
- /package/{esm2015/domain/location/index.js → esm2020/domain/location/index.mjs} +0 -0
- /package/{esm2015/domain/location/models/index.js → esm2020/domain/location/models/index.mjs} +0 -0
- /package/{esm2015/domain/location/models/types/index.js → esm2020/domain/location/models/types/index.mjs} +0 -0
- /package/{esm2015/domain/location/models/types/location-bound.type.js → esm2020/domain/location/models/types/location-bound.type.mjs} +0 -0
- /package/{esm2015/domain/location/models/types/location-geometry.type.js → esm2020/domain/location/models/types/location-geometry.type.mjs} +0 -0
- /package/{esm2015/domain/location/models/types/location-lat-lng.type.js → esm2020/domain/location/models/types/location-lat-lng.type.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/enums/filter-type.enum.js → esm2020/domain/shop-settings/enums/filter-type.enum.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/enums/index.js → esm2020/domain/shop-settings/enums/index.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/enums/questions-filters.enum.js → esm2020/domain/shop-settings/enums/questions-filters.enum.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/helpers/index.js → esm2020/domain/shop-settings/helpers/index.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/index.js → esm2020/domain/shop-settings/index.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/models/home.js → esm2020/domain/shop-settings/models/home.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/models/shop-menu.js → esm2020/domain/shop-settings/models/shop-menu.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/models/types/banner.type.js → esm2020/domain/shop-settings/models/types/banner.type.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/models/types/benefit.type.js → esm2020/domain/shop-settings/models/types/benefit.type.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/models/types/home-data.type.js → esm2020/domain/shop-settings/models/types/home-data.type.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/models/types/menu-nav.type.js → esm2020/domain/shop-settings/models/types/menu-nav.type.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/models/types/sub-menu.type.js → esm2020/domain/shop-settings/models/types/sub-menu.type.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/repositories/home.repository.js → esm2020/domain/shop-settings/repositories/home.repository.mjs} +0 -0
- /package/{esm2015/domain/shop-settings/repositories/shop-menu.repository.js → esm2020/domain/shop-settings/repositories/shop-menu.repository.mjs} +0 -0
- /package/{esm2015/domain/shopping/index.js → esm2020/domain/shopping/index.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/coupons/enums/coupon-club-mens.enum.js → esm2020/domain/shopping/models/coupons/enums/coupon-club-mens.enum.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js → esm2020/domain/shopping/models/coupons/enums/coupon-subtypes.enum.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/coupons/enums/coupon-types.enum.js → esm2020/domain/shopping/models/coupons/enums/coupon-types.enum.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/coupons/enums/exclusivities.enum.js → esm2020/domain/shopping/models/coupons/enums/exclusivities.enum.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/coupons/enums/index.js → esm2020/domain/shopping/models/coupons/enums/index.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/coupons/index.js → esm2020/domain/shopping/models/coupons/index.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/enums/checkout-types.enum.js → esm2020/domain/shopping/models/enums/checkout-types.enum.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/enums/index.js → esm2020/domain/shopping/models/enums/index.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/enums/order-status.enum.js → esm2020/domain/shopping/models/enums/order-status.enum.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/line-item.js → esm2020/domain/shopping/models/line-item.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/subscription/index.js → esm2020/domain/shopping/models/subscription/index.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/subscription/plan.js → esm2020/domain/shopping/models/subscription/plan.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/types/index.js → esm2020/domain/shopping/models/types/index.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/types/payment-address.type.js → esm2020/domain/shopping/models/types/payment-address.type.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/types/payment-billing.type.js → esm2020/domain/shopping/models/types/payment-billing.type.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/types/payment-card.type.js → esm2020/domain/shopping/models/types/payment-card.type.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/types/payment-customer.type.js → esm2020/domain/shopping/models/types/payment-customer.type.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/types/payment-document.type.js → esm2020/domain/shopping/models/types/payment-document.type.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/types/payment-item.type.js → esm2020/domain/shopping/models/types/payment-item.type.mjs} +0 -0
- /package/{esm2015/domain/shopping/models/types/payment-shipping.type.js → esm2020/domain/shopping/models/types/payment-shipping.type.mjs} +0 -0
- /package/{esm2015/domain/shopping/repositories/buy-2-win.repository.js → esm2020/domain/shopping/repositories/buy-2-win.repository.mjs} +0 -0
- /package/{esm2015/domain/shopping/repositories/checkout.repository.js → esm2020/domain/shopping/repositories/checkout.repository.mjs} +0 -0
- /package/{esm2015/domain/shopping/repositories/coupon.repository.js → esm2020/domain/shopping/repositories/coupon.repository.mjs} +0 -0
- /package/{esm2015/domain/shopping/repositories/legacy-order.repository.js → esm2020/domain/shopping/repositories/legacy-order.repository.mjs} +0 -0
- /package/{esm2015/domain/shopping/repositories/order.repository.js → esm2020/domain/shopping/repositories/order.repository.mjs} +0 -0
- /package/{esm2015/domain/shopping/repositories/payment.repository.js → esm2020/domain/shopping/repositories/payment.repository.mjs} +0 -0
- /package/{esm2015/domain/shopping/repositories/subscription/checkout.repository.js → esm2020/domain/shopping/repositories/subscription/checkout.repository.mjs} +0 -0
- /package/{esm2015/domain/shopping/repositories/subscription/index.js → esm2020/domain/shopping/repositories/subscription/index.mjs} +0 -0
- /package/{esm2015/domain/shopping/repositories/subscription/plan.repository.js → esm2020/domain/shopping/repositories/subscription/plan.repository.mjs} +0 -0
- /package/{esm2015/domain/users/errors/index.js → esm2020/domain/users/errors/index.mjs} +0 -0
- /package/{esm2015/domain/users/index.js → esm2020/domain/users/index.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/accessory-importances.enum.js → esm2020/domain/users/models/enums/accessory-importances.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/area.enum.js → esm2020/domain/users/models/enums/area.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/beard-problems.enum.js → esm2020/domain/users/models/enums/beard-problems.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/beard-sizes.enum.js → esm2020/domain/users/models/enums/beard-sizes.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/beauty-product-importances.enum.js → esm2020/domain/users/models/enums/beauty-product-importances.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/body-problems.enum.js → esm2020/domain/users/models/enums/body-problems.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/body-shapes.enum.js → esm2020/domain/users/models/enums/body-shapes.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/body-tattoos.enum.js → esm2020/domain/users/models/enums/body-tattoos.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/face-skin-oilinesses.enum.js → esm2020/domain/users/models/enums/face-skin-oilinesses.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/face-skin-problems.enum.js → esm2020/domain/users/models/enums/face-skin-problems.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/face-skin-tones.enum.js → esm2020/domain/users/models/enums/face-skin-tones.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/family-incomes.enum.js → esm2020/domain/users/models/enums/family-incomes.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/fragrance-importances.enum.js → esm2020/domain/users/models/enums/fragrance-importances.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/hair-colors.enum.js → esm2020/domain/users/models/enums/hair-colors.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/hair-problems.enum.js → esm2020/domain/users/models/enums/hair-problems.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/hair-strands.enum.js → esm2020/domain/users/models/enums/hair-strands.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/hair-types.enum.js → esm2020/domain/users/models/enums/hair-types.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/index.js → esm2020/domain/users/models/enums/index.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/office-position.enum.js → esm2020/domain/users/models/enums/office-position.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/product-spents.enum.js → esm2020/domain/users/models/enums/product-spents.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/enums/user-type.enum.js → esm2020/domain/users/models/enums/user-type.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/index.js → esm2020/domain/users/models/index.mjs} +0 -0
- /package/{esm2015/domain/users/models/subscription/edition.js → esm2020/domain/users/models/subscription/edition.mjs} +0 -0
- /package/{esm2015/domain/users/models/subscription/enums/billing-status.enum.js → esm2020/domain/users/models/subscription/enums/billing-status.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/subscription/enums/edition-status.enum.js → esm2020/domain/users/models/subscription/enums/edition-status.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/subscription/enums/index.js → esm2020/domain/users/models/subscription/enums/index.mjs} +0 -0
- /package/{esm2015/domain/users/models/subscription/enums/payment-type.enum.js → esm2020/domain/users/models/subscription/enums/payment-type.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/subscription/enums/status.enum.js → esm2020/domain/users/models/subscription/enums/status.enum.mjs} +0 -0
- /package/{esm2015/domain/users/models/subscription/index.js → esm2020/domain/users/models/subscription/index.mjs} +0 -0
- /package/{esm2015/domain/users/models/user-payment-method.js → esm2020/domain/users/models/user-payment-method.mjs} +0 -0
- /package/{esm2015/domain/users/repositories/beauty-profile.repository.js → esm2020/domain/users/repositories/beauty-profile.repository.mjs} +0 -0
- /package/{esm2015/domain/users/repositories/edition.repository.js → esm2020/domain/users/repositories/edition.repository.mjs} +0 -0
- /package/{esm2015/domain/users/repositories/index.js → esm2020/domain/users/repositories/index.mjs} +0 -0
- /package/{esm2015/domain/users/repositories/lead.repository.js → esm2020/domain/users/repositories/lead.repository.mjs} +0 -0
- /package/{esm2015/domain/users/repositories/subscription-payment.repository.js → esm2020/domain/users/repositories/subscription-payment.repository.mjs} +0 -0
- /package/{esm2015/domain/users/repositories/subscription.repository.js → esm2020/domain/users/repositories/subscription.repository.mjs} +0 -0
- /package/{esm2015/domain/users/repositories/user-address.repository.js → esm2020/domain/users/repositories/user-address.repository.mjs} +0 -0
- /package/{esm2015/domain/users/repositories/user-payment-method.repository.js → esm2020/domain/users/repositories/user-payment-method.repository.mjs} +0 -0
- /package/{esm2015/domain/users/repositories/user.repository.js → esm2020/domain/users/repositories/user.repository.mjs} +0 -0
- /package/{esm2015/domain/users/services/authentication.service.js → esm2020/domain/users/services/authentication.service.mjs} +0 -0
- /package/{esm2015/domain/users/services/index.js → esm2020/domain/users/services/index.mjs} +0 -0
- /package/{esm2015/domain/users/services/register.service.js → esm2020/domain/users/services/register.service.mjs} +0 -0
- /package/{esm2015/domain/users/services/types/basic-user-data.type.js → esm2020/domain/users/services/types/basic-user-data.type.mjs} +0 -0
- /package/{esm2015/domain/users/services/types/index.js → esm2020/domain/users/services/types/index.mjs} +0 -0
- /package/{esm2015/domain/users/use-cases/index.js → esm2020/domain/users/use-cases/index.mjs} +0 -0
- /package/{esm2015/errors/index.js → esm2020/errors/index.mjs} +0 -0
- /package/{esm2015/errors/required-argument.error.js → esm2020/errors/required-argument.error.mjs} +0 -0
- /package/{esm2015/index.js → esm2020/index.mjs} +0 -0
- /package/{esm2015/infra/elasticsearch/adapters/index.js → esm2020/infra/elasticsearch/adapters/index.mjs} +0 -0
- /package/{esm2015/infra/elasticsearch/index.js → esm2020/infra/elasticsearch/index.mjs} +0 -0
- /package/{esm2015/infra/elasticsearch/indexes/index.js → esm2020/infra/elasticsearch/indexes/index.mjs} +0 -0
- /package/{esm2015/infra/elasticsearch/types/index.js → esm2020/infra/elasticsearch/types/index.mjs} +0 -0
- /package/{esm2015/infra/firebase/auth/index.js → esm2020/infra/firebase/auth/index.mjs} +0 -0
- /package/{esm2015/infra/firebase/firestore/enums/firestore-field-type.enum.js → esm2020/infra/firebase/firestore/enums/firestore-field-type.enum.mjs} +0 -0
- /package/{esm2015/infra/firebase/firestore/enums/index.js → esm2020/infra/firebase/firestore/enums/index.mjs} +0 -0
- /package/{esm2015/infra/firebase/firestore/index.js → esm2020/infra/firebase/firestore/index.mjs} +0 -0
- /package/{esm2015/infra/firebase/firestore/mixins/index.js → esm2020/infra/firebase/firestore/mixins/index.mjs} +0 -0
- /package/{esm2015/infra/firebase/firestore/repositories/catalog/index.js → esm2020/infra/firebase/firestore/repositories/catalog/index.mjs} +0 -0
- /package/{esm2015/infra/firebase/firestore/repositories/index.js → esm2020/infra/firebase/firestore/repositories/index.mjs} +0 -0
- /package/{esm2015/infra/firebase/firestore/repositories/users/index.js → esm2020/infra/firebase/firestore/repositories/users/index.mjs} +0 -0
- /package/{esm2015/infra/firebase/firestore/types/index.js → esm2020/infra/firebase/firestore/types/index.mjs} +0 -0
- /package/{esm2015/infra/firebase/index.js → esm2020/infra/firebase/index.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.js → esm2020/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/enums/index.js → esm2020/infra/hasura-graphql/enums/index.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/index.js → esm2020/infra/hasura-graphql/index.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/mixins/helpers/index.js → esm2020/infra/hasura-graphql/mixins/helpers/index.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/mixins/index.js → esm2020/infra/hasura-graphql/mixins/index.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/models/category-hasura-graphql.js → esm2020/infra/hasura-graphql/models/category-hasura-graphql.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/models/index.js → esm2020/infra/hasura-graphql/models/index.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/repositories/index.js → esm2020/infra/hasura-graphql/repositories/index.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/types/fields.type.js → esm2020/infra/hasura-graphql/types/fields.type.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/types/hasura-graphql-auth-options.type.js → esm2020/infra/hasura-graphql/types/hasura-graphql-auth-options.type.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/types/hasura-graphql-headers.type.js → esm2020/infra/hasura-graphql/types/hasura-graphql-headers.type.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/types/index.js → esm2020/infra/hasura-graphql/types/index.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/types/nested-field.type.js → esm2020/infra/hasura-graphql/types/nested-field.type.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/types/query-builder-options.type.js → esm2020/infra/hasura-graphql/types/query-builder-options.type.mjs} +0 -0
- /package/{esm2015/infra/hasura-graphql/types/variable-options.type.js → esm2020/infra/hasura-graphql/types/variable-options.type.mjs} +0 -0
- /package/{esm2015/infra/index.js → esm2020/infra/index.mjs} +0 -0
- /package/{esm2015/infrab4a-connect.js → esm2020/infrab4a-connect.mjs} +0 -0
- /package/{esm2015/utils/is-uuid.js → esm2020/utils/is-uuid.mjs} +0 -0
- /package/{esm2015/utils/mixins/base.mixin.js → esm2020/utils/mixins/base.mixin.mjs} +0 -0
- /package/{esm2015/utils/mixins/index.js → esm2020/utils/mixins/index.mjs} +0 -0
- /package/{esm2015/utils/mixins/mixin-ctor.type.js → esm2020/utils/mixins/mixin-ctor.type.mjs} +0 -0
- /package/{esm2015/utils/parse-datetime.js → esm2020/utils/parse-datetime.mjs} +0 -0
- /package/{esm2015/utils/types/array-element.type.js → esm2020/utils/types/array-element.type.mjs} +0 -0
- /package/{esm2015/utils/types/index.js → esm2020/utils/types/index.mjs} +0 -0
- /package/{esm2015/utils/types/prop.type.js → esm2020/utils/types/prop.type.mjs} +0 -0
|
@@ -3,20 +3,19 @@ import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transforme
|
|
|
3
3
|
import { __decorate, __metadata, __awaiter, __rest } from 'tslib';
|
|
4
4
|
import { parseISO } from 'date-fns';
|
|
5
5
|
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import { Subject } from 'rxjs';
|
|
9
|
-
import { debug } from 'debug';
|
|
6
|
+
import * as lodash from 'lodash';
|
|
7
|
+
import { isString as isString$1 } from 'lodash';
|
|
10
8
|
import { CustomError } from 'ts-custom-error';
|
|
11
9
|
import axios from 'axios';
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
10
|
+
import { collection, getDoc, doc, where, orderBy, getDocs, query, startAfter, startAt, limit, addDoc, setDoc, deleteField, arrayUnion, arrayRemove, deleteDoc, Timestamp } from 'firebase/firestore';
|
|
11
|
+
import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
|
|
12
|
+
import { mutation, query as query$1 } from 'gql-query-builder';
|
|
13
|
+
import fetch from 'node-fetch';
|
|
14
14
|
|
|
15
15
|
class BaseModel {
|
|
16
16
|
get identifier() {
|
|
17
17
|
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
18
|
-
|
|
19
|
-
return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: data[field] })), {});
|
|
18
|
+
return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: this[field] })), {});
|
|
20
19
|
}
|
|
21
20
|
get identifiersFields() {
|
|
22
21
|
return this.constructor.identifiersFields;
|
|
@@ -462,439 +461,17 @@ __decorate([
|
|
|
462
461
|
__metadata("design:type", Payment)
|
|
463
462
|
], SubscriptionPayment.prototype, "payment", void 0);
|
|
464
463
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
DebugNamespaces["TRACE"] = "trace";
|
|
469
|
-
DebugNamespaces["ERROR"] = "error";
|
|
470
|
-
})(DebugNamespaces || (DebugNamespaces = {}));
|
|
471
|
-
const Logger = debug(DebugNamespaces.ROOT);
|
|
472
|
-
|
|
473
|
-
class ReflectHelper {
|
|
474
|
-
static get items() {
|
|
475
|
-
return this._items;
|
|
476
|
-
}
|
|
477
|
-
static get keys() {
|
|
478
|
-
return Object.keys(ReflectHelper.items);
|
|
479
|
-
}
|
|
480
|
-
static has(key, target, property) {
|
|
481
|
-
return (!isNil(key) &&
|
|
482
|
-
!isNil(ReflectHelper.items[key]) &&
|
|
483
|
-
(isNil(target) ||
|
|
484
|
-
(!isNil(ReflectHelper.items[key][target]) &&
|
|
485
|
-
(isNil(property) || !isNil(ReflectHelper.items[key][target][String(property)])))));
|
|
486
|
-
}
|
|
487
|
-
static get({ key, target, property, own = true }) {
|
|
488
|
-
try {
|
|
489
|
-
if (own) {
|
|
490
|
-
return Reflect.getOwnMetadata(key, target, property) || null;
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
return Reflect.getMetadata(key, target, property) || null;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
catch (_err) {
|
|
497
|
-
return null;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
static first({ key, target, property, own = true }) {
|
|
501
|
-
const values = ReflectHelper.get({ key, target, property, own });
|
|
502
|
-
return isArray(values) ? first(values) : values;
|
|
503
|
-
}
|
|
504
|
-
static last({ key, target, property, own = true }) {
|
|
505
|
-
const values = ReflectHelper.get({ key, target, property, own });
|
|
506
|
-
return isArray(values) ? last(values) : values;
|
|
507
|
-
}
|
|
508
|
-
static set({ key, target, property, value, propertyDescriptor }) {
|
|
509
|
-
Reflect.defineMetadata(key, value, target, property);
|
|
510
|
-
ReflectHelper.put({ key, target, property, value, propertyDescriptor });
|
|
511
|
-
}
|
|
512
|
-
static add({ key, target, property, value, propertyDescriptor }) {
|
|
513
|
-
let values = ReflectHelper.get({ key, target, property }) || new Array();
|
|
514
|
-
if (!Array.isArray(values))
|
|
515
|
-
values = [values];
|
|
516
|
-
values.push(value);
|
|
517
|
-
ReflectHelper.set({ key, target, property, value: values, propertyDescriptor });
|
|
518
|
-
}
|
|
519
|
-
static all({ key }) {
|
|
520
|
-
const items = ReflectHelper.items[key] || {};
|
|
521
|
-
return flatten(Object.keys(items).map((item) => flatten(this.allFrom(key, items[item]))));
|
|
522
|
-
}
|
|
523
|
-
static allFrom(key, target) {
|
|
524
|
-
return Object.keys(target)
|
|
525
|
-
.filter((property) => property !== 'object')
|
|
526
|
-
.map((property) => this.allValuesFrom(key, target, property));
|
|
527
|
-
}
|
|
528
|
-
static allValuesFrom(key, target, property) {
|
|
529
|
-
const values = target[property];
|
|
530
|
-
let value = values.value;
|
|
531
|
-
const propertyDescriptor = values.propertyDescriptor;
|
|
532
|
-
if (!isArray(value))
|
|
533
|
-
value = [value];
|
|
534
|
-
return flatten(value.map((val) => {
|
|
535
|
-
return {
|
|
536
|
-
key,
|
|
537
|
-
target: target.object,
|
|
538
|
-
property,
|
|
539
|
-
value: val,
|
|
540
|
-
propertyDescriptor,
|
|
541
|
-
};
|
|
542
|
-
}));
|
|
543
|
-
}
|
|
544
|
-
static delete({ key, target, property }) {
|
|
545
|
-
Reflect.deleteMetadata(key, target, property);
|
|
546
|
-
return ReflectHelper.remove(key, target, property);
|
|
547
|
-
}
|
|
548
|
-
static clear(key) {
|
|
549
|
-
if (!key) {
|
|
550
|
-
ReflectHelper.keys.forEach((storedKey) => {
|
|
551
|
-
ReflectHelper.clear(storedKey);
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
else {
|
|
555
|
-
if (ReflectHelper.keys.includes(key)) {
|
|
556
|
-
Object.values(ReflectHelper.items[key]).forEach((target) => {
|
|
557
|
-
if (ReflectHelper.has(key, target)) {
|
|
558
|
-
Object.values(ReflectHelper.items[key][target]).forEach((property) => {
|
|
559
|
-
ReflectHelper.delete({
|
|
560
|
-
key,
|
|
561
|
-
target: target.object,
|
|
562
|
-
property: String(property),
|
|
563
|
-
});
|
|
564
|
-
ReflectHelper.remove(key, target, String(property));
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
ReflectHelper.delete({ key, target: target.object });
|
|
568
|
-
ReflectHelper.remove(key, target);
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
static getType({ target, propertyKey }) {
|
|
574
|
-
return Reflect.getMetadata('design:type', target, propertyKey);
|
|
575
|
-
}
|
|
576
|
-
static getReturntype({ target, propertyKey }) {
|
|
577
|
-
return Reflect.getMetadata('design:returntype', target, propertyKey);
|
|
578
|
-
}
|
|
579
|
-
static getAllMethods(target) {
|
|
580
|
-
const props = [];
|
|
581
|
-
let obj = target;
|
|
582
|
-
do {
|
|
583
|
-
props.push(...Object.getOwnPropertyNames(obj));
|
|
584
|
-
} while ((obj = Object.getPrototypeOf(obj)));
|
|
585
|
-
return props.sort().filter((e, i, arr) => {
|
|
586
|
-
if ([
|
|
587
|
-
'__defineGetter__',
|
|
588
|
-
'__defineSetter__',
|
|
589
|
-
'__lookupGetter__',
|
|
590
|
-
'__lookupSetter__',
|
|
591
|
-
'constructor',
|
|
592
|
-
'hasOwnProperty',
|
|
593
|
-
'isPrototypeOf',
|
|
594
|
-
'propertyIsEnumerable',
|
|
595
|
-
'toLocaleString',
|
|
596
|
-
'toString',
|
|
597
|
-
'valueOf',
|
|
598
|
-
].includes(e))
|
|
599
|
-
return false;
|
|
600
|
-
if (e != arr[i + 1] && typeof target[e] === 'function')
|
|
601
|
-
return true;
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
static put({ key, target, property, value, propertyDescriptor }) {
|
|
605
|
-
const index = target.constructor.name;
|
|
606
|
-
ReflectHelper.items[key] = ReflectHelper.items[key] || {};
|
|
607
|
-
ReflectHelper.items[key][index] = ReflectHelper.items[key][index] || {};
|
|
608
|
-
ReflectHelper.items[key][index].object = target;
|
|
609
|
-
if (isNil(property)) {
|
|
610
|
-
ReflectHelper.items[key][index].value = {
|
|
611
|
-
value,
|
|
612
|
-
propertyDescriptor,
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
else {
|
|
616
|
-
ReflectHelper.items[key][index][String(property)] = ReflectHelper.items[key][index][String(property)] || {};
|
|
617
|
-
ReflectHelper.items[key][index][String(property)] = {
|
|
618
|
-
value,
|
|
619
|
-
propertyDescriptor,
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
static remove(key, target, property) {
|
|
624
|
-
if (ReflectHelper.has(key, target, property))
|
|
625
|
-
return delete ReflectHelper.items[key][target][String(property)];
|
|
626
|
-
else if (ReflectHelper.has(key, target))
|
|
627
|
-
return delete ReflectHelper.items[key][target];
|
|
628
|
-
else if (ReflectHelper.has(key))
|
|
629
|
-
return delete ReflectHelper.items[key];
|
|
630
|
-
else
|
|
631
|
-
return false;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
ReflectHelper._items = {};
|
|
635
|
-
|
|
636
|
-
class DebugDecoratorHelper {
|
|
637
|
-
static set(target, options) {
|
|
638
|
-
ReflectHelper.add({
|
|
639
|
-
key: DebugDecoratorHelper.DebugNamingMetadataKey,
|
|
640
|
-
target,
|
|
641
|
-
value: options,
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
static get(target) {
|
|
645
|
-
return ReflectHelper.first({
|
|
646
|
-
key: DebugDecoratorHelper.DebugNamingMetadataKey,
|
|
647
|
-
target,
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
DebugDecoratorHelper.DebugNamingMetadataKey = 'model:naming:decorator';
|
|
652
|
-
|
|
653
|
-
class ClassNameHelper {
|
|
654
|
-
static get(clazz) {
|
|
655
|
-
if (!clazz)
|
|
656
|
-
return null;
|
|
657
|
-
const prototype = Object.getPrototypeOf(clazz);
|
|
658
|
-
const names = compact([
|
|
659
|
-
get(clazz, 'constructor.name'),
|
|
660
|
-
get(prototype, 'constructor.name'),
|
|
661
|
-
get(prototype, '__proto__.constructor.name'),
|
|
662
|
-
]);
|
|
663
|
-
return names.find((name) => name !== 'class_1');
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
const isDebuggable = (object) => {
|
|
668
|
-
return 'debug' in object;
|
|
669
|
-
};
|
|
670
|
-
class DebugHelper {
|
|
671
|
-
constructor(...namespace) {
|
|
672
|
-
this.namespaces = new Set();
|
|
673
|
-
this.push(...namespace);
|
|
674
|
-
}
|
|
675
|
-
static namespacesFor(target) {
|
|
676
|
-
if (isNil(target))
|
|
677
|
-
return [];
|
|
678
|
-
const decorator = DebugDecoratorHelper.get(Object.getPrototypeOf(target));
|
|
679
|
-
const namespaces = get(decorator, 'namespaces', []);
|
|
680
|
-
const name = get(decorator, 'name', ClassNameHelper.get(target));
|
|
681
|
-
return [...namespaces, name];
|
|
682
|
-
}
|
|
683
|
-
static as(...namespaces) {
|
|
684
|
-
return new DebugHelper(...namespaces);
|
|
685
|
-
}
|
|
686
|
-
static for(target, ...namespaces) {
|
|
687
|
-
const targetNamespaces = this.namespacesFor(target);
|
|
688
|
-
return new DebugHelper(...targetNamespaces, ...namespaces);
|
|
689
|
-
}
|
|
690
|
-
static from(target, ...namespaces) {
|
|
691
|
-
if (this.isDebuggable(target)) {
|
|
692
|
-
const debug = target.debug;
|
|
693
|
-
if (namespaces)
|
|
694
|
-
debug.push(...namespaces);
|
|
695
|
-
return debug;
|
|
696
|
-
}
|
|
697
|
-
return DebugHelper.for(target, ...namespaces);
|
|
698
|
-
}
|
|
699
|
-
static clonedFrom(target, ...namespaces) {
|
|
700
|
-
if (this.isDebuggable(target)) {
|
|
701
|
-
namespaces.push(...target.debug.entries);
|
|
702
|
-
}
|
|
703
|
-
else if (!isNil(target)) {
|
|
704
|
-
namespaces.push(...this.namespacesFor(target));
|
|
705
|
-
}
|
|
706
|
-
return DebugHelper.for(target, ...namespaces);
|
|
707
|
-
}
|
|
708
|
-
static clone(target, ...namespaces) {
|
|
709
|
-
let original;
|
|
710
|
-
if (this.isDebuggable(target)) {
|
|
711
|
-
original = target.debug;
|
|
712
|
-
namespaces.push(...original.entries);
|
|
713
|
-
}
|
|
714
|
-
return {
|
|
715
|
-
original,
|
|
716
|
-
debug: DebugHelper.for(target, ...namespaces),
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
static replace(target, attrs) {
|
|
720
|
-
if (this.isDebuggable(target))
|
|
721
|
-
target.debug = attrs.with;
|
|
722
|
-
}
|
|
723
|
-
static mock(target, ...namespaces) {
|
|
724
|
-
const { original, debug } = DebugHelper.clone(target, ...namespaces);
|
|
725
|
-
DebugHelper.replace(target, { with: debug });
|
|
726
|
-
return { original, debug };
|
|
727
|
-
}
|
|
728
|
-
get entries() {
|
|
729
|
-
return Array.from(get(this, 'namespaces', []));
|
|
730
|
-
}
|
|
731
|
-
get namespace() {
|
|
732
|
-
return compact(flatten(this.entries)).join(':');
|
|
733
|
-
}
|
|
734
|
-
log(message, ...args) {
|
|
735
|
-
this.logger(JSON.stringify(message), ...args.map((element) => JSON.stringify(element)));
|
|
736
|
-
DebugHelper.logs$.next({ namespace: this.namespace, message, args });
|
|
737
|
-
return this;
|
|
738
|
-
}
|
|
739
|
-
trace(message, ...args) {
|
|
740
|
-
this.logger.extend(DebugNamespaces.TRACE)(message, ...args);
|
|
741
|
-
DebugHelper.traces$.next({ namespace: this.namespace, message, args });
|
|
742
|
-
return this;
|
|
743
|
-
}
|
|
744
|
-
error(error, ...args) {
|
|
745
|
-
this.logger.extend(DebugNamespaces.ERROR)(JSON.stringify(error), ...args.map((element) => JSON.stringify(element)));
|
|
746
|
-
DebugHelper.errors$.next({ namespace: this.namespace, error, args });
|
|
747
|
-
return this;
|
|
748
|
-
}
|
|
749
|
-
build() {
|
|
750
|
-
this.logger = Logger;
|
|
751
|
-
this.tracer = Logger;
|
|
752
|
-
this.err = Logger;
|
|
753
|
-
this.entries.forEach((namespace) => {
|
|
754
|
-
this.logger = this.logger.extend(namespace);
|
|
755
|
-
this.tracer = this.tracer.extend(namespace);
|
|
756
|
-
this.err = this.err.extend(namespace);
|
|
757
|
-
});
|
|
758
|
-
return this;
|
|
759
|
-
}
|
|
760
|
-
with(...namespace) {
|
|
761
|
-
return new DebugHelper(...this.entries, ...namespace);
|
|
762
|
-
}
|
|
763
|
-
push(...namespace) {
|
|
764
|
-
if (namespace) {
|
|
765
|
-
namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.add(item));
|
|
766
|
-
}
|
|
767
|
-
return this.build();
|
|
768
|
-
}
|
|
769
|
-
unshift(...namespace) {
|
|
770
|
-
if (namespace) {
|
|
771
|
-
return this.reset(...namespace, ...this.entries);
|
|
772
|
-
}
|
|
773
|
-
return this;
|
|
774
|
-
}
|
|
775
|
-
reset(...namespace) {
|
|
776
|
-
this.namespaces = new Set(flatten(compact(namespace)));
|
|
777
|
-
return this.build();
|
|
778
|
-
}
|
|
779
|
-
startWith(...namespace) {
|
|
780
|
-
const current = this.namespaces;
|
|
781
|
-
this.namespaces = new Set(flatten([compact(namespace), ...current]));
|
|
782
|
-
return this.build();
|
|
783
|
-
}
|
|
784
|
-
shift() {
|
|
785
|
-
const list = this.entries;
|
|
786
|
-
list.shift();
|
|
787
|
-
return this.reset(...list);
|
|
788
|
-
}
|
|
789
|
-
pop() {
|
|
790
|
-
const list = this.entries;
|
|
791
|
-
list.pop();
|
|
792
|
-
return this.reset(...list);
|
|
793
|
-
}
|
|
794
|
-
clear() {
|
|
795
|
-
return this.reset();
|
|
796
|
-
}
|
|
797
|
-
remove(...namespace) {
|
|
798
|
-
if (namespace) {
|
|
799
|
-
namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.delete(item));
|
|
800
|
-
}
|
|
801
|
-
return this.build();
|
|
802
|
-
}
|
|
803
|
-
puts(...args) {
|
|
804
|
-
return [`[${this.namespace}]`, ...args].join(' ');
|
|
464
|
+
class Address extends BaseModel {
|
|
465
|
+
static get identifiersFields() {
|
|
466
|
+
return ['id'];
|
|
805
467
|
}
|
|
806
468
|
}
|
|
807
|
-
DebugHelper.logs$ = new Subject();
|
|
808
|
-
DebugHelper.traces$ = new Subject();
|
|
809
|
-
DebugHelper.errors$ = new Subject();
|
|
810
|
-
DebugHelper.isDebuggable = isDebuggable;
|
|
811
|
-
|
|
812
|
-
function Debug(opts) {
|
|
813
|
-
return function (target) {
|
|
814
|
-
DebugDecoratorHelper.set(target.prototype, opts);
|
|
815
|
-
};
|
|
816
|
-
}
|
|
817
469
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
return Trace(Object.assign({ level: 'log' }, options));
|
|
821
|
-
}
|
|
822
|
-
function Trace(options = {}) {
|
|
823
|
-
return function (target, propertyKey, propertyDescriptor) {
|
|
824
|
-
const method = propertyDescriptor.value;
|
|
825
|
-
const isPromise = method.toString().includes(ASYNC_IDENTIFIER);
|
|
826
|
-
const args = {
|
|
827
|
-
options,
|
|
828
|
-
method,
|
|
829
|
-
target,
|
|
830
|
-
propertyKey,
|
|
831
|
-
propertyDescriptor,
|
|
832
|
-
};
|
|
833
|
-
propertyDescriptor.value = isPromise ? promiseTracer(args) : functionTracer(args);
|
|
834
|
-
return propertyDescriptor;
|
|
835
|
-
};
|
|
470
|
+
function is(value) {
|
|
471
|
+
return value;
|
|
836
472
|
}
|
|
837
|
-
const traceCall = ({ target, propertyKey, propertyDescriptor, args }) => {
|
|
838
|
-
if (!target.debug)
|
|
839
|
-
target.debug = DebugHelper.for(target, propertyKey);
|
|
840
|
-
return target.debug.push(propertyKey).trace('called', { target, propertyKey, propertyDescriptor, args });
|
|
841
|
-
};
|
|
842
|
-
const promiseTracer = function ({ options, method, propertyKey, propertyDescriptor }) {
|
|
843
|
-
return function (...args) {
|
|
844
|
-
return new Promise((resolve, reject) => {
|
|
845
|
-
const debug = traceCall({ target: this, propertyDescriptor, propertyKey, args });
|
|
846
|
-
if (get(options, 'level', '') === 'log') {
|
|
847
|
-
debug.with('params').log(args);
|
|
848
|
-
}
|
|
849
|
-
return method
|
|
850
|
-
.apply(this, args)
|
|
851
|
-
.then((result) => {
|
|
852
|
-
if (options.callbackFn) {
|
|
853
|
-
options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
|
|
854
|
-
}
|
|
855
|
-
if (get(options, 'level', '') === 'log') {
|
|
856
|
-
debug.with('returns').log(result === undefined ? 'void' : result);
|
|
857
|
-
}
|
|
858
|
-
return resolve(result);
|
|
859
|
-
})
|
|
860
|
-
.catch((error) => {
|
|
861
|
-
debug.error(error, ...args);
|
|
862
|
-
debug.with('stack').error(error.stack).pop();
|
|
863
|
-
return reject(error);
|
|
864
|
-
})
|
|
865
|
-
.finally(() => {
|
|
866
|
-
return debug.trace('finally', { args }).pop();
|
|
867
|
-
});
|
|
868
|
-
});
|
|
869
|
-
};
|
|
870
|
-
};
|
|
871
|
-
const functionTracer = function ({ options, target, method, propertyKey, propertyDescriptor, }) {
|
|
872
|
-
return function (...args) {
|
|
873
|
-
const debug = traceCall({ target: this || target, propertyDescriptor, propertyKey, args });
|
|
874
|
-
if (get(options, 'level', '') === 'log') {
|
|
875
|
-
debug.with('params').log(args);
|
|
876
|
-
}
|
|
877
|
-
let result;
|
|
878
|
-
try {
|
|
879
|
-
result = method.apply(this, args);
|
|
880
|
-
if (options.callbackFn)
|
|
881
|
-
options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
|
|
882
|
-
if (get(options, 'level', '') === 'log') {
|
|
883
|
-
debug.with('returns').log(result === undefined ? 'void' : result);
|
|
884
|
-
}
|
|
885
|
-
return result;
|
|
886
|
-
}
|
|
887
|
-
catch (error) {
|
|
888
|
-
debug.error(error, ...args).pop();
|
|
889
|
-
throw error;
|
|
890
|
-
}
|
|
891
|
-
finally {
|
|
892
|
-
debug.trace('finally', { args }).pop();
|
|
893
|
-
}
|
|
894
|
-
};
|
|
895
|
-
};
|
|
896
473
|
|
|
897
|
-
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);
|
|
474
|
+
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);
|
|
898
475
|
|
|
899
476
|
class Base {
|
|
900
477
|
constructor(...args) {
|
|
@@ -903,7 +480,7 @@ class Base {
|
|
|
903
480
|
}
|
|
904
481
|
|
|
905
482
|
const parseDateTime = (value) => {
|
|
906
|
-
if (!isString(value))
|
|
483
|
+
if (!isString$1(value))
|
|
907
484
|
return value;
|
|
908
485
|
if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
|
|
909
486
|
!/^\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))
|
|
@@ -914,6 +491,8 @@ const parseDateTime = (value) => {
|
|
|
914
491
|
return date;
|
|
915
492
|
};
|
|
916
493
|
|
|
494
|
+
const { chunk, get, isBoolean, isDate, isEmpty, isInteger, isNaN: isNaN$1, isNil, isNumber, isObject, isString, now, omit, pick, set, } = lodash;
|
|
495
|
+
|
|
917
496
|
var CheckoutTypes;
|
|
918
497
|
(function (CheckoutTypes) {
|
|
919
498
|
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
@@ -958,28 +537,26 @@ class Coupon extends BaseModel {
|
|
|
958
537
|
static createCoupon(userId) {
|
|
959
538
|
return this.toInstance({
|
|
960
539
|
nickname: `${Date.now()}`,
|
|
540
|
+
type: CouponTypes.ABSOLUTE,
|
|
961
541
|
checkoutType: CheckoutTypes.ECOMMERCE,
|
|
962
|
-
discount:
|
|
963
|
-
subscriber: {
|
|
964
|
-
type: CouponTypes.ABSOLUTE,
|
|
965
|
-
value: 10,
|
|
966
|
-
},
|
|
967
|
-
non_subscriber: {
|
|
968
|
-
type: CouponTypes.ABSOLUTE,
|
|
969
|
-
value: 10,
|
|
970
|
-
},
|
|
971
|
-
subscription: {
|
|
972
|
-
type: CouponTypes.ABSOLUTE,
|
|
973
|
-
value: 10,
|
|
974
|
-
},
|
|
975
|
-
},
|
|
542
|
+
discount: 30,
|
|
976
543
|
user: userId,
|
|
544
|
+
useLimit: 1,
|
|
545
|
+
useLimitPerUser: true,
|
|
977
546
|
createdAt: new Date(Date.now()),
|
|
978
547
|
beginAt: new Date(Date.now()),
|
|
979
548
|
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
980
549
|
});
|
|
981
550
|
}
|
|
982
551
|
}
|
|
552
|
+
__decorate([
|
|
553
|
+
Expose({ name: 'checkout_type' }),
|
|
554
|
+
__metadata("design:type", Number)
|
|
555
|
+
], Coupon.prototype, "checkoutType", void 0);
|
|
556
|
+
__decorate([
|
|
557
|
+
Expose({ name: 'exclusivity_type' }),
|
|
558
|
+
__metadata("design:type", Number)
|
|
559
|
+
], Coupon.prototype, "exclusivityType", void 0);
|
|
983
560
|
|
|
984
561
|
class SubscriptionPlan extends BaseModel {
|
|
985
562
|
static get identifiersFields() {
|
|
@@ -1019,18 +596,6 @@ __decorate([
|
|
|
1019
596
|
__metadata("design:type", BeautyProfile)
|
|
1020
597
|
], User.prototype, "beautyProfile", void 0);
|
|
1021
598
|
|
|
1022
|
-
class Address extends BaseModel {
|
|
1023
|
-
static get identifiersFields() {
|
|
1024
|
-
return ['id'];
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
class UserAddress extends Address {
|
|
1029
|
-
static get identifiersFields() {
|
|
1030
|
-
return ['id', 'userId'];
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
599
|
class Subscription extends BaseModel {
|
|
1035
600
|
static get identifiersFields() {
|
|
1036
601
|
return ['id'];
|
|
@@ -1045,12 +610,12 @@ __decorate([
|
|
|
1045
610
|
__metadata("design:type", SubscriptionPlan)
|
|
1046
611
|
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
1047
612
|
__decorate([
|
|
1048
|
-
Type(() =>
|
|
1049
|
-
__metadata("design:type",
|
|
613
|
+
Type(() => Address),
|
|
614
|
+
__metadata("design:type", Address)
|
|
1050
615
|
], Subscription.prototype, "shippingAddress", void 0);
|
|
1051
616
|
__decorate([
|
|
1052
|
-
Type(() =>
|
|
1053
|
-
__metadata("design:type",
|
|
617
|
+
Type(() => Address),
|
|
618
|
+
__metadata("design:type", Address)
|
|
1054
619
|
], Subscription.prototype, "billingAddress", void 0);
|
|
1055
620
|
__decorate([
|
|
1056
621
|
Type(() => Coupon),
|
|
@@ -1065,6 +630,12 @@ __decorate([
|
|
|
1065
630
|
__metadata("design:type", Array)
|
|
1066
631
|
], Subscription.prototype, "payment", void 0);
|
|
1067
632
|
|
|
633
|
+
class UserAddress extends Address {
|
|
634
|
+
static get identifiersFields() {
|
|
635
|
+
return ['id', 'userId'];
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
1068
639
|
class UserPaymentMethod extends BaseModel {
|
|
1069
640
|
static get identifiersFields() {
|
|
1070
641
|
return ['id', 'userId'];
|
|
@@ -1080,7 +651,6 @@ class Lead extends BaseModel {
|
|
|
1080
651
|
class UnauthorizedError extends CustomError {
|
|
1081
652
|
constructor(message) {
|
|
1082
653
|
super(message);
|
|
1083
|
-
this.message = message;
|
|
1084
654
|
}
|
|
1085
655
|
}
|
|
1086
656
|
|
|
@@ -1123,14 +693,12 @@ class Authentication {
|
|
|
1123
693
|
class UserAlreadyRegisteredError extends CustomError {
|
|
1124
694
|
constructor(message) {
|
|
1125
695
|
super(message);
|
|
1126
|
-
this.message = message;
|
|
1127
696
|
}
|
|
1128
697
|
}
|
|
1129
698
|
|
|
1130
699
|
class WeakPasswordError extends CustomError {
|
|
1131
700
|
constructor(message = 'Weak password') {
|
|
1132
701
|
super(message);
|
|
1133
|
-
this.message = message;
|
|
1134
702
|
}
|
|
1135
703
|
}
|
|
1136
704
|
|
|
@@ -1187,123 +755,14 @@ class RecoveryPassword {
|
|
|
1187
755
|
}
|
|
1188
756
|
}
|
|
1189
757
|
|
|
1190
|
-
class
|
|
1191
|
-
|
|
1192
|
-
return ['id'];
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
class CategoryBase extends BaseModel {
|
|
1197
|
-
static get identifiersFields() {
|
|
1198
|
-
return ['id'];
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
__decorate([
|
|
1202
|
-
Type(() => CategoryBase),
|
|
1203
|
-
__metadata("design:type", CategoryBase)
|
|
1204
|
-
], CategoryBase.prototype, "parent", void 0);
|
|
1205
|
-
__decorate([
|
|
1206
|
-
Type(() => Filter),
|
|
1207
|
-
__metadata("design:type", Array)
|
|
1208
|
-
], CategoryBase.prototype, "filters", void 0);
|
|
1209
|
-
|
|
1210
|
-
class CategoryForProduct extends CategoryBase {
|
|
1211
|
-
static get identifiersFields() {
|
|
1212
|
-
return ['id'];
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
class ProductBase extends BaseModel {
|
|
1217
|
-
get evaluation() {
|
|
1218
|
-
return {
|
|
1219
|
-
reviews: this.reviews,
|
|
1220
|
-
count: this.reviewsTotal,
|
|
1221
|
-
rating: this.rate,
|
|
1222
|
-
};
|
|
1223
|
-
}
|
|
1224
|
-
set evaluation(evaluation) {
|
|
1225
|
-
if (!evaluation) {
|
|
1226
|
-
this.reviews = null;
|
|
1227
|
-
this.reviewsTotal = null;
|
|
1228
|
-
this.rate = null;
|
|
1229
|
-
return;
|
|
1230
|
-
}
|
|
1231
|
-
this.reviews = evaluation.reviews || this.reviews;
|
|
1232
|
-
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
1233
|
-
this.rate = evaluation.rating || this.rate;
|
|
1234
|
-
}
|
|
1235
|
-
static get identifiersFields() {
|
|
1236
|
-
return ['id'];
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
class ProductForKit extends ProductBase {
|
|
1241
|
-
static get identifiersFields() {
|
|
1242
|
-
return ['id'];
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
__decorate([
|
|
1246
|
-
Type(() => CategoryForProduct),
|
|
1247
|
-
__metadata("design:type", CategoryForProduct)
|
|
1248
|
-
], ProductForKit.prototype, "category", void 0);
|
|
1249
|
-
|
|
1250
|
-
class KitProduct extends BaseModel {
|
|
1251
|
-
static get identifiersFields() {
|
|
1252
|
-
return ['productId', 'kitProductId'];
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
__decorate([
|
|
1256
|
-
Type(() => ProductForKit),
|
|
1257
|
-
__metadata("design:type", ProductForKit)
|
|
1258
|
-
], KitProduct.prototype, "kit", void 0);
|
|
1259
|
-
__decorate([
|
|
1260
|
-
Type(() => ProductForKit),
|
|
1261
|
-
__metadata("design:type", ProductForKit)
|
|
1262
|
-
], KitProduct.prototype, "product", void 0);
|
|
1263
|
-
|
|
1264
|
-
class ProductForCategory extends ProductBase {
|
|
1265
|
-
static get identifiersFields() {
|
|
1266
|
-
return ['id'];
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
__decorate([
|
|
1270
|
-
Type(() => KitProduct),
|
|
1271
|
-
__metadata("design:type", Array)
|
|
1272
|
-
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
1273
|
-
|
|
1274
|
-
class Category extends CategoryBase {
|
|
1275
|
-
static get identifiersFields() {
|
|
758
|
+
class Category extends BaseModel {
|
|
759
|
+
identifierFields() {
|
|
1276
760
|
return ['id'];
|
|
1277
761
|
}
|
|
1278
|
-
}
|
|
1279
|
-
__decorate([
|
|
1280
|
-
Type(() => ProductForCategory),
|
|
1281
|
-
__metadata("design:type", Array)
|
|
1282
|
-
], Category.prototype, "childrenProducts", void 0);
|
|
1283
|
-
|
|
1284
|
-
class CategoryCollectionChildren extends BaseModel {
|
|
1285
|
-
static get identifiersFields() {
|
|
1286
|
-
return ['collectionId', 'categoryId'];
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
__decorate([
|
|
1290
|
-
Type(() => CategoryCollectionChildren),
|
|
1291
|
-
__metadata("design:type", CategoryCollectionChildren)
|
|
1292
|
-
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
1293
|
-
|
|
1294
|
-
class CategoryFilter extends BaseModel {
|
|
1295
762
|
static get identifiersFields() {
|
|
1296
763
|
return ['id'];
|
|
1297
764
|
}
|
|
1298
765
|
}
|
|
1299
|
-
__decorate([
|
|
1300
|
-
Type(() => Filter),
|
|
1301
|
-
__metadata("design:type", Filter)
|
|
1302
|
-
], CategoryFilter.prototype, "filter", void 0);
|
|
1303
|
-
__decorate([
|
|
1304
|
-
Type(() => Category),
|
|
1305
|
-
__metadata("design:type", Category)
|
|
1306
|
-
], CategoryFilter.prototype, "category", void 0);
|
|
1307
766
|
|
|
1308
767
|
var GenderDestination;
|
|
1309
768
|
(function (GenderDestination) {
|
|
@@ -1320,60 +779,54 @@ var Shops;
|
|
|
1320
779
|
Shops["ALL"] = "ALL";
|
|
1321
780
|
})(Shops || (Shops = {}));
|
|
1322
781
|
|
|
1323
|
-
class
|
|
1324
|
-
|
|
782
|
+
class Product extends BaseModel {
|
|
783
|
+
identifierFields() {
|
|
1325
784
|
return ['id'];
|
|
1326
785
|
}
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
class Product extends ProductBase {
|
|
1330
786
|
static get identifiersFields() {
|
|
1331
787
|
return ['id'];
|
|
1332
788
|
}
|
|
1333
789
|
}
|
|
1334
|
-
__decorate([
|
|
1335
|
-
Type(() => CategoryForProduct),
|
|
1336
|
-
__metadata("design:type", CategoryForProduct)
|
|
1337
|
-
], Product.prototype, "category", void 0);
|
|
1338
790
|
__decorate([
|
|
1339
791
|
Type(() => KitProduct),
|
|
1340
792
|
__metadata("design:type", Array)
|
|
1341
793
|
], Product.prototype, "kitProducts", void 0);
|
|
1342
794
|
|
|
1343
|
-
class
|
|
1344
|
-
static get identifiersFields() {
|
|
1345
|
-
return ['id', 'productId'];
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
class Wishlist extends Category {
|
|
1350
|
-
static get identifiersFields() {
|
|
1351
|
-
return ['id'];
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
class Buy2Win extends BaseModel {
|
|
795
|
+
class KitProduct extends BaseModel {
|
|
1356
796
|
static get identifiersFields() {
|
|
1357
|
-
return ['
|
|
797
|
+
return ['productId', 'kitProducId'];
|
|
1358
798
|
}
|
|
1359
799
|
}
|
|
1360
800
|
__decorate([
|
|
1361
|
-
Type(() =>
|
|
1362
|
-
__metadata("design:type",
|
|
1363
|
-
],
|
|
801
|
+
Type(() => Product),
|
|
802
|
+
__metadata("design:type", Product)
|
|
803
|
+
], KitProduct.prototype, "kit", void 0);
|
|
804
|
+
__decorate([
|
|
805
|
+
Type(() => Product),
|
|
806
|
+
__metadata("design:type", Product)
|
|
807
|
+
], KitProduct.prototype, "product", void 0);
|
|
1364
808
|
|
|
1365
|
-
class
|
|
1366
|
-
|
|
809
|
+
class Variant extends BaseModel {
|
|
810
|
+
identifierFields() {
|
|
1367
811
|
return ['id'];
|
|
1368
812
|
}
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
class CampaignHashtag extends BaseModel {
|
|
1372
813
|
static get identifiersFields() {
|
|
1373
|
-
return ['id'];
|
|
814
|
+
return ['id', 'productId'];
|
|
1374
815
|
}
|
|
1375
816
|
}
|
|
1376
817
|
|
|
818
|
+
var OrderStatus;
|
|
819
|
+
(function (OrderStatus) {
|
|
820
|
+
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
821
|
+
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
822
|
+
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
823
|
+
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
824
|
+
OrderStatus["ENVIADO"] = "Enviado";
|
|
825
|
+
OrderStatus["ENTREGUE"] = "Entregue";
|
|
826
|
+
OrderStatus["CANCELADO"] = "Cancelado";
|
|
827
|
+
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
828
|
+
})(OrderStatus || (OrderStatus = {}));
|
|
829
|
+
|
|
1377
830
|
class LineItem extends Product {
|
|
1378
831
|
}
|
|
1379
832
|
|
|
@@ -1397,12 +850,12 @@ __decorate([
|
|
|
1397
850
|
__metadata("design:type", User)
|
|
1398
851
|
], Checkout.prototype, "user", void 0);
|
|
1399
852
|
__decorate([
|
|
1400
|
-
Type(() =>
|
|
1401
|
-
__metadata("design:type",
|
|
853
|
+
Type(() => Address),
|
|
854
|
+
__metadata("design:type", Address)
|
|
1402
855
|
], Checkout.prototype, "shippingAddress", void 0);
|
|
1403
856
|
__decorate([
|
|
1404
|
-
Type(() =>
|
|
1405
|
-
__metadata("design:type",
|
|
857
|
+
Type(() => Address),
|
|
858
|
+
__metadata("design:type", Address)
|
|
1406
859
|
], Checkout.prototype, "billingAddress", void 0);
|
|
1407
860
|
__decorate([
|
|
1408
861
|
Type(() => ShippingMethod),
|
|
@@ -1413,18 +866,6 @@ __decorate([
|
|
|
1413
866
|
__metadata("design:type", Coupon)
|
|
1414
867
|
], Checkout.prototype, "coupon", void 0);
|
|
1415
868
|
|
|
1416
|
-
var OrderStatus;
|
|
1417
|
-
(function (OrderStatus) {
|
|
1418
|
-
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
1419
|
-
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
1420
|
-
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
1421
|
-
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
1422
|
-
OrderStatus["ENVIADO"] = "Enviado";
|
|
1423
|
-
OrderStatus["ENTREGUE"] = "Entregue";
|
|
1424
|
-
OrderStatus["CANCELADO"] = "Cancelado";
|
|
1425
|
-
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
1426
|
-
})(OrderStatus || (OrderStatus = {}));
|
|
1427
|
-
|
|
1428
869
|
class Order extends Checkout {
|
|
1429
870
|
}
|
|
1430
871
|
__decorate([
|
|
@@ -1438,12 +879,12 @@ class CheckoutSubscription extends BaseModel {
|
|
|
1438
879
|
}
|
|
1439
880
|
}
|
|
1440
881
|
__decorate([
|
|
1441
|
-
Type(() =>
|
|
1442
|
-
__metadata("design:type",
|
|
882
|
+
Type(() => Address),
|
|
883
|
+
__metadata("design:type", Address)
|
|
1443
884
|
], CheckoutSubscription.prototype, "shippingAddress", void 0);
|
|
1444
885
|
__decorate([
|
|
1445
|
-
Type(() =>
|
|
1446
|
-
__metadata("design:type",
|
|
886
|
+
Type(() => Address),
|
|
887
|
+
__metadata("design:type", Address)
|
|
1447
888
|
], CheckoutSubscription.prototype, "billingAddress", void 0);
|
|
1448
889
|
__decorate([
|
|
1449
890
|
Type(() => SubscriptionPlan),
|
|
@@ -1454,19 +895,15 @@ __decorate([
|
|
|
1454
895
|
__metadata("design:type", Coupon)
|
|
1455
896
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
1456
897
|
|
|
1457
|
-
class
|
|
1458
|
-
static
|
|
1459
|
-
|
|
1460
|
-
product.price.fullPrice = Number(product.price.fullPrice.toFixed(2));
|
|
1461
|
-
if (product.price.subscriberPrice) {
|
|
1462
|
-
product.price.subscriberPrice = Number(product.price.subscriberPrice.toFixed(2));
|
|
1463
|
-
}
|
|
1464
|
-
if (product instanceof LineItem && product.pricePaid) {
|
|
1465
|
-
product.pricePaid = Number(product.pricePaid.toFixed(2));
|
|
1466
|
-
}
|
|
1467
|
-
return product;
|
|
898
|
+
class Buy2Win extends BaseModel {
|
|
899
|
+
static get identifiersFields() {
|
|
900
|
+
return ['id'];
|
|
1468
901
|
}
|
|
1469
902
|
}
|
|
903
|
+
__decorate([
|
|
904
|
+
Type(() => Category),
|
|
905
|
+
__metadata("design:type", Array)
|
|
906
|
+
], Buy2Win.prototype, "categories", void 0);
|
|
1470
907
|
|
|
1471
908
|
var FilterType;
|
|
1472
909
|
(function (FilterType) {
|
|
@@ -1550,7 +987,8 @@ class BeautyQuestionsHelper {
|
|
|
1550
987
|
}
|
|
1551
988
|
}
|
|
1552
989
|
static getQuestions(filter) {
|
|
1553
|
-
|
|
990
|
+
const filterKey = Object.keys(FilterType)[Object.values(FilterType).indexOf(filter)];
|
|
991
|
+
return QuestionsFilters[filterKey];
|
|
1554
992
|
}
|
|
1555
993
|
}
|
|
1556
994
|
|
|
@@ -1566,16 +1004,9 @@ class ShopMenu extends BaseModel {
|
|
|
1566
1004
|
}
|
|
1567
1005
|
}
|
|
1568
1006
|
|
|
1569
|
-
class ShopSettings extends BaseModel {
|
|
1570
|
-
static get identifiersFields() {
|
|
1571
|
-
return ['id'];
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
1007
|
class InvalidArgumentError extends CustomError {
|
|
1576
1008
|
constructor(message) {
|
|
1577
1009
|
super(message);
|
|
1578
|
-
this.message = message;
|
|
1579
1010
|
}
|
|
1580
1011
|
}
|
|
1581
1012
|
|
|
@@ -1590,14 +1021,12 @@ class RequiredArgumentError extends CustomError {
|
|
|
1590
1021
|
class NotFoundError extends CustomError {
|
|
1591
1022
|
constructor(message) {
|
|
1592
1023
|
super(message);
|
|
1593
|
-
this.message = message;
|
|
1594
1024
|
}
|
|
1595
1025
|
}
|
|
1596
1026
|
|
|
1597
1027
|
class DuplicatedResultsError extends CustomError {
|
|
1598
1028
|
constructor(message) {
|
|
1599
1029
|
super(message);
|
|
1600
|
-
this.message = message;
|
|
1601
1030
|
}
|
|
1602
1031
|
}
|
|
1603
1032
|
|
|
@@ -1605,21 +1034,19 @@ class AxiosAdapter {
|
|
|
1605
1034
|
constructor(config) {
|
|
1606
1035
|
this.config = config;
|
|
1607
1036
|
}
|
|
1608
|
-
get(index
|
|
1037
|
+
get(index) {
|
|
1609
1038
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1610
1039
|
try {
|
|
1611
1040
|
const { data } = yield axios({
|
|
1612
|
-
url: `${this.config.url}/${index}
|
|
1041
|
+
url: `${this.config.url}/${index}`,
|
|
1613
1042
|
method: 'GET',
|
|
1614
|
-
|
|
1615
|
-
headers: {
|
|
1616
|
-
'Content-Type': 'application/json',
|
|
1617
|
-
Authorization: `ApiKey ${this.config.credential}`,
|
|
1618
|
-
},
|
|
1043
|
+
headers: { Authorization: `Basic ${this.config.credential}` },
|
|
1619
1044
|
});
|
|
1620
1045
|
return data._source;
|
|
1621
1046
|
}
|
|
1622
1047
|
catch (error) {
|
|
1048
|
+
if (!(error instanceof Error))
|
|
1049
|
+
throw error;
|
|
1623
1050
|
throw new NotFoundError(error.message);
|
|
1624
1051
|
}
|
|
1625
1052
|
});
|
|
@@ -1627,14 +1054,9 @@ class AxiosAdapter {
|
|
|
1627
1054
|
query(index, query) {
|
|
1628
1055
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1629
1056
|
const { data } = yield axios({
|
|
1630
|
-
url: `${this.config.url}/${index}
|
|
1057
|
+
url: `${this.config.url}/${index}`,
|
|
1631
1058
|
method: 'POST',
|
|
1632
|
-
|
|
1633
|
-
headers: {
|
|
1634
|
-
Accept: 'application/vnd.elasticsearch+json;compatible-with=7',
|
|
1635
|
-
'Content-Type': 'application/vnd.elasticsearch+json;compatible-with=7',
|
|
1636
|
-
Authorization: `ApiKey ${this.config.credential}`,
|
|
1637
|
-
},
|
|
1059
|
+
headers: { Authorization: `Basic ${this.config.credential}` },
|
|
1638
1060
|
data: query,
|
|
1639
1061
|
});
|
|
1640
1062
|
return {
|
|
@@ -1646,29 +1068,19 @@ class AxiosAdapter {
|
|
|
1646
1068
|
save(index, data) {
|
|
1647
1069
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1648
1070
|
yield axios({
|
|
1649
|
-
url: `${this.config.url}/${index}
|
|
1650
|
-
method: 'POST',
|
|
1651
|
-
headers: { Authorization: `ApiKey ${this.config.credential}` },
|
|
1652
|
-
data,
|
|
1653
|
-
});
|
|
1654
|
-
});
|
|
1655
|
-
}
|
|
1656
|
-
update(index, id, data) {
|
|
1657
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1658
|
-
yield axios({
|
|
1659
|
-
url: `${this.config.url}/${index}/_update/${id}`,
|
|
1071
|
+
url: `${this.config.url}/${index}`,
|
|
1660
1072
|
method: 'PUT',
|
|
1661
|
-
headers: { Authorization: `
|
|
1073
|
+
headers: { Authorization: `Basic ${this.config.credential}` },
|
|
1662
1074
|
data,
|
|
1663
1075
|
});
|
|
1664
1076
|
});
|
|
1665
1077
|
}
|
|
1666
|
-
delete(index
|
|
1078
|
+
delete(index) {
|
|
1667
1079
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1668
1080
|
yield axios({
|
|
1669
|
-
url: `${this.config.url}/${index}
|
|
1081
|
+
url: `${this.config.url}/${index}`,
|
|
1670
1082
|
method: 'DELETE',
|
|
1671
|
-
headers: { Authorization: `
|
|
1083
|
+
headers: { Authorization: `Basic ${this.config.credential}` },
|
|
1672
1084
|
});
|
|
1673
1085
|
});
|
|
1674
1086
|
}
|
|
@@ -1677,19 +1089,16 @@ class AxiosAdapter {
|
|
|
1677
1089
|
class ProductsIndex {
|
|
1678
1090
|
constructor(adapter) {
|
|
1679
1091
|
this.adapter = adapter;
|
|
1680
|
-
this.index = `products`;
|
|
1681
1092
|
}
|
|
1682
|
-
|
|
1093
|
+
get(id) {
|
|
1683
1094
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1684
|
-
const data = yield this.adapter.get(
|
|
1095
|
+
const data = yield this.adapter.get(`products/_doc/${id}`);
|
|
1685
1096
|
return Product.toInstance(data);
|
|
1686
1097
|
});
|
|
1687
1098
|
}
|
|
1688
|
-
|
|
1099
|
+
findById(ids, options) {
|
|
1689
1100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1690
|
-
const size = total || 9;
|
|
1691
1101
|
const fields = [
|
|
1692
|
-
'EAN',
|
|
1693
1102
|
'brand',
|
|
1694
1103
|
'id',
|
|
1695
1104
|
'images',
|
|
@@ -1700,88 +1109,73 @@ class ProductsIndex {
|
|
|
1700
1109
|
'stock',
|
|
1701
1110
|
'slug',
|
|
1702
1111
|
'reviews',
|
|
1112
|
+
'pricePaid',
|
|
1113
|
+
'isGift',
|
|
1114
|
+
'stock',
|
|
1115
|
+
'weight',
|
|
1116
|
+
'tags',
|
|
1703
1117
|
'hasVariants',
|
|
1704
|
-
'
|
|
1118
|
+
'type',
|
|
1705
1119
|
];
|
|
1706
|
-
const
|
|
1707
|
-
if (size > 9) {
|
|
1708
|
-
fields.push(...['pricePaid', 'isGift', 'stock', 'weight', 'tags']);
|
|
1709
|
-
}
|
|
1710
|
-
else {
|
|
1711
|
-
filter.push({ term: { tags: shop == Shops.GLAMSHOP ? 'feminino' : 'masculino' } });
|
|
1712
|
-
}
|
|
1713
|
-
const search = yield this.adapter.query(this.index, {
|
|
1714
|
-
size,
|
|
1715
|
-
_source: fields,
|
|
1716
|
-
query: {
|
|
1120
|
+
const { hits } = yield this.adapter.query('products/_search', Object.assign({ _source: fields, query: {
|
|
1717
1121
|
bool: {
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
'name',
|
|
1724
|
-
'name.folded',
|
|
1725
|
-
'name.search',
|
|
1726
|
-
'description',
|
|
1727
|
-
'description.search',
|
|
1728
|
-
'description.folded',
|
|
1729
|
-
'brand',
|
|
1730
|
-
'brand.search',
|
|
1731
|
-
'brand.folded',
|
|
1732
|
-
],
|
|
1733
|
-
fuzziness: 2,
|
|
1122
|
+
filter: [
|
|
1123
|
+
{
|
|
1124
|
+
terms: {
|
|
1125
|
+
_id: ids,
|
|
1126
|
+
},
|
|
1734
1127
|
},
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
'name.search': {
|
|
1739
|
-
query: `${searchTerm}`,
|
|
1740
|
-
slop: 10,
|
|
1128
|
+
{
|
|
1129
|
+
term: {
|
|
1130
|
+
published: true,
|
|
1741
1131
|
},
|
|
1742
1132
|
},
|
|
1743
|
-
|
|
1744
|
-
|
|
1133
|
+
...((options === null || options === void 0 ? void 0 : options.hasStock)
|
|
1134
|
+
? [
|
|
1135
|
+
{
|
|
1136
|
+
range: {
|
|
1137
|
+
'stock.quantity': {
|
|
1138
|
+
gt: 0,
|
|
1139
|
+
},
|
|
1140
|
+
},
|
|
1141
|
+
},
|
|
1142
|
+
]
|
|
1143
|
+
: []),
|
|
1144
|
+
],
|
|
1745
1145
|
},
|
|
1746
|
-
},
|
|
1747
|
-
|
|
1748
|
-
search.hits = search.hits
|
|
1749
|
-
.filter((e) => e._source.name !== '')
|
|
1750
|
-
.map((hit) => {
|
|
1751
|
-
RoundProductPricesHelper.roundProductPrices(hit._source);
|
|
1752
|
-
return hit;
|
|
1753
|
-
});
|
|
1754
|
-
return search;
|
|
1146
|
+
} }, ((options === null || options === void 0 ? void 0 : options.size) ? { size: options === null || options === void 0 ? void 0 : options.size } : {})));
|
|
1147
|
+
return hits.map((hit) => Product.toInstance(hit._source));
|
|
1755
1148
|
});
|
|
1756
1149
|
}
|
|
1757
1150
|
save(product) {
|
|
1758
1151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1152
|
+
delete product.createdAt;
|
|
1153
|
+
delete product.updatedAt;
|
|
1154
|
+
delete product.kitProducts;
|
|
1759
1155
|
try {
|
|
1760
|
-
|
|
1761
|
-
|
|
1156
|
+
if (!product.firestoreId)
|
|
1157
|
+
throw new Error('Is not a product from firestore');
|
|
1158
|
+
yield this.get(product.firestoreId);
|
|
1159
|
+
yield this.adapter.save(`products/_doc/${product.firestoreId}`, product.toPlain());
|
|
1762
1160
|
}
|
|
1763
1161
|
catch (error) {
|
|
1764
|
-
|
|
1162
|
+
if (!(error instanceof Error))
|
|
1163
|
+
throw error;
|
|
1164
|
+
console.error(error.message);
|
|
1165
|
+
yield this.adapter.save(`products/_doc/${product.id}`, product.toPlain());
|
|
1765
1166
|
}
|
|
1766
1167
|
});
|
|
1767
1168
|
}
|
|
1768
|
-
|
|
1769
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1770
|
-
try {
|
|
1771
|
-
yield this.adapter.update(this.index, product.id, product);
|
|
1772
|
-
}
|
|
1773
|
-
catch (error) {
|
|
1774
|
-
console.error(error);
|
|
1775
|
-
}
|
|
1776
|
-
});
|
|
1777
|
-
}
|
|
1778
|
-
delete(id) {
|
|
1169
|
+
delete(product) {
|
|
1779
1170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1171
|
+
if (!product.firestoreId)
|
|
1172
|
+
return;
|
|
1780
1173
|
try {
|
|
1781
|
-
yield this.
|
|
1174
|
+
yield this.get(product.firestoreId);
|
|
1175
|
+
yield this.adapter.delete(`products/_doc/${product.firestoreId}`);
|
|
1782
1176
|
}
|
|
1783
1177
|
catch (error) {
|
|
1784
|
-
|
|
1178
|
+
yield this.adapter.delete(`products/_doc/${product.id}`);
|
|
1785
1179
|
}
|
|
1786
1180
|
});
|
|
1787
1181
|
}
|
|
@@ -1809,30 +1203,20 @@ const withFirestore = (MixinBase) => {
|
|
|
1809
1203
|
? data[key].map((element) => (isObjectsAndNoDate(element) ? bindAllDateFromObject(element) : element))
|
|
1810
1204
|
: bindDate(data[key], key) })), {});
|
|
1811
1205
|
};
|
|
1812
|
-
const omitByRecursivelyInPlace = (value, iteratee) => {
|
|
1813
|
-
each(value, (v, k) => {
|
|
1814
|
-
if (iteratee(v, k)) {
|
|
1815
|
-
unset(value, k);
|
|
1816
|
-
}
|
|
1817
|
-
else if (isObject(v)) {
|
|
1818
|
-
omitByRecursivelyInPlace(v, iteratee);
|
|
1819
|
-
}
|
|
1820
|
-
});
|
|
1821
|
-
return value;
|
|
1822
|
-
};
|
|
1823
1206
|
return class extends MixinBase {
|
|
1207
|
+
constructor() {
|
|
1208
|
+
super(...arguments);
|
|
1209
|
+
this.collectionName = '';
|
|
1210
|
+
}
|
|
1824
1211
|
collection(path) {
|
|
1825
|
-
return this.firestore
|
|
1212
|
+
return collection(this.firestore, path || this.collectionName).withConverter(this.buildModelInstance());
|
|
1826
1213
|
}
|
|
1827
1214
|
buildModelInstance() {
|
|
1828
1215
|
return {
|
|
1829
|
-
toFirestore: (data) =>
|
|
1830
|
-
const plain = (data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data;
|
|
1831
|
-
return omitByRecursivelyInPlace(plain, (value) => value === undefined);
|
|
1832
|
-
},
|
|
1216
|
+
toFirestore: (data) => ((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data),
|
|
1833
1217
|
fromFirestore: (snap) => {
|
|
1834
1218
|
const data = snap.data();
|
|
1835
|
-
let bindedData;
|
|
1219
|
+
let bindedData = null;
|
|
1836
1220
|
try {
|
|
1837
1221
|
const ids = { id: snap.id };
|
|
1838
1222
|
bindedData = bindAllDateFromObject(data);
|
|
@@ -1870,10 +1254,8 @@ const withGetFirestore = (MixinBase) => {
|
|
|
1870
1254
|
return class GetFirestore extends MixinBase {
|
|
1871
1255
|
get(identifiers) {
|
|
1872
1256
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1873
|
-
const
|
|
1874
|
-
|
|
1875
|
-
.get();
|
|
1876
|
-
const data = doc.data();
|
|
1257
|
+
const docRef = yield getDoc(doc(yield this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(identifiers).shift().toString()));
|
|
1258
|
+
const data = docRef.data();
|
|
1877
1259
|
if (isNil(data))
|
|
1878
1260
|
throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
|
|
1879
1261
|
return data;
|
|
@@ -1908,10 +1290,13 @@ const withFindFirestore = (MixinBase) => {
|
|
|
1908
1290
|
return class FindFirestore extends MixinBase {
|
|
1909
1291
|
constructor() {
|
|
1910
1292
|
super(...arguments);
|
|
1911
|
-
this.makeFirestoreWhere = (
|
|
1912
|
-
|
|
1293
|
+
this.makeFirestoreWhere = (filter) => Object.keys(filter).reduce((queries, fieldName) => [
|
|
1294
|
+
...queries,
|
|
1295
|
+
...this.buildWhereSentence(fieldName, is(filter[fieldName])),
|
|
1296
|
+
], []);
|
|
1297
|
+
this.buildWhereSentence = (fieldName, options) => {
|
|
1913
1298
|
if (this.isSubCollection(this) && fieldName === this.parentIdField)
|
|
1914
|
-
|
|
1299
|
+
[];
|
|
1915
1300
|
const value = (options === null || options === void 0 ? void 0 : options.value) || options;
|
|
1916
1301
|
const object = {};
|
|
1917
1302
|
set(object, fieldName, value);
|
|
@@ -1921,41 +1306,49 @@ const withFindFirestore = (MixinBase) => {
|
|
|
1921
1306
|
: Object.keys(plainInstance).find((key) => plainInstance[key]);
|
|
1922
1307
|
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.LIKE) {
|
|
1923
1308
|
if (Array.isArray(options === null || options === void 0 ? void 0 : options.value) &&
|
|
1924
|
-
(this.fields[firestoreFieldName] ===
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
return
|
|
1309
|
+
(this.fields[firestoreFieldName] ===
|
|
1310
|
+
FirestoreFieldType.Array ||
|
|
1311
|
+
!this.fields[firestoreFieldName]))
|
|
1312
|
+
return [where(firestoreFieldName, 'array-contains-any', options.value)];
|
|
1313
|
+
return [where(firestoreFieldName, '>=', options.value), where(firestoreFieldName, '<=', `${options.value}~`)];
|
|
1929
1314
|
}
|
|
1930
1315
|
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN &&
|
|
1931
1316
|
Array.isArray(options === null || options === void 0 ? void 0 : options.value) &&
|
|
1932
|
-
(this.fields[firestoreFieldName] === FirestoreFieldType.Array ||
|
|
1933
|
-
|
|
1317
|
+
(this.fields[firestoreFieldName] === FirestoreFieldType.Array ||
|
|
1318
|
+
!this.fields[firestoreFieldName]))
|
|
1319
|
+
return [where(firestoreFieldName, 'array-contains', options.value)];
|
|
1934
1320
|
if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value)) {
|
|
1935
|
-
return Object.keys(options).reduce((
|
|
1321
|
+
return Object.keys(options).reduce((queries, key) => [
|
|
1322
|
+
...queries,
|
|
1323
|
+
...this.buildWhereSentence(`${fieldName.toString()}.${key}`, is(options)[key]),
|
|
1324
|
+
], []);
|
|
1936
1325
|
}
|
|
1937
|
-
return
|
|
1326
|
+
return [where(firestoreFieldName, (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options)];
|
|
1327
|
+
};
|
|
1328
|
+
this.makeFirestoreOrderBy = (filters, fieldsToOrderBy) => {
|
|
1329
|
+
const orderByKeys = Object.keys(fieldsToOrderBy || {});
|
|
1330
|
+
if (!orderByKeys.length)
|
|
1331
|
+
return [];
|
|
1332
|
+
const filtersKeysWithUnordered = Object.keys(filters || {}).filter((filterKey) => !orderByKeys.includes(filterKey));
|
|
1333
|
+
if (filtersKeysWithUnordered.length)
|
|
1334
|
+
filtersKeysWithUnordered.forEach((filterKey) => (fieldsToOrderBy = Object.assign(Object.assign({}, (![Where.EQUALS].includes(is(filters[filterKey]).operator)
|
|
1335
|
+
? { [filterKey]: 'asc' }
|
|
1336
|
+
: {})), fieldsToOrderBy)));
|
|
1337
|
+
return Object.keys(fieldsToOrderBy).map((fieldName) => orderBy(fieldName, fieldsToOrderBy[fieldName]));
|
|
1938
1338
|
};
|
|
1939
1339
|
}
|
|
1940
|
-
find({ filters, limits, orderBy,
|
|
1941
|
-
var _a;
|
|
1340
|
+
find({ filters, limits, orderBy, } = {}) {
|
|
1942
1341
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1943
|
-
const
|
|
1944
|
-
const
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
if (filtersKeysWithUnordered.length)
|
|
1950
|
-
filtersKeysWithUnordered.forEach((filterKey) => (orderBy = Object.assign(Object.assign({}, (![Where.EQUALS].includes(filters[filterKey].operator) ? { [filterKey]: 'asc' } : {})), orderBy)));
|
|
1951
|
-
Object.keys(orderBy).forEach((fieldName) => (query = query.orderBy(fieldName, orderBy[fieldName])));
|
|
1952
|
-
}
|
|
1953
|
-
query = yield this.defineLimits(query, filters, limits);
|
|
1954
|
-
const docs = yield query.get();
|
|
1342
|
+
const collection = this.collection(this.buildCollectionPathForFind(filters));
|
|
1343
|
+
const queries = this.makeFirestoreWhere(filters || {});
|
|
1344
|
+
const ordination = this.makeFirestoreOrderBy(filters, orderBy);
|
|
1345
|
+
const offsets = yield this.defineLimits(filters, limits);
|
|
1346
|
+
const queryArgumments = [...queries, ...ordination, ...offsets];
|
|
1347
|
+
const docs = yield getDocs(query(collection, ...queryArgumments));
|
|
1955
1348
|
const data = docs.docs.map((doc) => doc.data());
|
|
1956
1349
|
return {
|
|
1957
1350
|
data,
|
|
1958
|
-
count:
|
|
1351
|
+
count: this.calculateCount(data, limits),
|
|
1959
1352
|
};
|
|
1960
1353
|
});
|
|
1961
1354
|
}
|
|
@@ -1966,19 +1359,18 @@ const withFindFirestore = (MixinBase) => {
|
|
|
1966
1359
|
const parentId = getValueFromFilter(filters === null || filters === void 0 ? void 0 : filters[parentIdField]);
|
|
1967
1360
|
return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
|
|
1968
1361
|
}
|
|
1969
|
-
defineLimits(
|
|
1362
|
+
defineLimits(filters, limits) {
|
|
1970
1363
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1364
|
+
const queries = [];
|
|
1971
1365
|
if (limits === null || limits === void 0 ? void 0 : limits.offset) {
|
|
1972
1366
|
if (this.model.isModel(limits.offset))
|
|
1973
|
-
|
|
1974
|
-
.doc(limits.offset[limits.offset.identifiersFields.shift()])
|
|
1975
|
-
.get());
|
|
1367
|
+
queries.push(startAfter(yield getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), limits.offset.identifier.shift()))));
|
|
1976
1368
|
else if (isNumber(limits.offset) || isString(limits.offset))
|
|
1977
|
-
|
|
1369
|
+
queries.push(startAt(limits.offset));
|
|
1978
1370
|
}
|
|
1979
1371
|
if (limits === null || limits === void 0 ? void 0 : limits.limit)
|
|
1980
|
-
|
|
1981
|
-
return
|
|
1372
|
+
queries.push(limit(limits.limit));
|
|
1373
|
+
return queries;
|
|
1982
1374
|
});
|
|
1983
1375
|
}
|
|
1984
1376
|
calculateCount(data, limits) {
|
|
@@ -1996,19 +1388,20 @@ const withCreateFirestore = (MixinBase) => {
|
|
|
1996
1388
|
create(data) {
|
|
1997
1389
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1998
1390
|
const docRef = yield this.save(this.model.toInstance(data));
|
|
1999
|
-
const doc = yield docRef
|
|
1391
|
+
const doc = yield getDoc(docRef);
|
|
2000
1392
|
return doc.data();
|
|
2001
1393
|
});
|
|
2002
1394
|
}
|
|
2003
1395
|
save(data) {
|
|
2004
1396
|
var _a, _b;
|
|
2005
1397
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2006
|
-
const id = (_b = (_a =
|
|
1398
|
+
const id = (_b = data.identifier[(_a = data.identifiersFields) === null || _a === void 0 ? void 0 : _a.shift()]) === null || _b === void 0 ? void 0 : _b.toString();
|
|
2007
1399
|
const collectionPath = this.buildCollectionPathForAdd(data);
|
|
1400
|
+
const collection = this.collection(collectionPath);
|
|
2008
1401
|
if (isEmpty(id))
|
|
2009
|
-
return
|
|
2010
|
-
const docRef =
|
|
2011
|
-
yield docRef
|
|
1402
|
+
return addDoc(collection, data);
|
|
1403
|
+
const docRef = doc(collection, id);
|
|
1404
|
+
yield setDoc(docRef, data);
|
|
2012
1405
|
return docRef;
|
|
2013
1406
|
});
|
|
2014
1407
|
}
|
|
@@ -2021,30 +1414,36 @@ const withCreateFirestore = (MixinBase) => {
|
|
|
2021
1414
|
};
|
|
2022
1415
|
|
|
2023
1416
|
const withUpdateFirestore = (MixinBase) => {
|
|
2024
|
-
const getValueFromParams = (params, field) => {
|
|
1417
|
+
const getValueFromParams = (params, field) => {
|
|
1418
|
+
var _a;
|
|
1419
|
+
return (isNil((_a = is(params[field])) === null || _a === void 0 ? void 0 : _a.value)
|
|
1420
|
+
? is(params[field])
|
|
1421
|
+
: is(params[field]).value) || null;
|
|
1422
|
+
};
|
|
2025
1423
|
const getValueByAction = (options) => {
|
|
2026
|
-
|
|
2027
|
-
if (isNil(options.action))
|
|
1424
|
+
if (isNil(options === null || options === void 0 ? void 0 : options.action))
|
|
2028
1425
|
return options;
|
|
2029
|
-
if (options.action === UpdateOptionActions.REMOVE_FIELD)
|
|
2030
|
-
return
|
|
2031
|
-
if (
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
if (options.action === UpdateOptionActions.
|
|
2035
|
-
return
|
|
1426
|
+
if ((options === null || options === void 0 ? void 0 : options.action) === UpdateOptionActions.REMOVE_FIELD)
|
|
1427
|
+
return deleteField();
|
|
1428
|
+
if ((options === null || options === void 0 ? void 0 : options.action) === UpdateOptionActions.NULL)
|
|
1429
|
+
return null;
|
|
1430
|
+
if (Array.isArray(options === null || options === void 0 ? void 0 : options.value)) {
|
|
1431
|
+
if ((options === null || options === void 0 ? void 0 : options.action) === UpdateOptionActions.MERGE)
|
|
1432
|
+
return arrayUnion(...options.value);
|
|
1433
|
+
if ((options === null || options === void 0 ? void 0 : options.action) === UpdateOptionActions.REMOVE)
|
|
1434
|
+
return arrayRemove(...options.value);
|
|
2036
1435
|
}
|
|
2037
|
-
return options.value;
|
|
1436
|
+
return options === null || options === void 0 ? void 0 : options.value;
|
|
2038
1437
|
};
|
|
2039
1438
|
return class UpdateFirestore extends MixinBase {
|
|
2040
1439
|
update(data) {
|
|
2041
1440
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2042
1441
|
const model = new this.model();
|
|
2043
1442
|
const keyField = model.identifiersFields.shift();
|
|
2044
|
-
const docRef = this.collection(this.buildCollectionPathForUpdate(data))
|
|
2045
|
-
yield docRef
|
|
2046
|
-
const
|
|
2047
|
-
return
|
|
1443
|
+
const docRef = doc(this.collection(this.buildCollectionPathForUpdate(data)), getValueFromParams(data, keyField).toString());
|
|
1444
|
+
yield setDoc(docRef, this.paramsToPlain(data), { merge: true });
|
|
1445
|
+
const docData = yield getDoc(docRef);
|
|
1446
|
+
return docData.data();
|
|
2048
1447
|
});
|
|
2049
1448
|
}
|
|
2050
1449
|
buildCollectionPathForUpdate(identifiers) {
|
|
@@ -2056,7 +1455,7 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
2056
1455
|
const model = this.model;
|
|
2057
1456
|
if (model.isModel(params))
|
|
2058
1457
|
return params.toPlain();
|
|
2059
|
-
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(params[currentKey])
|
|
1458
|
+
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), ((value) => (value === undefined ? {} : { [currentKey]: value }))(getValueByAction(params[currentKey])))), {});
|
|
2060
1459
|
}
|
|
2061
1460
|
};
|
|
2062
1461
|
};
|
|
@@ -2065,9 +1464,7 @@ const withDeleteFirestore = (MixinBase) => {
|
|
|
2065
1464
|
return class DeleteFirestore extends MixinBase {
|
|
2066
1465
|
delete(identifiers) {
|
|
2067
1466
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2068
|
-
yield this.collection(this.buildCollectionPathForRemove(identifiers))
|
|
2069
|
-
.doc(Object.values(identifiers).shift().toString())
|
|
2070
|
-
.delete();
|
|
1467
|
+
yield deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(identifiers).shift().toString()));
|
|
2071
1468
|
});
|
|
2072
1469
|
}
|
|
2073
1470
|
buildCollectionPathForRemove(identifiers) {
|
|
@@ -2193,22 +1590,13 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2193
1590
|
}
|
|
2194
1591
|
getBeautyProfile(userId) {
|
|
2195
1592
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2196
|
-
const beautyProfile = yield this.collection()
|
|
2197
|
-
.doc(userId)
|
|
2198
|
-
.collection('CX')
|
|
2199
|
-
.withConverter(this.buildBeautyProfileModelInstance())
|
|
2200
|
-
.doc('beautyProfile')
|
|
2201
|
-
.get();
|
|
1593
|
+
const beautyProfile = yield getDoc(doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
|
|
2202
1594
|
return beautyProfile.data();
|
|
2203
1595
|
});
|
|
2204
1596
|
}
|
|
2205
1597
|
checkIfIsSubscriber(userId) {
|
|
2206
1598
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2207
|
-
const docs = yield this.
|
|
2208
|
-
.collection('subscription')
|
|
2209
|
-
.where('user.id', '==', userId)
|
|
2210
|
-
.where('status', '==', 'active')
|
|
2211
|
-
.get();
|
|
1599
|
+
const docs = yield getDocs(query(this.collection('subscription'), where('user.id', '==', userId), where('status', '==', 'active')));
|
|
2212
1600
|
return !!docs && !!docs.size;
|
|
2213
1601
|
});
|
|
2214
1602
|
}
|
|
@@ -2239,33 +1627,25 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
|
|
|
2239
1627
|
this.model = Category;
|
|
2240
1628
|
}
|
|
2241
1629
|
getCategoryBySlug(slug, shop) {
|
|
2242
|
-
return this
|
|
2243
|
-
.where('slug', '==', slug)
|
|
2244
|
-
.
|
|
2245
|
-
.where('published', '==', true)
|
|
2246
|
-
.get()
|
|
2247
|
-
.then((snap) => {
|
|
2248
|
-
if (snap.size > 1)
|
|
1630
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1631
|
+
const categoryDocs = yield getDocs(query(this.collection(this.collectionName), where('slug', '==', slug), where('shop', '==', shop), where('published', '==', true)));
|
|
1632
|
+
if (categoryDocs.size > 1)
|
|
2249
1633
|
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
2250
|
-
if (
|
|
1634
|
+
if (categoryDocs.empty)
|
|
2251
1635
|
throw new NotFoundError(`Document with slug ${slug} not found`);
|
|
2252
|
-
return
|
|
2253
|
-
})
|
|
2254
|
-
.catch((error) => error);
|
|
1636
|
+
return categoryDocs.docs[0].data();
|
|
1637
|
+
});
|
|
2255
1638
|
}
|
|
2256
|
-
getCategoriesForHome(categoryIds, limit = 4
|
|
1639
|
+
getCategoriesForHome(categoryIds, limit = 4) {
|
|
2257
1640
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2258
|
-
const categorySnap = yield this.collection(this.collectionName)
|
|
2259
|
-
.where('id', 'in', categoryIds.filter(Boolean))
|
|
2260
|
-
.where('published', '==', true)
|
|
2261
|
-
.get();
|
|
1641
|
+
const categorySnap = yield getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
|
|
2262
1642
|
if (categorySnap.empty)
|
|
2263
1643
|
throw new NotFoundError('Categories not found');
|
|
2264
1644
|
const categories = categorySnap.docs.map((doc) => doc.data());
|
|
2265
1645
|
const homeSections = yield Promise.all(categories.map((category) => __awaiter(this, void 0, void 0, function* () {
|
|
2266
1646
|
return ({
|
|
2267
1647
|
category,
|
|
2268
|
-
products: yield this.mountCategory(category, { limit, hasStock: true
|
|
1648
|
+
products: yield this.mountCategory(category, { limit, hasStock: true }),
|
|
2269
1649
|
});
|
|
2270
1650
|
})));
|
|
2271
1651
|
return homeSections;
|
|
@@ -2277,35 +1657,23 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
|
|
|
2277
1657
|
throw new RequiredArgumentError(['Category products is empty']);
|
|
2278
1658
|
const chunks = chunk(category.products, 10);
|
|
2279
1659
|
const products = [];
|
|
1660
|
+
const wheres = [];
|
|
2280
1661
|
for (const productIds of chunks) {
|
|
2281
1662
|
if ((options === null || options === void 0 ? void 0 : options.limit) && products.length >= (options === null || options === void 0 ? void 0 : options.limit))
|
|
2282
1663
|
break;
|
|
2283
|
-
|
|
2284
|
-
.where('published', '==', true)
|
|
2285
|
-
.where('id', 'in', productIds);
|
|
1664
|
+
wheres.push(where('published', '==', true), where('id', 'in', productIds));
|
|
2286
1665
|
if (options === null || options === void 0 ? void 0 : options.hasStock)
|
|
2287
|
-
|
|
2288
|
-
if (options === null || options === void 0 ? void 0 : options.gender)
|
|
2289
|
-
query = query.where('tags', 'array-contains', options === null || options === void 0 ? void 0 : options.gender);
|
|
1666
|
+
wheres.push(where('stock.quantity', '>', 0));
|
|
2290
1667
|
if (options === null || options === void 0 ? void 0 : options.limit)
|
|
2291
|
-
|
|
2292
|
-
const productSnap = yield query.
|
|
1668
|
+
wheres.push(limit(options === null || options === void 0 ? void 0 : options.limit));
|
|
1669
|
+
const productSnap = yield getDocs(query(this.collection('productsErpVitrine'), ...wheres));
|
|
2293
1670
|
if (productSnap.empty)
|
|
2294
1671
|
continue;
|
|
2295
|
-
products.push(...productSnap.docs
|
|
1672
|
+
products.push(...productSnap.docs);
|
|
2296
1673
|
}
|
|
2297
|
-
return products;
|
|
1674
|
+
return is(products);
|
|
2298
1675
|
});
|
|
2299
1676
|
}
|
|
2300
|
-
getCategoryByShop(shop) {
|
|
2301
|
-
return;
|
|
2302
|
-
}
|
|
2303
|
-
getChildren(parentId) {
|
|
2304
|
-
return;
|
|
2305
|
-
}
|
|
2306
|
-
isChild(id, parentId) {
|
|
2307
|
-
return;
|
|
2308
|
-
}
|
|
2309
1677
|
}
|
|
2310
1678
|
|
|
2311
1679
|
class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
@@ -2349,17 +1717,12 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
2349
1717
|
return this.reviews.rejected.push(Object.assign(Object.assign({}, review), productInfo));
|
|
2350
1718
|
if (!!review.status)
|
|
2351
1719
|
return this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
|
|
1720
|
+
return review;
|
|
2352
1721
|
});
|
|
2353
1722
|
});
|
|
2354
1723
|
return this.reviews[status];
|
|
2355
1724
|
});
|
|
2356
1725
|
}
|
|
2357
|
-
cleanShoppingCountFromIds(ids) {
|
|
2358
|
-
return;
|
|
2359
|
-
}
|
|
2360
|
-
findCatalog(params) {
|
|
2361
|
-
return this.find(params);
|
|
2362
|
-
}
|
|
2363
1726
|
}
|
|
2364
1727
|
|
|
2365
1728
|
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
|
|
@@ -2382,33 +1745,6 @@ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpe
|
|
|
2382
1745
|
}
|
|
2383
1746
|
}
|
|
2384
1747
|
|
|
2385
|
-
class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2386
|
-
constructor(firestore) {
|
|
2387
|
-
super();
|
|
2388
|
-
this.firestore = firestore;
|
|
2389
|
-
this.collectionName = 'buy2win';
|
|
2390
|
-
this.model = Buy2Win;
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
|
|
2394
|
-
class CampaignDashboardFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2395
|
-
constructor(firestore) {
|
|
2396
|
-
super();
|
|
2397
|
-
this.firestore = firestore;
|
|
2398
|
-
this.collectionName = 'dashboardCampaignsAuto';
|
|
2399
|
-
this.model = CampaignDashboard;
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
class CampaignHashtagFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2404
|
-
constructor(firestore) {
|
|
2405
|
-
super();
|
|
2406
|
-
this.firestore = firestore;
|
|
2407
|
-
this.collectionName = 'hashtagCampaignsAuto';
|
|
2408
|
-
this.model = CampaignHashtag;
|
|
2409
|
-
}
|
|
2410
|
-
}
|
|
2411
|
-
|
|
2412
1748
|
class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2413
1749
|
constructor(firestore) {
|
|
2414
1750
|
super();
|
|
@@ -2418,15 +1754,6 @@ class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFire
|
|
|
2418
1754
|
}
|
|
2419
1755
|
}
|
|
2420
1756
|
|
|
2421
|
-
class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2422
|
-
constructor(firestore) {
|
|
2423
|
-
super();
|
|
2424
|
-
this.firestore = firestore;
|
|
2425
|
-
this.collectionName = 'checkoutsSubscription';
|
|
2426
|
-
this.model = CheckoutSubscription;
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
|
|
2430
1757
|
class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2431
1758
|
constructor(firestore) {
|
|
2432
1759
|
super();
|
|
@@ -2461,11 +1788,10 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
|
|
|
2461
1788
|
var _a;
|
|
2462
1789
|
if (!!((_a = order === null || order === void 0 ? void 0 : order.lineItems) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
2463
1790
|
order.lineItems = order.lineItems.map((lineItem) => {
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
lineItem
|
|
2468
|
-
}
|
|
1791
|
+
const prices = !!lineItem.price;
|
|
1792
|
+
const shopPrice = prices[order.shop];
|
|
1793
|
+
if (!!shopPrice)
|
|
1794
|
+
lineItem.price = shopPrice;
|
|
2469
1795
|
return lineItem;
|
|
2470
1796
|
});
|
|
2471
1797
|
}
|
|
@@ -2489,20 +1815,21 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
|
|
|
2489
1815
|
}
|
|
2490
1816
|
}
|
|
2491
1817
|
|
|
2492
|
-
class
|
|
1818
|
+
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2493
1819
|
constructor(firestore) {
|
|
2494
|
-
super(
|
|
1820
|
+
super();
|
|
2495
1821
|
this.firestore = firestore;
|
|
2496
|
-
this.collectionName = '
|
|
1822
|
+
this.collectionName = 'payments';
|
|
1823
|
+
this.model = Payment;
|
|
2497
1824
|
}
|
|
2498
1825
|
}
|
|
2499
1826
|
|
|
2500
|
-
class
|
|
1827
|
+
class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2501
1828
|
constructor(firestore) {
|
|
2502
1829
|
super();
|
|
2503
1830
|
this.firestore = firestore;
|
|
2504
|
-
this.collectionName = '
|
|
2505
|
-
this.model =
|
|
1831
|
+
this.collectionName = 'checkoutsSubscription';
|
|
1832
|
+
this.model = CheckoutSubscription;
|
|
2506
1833
|
}
|
|
2507
1834
|
}
|
|
2508
1835
|
|
|
@@ -2515,6 +1842,23 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
|
|
|
2515
1842
|
}
|
|
2516
1843
|
}
|
|
2517
1844
|
|
|
1845
|
+
class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1846
|
+
constructor(firestore) {
|
|
1847
|
+
super();
|
|
1848
|
+
this.firestore = firestore;
|
|
1849
|
+
this.collectionName = 'buy2win';
|
|
1850
|
+
this.model = Buy2Win;
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
1855
|
+
constructor(firestore) {
|
|
1856
|
+
super(firestore);
|
|
1857
|
+
this.firestore = firestore;
|
|
1858
|
+
this.collectionName = 'legacyOrders';
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
|
|
2518
1862
|
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2519
1863
|
constructor(firestore) {
|
|
2520
1864
|
super();
|
|
@@ -2539,9 +1883,9 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2539
1883
|
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
2540
1884
|
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
2541
1885
|
home.data.createdAt =
|
|
2542
|
-
home.data.createdAt instanceof
|
|
1886
|
+
home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
2543
1887
|
home.data.expiresAt =
|
|
2544
|
-
home.data.expiresAt instanceof
|
|
1888
|
+
home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
2545
1889
|
}
|
|
2546
1890
|
return home;
|
|
2547
1891
|
};
|
|
@@ -2576,22 +1920,13 @@ class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFire
|
|
|
2576
1920
|
}
|
|
2577
1921
|
}
|
|
2578
1922
|
|
|
2579
|
-
class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2580
|
-
constructor(firestore) {
|
|
2581
|
-
super();
|
|
2582
|
-
this.firestore = firestore;
|
|
2583
|
-
this.collectionName = 'shopSettings';
|
|
2584
|
-
this.model = ShopSettings;
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
1923
|
class AuthenticationFirebaseAuthService {
|
|
2589
1924
|
constructor(firebaseAuth) {
|
|
2590
1925
|
this.firebaseAuth = firebaseAuth;
|
|
2591
1926
|
}
|
|
2592
1927
|
signInWithEmailAndPassword(data) {
|
|
2593
1928
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2594
|
-
const credentials = yield this.firebaseAuth
|
|
1929
|
+
const credentials = yield signInWithEmailAndPassword(this.firebaseAuth, data.email, data.password);
|
|
2595
1930
|
const user = credentials.user;
|
|
2596
1931
|
return {
|
|
2597
1932
|
id: user.uid,
|
|
@@ -2604,7 +1939,7 @@ class AuthenticationFirebaseAuthService {
|
|
|
2604
1939
|
}
|
|
2605
1940
|
signInWithGoogle() {
|
|
2606
1941
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2607
|
-
const credentials = yield this.firebaseAuth
|
|
1942
|
+
const credentials = yield signInWithPopup(this.firebaseAuth, new GoogleAuthProvider());
|
|
2608
1943
|
const user = credentials.user;
|
|
2609
1944
|
return {
|
|
2610
1945
|
id: user.uid,
|
|
@@ -2622,7 +1957,7 @@ class AuthenticationFirebaseAuthService {
|
|
|
2622
1957
|
}
|
|
2623
1958
|
signInAnonymously() {
|
|
2624
1959
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2625
|
-
const auth = yield this.firebaseAuth
|
|
1960
|
+
const auth = yield signInAnonymously(this.firebaseAuth);
|
|
2626
1961
|
const user = auth.user;
|
|
2627
1962
|
user.id = auth.user.uid;
|
|
2628
1963
|
return user;
|
|
@@ -2630,7 +1965,7 @@ class AuthenticationFirebaseAuthService {
|
|
|
2630
1965
|
}
|
|
2631
1966
|
sendPasswordResetEmail(email) {
|
|
2632
1967
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2633
|
-
return this.firebaseAuth
|
|
1968
|
+
return sendPasswordResetEmail(this.firebaseAuth, email);
|
|
2634
1969
|
});
|
|
2635
1970
|
}
|
|
2636
1971
|
}
|
|
@@ -2641,17 +1976,24 @@ class RegisterFirebaseAuthService {
|
|
|
2641
1976
|
}
|
|
2642
1977
|
register(params) {
|
|
2643
1978
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1979
|
+
if (!params.email)
|
|
1980
|
+
throw new RequiredArgumentError(['email']);
|
|
2644
1981
|
try {
|
|
2645
|
-
const auth = yield this.firebaseAuth
|
|
2646
|
-
const user = auth.user;
|
|
2647
|
-
user
|
|
2648
|
-
|
|
1982
|
+
const auth = yield createUserWithEmailAndPassword(this.firebaseAuth, params.email, params.password);
|
|
1983
|
+
const user = is(auth.user);
|
|
1984
|
+
if (!user)
|
|
1985
|
+
throw new Error('User not created');
|
|
1986
|
+
yield sendEmailVerification(user);
|
|
1987
|
+
user.id = user.uid;
|
|
2649
1988
|
return user;
|
|
2650
1989
|
}
|
|
2651
1990
|
catch (error) {
|
|
2652
|
-
if (error
|
|
1991
|
+
if (!(error instanceof Error))
|
|
1992
|
+
throw error;
|
|
1993
|
+
const firebaseError = error;
|
|
1994
|
+
if (firebaseError.code === 'auth/email-already-in-use')
|
|
2653
1995
|
throw new UserAlreadyRegisteredError('Email already registered');
|
|
2654
|
-
if (
|
|
1996
|
+
if (firebaseError.code === 'auth/weak-password')
|
|
2655
1997
|
throw new WeakPasswordError();
|
|
2656
1998
|
throw error;
|
|
2657
1999
|
}
|
|
@@ -2662,27 +2004,28 @@ class RegisterFirebaseAuthService {
|
|
|
2662
2004
|
class AttributeOptionHelper {
|
|
2663
2005
|
}
|
|
2664
2006
|
AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
|
|
2007
|
+
var _a;
|
|
2665
2008
|
if (fields.includes(attributeName))
|
|
2666
|
-
return { columnName: attributeName.toString(), attributeName
|
|
2009
|
+
return { columnName: attributeName.toString(), attributeName };
|
|
2667
2010
|
const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
|
|
2668
|
-
const fieldOption = field === null ||
|
|
2011
|
+
const fieldOption = (_a = is(field)) === null || _a === void 0 ? void 0 : _a[attributeName];
|
|
2669
2012
|
if (isNil(fieldOption))
|
|
2670
2013
|
return { columnName: attributeName.toString(), attributeName };
|
|
2671
2014
|
if (Array.isArray(fieldOption))
|
|
2672
2015
|
return { columnName: attributeName.toString(), attributeName, fields: fieldOption };
|
|
2673
2016
|
return Object.assign({ attributeName, columnName: attributeName.toString() }, fieldOption);
|
|
2674
2017
|
};
|
|
2675
|
-
AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!
|
|
2018
|
+
AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue.columnName;
|
|
2676
2019
|
AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
|
|
2677
2020
|
if (fields.includes(columnName))
|
|
2678
2021
|
return { columnName, attributeName: columnName };
|
|
2679
|
-
const field = fields.find((
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2022
|
+
const field = is(fields.find((field) => {
|
|
2023
|
+
if (!isObject(field))
|
|
2024
|
+
return false;
|
|
2025
|
+
const columnOption = Object.values(field).find((option) => AttributeOptionHelper.CheckIsColumnOption(option) && option.columnName === columnName ? option : {});
|
|
2026
|
+
return AttributeOptionHelper.CheckIsColumnOption(columnOption) && (columnOption === null || columnOption === void 0 ? void 0 : columnOption.columnName) === columnName;
|
|
2027
|
+
}) || {});
|
|
2028
|
+
const attributeName = Object.keys(field).find((fieldOptionFromList) => AttributeOptionHelper.CheckIsColumnOption(field[fieldOptionFromList]) || Array.isArray(field[fieldOptionFromList]));
|
|
2686
2029
|
const fieldOption = field === null || field === void 0 ? void 0 : field[attributeName];
|
|
2687
2030
|
if (Array.isArray(fieldOption))
|
|
2688
2031
|
return { attributeName: attributeName, fields: fieldOption };
|
|
@@ -2702,6 +2045,8 @@ var HasuraGraphQLWhere;
|
|
|
2702
2045
|
HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
|
|
2703
2046
|
HasuraGraphQLWhere["ISNULL"] = "_is_null";
|
|
2704
2047
|
HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
|
|
2048
|
+
HasuraGraphQLWhere["JSON_CONTAINS"] = "_contains";
|
|
2049
|
+
HasuraGraphQLWhere["JSON_HAS_KEYS_ANY"] = "_has_keys_any";
|
|
2705
2050
|
})(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
|
|
2706
2051
|
|
|
2707
2052
|
var HasuraGraphQLColumnType;
|
|
@@ -2750,23 +2095,22 @@ BindFilterQueryHelper.MakeGraphQLWhere = (filter, fields) => Object.keys(filter)
|
|
|
2750
2095
|
}, {});
|
|
2751
2096
|
BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
|
|
2752
2097
|
const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
|
|
2753
|
-
|
|
2098
|
+
if (!Array.isArray(options) &&
|
|
2754
2099
|
isObject(options) &&
|
|
2755
2100
|
isNil(options === null || options === void 0 ? void 0 : options.operator) &&
|
|
2756
2101
|
isNil(options === null || options === void 0 ? void 0 : options.value) &&
|
|
2757
|
-
isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to)
|
|
2758
|
-
if (isNestedField)
|
|
2102
|
+
isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to))
|
|
2759
2103
|
return Object.keys(options).reduce((variables, key) => {
|
|
2760
2104
|
const fieldOptions = AttributeOptionHelper.FindByAttribute(key, (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || fields);
|
|
2761
2105
|
const columnName = fieldOptions.columnName;
|
|
2762
2106
|
const columnFields = fieldOptions.fields;
|
|
2763
|
-
return Object.assign(Object.assign({}, variables), { [columnName]: BindFilterQueryHelper.BuildWhereSentence(key, options[key],
|
|
2107
|
+
return Object.assign(Object.assign({}, variables), { [columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), columnFields || []) });
|
|
2764
2108
|
}, {});
|
|
2765
2109
|
if (!Array.isArray(options) && !isNil(fieldSentenceOptions.fields))
|
|
2766
2110
|
return {
|
|
2767
2111
|
[fieldSentenceOptions.fields[0]]: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
|
|
2768
2112
|
};
|
|
2769
|
-
if (
|
|
2113
|
+
if (isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
|
|
2770
2114
|
options = Object.values(options)[0];
|
|
2771
2115
|
return Array.isArray(options)
|
|
2772
2116
|
? options.reduce((whereSentence, option) => (Object.assign(Object.assign({}, whereSentence), BindFilterQueryHelper.BuildOperatorSentence(option, fieldSentenceOptions))), {})
|
|
@@ -2775,20 +2119,18 @@ BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
|
|
|
2775
2119
|
BindFilterQueryHelper.BuildOperatorSentence = (options, fieldOption) => ({
|
|
2776
2120
|
[BindFilterQueryHelper.GetHasuraOperator(options, fieldOption)]: FilterOptionHelper.GetValueFromFilter(options, fieldOption),
|
|
2777
2121
|
});
|
|
2778
|
-
BindFilterQueryHelper.GetHasuraOperator = (options, fieldOption) =>
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
return HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator === Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))];
|
|
2791
|
-
};
|
|
2122
|
+
BindFilterQueryHelper.GetHasuraOperator = (options, fieldOption) => FilterOptionHelper.CheckIfIsFilterOption(options)
|
|
2123
|
+
? fieldOption.type === HasuraGraphQLColumnType.Jsonb
|
|
2124
|
+
? BindFilterQueryHelper.GetHasuraJsonbOperator(options)
|
|
2125
|
+
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator ===
|
|
2126
|
+
Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))]
|
|
2127
|
+
: HasuraGraphQLWhere.EQUALS;
|
|
2128
|
+
BindFilterQueryHelper.GetHasuraJsonbOperator = (options) => options.operator === Where.IN
|
|
2129
|
+
? HasuraGraphQLWhere.JSON_CONTAINS
|
|
2130
|
+
: options.operator === Where.LIKE
|
|
2131
|
+
? HasuraGraphQLWhere.JSON_HAS_KEYS_ANY
|
|
2132
|
+
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator ===
|
|
2133
|
+
Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))];
|
|
2792
2134
|
|
|
2793
2135
|
class GraphQLFieldHelper {
|
|
2794
2136
|
}
|
|
@@ -2797,15 +2139,31 @@ GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = (fields) => {
|
|
|
2797
2139
|
return fields === null || fields === void 0 ? void 0 : fields.map((field) => {
|
|
2798
2140
|
if (isString(field))
|
|
2799
2141
|
return field.toString();
|
|
2142
|
+
if (field === 'affected_rows')
|
|
2143
|
+
return field;
|
|
2800
2144
|
const fieldName = Object.keys(field).shift();
|
|
2801
2145
|
const fieldValue = field[fieldName];
|
|
2802
2146
|
if (Array.isArray(fieldValue))
|
|
2803
2147
|
return { [fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue) };
|
|
2804
2148
|
if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
|
|
2805
|
-
return;
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2149
|
+
return null;
|
|
2150
|
+
if (fieldValue.fields)
|
|
2151
|
+
return !fieldValue.filters
|
|
2152
|
+
? {
|
|
2153
|
+
[fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
2154
|
+
}
|
|
2155
|
+
: {
|
|
2156
|
+
operation: fieldValue.columnName || fieldName,
|
|
2157
|
+
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
2158
|
+
variables: {
|
|
2159
|
+
[`${fieldValue.columnName}_where`]: {
|
|
2160
|
+
name: 'where',
|
|
2161
|
+
type: fieldValue.filters.filterType,
|
|
2162
|
+
value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
|
|
2163
|
+
required: true,
|
|
2164
|
+
},
|
|
2165
|
+
},
|
|
2166
|
+
};
|
|
2809
2167
|
return fieldValue.columnName;
|
|
2810
2168
|
}).filter((field) => !!field);
|
|
2811
2169
|
};
|
|
@@ -2815,15 +2173,15 @@ GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).r
|
|
|
2815
2173
|
if (Array.isArray(data[columnName]))
|
|
2816
2174
|
return Object.assign(Object.assign({}, result), { [attributeName]: from
|
|
2817
2175
|
? from(data[columnName], data)
|
|
2818
|
-
: data[columnName].map((value) => GraphQLFieldHelper.ConvertFieldValueFrom(value, attributeFields)) });
|
|
2176
|
+
: is(data[columnName]).map((value) => GraphQLFieldHelper.ConvertFieldValueFrom(is(value), attributeFields)) });
|
|
2819
2177
|
if (isObject(data[columnName]))
|
|
2820
2178
|
return Object.assign(Object.assign({}, result), { [attributeName]: !!from
|
|
2821
2179
|
? from(data[columnName])
|
|
2822
|
-
: GraphQLFieldHelper.ConvertFieldValueFrom(data[columnName], attributeFields) });
|
|
2180
|
+
: GraphQLFieldHelper.ConvertFieldValueFrom(is(data[columnName]), attributeFields) });
|
|
2823
2181
|
}
|
|
2824
2182
|
if (!!from)
|
|
2825
2183
|
return Object.assign(Object.assign({}, result), { [attributeName]: from(data[columnName], data) });
|
|
2826
|
-
return Object.assign(Object.assign({}, result), { [attributeName]: parseDateTime(data[columnName]) });
|
|
2184
|
+
return Object.assign(Object.assign({}, result), { [attributeName]: parseDateTime(data[columnName].toString()) });
|
|
2827
2185
|
}, {});
|
|
2828
2186
|
GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
|
|
2829
2187
|
var _a;
|
|
@@ -2836,16 +2194,22 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
|
|
|
2836
2194
|
return result;
|
|
2837
2195
|
if (!!foreignKeyColumn &&
|
|
2838
2196
|
!isEmpty(foreignKeyColumn) &&
|
|
2839
|
-
!Object.keys(foreignKeyColumn).filter((key) => { var _a; return !((_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[key]); }).length)
|
|
2197
|
+
!Object.keys(foreignKeyColumn).filter((key) => { var _a; return !((_a = is(data[attributeName])) === null || _a === void 0 ? void 0 : _a[key]); }).length)
|
|
2840
2198
|
return Object.keys(foreignKeyColumn).reduce((object, current) => {
|
|
2841
2199
|
var _a;
|
|
2842
|
-
|
|
2843
|
-
return Object.assign(Object.assign({}, object), { [foreignColumnName]: (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current] });
|
|
2200
|
+
return (Object.assign(Object.assign({}, object), { [foreignKeyColumn[current]]: (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current] }));
|
|
2844
2201
|
}, Object.assign({}, result));
|
|
2845
|
-
if (update &&
|
|
2202
|
+
if (update &&
|
|
2203
|
+
isObject(data[attributeName]) &&
|
|
2204
|
+
!isNil(attributeFields) &&
|
|
2205
|
+
!isDate(data[attributeName]))
|
|
2846
2206
|
return result;
|
|
2847
|
-
if (!!columnName &&
|
|
2848
|
-
|
|
2207
|
+
if (!!columnName &&
|
|
2208
|
+
Array.isArray(attributeFields) &&
|
|
2209
|
+
isObject(data[attributeName])) {
|
|
2210
|
+
const converted = !isNil(columnName) && to
|
|
2211
|
+
? to(instance[attributeName], instance)
|
|
2212
|
+
: data[attributeName];
|
|
2849
2213
|
return Object.assign(Object.assign({}, result), (converted !== undefined
|
|
2850
2214
|
? {
|
|
2851
2215
|
[columnName]: {
|
|
@@ -2861,25 +2225,6 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
|
|
|
2861
2225
|
return Object.assign(Object.assign({}, result), { [columnName]: data[attributeName] });
|
|
2862
2226
|
}, {});
|
|
2863
2227
|
};
|
|
2864
|
-
GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields = (fieldName, fieldValue) => {
|
|
2865
|
-
const hasCustomFilters = !!fieldValue.filters;
|
|
2866
|
-
if (hasCustomFilters)
|
|
2867
|
-
return {
|
|
2868
|
-
operation: fieldValue.columnName || fieldName,
|
|
2869
|
-
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
2870
|
-
variables: {
|
|
2871
|
-
[`${fieldValue.columnName}_where`]: {
|
|
2872
|
-
name: 'where',
|
|
2873
|
-
type: fieldValue.filters.filterType,
|
|
2874
|
-
value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
|
|
2875
|
-
required: true,
|
|
2876
|
-
},
|
|
2877
|
-
},
|
|
2878
|
-
};
|
|
2879
|
-
return {
|
|
2880
|
-
[fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
2881
|
-
};
|
|
2882
|
-
};
|
|
2883
2228
|
|
|
2884
2229
|
const withCreateHasuraGraphQL = (MixinBase) => {
|
|
2885
2230
|
return class CreateHasuraGraphQLMixin extends MixinBase {
|
|
@@ -2887,30 +2232,14 @@ const withCreateHasuraGraphQL = (MixinBase) => {
|
|
|
2887
2232
|
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
2888
2233
|
super(...params);
|
|
2889
2234
|
this.insertGraphQLOperation = (options === null || options === void 0 ? void 0 : options.insertGraphQLOperation) || `insert_${this.tableName}_one`;
|
|
2890
|
-
this.insertAllGraphQLOperation = (options === null || options === void 0 ? void 0 : options.insertAllGraphQLOperation) || `insert_${this.tableName}`;
|
|
2891
2235
|
this.insertGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.insertGraphQLObjectType) || `${this.tableName}_insert_input`;
|
|
2892
2236
|
}
|
|
2893
2237
|
create(data) {
|
|
2894
2238
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2895
|
-
this.logger = DebugHelper.from(this, 'create');
|
|
2896
2239
|
const newData = yield this.save(this.model.toInstance(data));
|
|
2897
2240
|
return this.model.toInstance(newData);
|
|
2898
2241
|
});
|
|
2899
2242
|
}
|
|
2900
|
-
createAll(data) {
|
|
2901
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2902
|
-
this.logger = DebugHelper.from(this, 'createAll');
|
|
2903
|
-
const result = yield this.mutation(this.insertAllGraphQLOperation, [{ returning: this.model.identifiersFields }], {
|
|
2904
|
-
objects: {
|
|
2905
|
-
type: this.insertGraphQLObjectType,
|
|
2906
|
-
required: true,
|
|
2907
|
-
list: true,
|
|
2908
|
-
value: data.map((item) => this.convertDataToHasura(item)),
|
|
2909
|
-
},
|
|
2910
|
-
});
|
|
2911
|
-
return result[this.insertAllGraphQLOperation].returning.map((item, index) => this.model.toInstance(Object.assign(Object.assign({}, data[index]), item)));
|
|
2912
|
-
});
|
|
2913
|
-
}
|
|
2914
2243
|
save(data) {
|
|
2915
2244
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2916
2245
|
const primaryKeyColumns = this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName);
|
|
@@ -2919,11 +2248,12 @@ const withCreateHasuraGraphQL = (MixinBase) => {
|
|
|
2919
2248
|
const columnOptions = Object.values(field).shift();
|
|
2920
2249
|
return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
|
|
2921
2250
|
columnOptions.foreignKeyColumn && [
|
|
2922
|
-
...Object.values(columnOptions.foreignKeyColumn)
|
|
2251
|
+
...Object.values(columnOptions.foreignKeyColumn),
|
|
2923
2252
|
{
|
|
2924
2253
|
[columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => {
|
|
2925
2254
|
var _a;
|
|
2926
|
-
return ((_a = AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions === null || columnOptions === void 0 ? void 0 : columnOptions.fields)) === null || _a === void 0 ? void 0 : _a.columnName) ||
|
|
2255
|
+
return ((_a = AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions === null || columnOptions === void 0 ? void 0 : columnOptions.fields)) === null || _a === void 0 ? void 0 : _a.columnName) ||
|
|
2256
|
+
foreignKeyField;
|
|
2927
2257
|
}),
|
|
2928
2258
|
},
|
|
2929
2259
|
]);
|
|
@@ -2948,14 +2278,12 @@ const withDeleteHasuraGraphQL = (MixinBase) => {
|
|
|
2948
2278
|
}
|
|
2949
2279
|
delete(identifiers) {
|
|
2950
2280
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2951
|
-
this.logger = DebugHelper.from(this, 'delete');
|
|
2952
2281
|
const instance = this.model.toInstance(identifiers);
|
|
2953
2282
|
yield this.mutation(this.deleteGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), this.model.identifiersFields.reduce((ids, identifier) => {
|
|
2954
|
-
|
|
2955
|
-
if (isNil(instance[identifierBinded]))
|
|
2283
|
+
if (isNil(instance[identifier]))
|
|
2956
2284
|
return ids;
|
|
2957
2285
|
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
2958
|
-
const value = columnOption.to(identifiers[identifier
|
|
2286
|
+
const value = columnOption.to(identifiers[identifier], instance);
|
|
2959
2287
|
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: {
|
|
2960
2288
|
type: this.getAttributeGraphQLTypeOf(columnOption.type || value),
|
|
2961
2289
|
value,
|
|
@@ -2977,7 +2305,6 @@ const withHasuraGraphQL = (MixinBase) => {
|
|
|
2977
2305
|
this.authOptions = options.authOptions;
|
|
2978
2306
|
this.model = options.model;
|
|
2979
2307
|
this.fields = options.fields || this.model.identifiersFields;
|
|
2980
|
-
this.logger = DebugHelper.from(this);
|
|
2981
2308
|
}
|
|
2982
2309
|
get headers() {
|
|
2983
2310
|
return Object.assign(Object.assign(Object.assign({ 'Content-Type': 'application/json' }, (isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken })), (isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret })), (isNil(this.authOptions.authRole)
|
|
@@ -2997,12 +2324,12 @@ const withHasuraGraphQL = (MixinBase) => {
|
|
|
2997
2324
|
query(operation, fields, variables) {
|
|
2998
2325
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2999
2326
|
const resultQuery = GraphQLFieldHelper.CheckIsGraphQLParams(operation)
|
|
3000
|
-
? query(operation.map((option) => ({
|
|
2327
|
+
? query$1(operation.map((option) => ({
|
|
3001
2328
|
operation: option.operation,
|
|
3002
2329
|
variables: option.variables,
|
|
3003
2330
|
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
|
|
3004
2331
|
})))
|
|
3005
|
-
: query({
|
|
2332
|
+
: query$1({
|
|
3006
2333
|
operation,
|
|
3007
2334
|
variables,
|
|
3008
2335
|
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
|
|
@@ -3012,17 +2339,15 @@ const withHasuraGraphQL = (MixinBase) => {
|
|
|
3012
2339
|
}
|
|
3013
2340
|
fetch(params) {
|
|
3014
2341
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3015
|
-
this.logger.with('params').log(params);
|
|
3016
2342
|
const headers = this.headers;
|
|
3017
|
-
const
|
|
3018
|
-
url: `${this.endpoint}`,
|
|
2343
|
+
const response = yield fetch(`${this.endpoint}`, {
|
|
3019
2344
|
method: 'POST',
|
|
3020
|
-
|
|
2345
|
+
body: JSON.stringify(params),
|
|
3021
2346
|
headers,
|
|
3022
2347
|
});
|
|
2348
|
+
const result = yield response.json();
|
|
3023
2349
|
if (!isNil(result.errors))
|
|
3024
2350
|
throw new Error(JSON.stringify(result.errors));
|
|
3025
|
-
this.logger.with('returns').log(result);
|
|
3026
2351
|
return result.data;
|
|
3027
2352
|
});
|
|
3028
2353
|
}
|
|
@@ -3049,8 +2374,8 @@ const withHasuraGraphQL = (MixinBase) => {
|
|
|
3049
2374
|
return value;
|
|
3050
2375
|
return date;
|
|
3051
2376
|
}
|
|
3052
|
-
convertDataFromHasura(data
|
|
3053
|
-
const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data,
|
|
2377
|
+
convertDataFromHasura(data) {
|
|
2378
|
+
const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
|
|
3054
2379
|
return this.model.toInstance(plain);
|
|
3055
2380
|
}
|
|
3056
2381
|
convertDataToHasura(instance, update = false) {
|
|
@@ -3079,7 +2404,6 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
|
|
|
3079
2404
|
}
|
|
3080
2405
|
update(data) {
|
|
3081
2406
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3082
|
-
this.logger = DebugHelper.from(this, 'update');
|
|
3083
2407
|
const plainData = this.paramsToPlain(data);
|
|
3084
2408
|
yield this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), {
|
|
3085
2409
|
_set: {
|
|
@@ -3096,17 +2420,18 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
|
|
|
3096
2420
|
const model = this.model;
|
|
3097
2421
|
if (model.isModel(params))
|
|
3098
2422
|
return params.toPlain();
|
|
3099
|
-
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), (params[currentKey] !== undefined && {
|
|
2423
|
+
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), (params[currentKey] !== undefined && {
|
|
2424
|
+
[currentKey]: getValueByAction(is(params[currentKey])),
|
|
2425
|
+
}))), {});
|
|
3100
2426
|
}
|
|
3101
2427
|
getUpdateModelKeys(data) {
|
|
3102
2428
|
const instance = this.model.toInstance(data);
|
|
3103
2429
|
return this.model.identifiersFields.reduce((ids, identifier) => {
|
|
3104
2430
|
var _a;
|
|
3105
|
-
|
|
3106
|
-
if (isNil(instance[identifierBinded]))
|
|
2431
|
+
if (isNil(instance[identifier]))
|
|
3107
2432
|
return ids;
|
|
3108
|
-
const columnOption = AttributeOptionHelper.FindByAttribute(
|
|
3109
|
-
const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[
|
|
2433
|
+
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
2434
|
+
const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[identifier], instance)) || data[columnOption.attributeName];
|
|
3110
2435
|
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: value });
|
|
3111
2436
|
}, {});
|
|
3112
2437
|
}
|
|
@@ -3122,15 +2447,14 @@ const withGetHasuraGraphQL = (MixinBase) => {
|
|
|
3122
2447
|
}
|
|
3123
2448
|
get(identifiers) {
|
|
3124
2449
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3125
|
-
this.logger = DebugHelper.from(this, 'get');
|
|
3126
2450
|
const instance = this.model.toInstance(identifiers);
|
|
3127
2451
|
const result = yield this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce((ids, identifier) => {
|
|
3128
2452
|
var _a;
|
|
3129
|
-
|
|
3130
|
-
if (isNil(instance[identifierBinded]))
|
|
2453
|
+
if (isNil(instance[identifier]))
|
|
3131
2454
|
return ids;
|
|
3132
2455
|
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
3133
|
-
const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, identifiers[identifier
|
|
2456
|
+
const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, identifiers[identifier], instance)) ||
|
|
2457
|
+
identifiers[identifier];
|
|
3134
2458
|
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: {
|
|
3135
2459
|
type: this.getAttributeGraphQLTypeOf(columnOption.type || value),
|
|
3136
2460
|
value,
|
|
@@ -3148,42 +2472,10 @@ const withGetHasuraGraphQL = (MixinBase) => {
|
|
|
3148
2472
|
|
|
3149
2473
|
const withFindHasuraGraphQL = (MixinBase) => {
|
|
3150
2474
|
return class FindHasuraGraphQLMixin extends MixinBase {
|
|
3151
|
-
|
|
3152
|
-
super(...arguments);
|
|
3153
|
-
this.bindOrderByAttributes = (orderBy, fields) => Object.keys(orderBy).reduce((acc, current) => (Object.assign(Object.assign({}, acc), { [AttributeOptionHelper.FindByAttribute(current, fields)
|
|
3154
|
-
.columnName]: orderBy[current] })), {});
|
|
3155
|
-
this.bindAggretageAttributes = (aggregates, fields) => {
|
|
3156
|
-
var _a, _b;
|
|
3157
|
-
return [
|
|
3158
|
-
...(((_a = aggregates === null || aggregates === void 0 ? void 0 : aggregates.minimal) === null || _a === void 0 ? void 0 : _a.length)
|
|
3159
|
-
? [
|
|
3160
|
-
{
|
|
3161
|
-
min: this.bindAttributesToColumns(aggregates === null || aggregates === void 0 ? void 0 : aggregates.minimal, fields),
|
|
3162
|
-
},
|
|
3163
|
-
]
|
|
3164
|
-
: []),
|
|
3165
|
-
...(((_b = aggregates === null || aggregates === void 0 ? void 0 : aggregates.maximum) === null || _b === void 0 ? void 0 : _b.length)
|
|
3166
|
-
? [
|
|
3167
|
-
{
|
|
3168
|
-
max: this.bindAttributesToColumns(aggregates === null || aggregates === void 0 ? void 0 : aggregates.maximum, fields),
|
|
3169
|
-
},
|
|
3170
|
-
]
|
|
3171
|
-
: []),
|
|
3172
|
-
];
|
|
3173
|
-
};
|
|
3174
|
-
this.bindDistinctAttributes = (distinct, fields) => this.bindAttributesToColumns(distinct, fields);
|
|
3175
|
-
this.bindAttributesToColumns = (attributes, fields) => attributes.map((attr) => {
|
|
3176
|
-
var _a;
|
|
3177
|
-
return ((_a = AttributeOptionHelper.FindByAttribute(attr.toString().split('.').pop(), fields)) === null || _a === void 0 ? void 0 : _a.columnName) || attr;
|
|
3178
|
-
});
|
|
3179
|
-
}
|
|
3180
|
-
find(params) {
|
|
3181
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2475
|
+
find(options) {
|
|
3182
2476
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3183
|
-
|
|
3184
|
-
const
|
|
3185
|
-
const enableCount = (_a = options === null || options === void 0 ? void 0 : options.enableCount) !== null && _a !== void 0 ? _a : true;
|
|
3186
|
-
const variablesFilters = isNil(filters)
|
|
2477
|
+
const { filters, limits, orderBy } = options || {};
|
|
2478
|
+
const variablesCount = Object.assign(Object.assign({}, (isNil(orderBy) ? {} : { order_by: { type: `${this.tableName}_order_by!`, list: true, value: orderBy } })), (isNil(filters)
|
|
3187
2479
|
? {}
|
|
3188
2480
|
: {
|
|
3189
2481
|
where: {
|
|
@@ -3191,26 +2483,13 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
3191
2483
|
type: `${this.tableName}_bool_exp`,
|
|
3192
2484
|
required: true,
|
|
3193
2485
|
},
|
|
3194
|
-
};
|
|
3195
|
-
const variablesCount = Object.assign(Object.assign({}, (isNil(orderBy)
|
|
3196
|
-
? {}
|
|
3197
|
-
: {
|
|
3198
|
-
order_by: {
|
|
3199
|
-
type: `${this.tableName}_order_by!`,
|
|
3200
|
-
list: true,
|
|
3201
|
-
value: this.bindOrderByAttributes(orderBy, this.fields),
|
|
3202
|
-
},
|
|
3203
|
-
})), variablesFilters);
|
|
2486
|
+
}));
|
|
3204
2487
|
const variables = Object.assign(Object.assign({}, (isNil(limits) ? {} : limits)), variablesCount);
|
|
3205
|
-
const aggregateFields = [
|
|
3206
|
-
...(enableCount ? ['count'] : []),
|
|
3207
|
-
...this.bindAggretageAttributes(params.options, this.fields),
|
|
3208
|
-
];
|
|
3209
2488
|
const result = yield this.query([
|
|
3210
2489
|
{
|
|
3211
2490
|
operation: this.tableName,
|
|
3212
|
-
fields:
|
|
3213
|
-
?
|
|
2491
|
+
fields: options.fields
|
|
2492
|
+
? options.fields
|
|
3214
2493
|
.map((fieldName) => {
|
|
3215
2494
|
var _a;
|
|
3216
2495
|
return (_a = this.fields.find((fieldOption) => fieldOption === fieldName)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName);
|
|
@@ -3219,64 +2498,15 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
3219
2498
|
: this.fields,
|
|
3220
2499
|
variables,
|
|
3221
2500
|
},
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
{
|
|
3228
|
-
aggregate: aggregateFields,
|
|
3229
|
-
},
|
|
3230
|
-
],
|
|
3231
|
-
variables: variablesCount,
|
|
3232
|
-
},
|
|
3233
|
-
]
|
|
3234
|
-
: []),
|
|
3235
|
-
...((!((_b = params.limits) === null || _b === void 0 ? void 0 : _b.offset) &&
|
|
3236
|
-
((_d = (_c = params.options) === null || _c === void 0 ? void 0 : _c.distinct) === null || _d === void 0 ? void 0 : _d.map((distinct) => {
|
|
3237
|
-
var _a, _b;
|
|
3238
|
-
const distinctOption = (_a = this.fields.find((fieldOption) => fieldOption === distinct)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === distinct);
|
|
3239
|
-
const fieldName = ((_b = Object.values(distinctOption).shift()) === null || _b === void 0 ? void 0 : _b.columnName) || distinct;
|
|
3240
|
-
return {
|
|
3241
|
-
operation: {
|
|
3242
|
-
name: `${this.tableName}`,
|
|
3243
|
-
alias: `${this.tableName}_${distinct}_distinct`,
|
|
3244
|
-
},
|
|
3245
|
-
fields: [distinctOption],
|
|
3246
|
-
variables: Object.assign(Object.assign({}, variablesFilters), { [`${this.tableName}_${fieldName}_distinct`]: {
|
|
3247
|
-
type: `${this.tableName}_select_column!`,
|
|
3248
|
-
list: true,
|
|
3249
|
-
value: fieldName,
|
|
3250
|
-
name: 'distinct_on',
|
|
3251
|
-
} }),
|
|
3252
|
-
};
|
|
3253
|
-
}))) ||
|
|
3254
|
-
[]),
|
|
2501
|
+
{
|
|
2502
|
+
operation: `${this.tableName}_aggregate`,
|
|
2503
|
+
fields: [{ aggregate: ['count'] }],
|
|
2504
|
+
variables: variablesCount,
|
|
2505
|
+
},
|
|
3255
2506
|
]);
|
|
3256
2507
|
const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
minimal: options.minimal.reduce((minimals, current) => {
|
|
3260
|
-
var _a;
|
|
3261
|
-
return (Object.assign(Object.assign({}, minimals), set(minimals, current, result[`${this.tableName}_aggregate`].aggregate.min[((_a = AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || current])));
|
|
3262
|
-
}, {}),
|
|
3263
|
-
}
|
|
3264
|
-
: {})), (((_f = options === null || options === void 0 ? void 0 : options.maximum) === null || _f === void 0 ? void 0 : _f.length)
|
|
3265
|
-
? {
|
|
3266
|
-
maximum: options.maximum.reduce((maximums, current) => {
|
|
3267
|
-
var _a;
|
|
3268
|
-
return (Object.assign(Object.assign({}, maximums), set(maximums, current, result[`${this.tableName}_aggregate`].aggregate.max[((_a = AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || current])));
|
|
3269
|
-
}, {}),
|
|
3270
|
-
}
|
|
3271
|
-
: {})), (!((_g = params.limits) === null || _g === void 0 ? void 0 : _g.offset) &&
|
|
3272
|
-
((_h = options === null || options === void 0 ? void 0 : options.distinct) === null || _h === void 0 ? void 0 : _h.length) && {
|
|
3273
|
-
distinct: options === null || options === void 0 ? void 0 : options.distinct.reduce((distinct, current) => {
|
|
3274
|
-
var _a, _b;
|
|
3275
|
-
const distinctOption = (_a = this.fields.find((fieldOption) => fieldOption === current)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === current);
|
|
3276
|
-
const fieldName = ((_b = Object.values(distinctOption).shift()) === null || _b === void 0 ? void 0 : _b.columnName) || current;
|
|
3277
|
-
return Object.assign(Object.assign({}, distinct), { [current.toString()]: result[`${this.tableName}_${current.toString()}_distinct`].map((obj) => obj[fieldName]) });
|
|
3278
|
-
}, {}),
|
|
3279
|
-
}));
|
|
2508
|
+
const count = result[`${this.tableName}_aggregate`].aggregate.count;
|
|
2509
|
+
return { count, data };
|
|
3280
2510
|
});
|
|
3281
2511
|
}
|
|
3282
2512
|
};
|
|
@@ -3316,146 +2546,8 @@ class VariantHasuraGraphQL extends Variant {
|
|
|
3316
2546
|
}
|
|
3317
2547
|
}
|
|
3318
2548
|
|
|
3319
|
-
class CategoryCollectionChildrenHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
3320
|
-
constructor(endpoint, authOptions) {
|
|
3321
|
-
super({
|
|
3322
|
-
tableName: 'category_collection_children',
|
|
3323
|
-
model: CategoryCollectionChildren,
|
|
3324
|
-
endpoint,
|
|
3325
|
-
authOptions,
|
|
3326
|
-
fields: [
|
|
3327
|
-
{ collectionId: { columnName: 'collection_id' } },
|
|
3328
|
-
{ categoryId: { columnName: 'category_id' } },
|
|
3329
|
-
'name',
|
|
3330
|
-
'slug',
|
|
3331
|
-
'reference',
|
|
3332
|
-
{ parentCollectionId: { columnName: 'parent_collection_id' } },
|
|
3333
|
-
{ parentCategoryId: { columnName: 'parent_category_id' } },
|
|
3334
|
-
{
|
|
3335
|
-
parent: {
|
|
3336
|
-
columnName: 'parent',
|
|
3337
|
-
foreignKeyColumn: { collectionId: 'parentCollectionId', categoryId: 'parentCategoryId' },
|
|
3338
|
-
fields: [
|
|
3339
|
-
{ collectionId: { columnName: 'collection_id' } },
|
|
3340
|
-
{ categoryId: { columnName: 'category_id' } },
|
|
3341
|
-
'name',
|
|
3342
|
-
'slug',
|
|
3343
|
-
'reference',
|
|
3344
|
-
{ parentCollectionId: { columnName: 'parent_collection_id' } },
|
|
3345
|
-
{ parentCategoryId: { columnName: 'parent_category_id' } },
|
|
3346
|
-
],
|
|
3347
|
-
},
|
|
3348
|
-
},
|
|
3349
|
-
],
|
|
3350
|
-
});
|
|
3351
|
-
}
|
|
3352
|
-
}
|
|
3353
|
-
|
|
3354
|
-
class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
3355
|
-
constructor(endpoint, authOptions) {
|
|
3356
|
-
super({
|
|
3357
|
-
tableName: 'category_filter',
|
|
3358
|
-
model: CategoryFilter,
|
|
3359
|
-
endpoint,
|
|
3360
|
-
authOptions,
|
|
3361
|
-
fields: [
|
|
3362
|
-
'id',
|
|
3363
|
-
{ filterId: { columnName: 'filter_id' } },
|
|
3364
|
-
{ categoryId: { columnName: 'category_id' } },
|
|
3365
|
-
{
|
|
3366
|
-
filter: {
|
|
3367
|
-
columnName: 'filter',
|
|
3368
|
-
foreignKeyColumn: { id: 'filterId' },
|
|
3369
|
-
fields: [
|
|
3370
|
-
'id',
|
|
3371
|
-
'description',
|
|
3372
|
-
'slug',
|
|
3373
|
-
'enabled',
|
|
3374
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
3375
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
3376
|
-
{
|
|
3377
|
-
options: {
|
|
3378
|
-
columnName: 'options',
|
|
3379
|
-
foreignKeyColumn: { filterId: 'id' },
|
|
3380
|
-
fields: [
|
|
3381
|
-
'id',
|
|
3382
|
-
{ filterId: { columnName: 'filter_id' } },
|
|
3383
|
-
'description',
|
|
3384
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
3385
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
3386
|
-
],
|
|
3387
|
-
},
|
|
3388
|
-
},
|
|
3389
|
-
],
|
|
3390
|
-
},
|
|
3391
|
-
},
|
|
3392
|
-
{
|
|
3393
|
-
category: {
|
|
3394
|
-
columnName: 'category',
|
|
3395
|
-
foreignKeyColumn: { id: 'categoryId' },
|
|
3396
|
-
fields: [
|
|
3397
|
-
'id',
|
|
3398
|
-
'description',
|
|
3399
|
-
{
|
|
3400
|
-
products: {
|
|
3401
|
-
columnName: 'products',
|
|
3402
|
-
fields: ['product_id'],
|
|
3403
|
-
from: (value) => value.map((product) => product.product_id.toString()),
|
|
3404
|
-
to: (productIds) => productIds.map((productId) => ({
|
|
3405
|
-
product_id: +productId,
|
|
3406
|
-
})),
|
|
3407
|
-
},
|
|
3408
|
-
},
|
|
3409
|
-
{
|
|
3410
|
-
childrenProducts: {
|
|
3411
|
-
columnName: 'children_products',
|
|
3412
|
-
foreignKeyColumn: { category_id: 'id' },
|
|
3413
|
-
fields: [
|
|
3414
|
-
'id',
|
|
3415
|
-
'name',
|
|
3416
|
-
'slug',
|
|
3417
|
-
{
|
|
3418
|
-
categories: {
|
|
3419
|
-
columnName: 'categories',
|
|
3420
|
-
fields: ['category_id'],
|
|
3421
|
-
bindPersistData: (value) => ({
|
|
3422
|
-
categories: { data: value.map((category) => ({ category_id: +category })) },
|
|
3423
|
-
}),
|
|
3424
|
-
to: (categories) => categories.map((categoryId) => +categoryId),
|
|
3425
|
-
from: (categories) => (categories === null || categories === void 0 ? void 0 : categories.map((category) => { var _a; return (_a = category === null || category === void 0 ? void 0 : category.category_id) === null || _a === void 0 ? void 0 : _a.toString(); })) || [],
|
|
3426
|
-
},
|
|
3427
|
-
},
|
|
3428
|
-
],
|
|
3429
|
-
},
|
|
3430
|
-
},
|
|
3431
|
-
],
|
|
3432
|
-
},
|
|
3433
|
-
},
|
|
3434
|
-
],
|
|
3435
|
-
});
|
|
3436
|
-
}
|
|
3437
|
-
deleteByCategory(categoryId) {
|
|
3438
|
-
return this.mutation('delete_category_filter', ['affected_rows'], {
|
|
3439
|
-
where: {
|
|
3440
|
-
type: 'category_filter_bool_exp',
|
|
3441
|
-
required: true,
|
|
3442
|
-
value: { category_id: { _eq: categoryId } },
|
|
3443
|
-
},
|
|
3444
|
-
});
|
|
3445
|
-
}
|
|
3446
|
-
deleteByCategoryAndFilter(categoryId, filterId) {
|
|
3447
|
-
return this.mutation('delete_category_filter', ['affected_rows'], {
|
|
3448
|
-
where: {
|
|
3449
|
-
type: 'category_filter_bool_exp',
|
|
3450
|
-
required: true,
|
|
3451
|
-
value: { category_id: { _eq: categoryId }, filter_id: { _eq: filterId } },
|
|
3452
|
-
},
|
|
3453
|
-
});
|
|
3454
|
-
}
|
|
3455
|
-
}
|
|
3456
|
-
|
|
3457
2549
|
class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
3458
|
-
constructor(endpoint, authOptions, productRepository
|
|
2550
|
+
constructor(endpoint, authOptions, productRepository) {
|
|
3459
2551
|
super({
|
|
3460
2552
|
tableName: 'category',
|
|
3461
2553
|
model: Category,
|
|
@@ -3469,7 +2561,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3469
2561
|
'image',
|
|
3470
2562
|
'published',
|
|
3471
2563
|
'shop',
|
|
3472
|
-
{ shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
|
|
3473
2564
|
'slug',
|
|
3474
2565
|
{ brandCategory: { columnName: 'brand_category' } },
|
|
3475
2566
|
{ brandCategoryBanner: { columnName: 'brand_banner' } },
|
|
@@ -3480,7 +2571,10 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3480
2571
|
conditions: {
|
|
3481
2572
|
columnName: 'tag_condition',
|
|
3482
2573
|
type: HasuraGraphQLColumnType.Jsonb,
|
|
3483
|
-
from: (tags, row) => ({
|
|
2574
|
+
from: (tags, row) => ({
|
|
2575
|
+
brand: row.brand_condition,
|
|
2576
|
+
tags: Array.isArray(tags) ? tags : [],
|
|
2577
|
+
}),
|
|
3484
2578
|
bindPersistData: (value) => {
|
|
3485
2579
|
return {
|
|
3486
2580
|
brand_condition: value.brand,
|
|
@@ -3492,17 +2586,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3492
2586
|
},
|
|
3493
2587
|
},
|
|
3494
2588
|
},
|
|
3495
|
-
|
|
3496
|
-
filters: {
|
|
3497
|
-
columnName: 'filters',
|
|
3498
|
-
foreignKeyColumn: { filter_id: 'id' },
|
|
3499
|
-
fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
|
|
3500
|
-
bindPersistData: (value) => ({
|
|
3501
|
-
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
3502
|
-
}),
|
|
3503
|
-
from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter)) || [],
|
|
3504
|
-
},
|
|
3505
|
-
},
|
|
2589
|
+
'filters',
|
|
3506
2590
|
{ createdAt: { columnName: 'created_at' } },
|
|
3507
2591
|
{ updatedAt: { columnName: 'updated_at' } },
|
|
3508
2592
|
{
|
|
@@ -3524,21 +2608,9 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3524
2608
|
}),
|
|
3525
2609
|
},
|
|
3526
2610
|
},
|
|
3527
|
-
{ isCollection: { columnName: 'is_collection' } },
|
|
3528
|
-
{ isWishlist: { columnName: 'is_wishlist' } },
|
|
3529
|
-
'reference',
|
|
3530
|
-
{ parentId: { columnName: 'parent_id' } },
|
|
3531
|
-
{
|
|
3532
|
-
parent: {
|
|
3533
|
-
columnName: 'parent',
|
|
3534
|
-
foreignKeyColumn: { id: 'parentId' },
|
|
3535
|
-
fields: ['id', 'name', 'reference', 'slug'],
|
|
3536
|
-
},
|
|
3537
|
-
},
|
|
3538
2611
|
],
|
|
3539
2612
|
});
|
|
3540
2613
|
this.productRepository = productRepository;
|
|
3541
|
-
this.categoryFilterRepository = categoryFilterRepository;
|
|
3542
2614
|
}
|
|
3543
2615
|
create(params) {
|
|
3544
2616
|
const _super = Object.create(null, {
|
|
@@ -3546,7 +2618,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3546
2618
|
});
|
|
3547
2619
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3548
2620
|
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
3549
|
-
return _super.create.call(this, Object.assign(Object.assign({}, data), {
|
|
2621
|
+
return _super.create.call(this, Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }));
|
|
3550
2622
|
});
|
|
3551
2623
|
}
|
|
3552
2624
|
get(identifiers) {
|
|
@@ -3556,7 +2628,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3556
2628
|
var _a;
|
|
3557
2629
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3558
2630
|
return Number.isNaN(+identifiers.id)
|
|
3559
|
-
? (_a = (yield this.find({ filters: { firestoreId: identifiers.id }
|
|
2631
|
+
? (_a = (yield this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
3560
2632
|
: _super.get.call(this, identifiers);
|
|
3561
2633
|
});
|
|
3562
2634
|
}
|
|
@@ -3565,56 +2637,28 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3565
2637
|
update: { get: () => super.update }
|
|
3566
2638
|
});
|
|
3567
2639
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3568
|
-
const { products, id: checkId, metadata
|
|
2640
|
+
const { products, id: checkId, metadata } = params, data = __rest(params, ["products", "id", "metadata"]);
|
|
3569
2641
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
3570
2642
|
const id = yield this.getId(plainData.id);
|
|
3571
|
-
const category = yield _super.update.call(this, Object.assign(
|
|
2643
|
+
const category = yield _super.update.call(this, Object.assign({ id }, data));
|
|
3572
2644
|
category.products = products && (yield this.updateProducts(+id, { products }));
|
|
3573
2645
|
category.metadata = metadata && (yield this.updateMetadata(+id, { metadata }));
|
|
3574
|
-
category.filters = filters && (yield this.updateFilters(+id, { filters }));
|
|
3575
2646
|
return category;
|
|
3576
2647
|
});
|
|
3577
2648
|
}
|
|
3578
2649
|
getCategoryBySlug(slug, shop) {
|
|
3579
2650
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3580
2651
|
if (!slug)
|
|
3581
|
-
return;
|
|
3582
|
-
const { data } = yield this.find({
|
|
3583
|
-
|
|
3584
|
-
slug,
|
|
3585
|
-
shops: { operator: Where.IN, value: [shop] },
|
|
3586
|
-
published: { operator: Where.EQUALS, value: true },
|
|
3587
|
-
isWishlist: { operator: Where.EQUALS, value: false },
|
|
3588
|
-
},
|
|
3589
|
-
options: {
|
|
3590
|
-
enableCount: false,
|
|
3591
|
-
},
|
|
3592
|
-
});
|
|
3593
|
-
if (!data.length)
|
|
3594
|
-
throw new NotFoundError(`Category with slug ${slug} not found`);
|
|
3595
|
-
if (data.length > 1)
|
|
2652
|
+
return null;
|
|
2653
|
+
const { data, count } = yield this.find({ filters: { slug, shop, published: true } });
|
|
2654
|
+
if (count > 1)
|
|
3596
2655
|
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
2656
|
+
if (!count)
|
|
2657
|
+
throw new NotFoundError(`Category with slug ${slug} not found`);
|
|
3597
2658
|
return data.shift();
|
|
3598
2659
|
});
|
|
3599
2660
|
}
|
|
3600
|
-
|
|
3601
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3602
|
-
if (!shop)
|
|
3603
|
-
return;
|
|
3604
|
-
const { data } = yield this.find({
|
|
3605
|
-
filters: {
|
|
3606
|
-
shops: { operator: Where.IN, value: [shop] },
|
|
3607
|
-
published: { operator: Where.EQUALS, value: true },
|
|
3608
|
-
isWishlist: { operator: Where.EQUALS, value: false },
|
|
3609
|
-
},
|
|
3610
|
-
options: {
|
|
3611
|
-
enableCount: false,
|
|
3612
|
-
},
|
|
3613
|
-
});
|
|
3614
|
-
return data;
|
|
3615
|
-
});
|
|
3616
|
-
}
|
|
3617
|
-
getCategoriesForHome(categoryIds, limit = 4, gender) {
|
|
2661
|
+
getCategoriesForHome(categoryIds, limit = 4) {
|
|
3618
2662
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3619
2663
|
if (!(categoryIds === null || categoryIds === void 0 ? void 0 : categoryIds.length))
|
|
3620
2664
|
return [];
|
|
@@ -3634,7 +2678,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3634
2678
|
const homeSections = yield Promise.all(categories.map((category) => __awaiter(this, void 0, void 0, function* () {
|
|
3635
2679
|
return ({
|
|
3636
2680
|
category,
|
|
3637
|
-
products: yield this.mountCategory(category, { limit, hasStock: true
|
|
2681
|
+
products: yield this.mountCategory(category, { limit, hasStock: true }),
|
|
3638
2682
|
});
|
|
3639
2683
|
})));
|
|
3640
2684
|
return homeSections;
|
|
@@ -3646,7 +2690,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3646
2690
|
if (!((_a = category === null || category === void 0 ? void 0 : category.products) === null || _a === void 0 ? void 0 : _a.length))
|
|
3647
2691
|
return [];
|
|
3648
2692
|
const products = [];
|
|
3649
|
-
const { data: productsData } = yield this.productRepository.find(Object.assign(
|
|
2693
|
+
const { data: productsData } = yield this.productRepository.find(Object.assign({ filters: Object.assign({ id: { operator: Where.IN, value: category.products }, published: true }, ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {})), fields: [
|
|
3650
2694
|
'id',
|
|
3651
2695
|
'name',
|
|
3652
2696
|
'slug',
|
|
@@ -3670,9 +2714,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3670
2714
|
'tags',
|
|
3671
2715
|
'type',
|
|
3672
2716
|
'shoppingCount',
|
|
3673
|
-
|
|
3674
|
-
'createdAt',
|
|
3675
|
-
] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})), { options: { enableCount: false } }));
|
|
2717
|
+
] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})));
|
|
3676
2718
|
products.push(...productsData);
|
|
3677
2719
|
return products;
|
|
3678
2720
|
});
|
|
@@ -3682,7 +2724,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3682
2724
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3683
2725
|
if (!Number.isNaN(+id))
|
|
3684
2726
|
return id;
|
|
3685
|
-
const { data } = yield this.find({ filters: { firestoreId: id }
|
|
2727
|
+
const { data } = yield this.find({ filters: { firestoreId: id } });
|
|
3686
2728
|
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
3687
2729
|
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
3688
2730
|
throw new NotFoundError(`Category with id ${id} not found`);
|
|
@@ -3724,7 +2766,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3724
2766
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3725
2767
|
const plainData = this.paramsToPlain({ metadata });
|
|
3726
2768
|
if (!plainData.metadata)
|
|
3727
|
-
return;
|
|
2769
|
+
return null;
|
|
3728
2770
|
yield this.mutation('update_category_metadata_by_pk', ['category_id'], {
|
|
3729
2771
|
pk_columns: {
|
|
3730
2772
|
value: { category_id: categoryId },
|
|
@@ -3740,212 +2782,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3740
2782
|
return plainData.metadata;
|
|
3741
2783
|
});
|
|
3742
2784
|
}
|
|
3743
|
-
updateFilters(categoryId, { filters }) {
|
|
3744
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3745
|
-
if ('action' in filters && filters.action === 'remove' && filters.value.length) {
|
|
3746
|
-
for (let i = 0; i < filters.value.length; i++) {
|
|
3747
|
-
yield this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filters.value[i].id);
|
|
3748
|
-
}
|
|
3749
|
-
return [];
|
|
3750
|
-
}
|
|
3751
|
-
if ('action' in filters && filters.action === 'merge' && filters.value.length) {
|
|
3752
|
-
let filtersList = [];
|
|
3753
|
-
const currentFilters = yield this.categoryFilterRepository
|
|
3754
|
-
.find({
|
|
3755
|
-
filters: {
|
|
3756
|
-
categoryId,
|
|
3757
|
-
},
|
|
3758
|
-
})
|
|
3759
|
-
.then((res) => res.data);
|
|
3760
|
-
const currentFiltersId = currentFilters.map((f) => f.id);
|
|
3761
|
-
const filtersUpdatedId = filters.value.map((f) => f.id);
|
|
3762
|
-
const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
|
|
3763
|
-
const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
|
|
3764
|
-
for (const filter of filterToBeDeleted) {
|
|
3765
|
-
const index = currentFilters.findIndex((f) => f.id == filter);
|
|
3766
|
-
if (index != -1) {
|
|
3767
|
-
currentFilters.splice(index, 1);
|
|
3768
|
-
}
|
|
3769
|
-
yield this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
|
|
3770
|
-
}
|
|
3771
|
-
for (const filter of filterToBeInserted) {
|
|
3772
|
-
const newCategoryFilter = yield this.categoryFilterRepository.create({
|
|
3773
|
-
filterId: filter,
|
|
3774
|
-
categoryId,
|
|
3775
|
-
});
|
|
3776
|
-
filtersList.push(newCategoryFilter);
|
|
3777
|
-
}
|
|
3778
|
-
return [...currentFilters, ...filtersList];
|
|
3779
|
-
}
|
|
3780
|
-
if (Array.isArray(filters) && filters.length) {
|
|
3781
|
-
yield this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
3782
|
-
let filtersList = [];
|
|
3783
|
-
for (let i = 0; i < filters.length; i++) {
|
|
3784
|
-
const newCategoryFilter = yield this.categoryFilterRepository.create({
|
|
3785
|
-
filterId: filters[i].id,
|
|
3786
|
-
categoryId,
|
|
3787
|
-
});
|
|
3788
|
-
filtersList.push(newCategoryFilter);
|
|
3789
|
-
}
|
|
3790
|
-
return filtersList;
|
|
3791
|
-
}
|
|
3792
|
-
});
|
|
3793
|
-
}
|
|
3794
|
-
getChildren(parentId) {
|
|
3795
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3796
|
-
const { category_tree } = yield this.query('category_tree', ['id', 'name', 'parent_id'], {
|
|
3797
|
-
args: {
|
|
3798
|
-
type: 'category_tree_args',
|
|
3799
|
-
value: { parentid: parentId },
|
|
3800
|
-
required: true,
|
|
3801
|
-
},
|
|
3802
|
-
});
|
|
3803
|
-
return category_tree.map((category) => Category.toInstance(category));
|
|
3804
|
-
});
|
|
3805
|
-
}
|
|
3806
|
-
isChild(id, parentId) {
|
|
3807
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3808
|
-
const categoryTree = yield this.getChildren(parentId);
|
|
3809
|
-
return categoryTree.some((c) => c.id == id.toString());
|
|
3810
|
-
});
|
|
3811
|
-
}
|
|
3812
|
-
}
|
|
3813
|
-
|
|
3814
|
-
class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
3815
|
-
constructor(endpoint, authOptions, filterOptionRepository, categoryFilterRepository) {
|
|
3816
|
-
super({
|
|
3817
|
-
tableName: 'filter',
|
|
3818
|
-
model: Filter,
|
|
3819
|
-
endpoint,
|
|
3820
|
-
authOptions,
|
|
3821
|
-
fields: [
|
|
3822
|
-
'id',
|
|
3823
|
-
'description',
|
|
3824
|
-
'slug',
|
|
3825
|
-
'enabled',
|
|
3826
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
3827
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
3828
|
-
{
|
|
3829
|
-
options: {
|
|
3830
|
-
columnName: 'options',
|
|
3831
|
-
foreignKeyColumn: { filterId: 'id' },
|
|
3832
|
-
fields: [
|
|
3833
|
-
'id',
|
|
3834
|
-
{ filterId: { columnName: 'filter_id' } },
|
|
3835
|
-
'description',
|
|
3836
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
3837
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
3838
|
-
],
|
|
3839
|
-
},
|
|
3840
|
-
},
|
|
3841
|
-
],
|
|
3842
|
-
});
|
|
3843
|
-
this.filterOptionRepository = filterOptionRepository;
|
|
3844
|
-
this.categoryFilterRepository = categoryFilterRepository;
|
|
3845
|
-
}
|
|
3846
|
-
update(params) {
|
|
3847
|
-
const _super = Object.create(null, {
|
|
3848
|
-
update: { get: () => super.update }
|
|
3849
|
-
});
|
|
3850
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3851
|
-
const { options } = params, data = __rest(params, ["options"]);
|
|
3852
|
-
const filter = yield _super.update.call(this, data);
|
|
3853
|
-
filter.options = yield this.updateOptions(+data.id, { options });
|
|
3854
|
-
return filter;
|
|
3855
|
-
});
|
|
3856
|
-
}
|
|
3857
|
-
updateOptions(filterId, { options }) {
|
|
3858
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3859
|
-
if (!options)
|
|
3860
|
-
return [];
|
|
3861
|
-
if ('action' in options && options.action === 'remove' && options.value.length) {
|
|
3862
|
-
for (let i = 0; i < options.value.length; i++) {
|
|
3863
|
-
yield this.filterOptionRepository.delete({ id: options.value[i].id });
|
|
3864
|
-
}
|
|
3865
|
-
return [];
|
|
3866
|
-
}
|
|
3867
|
-
if ('action' in options && options.action === 'merge' && options.value.length) {
|
|
3868
|
-
let filterOptions = [];
|
|
3869
|
-
for (let i = 0; i < options.value.length; i++) {
|
|
3870
|
-
try {
|
|
3871
|
-
const hasFilter = yield this.filterOptionRepository.get({ id: options.value[i].id });
|
|
3872
|
-
if (hasFilter)
|
|
3873
|
-
filterOptions.push(hasFilter);
|
|
3874
|
-
}
|
|
3875
|
-
catch (error) {
|
|
3876
|
-
const newOption = yield this.filterOptionRepository.create(Object.assign(Object.assign({}, options.value[i]), { filterId }));
|
|
3877
|
-
filterOptions.push(newOption);
|
|
3878
|
-
}
|
|
3879
|
-
}
|
|
3880
|
-
return filterOptions;
|
|
3881
|
-
}
|
|
3882
|
-
if (Array.isArray(options) && options.length) {
|
|
3883
|
-
let filterOptions = [];
|
|
3884
|
-
for (let i = 0; i < options.length; i++) {
|
|
3885
|
-
try {
|
|
3886
|
-
const hasFilter = yield this.filterOptionRepository.get({ id: options[i].id });
|
|
3887
|
-
if (hasFilter)
|
|
3888
|
-
filterOptions.push(hasFilter);
|
|
3889
|
-
}
|
|
3890
|
-
catch (error) {
|
|
3891
|
-
const newOption = yield this.filterOptionRepository.create(Object.assign(Object.assign({}, options[i]), { filterId }));
|
|
3892
|
-
filterOptions.push(newOption);
|
|
3893
|
-
}
|
|
3894
|
-
}
|
|
3895
|
-
}
|
|
3896
|
-
return [];
|
|
3897
|
-
});
|
|
3898
|
-
}
|
|
3899
|
-
delete(params) {
|
|
3900
|
-
const _super = Object.create(null, {
|
|
3901
|
-
delete: { get: () => super.delete }
|
|
3902
|
-
});
|
|
3903
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3904
|
-
const { options } = params, data = __rest(params, ["options"]);
|
|
3905
|
-
const categoryFilters = yield this.categoryFilterRepository
|
|
3906
|
-
.find({
|
|
3907
|
-
filters: {
|
|
3908
|
-
filterId: +data.id,
|
|
3909
|
-
},
|
|
3910
|
-
})
|
|
3911
|
-
.then((result) => result.data);
|
|
3912
|
-
if (categoryFilters.length)
|
|
3913
|
-
throw new Error('Erro: o filtro está associado a uma ou mais categoria(s)');
|
|
3914
|
-
yield this.deleteOptions(options);
|
|
3915
|
-
yield _super.delete.call(this, { id: +data.id });
|
|
3916
|
-
return;
|
|
3917
|
-
});
|
|
3918
|
-
}
|
|
3919
|
-
deleteOptions(options) {
|
|
3920
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3921
|
-
for (let i = 0; i < options.length; i++) {
|
|
3922
|
-
try {
|
|
3923
|
-
yield this.filterOptionRepository.delete({ id: options[i].id });
|
|
3924
|
-
}
|
|
3925
|
-
catch (error) {
|
|
3926
|
-
console.log(error);
|
|
3927
|
-
}
|
|
3928
|
-
}
|
|
3929
|
-
});
|
|
3930
|
-
}
|
|
3931
|
-
}
|
|
3932
|
-
|
|
3933
|
-
class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
3934
|
-
constructor(endpoint, authOptions) {
|
|
3935
|
-
super({
|
|
3936
|
-
tableName: 'filter_option',
|
|
3937
|
-
model: FilterOption,
|
|
3938
|
-
endpoint,
|
|
3939
|
-
authOptions,
|
|
3940
|
-
fields: [
|
|
3941
|
-
'id',
|
|
3942
|
-
'description',
|
|
3943
|
-
{ filterId: { columnName: 'filter_id' } },
|
|
3944
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
3945
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
3946
|
-
],
|
|
3947
|
-
});
|
|
3948
|
-
}
|
|
3949
2785
|
}
|
|
3950
2786
|
|
|
3951
2787
|
class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
@@ -3957,8 +2793,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3957
2793
|
authOptions,
|
|
3958
2794
|
fields: [],
|
|
3959
2795
|
});
|
|
3960
|
-
this.bindReviewToModel = (plain) => (Object.assign(Object.assign({}, omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id'])), { createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at, updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at, personId: plain.person_id, orderId: plain.order_id }));
|
|
3961
|
-
this.bindReviewToHasura = (review) => (Object.assign(Object.assign({}, omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId'])), { person_id: review.personId, order_id: review.orderId }));
|
|
2796
|
+
this.bindReviewToModel = (plain) => (Object.assign(Object.assign({}, is(omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id']))), { createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at, updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at, personId: plain.person_id, orderId: plain.order_id }));
|
|
2797
|
+
this.bindReviewToHasura = (review) => (Object.assign(Object.assign({}, is(omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId']))), { person_id: review.personId, order_id: review.orderId }));
|
|
3962
2798
|
const commonFields = [
|
|
3963
2799
|
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
3964
2800
|
{ firestoreId: { columnName: 'firestore_id' } },
|
|
@@ -3977,29 +2813,26 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3977
2813
|
whoMustUse: data.who_must_use,
|
|
3978
2814
|
howToUse: data.how_to_use,
|
|
3979
2815
|
brand: data.brand_description,
|
|
3980
|
-
ingredients: data.ingredients,
|
|
3981
2816
|
}),
|
|
3982
|
-
bindFindFilter: (
|
|
3983
|
-
|
|
2817
|
+
bindFindFilter: (sentence) => {
|
|
2818
|
+
const filters = Object.values(sentence).shift();
|
|
2819
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((filters === null || filters === void 0 ? void 0 : filters.description) && { description: filters.description })), (filters.differentials && { differentials: filters.differentials })), (filters.whoMustUse && {
|
|
3984
2820
|
who_must_use: filters.whoMustUse,
|
|
3985
2821
|
})), (filters.howToUse && {
|
|
3986
2822
|
how_to_use: filters.howToUse,
|
|
3987
2823
|
})), (filters.brand && {
|
|
3988
2824
|
brand_description: filters.brand,
|
|
3989
|
-
})), (filters.ingredients && {
|
|
3990
|
-
ingredients: filters.ingredients,
|
|
3991
2825
|
}));
|
|
3992
2826
|
},
|
|
3993
|
-
bindPersistData: (descriptionData) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
2827
|
+
bindPersistData: (descriptionData) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((descriptionData === null || descriptionData === void 0 ? void 0 : descriptionData.description) && { description: descriptionData.description })), (descriptionData.differentials && { differentials: descriptionData.differentials })), (descriptionData.whoMustUse && {
|
|
3994
2828
|
who_must_use: descriptionData.whoMustUse,
|
|
3995
|
-
})), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand }))
|
|
2829
|
+
})), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand }))),
|
|
3996
2830
|
},
|
|
3997
2831
|
},
|
|
3998
2832
|
{ differentials: { columnName: 'differentials' } },
|
|
3999
2833
|
{ whoMustUse: { columnName: 'who_must_use' } },
|
|
4000
2834
|
{ howToUse: { columnName: 'how_to_use' } },
|
|
4001
2835
|
{ brandDescription: { columnName: 'brand_description' } },
|
|
4002
|
-
{ ingredients: { columnName: 'ingredients' } },
|
|
4003
2836
|
{ hasVariants: { columnName: 'has_variants' } },
|
|
4004
2837
|
{
|
|
4005
2838
|
images: {
|
|
@@ -4023,7 +2856,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4023
2856
|
subscriberDiscountPercentage: data.subscriber_discount_percentage,
|
|
4024
2857
|
subscriberPrice: data.subscriber_price,
|
|
4025
2858
|
}),
|
|
4026
|
-
bindFindFilter: (
|
|
2859
|
+
bindFindFilter: (sentence) => {
|
|
2860
|
+
const filters = Object.values(sentence).shift();
|
|
4027
2861
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, (((filters === null || filters === void 0 ? void 0 : filters.price) || (filters === null || filters === void 0 ? void 0 : filters.price) === 0) && { price: filters.price })), ((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice })), ((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
|
|
4028
2862
|
subscriber_discount_percentage: filters.subscriberDiscountPercentage,
|
|
4029
2863
|
})), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
@@ -4047,29 +2881,27 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4047
2881
|
to: (value) => (isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity),
|
|
4048
2882
|
},
|
|
4049
2883
|
},
|
|
4050
|
-
{ hasStock: { columnName: 'has_stock' } },
|
|
4051
2884
|
'slug',
|
|
4052
2885
|
'type',
|
|
4053
2886
|
'video',
|
|
4054
2887
|
'weight',
|
|
4055
2888
|
'gender',
|
|
4056
|
-
{ intGender: { columnName: 'int_gender' } },
|
|
4057
2889
|
{ tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4058
|
-
{ filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4059
2890
|
{ isKit: { columnName: 'is_kit' } },
|
|
4060
2891
|
{ createdAt: { columnName: 'created_at' } },
|
|
4061
2892
|
{ updatedAt: { columnName: 'updated_at' } },
|
|
4062
|
-
{ rate: { columnName: 'rating' } },
|
|
4063
|
-
{ reviewsTotal: { columnName: 'reviews_total' } },
|
|
4064
|
-
{ shoppingCount: { columnName: 'shopping_count' } },
|
|
4065
|
-
{ categoryId: { columnName: 'category_id' } },
|
|
4066
2893
|
{
|
|
4067
|
-
|
|
4068
|
-
columnName: '
|
|
4069
|
-
|
|
4070
|
-
|
|
2894
|
+
rate: {
|
|
2895
|
+
columnName: 'reviews_aggregate',
|
|
2896
|
+
filters: {
|
|
2897
|
+
filters: { status: true },
|
|
2898
|
+
filterType: 'product_review_bool_exp',
|
|
2899
|
+
},
|
|
2900
|
+
fields: [{ aggregate: [{ avg: ['rate'] }] }],
|
|
2901
|
+
from: (value) => value.aggregate.avg.rate,
|
|
4071
2902
|
},
|
|
4072
2903
|
},
|
|
2904
|
+
{ shoppingCount: { columnName: 'shopping_count' } },
|
|
4073
2905
|
];
|
|
4074
2906
|
this.fields = [
|
|
4075
2907
|
...commonFields,
|
|
@@ -4156,7 +2988,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4156
2988
|
var _a;
|
|
4157
2989
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4158
2990
|
const product = Number.isNaN(+identifiers.id)
|
|
4159
|
-
? (_a = (yield this.find({ filters: { firestoreId: identifiers.id }
|
|
2991
|
+
? (_a = (yield this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
4160
2992
|
: yield _super.get.call(this, identifiers);
|
|
4161
2993
|
if (product.productId)
|
|
4162
2994
|
throw new NotFoundError('Product not found, it is a variant');
|
|
@@ -4168,29 +3000,13 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4168
3000
|
const _super = Object.create(null, {
|
|
4169
3001
|
find: { get: () => super.find }
|
|
4170
3002
|
});
|
|
4171
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
4172
3003
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4173
|
-
const
|
|
3004
|
+
const _a = params || {}, { filters, fields } = _a, options = __rest(_a, ["filters", "fields"]);
|
|
4174
3005
|
const bindFields = fields ||
|
|
4175
3006
|
this.fields
|
|
4176
3007
|
.map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
|
|
4177
3008
|
.filter((field) => field !== 'reviews');
|
|
4178
|
-
|
|
4179
|
-
(_c = options.options) === null || _c === void 0 ? void 0 : _c.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
|
|
4180
|
-
if ((_e = (_d = options.options) === null || _d === void 0 ? void 0 : _d.maximum) === null || _e === void 0 ? void 0 : _e.includes('price'))
|
|
4181
|
-
(_f = options.options) === null || _f === void 0 ? void 0 : _f.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
|
|
4182
|
-
(_h = (_g = options.options) === null || _g === void 0 ? void 0 : _g.minimal) === null || _h === void 0 ? void 0 : _h.splice((_j = options.options) === null || _j === void 0 ? void 0 : _j.minimal.indexOf('price'), 1);
|
|
4183
|
-
(_l = (_k = options.options) === null || _k === void 0 ? void 0 : _k.maximum) === null || _l === void 0 ? void 0 : _l.splice((_m = options.options) === null || _m === void 0 ? void 0 : _m.maximum.indexOf('price'), 1);
|
|
4184
|
-
return _super.find.call(this, Object.assign(Object.assign({}, options), { filters: Object.assign(Object.assign({}, filters), { productId: { operator: Where.ISNULL } }), fields: [
|
|
4185
|
-
...bindFields,
|
|
4186
|
-
...(bindFields.includes('price')
|
|
4187
|
-
? [
|
|
4188
|
-
'subscriberPrice',
|
|
4189
|
-
'subscriberDiscountPercentage',
|
|
4190
|
-
'fullPrice',
|
|
4191
|
-
]
|
|
4192
|
-
: []),
|
|
4193
|
-
] }));
|
|
3009
|
+
return _super.find.call(this, Object.assign(Object.assign({}, options), { filters: Object.assign(Object.assign({}, filters), { productId: { operator: Where.ISNULL } }), fields: bindFields }));
|
|
4194
3010
|
});
|
|
4195
3011
|
}
|
|
4196
3012
|
getBySlug(slug) {
|
|
@@ -4200,13 +3016,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4200
3016
|
filters: {
|
|
4201
3017
|
slug,
|
|
4202
3018
|
},
|
|
4203
|
-
fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
|
|
4204
|
-
options: {
|
|
4205
|
-
enableCount: false,
|
|
4206
|
-
},
|
|
4207
3019
|
});
|
|
4208
3020
|
const product = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
4209
|
-
|
|
3021
|
+
product.reviews = yield this.findReviewsByProduct(+product.id);
|
|
4210
3022
|
return product;
|
|
4211
3023
|
});
|
|
4212
3024
|
}
|
|
@@ -4246,11 +3058,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4246
3058
|
], []);
|
|
4247
3059
|
});
|
|
4248
3060
|
}
|
|
4249
|
-
findCatalog(params, mainGender) {
|
|
4250
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4251
|
-
return this.find(Object.assign(Object.assign({}, params), { filters: Object.assign(Object.assign({}, params.filters), { published: true }), orderBy: Object.assign(Object.assign({ hasStock: 'desc' }, (!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' })), omit(params.orderBy, ['hasStock', 'intGender'])) }));
|
|
4252
|
-
});
|
|
4253
|
-
}
|
|
4254
3061
|
updateCategories(productId, { categories }) {
|
|
4255
3062
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4256
3063
|
if ('action' in categories && categories.action === 'remove') {
|
|
@@ -4353,7 +3160,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4353
3160
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4354
3161
|
const plainData = this.paramsToPlain({ metadata });
|
|
4355
3162
|
if (!plainData.metadata)
|
|
4356
|
-
return;
|
|
3163
|
+
return null;
|
|
4357
3164
|
yield this.mutation('update_product_metadata_by_pk', ['product_id'], {
|
|
4358
3165
|
pk_columns: {
|
|
4359
3166
|
value: { product_id: productId },
|
|
@@ -4374,7 +3181,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4374
3181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4375
3182
|
if (!Number.isNaN(+id))
|
|
4376
3183
|
return id;
|
|
4377
|
-
const { data } = yield this.find({ filters: { firestoreId: id }
|
|
3184
|
+
const { data } = yield this.find({ filters: { firestoreId: id } });
|
|
4378
3185
|
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
4379
3186
|
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
4380
3187
|
throw new NotFoundError(`Product with id ${id} not found`);
|
|
@@ -4430,21 +3237,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4430
3237
|
return data && data[0] && this.bindReviewToModel(data[0]);
|
|
4431
3238
|
});
|
|
4432
3239
|
}
|
|
4433
|
-
cleanShoppingCountFromIds(ids) {
|
|
4434
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4435
|
-
return yield this.mutation('update_product', ['affected_rows'], {
|
|
4436
|
-
where: {
|
|
4437
|
-
value: { id: { _nin: ids } },
|
|
4438
|
-
type: 'product_bool_exp',
|
|
4439
|
-
required: true,
|
|
4440
|
-
},
|
|
4441
|
-
_set: {
|
|
4442
|
-
value: { shopping_count: 0 },
|
|
4443
|
-
type: 'product_set_input',
|
|
4444
|
-
},
|
|
4445
|
-
});
|
|
4446
|
-
});
|
|
4447
|
-
}
|
|
4448
3240
|
}
|
|
4449
3241
|
|
|
4450
3242
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
@@ -4457,7 +3249,13 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4457
3249
|
fields: [
|
|
4458
3250
|
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
4459
3251
|
{ firestoreId: { columnName: 'firestore_id' } },
|
|
4460
|
-
{
|
|
3252
|
+
{
|
|
3253
|
+
productId: {
|
|
3254
|
+
columnName: 'main_product_id',
|
|
3255
|
+
to: (value) => +value,
|
|
3256
|
+
from: (value) => value === null || value === void 0 ? void 0 : value.toString(),
|
|
3257
|
+
},
|
|
3258
|
+
},
|
|
4461
3259
|
{ EAN: { columnName: 'ean' } },
|
|
4462
3260
|
{ costPrice: { columnName: 'cost_price' } },
|
|
4463
3261
|
{
|
|
@@ -4493,7 +3291,6 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4493
3291
|
to: (value) => (isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity),
|
|
4494
3292
|
},
|
|
4495
3293
|
},
|
|
4496
|
-
{ hasStock: { columnName: 'has_stock' } },
|
|
4497
3294
|
'weight',
|
|
4498
3295
|
{ name: { to: () => '', from: () => undefined } },
|
|
4499
3296
|
{ hasVariants: { columnName: 'has_variants', to: () => false, from: () => undefined } },
|
|
@@ -4549,7 +3346,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4549
3346
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4550
3347
|
if (!Number.isNaN(+id))
|
|
4551
3348
|
return id;
|
|
4552
|
-
const { data } = yield this.find({ filters: { firestoreId: id }
|
|
3349
|
+
const { data } = yield this.find({ filters: { firestoreId: id } });
|
|
4553
3350
|
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
4554
3351
|
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
4555
3352
|
throw new NotFoundError(`Product with id ${id} not found`);
|
|
@@ -4557,255 +3354,9 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4557
3354
|
}
|
|
4558
3355
|
}
|
|
4559
3356
|
|
|
4560
|
-
class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
4561
|
-
constructor(endpoint, authOptions, categoryFilterRepository) {
|
|
4562
|
-
super({
|
|
4563
|
-
tableName: 'category',
|
|
4564
|
-
model: Wishlist,
|
|
4565
|
-
endpoint,
|
|
4566
|
-
authOptions,
|
|
4567
|
-
fields: [
|
|
4568
|
-
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
4569
|
-
{ firestoreId: { columnName: 'firestore_id' } },
|
|
4570
|
-
'name',
|
|
4571
|
-
'description',
|
|
4572
|
-
'image',
|
|
4573
|
-
'published',
|
|
4574
|
-
'shop',
|
|
4575
|
-
{ shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4576
|
-
'slug',
|
|
4577
|
-
{ brandCategory: { columnName: 'brand_category' } },
|
|
4578
|
-
{ brandCategoryBanner: { columnName: 'brand_banner' } },
|
|
4579
|
-
{ brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
|
|
4580
|
-
{ brandLogo: { columnName: 'brand_logo' } },
|
|
4581
|
-
{ brandCondition: { columnName: 'brand_condition' } },
|
|
4582
|
-
{
|
|
4583
|
-
conditions: {
|
|
4584
|
-
columnName: 'tag_condition',
|
|
4585
|
-
type: HasuraGraphQLColumnType.Jsonb,
|
|
4586
|
-
from: (tags, row) => ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }),
|
|
4587
|
-
bindPersistData: (value) => {
|
|
4588
|
-
return {
|
|
4589
|
-
brand_condition: value.brand,
|
|
4590
|
-
tag_condition: (value === null || value === void 0 ? void 0 : value.tags) || [],
|
|
4591
|
-
};
|
|
4592
|
-
},
|
|
4593
|
-
bindFindFilter: (sentence) => {
|
|
4594
|
-
return Object.assign(Object.assign({}, (sentence.brand ? { brand_condition: sentence.brand } : {})), (sentence.tags ? { tag_condition: sentence.tags } : {}));
|
|
4595
|
-
},
|
|
4596
|
-
},
|
|
4597
|
-
},
|
|
4598
|
-
{
|
|
4599
|
-
filters: {
|
|
4600
|
-
columnName: 'filters',
|
|
4601
|
-
foreignKeyColumn: { filter_id: 'id' },
|
|
4602
|
-
fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
|
|
4603
|
-
bindPersistData: (value) => ({
|
|
4604
|
-
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
4605
|
-
}),
|
|
4606
|
-
from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter)) || [],
|
|
4607
|
-
},
|
|
4608
|
-
},
|
|
4609
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
4610
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
4611
|
-
{
|
|
4612
|
-
products: {
|
|
4613
|
-
columnName: 'products',
|
|
4614
|
-
fields: ['product_id'],
|
|
4615
|
-
from: (value) => value.map((product) => product.product_id.toString()),
|
|
4616
|
-
to: (productIds) => productIds.map((productId) => ({
|
|
4617
|
-
product_id: +productId,
|
|
4618
|
-
})),
|
|
4619
|
-
},
|
|
4620
|
-
},
|
|
4621
|
-
{
|
|
4622
|
-
metadata: {
|
|
4623
|
-
columnName: 'metadata',
|
|
4624
|
-
fields: ['title', 'description'],
|
|
4625
|
-
bindPersistData: (value) => ({
|
|
4626
|
-
metadata: { data: value },
|
|
4627
|
-
}),
|
|
4628
|
-
},
|
|
4629
|
-
},
|
|
4630
|
-
{ isCollection: { columnName: 'is_collection' } },
|
|
4631
|
-
{ isWishlist: { columnName: 'is_wishlist' } },
|
|
4632
|
-
'reference',
|
|
4633
|
-
{ parentId: { columnName: 'parent_id' } },
|
|
4634
|
-
{
|
|
4635
|
-
parent: {
|
|
4636
|
-
columnName: 'parent',
|
|
4637
|
-
foreignKeyColumn: { id: 'parentId' },
|
|
4638
|
-
fields: ['id', 'name', 'reference', 'slug'],
|
|
4639
|
-
},
|
|
4640
|
-
},
|
|
4641
|
-
{ personId: { columnName: 'person_id' } },
|
|
4642
|
-
],
|
|
4643
|
-
});
|
|
4644
|
-
this.categoryFilterRepository = categoryFilterRepository;
|
|
4645
|
-
}
|
|
4646
|
-
create(params) {
|
|
4647
|
-
const _super = Object.create(null, {
|
|
4648
|
-
create: { get: () => super.create }
|
|
4649
|
-
});
|
|
4650
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4651
|
-
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
4652
|
-
return _super.create.call(this, Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
|
|
4653
|
-
});
|
|
4654
|
-
}
|
|
4655
|
-
get(identifiers) {
|
|
4656
|
-
const _super = Object.create(null, {
|
|
4657
|
-
get: { get: () => super.get }
|
|
4658
|
-
});
|
|
4659
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4660
|
-
const data = yield _super.get.call(this, identifiers);
|
|
4661
|
-
if (!data.isWishlist)
|
|
4662
|
-
throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
|
|
4663
|
-
return data;
|
|
4664
|
-
});
|
|
4665
|
-
}
|
|
4666
|
-
update(params) {
|
|
4667
|
-
const _super = Object.create(null, {
|
|
4668
|
-
update: { get: () => super.update }
|
|
4669
|
-
});
|
|
4670
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4671
|
-
const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
|
|
4672
|
-
const plainData = this.paramsToPlain({ id: checkId });
|
|
4673
|
-
const id = plainData.id;
|
|
4674
|
-
const category = yield _super.update.call(this, Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
4675
|
-
category.products = products && (yield this.updateProducts(+id, { products }));
|
|
4676
|
-
category.metadata = metadata && (yield this.updateMetadata(+id, { metadata }));
|
|
4677
|
-
return category;
|
|
4678
|
-
});
|
|
4679
|
-
}
|
|
4680
|
-
getWishlistBySlug(slug) {
|
|
4681
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4682
|
-
if (!slug)
|
|
4683
|
-
return;
|
|
4684
|
-
const { data } = yield this.find({
|
|
4685
|
-
filters: {
|
|
4686
|
-
slug,
|
|
4687
|
-
isWishlist: { operator: Where.EQUALS, value: true },
|
|
4688
|
-
},
|
|
4689
|
-
options: {
|
|
4690
|
-
enableCount: false,
|
|
4691
|
-
},
|
|
4692
|
-
});
|
|
4693
|
-
if (!data.length)
|
|
4694
|
-
throw new NotFoundError(`Wishlist with slug ${slug} not found`);
|
|
4695
|
-
if (data.length > 1)
|
|
4696
|
-
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
4697
|
-
return data.shift();
|
|
4698
|
-
});
|
|
4699
|
-
}
|
|
4700
|
-
getWishlistByPerson(personId) {
|
|
4701
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4702
|
-
if (!personId)
|
|
4703
|
-
return;
|
|
4704
|
-
const { data } = yield this.find({
|
|
4705
|
-
filters: {
|
|
4706
|
-
personId: { operator: Where.EQUALS, value: personId },
|
|
4707
|
-
isWishlist: { operator: Where.EQUALS, value: true },
|
|
4708
|
-
},
|
|
4709
|
-
options: {
|
|
4710
|
-
enableCount: false,
|
|
4711
|
-
},
|
|
4712
|
-
});
|
|
4713
|
-
if (!data.length)
|
|
4714
|
-
throw new NotFoundError(`Wishlists from person ${personId} not found`);
|
|
4715
|
-
return data;
|
|
4716
|
-
});
|
|
4717
|
-
}
|
|
4718
|
-
updateProducts(categoryId, { products }) {
|
|
4719
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4720
|
-
if ('action' in products && products.action === 'remove') {
|
|
4721
|
-
yield this.mutation('delete_category_product', ['affected_rows'], {
|
|
4722
|
-
where: {
|
|
4723
|
-
type: 'category_product_bool_exp',
|
|
4724
|
-
required: true,
|
|
4725
|
-
value: { category_id: { _eq: categoryId } },
|
|
4726
|
-
},
|
|
4727
|
-
});
|
|
4728
|
-
yield this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
4729
|
-
return [];
|
|
4730
|
-
}
|
|
4731
|
-
const plainData = this.paramsToPlain({ products });
|
|
4732
|
-
if (!plainData.products || plainData.products.length <= 0)
|
|
4733
|
-
return [];
|
|
4734
|
-
yield this.mutation('delete_category_product', ['affected_rows'], {
|
|
4735
|
-
where: {
|
|
4736
|
-
type: 'category_product_bool_exp',
|
|
4737
|
-
required: true,
|
|
4738
|
-
value: { category_id: { _eq: categoryId } },
|
|
4739
|
-
},
|
|
4740
|
-
});
|
|
4741
|
-
yield this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
4742
|
-
yield this.mutation('insert_category_product', ['affected_rows'], {
|
|
4743
|
-
objects: {
|
|
4744
|
-
type: '[category_product_insert_input!]',
|
|
4745
|
-
required: true,
|
|
4746
|
-
value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4747
|
-
},
|
|
4748
|
-
});
|
|
4749
|
-
return plainData.products;
|
|
4750
|
-
});
|
|
4751
|
-
}
|
|
4752
|
-
updateMetadata(categoryId, { metadata }) {
|
|
4753
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4754
|
-
const plainData = this.paramsToPlain({ metadata });
|
|
4755
|
-
if (!plainData.metadata)
|
|
4756
|
-
return;
|
|
4757
|
-
yield this.mutation('update_category_metadata_by_pk', ['category_id'], {
|
|
4758
|
-
pk_columns: {
|
|
4759
|
-
value: { category_id: categoryId },
|
|
4760
|
-
type: 'category_metadata_pk_columns_input',
|
|
4761
|
-
required: true,
|
|
4762
|
-
},
|
|
4763
|
-
_set: {
|
|
4764
|
-
value: omit(metadata, ['category_id']),
|
|
4765
|
-
type: 'category_metadata_set_input',
|
|
4766
|
-
required: true,
|
|
4767
|
-
},
|
|
4768
|
-
});
|
|
4769
|
-
return plainData.metadata;
|
|
4770
|
-
});
|
|
4771
|
-
}
|
|
4772
|
-
getCategoryBySlug(slug, _shop) {
|
|
4773
|
-
return this.getWishlistBySlug(slug);
|
|
4774
|
-
}
|
|
4775
|
-
getCategoryByShop(shop) {
|
|
4776
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4777
|
-
if (!shop)
|
|
4778
|
-
return;
|
|
4779
|
-
const { data } = yield this.find({
|
|
4780
|
-
filters: {
|
|
4781
|
-
shops: { operator: Where.IN, value: [shop] },
|
|
4782
|
-
published: { operator: Where.EQUALS, value: true },
|
|
4783
|
-
isWishlist: { operator: Where.EQUALS, value: true },
|
|
4784
|
-
},
|
|
4785
|
-
options: {
|
|
4786
|
-
enableCount: false,
|
|
4787
|
-
},
|
|
4788
|
-
});
|
|
4789
|
-
return data;
|
|
4790
|
-
});
|
|
4791
|
-
}
|
|
4792
|
-
getCategoriesForHome(categoryIds, limit, gender) {
|
|
4793
|
-
return;
|
|
4794
|
-
}
|
|
4795
|
-
mountCategory(category, options) {
|
|
4796
|
-
return;
|
|
4797
|
-
}
|
|
4798
|
-
getChildren(parentId) {
|
|
4799
|
-
return;
|
|
4800
|
-
}
|
|
4801
|
-
isChild(id, parentId) {
|
|
4802
|
-
return;
|
|
4803
|
-
}
|
|
4804
|
-
}
|
|
4805
|
-
|
|
4806
3357
|
/**
|
|
4807
3358
|
* Generated bundle index. Do not edit.
|
|
4808
3359
|
*/
|
|
4809
3360
|
|
|
4810
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository,
|
|
4811
|
-
//# sourceMappingURL=infrab4a-connect.
|
|
3361
|
+
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 };
|
|
3362
|
+
//# sourceMappingURL=infrab4a-connect.mjs.map
|