@infrab4a/connect 4.1.0-beta.9 → 4.1.1-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/index.cjs.d.ts +1 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +5720 -0
- package/index.cjs.mjs +2 -0
- package/index.d.ts +1 -5
- package/{fesm2020/infrab4a-connect.mjs → index.esm.js} +1206 -627
- package/package.json +12 -17
- package/{domain → src/domain}/catalog/models/category-collection-children.d.ts +1 -1
- package/{domain → src/domain}/catalog/models/category-filter.d.ts +1 -1
- package/{domain → src/domain}/catalog/models/kit-product.d.ts +1 -1
- package/src/domain/catalog/models/types/category-condition.type.d.ts +4 -0
- package/{domain → src/domain}/catalog/models/types/category-metadata.type.d.ts +1 -1
- package/{domain → src/domain}/catalog/models/types/category-product.d.ts +1 -1
- package/{domain → src/domain}/catalog/models/types/product-evaluation.type.d.ts +1 -1
- package/src/domain/catalog/models/types/product-gender.type.d.ts +1 -0
- package/{domain → src/domain}/catalog/models/types/product-metadata.type.d.ts +1 -1
- package/{domain → src/domain}/catalog/models/types/product-review.type.d.ts +1 -1
- package/{domain → src/domain}/catalog/models/types/shop-description.type.d.ts +1 -1
- package/{domain → src/domain}/catalog/models/types/shop-price.type.d.ts +1 -1
- package/src/domain/catalog/models/types/stock.type.d.ts +3 -0
- package/{domain → src/domain}/catalog/models/types/variant-grade.type.d.ts +1 -1
- package/{domain → src/domain}/catalog/models/variant.d.ts +1 -1
- package/{domain → src/domain}/catalog/repositories/product.repository.d.ts +2 -2
- package/{domain → src/domain}/generic/model/base.model.d.ts +1 -1
- package/src/domain/generic/model/types/identifier-model.type.d.ts +8 -0
- package/{domain → src/domain}/generic/model/types/model-base-structure.type.d.ts +2 -2
- package/src/domain/generic/model/types/non-function-properties.type.d.ts +12 -0
- package/src/domain/generic/model/types/non-function-property-name.type.d.ts +13 -0
- package/{domain → src/domain}/generic/repository/create.repository.d.ts +1 -1
- package/{domain → src/domain}/generic/repository/crud.repository.d.ts +2 -2
- package/{domain → src/domain}/generic/repository/delete.repository.d.ts +1 -1
- package/{domain → src/domain}/generic/repository/find.repository.d.ts +1 -1
- package/{domain → src/domain}/generic/repository/get.repository.d.ts +1 -1
- package/{domain → src/domain}/generic/repository/read.repository.d.ts +2 -2
- package/{domain → src/domain}/generic/repository/types/repository-find-filters.type.d.ts +4 -4
- package/{domain → src/domain}/generic/repository/types/repository-find-result.type.d.ts +2 -2
- package/{domain → src/domain}/generic/repository/types/repository-limit-options.type.d.ts +1 -1
- package/{domain → src/domain}/generic/repository/types/repository-order-by-list.type.d.ts +2 -2
- package/{domain → src/domain}/generic/repository/types/repository-update-params.type.d.ts +3 -3
- package/src/domain/generic/repository/types/where-options.type.d.ts +2 -0
- package/{domain → src/domain}/generic/repository/update.repository.d.ts +1 -1
- package/{domain → src/domain}/location/models/types/location-bound.type.d.ts +1 -1
- package/{domain → src/domain}/location/models/types/location-geometry.type.d.ts +1 -1
- package/{domain → src/domain}/location/models/types/location-lat-lng.type.d.ts +1 -1
- package/{domain → src/domain}/shop-settings/enums/index.d.ts +0 -1
- package/{domain → src/domain}/shop-settings/helpers/beauty-questions.helper.d.ts +1 -1
- package/{domain → src/domain}/shop-settings/models/index.d.ts +0 -2
- package/{domain → src/domain}/shop-settings/models/shop-settings.d.ts +3 -7
- package/{domain → src/domain}/shop-settings/models/types/banner.type.d.ts +1 -1
- package/{domain → src/domain}/shop-settings/models/types/benefit.type.d.ts +1 -1
- package/{domain → src/domain}/shop-settings/models/types/home-data.type.d.ts +3 -3
- package/{domain → src/domain}/shop-settings/models/types/index.d.ts +0 -6
- package/{domain → src/domain}/shop-settings/models/types/menu-nav.type.d.ts +1 -1
- package/src/domain/shop-settings/models/types/shop-banner.type.d.ts +12 -0
- package/src/domain/shop-settings/models/types/shop-carousel.type.d.ts +5 -0
- package/{domain → src/domain}/shop-settings/models/types/shop-section.type.d.ts +1 -4
- package/{domain → src/domain}/shop-settings/models/types/sub-menu.type.d.ts +2 -2
- package/{domain → src/domain}/shop-settings/repositories/index.d.ts +0 -2
- package/{domain → src/domain}/shopping/models/types/payment-address.type.d.ts +1 -1
- package/{domain → src/domain}/shopping/models/types/payment-billing.type.d.ts +1 -1
- package/{domain → src/domain}/shopping/models/types/payment-card.type.d.ts +1 -1
- package/{domain → src/domain}/shopping/models/types/payment-customer.type.d.ts +1 -1
- package/{domain → src/domain}/shopping/models/types/payment-document.type.d.ts +1 -1
- package/{domain → src/domain}/shopping/models/types/payment-item.type.d.ts +1 -1
- package/{domain → src/domain}/shopping/models/types/payment-shipping.type.d.ts +1 -1
- package/{domain → src/domain}/users/models/beauty-profile.d.ts +1 -1
- package/{domain → src/domain}/users/models/subscription/edition.d.ts +1 -1
- package/{domain → src/domain}/users/models/subscription/payment.d.ts +1 -1
- package/{domain → src/domain}/users/models/user-address.d.ts +1 -1
- package/{domain → src/domain}/users/models/user-payment-method.d.ts +1 -1
- package/{domain → src/domain}/users/services/authentication.service.d.ts +1 -1
- package/{domain → src/domain}/users/services/register.service.d.ts +1 -1
- package/src/domain/users/services/types/basic-user-data.type.d.ts +4 -0
- package/{domain → src/domain}/users/use-cases/authentication.d.ts +2 -2
- package/{domain → src/domain}/users/use-cases/register.d.ts +1 -1
- package/src/index.d.ts +5 -0
- package/{infra → src/infra}/elasticsearch/adapters/axios.adapter.d.ts +1 -1
- package/{infra → src/infra}/elasticsearch/indexes/products-index.d.ts +1 -1
- package/{infra → src/infra}/elasticsearch/types/elastic-search-result.d.ts +1 -1
- package/{infra → src/infra}/firebase/auth/types/firebase-user-with-id.type.d.ts +1 -1
- package/src/infra/firebase/auth/types/index.d.ts +1 -0
- package/{infra → src/infra}/firebase/firestore/mixins/with-firestore.mixin.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +2 -2
- package/{infra → src/infra}/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +2 -2
- package/{infra → src/infra}/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +2 -2
- package/{infra → src/infra}/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +2 -2
- package/{infra → src/infra}/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +2 -2
- package/{infra → src/infra}/firebase/firestore/repositories/users/user-firestore.repository.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +2 -2
- package/{infra → src/infra}/firebase/firestore/types/firestore-interceptors.type.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/types/firestore-sub.repository.type.d.ts +1 -1
- package/{infra → src/infra}/firebase/firestore/types/firestore.repository.type.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +3 -3
- package/{infra → src/infra}/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +2 -2
- package/{infra → src/infra}/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +1 -1
- package/src/infra/hasura-graphql/types/fields.type.d.ts +2 -0
- package/{infra → src/infra}/hasura-graphql/types/graphql.repository.type.d.ts +2 -2
- package/{infra → src/infra}/hasura-graphql/types/hasura-graphql-auth-options.type.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/types/hasura-graphql-fields.type.d.ts +6 -6
- package/{infra → src/infra}/hasura-graphql/types/hasura-graphql-headers.type.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/types/nested-field.type.d.ts +1 -1
- package/{infra → src/infra}/hasura-graphql/types/variable-options.type.d.ts +1 -1
- package/{utils → src/utils}/decorators/trace.method.decorator.d.ts +3 -3
- package/{utils → src/utils}/helpers/debug-decorator.helper.d.ts +1 -1
- package/{utils → src/utils}/helpers/debug.helper.d.ts +3 -3
- package/{utils → src/utils}/helpers/reflect.helper.d.ts +7 -7
- package/{utils → src/utils}/index.d.ts +1 -1
- package/src/utils/mixins/merge-constructor-params.type.d.ts +3 -0
- package/src/utils/mixins/mixin-ctor.type.d.ts +1 -0
- package/src/utils/types/array-element.type.d.ts +1 -0
- package/src/utils/types/prop.type.d.ts +1 -0
- package/README.md +0 -24
- package/domain/catalog/models/types/category-condition.type.d.ts +0 -4
- package/domain/catalog/models/types/product-gender.type.d.ts +0 -1
- package/domain/catalog/models/types/stock.type.d.ts +0 -3
- package/domain/generic/model/types/identifier-model.type.d.ts +0 -8
- package/domain/generic/model/types/non-function-properties.type.d.ts +0 -12
- package/domain/generic/model/types/non-function-property-name.type.d.ts +0 -13
- package/domain/generic/repository/types/where-options.type.d.ts +0 -2
- package/domain/shop-settings/enums/shop-page-name.enum.d.ts +0 -19
- package/domain/shop-settings/models/campaign-banner.d.ts +0 -11
- package/domain/shop-settings/models/campaign.d.ts +0 -10
- package/domain/shop-settings/models/types/campaign-page.d.ts +0 -17
- package/domain/shop-settings/models/types/landing-page.d.ts +0 -8
- package/domain/shop-settings/models/types/sections.type.d.ts +0 -34
- package/domain/shop-settings/models/types/shop-banner.type.d.ts +0 -13
- package/domain/shop-settings/models/types/shop-carousel.type.d.ts +0 -4
- package/domain/shop-settings/models/types/shop-gift.type.d.ts +0 -8
- package/domain/shop-settings/models/types/shop-home.d.ts +0 -12
- package/domain/shop-settings/models/types/shop-post.type.d.ts +0 -7
- package/domain/shop-settings/repositories/campaign-banner.repository.d.ts +0 -4
- package/domain/shop-settings/repositories/campaign.repository.d.ts +0 -4
- package/domain/users/services/types/basic-user-data.type.d.ts +0 -4
- package/esm2020/domain/catalog/helpers/index.mjs +0 -2
- package/esm2020/domain/catalog/helpers/round-product-price.helper.mjs +0 -15
- package/esm2020/domain/catalog/index.mjs +0 -4
- package/esm2020/domain/catalog/models/category-base.mjs +0 -18
- package/esm2020/domain/catalog/models/category-collection-children.mjs +0 -13
- package/esm2020/domain/catalog/models/category-filter.mjs +0 -19
- package/esm2020/domain/catalog/models/category-for-product.mjs +0 -7
- package/esm2020/domain/catalog/models/category.mjs +0 -14
- package/esm2020/domain/catalog/models/enums/index.mjs +0 -3
- package/esm2020/domain/catalog/models/enums/product-genders.enum.mjs +0 -7
- package/esm2020/domain/catalog/models/enums/shops.enum.mjs +0 -8
- package/esm2020/domain/catalog/models/filter-option.mjs +0 -7
- package/esm2020/domain/catalog/models/filter.mjs +0 -7
- package/esm2020/domain/catalog/models/index.mjs +0 -12
- package/esm2020/domain/catalog/models/kit-product.mjs +0 -18
- package/esm2020/domain/catalog/models/product-base.mjs +0 -25
- package/esm2020/domain/catalog/models/product-for-category.mjs +0 -14
- package/esm2020/domain/catalog/models/product-for-kit.mjs +0 -14
- package/esm2020/domain/catalog/models/product.mjs +0 -19
- package/esm2020/domain/catalog/models/types/category-condition.type.mjs +0 -2
- package/esm2020/domain/catalog/models/types/category-metadata.type.mjs +0 -2
- package/esm2020/domain/catalog/models/types/category-product.mjs +0 -2
- package/esm2020/domain/catalog/models/types/index.mjs +0 -12
- package/esm2020/domain/catalog/models/types/product-evaluation.type.mjs +0 -2
- package/esm2020/domain/catalog/models/types/product-gender.type.mjs +0 -2
- package/esm2020/domain/catalog/models/types/product-metadata.type.mjs +0 -2
- package/esm2020/domain/catalog/models/types/product-review.type.mjs +0 -2
- package/esm2020/domain/catalog/models/types/shop-description.type.mjs +0 -2
- package/esm2020/domain/catalog/models/types/shop-price.type.mjs +0 -2
- package/esm2020/domain/catalog/models/types/stock.type.mjs +0 -2
- package/esm2020/domain/catalog/models/types/variant-grade.type.mjs +0 -2
- package/esm2020/domain/catalog/models/variant.mjs +0 -7
- package/esm2020/domain/catalog/models/wishlist.mjs +0 -7
- package/esm2020/domain/catalog/repositories/category-collection-children.repository.mjs +0 -2
- package/esm2020/domain/catalog/repositories/category-filter.repository.mjs +0 -2
- package/esm2020/domain/catalog/repositories/category.repository.mjs +0 -2
- package/esm2020/domain/catalog/repositories/filter-option.repository.mjs +0 -2
- package/esm2020/domain/catalog/repositories/filter.repository.mjs +0 -2
- package/esm2020/domain/catalog/repositories/index.mjs +0 -10
- package/esm2020/domain/catalog/repositories/product.repository.mjs +0 -2
- package/esm2020/domain/catalog/repositories/subscription-product.repository.mjs +0 -2
- package/esm2020/domain/catalog/repositories/variant.repository.mjs +0 -2
- package/esm2020/domain/catalog/repositories/wishlist.repository.mjs +0 -2
- package/esm2020/domain/generic/index.mjs +0 -3
- package/esm2020/domain/generic/model/base.model.mjs +0 -24
- package/esm2020/domain/generic/model/identifier-fields.mjs +0 -2
- package/esm2020/domain/generic/model/index.mjs +0 -4
- package/esm2020/domain/generic/model/types/base-model-builder.type.mjs +0 -2
- package/esm2020/domain/generic/model/types/identifier-model.type.mjs +0 -2
- package/esm2020/domain/generic/model/types/index.mjs +0 -6
- package/esm2020/domain/generic/model/types/model-base-structure.type.mjs +0 -2
- package/esm2020/domain/generic/model/types/non-function-properties.type.mjs +0 -2
- package/esm2020/domain/generic/model/types/non-function-property-name.type.mjs +0 -2
- package/esm2020/domain/generic/repository/create.repository.mjs +0 -2
- package/esm2020/domain/generic/repository/crud.repository.mjs +0 -2
- package/esm2020/domain/generic/repository/delete.repository.mjs +0 -2
- package/esm2020/domain/generic/repository/enums/index.mjs +0 -3
- package/esm2020/domain/generic/repository/enums/update-option-actions.enum.mjs +0 -9
- package/esm2020/domain/generic/repository/enums/where.enum.mjs +0 -16
- package/esm2020/domain/generic/repository/find.repository.mjs +0 -2
- package/esm2020/domain/generic/repository/get.repository.mjs +0 -2
- package/esm2020/domain/generic/repository/index.mjs +0 -10
- package/esm2020/domain/generic/repository/read.repository.mjs +0 -2
- package/esm2020/domain/generic/repository/types/index.mjs +0 -7
- package/esm2020/domain/generic/repository/types/repository-find-filters.type.mjs +0 -2
- package/esm2020/domain/generic/repository/types/repository-find-result.type.mjs +0 -2
- package/esm2020/domain/generic/repository/types/repository-limit-options.type.mjs +0 -2
- package/esm2020/domain/generic/repository/types/repository-order-by-list.type.mjs +0 -2
- package/esm2020/domain/generic/repository/types/repository-update-params.type.mjs +0 -2
- package/esm2020/domain/generic/repository/types/where-options.type.mjs +0 -2
- package/esm2020/domain/generic/repository/update.repository.mjs +0 -2
- package/esm2020/domain/index.mjs +0 -7
- package/esm2020/domain/location/index.mjs +0 -2
- package/esm2020/domain/location/models/address.mjs +0 -7
- package/esm2020/domain/location/models/index.mjs +0 -3
- package/esm2020/domain/location/models/types/index.mjs +0 -4
- package/esm2020/domain/location/models/types/location-bound.type.mjs +0 -2
- package/esm2020/domain/location/models/types/location-geometry.type.mjs +0 -2
- package/esm2020/domain/location/models/types/location-lat-lng.type.mjs +0 -2
- package/esm2020/domain/shop-settings/enums/filter-type.enum.mjs +0 -21
- package/esm2020/domain/shop-settings/enums/index.mjs +0 -4
- package/esm2020/domain/shop-settings/enums/questions-filters.enum.mjs +0 -21
- package/esm2020/domain/shop-settings/enums/shop-page-name.enum.mjs +0 -21
- package/esm2020/domain/shop-settings/helpers/beauty-questions.helper.mjs +0 -47
- package/esm2020/domain/shop-settings/helpers/index.mjs +0 -2
- package/esm2020/domain/shop-settings/index.mjs +0 -5
- package/esm2020/domain/shop-settings/models/campaign-banner.mjs +0 -7
- package/esm2020/domain/shop-settings/models/campaign.mjs +0 -7
- package/esm2020/domain/shop-settings/models/home.mjs +0 -7
- package/esm2020/domain/shop-settings/models/index.mjs +0 -7
- package/esm2020/domain/shop-settings/models/shop-menu.mjs +0 -7
- package/esm2020/domain/shop-settings/models/shop-settings.mjs +0 -7
- package/esm2020/domain/shop-settings/models/types/banner.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/benefit.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/campaign-page.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/home-data.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/index.mjs +0 -17
- package/esm2020/domain/shop-settings/models/types/landing-page.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/menu-nav.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/sections.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/shop-banner.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/shop-brands.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/shop-carousel.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/shop-collection.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/shop-gift.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/shop-home.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/shop-post.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/shop-section.type.mjs +0 -2
- package/esm2020/domain/shop-settings/models/types/sub-menu.type.mjs +0 -2
- package/esm2020/domain/shop-settings/repositories/campaign-banner.repository.mjs +0 -2
- package/esm2020/domain/shop-settings/repositories/campaign.repository.mjs +0 -2
- package/esm2020/domain/shop-settings/repositories/home.repository.mjs +0 -2
- package/esm2020/domain/shop-settings/repositories/index.mjs +0 -6
- package/esm2020/domain/shop-settings/repositories/shop-menu.repository.mjs +0 -2
- package/esm2020/domain/shop-settings/repositories/shop-settings.repository.mjs +0 -2
- package/esm2020/domain/shopping/index.mjs +0 -3
- package/esm2020/domain/shopping/models/buy-2-win.mjs +0 -14
- package/esm2020/domain/shopping/models/campaign-dashboard.mjs +0 -7
- package/esm2020/domain/shopping/models/campaign-hashtag.mjs +0 -7
- package/esm2020/domain/shopping/models/checkout.mjs +0 -37
- package/esm2020/domain/shopping/models/coupons/coupon.mjs +0 -38
- package/esm2020/domain/shopping/models/coupons/enums/coupon-club-mens.enum.mjs +0 -7
- package/esm2020/domain/shopping/models/coupons/enums/coupon-subtypes.enum.mjs +0 -6
- package/esm2020/domain/shopping/models/coupons/enums/coupon-types.enum.mjs +0 -10
- package/esm2020/domain/shopping/models/coupons/enums/exclusivities.enum.mjs +0 -10
- package/esm2020/domain/shopping/models/coupons/enums/index.mjs +0 -4
- package/esm2020/domain/shopping/models/coupons/index.mjs +0 -3
- package/esm2020/domain/shopping/models/enums/checkout-types.enum.mjs +0 -7
- package/esm2020/domain/shopping/models/enums/index.mjs +0 -3
- package/esm2020/domain/shopping/models/enums/order-status.enum.mjs +0 -12
- package/esm2020/domain/shopping/models/index.mjs +0 -13
- package/esm2020/domain/shopping/models/line-item.mjs +0 -4
- package/esm2020/domain/shopping/models/order.mjs +0 -11
- package/esm2020/domain/shopping/models/payment.mjs +0 -169
- package/esm2020/domain/shopping/models/shipping-method.mjs +0 -7
- package/esm2020/domain/shopping/models/subscription/checkout.mjs +0 -28
- package/esm2020/domain/shopping/models/subscription/index.mjs +0 -3
- package/esm2020/domain/shopping/models/subscription/plan.mjs +0 -7
- package/esm2020/domain/shopping/models/types/index.mjs +0 -8
- package/esm2020/domain/shopping/models/types/payment-address.type.mjs +0 -2
- package/esm2020/domain/shopping/models/types/payment-billing.type.mjs +0 -2
- package/esm2020/domain/shopping/models/types/payment-card.type.mjs +0 -2
- package/esm2020/domain/shopping/models/types/payment-customer.type.mjs +0 -2
- package/esm2020/domain/shopping/models/types/payment-document.type.mjs +0 -2
- package/esm2020/domain/shopping/models/types/payment-item.type.mjs +0 -2
- package/esm2020/domain/shopping/models/types/payment-shipping.type.mjs +0 -2
- package/esm2020/domain/shopping/repositories/buy-2-win.repository.mjs +0 -2
- package/esm2020/domain/shopping/repositories/campaign-dashboard.repository.mjs +0 -2
- package/esm2020/domain/shopping/repositories/campaign-hashtag.repository.mjs +0 -2
- package/esm2020/domain/shopping/repositories/checkout.repository.mjs +0 -2
- package/esm2020/domain/shopping/repositories/coupon.repository.mjs +0 -2
- package/esm2020/domain/shopping/repositories/index.mjs +0 -10
- package/esm2020/domain/shopping/repositories/legacy-order.repository.mjs +0 -2
- package/esm2020/domain/shopping/repositories/order.repository.mjs +0 -2
- package/esm2020/domain/shopping/repositories/payment.repository.mjs +0 -2
- package/esm2020/domain/shopping/repositories/subscription/checkout.repository.mjs +0 -2
- package/esm2020/domain/shopping/repositories/subscription/index.mjs +0 -3
- package/esm2020/domain/shopping/repositories/subscription/plan.repository.mjs +0 -2
- package/esm2020/domain/users/errors/index.mjs +0 -4
- package/esm2020/domain/users/errors/unauthorized.error.mjs +0 -7
- package/esm2020/domain/users/errors/user-already-registered.error.mjs +0 -7
- package/esm2020/domain/users/errors/weak-password.error.mjs +0 -7
- package/esm2020/domain/users/index.mjs +0 -6
- package/esm2020/domain/users/models/beauty-profile.mjs +0 -12
- package/esm2020/domain/users/models/enums/accessory-importances.enum.mjs +0 -7
- package/esm2020/domain/users/models/enums/area.enum.mjs +0 -13
- package/esm2020/domain/users/models/enums/beard-problems.enum.mjs +0 -11
- package/esm2020/domain/users/models/enums/beard-sizes.enum.mjs +0 -9
- package/esm2020/domain/users/models/enums/beauty-product-importances.enum.mjs +0 -8
- package/esm2020/domain/users/models/enums/body-problems.enum.mjs +0 -13
- package/esm2020/domain/users/models/enums/body-shapes.enum.mjs +0 -9
- package/esm2020/domain/users/models/enums/body-tattoos.enum.mjs +0 -7
- package/esm2020/domain/users/models/enums/face-skin-oilinesses.enum.mjs +0 -9
- package/esm2020/domain/users/models/enums/face-skin-problems.enum.mjs +0 -12
- package/esm2020/domain/users/models/enums/face-skin-tones.enum.mjs +0 -10
- package/esm2020/domain/users/models/enums/family-incomes.enum.mjs +0 -10
- package/esm2020/domain/users/models/enums/fragrance-importances.enum.mjs +0 -7
- package/esm2020/domain/users/models/enums/hair-colors.enum.mjs +0 -12
- package/esm2020/domain/users/models/enums/hair-problems.enum.mjs +0 -12
- package/esm2020/domain/users/models/enums/hair-strands.enum.mjs +0 -10
- package/esm2020/domain/users/models/enums/hair-types.enum.mjs +0 -9
- package/esm2020/domain/users/models/enums/index.mjs +0 -21
- package/esm2020/domain/users/models/enums/office-position.enum.mjs +0 -8
- package/esm2020/domain/users/models/enums/product-spents.enum.mjs +0 -10
- package/esm2020/domain/users/models/enums/user-type.enum.mjs +0 -10
- package/esm2020/domain/users/models/index.mjs +0 -8
- package/esm2020/domain/users/models/lead.mjs +0 -7
- package/esm2020/domain/users/models/subscription/edition.mjs +0 -7
- package/esm2020/domain/users/models/subscription/enums/billing-status.enum.mjs +0 -5
- package/esm2020/domain/users/models/subscription/enums/edition-status.enum.mjs +0 -6
- package/esm2020/domain/users/models/subscription/enums/index.mjs +0 -5
- package/esm2020/domain/users/models/subscription/enums/payment-type.enum.mjs +0 -7
- package/esm2020/domain/users/models/subscription/enums/status.enum.mjs +0 -6
- package/esm2020/domain/users/models/subscription/index.mjs +0 -5
- package/esm2020/domain/users/models/subscription/payment.mjs +0 -14
- package/esm2020/domain/users/models/subscription/subscription.mjs +0 -43
- package/esm2020/domain/users/models/user-address.mjs +0 -7
- package/esm2020/domain/users/models/user-payment-method.mjs +0 -7
- package/esm2020/domain/users/models/user.mjs +0 -26
- package/esm2020/domain/users/repositories/beauty-profile.repository.mjs +0 -2
- package/esm2020/domain/users/repositories/edition.repository.mjs +0 -2
- package/esm2020/domain/users/repositories/index.mjs +0 -9
- package/esm2020/domain/users/repositories/lead.repository.mjs +0 -2
- package/esm2020/domain/users/repositories/subscription-payment.repository.mjs +0 -2
- package/esm2020/domain/users/repositories/subscription.repository.mjs +0 -2
- package/esm2020/domain/users/repositories/user-address.repository.mjs +0 -2
- package/esm2020/domain/users/repositories/user-payment-method.repository.mjs +0 -2
- package/esm2020/domain/users/repositories/user.repository.mjs +0 -2
- package/esm2020/domain/users/services/authentication.service.mjs +0 -2
- package/esm2020/domain/users/services/index.mjs +0 -4
- package/esm2020/domain/users/services/register.service.mjs +0 -2
- package/esm2020/domain/users/services/types/basic-user-data.type.mjs +0 -2
- package/esm2020/domain/users/services/types/index.mjs +0 -2
- package/esm2020/domain/users/use-cases/authentication.mjs +0 -43
- package/esm2020/domain/users/use-cases/index.mjs +0 -5
- package/esm2020/domain/users/use-cases/recovery-password.mjs +0 -9
- package/esm2020/domain/users/use-cases/register.mjs +0 -38
- package/esm2020/domain/users/use-cases/signout.mjs +0 -9
- package/esm2020/errors/duplicated-results.error.mjs +0 -7
- package/esm2020/errors/index.mjs +0 -5
- package/esm2020/errors/invalid-argument.error.mjs +0 -7
- package/esm2020/errors/not-found.error.mjs +0 -7
- package/esm2020/errors/required-argument.error.mjs +0 -9
- package/esm2020/index.mjs +0 -6
- package/esm2020/infra/elasticsearch/adapters/axios.adapter.mjs +0 -67
- package/esm2020/infra/elasticsearch/adapters/elastic-search.adapter.mjs +0 -2
- package/esm2020/infra/elasticsearch/adapters/index.mjs +0 -3
- package/esm2020/infra/elasticsearch/index.mjs +0 -4
- package/esm2020/infra/elasticsearch/indexes/index.mjs +0 -2
- package/esm2020/infra/elasticsearch/indexes/products-index.mjs +0 -104
- package/esm2020/infra/elasticsearch/types/elastic-search-result.mjs +0 -2
- package/esm2020/infra/elasticsearch/types/index.mjs +0 -2
- package/esm2020/infra/firebase/auth/authentication-firebase-auth.service.mjs +0 -41
- package/esm2020/infra/firebase/auth/index.mjs +0 -3
- package/esm2020/infra/firebase/auth/register-firebase-auth.service.mjs +0 -33
- package/esm2020/infra/firebase/auth/types/firebase-user-with-id.type.mjs +0 -2
- package/esm2020/infra/firebase/firestore/enums/firestore-field-type.enum.mjs +0 -10
- package/esm2020/infra/firebase/firestore/enums/index.mjs +0 -2
- package/esm2020/infra/firebase/firestore/index.mjs +0 -4
- package/esm2020/infra/firebase/firestore/mixins/index.mjs +0 -10
- package/esm2020/infra/firebase/firestore/mixins/with-create-firestore.mixin.mjs +0 -31
- package/esm2020/infra/firebase/firestore/mixins/with-crud-firestore.mixin.mjs +0 -10
- package/esm2020/infra/firebase/firestore/mixins/with-delete-firestore.mixin.mjs +0 -18
- package/esm2020/infra/firebase/firestore/mixins/with-find-firestore.mixin.mjs +0 -110
- package/esm2020/infra/firebase/firestore/mixins/with-firestore.mixin.mjs +0 -80
- package/esm2020/infra/firebase/firestore/mixins/with-get-firestore.mixin.mjs +0 -23
- package/esm2020/infra/firebase/firestore/mixins/with-helpers.mixin.mjs +0 -17
- package/esm2020/infra/firebase/firestore/mixins/with-sub-collection.mixin.mjs +0 -13
- package/esm2020/infra/firebase/firestore/mixins/with-update-firestore.mixin.mjs +0 -51
- package/esm2020/infra/firebase/firestore/repositories/catalog/category-firestore.repository.mjs +0 -67
- package/esm2020/infra/firebase/firestore/repositories/catalog/index.mjs +0 -5
- package/esm2020/infra/firebase/firestore/repositories/catalog/product-firestore.repository.mjs +0 -54
- package/esm2020/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.mjs +0 -16
- package/esm2020/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/index.mjs +0 -5
- package/esm2020/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.mjs +0 -60
- package/esm2020/infra/firebase/firestore/repositories/shop-settings/index.mjs +0 -4
- package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.mjs +0 -31
- package/esm2020/infra/firebase/firestore/repositories/shopping/index.mjs +0 -11
- package/esm2020/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.mjs +0 -11
- package/esm2020/infra/firebase/firestore/repositories/shopping/order-firestore.repository.mjs +0 -40
- package/esm2020/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/users/index.mjs +0 -9
- package/esm2020/infra/firebase/firestore/repositories/users/lead-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.mjs +0 -16
- package/esm2020/infra/firebase/firestore/repositories/users/subscription-firestore.repository.mjs +0 -14
- package/esm2020/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.mjs +0 -16
- package/esm2020/infra/firebase/firestore/repositories/users/user-address-firestore.repository.mjs +0 -16
- package/esm2020/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.mjs +0 -16
- package/esm2020/infra/firebase/firestore/repositories/users/user-firestore.repository.mjs +0 -50
- package/esm2020/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.mjs +0 -16
- package/esm2020/infra/firebase/firestore/types/firestore-interceptors.type.mjs +0 -2
- package/esm2020/infra/firebase/firestore/types/firestore-sub.repository.type.mjs +0 -2
- package/esm2020/infra/firebase/firestore/types/firestore.helpers.type.mjs +0 -2
- package/esm2020/infra/firebase/firestore/types/firestore.repository.type.mjs +0 -2
- package/esm2020/infra/firebase/firestore/types/index.mjs +0 -5
- package/esm2020/infra/firebase/index.mjs +0 -3
- package/esm2020/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.mjs +0 -13
- package/esm2020/infra/hasura-graphql/enums/hasura-graphql-where.enum.mjs +0 -17
- package/esm2020/infra/hasura-graphql/enums/index.mjs +0 -3
- package/esm2020/infra/hasura-graphql/index.mjs +0 -5
- package/esm2020/infra/hasura-graphql/mixins/helpers/attribute-option.helper.mjs +0 -35
- package/esm2020/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.mjs +0 -71
- package/esm2020/infra/hasura-graphql/mixins/helpers/filter-option.helper.mjs +0 -22
- package/esm2020/infra/hasura-graphql/mixins/helpers/graphql-field.helper.mjs +0 -125
- package/esm2020/infra/hasura-graphql/mixins/helpers/index.mjs +0 -5
- package/esm2020/infra/hasura-graphql/mixins/index.mjs +0 -8
- package/esm2020/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.mjs +0 -39
- package/esm2020/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.mjs +0 -10
- package/esm2020/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.mjs +0 -31
- package/esm2020/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.mjs +0 -152
- package/esm2020/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.mjs +0 -37
- package/esm2020/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.mjs +0 -108
- package/esm2020/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.mjs +0 -62
- package/esm2020/infra/hasura-graphql/models/category-hasura-graphql.mjs +0 -4
- package/esm2020/infra/hasura-graphql/models/index.mjs +0 -5
- package/esm2020/infra/hasura-graphql/models/kit-product-hasura-graphql.mjs +0 -15
- package/esm2020/infra/hasura-graphql/models/product-hasura-graphql.mjs +0 -11
- package/esm2020/infra/hasura-graphql/models/variant-hasura-graphql.mjs +0 -9
- package/esm2020/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.mjs +0 -39
- package/esm2020/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.mjs +0 -107
- package/esm2020/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.mjs +0 -338
- package/esm2020/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.mjs +0 -105
- package/esm2020/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.mjs +0 -22
- package/esm2020/infra/hasura-graphql/repositories/catalog/index.mjs +0 -9
- package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +0 -516
- package/esm2020/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.mjs +0 -114
- package/esm2020/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.mjs +0 -238
- package/esm2020/infra/hasura-graphql/repositories/index.mjs +0 -2
- package/esm2020/infra/hasura-graphql/types/fields.type.mjs +0 -2
- package/esm2020/infra/hasura-graphql/types/graphql.repository.type.mjs +0 -2
- package/esm2020/infra/hasura-graphql/types/hasura-graphql-auth-options.type.mjs +0 -2
- package/esm2020/infra/hasura-graphql/types/hasura-graphql-fields.type.mjs +0 -2
- package/esm2020/infra/hasura-graphql/types/hasura-graphql-headers.type.mjs +0 -2
- package/esm2020/infra/hasura-graphql/types/index.mjs +0 -9
- package/esm2020/infra/hasura-graphql/types/nested-field.type.mjs +0 -2
- package/esm2020/infra/hasura-graphql/types/query-builder-options.type.mjs +0 -2
- package/esm2020/infra/hasura-graphql/types/variable-options.type.mjs +0 -2
- package/esm2020/infra/index.mjs +0 -4
- package/esm2020/infrab4a-connect.mjs +0 -5
- package/esm2020/utils/decorators/debug.class.decorator.mjs +0 -7
- package/esm2020/utils/decorators/index.mjs +0 -3
- package/esm2020/utils/decorators/trace.method.decorator.mjs +0 -81
- package/esm2020/utils/get.mjs +0 -3
- package/esm2020/utils/helpers/class-name.helper.mjs +0 -15
- package/esm2020/utils/helpers/debug-decorator.helper.mjs +0 -18
- package/esm2020/utils/helpers/debug.helper.mjs +0 -150
- package/esm2020/utils/helpers/index.mjs +0 -5
- package/esm2020/utils/helpers/reflect.helper.mjs +0 -165
- package/esm2020/utils/index.mjs +0 -13
- package/esm2020/utils/is-uuid.mjs +0 -3
- package/esm2020/utils/is.mjs +0 -4
- package/esm2020/utils/log.utils.mjs +0 -9
- package/esm2020/utils/mixins/base.mixin.mjs +0 -6
- package/esm2020/utils/mixins/index.mjs +0 -4
- package/esm2020/utils/mixins/merge-constructor-params.type.mjs +0 -2
- package/esm2020/utils/mixins/mixin-ctor.type.mjs +0 -2
- package/esm2020/utils/parse-datetime.mjs +0 -14
- package/esm2020/utils/types/array-element.type.mjs +0 -2
- package/esm2020/utils/types/index.mjs +0 -3
- package/esm2020/utils/types/prop.type.mjs +0 -2
- package/fesm2015/infrab4a-connect.mjs +0 -4976
- package/fesm2015/infrab4a-connect.mjs.map +0 -1
- package/fesm2020/infrab4a-connect.mjs.map +0 -1
- package/infra/hasura-graphql/types/fields.type.d.ts +0 -2
- package/utils/mixins/merge-constructor-params.type.d.ts +0 -3
- package/utils/mixins/mixin-ctor.type.d.ts +0 -1
- package/utils/types/array-element.type.d.ts +0 -1
- package/utils/types/prop.type.d.ts +0 -1
- /package/{domain → src/domain}/catalog/helpers/index.d.ts +0 -0
- /package/{domain → src/domain}/catalog/helpers/round-product-price.helper.d.ts +0 -0
- /package/{domain → src/domain}/catalog/index.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/category-base.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/category-for-product.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/category.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/enums/index.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/enums/product-genders.enum.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/enums/shops.enum.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/filter-option.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/filter.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/index.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/product-base.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/product-for-category.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/product-for-kit.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/product.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/types/index.d.ts +0 -0
- /package/{domain → src/domain}/catalog/models/wishlist.d.ts +0 -0
- /package/{domain → src/domain}/catalog/repositories/category-collection-children.repository.d.ts +0 -0
- /package/{domain → src/domain}/catalog/repositories/category-filter.repository.d.ts +0 -0
- /package/{domain → src/domain}/catalog/repositories/category.repository.d.ts +0 -0
- /package/{domain → src/domain}/catalog/repositories/filter-option.repository.d.ts +0 -0
- /package/{domain → src/domain}/catalog/repositories/filter.repository.d.ts +0 -0
- /package/{domain → src/domain}/catalog/repositories/index.d.ts +0 -0
- /package/{domain → src/domain}/catalog/repositories/subscription-product.repository.d.ts +0 -0
- /package/{domain → src/domain}/catalog/repositories/variant.repository.d.ts +0 -0
- /package/{domain → src/domain}/catalog/repositories/wishlist.repository.d.ts +0 -0
- /package/{domain → src/domain}/generic/index.d.ts +0 -0
- /package/{domain → src/domain}/generic/model/identifier-fields.d.ts +0 -0
- /package/{domain → src/domain}/generic/model/index.d.ts +0 -0
- /package/{domain → src/domain}/generic/model/types/base-model-builder.type.d.ts +0 -0
- /package/{domain → src/domain}/generic/model/types/index.d.ts +0 -0
- /package/{domain → src/domain}/generic/repository/enums/index.d.ts +0 -0
- /package/{domain → src/domain}/generic/repository/enums/update-option-actions.enum.d.ts +0 -0
- /package/{domain → src/domain}/generic/repository/enums/where.enum.d.ts +0 -0
- /package/{domain → src/domain}/generic/repository/index.d.ts +0 -0
- /package/{domain → src/domain}/generic/repository/types/index.d.ts +0 -0
- /package/{domain → src/domain}/index.d.ts +0 -0
- /package/{domain → src/domain}/location/index.d.ts +0 -0
- /package/{domain → src/domain}/location/models/address.d.ts +0 -0
- /package/{domain → src/domain}/location/models/index.d.ts +0 -0
- /package/{domain → src/domain}/location/models/types/index.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/enums/filter-type.enum.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/enums/questions-filters.enum.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/helpers/index.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/index.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/models/home.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/models/shop-menu.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/models/types/shop-brands.type.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/models/types/shop-collection.type.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/repositories/home.repository.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/repositories/shop-menu.repository.d.ts +0 -0
- /package/{domain → src/domain}/shop-settings/repositories/shop-settings.repository.d.ts +0 -0
- /package/{domain → src/domain}/shopping/index.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/buy-2-win.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/campaign-dashboard.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/campaign-hashtag.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/checkout.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/coupons/coupon.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/coupons/enums/coupon-club-mens.enum.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/coupons/enums/coupon-subtypes.enum.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/coupons/enums/coupon-types.enum.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/coupons/enums/exclusivities.enum.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/coupons/enums/index.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/coupons/index.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/enums/checkout-types.enum.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/enums/index.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/enums/order-status.enum.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/index.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/line-item.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/order.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/payment.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/shipping-method.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/subscription/checkout.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/subscription/index.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/subscription/plan.d.ts +0 -0
- /package/{domain → src/domain}/shopping/models/types/index.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/buy-2-win.repository.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/campaign-dashboard.repository.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/campaign-hashtag.repository.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/checkout.repository.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/coupon.repository.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/index.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/legacy-order.repository.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/order.repository.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/payment.repository.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/subscription/checkout.repository.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/subscription/index.d.ts +0 -0
- /package/{domain → src/domain}/shopping/repositories/subscription/plan.repository.d.ts +0 -0
- /package/{domain → src/domain}/users/errors/index.d.ts +0 -0
- /package/{domain → src/domain}/users/errors/unauthorized.error.d.ts +0 -0
- /package/{domain → src/domain}/users/errors/user-already-registered.error.d.ts +0 -0
- /package/{domain → src/domain}/users/errors/weak-password.error.d.ts +0 -0
- /package/{domain → src/domain}/users/index.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/accessory-importances.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/area.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/beard-problems.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/beard-sizes.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/beauty-product-importances.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/body-problems.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/body-shapes.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/body-tattoos.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/face-skin-oilinesses.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/face-skin-problems.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/face-skin-tones.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/family-incomes.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/fragrance-importances.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/hair-colors.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/hair-problems.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/hair-strands.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/hair-types.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/index.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/office-position.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/product-spents.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/enums/user-type.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/index.d.ts +0 -0
- /package/{domain → src/domain}/users/models/lead.d.ts +0 -0
- /package/{domain → src/domain}/users/models/subscription/enums/billing-status.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/subscription/enums/edition-status.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/subscription/enums/index.d.ts +0 -0
- /package/{domain → src/domain}/users/models/subscription/enums/payment-type.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/subscription/enums/status.enum.d.ts +0 -0
- /package/{domain → src/domain}/users/models/subscription/index.d.ts +0 -0
- /package/{domain → src/domain}/users/models/subscription/subscription.d.ts +0 -0
- /package/{domain → src/domain}/users/models/user.d.ts +0 -0
- /package/{domain → src/domain}/users/repositories/beauty-profile.repository.d.ts +0 -0
- /package/{domain → src/domain}/users/repositories/edition.repository.d.ts +0 -0
- /package/{domain → src/domain}/users/repositories/index.d.ts +0 -0
- /package/{domain → src/domain}/users/repositories/lead.repository.d.ts +0 -0
- /package/{domain → src/domain}/users/repositories/subscription-payment.repository.d.ts +0 -0
- /package/{domain → src/domain}/users/repositories/subscription.repository.d.ts +0 -0
- /package/{domain → src/domain}/users/repositories/user-address.repository.d.ts +0 -0
- /package/{domain → src/domain}/users/repositories/user-payment-method.repository.d.ts +0 -0
- /package/{domain → src/domain}/users/repositories/user.repository.d.ts +0 -0
- /package/{domain → src/domain}/users/services/index.d.ts +0 -0
- /package/{domain → src/domain}/users/services/types/index.d.ts +0 -0
- /package/{domain → src/domain}/users/use-cases/index.d.ts +0 -0
- /package/{domain → src/domain}/users/use-cases/recovery-password.d.ts +0 -0
- /package/{domain → src/domain}/users/use-cases/signout.d.ts +0 -0
- /package/{errors → src/errors}/duplicated-results.error.d.ts +0 -0
- /package/{errors → src/errors}/index.d.ts +0 -0
- /package/{errors → src/errors}/invalid-argument.error.d.ts +0 -0
- /package/{errors → src/errors}/not-found.error.d.ts +0 -0
- /package/{errors → src/errors}/required-argument.error.d.ts +0 -0
- /package/{infra → src/infra}/elasticsearch/adapters/elastic-search.adapter.d.ts +0 -0
- /package/{infra → src/infra}/elasticsearch/adapters/index.d.ts +0 -0
- /package/{infra → src/infra}/elasticsearch/index.d.ts +0 -0
- /package/{infra → src/infra}/elasticsearch/indexes/index.d.ts +0 -0
- /package/{infra → src/infra}/elasticsearch/types/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/auth/authentication-firebase-auth.service.d.ts +0 -0
- /package/{infra → src/infra}/firebase/auth/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/auth/register-firebase-auth.service.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/enums/firestore-field-type.enum.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/enums/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/mixins/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/mixins/with-helpers.mixin.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/repositories/catalog/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/repositories/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/repositories/shop-settings/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/repositories/shopping/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/repositories/users/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/types/firestore.helpers.type.d.ts +0 -0
- /package/{infra → src/infra}/firebase/firestore/types/index.d.ts +0 -0
- /package/{infra → src/infra}/firebase/index.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/enums/hasura-graphql-column-type.enum.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/enums/hasura-graphql-where.enum.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/enums/index.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/index.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/mixins/helpers/bind-filter-query.helper.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/mixins/helpers/index.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/mixins/index.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/models/category-hasura-graphql.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/models/index.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/models/kit-product-hasura-graphql.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/models/product-hasura-graphql.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/models/variant-hasura-graphql.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/repositories/catalog/index.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/repositories/index.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/types/index.d.ts +0 -0
- /package/{infra → src/infra}/hasura-graphql/types/query-builder-options.type.d.ts +0 -0
- /package/{infra → src/infra}/index.d.ts +0 -0
- /package/{utils → src/utils}/decorators/debug.class.decorator.d.ts +0 -0
- /package/{utils → src/utils}/decorators/index.d.ts +0 -0
- /package/{utils → src/utils}/get.d.ts +0 -0
- /package/{utils → src/utils}/helpers/class-name.helper.d.ts +0 -0
- /package/{utils → src/utils}/helpers/index.d.ts +0 -0
- /package/{utils → src/utils}/is-uuid.d.ts +0 -0
- /package/{utils → src/utils}/is.d.ts +0 -0
- /package/{utils → src/utils}/log.utils.d.ts +0 -0
- /package/{utils → src/utils}/mixins/base.mixin.d.ts +0 -0
- /package/{utils → src/utils}/mixins/index.d.ts +0 -0
- /package/{utils → src/utils}/parse-datetime.d.ts +0 -0
- /package/{utils → src/utils}/types/index.d.ts +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transformer';
|
|
3
|
-
import
|
|
3
|
+
import * as tslib_1 from 'tslib';
|
|
4
|
+
import { __decorate, __metadata, __rest } from 'tslib';
|
|
4
5
|
import { parseISO } from 'date-fns';
|
|
5
6
|
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
6
|
-
import { isNil, isArray, first, last, flatten, compact, get
|
|
7
|
+
import { isNil, isArray as isArray$1, first, last, flatten, compact, get, isString, each, unset, isObject as isObject$1, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
|
|
7
8
|
export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
|
|
8
|
-
import { Subject } from 'rxjs';
|
|
9
9
|
import { debug } from 'debug';
|
|
10
10
|
import { CustomError } from 'ts-custom-error';
|
|
11
11
|
import axios from 'axios';
|
|
@@ -17,7 +17,7 @@ class BaseModel {
|
|
|
17
17
|
get identifier() {
|
|
18
18
|
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
19
19
|
const data = this;
|
|
20
|
-
return fields.reduce((object, field) => ({
|
|
20
|
+
return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: data[field] })), {});
|
|
21
21
|
}
|
|
22
22
|
get identifiersFields() {
|
|
23
23
|
return this.constructor.identifiersFields;
|
|
@@ -463,6 +463,790 @@ __decorate([
|
|
|
463
463
|
__metadata("design:type", Payment)
|
|
464
464
|
], SubscriptionPayment.prototype, "payment", void 0);
|
|
465
465
|
|
|
466
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
467
|
+
function isFunction(x) {
|
|
468
|
+
return typeof x === 'function';
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
472
|
+
var _enable_super_gross_mode_that_will_cause_bad_things = false;
|
|
473
|
+
var config = {
|
|
474
|
+
Promise: undefined,
|
|
475
|
+
set useDeprecatedSynchronousErrorHandling(value) {
|
|
476
|
+
if (value) {
|
|
477
|
+
var error = /*@__PURE__*/ new Error();
|
|
478
|
+
/*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
|
|
479
|
+
}
|
|
480
|
+
_enable_super_gross_mode_that_will_cause_bad_things = value;
|
|
481
|
+
},
|
|
482
|
+
get useDeprecatedSynchronousErrorHandling() {
|
|
483
|
+
return _enable_super_gross_mode_that_will_cause_bad_things;
|
|
484
|
+
},
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
488
|
+
function hostReportError(err) {
|
|
489
|
+
setTimeout(function () { throw err; }, 0);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */
|
|
493
|
+
var empty = {
|
|
494
|
+
closed: true,
|
|
495
|
+
next: function (value) { },
|
|
496
|
+
error: function (err) {
|
|
497
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
498
|
+
throw err;
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
hostReportError(err);
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
complete: function () { }
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
508
|
+
var isArray = /*@__PURE__*/ (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })();
|
|
509
|
+
|
|
510
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
511
|
+
function isObject(x) {
|
|
512
|
+
return x !== null && typeof x === 'object';
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
516
|
+
var UnsubscriptionErrorImpl = /*@__PURE__*/ (function () {
|
|
517
|
+
function UnsubscriptionErrorImpl(errors) {
|
|
518
|
+
Error.call(this);
|
|
519
|
+
this.message = errors ?
|
|
520
|
+
errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : '';
|
|
521
|
+
this.name = 'UnsubscriptionError';
|
|
522
|
+
this.errors = errors;
|
|
523
|
+
return this;
|
|
524
|
+
}
|
|
525
|
+
UnsubscriptionErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
|
|
526
|
+
return UnsubscriptionErrorImpl;
|
|
527
|
+
})();
|
|
528
|
+
var UnsubscriptionError = UnsubscriptionErrorImpl;
|
|
529
|
+
|
|
530
|
+
/** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_UnsubscriptionError PURE_IMPORTS_END */
|
|
531
|
+
var Subscription$1 = /*@__PURE__*/ (function () {
|
|
532
|
+
function Subscription(unsubscribe) {
|
|
533
|
+
this.closed = false;
|
|
534
|
+
this._parentOrParents = null;
|
|
535
|
+
this._subscriptions = null;
|
|
536
|
+
if (unsubscribe) {
|
|
537
|
+
this._ctorUnsubscribe = true;
|
|
538
|
+
this._unsubscribe = unsubscribe;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
Subscription.prototype.unsubscribe = function () {
|
|
542
|
+
var errors;
|
|
543
|
+
if (this.closed) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
|
|
547
|
+
this.closed = true;
|
|
548
|
+
this._parentOrParents = null;
|
|
549
|
+
this._subscriptions = null;
|
|
550
|
+
if (_parentOrParents instanceof Subscription) {
|
|
551
|
+
_parentOrParents.remove(this);
|
|
552
|
+
}
|
|
553
|
+
else if (_parentOrParents !== null) {
|
|
554
|
+
for (var index = 0; index < _parentOrParents.length; ++index) {
|
|
555
|
+
var parent_1 = _parentOrParents[index];
|
|
556
|
+
parent_1.remove(this);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (isFunction(_unsubscribe)) {
|
|
560
|
+
if (_ctorUnsubscribe) {
|
|
561
|
+
this._unsubscribe = undefined;
|
|
562
|
+
}
|
|
563
|
+
try {
|
|
564
|
+
_unsubscribe.call(this);
|
|
565
|
+
}
|
|
566
|
+
catch (e) {
|
|
567
|
+
errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (isArray(_subscriptions)) {
|
|
571
|
+
var index = -1;
|
|
572
|
+
var len = _subscriptions.length;
|
|
573
|
+
while (++index < len) {
|
|
574
|
+
var sub = _subscriptions[index];
|
|
575
|
+
if (isObject(sub)) {
|
|
576
|
+
try {
|
|
577
|
+
sub.unsubscribe();
|
|
578
|
+
}
|
|
579
|
+
catch (e) {
|
|
580
|
+
errors = errors || [];
|
|
581
|
+
if (e instanceof UnsubscriptionError) {
|
|
582
|
+
errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
errors.push(e);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (errors) {
|
|
592
|
+
throw new UnsubscriptionError(errors);
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
Subscription.prototype.add = function (teardown) {
|
|
596
|
+
var subscription = teardown;
|
|
597
|
+
if (!teardown) {
|
|
598
|
+
return Subscription.EMPTY;
|
|
599
|
+
}
|
|
600
|
+
switch (typeof teardown) {
|
|
601
|
+
case 'function':
|
|
602
|
+
subscription = new Subscription(teardown);
|
|
603
|
+
case 'object':
|
|
604
|
+
if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
|
|
605
|
+
return subscription;
|
|
606
|
+
}
|
|
607
|
+
else if (this.closed) {
|
|
608
|
+
subscription.unsubscribe();
|
|
609
|
+
return subscription;
|
|
610
|
+
}
|
|
611
|
+
else if (!(subscription instanceof Subscription)) {
|
|
612
|
+
var tmp = subscription;
|
|
613
|
+
subscription = new Subscription();
|
|
614
|
+
subscription._subscriptions = [tmp];
|
|
615
|
+
}
|
|
616
|
+
break;
|
|
617
|
+
default: {
|
|
618
|
+
throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
var _parentOrParents = subscription._parentOrParents;
|
|
622
|
+
if (_parentOrParents === null) {
|
|
623
|
+
subscription._parentOrParents = this;
|
|
624
|
+
}
|
|
625
|
+
else if (_parentOrParents instanceof Subscription) {
|
|
626
|
+
if (_parentOrParents === this) {
|
|
627
|
+
return subscription;
|
|
628
|
+
}
|
|
629
|
+
subscription._parentOrParents = [_parentOrParents, this];
|
|
630
|
+
}
|
|
631
|
+
else if (_parentOrParents.indexOf(this) === -1) {
|
|
632
|
+
_parentOrParents.push(this);
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
return subscription;
|
|
636
|
+
}
|
|
637
|
+
var subscriptions = this._subscriptions;
|
|
638
|
+
if (subscriptions === null) {
|
|
639
|
+
this._subscriptions = [subscription];
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
subscriptions.push(subscription);
|
|
643
|
+
}
|
|
644
|
+
return subscription;
|
|
645
|
+
};
|
|
646
|
+
Subscription.prototype.remove = function (subscription) {
|
|
647
|
+
var subscriptions = this._subscriptions;
|
|
648
|
+
if (subscriptions) {
|
|
649
|
+
var subscriptionIndex = subscriptions.indexOf(subscription);
|
|
650
|
+
if (subscriptionIndex !== -1) {
|
|
651
|
+
subscriptions.splice(subscriptionIndex, 1);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
Subscription.EMPTY = (function (empty) {
|
|
656
|
+
empty.closed = true;
|
|
657
|
+
return empty;
|
|
658
|
+
}(new Subscription()));
|
|
659
|
+
return Subscription;
|
|
660
|
+
}());
|
|
661
|
+
function flattenUnsubscriptionErrors(errors) {
|
|
662
|
+
return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
666
|
+
var rxSubscriber = /*@__PURE__*/ (function () {
|
|
667
|
+
return typeof Symbol === 'function'
|
|
668
|
+
? /*@__PURE__*/ Symbol('rxSubscriber')
|
|
669
|
+
: '@@rxSubscriber_' + /*@__PURE__*/ Math.random();
|
|
670
|
+
})();
|
|
671
|
+
|
|
672
|
+
/** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */
|
|
673
|
+
var Subscriber = /*@__PURE__*/ (function (_super) {
|
|
674
|
+
tslib_1.__extends(Subscriber, _super);
|
|
675
|
+
function Subscriber(destinationOrNext, error, complete) {
|
|
676
|
+
var _this = _super.call(this) || this;
|
|
677
|
+
_this.syncErrorValue = null;
|
|
678
|
+
_this.syncErrorThrown = false;
|
|
679
|
+
_this.syncErrorThrowable = false;
|
|
680
|
+
_this.isStopped = false;
|
|
681
|
+
switch (arguments.length) {
|
|
682
|
+
case 0:
|
|
683
|
+
_this.destination = empty;
|
|
684
|
+
break;
|
|
685
|
+
case 1:
|
|
686
|
+
if (!destinationOrNext) {
|
|
687
|
+
_this.destination = empty;
|
|
688
|
+
break;
|
|
689
|
+
}
|
|
690
|
+
if (typeof destinationOrNext === 'object') {
|
|
691
|
+
if (destinationOrNext instanceof Subscriber) {
|
|
692
|
+
_this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
|
|
693
|
+
_this.destination = destinationOrNext;
|
|
694
|
+
destinationOrNext.add(_this);
|
|
695
|
+
}
|
|
696
|
+
else {
|
|
697
|
+
_this.syncErrorThrowable = true;
|
|
698
|
+
_this.destination = new SafeSubscriber(_this, destinationOrNext);
|
|
699
|
+
}
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
default:
|
|
703
|
+
_this.syncErrorThrowable = true;
|
|
704
|
+
_this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
return _this;
|
|
708
|
+
}
|
|
709
|
+
Subscriber.prototype[rxSubscriber] = function () { return this; };
|
|
710
|
+
Subscriber.create = function (next, error, complete) {
|
|
711
|
+
var subscriber = new Subscriber(next, error, complete);
|
|
712
|
+
subscriber.syncErrorThrowable = false;
|
|
713
|
+
return subscriber;
|
|
714
|
+
};
|
|
715
|
+
Subscriber.prototype.next = function (value) {
|
|
716
|
+
if (!this.isStopped) {
|
|
717
|
+
this._next(value);
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
Subscriber.prototype.error = function (err) {
|
|
721
|
+
if (!this.isStopped) {
|
|
722
|
+
this.isStopped = true;
|
|
723
|
+
this._error(err);
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
Subscriber.prototype.complete = function () {
|
|
727
|
+
if (!this.isStopped) {
|
|
728
|
+
this.isStopped = true;
|
|
729
|
+
this._complete();
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
Subscriber.prototype.unsubscribe = function () {
|
|
733
|
+
if (this.closed) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
this.isStopped = true;
|
|
737
|
+
_super.prototype.unsubscribe.call(this);
|
|
738
|
+
};
|
|
739
|
+
Subscriber.prototype._next = function (value) {
|
|
740
|
+
this.destination.next(value);
|
|
741
|
+
};
|
|
742
|
+
Subscriber.prototype._error = function (err) {
|
|
743
|
+
this.destination.error(err);
|
|
744
|
+
this.unsubscribe();
|
|
745
|
+
};
|
|
746
|
+
Subscriber.prototype._complete = function () {
|
|
747
|
+
this.destination.complete();
|
|
748
|
+
this.unsubscribe();
|
|
749
|
+
};
|
|
750
|
+
Subscriber.prototype._unsubscribeAndRecycle = function () {
|
|
751
|
+
var _parentOrParents = this._parentOrParents;
|
|
752
|
+
this._parentOrParents = null;
|
|
753
|
+
this.unsubscribe();
|
|
754
|
+
this.closed = false;
|
|
755
|
+
this.isStopped = false;
|
|
756
|
+
this._parentOrParents = _parentOrParents;
|
|
757
|
+
return this;
|
|
758
|
+
};
|
|
759
|
+
return Subscriber;
|
|
760
|
+
}(Subscription$1));
|
|
761
|
+
var SafeSubscriber = /*@__PURE__*/ (function (_super) {
|
|
762
|
+
tslib_1.__extends(SafeSubscriber, _super);
|
|
763
|
+
function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
|
|
764
|
+
var _this = _super.call(this) || this;
|
|
765
|
+
_this._parentSubscriber = _parentSubscriber;
|
|
766
|
+
var next;
|
|
767
|
+
var context = _this;
|
|
768
|
+
if (isFunction(observerOrNext)) {
|
|
769
|
+
next = observerOrNext;
|
|
770
|
+
}
|
|
771
|
+
else if (observerOrNext) {
|
|
772
|
+
next = observerOrNext.next;
|
|
773
|
+
error = observerOrNext.error;
|
|
774
|
+
complete = observerOrNext.complete;
|
|
775
|
+
if (observerOrNext !== empty) {
|
|
776
|
+
context = Object.create(observerOrNext);
|
|
777
|
+
if (isFunction(context.unsubscribe)) {
|
|
778
|
+
_this.add(context.unsubscribe.bind(context));
|
|
779
|
+
}
|
|
780
|
+
context.unsubscribe = _this.unsubscribe.bind(_this);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
_this._context = context;
|
|
784
|
+
_this._next = next;
|
|
785
|
+
_this._error = error;
|
|
786
|
+
_this._complete = complete;
|
|
787
|
+
return _this;
|
|
788
|
+
}
|
|
789
|
+
SafeSubscriber.prototype.next = function (value) {
|
|
790
|
+
if (!this.isStopped && this._next) {
|
|
791
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
792
|
+
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
793
|
+
this.__tryOrUnsub(this._next, value);
|
|
794
|
+
}
|
|
795
|
+
else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
|
|
796
|
+
this.unsubscribe();
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
SafeSubscriber.prototype.error = function (err) {
|
|
801
|
+
if (!this.isStopped) {
|
|
802
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
803
|
+
var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling;
|
|
804
|
+
if (this._error) {
|
|
805
|
+
if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
806
|
+
this.__tryOrUnsub(this._error, err);
|
|
807
|
+
this.unsubscribe();
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
this.__tryOrSetError(_parentSubscriber, this._error, err);
|
|
811
|
+
this.unsubscribe();
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
else if (!_parentSubscriber.syncErrorThrowable) {
|
|
815
|
+
this.unsubscribe();
|
|
816
|
+
if (useDeprecatedSynchronousErrorHandling) {
|
|
817
|
+
throw err;
|
|
818
|
+
}
|
|
819
|
+
hostReportError(err);
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
if (useDeprecatedSynchronousErrorHandling) {
|
|
823
|
+
_parentSubscriber.syncErrorValue = err;
|
|
824
|
+
_parentSubscriber.syncErrorThrown = true;
|
|
825
|
+
}
|
|
826
|
+
else {
|
|
827
|
+
hostReportError(err);
|
|
828
|
+
}
|
|
829
|
+
this.unsubscribe();
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
SafeSubscriber.prototype.complete = function () {
|
|
834
|
+
var _this = this;
|
|
835
|
+
if (!this.isStopped) {
|
|
836
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
837
|
+
if (this._complete) {
|
|
838
|
+
var wrappedComplete = function () { return _this._complete.call(_this._context); };
|
|
839
|
+
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
840
|
+
this.__tryOrUnsub(wrappedComplete);
|
|
841
|
+
this.unsubscribe();
|
|
842
|
+
}
|
|
843
|
+
else {
|
|
844
|
+
this.__tryOrSetError(_parentSubscriber, wrappedComplete);
|
|
845
|
+
this.unsubscribe();
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
this.unsubscribe();
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
|
|
854
|
+
try {
|
|
855
|
+
fn.call(this._context, value);
|
|
856
|
+
}
|
|
857
|
+
catch (err) {
|
|
858
|
+
this.unsubscribe();
|
|
859
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
860
|
+
throw err;
|
|
861
|
+
}
|
|
862
|
+
else {
|
|
863
|
+
hostReportError(err);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
|
|
868
|
+
if (!config.useDeprecatedSynchronousErrorHandling) {
|
|
869
|
+
throw new Error('bad call');
|
|
870
|
+
}
|
|
871
|
+
try {
|
|
872
|
+
fn.call(this._context, value);
|
|
873
|
+
}
|
|
874
|
+
catch (err) {
|
|
875
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
876
|
+
parent.syncErrorValue = err;
|
|
877
|
+
parent.syncErrorThrown = true;
|
|
878
|
+
return true;
|
|
879
|
+
}
|
|
880
|
+
else {
|
|
881
|
+
hostReportError(err);
|
|
882
|
+
return true;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
return false;
|
|
886
|
+
};
|
|
887
|
+
SafeSubscriber.prototype._unsubscribe = function () {
|
|
888
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
889
|
+
this._context = null;
|
|
890
|
+
this._parentSubscriber = null;
|
|
891
|
+
_parentSubscriber.unsubscribe();
|
|
892
|
+
};
|
|
893
|
+
return SafeSubscriber;
|
|
894
|
+
}(Subscriber));
|
|
895
|
+
|
|
896
|
+
/** PURE_IMPORTS_START _Subscriber PURE_IMPORTS_END */
|
|
897
|
+
function canReportError(observer) {
|
|
898
|
+
while (observer) {
|
|
899
|
+
var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped;
|
|
900
|
+
if (closed_1 || isStopped) {
|
|
901
|
+
return false;
|
|
902
|
+
}
|
|
903
|
+
else if (destination && destination instanceof Subscriber) {
|
|
904
|
+
observer = destination;
|
|
905
|
+
}
|
|
906
|
+
else {
|
|
907
|
+
observer = null;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return true;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/** PURE_IMPORTS_START _Subscriber,_symbol_rxSubscriber,_Observer PURE_IMPORTS_END */
|
|
914
|
+
function toSubscriber(nextOrObserver, error, complete) {
|
|
915
|
+
if (nextOrObserver) {
|
|
916
|
+
if (nextOrObserver instanceof Subscriber) {
|
|
917
|
+
return nextOrObserver;
|
|
918
|
+
}
|
|
919
|
+
if (nextOrObserver[rxSubscriber]) {
|
|
920
|
+
return nextOrObserver[rxSubscriber]();
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
if (!nextOrObserver && !error && !complete) {
|
|
924
|
+
return new Subscriber(empty);
|
|
925
|
+
}
|
|
926
|
+
return new Subscriber(nextOrObserver, error, complete);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
930
|
+
var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();
|
|
931
|
+
|
|
932
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
933
|
+
function identity(x) {
|
|
934
|
+
return x;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/** PURE_IMPORTS_START _identity PURE_IMPORTS_END */
|
|
938
|
+
function pipeFromArray(fns) {
|
|
939
|
+
if (fns.length === 0) {
|
|
940
|
+
return identity;
|
|
941
|
+
}
|
|
942
|
+
if (fns.length === 1) {
|
|
943
|
+
return fns[0];
|
|
944
|
+
}
|
|
945
|
+
return function piped(input) {
|
|
946
|
+
return fns.reduce(function (prev, fn) { return fn(prev); }, input);
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
/** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */
|
|
951
|
+
var Observable = /*@__PURE__*/ (function () {
|
|
952
|
+
function Observable(subscribe) {
|
|
953
|
+
this._isScalar = false;
|
|
954
|
+
if (subscribe) {
|
|
955
|
+
this._subscribe = subscribe;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
Observable.prototype.lift = function (operator) {
|
|
959
|
+
var observable = new Observable();
|
|
960
|
+
observable.source = this;
|
|
961
|
+
observable.operator = operator;
|
|
962
|
+
return observable;
|
|
963
|
+
};
|
|
964
|
+
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
|
965
|
+
var operator = this.operator;
|
|
966
|
+
var sink = toSubscriber(observerOrNext, error, complete);
|
|
967
|
+
if (operator) {
|
|
968
|
+
sink.add(operator.call(sink, this.source));
|
|
969
|
+
}
|
|
970
|
+
else {
|
|
971
|
+
sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
|
|
972
|
+
this._subscribe(sink) :
|
|
973
|
+
this._trySubscribe(sink));
|
|
974
|
+
}
|
|
975
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
976
|
+
if (sink.syncErrorThrowable) {
|
|
977
|
+
sink.syncErrorThrowable = false;
|
|
978
|
+
if (sink.syncErrorThrown) {
|
|
979
|
+
throw sink.syncErrorValue;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
return sink;
|
|
984
|
+
};
|
|
985
|
+
Observable.prototype._trySubscribe = function (sink) {
|
|
986
|
+
try {
|
|
987
|
+
return this._subscribe(sink);
|
|
988
|
+
}
|
|
989
|
+
catch (err) {
|
|
990
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
991
|
+
sink.syncErrorThrown = true;
|
|
992
|
+
sink.syncErrorValue = err;
|
|
993
|
+
}
|
|
994
|
+
if (canReportError(sink)) {
|
|
995
|
+
sink.error(err);
|
|
996
|
+
}
|
|
997
|
+
else {
|
|
998
|
+
console.warn(err);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
Observable.prototype.forEach = function (next, promiseCtor) {
|
|
1003
|
+
var _this = this;
|
|
1004
|
+
promiseCtor = getPromiseCtor(promiseCtor);
|
|
1005
|
+
return new promiseCtor(function (resolve, reject) {
|
|
1006
|
+
var subscription;
|
|
1007
|
+
subscription = _this.subscribe(function (value) {
|
|
1008
|
+
try {
|
|
1009
|
+
next(value);
|
|
1010
|
+
}
|
|
1011
|
+
catch (err) {
|
|
1012
|
+
reject(err);
|
|
1013
|
+
if (subscription) {
|
|
1014
|
+
subscription.unsubscribe();
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}, reject, resolve);
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
1020
|
+
Observable.prototype._subscribe = function (subscriber) {
|
|
1021
|
+
var source = this.source;
|
|
1022
|
+
return source && source.subscribe(subscriber);
|
|
1023
|
+
};
|
|
1024
|
+
Observable.prototype[observable] = function () {
|
|
1025
|
+
return this;
|
|
1026
|
+
};
|
|
1027
|
+
Observable.prototype.pipe = function () {
|
|
1028
|
+
var operations = [];
|
|
1029
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1030
|
+
operations[_i] = arguments[_i];
|
|
1031
|
+
}
|
|
1032
|
+
if (operations.length === 0) {
|
|
1033
|
+
return this;
|
|
1034
|
+
}
|
|
1035
|
+
return pipeFromArray(operations)(this);
|
|
1036
|
+
};
|
|
1037
|
+
Observable.prototype.toPromise = function (promiseCtor) {
|
|
1038
|
+
var _this = this;
|
|
1039
|
+
promiseCtor = getPromiseCtor(promiseCtor);
|
|
1040
|
+
return new promiseCtor(function (resolve, reject) {
|
|
1041
|
+
var value;
|
|
1042
|
+
_this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
1043
|
+
});
|
|
1044
|
+
};
|
|
1045
|
+
Observable.create = function (subscribe) {
|
|
1046
|
+
return new Observable(subscribe);
|
|
1047
|
+
};
|
|
1048
|
+
return Observable;
|
|
1049
|
+
}());
|
|
1050
|
+
function getPromiseCtor(promiseCtor) {
|
|
1051
|
+
if (!promiseCtor) {
|
|
1052
|
+
promiseCtor = config.Promise || Promise;
|
|
1053
|
+
}
|
|
1054
|
+
if (!promiseCtor) {
|
|
1055
|
+
throw new Error('no Promise impl found');
|
|
1056
|
+
}
|
|
1057
|
+
return promiseCtor;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
1061
|
+
var ObjectUnsubscribedErrorImpl = /*@__PURE__*/ (function () {
|
|
1062
|
+
function ObjectUnsubscribedErrorImpl() {
|
|
1063
|
+
Error.call(this);
|
|
1064
|
+
this.message = 'object unsubscribed';
|
|
1065
|
+
this.name = 'ObjectUnsubscribedError';
|
|
1066
|
+
return this;
|
|
1067
|
+
}
|
|
1068
|
+
ObjectUnsubscribedErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
|
|
1069
|
+
return ObjectUnsubscribedErrorImpl;
|
|
1070
|
+
})();
|
|
1071
|
+
var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;
|
|
1072
|
+
|
|
1073
|
+
/** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */
|
|
1074
|
+
var SubjectSubscription = /*@__PURE__*/ (function (_super) {
|
|
1075
|
+
tslib_1.__extends(SubjectSubscription, _super);
|
|
1076
|
+
function SubjectSubscription(subject, subscriber) {
|
|
1077
|
+
var _this = _super.call(this) || this;
|
|
1078
|
+
_this.subject = subject;
|
|
1079
|
+
_this.subscriber = subscriber;
|
|
1080
|
+
_this.closed = false;
|
|
1081
|
+
return _this;
|
|
1082
|
+
}
|
|
1083
|
+
SubjectSubscription.prototype.unsubscribe = function () {
|
|
1084
|
+
if (this.closed) {
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
this.closed = true;
|
|
1088
|
+
var subject = this.subject;
|
|
1089
|
+
var observers = subject.observers;
|
|
1090
|
+
this.subject = null;
|
|
1091
|
+
if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
var subscriberIndex = observers.indexOf(this.subscriber);
|
|
1095
|
+
if (subscriberIndex !== -1) {
|
|
1096
|
+
observers.splice(subscriberIndex, 1);
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
return SubjectSubscription;
|
|
1100
|
+
}(Subscription$1));
|
|
1101
|
+
|
|
1102
|
+
/** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */
|
|
1103
|
+
var SubjectSubscriber = /*@__PURE__*/ (function (_super) {
|
|
1104
|
+
tslib_1.__extends(SubjectSubscriber, _super);
|
|
1105
|
+
function SubjectSubscriber(destination) {
|
|
1106
|
+
var _this = _super.call(this, destination) || this;
|
|
1107
|
+
_this.destination = destination;
|
|
1108
|
+
return _this;
|
|
1109
|
+
}
|
|
1110
|
+
return SubjectSubscriber;
|
|
1111
|
+
}(Subscriber));
|
|
1112
|
+
var Subject = /*@__PURE__*/ (function (_super) {
|
|
1113
|
+
tslib_1.__extends(Subject, _super);
|
|
1114
|
+
function Subject() {
|
|
1115
|
+
var _this = _super.call(this) || this;
|
|
1116
|
+
_this.observers = [];
|
|
1117
|
+
_this.closed = false;
|
|
1118
|
+
_this.isStopped = false;
|
|
1119
|
+
_this.hasError = false;
|
|
1120
|
+
_this.thrownError = null;
|
|
1121
|
+
return _this;
|
|
1122
|
+
}
|
|
1123
|
+
Subject.prototype[rxSubscriber] = function () {
|
|
1124
|
+
return new SubjectSubscriber(this);
|
|
1125
|
+
};
|
|
1126
|
+
Subject.prototype.lift = function (operator) {
|
|
1127
|
+
var subject = new AnonymousSubject(this, this);
|
|
1128
|
+
subject.operator = operator;
|
|
1129
|
+
return subject;
|
|
1130
|
+
};
|
|
1131
|
+
Subject.prototype.next = function (value) {
|
|
1132
|
+
if (this.closed) {
|
|
1133
|
+
throw new ObjectUnsubscribedError();
|
|
1134
|
+
}
|
|
1135
|
+
if (!this.isStopped) {
|
|
1136
|
+
var observers = this.observers;
|
|
1137
|
+
var len = observers.length;
|
|
1138
|
+
var copy = observers.slice();
|
|
1139
|
+
for (var i = 0; i < len; i++) {
|
|
1140
|
+
copy[i].next(value);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
Subject.prototype.error = function (err) {
|
|
1145
|
+
if (this.closed) {
|
|
1146
|
+
throw new ObjectUnsubscribedError();
|
|
1147
|
+
}
|
|
1148
|
+
this.hasError = true;
|
|
1149
|
+
this.thrownError = err;
|
|
1150
|
+
this.isStopped = true;
|
|
1151
|
+
var observers = this.observers;
|
|
1152
|
+
var len = observers.length;
|
|
1153
|
+
var copy = observers.slice();
|
|
1154
|
+
for (var i = 0; i < len; i++) {
|
|
1155
|
+
copy[i].error(err);
|
|
1156
|
+
}
|
|
1157
|
+
this.observers.length = 0;
|
|
1158
|
+
};
|
|
1159
|
+
Subject.prototype.complete = function () {
|
|
1160
|
+
if (this.closed) {
|
|
1161
|
+
throw new ObjectUnsubscribedError();
|
|
1162
|
+
}
|
|
1163
|
+
this.isStopped = true;
|
|
1164
|
+
var observers = this.observers;
|
|
1165
|
+
var len = observers.length;
|
|
1166
|
+
var copy = observers.slice();
|
|
1167
|
+
for (var i = 0; i < len; i++) {
|
|
1168
|
+
copy[i].complete();
|
|
1169
|
+
}
|
|
1170
|
+
this.observers.length = 0;
|
|
1171
|
+
};
|
|
1172
|
+
Subject.prototype.unsubscribe = function () {
|
|
1173
|
+
this.isStopped = true;
|
|
1174
|
+
this.closed = true;
|
|
1175
|
+
this.observers = null;
|
|
1176
|
+
};
|
|
1177
|
+
Subject.prototype._trySubscribe = function (subscriber) {
|
|
1178
|
+
if (this.closed) {
|
|
1179
|
+
throw new ObjectUnsubscribedError();
|
|
1180
|
+
}
|
|
1181
|
+
else {
|
|
1182
|
+
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
Subject.prototype._subscribe = function (subscriber) {
|
|
1186
|
+
if (this.closed) {
|
|
1187
|
+
throw new ObjectUnsubscribedError();
|
|
1188
|
+
}
|
|
1189
|
+
else if (this.hasError) {
|
|
1190
|
+
subscriber.error(this.thrownError);
|
|
1191
|
+
return Subscription$1.EMPTY;
|
|
1192
|
+
}
|
|
1193
|
+
else if (this.isStopped) {
|
|
1194
|
+
subscriber.complete();
|
|
1195
|
+
return Subscription$1.EMPTY;
|
|
1196
|
+
}
|
|
1197
|
+
else {
|
|
1198
|
+
this.observers.push(subscriber);
|
|
1199
|
+
return new SubjectSubscription(this, subscriber);
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
Subject.prototype.asObservable = function () {
|
|
1203
|
+
var observable = new Observable();
|
|
1204
|
+
observable.source = this;
|
|
1205
|
+
return observable;
|
|
1206
|
+
};
|
|
1207
|
+
Subject.create = function (destination, source) {
|
|
1208
|
+
return new AnonymousSubject(destination, source);
|
|
1209
|
+
};
|
|
1210
|
+
return Subject;
|
|
1211
|
+
}(Observable));
|
|
1212
|
+
var AnonymousSubject = /*@__PURE__*/ (function (_super) {
|
|
1213
|
+
tslib_1.__extends(AnonymousSubject, _super);
|
|
1214
|
+
function AnonymousSubject(destination, source) {
|
|
1215
|
+
var _this = _super.call(this) || this;
|
|
1216
|
+
_this.destination = destination;
|
|
1217
|
+
_this.source = source;
|
|
1218
|
+
return _this;
|
|
1219
|
+
}
|
|
1220
|
+
AnonymousSubject.prototype.next = function (value) {
|
|
1221
|
+
var destination = this.destination;
|
|
1222
|
+
if (destination && destination.next) {
|
|
1223
|
+
destination.next(value);
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
AnonymousSubject.prototype.error = function (err) {
|
|
1227
|
+
var destination = this.destination;
|
|
1228
|
+
if (destination && destination.error) {
|
|
1229
|
+
this.destination.error(err);
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
AnonymousSubject.prototype.complete = function () {
|
|
1233
|
+
var destination = this.destination;
|
|
1234
|
+
if (destination && destination.complete) {
|
|
1235
|
+
this.destination.complete();
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
AnonymousSubject.prototype._subscribe = function (subscriber) {
|
|
1239
|
+
var source = this.source;
|
|
1240
|
+
if (source) {
|
|
1241
|
+
return this.source.subscribe(subscriber);
|
|
1242
|
+
}
|
|
1243
|
+
else {
|
|
1244
|
+
return Subscription$1.EMPTY;
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
return AnonymousSubject;
|
|
1248
|
+
}(Subject));
|
|
1249
|
+
|
|
466
1250
|
var DebugNamespaces;
|
|
467
1251
|
(function (DebugNamespaces) {
|
|
468
1252
|
DebugNamespaces["ROOT"] = "connect";
|
|
@@ -500,11 +1284,11 @@ class ReflectHelper {
|
|
|
500
1284
|
}
|
|
501
1285
|
static first({ key, target, property, own = true }) {
|
|
502
1286
|
const values = ReflectHelper.get({ key, target, property, own });
|
|
503
|
-
return isArray(values) ? first(values) : values;
|
|
1287
|
+
return isArray$1(values) ? first(values) : values;
|
|
504
1288
|
}
|
|
505
1289
|
static last({ key, target, property, own = true }) {
|
|
506
1290
|
const values = ReflectHelper.get({ key, target, property, own });
|
|
507
|
-
return isArray(values) ? last(values) : values;
|
|
1291
|
+
return isArray$1(values) ? last(values) : values;
|
|
508
1292
|
}
|
|
509
1293
|
static set({ key, target, property, value, propertyDescriptor }) {
|
|
510
1294
|
Reflect.defineMetadata(key, value, target, property);
|
|
@@ -530,7 +1314,7 @@ class ReflectHelper {
|
|
|
530
1314
|
const values = target[property];
|
|
531
1315
|
let value = values.value;
|
|
532
1316
|
const propertyDescriptor = values.propertyDescriptor;
|
|
533
|
-
if (!isArray(value))
|
|
1317
|
+
if (!isArray$1(value))
|
|
534
1318
|
value = [value];
|
|
535
1319
|
return flatten(value.map((val) => {
|
|
536
1320
|
return {
|
|
@@ -657,9 +1441,9 @@ class ClassNameHelper {
|
|
|
657
1441
|
return null;
|
|
658
1442
|
const prototype = Object.getPrototypeOf(clazz);
|
|
659
1443
|
const names = compact([
|
|
660
|
-
get
|
|
661
|
-
get
|
|
662
|
-
get
|
|
1444
|
+
get(clazz, 'constructor.name'),
|
|
1445
|
+
get(prototype, 'constructor.name'),
|
|
1446
|
+
get(prototype, '__proto__.constructor.name'),
|
|
663
1447
|
]);
|
|
664
1448
|
return names.find((name) => name !== 'class_1');
|
|
665
1449
|
}
|
|
@@ -669,16 +1453,12 @@ const isDebuggable = (object) => {
|
|
|
669
1453
|
return 'debug' in object;
|
|
670
1454
|
};
|
|
671
1455
|
class DebugHelper {
|
|
672
|
-
constructor(...namespace) {
|
|
673
|
-
this.namespaces = new Set();
|
|
674
|
-
this.push(...namespace);
|
|
675
|
-
}
|
|
676
1456
|
static namespacesFor(target) {
|
|
677
1457
|
if (isNil(target))
|
|
678
1458
|
return [];
|
|
679
1459
|
const decorator = DebugDecoratorHelper.get(Object.getPrototypeOf(target));
|
|
680
|
-
const namespaces = get
|
|
681
|
-
const name = get
|
|
1460
|
+
const namespaces = get(decorator, 'namespaces', []);
|
|
1461
|
+
const name = get(decorator, 'name', ClassNameHelper.get(target));
|
|
682
1462
|
return [...namespaces, name];
|
|
683
1463
|
}
|
|
684
1464
|
static as(...namespaces) {
|
|
@@ -726,8 +1506,12 @@ class DebugHelper {
|
|
|
726
1506
|
DebugHelper.replace(target, { with: debug });
|
|
727
1507
|
return { original, debug };
|
|
728
1508
|
}
|
|
1509
|
+
constructor(...namespace) {
|
|
1510
|
+
this.namespaces = new Set();
|
|
1511
|
+
this.push(...namespace);
|
|
1512
|
+
}
|
|
729
1513
|
get entries() {
|
|
730
|
-
return Array.from(get
|
|
1514
|
+
return Array.from(get(this, 'namespaces', []));
|
|
731
1515
|
}
|
|
732
1516
|
get namespace() {
|
|
733
1517
|
return compact(flatten(this.entries)).join(':');
|
|
@@ -818,7 +1602,7 @@ function Debug(opts) {
|
|
|
818
1602
|
|
|
819
1603
|
const ASYNC_IDENTIFIER = 'async';
|
|
820
1604
|
function Log(options = {}) {
|
|
821
|
-
return Trace({ level: 'log',
|
|
1605
|
+
return Trace(Object.assign({ level: 'log' }, options));
|
|
822
1606
|
}
|
|
823
1607
|
function Trace(options = {}) {
|
|
824
1608
|
return function (target, propertyKey, propertyDescriptor) {
|
|
@@ -844,7 +1628,7 @@ const promiseTracer = function ({ options, method, propertyKey, propertyDescript
|
|
|
844
1628
|
return function (...args) {
|
|
845
1629
|
return new Promise((resolve, reject) => {
|
|
846
1630
|
const debug = traceCall({ target: this, propertyDescriptor, propertyKey, args });
|
|
847
|
-
if (get
|
|
1631
|
+
if (get(options, 'level', '') === 'log') {
|
|
848
1632
|
debug.with('params').log(args);
|
|
849
1633
|
}
|
|
850
1634
|
return method
|
|
@@ -853,7 +1637,7 @@ const promiseTracer = function ({ options, method, propertyKey, propertyDescript
|
|
|
853
1637
|
if (options.callbackFn) {
|
|
854
1638
|
options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
|
|
855
1639
|
}
|
|
856
|
-
if (get
|
|
1640
|
+
if (get(options, 'level', '') === 'log') {
|
|
857
1641
|
debug.with('returns').log(result === undefined ? 'void' : result);
|
|
858
1642
|
}
|
|
859
1643
|
return resolve(result);
|
|
@@ -872,7 +1656,7 @@ const promiseTracer = function ({ options, method, propertyKey, propertyDescript
|
|
|
872
1656
|
const functionTracer = function ({ options, target, method, propertyKey, propertyDescriptor, }) {
|
|
873
1657
|
return function (...args) {
|
|
874
1658
|
const debug = traceCall({ target: this || target, propertyDescriptor, propertyKey, args });
|
|
875
|
-
if (get
|
|
1659
|
+
if (get(options, 'level', '') === 'log') {
|
|
876
1660
|
debug.with('params').log(args);
|
|
877
1661
|
}
|
|
878
1662
|
let result;
|
|
@@ -880,7 +1664,7 @@ const functionTracer = function ({ options, target, method, propertyKey, propert
|
|
|
880
1664
|
result = method.apply(this, args);
|
|
881
1665
|
if (options.callbackFn)
|
|
882
1666
|
options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
|
|
883
|
-
if (get
|
|
1667
|
+
if (get(options, 'level', '') === 'log') {
|
|
884
1668
|
debug.with('returns').log(result === undefined ? 'void' : result);
|
|
885
1669
|
}
|
|
886
1670
|
return result;
|
|
@@ -895,8 +1679,6 @@ const functionTracer = function ({ options, target, method, propertyKey, propert
|
|
|
895
1679
|
};
|
|
896
1680
|
};
|
|
897
1681
|
|
|
898
|
-
const get = (object, path, defaultValue) => get$1(object, path, defaultValue);
|
|
899
|
-
|
|
900
1682
|
function is(value) {
|
|
901
1683
|
return value;
|
|
902
1684
|
}
|
|
@@ -1114,18 +1896,10 @@ class Authentication {
|
|
|
1114
1896
|
return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
|
|
1115
1897
|
}
|
|
1116
1898
|
async createsUserByCredential(user) {
|
|
1117
|
-
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
birthday: new Date(),
|
|
1122
|
-
firstName,
|
|
1123
|
-
lastName,
|
|
1124
|
-
acceptsNewsletter: false,
|
|
1125
|
-
area: Area.Transactional,
|
|
1126
|
-
officePosition: OfficePosition.Intern,
|
|
1127
|
-
type: UserType.Collaborator,
|
|
1128
|
-
});
|
|
1899
|
+
var _a;
|
|
1900
|
+
const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
|
|
1901
|
+
const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
|
|
1902
|
+
lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
|
|
1129
1903
|
return this.userRepository.create(person);
|
|
1130
1904
|
}
|
|
1131
1905
|
}
|
|
@@ -1165,15 +1939,8 @@ class Register {
|
|
|
1165
1939
|
password: params.password,
|
|
1166
1940
|
});
|
|
1167
1941
|
delete params.password;
|
|
1168
|
-
const user = await this.userRepository.create({
|
|
1169
|
-
|
|
1170
|
-
id: auth.id,
|
|
1171
|
-
email,
|
|
1172
|
-
displayName,
|
|
1173
|
-
type: UserType.B2C,
|
|
1174
|
-
dateCreated: new Date(),
|
|
1175
|
-
dateModified: new Date(),
|
|
1176
|
-
});
|
|
1942
|
+
const user = await this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email,
|
|
1943
|
+
displayName, type: UserType.B2C, dateCreated: new Date(), dateModified: new Date() }));
|
|
1177
1944
|
return user;
|
|
1178
1945
|
}
|
|
1179
1946
|
}
|
|
@@ -1519,27 +2286,6 @@ var QuestionsFilters;
|
|
|
1519
2286
|
QuestionsFilters["PRODUCT_SPENT"] = "Qual \u00E9 o seu nivel de gasto mensal em produtos de beleza e cuidados pessoais?";
|
|
1520
2287
|
})(QuestionsFilters || (QuestionsFilters = {}));
|
|
1521
2288
|
|
|
1522
|
-
var ShopPageName;
|
|
1523
|
-
(function (ShopPageName) {
|
|
1524
|
-
ShopPageName["LP_CLUB"] = "LP_CLUBE";
|
|
1525
|
-
ShopPageName["SUBSCRIBER_PANEL"] = "SUBSCRIBER_PANEL";
|
|
1526
|
-
ShopPageName["INVITE_FRIENDS"] = "INVITE_FRIENDS";
|
|
1527
|
-
ShopPageName["INVITE_AND_WIN"] = "INVITE_AND_WIN";
|
|
1528
|
-
ShopPageName["WIN_GLAMPOINTS"] = "WIN_GLAMPOINTS";
|
|
1529
|
-
ShopPageName["POSTS"] = "POSTS";
|
|
1530
|
-
ShopPageName["GLAMPOINTS_SHOWCASE"] = "GLAMPOINTS_SHOWCASE";
|
|
1531
|
-
ShopPageName["LP_EDITIONS"] = "LP_EDITIONS";
|
|
1532
|
-
ShopPageName["LP_GLAMBOX_EDITION"] = "LP_GLAMBOX_EDITION";
|
|
1533
|
-
ShopPageName["LP_GLAMBOX_PROMOTION"] = "LP_GLAMBOX_PROMOTION";
|
|
1534
|
-
ShopPageName["LP_GLAMBAG_PROMOTION"] = "LP_GLAMBAG_PROMOTION";
|
|
1535
|
-
ShopPageName["LP_GLAMPASS_PROMOTION"] = "LP_GLAMPASS_PROMOTION";
|
|
1536
|
-
ShopPageName["LP_SUBSCRIPTION_PROMOTION"] = "LP_SUBSCRIPTION_PROMOTION";
|
|
1537
|
-
ShopPageName["LP_GLAMPARTNER_PROMOTION"] = "LP_GLAMPARTNER_PROMOTION";
|
|
1538
|
-
ShopPageName["LP_GLAMQUEENS"] = "LP_GLAMQUEENS";
|
|
1539
|
-
ShopPageName["LP_INVITE"] = "LP_INVITE";
|
|
1540
|
-
ShopPageName["LP_LIVELO"] = "LP_LIVELO";
|
|
1541
|
-
})(ShopPageName || (ShopPageName = {}));
|
|
1542
|
-
|
|
1543
2289
|
class BeautyQuestionsHelper {
|
|
1544
2290
|
static getAnswers(filter) {
|
|
1545
2291
|
switch (filter) {
|
|
@@ -1585,18 +2331,6 @@ class BeautyQuestionsHelper {
|
|
|
1585
2331
|
}
|
|
1586
2332
|
}
|
|
1587
2333
|
|
|
1588
|
-
class Campaign extends BaseModel {
|
|
1589
|
-
static get identifiersFields() {
|
|
1590
|
-
return ['id'];
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
class CampaignBanner extends BaseModel {
|
|
1595
|
-
static get identifiersFields() {
|
|
1596
|
-
return ['id'];
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
2334
|
class Home extends BaseModel {
|
|
1601
2335
|
static get identifiersFields() {
|
|
1602
2336
|
return ['id'];
|
|
@@ -1747,18 +2481,7 @@ class ProductsIndex {
|
|
|
1747
2481
|
must: {
|
|
1748
2482
|
multi_match: {
|
|
1749
2483
|
query: `${searchTerm}`,
|
|
1750
|
-
|
|
1751
|
-
fields: [
|
|
1752
|
-
'name',
|
|
1753
|
-
'name.folded',
|
|
1754
|
-
'name.search',
|
|
1755
|
-
'description',
|
|
1756
|
-
'description.search',
|
|
1757
|
-
'description.folded',
|
|
1758
|
-
'brand',
|
|
1759
|
-
'brand.search',
|
|
1760
|
-
'brand.folded',
|
|
1761
|
-
],
|
|
2484
|
+
fields: ['name', 'name.folded', 'name.search', 'description', 'brand'],
|
|
1762
2485
|
fuzziness: 2,
|
|
1763
2486
|
},
|
|
1764
2487
|
},
|
|
@@ -1784,7 +2507,7 @@ class ProductsIndex {
|
|
|
1784
2507
|
}
|
|
1785
2508
|
async save(product) {
|
|
1786
2509
|
try {
|
|
1787
|
-
const { createdAt, updatedAt, kitProducts,
|
|
2510
|
+
const { createdAt, updatedAt, kitProducts } = product, data = __rest(product, ["createdAt", "updatedAt", "kitProducts"]);
|
|
1788
2511
|
this.adapter.save(this.index, data);
|
|
1789
2512
|
}
|
|
1790
2513
|
catch (error) {
|
|
@@ -1813,10 +2536,10 @@ const withFirestore = (MixinBase) => {
|
|
|
1813
2536
|
const isObjectsAndNoDate = (data) => data &&
|
|
1814
2537
|
!Array.isArray(data) &&
|
|
1815
2538
|
typeof data === 'object' &&
|
|
1816
|
-
data
|
|
2539
|
+
(data === null || data === void 0 ? void 0 : data.constructor.name) !== 'Timestamp' &&
|
|
1817
2540
|
!('seconds' in data);
|
|
1818
2541
|
const bindDate = (data, keyName) => {
|
|
1819
|
-
if (data
|
|
2542
|
+
if ((data === null || data === void 0 ? void 0 : data.constructor.name) === 'Timestamp')
|
|
1820
2543
|
return data.toDate();
|
|
1821
2544
|
if (data && typeof data === 'object' && 'seconds' in data)
|
|
1822
2545
|
return new Date(data.seconds * 1000);
|
|
@@ -1825,21 +2548,18 @@ const withFirestore = (MixinBase) => {
|
|
|
1825
2548
|
return data;
|
|
1826
2549
|
};
|
|
1827
2550
|
const bindAllDateFromObject = (data) => {
|
|
1828
|
-
return Object.keys(data).reduce((object, key) => ({
|
|
1829
|
-
...object,
|
|
1830
|
-
[key]: isObjectsAndNoDate(data[key])
|
|
2551
|
+
return Object.keys(data).reduce((object, key) => (Object.assign(Object.assign({}, object), { [key]: isObjectsAndNoDate(data[key])
|
|
1831
2552
|
? bindAllDateFromObject(data[key])
|
|
1832
2553
|
: Array.isArray(data[key])
|
|
1833
2554
|
? data[key].map((element) => (isObjectsAndNoDate(element) ? bindAllDateFromObject(element) : element))
|
|
1834
|
-
: bindDate(data[key], key),
|
|
1835
|
-
}), {});
|
|
2555
|
+
: bindDate(data[key], key) })), {});
|
|
1836
2556
|
};
|
|
1837
2557
|
const omitByRecursivelyInPlace = (value, iteratee) => {
|
|
1838
2558
|
each(value, (v, k) => {
|
|
1839
2559
|
if (iteratee(v, k)) {
|
|
1840
2560
|
unset(value, k);
|
|
1841
2561
|
}
|
|
1842
|
-
else if (isObject(v)) {
|
|
2562
|
+
else if (isObject$1(v)) {
|
|
1843
2563
|
omitByRecursivelyInPlace(v, iteratee);
|
|
1844
2564
|
}
|
|
1845
2565
|
});
|
|
@@ -1864,7 +2584,7 @@ const withFirestore = (MixinBase) => {
|
|
|
1864
2584
|
buildModelInstance() {
|
|
1865
2585
|
return {
|
|
1866
2586
|
toFirestore: (data) => {
|
|
1867
|
-
const plain = data
|
|
2587
|
+
const plain = (data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data;
|
|
1868
2588
|
return omitByRecursivelyInPlace(plain, (value) => value === undefined);
|
|
1869
2589
|
},
|
|
1870
2590
|
fromFirestore: (snap) => {
|
|
@@ -1873,7 +2593,7 @@ const withFirestore = (MixinBase) => {
|
|
|
1873
2593
|
try {
|
|
1874
2594
|
const ids = { id: snap.id };
|
|
1875
2595
|
bindedData = bindAllDateFromObject(data);
|
|
1876
|
-
return this.model.toInstance({
|
|
2596
|
+
return this.model.toInstance(Object.assign(Object.assign({}, bindedData), ids));
|
|
1877
2597
|
}
|
|
1878
2598
|
catch (error) {
|
|
1879
2599
|
console.info('id', snap.id);
|
|
@@ -1906,14 +2626,15 @@ const withHelpers = (MixinBase) => {
|
|
|
1906
2626
|
const withGetFirestore = (MixinBase) => {
|
|
1907
2627
|
return class GetFirestore extends MixinBase {
|
|
1908
2628
|
async get(identifiers) {
|
|
1909
|
-
|
|
1910
|
-
const
|
|
1911
|
-
const
|
|
2629
|
+
var _a, _b, _c, _d;
|
|
2630
|
+
const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => (Object.assign(Object.assign({}, acc), { [field]: identifiers[field] })), {}));
|
|
2631
|
+
const intercepted = await ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance }));
|
|
2632
|
+
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || instance;
|
|
1912
2633
|
const docRef = await getDoc(doc(await this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(builded.identifier).shift().toString()));
|
|
1913
2634
|
const data = docRef.data();
|
|
1914
2635
|
if (isNil(data))
|
|
1915
2636
|
throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
|
|
1916
|
-
return this.interceptors
|
|
2637
|
+
return ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, data, intercepted)) || data;
|
|
1917
2638
|
}
|
|
1918
2639
|
buildCollectionPathForGet(identifiers) {
|
|
1919
2640
|
return this.isSubCollection(this)
|
|
@@ -1934,13 +2655,10 @@ var FirestoreFieldType;
|
|
|
1934
2655
|
})(FirestoreFieldType || (FirestoreFieldType = {}));
|
|
1935
2656
|
|
|
1936
2657
|
const withFindFirestore = (MixinBase) => {
|
|
1937
|
-
const checkIfIsFilterOption = (filter) => !isNil(filter
|
|
2658
|
+
const checkIfIsFilterOption = (filter) => !isNil(filter === null || filter === void 0 ? void 0 : filter.operator);
|
|
1938
2659
|
const getValueFromFilter = (filter) => {
|
|
1939
2660
|
return checkIfIsFilterOption(filter) ? filter.value : filter;
|
|
1940
2661
|
};
|
|
1941
|
-
const getFinalValueFrom = (value) => isNumber(value) || isString(value) || isDate(value) || Array.isArray(value)
|
|
1942
|
-
? value
|
|
1943
|
-
: Object.values(getFinalValueFrom);
|
|
1944
2662
|
return class FindFirestore extends MixinBase {
|
|
1945
2663
|
constructor() {
|
|
1946
2664
|
super(...arguments);
|
|
@@ -1951,33 +2669,33 @@ const withFindFirestore = (MixinBase) => {
|
|
|
1951
2669
|
this.buildWhereSentence = (fieldName, options) => {
|
|
1952
2670
|
if (this.isSubCollection(this) && fieldName === this.parentIdField)
|
|
1953
2671
|
return [];
|
|
1954
|
-
const value = options
|
|
2672
|
+
const value = (options === null || options === void 0 ? void 0 : options.value) || options;
|
|
1955
2673
|
const object = {};
|
|
1956
2674
|
set(object, fieldName, value);
|
|
1957
2675
|
const plainInstance = new this.model(object).toPlain();
|
|
1958
2676
|
const firestoreFieldName = fieldName.toString().indexOf('.') > -1
|
|
1959
2677
|
? fieldName.toString()
|
|
1960
2678
|
: Object.keys(plainInstance).find((key) => plainInstance[key]);
|
|
1961
|
-
if (options
|
|
1962
|
-
if (Array.isArray(options
|
|
2679
|
+
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.LIKE) {
|
|
2680
|
+
if (Array.isArray(options === null || options === void 0 ? void 0 : options.value) &&
|
|
1963
2681
|
(this.fields[firestoreFieldName] ===
|
|
1964
2682
|
FirestoreFieldType.Array ||
|
|
1965
2683
|
!this.fields[firestoreFieldName]))
|
|
1966
2684
|
return [where(firestoreFieldName, 'array-contains-any', options.value)];
|
|
1967
2685
|
return [where(firestoreFieldName, '>=', options.value), where(firestoreFieldName, '<=', `${options.value}~`)];
|
|
1968
2686
|
}
|
|
1969
|
-
if (options
|
|
1970
|
-
Array.isArray(options
|
|
2687
|
+
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN &&
|
|
2688
|
+
Array.isArray(options === null || options === void 0 ? void 0 : options.value) &&
|
|
1971
2689
|
(this.fields[firestoreFieldName] === FirestoreFieldType.Array ||
|
|
1972
2690
|
!this.fields[firestoreFieldName]))
|
|
1973
2691
|
return [where(firestoreFieldName, 'array-contains', options.value)];
|
|
1974
|
-
if (isObject(options) && isNil(options
|
|
2692
|
+
if (isObject$1(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value)) {
|
|
1975
2693
|
return Object.keys(options).reduce((queries, key) => [
|
|
1976
2694
|
...queries,
|
|
1977
2695
|
...this.buildWhereSentence(`${fieldName.toString()}.${key}`, is(options)[key]),
|
|
1978
2696
|
], []);
|
|
1979
2697
|
}
|
|
1980
|
-
return [where(firestoreFieldName, options
|
|
2698
|
+
return [where(firestoreFieldName, (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options)];
|
|
1981
2699
|
};
|
|
1982
2700
|
this.makeFirestoreOrderBy = (filters, fieldsToOrderBy) => {
|
|
1983
2701
|
const orderByKeys = Object.keys(fieldsToOrderBy || {});
|
|
@@ -1985,19 +2703,17 @@ const withFindFirestore = (MixinBase) => {
|
|
|
1985
2703
|
return [];
|
|
1986
2704
|
const filtersKeysWithUnordered = Object.keys(filters || {}).filter((filterKey) => !orderByKeys.includes(filterKey));
|
|
1987
2705
|
if (filtersKeysWithUnordered.length)
|
|
1988
|
-
filtersKeysWithUnordered.forEach((filterKey) => (fieldsToOrderBy = {
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
: {}),
|
|
1992
|
-
...fieldsToOrderBy,
|
|
1993
|
-
}));
|
|
2706
|
+
filtersKeysWithUnordered.forEach((filterKey) => (fieldsToOrderBy = Object.assign(Object.assign({}, (![Where.EQUALS].includes(is(filters[filterKey]).operator)
|
|
2707
|
+
? { [filterKey]: 'asc' }
|
|
2708
|
+
: {})), fieldsToOrderBy)));
|
|
1994
2709
|
return Object.keys(fieldsToOrderBy).map((fieldName) => orderBy(fieldName, fieldsToOrderBy[fieldName]));
|
|
1995
2710
|
};
|
|
1996
2711
|
}
|
|
1997
2712
|
async find(find = {}) {
|
|
2713
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1998
2714
|
const collection = this.collection(this.buildCollectionPathForFind(find.filters));
|
|
1999
|
-
const enableCount = find
|
|
2000
|
-
const intercepted = await this.interceptors
|
|
2715
|
+
const enableCount = (_b = (_a = find === null || find === void 0 ? void 0 : find.options) === null || _a === void 0 ? void 0 : _a.enableCount) !== null && _b !== void 0 ? _b : true;
|
|
2716
|
+
const intercepted = await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.request) === null || _d === void 0 ? void 0 : _d.call(_c, { find }));
|
|
2001
2717
|
const { filters, limits, orderBy } = intercepted.find || find;
|
|
2002
2718
|
const queries = this.makeFirestoreWhere(filters || {});
|
|
2003
2719
|
const ordination = this.makeFirestoreOrderBy(filters, orderBy);
|
|
@@ -2006,7 +2722,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
2006
2722
|
const docs = await getDocs(query(collection, ...queryArgumments));
|
|
2007
2723
|
const data = docs.docs.map((doc) => doc.data());
|
|
2008
2724
|
return {
|
|
2009
|
-
data: (await this.interceptors
|
|
2725
|
+
data: (await ((_f = (_e = this.interceptors) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.call(_e, data, intercepted))) || data,
|
|
2010
2726
|
count: enableCount ? this.calculateCount(data, limits) : Infinity,
|
|
2011
2727
|
};
|
|
2012
2728
|
}
|
|
@@ -2014,25 +2730,26 @@ const withFindFirestore = (MixinBase) => {
|
|
|
2014
2730
|
if (!this.isSubCollection(this))
|
|
2015
2731
|
return this.collectionName;
|
|
2016
2732
|
const parentIdField = this.parentIdField;
|
|
2017
|
-
const parentId = getValueFromFilter(filters
|
|
2733
|
+
const parentId = getValueFromFilter(filters === null || filters === void 0 ? void 0 : filters[parentIdField]);
|
|
2018
2734
|
return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
|
|
2019
2735
|
}
|
|
2020
2736
|
async defineLimits(filters, limits) {
|
|
2737
|
+
var _a;
|
|
2021
2738
|
const queries = [];
|
|
2022
|
-
if (limits
|
|
2739
|
+
if (limits === null || limits === void 0 ? void 0 : limits.offset) {
|
|
2023
2740
|
if (this.model.isModel(limits.offset))
|
|
2024
|
-
queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), Object.values(limits.offset.identifier).shift()
|
|
2741
|
+
queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), (_a = Object.values(limits.offset.identifier).shift()) === null || _a === void 0 ? void 0 : _a.toString()))));
|
|
2025
2742
|
else if (isNumber(limits.offset) || isString(limits.offset))
|
|
2026
2743
|
queries.push(startAt(limits.offset));
|
|
2027
2744
|
}
|
|
2028
|
-
if (limits
|
|
2745
|
+
if (limits === null || limits === void 0 ? void 0 : limits.limit)
|
|
2029
2746
|
queries.push(limit(limits.limit));
|
|
2030
2747
|
return queries;
|
|
2031
2748
|
}
|
|
2032
2749
|
calculateCount(data, limits) {
|
|
2033
2750
|
if (data.length <= 0)
|
|
2034
2751
|
return 0;
|
|
2035
|
-
if (data.length < limits
|
|
2752
|
+
if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
|
|
2036
2753
|
return data.length;
|
|
2037
2754
|
return Infinity;
|
|
2038
2755
|
}
|
|
@@ -2042,16 +2759,18 @@ const withFindFirestore = (MixinBase) => {
|
|
|
2042
2759
|
const withCreateFirestore = (MixinBase) => {
|
|
2043
2760
|
return class CreateFirestore extends MixinBase {
|
|
2044
2761
|
async create(data) {
|
|
2762
|
+
var _a, _b, _c, _d;
|
|
2045
2763
|
const instance = this.model.toInstance(data);
|
|
2046
|
-
const intercepted = await this.interceptors
|
|
2047
|
-
const builded = intercepted
|
|
2764
|
+
const intercepted = await ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance }));
|
|
2765
|
+
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || instance;
|
|
2048
2766
|
const docRef = await this.save(builded);
|
|
2049
2767
|
const doc = await getDoc(docRef);
|
|
2050
|
-
const docBuilded = (await this.interceptors
|
|
2768
|
+
const docBuilded = (await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, doc.data(), intercepted))) || doc.data();
|
|
2051
2769
|
return docBuilded;
|
|
2052
2770
|
}
|
|
2053
2771
|
async save(data) {
|
|
2054
|
-
|
|
2772
|
+
var _a, _b;
|
|
2773
|
+
const id = (_b = (_a = Object.values(data.identifier)) === null || _a === void 0 ? void 0 : _a.shift()) === null || _b === void 0 ? void 0 : _b.toString();
|
|
2055
2774
|
const collectionPath = this.buildCollectionPathForAdd(data);
|
|
2056
2775
|
const collection = this.collection(collectionPath);
|
|
2057
2776
|
if (isEmpty(id))
|
|
@@ -2069,35 +2788,39 @@ const withCreateFirestore = (MixinBase) => {
|
|
|
2069
2788
|
};
|
|
2070
2789
|
|
|
2071
2790
|
const withUpdateFirestore = (MixinBase) => {
|
|
2072
|
-
const getValueFromParams = (params, field) =>
|
|
2073
|
-
|
|
2074
|
-
|
|
2791
|
+
const getValueFromParams = (params, field) => {
|
|
2792
|
+
var _a;
|
|
2793
|
+
return (isNil((_a = is(params[field])) === null || _a === void 0 ? void 0 : _a.value)
|
|
2794
|
+
? is(params[field])
|
|
2795
|
+
: is(params[field]).value) || null;
|
|
2796
|
+
};
|
|
2075
2797
|
const getValueByAction = (options) => {
|
|
2076
|
-
if (isNil(options
|
|
2798
|
+
if (isNil(options === null || options === void 0 ? void 0 : options.action))
|
|
2077
2799
|
return options;
|
|
2078
|
-
if (options
|
|
2800
|
+
if ((options === null || options === void 0 ? void 0 : options.action) === UpdateOptionActions.REMOVE_FIELD)
|
|
2079
2801
|
return deleteField();
|
|
2080
|
-
if (options
|
|
2802
|
+
if ((options === null || options === void 0 ? void 0 : options.action) === UpdateOptionActions.NULL)
|
|
2081
2803
|
return null;
|
|
2082
|
-
if (Array.isArray(options
|
|
2083
|
-
if (options
|
|
2804
|
+
if (Array.isArray(options === null || options === void 0 ? void 0 : options.value)) {
|
|
2805
|
+
if ((options === null || options === void 0 ? void 0 : options.action) === UpdateOptionActions.MERGE)
|
|
2084
2806
|
return arrayUnion(...options.value);
|
|
2085
|
-
if (options
|
|
2807
|
+
if ((options === null || options === void 0 ? void 0 : options.action) === UpdateOptionActions.REMOVE)
|
|
2086
2808
|
return arrayRemove(...options.value);
|
|
2087
2809
|
}
|
|
2088
|
-
return options
|
|
2810
|
+
return options === null || options === void 0 ? void 0 : options.value;
|
|
2089
2811
|
};
|
|
2090
2812
|
return class UpdateFirestore extends MixinBase {
|
|
2091
2813
|
async update(data) {
|
|
2814
|
+
var _a, _b, _c, _d;
|
|
2092
2815
|
const model = new this.model();
|
|
2093
2816
|
const keyField = model.identifiersFields.shift();
|
|
2094
2817
|
const docRef = doc(this.collection(this.buildCollectionPathForUpdate(data)), getValueFromParams(data, keyField).toString());
|
|
2095
2818
|
const plainFromData = this.model.toInstance(this.paramsToPlain(data));
|
|
2096
|
-
const intercepted = await this.interceptors
|
|
2097
|
-
const builded = intercepted
|
|
2819
|
+
const intercepted = await ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance: plainFromData }));
|
|
2820
|
+
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
|
|
2098
2821
|
await setDoc(docRef, builded.toPlain(), { merge: true });
|
|
2099
2822
|
const docData = await getDoc(docRef).then((doc) => doc.data());
|
|
2100
|
-
return this.interceptors
|
|
2823
|
+
return ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, docData, intercepted)) || docData;
|
|
2101
2824
|
}
|
|
2102
2825
|
buildCollectionPathForUpdate(identifiers) {
|
|
2103
2826
|
return this.isSubCollection(this)
|
|
@@ -2108,10 +2831,7 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
2108
2831
|
const model = this.model;
|
|
2109
2832
|
if (model.isModel(params))
|
|
2110
2833
|
return params.toPlain();
|
|
2111
|
-
return Object.keys(params).reduce((data, currentKey) => ({
|
|
2112
|
-
...data,
|
|
2113
|
-
...((value) => (value === undefined ? {} : { [currentKey]: value }))(getValueByAction(params[currentKey])),
|
|
2114
|
-
}), {});
|
|
2834
|
+
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), ((value) => (value === undefined ? {} : { [currentKey]: value }))(getValueByAction(params[currentKey])))), {});
|
|
2115
2835
|
}
|
|
2116
2836
|
};
|
|
2117
2837
|
};
|
|
@@ -2119,11 +2839,12 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
2119
2839
|
const withDeleteFirestore = (MixinBase) => {
|
|
2120
2840
|
return class DeleteFirestore extends MixinBase {
|
|
2121
2841
|
async delete(identifiers) {
|
|
2122
|
-
|
|
2123
|
-
const
|
|
2124
|
-
const
|
|
2842
|
+
var _a, _b, _c, _d;
|
|
2843
|
+
const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => (Object.assign(Object.assign({}, acc), { [field]: identifiers[field] })), {}));
|
|
2844
|
+
const intercepted = await ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance }));
|
|
2845
|
+
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || instance;
|
|
2125
2846
|
await deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(builded.identifier).shift().toString()));
|
|
2126
|
-
await this.interceptors
|
|
2847
|
+
await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, instance, intercepted));
|
|
2127
2848
|
}
|
|
2128
2849
|
buildCollectionPathForRemove(identifiers) {
|
|
2129
2850
|
return this.isSubCollection(this)
|
|
@@ -2162,7 +2883,7 @@ class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2162
2883
|
}
|
|
2163
2884
|
}
|
|
2164
2885
|
|
|
2165
|
-
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))
|
|
2886
|
+
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2166
2887
|
constructor({ firestore, interceptors }, parentRepository) {
|
|
2167
2888
|
super({
|
|
2168
2889
|
firestore,
|
|
@@ -2186,7 +2907,7 @@ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
2186
2907
|
}
|
|
2187
2908
|
}
|
|
2188
2909
|
|
|
2189
|
-
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))
|
|
2910
|
+
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2190
2911
|
constructor({ firestore, interceptors }, parentRepository) {
|
|
2191
2912
|
super({
|
|
2192
2913
|
firestore,
|
|
@@ -2199,7 +2920,7 @@ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudF
|
|
|
2199
2920
|
}
|
|
2200
2921
|
}
|
|
2201
2922
|
|
|
2202
|
-
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))
|
|
2923
|
+
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2203
2924
|
constructor({ firestore, interceptors }, parentRepository) {
|
|
2204
2925
|
super({
|
|
2205
2926
|
firestore,
|
|
@@ -2212,7 +2933,7 @@ class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore
|
|
|
2212
2933
|
}
|
|
2213
2934
|
}
|
|
2214
2935
|
|
|
2215
|
-
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))
|
|
2936
|
+
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2216
2937
|
constructor({ firestore, interceptors }, parentRepository) {
|
|
2217
2938
|
super({
|
|
2218
2939
|
firestore,
|
|
@@ -2271,7 +2992,7 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2271
2992
|
}
|
|
2272
2993
|
}
|
|
2273
2994
|
|
|
2274
|
-
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))
|
|
2995
|
+
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2275
2996
|
constructor({ firestore, interceptors }, parentRepository) {
|
|
2276
2997
|
super({
|
|
2277
2998
|
firestore,
|
|
@@ -2319,15 +3040,15 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
|
|
|
2319
3040
|
const products = [];
|
|
2320
3041
|
const wheres = [];
|
|
2321
3042
|
for (const productIds of chunks) {
|
|
2322
|
-
if (options
|
|
3043
|
+
if ((options === null || options === void 0 ? void 0 : options.limit) && products.length >= (options === null || options === void 0 ? void 0 : options.limit))
|
|
2323
3044
|
break;
|
|
2324
3045
|
wheres.push(where('published', '==', true), where('id', 'in', productIds));
|
|
2325
|
-
if (options
|
|
3046
|
+
if (options === null || options === void 0 ? void 0 : options.hasStock)
|
|
2326
3047
|
wheres.push(where('stock.quantity', '>', 0));
|
|
2327
|
-
if (options
|
|
2328
|
-
wheres.push(where('tags', 'array-contains', options
|
|
2329
|
-
if (options
|
|
2330
|
-
wheres.push(limit(options
|
|
3048
|
+
if (options === null || options === void 0 ? void 0 : options.gender)
|
|
3049
|
+
wheres.push(where('tags', 'array-contains', options === null || options === void 0 ? void 0 : options.gender));
|
|
3050
|
+
if (options === null || options === void 0 ? void 0 : options.limit)
|
|
3051
|
+
wheres.push(limit(options === null || options === void 0 ? void 0 : options.limit));
|
|
2331
3052
|
const productSnap = await getDocs(query(this.collection('productsErpVitrine'), ...wheres));
|
|
2332
3053
|
if (productSnap.empty)
|
|
2333
3054
|
continue;
|
|
@@ -2357,17 +3078,19 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
2357
3078
|
this.reviews = {};
|
|
2358
3079
|
}
|
|
2359
3080
|
async getBySlug(slug) {
|
|
3081
|
+
var _a;
|
|
2360
3082
|
const result = await this.find({
|
|
2361
3083
|
filters: {
|
|
2362
3084
|
slug: { operator: Where.EQUALS, value: slug },
|
|
2363
3085
|
},
|
|
2364
3086
|
});
|
|
2365
|
-
return result
|
|
3087
|
+
return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
2366
3088
|
}
|
|
2367
3089
|
async fetchReviews(status) {
|
|
2368
3090
|
const { data: products } = await this.find();
|
|
2369
3091
|
products.forEach((product) => {
|
|
2370
|
-
|
|
3092
|
+
var _a;
|
|
3093
|
+
if ([undefined, 0].includes((_a = product.reviews) === null || _a === void 0 ? void 0 : _a.length))
|
|
2371
3094
|
return;
|
|
2372
3095
|
const productInfo = {
|
|
2373
3096
|
productId: product.id,
|
|
@@ -2379,11 +3102,11 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
2379
3102
|
this.reviews.rejected = [];
|
|
2380
3103
|
product.reviews.forEach((review) => {
|
|
2381
3104
|
if ([null, undefined].includes(review.status))
|
|
2382
|
-
return this.reviews.pending.push({
|
|
3105
|
+
return this.reviews.pending.push(Object.assign(Object.assign({}, review), productInfo));
|
|
2383
3106
|
if (review.status === false)
|
|
2384
|
-
return this.reviews.rejected.push({
|
|
3107
|
+
return this.reviews.rejected.push(Object.assign(Object.assign({}, review), productInfo));
|
|
2385
3108
|
if (!!review.status)
|
|
2386
|
-
return this.reviews.approved.push({
|
|
3109
|
+
return this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
|
|
2387
3110
|
return review;
|
|
2388
3111
|
});
|
|
2389
3112
|
});
|
|
@@ -2397,7 +3120,7 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
2397
3120
|
}
|
|
2398
3121
|
}
|
|
2399
3122
|
|
|
2400
|
-
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))
|
|
3123
|
+
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2401
3124
|
constructor({ firestore, interceptors }, parentRepository) {
|
|
2402
3125
|
super({
|
|
2403
3126
|
firestore,
|
|
@@ -2516,7 +3239,8 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
|
|
|
2516
3239
|
},
|
|
2517
3240
|
});
|
|
2518
3241
|
this.orderFromFirestore = (order) => {
|
|
2519
|
-
|
|
3242
|
+
var _a;
|
|
3243
|
+
if (!!((_a = order === null || order === void 0 ? void 0 : order.lineItems) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
2520
3244
|
order.lineItems = order.lineItems.map((lineItem) => {
|
|
2521
3245
|
const prices = !!lineItem.price;
|
|
2522
3246
|
const shopPrice = prices[order.shop];
|
|
@@ -2531,7 +3255,7 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
|
|
|
2531
3255
|
buildModelInstance() {
|
|
2532
3256
|
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
2533
3257
|
return {
|
|
2534
|
-
toFirestore: (data) => toFirestore(data
|
|
3258
|
+
toFirestore: (data) => toFirestore((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data),
|
|
2535
3259
|
fromFirestore: (snap) => {
|
|
2536
3260
|
const instance = fromFirestore(snap);
|
|
2537
3261
|
return this.orderFromFirestore(instance);
|
|
@@ -2580,18 +3304,22 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2580
3304
|
model: Home,
|
|
2581
3305
|
interceptors,
|
|
2582
3306
|
});
|
|
2583
|
-
this.homeCategoryGroupToPlain = (homeCategoryGroup) =>
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
: homeCategoryGroup
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
.filter(Boolean) || [],
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
3307
|
+
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
3308
|
+
var _a, _b, _c;
|
|
3309
|
+
return ({
|
|
3310
|
+
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
3311
|
+
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
3312
|
+
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
3313
|
+
products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => ((product === null || product === void 0 ? void 0 : product.toPlain) ? product === null || product === void 0 ? void 0 : product.toPlain() : product)).filter(Boolean)) || [],
|
|
3314
|
+
});
|
|
3315
|
+
};
|
|
3316
|
+
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
3317
|
+
var _a;
|
|
3318
|
+
return ({
|
|
3319
|
+
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
3320
|
+
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
3321
|
+
});
|
|
3322
|
+
};
|
|
2595
3323
|
}
|
|
2596
3324
|
buildModelInstance() {
|
|
2597
3325
|
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
@@ -2607,15 +3335,17 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2607
3335
|
};
|
|
2608
3336
|
}
|
|
2609
3337
|
homeToFirestore(home) {
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
home.data.data.
|
|
2613
|
-
home.data.data.
|
|
3338
|
+
var _a, _b, _c, _d;
|
|
3339
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3340
|
+
home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
|
|
3341
|
+
home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
|
|
3342
|
+
home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
|
|
2614
3343
|
}
|
|
2615
3344
|
return home;
|
|
2616
3345
|
}
|
|
2617
3346
|
homeFromFirestore(home) {
|
|
2618
|
-
|
|
3347
|
+
var _a;
|
|
3348
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
2619
3349
|
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
2620
3350
|
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
2621
3351
|
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
@@ -2722,35 +3452,32 @@ class RegisterFirebaseAuthService {
|
|
|
2722
3452
|
class AttributeOptionHelper {
|
|
2723
3453
|
}
|
|
2724
3454
|
AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
|
|
3455
|
+
var _a;
|
|
2725
3456
|
if (fields.includes(attributeName))
|
|
2726
3457
|
return { columnName: attributeName.toString(), attributeName, to: (value) => value, from: (value) => value };
|
|
2727
|
-
const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
|
|
2728
|
-
const fieldOption = is(field)
|
|
3458
|
+
const field = fields.find((columnOption) => isObject$1(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
|
|
3459
|
+
const fieldOption = (_a = is(field)) === null || _a === void 0 ? void 0 : _a[attributeName];
|
|
2729
3460
|
if (isNil(fieldOption))
|
|
2730
3461
|
return { columnName: attributeName.toString(), attributeName };
|
|
2731
3462
|
if (Array.isArray(fieldOption))
|
|
2732
3463
|
return { columnName: attributeName.toString(), attributeName, fields: fieldOption };
|
|
2733
|
-
return { attributeName, columnName: attributeName.toString(),
|
|
3464
|
+
return Object.assign({ attributeName, columnName: attributeName.toString() }, fieldOption);
|
|
2734
3465
|
};
|
|
2735
|
-
AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue
|
|
3466
|
+
AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!(fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.columnName);
|
|
2736
3467
|
AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
|
|
2737
3468
|
if (fields.includes(columnName))
|
|
2738
3469
|
return { columnName, attributeName: columnName };
|
|
2739
3470
|
const field = is(fields.find((field) => {
|
|
2740
|
-
if (!isObject(field))
|
|
3471
|
+
if (!isObject$1(field))
|
|
2741
3472
|
return false;
|
|
2742
3473
|
const columnOption = Object.values(field).find((option) => AttributeOptionHelper.CheckIsColumnOption(option) && option.columnName === columnName ? option : {});
|
|
2743
|
-
return AttributeOptionHelper.CheckIsColumnOption(columnOption) && columnOption
|
|
3474
|
+
return AttributeOptionHelper.CheckIsColumnOption(columnOption) && (columnOption === null || columnOption === void 0 ? void 0 : columnOption.columnName) === columnName;
|
|
2744
3475
|
}) || {});
|
|
2745
3476
|
const attributeName = Object.keys(field).find((fieldOptionFromList) => AttributeOptionHelper.CheckIsColumnOption(field[fieldOptionFromList]) || Array.isArray(field[fieldOptionFromList]));
|
|
2746
|
-
const fieldOption = field
|
|
3477
|
+
const fieldOption = field === null || field === void 0 ? void 0 : field[attributeName];
|
|
2747
3478
|
if (Array.isArray(fieldOption))
|
|
2748
3479
|
return { attributeName: attributeName, fields: fieldOption };
|
|
2749
|
-
return {
|
|
2750
|
-
attributeName: attributeName || columnName,
|
|
2751
|
-
columnName,
|
|
2752
|
-
...fieldOption,
|
|
2753
|
-
};
|
|
3480
|
+
return Object.assign({ attributeName: attributeName || columnName, columnName }, fieldOption);
|
|
2754
3481
|
};
|
|
2755
3482
|
|
|
2756
3483
|
var HasuraGraphQLWhere;
|
|
@@ -2785,7 +3512,7 @@ var HasuraGraphQLColumnType;
|
|
|
2785
3512
|
|
|
2786
3513
|
class FilterOptionHelper {
|
|
2787
3514
|
}
|
|
2788
|
-
FilterOptionHelper.CheckIfIsFilterOption = (filter) => !isNil(filter
|
|
3515
|
+
FilterOptionHelper.CheckIfIsFilterOption = (filter) => !isNil(filter === null || filter === void 0 ? void 0 : filter.operator);
|
|
2789
3516
|
FilterOptionHelper.GetValueFromFilter = (filter, fieldOption) => {
|
|
2790
3517
|
if (!FilterOptionHelper.CheckIfIsFilterOption(filter))
|
|
2791
3518
|
return filter;
|
|
@@ -2808,49 +3535,34 @@ class BindFilterQueryHelper {
|
|
|
2808
3535
|
BindFilterQueryHelper.MakeGraphQLWhere = (filter, fields) => Object.keys(filter).reduce((variables, fieldName) => {
|
|
2809
3536
|
const columnOption = AttributeOptionHelper.FindByAttribute(fieldName, fields);
|
|
2810
3537
|
if (!columnOption.bindFindFilter)
|
|
2811
|
-
return {
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
[columnOption.columnName]: BindFilterQueryHelper.BuildWhereSentence(fieldName, filter[fieldName], fields),
|
|
2815
|
-
},
|
|
2816
|
-
};
|
|
3538
|
+
return Object.assign(Object.assign({}, variables), {
|
|
3539
|
+
[columnOption.columnName]: BindFilterQueryHelper.BuildWhereSentence(fieldName, filter[fieldName], fields),
|
|
3540
|
+
});
|
|
2817
3541
|
const builtFilter = columnOption.bindFindFilter(filter[fieldName]);
|
|
2818
|
-
return {
|
|
2819
|
-
...variables,
|
|
2820
|
-
...Object.keys(builtFilter).reduce((variablesList, columnName) => ({
|
|
2821
|
-
...variablesList,
|
|
2822
|
-
[columnName]: BindFilterQueryHelper.BuildWhereSentence(fieldName, builtFilter[columnName], fields),
|
|
2823
|
-
}), {}),
|
|
2824
|
-
};
|
|
3542
|
+
return Object.assign(Object.assign({}, variables), Object.keys(builtFilter).reduce((variablesList, columnName) => (Object.assign(Object.assign({}, variablesList), { [columnName]: BindFilterQueryHelper.BuildWhereSentence(fieldName, builtFilter[columnName], fields) })), {}));
|
|
2825
3543
|
}, {});
|
|
2826
3544
|
BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
|
|
2827
3545
|
const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
|
|
2828
3546
|
const isNestedField = !Array.isArray(options) &&
|
|
2829
|
-
isObject(options) &&
|
|
2830
|
-
isNil(options
|
|
2831
|
-
isNil(options
|
|
2832
|
-
isNil(fieldSentenceOptions
|
|
3547
|
+
isObject$1(options) &&
|
|
3548
|
+
isNil(options === null || options === void 0 ? void 0 : options.operator) &&
|
|
3549
|
+
isNil(options === null || options === void 0 ? void 0 : options.value) &&
|
|
3550
|
+
isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to);
|
|
2833
3551
|
if (isNestedField)
|
|
2834
3552
|
return Object.keys(options).reduce((variables, key) => {
|
|
2835
|
-
const fieldOptions = AttributeOptionHelper.FindByAttribute(key, fieldSentenceOptions
|
|
3553
|
+
const fieldOptions = AttributeOptionHelper.FindByAttribute(key, (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || fields);
|
|
2836
3554
|
const columnName = fieldOptions.columnName;
|
|
2837
3555
|
const columnFields = fieldOptions.fields;
|
|
2838
|
-
return {
|
|
2839
|
-
...variables,
|
|
2840
|
-
[columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), fieldSentenceOptions?.fields || columnFields || fields),
|
|
2841
|
-
};
|
|
3556
|
+
return Object.assign(Object.assign({}, variables), { [columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || columnFields || fields) });
|
|
2842
3557
|
}, {});
|
|
2843
3558
|
if (!Array.isArray(options) && !isNil(fieldSentenceOptions.fields))
|
|
2844
3559
|
return {
|
|
2845
3560
|
[fieldSentenceOptions.fields[0]]: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
|
|
2846
3561
|
};
|
|
2847
|
-
if (!Array.isArray(options) && isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
|
|
3562
|
+
if (!Array.isArray(options) && isObject$1(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
|
|
2848
3563
|
options = Object.values(options)[0];
|
|
2849
3564
|
return Array.isArray(options)
|
|
2850
|
-
? options.reduce((whereSentence, option) => ({
|
|
2851
|
-
...whereSentence,
|
|
2852
|
-
...BindFilterQueryHelper.BuildOperatorSentence(option, fieldSentenceOptions),
|
|
2853
|
-
}), {})
|
|
3565
|
+
? options.reduce((whereSentence, option) => (Object.assign(Object.assign({}, whereSentence), BindFilterQueryHelper.BuildOperatorSentence(option, fieldSentenceOptions))), {})
|
|
2854
3566
|
: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions);
|
|
2855
3567
|
};
|
|
2856
3568
|
BindFilterQueryHelper.BuildOperatorSentence = (options, fieldOption) => ({
|
|
@@ -2860,21 +3572,20 @@ BindFilterQueryHelper.GetHasuraOperator = (options, fieldOption) => FilterOption
|
|
|
2860
3572
|
? fieldOption.type === HasuraGraphQLColumnType.Jsonb
|
|
2861
3573
|
? BindFilterQueryHelper.GetHasuraJsonbOperator(options)
|
|
2862
3574
|
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator ===
|
|
2863
|
-
Object.keys(Where).find((operator) => Where[operator] === options
|
|
3575
|
+
Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))]
|
|
2864
3576
|
: HasuraGraphQLWhere.EQUALS;
|
|
2865
3577
|
BindFilterQueryHelper.GetHasuraJsonbOperator = (options) => options.operator === Where.IN
|
|
2866
3578
|
? HasuraGraphQLWhere.JSON_CONTAINS
|
|
2867
3579
|
: options.operator === Where.LIKE
|
|
2868
3580
|
? HasuraGraphQLWhere.JSON_HAS_KEYS_ANY
|
|
2869
3581
|
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator ===
|
|
2870
|
-
Object.keys(Where).find((operator) => Where[operator] === options
|
|
3582
|
+
Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))];
|
|
2871
3583
|
|
|
2872
3584
|
class GraphQLFieldHelper {
|
|
2873
3585
|
}
|
|
2874
3586
|
GraphQLFieldHelper.CheckIsGraphQLParams = (params) => !isString(params) && Array.isArray(params) && params.length >= 0 && !!params[0].operation;
|
|
2875
3587
|
GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = (fields) => {
|
|
2876
|
-
return fields
|
|
2877
|
-
?.map((field) => {
|
|
3588
|
+
return fields === null || fields === void 0 ? void 0 : fields.map((field) => {
|
|
2878
3589
|
if (isString(field))
|
|
2879
3590
|
return field.toString();
|
|
2880
3591
|
if (field === 'affected_rows')
|
|
@@ -2889,85 +3600,65 @@ GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = (fields) => {
|
|
|
2889
3600
|
if (isNestedField)
|
|
2890
3601
|
return GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields(fieldName, fieldValue);
|
|
2891
3602
|
return fieldValue.columnName;
|
|
2892
|
-
})
|
|
2893
|
-
.filter((field) => !!field);
|
|
3603
|
+
}).filter((field) => !!field);
|
|
2894
3604
|
};
|
|
2895
3605
|
GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).reduce((result, columnName) => {
|
|
2896
3606
|
const { attributeName, fields: attributeFields, from, } = AttributeOptionHelper.FindColumnOptionFromList(columnName, fields);
|
|
2897
3607
|
if (!!attributeFields && Array.isArray(attributeFields)) {
|
|
2898
3608
|
if (Array.isArray(data[columnName]))
|
|
2899
|
-
return {
|
|
2900
|
-
...result,
|
|
2901
|
-
[attributeName]: from
|
|
3609
|
+
return Object.assign(Object.assign({}, result), { [attributeName]: from
|
|
2902
3610
|
? from(data[columnName], data)
|
|
2903
|
-
: is(data[columnName]).map((value) => GraphQLFieldHelper.ConvertFieldValueFrom(is(value), attributeFields))
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
return {
|
|
2907
|
-
...result,
|
|
2908
|
-
[attributeName]: !!from
|
|
3611
|
+
: is(data[columnName]).map((value) => GraphQLFieldHelper.ConvertFieldValueFrom(is(value), attributeFields)) });
|
|
3612
|
+
if (isObject$1(data[columnName]))
|
|
3613
|
+
return Object.assign(Object.assign({}, result), { [attributeName]: !!from
|
|
2909
3614
|
? from(data[columnName])
|
|
2910
|
-
: GraphQLFieldHelper.ConvertFieldValueFrom(is(data[columnName]), attributeFields)
|
|
2911
|
-
};
|
|
3615
|
+
: GraphQLFieldHelper.ConvertFieldValueFrom(is(data[columnName]), attributeFields) });
|
|
2912
3616
|
}
|
|
2913
3617
|
if (!!from)
|
|
2914
|
-
return {
|
|
2915
|
-
return {
|
|
2916
|
-
...result,
|
|
2917
|
-
[attributeName]: isString(data[columnName]) ? parseDateTime(data[columnName].toString()) : data[columnName],
|
|
2918
|
-
};
|
|
3618
|
+
return Object.assign(Object.assign({}, result), { [attributeName]: from(data[columnName], data) });
|
|
3619
|
+
return Object.assign(Object.assign({}, result), { [attributeName]: isString(data[columnName]) ? parseDateTime(data[columnName].toString()) : data[columnName] });
|
|
2919
3620
|
}, {});
|
|
2920
3621
|
GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
|
|
2921
|
-
|
|
3622
|
+
var _a;
|
|
3623
|
+
const data = ((_a = instance.toPlain) === null || _a === void 0 ? void 0 : _a.call(instance)) || instance;
|
|
2922
3624
|
return Object.keys(data).reduce((result, attributeName) => {
|
|
2923
3625
|
const { columnName, fields: attributeFields, foreignKeyColumn, to, bindPersistData, } = AttributeOptionHelper.FindByAttribute(attributeName, fields);
|
|
2924
3626
|
if (bindPersistData)
|
|
2925
|
-
return {
|
|
2926
|
-
...result,
|
|
2927
|
-
...bindPersistData(data[attributeName], instance),
|
|
2928
|
-
};
|
|
3627
|
+
return Object.assign(Object.assign({}, result), bindPersistData(data[attributeName], instance));
|
|
2929
3628
|
if (isNil(columnName))
|
|
2930
3629
|
return result;
|
|
2931
3630
|
if (!!foreignKeyColumn &&
|
|
2932
3631
|
!isEmpty(foreignKeyColumn) &&
|
|
2933
|
-
!Object.keys(foreignKeyColumn).filter((key) => !is(data[attributeName])
|
|
3632
|
+
!Object.keys(foreignKeyColumn).filter((key) => { var _a; return !((_a = is(data[attributeName])) === null || _a === void 0 ? void 0 : _a[key]); }).length)
|
|
2934
3633
|
return Object.keys(foreignKeyColumn).reduce((object, current) => {
|
|
3634
|
+
var _a;
|
|
2935
3635
|
const { columnName: foreignColumnName } = AttributeOptionHelper.FindByAttribute(foreignKeyColumn[current], fields);
|
|
2936
|
-
return {
|
|
2937
|
-
|
|
2938
|
-
[foreignColumnName]: data[attributeName]?.[current],
|
|
2939
|
-
};
|
|
2940
|
-
}, { ...result });
|
|
3636
|
+
return Object.assign(Object.assign({}, object), { [foreignColumnName]: (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current] });
|
|
3637
|
+
}, Object.assign({}, result));
|
|
2941
3638
|
if (update &&
|
|
2942
|
-
isObject(data[attributeName]) &&
|
|
3639
|
+
isObject$1(data[attributeName]) &&
|
|
2943
3640
|
!isNil(attributeFields) &&
|
|
2944
3641
|
!isDate(data[attributeName]))
|
|
2945
3642
|
return result;
|
|
2946
3643
|
if (!!columnName &&
|
|
2947
3644
|
Array.isArray(attributeFields) &&
|
|
2948
|
-
isObject(data[attributeName])) {
|
|
3645
|
+
isObject$1(data[attributeName])) {
|
|
2949
3646
|
const converted = !isNil(columnName) && to
|
|
2950
3647
|
? to(instance[attributeName], instance)
|
|
2951
3648
|
: data[attributeName];
|
|
2952
|
-
return {
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
}
|
|
2962
|
-
: {}),
|
|
2963
|
-
};
|
|
3649
|
+
return Object.assign(Object.assign({}, result), (converted !== undefined
|
|
3650
|
+
? {
|
|
3651
|
+
[columnName]: {
|
|
3652
|
+
data: instance[attributeName] instanceof BaseModel
|
|
3653
|
+
? GraphQLFieldHelper.ConvertFieldValueTo(data[attributeName], attributeFields)
|
|
3654
|
+
: converted,
|
|
3655
|
+
},
|
|
3656
|
+
}
|
|
3657
|
+
: {}));
|
|
2964
3658
|
}
|
|
2965
3659
|
if (!!to)
|
|
2966
|
-
return {
|
|
2967
|
-
|
|
2968
|
-
[columnName]: to(instance[attributeName], instance),
|
|
2969
|
-
};
|
|
2970
|
-
return { ...result, [columnName]: data[attributeName] };
|
|
3660
|
+
return Object.assign(Object.assign({}, result), { [columnName]: to(instance[attributeName], instance) });
|
|
3661
|
+
return Object.assign(Object.assign({}, result), { [columnName]: data[attributeName] });
|
|
2971
3662
|
}, {});
|
|
2972
3663
|
};
|
|
2973
3664
|
GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields = (fieldName, fieldValue) => {
|
|
@@ -2993,10 +3684,10 @@ GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields = (fieldName, fieldValue)
|
|
|
2993
3684
|
const withCreateHasuraGraphQL = (MixinBase) => {
|
|
2994
3685
|
return class CreateHasuraGraphQLMixin extends MixinBase {
|
|
2995
3686
|
constructor(...params) {
|
|
2996
|
-
const options = params
|
|
3687
|
+
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
2997
3688
|
super(...params);
|
|
2998
|
-
this.insertGraphQLOperation = options
|
|
2999
|
-
this.insertGraphQLObjectType = options
|
|
3689
|
+
this.insertGraphQLOperation = (options === null || options === void 0 ? void 0 : options.insertGraphQLOperation) || `insert_${this.tableName}_one`;
|
|
3690
|
+
this.insertGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.insertGraphQLObjectType) || `${this.tableName}_insert_input`;
|
|
3000
3691
|
}
|
|
3001
3692
|
async create(data) {
|
|
3002
3693
|
this.logger = DebugHelper.from(this, 'create');
|
|
@@ -3010,10 +3701,12 @@ const withCreateHasuraGraphQL = (MixinBase) => {
|
|
|
3010
3701
|
const columnOptions = Object.values(field).shift();
|
|
3011
3702
|
return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
|
|
3012
3703
|
columnOptions.foreignKeyColumn && [
|
|
3013
|
-
...Object.values(columnOptions.foreignKeyColumn).map((foreignKeyName) => AttributeOptionHelper.FindByAttribute(foreignKeyName, this.fields)
|
|
3704
|
+
...Object.values(columnOptions.foreignKeyColumn).map((foreignKeyName) => { var _a; return (_a = AttributeOptionHelper.FindByAttribute(foreignKeyName, this.fields)) === null || _a === void 0 ? void 0 : _a.columnName; }),
|
|
3014
3705
|
{
|
|
3015
|
-
[columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) =>
|
|
3016
|
-
|
|
3706
|
+
[columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => {
|
|
3707
|
+
var _a;
|
|
3708
|
+
return ((_a = AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions === null || columnOptions === void 0 ? void 0 : columnOptions.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || foreignKeyField;
|
|
3709
|
+
}),
|
|
3017
3710
|
},
|
|
3018
3711
|
]);
|
|
3019
3712
|
})
|
|
@@ -3022,7 +3715,7 @@ const withCreateHasuraGraphQL = (MixinBase) => {
|
|
|
3022
3715
|
const result = await this.mutation(this.insertGraphQLOperation, [...primaryKeyColumns, ...foreignKeyColumns], {
|
|
3023
3716
|
object: { type: this.insertGraphQLObjectType, required: true, value: this.convertDataToHasura(data) },
|
|
3024
3717
|
});
|
|
3025
|
-
return {
|
|
3718
|
+
return Object.assign(Object.assign({}, data.toPlain()), this.convertDataFromHasura(result[this.insertGraphQLOperation]).toPlain());
|
|
3026
3719
|
}
|
|
3027
3720
|
};
|
|
3028
3721
|
};
|
|
@@ -3030,9 +3723,9 @@ const withCreateHasuraGraphQL = (MixinBase) => {
|
|
|
3030
3723
|
const withDeleteHasuraGraphQL = (MixinBase) => {
|
|
3031
3724
|
return class DeleteHasuraGraphQLMixin extends MixinBase {
|
|
3032
3725
|
constructor(...params) {
|
|
3033
|
-
const options = params
|
|
3726
|
+
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
3034
3727
|
super(...params);
|
|
3035
|
-
this.deleteGraphQLOperation = options
|
|
3728
|
+
this.deleteGraphQLOperation = (options === null || options === void 0 ? void 0 : options.deleteGraphQLOperation) || `delete_${this.tableName}_by_pk`;
|
|
3036
3729
|
}
|
|
3037
3730
|
async delete(identifiers) {
|
|
3038
3731
|
this.logger = DebugHelper.from(this, 'delete');
|
|
@@ -3043,14 +3736,11 @@ const withDeleteHasuraGraphQL = (MixinBase) => {
|
|
|
3043
3736
|
return ids;
|
|
3044
3737
|
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
3045
3738
|
const value = columnOption.to(identifiers[identifier], instance);
|
|
3046
|
-
return {
|
|
3047
|
-
...ids,
|
|
3048
|
-
[columnOption.columnName]: {
|
|
3739
|
+
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: {
|
|
3049
3740
|
type: this.getAttributeGraphQLTypeOf(columnOption.type || value),
|
|
3050
3741
|
value,
|
|
3051
3742
|
required: true,
|
|
3052
|
-
}
|
|
3053
|
-
};
|
|
3743
|
+
} });
|
|
3054
3744
|
}, {}));
|
|
3055
3745
|
}
|
|
3056
3746
|
};
|
|
@@ -3058,6 +3748,15 @@ const withDeleteHasuraGraphQL = (MixinBase) => {
|
|
|
3058
3748
|
|
|
3059
3749
|
const withHasuraGraphQL = (MixinBase) => {
|
|
3060
3750
|
return class HasuraGraphQLMixin extends MixinBase {
|
|
3751
|
+
get headers() {
|
|
3752
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3753
|
+
return Object.assign(Object.assign(Object.assign({ 'Content-Type': 'application/json' }, (isNil((_a = this.authOptions) === null || _a === void 0 ? void 0 : _a.authToken) ? {} : { Authorization: (_b = this.authOptions) === null || _b === void 0 ? void 0 : _b.authToken })), (isNil((_c = this.authOptions) === null || _c === void 0 ? void 0 : _c.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': (_d = this.authOptions) === null || _d === void 0 ? void 0 : _d.adminSecret })), (isNil((_e = this.authOptions) === null || _e === void 0 ? void 0 : _e.authRole)
|
|
3754
|
+
? {}
|
|
3755
|
+
: {
|
|
3756
|
+
'X-Hasura-Role': this.authOptions.authRole.role,
|
|
3757
|
+
'X-Hasura-User-Id': (_g = (_f = this.authOptions) === null || _f === void 0 ? void 0 : _f.authRole) === null || _g === void 0 ? void 0 : _g.userId,
|
|
3758
|
+
}));
|
|
3759
|
+
}
|
|
3061
3760
|
constructor(...params) {
|
|
3062
3761
|
const options = params[0];
|
|
3063
3762
|
super(...params);
|
|
@@ -3068,19 +3767,6 @@ const withHasuraGraphQL = (MixinBase) => {
|
|
|
3068
3767
|
this.fields = options.fields || this.model.identifiersFields;
|
|
3069
3768
|
this.logger = DebugHelper.from(this);
|
|
3070
3769
|
}
|
|
3071
|
-
get headers() {
|
|
3072
|
-
return {
|
|
3073
|
-
'Content-Type': 'application/json',
|
|
3074
|
-
...(isNil(this.authOptions?.authToken) ? {} : { Authorization: this.authOptions?.authToken }),
|
|
3075
|
-
...(isNil(this.authOptions?.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions?.adminSecret }),
|
|
3076
|
-
...(isNil(this.authOptions?.authRole)
|
|
3077
|
-
? {}
|
|
3078
|
-
: {
|
|
3079
|
-
'X-Hasura-Role': this.authOptions.authRole.role,
|
|
3080
|
-
'X-Hasura-User-Id': this.authOptions?.authRole?.userId,
|
|
3081
|
-
}),
|
|
3082
|
-
};
|
|
3083
|
-
}
|
|
3084
3770
|
async mutation(operation, fields, variables) {
|
|
3085
3771
|
const resultQuery = mutation({
|
|
3086
3772
|
operation,
|
|
@@ -3090,15 +3776,16 @@ const withHasuraGraphQL = (MixinBase) => {
|
|
|
3090
3776
|
return this.fetch(resultQuery);
|
|
3091
3777
|
}
|
|
3092
3778
|
async query(operation, fields, variables) {
|
|
3779
|
+
var _a, _b, _c, _d;
|
|
3093
3780
|
const builded = this.buildHasuraQueryFields({
|
|
3094
3781
|
operation,
|
|
3095
3782
|
fields: fields,
|
|
3096
3783
|
variables,
|
|
3097
3784
|
});
|
|
3098
|
-
const interpected = (await this.interceptors
|
|
3785
|
+
const interpected = (await ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, builded))) || builded;
|
|
3099
3786
|
const resultQuery = query$1(interpected);
|
|
3100
3787
|
const result = await this.fetch(resultQuery);
|
|
3101
|
-
return (await this.interceptors
|
|
3788
|
+
return (await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, result, interpected))) || result;
|
|
3102
3789
|
}
|
|
3103
3790
|
async fetch(params) {
|
|
3104
3791
|
this.logger.with('params').log(params);
|
|
@@ -3164,7 +3851,7 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
|
|
|
3164
3851
|
const getValueByAction = (options) => {
|
|
3165
3852
|
if (options instanceof BaseModel)
|
|
3166
3853
|
return options.toPlain();
|
|
3167
|
-
if (isNil(options
|
|
3854
|
+
if (isNil(options === null || options === void 0 ? void 0 : options.action))
|
|
3168
3855
|
return options;
|
|
3169
3856
|
if ([UpdateOptionActions.REMOVE_FIELD.toString(), UpdateOptionActions.NULL.toString()].includes(options.action))
|
|
3170
3857
|
return null;
|
|
@@ -3172,11 +3859,11 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
|
|
|
3172
3859
|
};
|
|
3173
3860
|
return class UpdateHasuraGraphQLMixin extends MixinBase {
|
|
3174
3861
|
constructor(...params) {
|
|
3175
|
-
const options = params
|
|
3862
|
+
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
3176
3863
|
super(...params);
|
|
3177
|
-
this.updateGraphQLOperation = options
|
|
3178
|
-
this.updateGraphQLObjectType = options
|
|
3179
|
-
this.updateGraphQLPKType = options
|
|
3864
|
+
this.updateGraphQLOperation = (options === null || options === void 0 ? void 0 : options.updateGraphQLOperation) || `update_${this.tableName}_by_pk`;
|
|
3865
|
+
this.updateGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.updateGraphQLObjectType) || `${this.tableName}_set_input`;
|
|
3866
|
+
this.updateGraphQLPKType = (options === null || options === void 0 ? void 0 : options.updateGraphQLPKType) || `${this.tableName}_pk_columns_input`;
|
|
3180
3867
|
}
|
|
3181
3868
|
async update(data) {
|
|
3182
3869
|
this.logger = DebugHelper.from(this, 'update');
|
|
@@ -3195,25 +3882,20 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
|
|
|
3195
3882
|
const model = this.model;
|
|
3196
3883
|
if (model.isModel(params))
|
|
3197
3884
|
return params.toPlain();
|
|
3198
|
-
return Object.keys(params).reduce((data, currentKey) => ({
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
[currentKey]: getValueByAction(is(params[currentKey])),
|
|
3202
|
-
}),
|
|
3203
|
-
}), {});
|
|
3885
|
+
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), (params[currentKey] !== undefined && {
|
|
3886
|
+
[currentKey]: getValueByAction(is(params[currentKey])),
|
|
3887
|
+
}))), {});
|
|
3204
3888
|
}
|
|
3205
3889
|
getUpdateModelKeys(data) {
|
|
3206
3890
|
const instance = this.model.toInstance(data);
|
|
3207
3891
|
return this.model.identifiersFields.reduce((ids, identifier) => {
|
|
3892
|
+
var _a;
|
|
3208
3893
|
const identifierBinded = identifier;
|
|
3209
3894
|
if (isNil(instance.identifier[identifierBinded]))
|
|
3210
3895
|
return ids;
|
|
3211
3896
|
const columnOption = AttributeOptionHelper.FindByAttribute(identifierBinded, this.fields);
|
|
3212
|
-
const value = columnOption
|
|
3213
|
-
return {
|
|
3214
|
-
...ids,
|
|
3215
|
-
[columnOption.columnName]: value,
|
|
3216
|
-
};
|
|
3897
|
+
const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[identifierBinded], instance)) || data[columnOption.attributeName];
|
|
3898
|
+
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: value });
|
|
3217
3899
|
}, {});
|
|
3218
3900
|
}
|
|
3219
3901
|
};
|
|
@@ -3222,28 +3904,26 @@ const withUpdateHasuraGraphQL = (MixinBase) => {
|
|
|
3222
3904
|
const withGetHasuraGraphQL = (MixinBase) => {
|
|
3223
3905
|
return class GetHasuraGraphQLMixin extends MixinBase {
|
|
3224
3906
|
constructor(...params) {
|
|
3225
|
-
const options = params
|
|
3907
|
+
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
3226
3908
|
super(...params);
|
|
3227
|
-
this.getGraphQLOperation = options
|
|
3909
|
+
this.getGraphQLOperation = (options === null || options === void 0 ? void 0 : options.getGraphQLOperation) || `${this.tableName}_by_pk`;
|
|
3228
3910
|
}
|
|
3229
3911
|
async get(identifiers) {
|
|
3230
3912
|
this.logger = DebugHelper.from(this, 'get');
|
|
3231
3913
|
const instance = this.model.toInstance(identifiers);
|
|
3232
3914
|
const result = await this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce((ids, identifier) => {
|
|
3915
|
+
var _a;
|
|
3233
3916
|
const identifierBinded = identifier;
|
|
3234
3917
|
if (isNil(instance[identifierBinded]))
|
|
3235
3918
|
return ids;
|
|
3236
3919
|
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
3237
|
-
const value = columnOption
|
|
3920
|
+
const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, identifiers[identifier], instance)) ||
|
|
3238
3921
|
identifiers[identifier];
|
|
3239
|
-
return {
|
|
3240
|
-
...ids,
|
|
3241
|
-
[columnOption.columnName]: {
|
|
3922
|
+
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: {
|
|
3242
3923
|
type: this.getAttributeGraphQLTypeOf(columnOption.type || value),
|
|
3243
3924
|
value,
|
|
3244
3925
|
required: true,
|
|
3245
|
-
}
|
|
3246
|
-
};
|
|
3926
|
+
} });
|
|
3247
3927
|
}, {}));
|
|
3248
3928
|
const data = result[this.getGraphQLOperation];
|
|
3249
3929
|
if (isNil(data))
|
|
@@ -3266,29 +3946,36 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
3266
3946
|
: 'desc_nulls_last',
|
|
3267
3947
|
},
|
|
3268
3948
|
], []);
|
|
3269
|
-
this.bindAggretageAttributes = (aggregates, fields) =>
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3949
|
+
this.bindAggretageAttributes = (aggregates, fields) => {
|
|
3950
|
+
var _a, _b;
|
|
3951
|
+
return [
|
|
3952
|
+
...(((_a = aggregates === null || aggregates === void 0 ? void 0 : aggregates.minimal) === null || _a === void 0 ? void 0 : _a.length)
|
|
3953
|
+
? [
|
|
3954
|
+
{
|
|
3955
|
+
min: this.bindAttributesToColumns(aggregates === null || aggregates === void 0 ? void 0 : aggregates.minimal, fields),
|
|
3956
|
+
},
|
|
3957
|
+
]
|
|
3958
|
+
: []),
|
|
3959
|
+
...(((_b = aggregates === null || aggregates === void 0 ? void 0 : aggregates.maximum) === null || _b === void 0 ? void 0 : _b.length)
|
|
3960
|
+
? [
|
|
3961
|
+
{
|
|
3962
|
+
max: this.bindAttributesToColumns(aggregates === null || aggregates === void 0 ? void 0 : aggregates.maximum, fields),
|
|
3963
|
+
},
|
|
3964
|
+
]
|
|
3965
|
+
: []),
|
|
3966
|
+
];
|
|
3967
|
+
};
|
|
3285
3968
|
this.bindDistinctAttributes = (distinct, fields) => this.bindAttributesToColumns(distinct, fields);
|
|
3286
|
-
this.bindAttributesToColumns = (attributes, fields) => attributes.map((attr) =>
|
|
3969
|
+
this.bindAttributesToColumns = (attributes, fields) => attributes.map((attr) => {
|
|
3970
|
+
var _a;
|
|
3971
|
+
return ((_a = AttributeOptionHelper.FindByAttribute(attr.toString().split('.').pop(), fields)) === null || _a === void 0 ? void 0 : _a.columnName) || attr;
|
|
3972
|
+
});
|
|
3287
3973
|
}
|
|
3288
3974
|
async find(params) {
|
|
3975
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3289
3976
|
this.logger = DebugHelper.from(this, 'find');
|
|
3290
3977
|
const { filters, limits, orderBy, options } = params || {};
|
|
3291
|
-
const enableCount = options
|
|
3978
|
+
const enableCount = (_a = options === null || options === void 0 ? void 0 : options.enableCount) !== null && _a !== void 0 ? _a : true;
|
|
3292
3979
|
const variablesFilters = isNil(filters)
|
|
3293
3980
|
? {}
|
|
3294
3981
|
: {
|
|
@@ -3298,22 +3985,16 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
3298
3985
|
required: true,
|
|
3299
3986
|
},
|
|
3300
3987
|
};
|
|
3301
|
-
const variablesCount = {
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
: {
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
...variablesFilters,
|
|
3312
|
-
};
|
|
3313
|
-
const variables = {
|
|
3314
|
-
...(isNil(limits) ? {} : limits),
|
|
3315
|
-
...variablesCount,
|
|
3316
|
-
};
|
|
3988
|
+
const variablesCount = Object.assign(Object.assign({}, (isNil(orderBy)
|
|
3989
|
+
? {}
|
|
3990
|
+
: {
|
|
3991
|
+
order_by: {
|
|
3992
|
+
type: `${this.tableName}_order_by!`,
|
|
3993
|
+
list: true,
|
|
3994
|
+
value: this.bindOrderByAttributes(orderBy, this.fields),
|
|
3995
|
+
},
|
|
3996
|
+
})), variablesFilters);
|
|
3997
|
+
const variables = Object.assign(Object.assign({}, (isNil(limits) ? {} : limits)), variablesCount);
|
|
3317
3998
|
const aggregateFields = [
|
|
3318
3999
|
...(enableCount ? ['count'] : []),
|
|
3319
4000
|
...this.bindAggretageAttributes(params.options, this.fields),
|
|
@@ -3323,8 +4004,10 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
3323
4004
|
operation: this.tableName,
|
|
3324
4005
|
fields: params.fields
|
|
3325
4006
|
? params.fields
|
|
3326
|
-
.map((fieldName) =>
|
|
3327
|
-
|
|
4007
|
+
.map((fieldName) => {
|
|
4008
|
+
var _a;
|
|
4009
|
+
return (_a = this.fields.find((fieldOption) => fieldOption === fieldName)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName);
|
|
4010
|
+
})
|
|
3328
4011
|
.filter(Boolean)
|
|
3329
4012
|
: this.fields,
|
|
3330
4013
|
variables,
|
|
@@ -3342,63 +4025,51 @@ const withFindHasuraGraphQL = (MixinBase) => {
|
|
|
3342
4025
|
},
|
|
3343
4026
|
]
|
|
3344
4027
|
: []),
|
|
3345
|
-
...((!params.limits
|
|
3346
|
-
params.options
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
const fieldName = Object.values(distinctOption).shift()
|
|
4028
|
+
...((!((_b = params.limits) === null || _b === void 0 ? void 0 : _b.offset) &&
|
|
4029
|
+
((_d = (_c = params.options) === null || _c === void 0 ? void 0 : _c.distinct) === null || _d === void 0 ? void 0 : _d.map((distinct) => {
|
|
4030
|
+
var _a, _b;
|
|
4031
|
+
const distinctOption = (_a = this.fields.find((fieldOption) => fieldOption === distinct)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === distinct);
|
|
4032
|
+
const fieldName = ((_b = Object.values(distinctOption).shift()) === null || _b === void 0 ? void 0 : _b.columnName) || distinct;
|
|
3350
4033
|
return {
|
|
3351
4034
|
operation: {
|
|
3352
4035
|
name: `${this.tableName}`,
|
|
3353
4036
|
alias: `${this.tableName}_${distinct.toString()}_distinct`,
|
|
3354
4037
|
},
|
|
3355
4038
|
fields: [distinctOption],
|
|
3356
|
-
variables: {
|
|
3357
|
-
...variablesFilters,
|
|
3358
|
-
[`${this.tableName}_${fieldName}_distinct`]: {
|
|
4039
|
+
variables: Object.assign(Object.assign({}, variablesFilters), { [`${this.tableName}_${fieldName}_distinct`]: {
|
|
3359
4040
|
type: `${this.tableName}_select_column!`,
|
|
3360
4041
|
list: true,
|
|
3361
4042
|
value: fieldName,
|
|
3362
4043
|
name: 'distinct_on',
|
|
3363
|
-
},
|
|
3364
|
-
},
|
|
4044
|
+
} }),
|
|
3365
4045
|
};
|
|
3366
|
-
})) ||
|
|
4046
|
+
}))) ||
|
|
3367
4047
|
[]),
|
|
3368
4048
|
]);
|
|
3369
4049
|
const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
|
|
3370
|
-
return {
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
minimal: options.minimal.reduce((minimals, current) => ({
|
|
3376
|
-
...minimals,
|
|
3377
|
-
...set(minimals, current, result[`${this.tableName}_aggregate`].aggregate.min[AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)?.columnName || current]),
|
|
3378
|
-
}), {}),
|
|
3379
|
-
}
|
|
3380
|
-
: {}),
|
|
3381
|
-
...(options?.maximum?.length
|
|
3382
|
-
? {
|
|
3383
|
-
maximum: options.maximum.reduce((maximums, current) => ({
|
|
3384
|
-
...maximums,
|
|
3385
|
-
...set(maximums, current, result[`${this.tableName}_aggregate`].aggregate.max[AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), this.fields)?.columnName || current]),
|
|
3386
|
-
}), {}),
|
|
3387
|
-
}
|
|
3388
|
-
: {}),
|
|
3389
|
-
...(!params.limits?.offset &&
|
|
3390
|
-
options?.distinct?.length && {
|
|
3391
|
-
distinct: options?.distinct.reduce((distinct, current) => {
|
|
3392
|
-
const distinctOption = this.fields.find((fieldOption) => fieldOption === current) ??
|
|
3393
|
-
this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === current);
|
|
3394
|
-
const fieldName = Object.values(distinctOption).shift()?.columnName || current;
|
|
3395
|
-
return {
|
|
3396
|
-
...distinct,
|
|
3397
|
-
[current.toString()]: result[`${this.tableName}_${current.toString()}_distinct`].map((obj) => obj[fieldName]),
|
|
3398
|
-
};
|
|
4050
|
+
return Object.assign(Object.assign(Object.assign({ data, count: enableCount ? result[`${this.tableName}_aggregate`].aggregate.count : Infinity }, (((_e = options === null || options === void 0 ? void 0 : options.minimal) === null || _e === void 0 ? void 0 : _e.length)
|
|
4051
|
+
? {
|
|
4052
|
+
minimal: options.minimal.reduce((minimals, current) => {
|
|
4053
|
+
var _a;
|
|
4054
|
+
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])));
|
|
3399
4055
|
}, {}),
|
|
3400
|
-
}
|
|
3401
|
-
|
|
4056
|
+
}
|
|
4057
|
+
: {})), (((_f = options === null || options === void 0 ? void 0 : options.maximum) === null || _f === void 0 ? void 0 : _f.length)
|
|
4058
|
+
? {
|
|
4059
|
+
maximum: options.maximum.reduce((maximums, current) => {
|
|
4060
|
+
var _a;
|
|
4061
|
+
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])));
|
|
4062
|
+
}, {}),
|
|
4063
|
+
}
|
|
4064
|
+
: {})), (!((_g = params.limits) === null || _g === void 0 ? void 0 : _g.offset) &&
|
|
4065
|
+
((_h = options === null || options === void 0 ? void 0 : options.distinct) === null || _h === void 0 ? void 0 : _h.length) && {
|
|
4066
|
+
distinct: options === null || options === void 0 ? void 0 : options.distinct.reduce((distinct, current) => {
|
|
4067
|
+
var _a, _b;
|
|
4068
|
+
const distinctOption = (_a = this.fields.find((fieldOption) => fieldOption === current)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === current);
|
|
4069
|
+
const fieldName = ((_b = Object.values(distinctOption).shift()) === null || _b === void 0 ? void 0 : _b.columnName) || current;
|
|
4070
|
+
return Object.assign(Object.assign({}, distinct), { [current.toString()]: result[`${this.tableName}_${current.toString()}_distinct`].map((obj) => obj[fieldName]) });
|
|
4071
|
+
}, {}),
|
|
4072
|
+
}));
|
|
3402
4073
|
}
|
|
3403
4074
|
};
|
|
3404
4075
|
};
|
|
@@ -3545,7 +4216,7 @@ class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
|
|
|
3545
4216
|
categories: { data: value.map((category) => ({ category_id: +category })) },
|
|
3546
4217
|
}),
|
|
3547
4218
|
to: (categories) => categories.map((categoryId) => +categoryId),
|
|
3548
|
-
from: (categories) => categories
|
|
4219
|
+
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(); })) || [],
|
|
3549
4220
|
},
|
|
3550
4221
|
},
|
|
3551
4222
|
],
|
|
@@ -3611,14 +4282,11 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3611
4282
|
bindPersistData: (value) => {
|
|
3612
4283
|
return {
|
|
3613
4284
|
brand_condition: value.brand,
|
|
3614
|
-
tag_condition: value
|
|
4285
|
+
tag_condition: (value === null || value === void 0 ? void 0 : value.tags) || [],
|
|
3615
4286
|
};
|
|
3616
4287
|
},
|
|
3617
4288
|
bindFindFilter: (sentence) => {
|
|
3618
|
-
return {
|
|
3619
|
-
...(sentence.brand ? { brand_condition: sentence.brand } : {}),
|
|
3620
|
-
...(sentence.tags ? { tag_condition: sentence.tags } : {}),
|
|
3621
|
-
};
|
|
4289
|
+
return Object.assign(Object.assign({}, (sentence.brand ? { brand_condition: sentence.brand } : {})), (sentence.tags ? { tag_condition: sentence.tags } : {}));
|
|
3622
4290
|
},
|
|
3623
4291
|
},
|
|
3624
4292
|
},
|
|
@@ -3630,7 +4298,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3630
4298
|
bindPersistData: (value) => ({
|
|
3631
4299
|
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
3632
4300
|
}),
|
|
3633
|
-
from: (filters) => filters
|
|
4301
|
+
from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter)) || [],
|
|
3634
4302
|
},
|
|
3635
4303
|
},
|
|
3636
4304
|
{ createdAt: { columnName: 'created_at' } },
|
|
@@ -3671,19 +4339,20 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3671
4339
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
3672
4340
|
}
|
|
3673
4341
|
async create(params) {
|
|
3674
|
-
const { metadata,
|
|
3675
|
-
return super.create({
|
|
4342
|
+
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
4343
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
|
|
3676
4344
|
}
|
|
3677
4345
|
async get(identifiers) {
|
|
4346
|
+
var _a;
|
|
3678
4347
|
return Number.isNaN(+identifiers.id)
|
|
3679
|
-
? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data
|
|
4348
|
+
? (_a = (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
3680
4349
|
: super.get(identifiers);
|
|
3681
4350
|
}
|
|
3682
4351
|
async update(params) {
|
|
3683
|
-
const { products, id: checkId, metadata, filters,
|
|
4352
|
+
const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
|
|
3684
4353
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
3685
4354
|
const id = await this.getId(plainData.id);
|
|
3686
|
-
const category = await super.update({ id,
|
|
4355
|
+
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: false }));
|
|
3687
4356
|
category.products = products && (await this.updateProducts(+id, { products }));
|
|
3688
4357
|
category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
3689
4358
|
category.filters = filters && (await this.updateFilters(+id, { filters }));
|
|
@@ -3724,7 +4393,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3724
4393
|
return data;
|
|
3725
4394
|
}
|
|
3726
4395
|
async getCategoriesForHome(categoryIds, limit = 4, gender) {
|
|
3727
|
-
if (!categoryIds
|
|
4396
|
+
if (!(categoryIds === null || categoryIds === void 0 ? void 0 : categoryIds.length))
|
|
3728
4397
|
return [];
|
|
3729
4398
|
const categoriesFirestore = categoryIds.filter((categoryId) => Number.isNaN(+categoryId));
|
|
3730
4399
|
const categoriesHasura = categoryIds.filter((categoryId) => +categoryId > 0);
|
|
@@ -3746,17 +4415,11 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3746
4415
|
return homeSections;
|
|
3747
4416
|
}
|
|
3748
4417
|
async mountCategory(category, options) {
|
|
3749
|
-
|
|
4418
|
+
var _a;
|
|
4419
|
+
if (!((_a = category === null || category === void 0 ? void 0 : category.products) === null || _a === void 0 ? void 0 : _a.length))
|
|
3750
4420
|
return [];
|
|
3751
4421
|
const products = [];
|
|
3752
|
-
const { data: productsData } = await this.productRepository.find({
|
|
3753
|
-
filters: {
|
|
3754
|
-
id: { operator: Where.IN, value: category.products },
|
|
3755
|
-
published: true,
|
|
3756
|
-
...(options?.hasStock ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {}),
|
|
3757
|
-
...(options?.gender ? { tags: { operator: Where.IN, value: [options?.gender] } } : {}),
|
|
3758
|
-
},
|
|
3759
|
-
fields: [
|
|
4422
|
+
const { data: productsData } = await this.productRepository.find(Object.assign(Object.assign({ filters: Object.assign(Object.assign({ id: { operator: Where.IN, value: category.products }, published: true }, ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {})), ((options === null || options === void 0 ? void 0 : options.gender) ? { tags: { operator: Where.IN, value: [options === null || options === void 0 ? void 0 : options.gender] } } : {})), fields: [
|
|
3760
4423
|
'id',
|
|
3761
4424
|
'name',
|
|
3762
4425
|
'slug',
|
|
@@ -3782,19 +4445,17 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3782
4445
|
'shoppingCount',
|
|
3783
4446
|
'gender',
|
|
3784
4447
|
'createdAt',
|
|
3785
|
-
],
|
|
3786
|
-
...(options?.limit ? { limits: { limit: options?.limit } } : {}),
|
|
3787
|
-
options: { enableCount: false },
|
|
3788
|
-
});
|
|
4448
|
+
] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})), { options: { enableCount: false } }));
|
|
3789
4449
|
products.push(...productsData);
|
|
3790
4450
|
return products;
|
|
3791
4451
|
}
|
|
3792
4452
|
async getId(id) {
|
|
4453
|
+
var _a, _b;
|
|
3793
4454
|
if (!Number.isNaN(+id))
|
|
3794
4455
|
return id;
|
|
3795
4456
|
const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
|
|
3796
|
-
if (data
|
|
3797
|
-
return data
|
|
4457
|
+
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
4458
|
+
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
3798
4459
|
throw new NotFoundError(`Category with id ${id} not found`);
|
|
3799
4460
|
}
|
|
3800
4461
|
async updateProducts(categoryId, { products }) {
|
|
@@ -3853,7 +4514,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3853
4514
|
return [];
|
|
3854
4515
|
}
|
|
3855
4516
|
if ('action' in filters && filters.action === 'merge' && filters.value.length) {
|
|
3856
|
-
let filtersList = [];
|
|
3857
4517
|
const currentFilters = await this.categoryFilterRepository
|
|
3858
4518
|
.find({
|
|
3859
4519
|
filters: {
|
|
@@ -3873,23 +4533,20 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
3873
4533
|
await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
|
|
3874
4534
|
}
|
|
3875
4535
|
for (const filter of filterToBeInserted) {
|
|
3876
|
-
|
|
4536
|
+
await this.categoryFilterRepository.create({
|
|
3877
4537
|
filterId: filter,
|
|
3878
4538
|
categoryId,
|
|
3879
4539
|
});
|
|
3880
|
-
filtersList.push(filter);
|
|
3881
4540
|
}
|
|
3882
4541
|
return filters.value;
|
|
3883
4542
|
}
|
|
3884
4543
|
if (Array.isArray(filters) && filters.length) {
|
|
3885
4544
|
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
3886
|
-
let filtersList = [];
|
|
3887
4545
|
for (let i = 0; i < filters.length; i++) {
|
|
3888
|
-
|
|
4546
|
+
await this.categoryFilterRepository.create({
|
|
3889
4547
|
filterId: filters[i].id,
|
|
3890
4548
|
categoryId,
|
|
3891
4549
|
});
|
|
3892
|
-
filtersList.push(newCategoryFilter);
|
|
3893
4550
|
}
|
|
3894
4551
|
return filters;
|
|
3895
4552
|
}
|
|
@@ -3944,7 +4601,7 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
3944
4601
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
3945
4602
|
}
|
|
3946
4603
|
async update(params) {
|
|
3947
|
-
const { options,
|
|
4604
|
+
const { options } = params, data = __rest(params, ["options"]);
|
|
3948
4605
|
const filter = await super.update(data);
|
|
3949
4606
|
filter.options = await this.updateOptions(+data.id, { options });
|
|
3950
4607
|
return filter;
|
|
@@ -3967,7 +4624,7 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
3967
4624
|
filterOptions.push(hasFilter);
|
|
3968
4625
|
}
|
|
3969
4626
|
catch (error) {
|
|
3970
|
-
const newOption = await this.filterOptionRepository.create({
|
|
4627
|
+
const newOption = await this.filterOptionRepository.create(Object.assign(Object.assign({}, options.value[i]), { filterId }));
|
|
3971
4628
|
filterOptions.push(newOption);
|
|
3972
4629
|
}
|
|
3973
4630
|
}
|
|
@@ -3982,7 +4639,7 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
3982
4639
|
filterOptions.push(hasFilter);
|
|
3983
4640
|
}
|
|
3984
4641
|
catch (error) {
|
|
3985
|
-
const newOption = await this.filterOptionRepository.create({
|
|
4642
|
+
const newOption = await this.filterOptionRepository.create(Object.assign(Object.assign({}, options[i]), { filterId }));
|
|
3986
4643
|
filterOptions.push(newOption);
|
|
3987
4644
|
}
|
|
3988
4645
|
}
|
|
@@ -4032,6 +4689,24 @@ class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasu
|
|
|
4032
4689
|
}
|
|
4033
4690
|
|
|
4034
4691
|
class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
4692
|
+
get reviewsFields() {
|
|
4693
|
+
return [
|
|
4694
|
+
'id',
|
|
4695
|
+
'shop',
|
|
4696
|
+
'rate',
|
|
4697
|
+
'author',
|
|
4698
|
+
'email',
|
|
4699
|
+
'location',
|
|
4700
|
+
'review',
|
|
4701
|
+
'status',
|
|
4702
|
+
'title',
|
|
4703
|
+
{ personId: { columnName: 'person_id' } },
|
|
4704
|
+
'points',
|
|
4705
|
+
{ orderId: { columnName: 'order_id' } },
|
|
4706
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
4707
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
4708
|
+
];
|
|
4709
|
+
}
|
|
4035
4710
|
constructor({ endpoint, authOptions, interceptors, }) {
|
|
4036
4711
|
super({
|
|
4037
4712
|
tableName: 'product',
|
|
@@ -4041,18 +4716,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4041
4716
|
interceptors,
|
|
4042
4717
|
fields: [],
|
|
4043
4718
|
});
|
|
4044
|
-
this.bindReviewToModel = (plain) => ({
|
|
4045
|
-
|
|
4046
|
-
createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at,
|
|
4047
|
-
updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at,
|
|
4048
|
-
personId: plain.person_id,
|
|
4049
|
-
orderId: plain.order_id,
|
|
4050
|
-
});
|
|
4051
|
-
this.bindReviewToHasura = (review) => ({
|
|
4052
|
-
...is(omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId'])),
|
|
4053
|
-
person_id: review.personId,
|
|
4054
|
-
order_id: review.orderId,
|
|
4055
|
-
});
|
|
4719
|
+
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 }));
|
|
4720
|
+
this.bindReviewToHasura = (review) => (Object.assign(Object.assign({}, is(omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId']))), { person_id: review.personId, order_id: review.orderId }));
|
|
4056
4721
|
const commonFields = [
|
|
4057
4722
|
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
4058
4723
|
{ firestoreId: { columnName: 'firestore_id' } },
|
|
@@ -4074,33 +4739,19 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4074
4739
|
ingredients: data.ingredients,
|
|
4075
4740
|
}),
|
|
4076
4741
|
bindFindFilter: (filters) => {
|
|
4077
|
-
return {
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
...(filters.brand && {
|
|
4087
|
-
brand_description: filters.brand,
|
|
4088
|
-
}),
|
|
4089
|
-
...(filters.ingredients && {
|
|
4090
|
-
ingredients: filters.ingredients,
|
|
4091
|
-
}),
|
|
4092
|
-
};
|
|
4742
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((filters === null || filters === void 0 ? void 0 : filters.description) && { description: filters.description })), (filters.differentials && { differentials: filters.differentials })), (filters.whoMustUse && {
|
|
4743
|
+
who_must_use: filters.whoMustUse,
|
|
4744
|
+
})), (filters.howToUse && {
|
|
4745
|
+
how_to_use: filters.howToUse,
|
|
4746
|
+
})), (filters.brand && {
|
|
4747
|
+
brand_description: filters.brand,
|
|
4748
|
+
})), (filters.ingredients && {
|
|
4749
|
+
ingredients: filters.ingredients,
|
|
4750
|
+
}));
|
|
4093
4751
|
},
|
|
4094
|
-
bindPersistData: (descriptionData) => ({
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
...(descriptionData.whoMustUse && {
|
|
4098
|
-
who_must_use: descriptionData.whoMustUse,
|
|
4099
|
-
}),
|
|
4100
|
-
...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
|
|
4101
|
-
...(descriptionData.brand && { brand_description: descriptionData.brand }),
|
|
4102
|
-
...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
|
|
4103
|
-
}),
|
|
4752
|
+
bindPersistData: (descriptionData) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((descriptionData === null || descriptionData === void 0 ? void 0 : descriptionData.description) && { description: descriptionData.description })), (descriptionData.differentials && { differentials: descriptionData.differentials })), (descriptionData.whoMustUse && {
|
|
4753
|
+
who_must_use: descriptionData.whoMustUse,
|
|
4754
|
+
})), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand })), (descriptionData.ingredients && { ingredients: descriptionData.ingredients }))),
|
|
4104
4755
|
},
|
|
4105
4756
|
},
|
|
4106
4757
|
{ differentials: { columnName: 'differentials' } },
|
|
@@ -4112,13 +4763,13 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4112
4763
|
{
|
|
4113
4764
|
images: {
|
|
4114
4765
|
columnName: 'images',
|
|
4115
|
-
to: (value) => (value
|
|
4766
|
+
to: (value) => { var _a; return ((value === null || value === void 0 ? void 0 : value.length) > 0 ? `{"${((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, `","`)) || ''}"}` : `{}`); },
|
|
4116
4767
|
},
|
|
4117
4768
|
},
|
|
4118
4769
|
{
|
|
4119
4770
|
miniatures: {
|
|
4120
4771
|
columnName: 'miniatures',
|
|
4121
|
-
to: (value) => (value
|
|
4772
|
+
to: (value) => { var _a; return ((value === null || value === void 0 ? void 0 : value.length) > 0 ? `{"${((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, `","`)) || ''}"}` : `{}`); },
|
|
4122
4773
|
},
|
|
4123
4774
|
},
|
|
4124
4775
|
'name',
|
|
@@ -4132,25 +4783,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4132
4783
|
subscriberPrice: data.subscriber_price,
|
|
4133
4784
|
}),
|
|
4134
4785
|
bindFindFilter: (filters) => {
|
|
4135
|
-
return {
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
}),
|
|
4141
|
-
...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
4142
|
-
subscriber_price: filters.subscriberPrice,
|
|
4143
|
-
}),
|
|
4144
|
-
};
|
|
4786
|
+
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) && {
|
|
4787
|
+
subscriber_discount_percentage: filters.subscriberDiscountPercentage,
|
|
4788
|
+
})), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
4789
|
+
subscriber_price: filters.subscriberPrice,
|
|
4790
|
+
}));
|
|
4145
4791
|
},
|
|
4146
|
-
bindPersistData: (priceData) => ({
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
...(priceData.subscriberDiscountPercentage >= 0 && {
|
|
4150
|
-
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
4151
|
-
}),
|
|
4152
|
-
...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
|
|
4153
|
-
}),
|
|
4792
|
+
bindPersistData: (priceData) => (Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) >= 0 && { price: priceData.price })), (priceData.fullPrice >= 0 && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage >= 0 && {
|
|
4793
|
+
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
4794
|
+
})), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }))),
|
|
4154
4795
|
},
|
|
4155
4796
|
},
|
|
4156
4797
|
{ fullPrice: { columnName: 'full_price' } },
|
|
@@ -4162,7 +4803,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4162
4803
|
stock: {
|
|
4163
4804
|
columnName: 'stock',
|
|
4164
4805
|
from: (quantity) => ({ quantity }),
|
|
4165
|
-
to: (value) => (isNil(value
|
|
4806
|
+
to: (value) => (isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity),
|
|
4166
4807
|
},
|
|
4167
4808
|
},
|
|
4168
4809
|
{ hasStock: { columnName: 'has_stock' } },
|
|
@@ -4199,7 +4840,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4199
4840
|
categories: { data: value.map((category) => ({ category_id: +category })) },
|
|
4200
4841
|
}),
|
|
4201
4842
|
to: (categories) => categories.map((categoryId) => +categoryId),
|
|
4202
|
-
from: (categories) => categories
|
|
4843
|
+
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(); })) || [],
|
|
4203
4844
|
},
|
|
4204
4845
|
},
|
|
4205
4846
|
{
|
|
@@ -4232,27 +4873,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4232
4873
|
},
|
|
4233
4874
|
];
|
|
4234
4875
|
}
|
|
4235
|
-
get reviewsFields() {
|
|
4236
|
-
return [
|
|
4237
|
-
'id',
|
|
4238
|
-
'shop',
|
|
4239
|
-
'rate',
|
|
4240
|
-
'author',
|
|
4241
|
-
'email',
|
|
4242
|
-
'location',
|
|
4243
|
-
'review',
|
|
4244
|
-
'status',
|
|
4245
|
-
'title',
|
|
4246
|
-
{ personId: { columnName: 'person_id' } },
|
|
4247
|
-
'points',
|
|
4248
|
-
{ orderId: { columnName: 'order_id' } },
|
|
4249
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
4250
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
4251
|
-
];
|
|
4252
|
-
}
|
|
4253
4876
|
async create(params) {
|
|
4254
|
-
const { metadata,
|
|
4255
|
-
const product = await super.create(omit({
|
|
4877
|
+
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
4878
|
+
const product = await super.create(omit(Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }), ['reviews']));
|
|
4256
4879
|
try {
|
|
4257
4880
|
product.reviews = data.reviews && (await this.updateReviews(+product.id, data));
|
|
4258
4881
|
}
|
|
@@ -4263,8 +4886,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4263
4886
|
return product;
|
|
4264
4887
|
}
|
|
4265
4888
|
async get(identifiers) {
|
|
4889
|
+
var _a;
|
|
4266
4890
|
const product = Number.isNaN(+identifiers.id)
|
|
4267
|
-
? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data
|
|
4891
|
+
? (_a = (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
4268
4892
|
: await super.get(identifiers);
|
|
4269
4893
|
if (product.productId)
|
|
4270
4894
|
throw new NotFoundError('Product not found, it is a variant');
|
|
@@ -4272,21 +4896,19 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4272
4896
|
return product;
|
|
4273
4897
|
}
|
|
4274
4898
|
async find(params) {
|
|
4275
|
-
|
|
4899
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
4900
|
+
const _o = params || {}, { filters, fields } = _o, options = __rest(_o, ["filters", "fields"]);
|
|
4276
4901
|
const bindFields = fields ||
|
|
4277
4902
|
this.fields
|
|
4278
4903
|
.map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
|
|
4279
4904
|
.filter((field) => field !== 'reviews');
|
|
4280
|
-
if (options.options
|
|
4281
|
-
options.options
|
|
4282
|
-
if (options.options
|
|
4283
|
-
options.options
|
|
4284
|
-
options.options
|
|
4285
|
-
options.options
|
|
4286
|
-
return super.find({
|
|
4287
|
-
...options,
|
|
4288
|
-
filters: { ...filters, productId: { operator: Where.ISNULL } },
|
|
4289
|
-
fields: [
|
|
4905
|
+
if ((_b = (_a = options.options) === null || _a === void 0 ? void 0 : _a.minimal) === null || _b === void 0 ? void 0 : _b.includes('price'))
|
|
4906
|
+
(_c = options.options) === null || _c === void 0 ? void 0 : _c.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
|
|
4907
|
+
if ((_e = (_d = options.options) === null || _d === void 0 ? void 0 : _d.maximum) === null || _e === void 0 ? void 0 : _e.includes('price'))
|
|
4908
|
+
(_f = options.options) === null || _f === void 0 ? void 0 : _f.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
|
|
4909
|
+
(_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);
|
|
4910
|
+
(_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);
|
|
4911
|
+
return super.find(Object.assign(Object.assign({}, options), { filters: Object.assign(Object.assign({}, filters), { productId: { operator: Where.ISNULL } }), fields: [
|
|
4290
4912
|
...bindFields,
|
|
4291
4913
|
...(bindFields.includes('price')
|
|
4292
4914
|
? [
|
|
@@ -4295,10 +4917,10 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4295
4917
|
'fullPrice',
|
|
4296
4918
|
]
|
|
4297
4919
|
: []),
|
|
4298
|
-
]
|
|
4299
|
-
});
|
|
4920
|
+
] }));
|
|
4300
4921
|
}
|
|
4301
4922
|
async getBySlug(slug) {
|
|
4923
|
+
var _a;
|
|
4302
4924
|
const result = await this.find({
|
|
4303
4925
|
filters: {
|
|
4304
4926
|
slug,
|
|
@@ -4308,15 +4930,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4308
4930
|
enableCount: false,
|
|
4309
4931
|
},
|
|
4310
4932
|
});
|
|
4311
|
-
const product = result
|
|
4933
|
+
const product = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
4312
4934
|
RoundProductPricesHelper.roundProductPrices(product);
|
|
4313
4935
|
return product;
|
|
4314
4936
|
}
|
|
4315
4937
|
async update(params) {
|
|
4316
|
-
const { categories, kitProducts, reviews, id: checkId, rate, metadata,
|
|
4938
|
+
const { categories, kitProducts, reviews, id: checkId, rate, metadata } = params, data = __rest(params, ["categories", "kitProducts", "reviews", "id", "rate", "metadata"]);
|
|
4317
4939
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
4318
4940
|
const id = await this.getId(plainData.id);
|
|
4319
|
-
const product = await super.update({ id,
|
|
4941
|
+
const product = await super.update(Object.assign({ id }, data));
|
|
4320
4942
|
product.categories = categories && (await this.updateCategories(+id, { categories }));
|
|
4321
4943
|
product.kitProducts = kitProducts && (await this.updateKitProducts(+id, { kitProducts }));
|
|
4322
4944
|
product.reviews = reviews && (await this.updateReviews(+id, { reviews }));
|
|
@@ -4338,24 +4960,11 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4338
4960
|
.filter((review) => (status === 'pending' && [undefined, null].includes(review.status)) ||
|
|
4339
4961
|
(status === 'approved' && review.status === true) ||
|
|
4340
4962
|
(status === 'rejected' && review.status === false))
|
|
4341
|
-
.map((review) => ({
|
|
4342
|
-
...this.bindReviewToModel(review),
|
|
4343
|
-
productId: product.id,
|
|
4344
|
-
productName: product.name,
|
|
4345
|
-
productSku: product.sku,
|
|
4346
|
-
})),
|
|
4963
|
+
.map((review) => (Object.assign(Object.assign({}, this.bindReviewToModel(review)), { productId: product.id, productName: product.name, productSku: product.sku }))),
|
|
4347
4964
|
], []);
|
|
4348
4965
|
}
|
|
4349
4966
|
async findCatalog(params, mainGender) {
|
|
4350
|
-
return this.find({
|
|
4351
|
-
...params,
|
|
4352
|
-
filters: { ...params.filters, published: true },
|
|
4353
|
-
orderBy: {
|
|
4354
|
-
hasStock: 'desc',
|
|
4355
|
-
...(!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' }),
|
|
4356
|
-
...omit(params.orderBy, ['hasStock', 'intGender']),
|
|
4357
|
-
},
|
|
4358
|
-
});
|
|
4967
|
+
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'])) }));
|
|
4359
4968
|
}
|
|
4360
4969
|
async updateCategories(productId, { categories }) {
|
|
4361
4970
|
if ('action' in categories && categories.action === 'remove') {
|
|
@@ -4415,7 +5024,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4415
5024
|
if ('action' in reviews && reviews.action === 'remove') {
|
|
4416
5025
|
const reviewIds = await Promise.all(reviews.value.map(async (reviewData) => {
|
|
4417
5026
|
const review = await this.findReview(reviewData, productId);
|
|
4418
|
-
return review
|
|
5027
|
+
return review === null || review === void 0 ? void 0 : review.id;
|
|
4419
5028
|
}));
|
|
4420
5029
|
await this.mutation('delete_product_review', ['affected_rows'], {
|
|
4421
5030
|
where: { value: { id: { _in: reviewIds.filter(Boolean) } }, type: 'product_review_bool_exp', required: true },
|
|
@@ -4442,7 +5051,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4442
5051
|
})).update_product_review_by_pk);
|
|
4443
5052
|
return this.bindReviewToModel((await this.mutation('insert_product_review_one', this.reviewsFields, {
|
|
4444
5053
|
object: {
|
|
4445
|
-
value: omit({
|
|
5054
|
+
value: omit(Object.assign(Object.assign({}, this.bindReviewToHasura(reviewData)), { product_id: productId }), ['id']),
|
|
4446
5055
|
type: 'product_review_insert_input',
|
|
4447
5056
|
required: true,
|
|
4448
5057
|
},
|
|
@@ -4468,11 +5077,12 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4468
5077
|
return plainData.metadata;
|
|
4469
5078
|
}
|
|
4470
5079
|
async getId(id) {
|
|
5080
|
+
var _a, _b;
|
|
4471
5081
|
if (!Number.isNaN(+id))
|
|
4472
5082
|
return id;
|
|
4473
5083
|
const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
|
|
4474
|
-
if (data
|
|
4475
|
-
return data
|
|
5084
|
+
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
5085
|
+
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
4476
5086
|
throw new NotFoundError(`Product with id ${id} not found`);
|
|
4477
5087
|
}
|
|
4478
5088
|
async findReviewsByProduct(productId) {
|
|
@@ -4500,11 +5110,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4500
5110
|
async getReviewByPersonId(personId, productId, orderId) {
|
|
4501
5111
|
const { product_review: data } = await this.query('product_review', this.reviewsFields, {
|
|
4502
5112
|
where: {
|
|
4503
|
-
value: {
|
|
4504
|
-
product_id: { _eq: productId },
|
|
4505
|
-
person_id: { _eq: personId },
|
|
4506
|
-
...(orderId && { order_id: { _eq: orderId } }),
|
|
4507
|
-
},
|
|
5113
|
+
value: Object.assign({ product_id: { _eq: productId }, person_id: { _eq: personId } }, (orderId && { order_id: { _eq: orderId } })),
|
|
4508
5114
|
type: `product_review_bool_exp`,
|
|
4509
5115
|
required: true,
|
|
4510
5116
|
},
|
|
@@ -4514,12 +5120,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4514
5120
|
async getReviewByAuthorAndEmail(author, email, productId, orderId) {
|
|
4515
5121
|
const { product_review: data } = await this.query('product_review', this.reviewsFields, {
|
|
4516
5122
|
where: {
|
|
4517
|
-
value: {
|
|
4518
|
-
product_id: { _eq: productId },
|
|
4519
|
-
author: { _eq: author },
|
|
4520
|
-
email: { _eq: email },
|
|
4521
|
-
...(orderId && { order_id: { _eq: orderId } }),
|
|
4522
|
-
},
|
|
5123
|
+
value: Object.assign({ product_id: { _eq: productId }, author: { _eq: author }, email: { _eq: email } }, (orderId && { order_id: { _eq: orderId } })),
|
|
4523
5124
|
type: `product_review_bool_exp`,
|
|
4524
5125
|
required: true,
|
|
4525
5126
|
},
|
|
@@ -4556,7 +5157,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4556
5157
|
productId: {
|
|
4557
5158
|
columnName: 'main_product_id',
|
|
4558
5159
|
to: (value) => +value,
|
|
4559
|
-
from: (value) => value
|
|
5160
|
+
from: (value) => value === null || value === void 0 ? void 0 : value.toString(),
|
|
4560
5161
|
},
|
|
4561
5162
|
},
|
|
4562
5163
|
{ EAN: { columnName: 'ean' } },
|
|
@@ -4572,25 +5173,15 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4572
5173
|
}),
|
|
4573
5174
|
bindFindFilter: (sentence) => {
|
|
4574
5175
|
const filters = Object.values(sentence).shift();
|
|
4575
|
-
return {
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
}),
|
|
4581
|
-
...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
4582
|
-
subscriber_price: filters.subscriberPrice,
|
|
4583
|
-
}),
|
|
4584
|
-
};
|
|
5176
|
+
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) && {
|
|
5177
|
+
subscriber_discount_percentage: filters.subscriberDiscountPercentage,
|
|
5178
|
+
})), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
5179
|
+
subscriber_price: filters.subscriberPrice,
|
|
5180
|
+
}));
|
|
4585
5181
|
},
|
|
4586
|
-
bindPersistData: (priceData) => ({
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
...((priceData?.subscriberDiscountPercentage || 0) >= 0 && {
|
|
4590
|
-
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
4591
|
-
}),
|
|
4592
|
-
...((priceData?.subscriberPrice || 0) >= 0 && { subscriber_price: priceData.subscriberPrice }),
|
|
4593
|
-
}),
|
|
5182
|
+
bindPersistData: (priceData) => (Object.assign(Object.assign(Object.assign(Object.assign({}, (((priceData === null || priceData === void 0 ? void 0 : priceData.price) || 0) >= 0 && { price: priceData.price })), (((priceData === null || priceData === void 0 ? void 0 : priceData.fullPrice) || 0) >= 0 && { full_price: priceData.fullPrice })), (((priceData === null || priceData === void 0 ? void 0 : priceData.subscriberDiscountPercentage) || 0) >= 0 && {
|
|
5183
|
+
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
5184
|
+
})), (((priceData === null || priceData === void 0 ? void 0 : priceData.subscriberPrice) || 0) >= 0 && { subscriber_price: priceData.subscriberPrice }))),
|
|
4594
5185
|
},
|
|
4595
5186
|
},
|
|
4596
5187
|
{ fullPrice: { columnName: 'full_price' } },
|
|
@@ -4601,7 +5192,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4601
5192
|
stock: {
|
|
4602
5193
|
columnName: 'stock',
|
|
4603
5194
|
from: (quantity) => ({ quantity }),
|
|
4604
|
-
to: (value) => (isNil(value
|
|
5195
|
+
to: (value) => (isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity),
|
|
4605
5196
|
},
|
|
4606
5197
|
},
|
|
4607
5198
|
{ hasStock: { columnName: 'has_stock' } },
|
|
@@ -4620,31 +5211,33 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4620
5211
|
});
|
|
4621
5212
|
}
|
|
4622
5213
|
async get(identifiers) {
|
|
5214
|
+
var _a;
|
|
4623
5215
|
const variant = Number.isNaN(+identifiers.id)
|
|
4624
|
-
? (await this.find({ filters: { firestoreId: identifiers.id } })).data
|
|
5216
|
+
? (_a = (await this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
4625
5217
|
: await super.get(identifiers);
|
|
4626
5218
|
if (!variant.productId)
|
|
4627
5219
|
throw new NotFoundError(`Variant not found, it is a product`);
|
|
4628
5220
|
return variant;
|
|
4629
5221
|
}
|
|
4630
5222
|
async find(params) {
|
|
4631
|
-
const { filters,
|
|
4632
|
-
return super.find({
|
|
5223
|
+
const _a = params || {}, { filters } = _a, options = __rest(_a, ["filters"]);
|
|
5224
|
+
return super.find(Object.assign(Object.assign({}, options), { filters: Object.assign({ productId: { operator: Where.ISNOTNULL } }, filters) }));
|
|
4633
5225
|
}
|
|
4634
5226
|
async update(params) {
|
|
4635
|
-
const { productId, id: checkId,
|
|
5227
|
+
const { productId, id: checkId } = params, data = __rest(params, ["productId", "id"]);
|
|
4636
5228
|
const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
|
|
4637
5229
|
const id = await this.getId(dataWithProductId.id);
|
|
4638
|
-
const product = await super.update({ id,
|
|
5230
|
+
const product = await super.update(Object.assign({ id }, data));
|
|
4639
5231
|
product.productId = dataWithProductId.productId;
|
|
4640
5232
|
return product;
|
|
4641
5233
|
}
|
|
4642
5234
|
async getId(id) {
|
|
5235
|
+
var _a, _b;
|
|
4643
5236
|
if (!Number.isNaN(+id))
|
|
4644
5237
|
return id;
|
|
4645
5238
|
const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
|
|
4646
|
-
if (data
|
|
4647
|
-
return data
|
|
5239
|
+
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
5240
|
+
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
4648
5241
|
throw new NotFoundError(`Product with id ${id} not found`);
|
|
4649
5242
|
}
|
|
4650
5243
|
}
|
|
@@ -4680,14 +5273,11 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4680
5273
|
bindPersistData: (value) => {
|
|
4681
5274
|
return {
|
|
4682
5275
|
brand_condition: value.brand,
|
|
4683
|
-
tag_condition: value
|
|
5276
|
+
tag_condition: (value === null || value === void 0 ? void 0 : value.tags) || [],
|
|
4684
5277
|
};
|
|
4685
5278
|
},
|
|
4686
5279
|
bindFindFilter: (sentence) => {
|
|
4687
|
-
return {
|
|
4688
|
-
...(sentence.brand ? { brand_condition: sentence.brand } : {}),
|
|
4689
|
-
...(sentence.tags ? { tag_condition: sentence.tags } : {}),
|
|
4690
|
-
};
|
|
5280
|
+
return Object.assign(Object.assign({}, (sentence.brand ? { brand_condition: sentence.brand } : {})), (sentence.tags ? { tag_condition: sentence.tags } : {}));
|
|
4691
5281
|
},
|
|
4692
5282
|
},
|
|
4693
5283
|
},
|
|
@@ -4699,7 +5289,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4699
5289
|
bindPersistData: (value) => ({
|
|
4700
5290
|
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
4701
5291
|
}),
|
|
4702
|
-
from: (filters) => filters
|
|
5292
|
+
from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter)) || [],
|
|
4703
5293
|
},
|
|
4704
5294
|
},
|
|
4705
5295
|
{ createdAt: { columnName: 'created_at' } },
|
|
@@ -4742,14 +5332,8 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4742
5332
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
4743
5333
|
}
|
|
4744
5334
|
async create(params) {
|
|
4745
|
-
const { metadata,
|
|
4746
|
-
return super.create({
|
|
4747
|
-
...data,
|
|
4748
|
-
isWishlist: true,
|
|
4749
|
-
isCollection: true,
|
|
4750
|
-
brandCategory: false,
|
|
4751
|
-
metadata: metadata || { description: data.description, title: data.name },
|
|
4752
|
-
});
|
|
5335
|
+
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
5336
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
|
|
4753
5337
|
}
|
|
4754
5338
|
async get(identifiers) {
|
|
4755
5339
|
const data = await super.get(identifiers);
|
|
@@ -4758,10 +5342,10 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4758
5342
|
return data;
|
|
4759
5343
|
}
|
|
4760
5344
|
async update(params) {
|
|
4761
|
-
const { products, id: checkId, metadata, filters,
|
|
5345
|
+
const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
|
|
4762
5346
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
4763
5347
|
const id = plainData.id;
|
|
4764
|
-
const category = await super.update({ id,
|
|
5348
|
+
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
4765
5349
|
category.products = products && (await this.updateProducts(+id, { products }));
|
|
4766
5350
|
category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
4767
5351
|
return category;
|
|
@@ -4882,9 +5466,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4882
5466
|
}
|
|
4883
5467
|
}
|
|
4884
5468
|
|
|
4885
|
-
|
|
4886
|
-
* Generated bundle index. Do not edit.
|
|
4887
|
-
*/
|
|
4888
|
-
|
|
4889
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
4890
|
-
//# sourceMappingURL=infrab4a-connect.mjs.map
|
|
5469
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|