@infrab4a/connect 1.0.0-beta.4 → 1.0.0-beta.41
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/bundles/infrab4a-connect.umd.js +2168 -267
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/category.d.ts +5 -4
- package/domain/catalog/models/index.d.ts +3 -2
- package/domain/catalog/models/kit-product.d.ts +12 -0
- package/domain/catalog/models/product.d.ts +9 -4
- package/domain/catalog/models/types/product-review.type.d.ts +10 -8
- package/domain/catalog/models/variant.d.ts +7 -3
- package/domain/catalog/repositories/category.repository.d.ts +1 -1
- package/domain/catalog/repositories/product.repository.d.ts +10 -3
- package/domain/catalog/repositories/subscription-product.repository.d.ts +1 -1
- package/domain/catalog/repositories/variant.repository.d.ts +1 -1
- package/domain/generic/model/base.model.d.ts +10 -0
- package/domain/{general → generic}/model/index.d.ts +0 -1
- package/domain/generic/model/types/base-model-builder.type.d.ts +15 -0
- package/domain/generic/model/types/identifier-model.type.d.ts +7 -0
- package/domain/{general → generic}/model/types/index.d.ts +2 -0
- package/domain/generic/model/types/model-base-structure.type.d.ts +6 -0
- package/domain/generic/model/types/non-function-properties.type.d.ts +12 -0
- package/domain/generic/model/types/non-function-property-name.type.d.ts +4 -0
- package/domain/generic/repository/create.repository.d.ts +8 -0
- package/domain/generic/repository/crud.repository.d.ts +19 -0
- package/domain/generic/repository/delete.repository.d.ts +7 -0
- package/domain/{general → generic}/repository/enums/where.enum.d.ts +5 -2
- package/domain/generic/repository/find.repository.d.ts +11 -0
- package/domain/generic/repository/get.repository.d.ts +5 -0
- package/domain/generic/repository/read.repository.d.ts +14 -0
- package/domain/{general → generic}/repository/types/index.d.ts +1 -0
- package/domain/generic/repository/types/repository-find-filters.type.d.ts +13 -0
- package/domain/{general → generic}/repository/types/repository-update-params.type.d.ts +4 -4
- package/domain/generic/repository/types/where-options.type.d.ts +2 -0
- package/domain/generic/repository/update.repository.d.ts +6 -0
- package/domain/index.d.ts +1 -1
- package/domain/location/models/address.d.ts +3 -2
- package/domain/shop-settings/models/home.d.ts +3 -3
- package/domain/shop-settings/models/shop-menu.d.ts +3 -3
- package/domain/shop-settings/repositories/home.repository.d.ts +1 -1
- package/domain/shop-settings/repositories/shop-menu.repository.d.ts +1 -1
- package/domain/shopping/models/buy-2-win.d.ts +3 -5
- package/domain/shopping/models/checkout.d.ts +7 -9
- package/domain/shopping/models/coupons/coupon.d.ts +13 -15
- package/domain/shopping/models/coupons/enums/coupon-subtypes.enum.d.ts +4 -0
- package/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +6 -0
- package/domain/shopping/models/coupons/enums/index.d.ts +2 -1
- package/domain/shopping/models/coupons/financial-coupon.d.ts +9 -0
- package/domain/shopping/models/coupons/index.d.ts +1 -2
- package/domain/shopping/models/payment.d.ts +3 -5
- package/domain/shopping/models/shipping-method.d.ts +3 -5
- package/domain/shopping/models/subscription/checkout.d.ts +3 -5
- package/domain/shopping/models/subscription/plan.d.ts +3 -5
- package/domain/shopping/repositories/buy-2-win.repository.d.ts +1 -1
- package/domain/shopping/repositories/checkout.repository.d.ts +1 -1
- package/domain/shopping/repositories/coupon.repository.d.ts +1 -1
- package/domain/shopping/repositories/order.repository.d.ts +1 -1
- package/domain/shopping/repositories/payment.repository.d.ts +1 -1
- package/domain/shopping/repositories/subscription/checkout.repository.d.ts +1 -1
- package/domain/shopping/repositories/subscription/plan.repository.d.ts +1 -1
- package/domain/users/errors/unauthorized.error.d.ts +2 -1
- package/domain/users/errors/user-already-registered.error.d.ts +2 -1
- package/domain/users/errors/weak-password.error.d.ts +2 -1
- package/domain/users/models/beauty-profile.d.ts +4 -5
- package/domain/users/models/lead.d.ts +3 -5
- package/domain/users/models/subscription/edition.d.ts +4 -5
- package/domain/users/models/subscription/payment.d.ts +4 -5
- package/domain/users/models/subscription/subscription.d.ts +3 -5
- package/domain/users/models/user-address.d.ts +3 -3
- package/domain/users/models/user-payment-method.d.ts +4 -4
- package/domain/users/models/user.d.ts +11 -10
- package/domain/users/repositories/beauty-profile.repository.d.ts +1 -1
- package/domain/users/repositories/edition.repository.d.ts +1 -1
- package/domain/users/repositories/lead.repository.d.ts +1 -1
- package/domain/users/repositories/subscription-payment.repository.d.ts +1 -1
- package/domain/users/repositories/subscription.repository.d.ts +1 -1
- package/domain/users/repositories/user-address.repository.d.ts +1 -1
- package/domain/users/repositories/user-payment-method.repository.d.ts +1 -1
- package/domain/users/repositories/user.repository.d.ts +2 -2
- package/errors/duplicated-results.error.d.ts +2 -1
- package/errors/invalid-argument.error.d.ts +2 -1
- package/errors/not-found.error.d.ts +2 -1
- package/errors/required-argument.error.d.ts +2 -1
- package/esm2015/domain/catalog/models/category.js +5 -2
- package/esm2015/domain/catalog/models/index.js +4 -3
- package/esm2015/domain/catalog/models/kit-product.js +18 -0
- package/esm2015/domain/catalog/models/product.js +12 -2
- package/esm2015/domain/catalog/models/types/product-review.type.js +1 -1
- package/esm2015/domain/catalog/models/variant.js +5 -2
- package/esm2015/domain/catalog/repositories/category.repository.js +1 -1
- package/esm2015/domain/catalog/repositories/product.repository.js +1 -1
- package/esm2015/domain/catalog/repositories/subscription-product.repository.js +1 -1
- package/esm2015/domain/catalog/repositories/variant.repository.js +1 -1
- package/esm2015/domain/{general → generic}/index.js +1 -1
- package/esm2015/domain/generic/model/base.model.js +23 -0
- package/esm2015/domain/{general → generic}/model/identifier-fields.js +1 -1
- package/esm2015/domain/generic/model/index.js +4 -0
- package/esm2015/domain/generic/model/types/base-model-builder.type.js +2 -0
- package/esm2015/domain/generic/model/types/identifier-model.type.js +2 -0
- package/esm2015/domain/generic/model/types/index.js +6 -0
- package/esm2015/domain/generic/model/types/model-base-structure.type.js +2 -0
- package/esm2015/domain/generic/model/types/non-function-properties.type.js +2 -0
- package/esm2015/domain/generic/model/types/non-function-property-name.type.js +2 -0
- package/esm2015/domain/generic/repository/create.repository.js +2 -0
- package/esm2015/domain/generic/repository/crud.repository.js +2 -0
- package/esm2015/domain/generic/repository/delete.repository.js +2 -0
- package/esm2015/domain/{general → generic}/repository/enums/index.js +1 -1
- package/esm2015/domain/{general → generic}/repository/enums/update-option-actions.enum.js +1 -1
- package/esm2015/domain/generic/repository/enums/where.enum.js +15 -0
- package/esm2015/domain/generic/repository/find.repository.js +2 -0
- package/esm2015/domain/generic/repository/get.repository.js +2 -0
- package/esm2015/domain/{general → generic}/repository/index.js +1 -1
- package/esm2015/domain/generic/repository/read.repository.js +2 -0
- package/esm2015/domain/generic/repository/types/index.js +7 -0
- package/esm2015/domain/generic/repository/types/repository-find-filters.type.js +2 -0
- package/esm2015/domain/{general → generic}/repository/types/repository-find-result.type.js +1 -1
- package/esm2015/domain/{general → generic}/repository/types/repository-limit-options.type.js +1 -1
- package/esm2015/domain/{general → generic}/repository/types/repository-order-by-list.type.js +1 -1
- package/esm2015/domain/generic/repository/types/repository-update-params.type.js +2 -0
- package/esm2015/domain/generic/repository/types/where-options.type.js +2 -0
- package/esm2015/domain/generic/repository/update.repository.js +2 -0
- package/esm2015/domain/index.js +2 -2
- package/esm2015/domain/location/models/address.js +5 -2
- package/esm2015/domain/shop-settings/models/home.js +3 -3
- package/esm2015/domain/shop-settings/models/shop-menu.js +3 -3
- package/esm2015/domain/shop-settings/repositories/home.repository.js +1 -1
- package/esm2015/domain/shop-settings/repositories/shop-menu.repository.js +1 -1
- package/esm2015/domain/shopping/models/buy-2-win.js +3 -3
- package/esm2015/domain/shopping/models/checkout.js +6 -14
- package/esm2015/domain/shopping/models/coupons/coupon.js +4 -12
- package/esm2015/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +6 -0
- package/esm2015/domain/shopping/models/coupons/enums/coupon-types.enum.js +8 -0
- package/esm2015/domain/shopping/models/coupons/enums/index.js +3 -2
- package/esm2015/domain/shopping/models/coupons/financial-coupon.js +28 -0
- package/esm2015/domain/shopping/models/coupons/index.js +2 -3
- package/esm2015/domain/shopping/models/payment.js +3 -3
- package/esm2015/domain/shopping/models/shipping-method.js +3 -3
- package/esm2015/domain/shopping/models/subscription/checkout.js +3 -3
- package/esm2015/domain/shopping/models/subscription/plan.js +3 -3
- package/esm2015/domain/shopping/repositories/buy-2-win.repository.js +1 -1
- package/esm2015/domain/shopping/repositories/checkout.repository.js +1 -1
- package/esm2015/domain/shopping/repositories/coupon.repository.js +1 -1
- package/esm2015/domain/shopping/repositories/order.repository.js +1 -1
- package/esm2015/domain/shopping/repositories/payment.repository.js +1 -1
- package/esm2015/domain/shopping/repositories/subscription/checkout.repository.js +1 -1
- package/esm2015/domain/shopping/repositories/subscription/plan.repository.js +1 -1
- package/esm2015/domain/users/errors/unauthorized.error.js +3 -2
- package/esm2015/domain/users/errors/user-already-registered.error.js +3 -2
- package/esm2015/domain/users/errors/weak-password.error.js +3 -2
- package/esm2015/domain/users/models/beauty-profile.js +4 -4
- package/esm2015/domain/users/models/lead.js +3 -3
- package/esm2015/domain/users/models/subscription/edition.js +4 -4
- package/esm2015/domain/users/models/subscription/payment.js +4 -4
- package/esm2015/domain/users/models/subscription/subscription.js +3 -3
- package/esm2015/domain/users/models/user-address.js +3 -3
- package/esm2015/domain/users/models/user-payment-method.js +4 -4
- package/esm2015/domain/users/models/user.js +5 -5
- package/esm2015/domain/users/repositories/beauty-profile.repository.js +1 -1
- package/esm2015/domain/users/repositories/edition.repository.js +1 -1
- package/esm2015/domain/users/repositories/lead.repository.js +1 -1
- package/esm2015/domain/users/repositories/subscription-payment.repository.js +1 -1
- package/esm2015/domain/users/repositories/subscription.repository.js +1 -1
- package/esm2015/domain/users/repositories/user-address.repository.js +1 -1
- package/esm2015/domain/users/repositories/user-payment-method.repository.js +1 -1
- package/esm2015/domain/users/repositories/user.repository.js +1 -1
- package/esm2015/errors/duplicated-results.error.js +3 -2
- package/esm2015/errors/invalid-argument.error.js +3 -2
- package/esm2015/errors/not-found.error.js +3 -2
- package/esm2015/errors/required-argument.error.js +3 -2
- package/esm2015/infra/elasticsearch/adapters/axios.adapter.js +36 -1
- package/esm2015/infra/elasticsearch/adapters/elastic-search.adapter.js +1 -1
- package/esm2015/infra/elasticsearch/indexes/products-index.js +35 -1
- package/esm2015/infra/firebase/auth/authentication-firebase-auth.service.js +2 -2
- package/esm2015/infra/firebase/auth/register-firebase-auth.service.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +2 -2
- package/esm2015/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +9 -10
- package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +2 -6
- package/esm2015/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-helpers.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +4 -4
- package/esm2015/infra/firebase/firestore/models/user-search.js +3 -3
- package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +4 -2
- package/esm2015/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +37 -8
- package/esm2015/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js +11 -21
- package/esm2015/infra/firebase/firestore/repositories/users/user-firestore.repository.js +2 -2
- package/esm2015/infra/firebase/firestore/types/firestore-sub.repository.type.js +1 -1
- package/esm2015/infra/firebase/firestore/types/firestore.helpers.type.js +1 -1
- package/esm2015/infra/firebase/firestore/types/firestore.repository.type.js +1 -1
- package/esm2015/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.js +13 -0
- package/esm2015/infra/hasura-graphql/enums/hasura-graphql-where.enum.js +15 -0
- package/esm2015/infra/hasura-graphql/enums/index.js +3 -0
- package/esm2015/infra/hasura-graphql/index.js +5 -0
- package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +31 -0
- package/esm2015/infra/hasura-graphql/mixins/helpers/filter-option.helper.js +18 -0
- package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +72 -0
- package/esm2015/infra/hasura-graphql/mixins/helpers/index.js +4 -0
- package/esm2015/infra/hasura-graphql/mixins/index.js +8 -0
- package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +45 -0
- package/esm2015/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.js +10 -0
- package/esm2015/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.js +29 -0
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +93 -0
- package/esm2015/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.js +35 -0
- package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +94 -0
- package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +56 -0
- package/esm2015/infra/hasura-graphql/models/category-hasura-graphql.js +4 -0
- package/esm2015/infra/hasura-graphql/models/index.js +5 -0
- package/esm2015/infra/hasura-graphql/models/kit-product-hasura-graphql.js +15 -0
- package/esm2015/infra/hasura-graphql/models/product-hasura-graphql.js +11 -0
- package/esm2015/infra/hasura-graphql/models/variant-hasura-graphql.js +9 -0
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +136 -0
- package/esm2015/infra/hasura-graphql/repositories/catalog/index.js +4 -0
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +375 -0
- package/esm2015/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.js +100 -0
- package/esm2015/infra/hasura-graphql/repositories/index.js +2 -0
- package/esm2015/infra/hasura-graphql/types/fields.type.js +2 -0
- package/esm2015/infra/hasura-graphql/types/graphql.repository.type.js +2 -0
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-auth-options.type.js +2 -0
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +2 -0
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-headers.type.js +2 -0
- package/esm2015/infra/hasura-graphql/types/index.js +9 -0
- package/esm2015/infra/hasura-graphql/types/nested-field.type.js +2 -0
- package/esm2015/infra/hasura-graphql/types/query-builder-options.type.js +2 -0
- package/esm2015/infra/hasura-graphql/types/variable-options.type.js +2 -0
- package/esm2015/infra/index.js +2 -1
- package/esm2015/utils/index.js +6 -4
- package/esm2015/utils/is-uuid.js +3 -0
- package/esm2015/utils/mixins/index.js +2 -1
- package/esm2015/utils/mixins/merge-constructor-params.type.js +2 -0
- package/esm2015/utils/mixins/mixin-ctor.type.js +1 -1
- package/esm2015/utils/parse-datetime.js +14 -0
- package/esm2015/utils/types/array-element.type.js +2 -0
- package/esm2015/utils/types/index.js +2 -1
- package/fesm2015/infrab4a-connect.js +1369 -141
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/elasticsearch/adapters/axios.adapter.d.ts +3 -0
- package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +3 -0
- package/infra/elasticsearch/indexes/products-index.d.ts +5 -1
- package/infra/firebase/auth/authentication-firebase-auth.service.d.ts +1 -1
- package/infra/firebase/auth/register-firebase-auth.service.d.ts +1 -1
- package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +3 -16
- package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +3 -28
- package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +3 -14
- package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +3 -19
- package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +3 -14
- package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +3 -14
- package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +5 -4
- package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +7 -14
- package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +6 -15
- package/infra/firebase/firestore/models/user-search.d.ts +3 -3
- package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +5 -44
- package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +4 -51
- package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +4 -51
- package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +4 -51
- package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +4 -51
- package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +4 -51
- package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +4 -51
- package/infra/firebase/firestore/repositories/users/user-search-firestore.repository.d.ts +1 -42
- package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +3 -3
- package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +3 -3
- package/infra/firebase/firestore/types/firestore.repository.type.d.ts +7 -3
- package/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.d.ts +11 -0
- package/infra/hasura-graphql/enums/hasura-graphql-where.enum.d.ts +13 -0
- package/infra/hasura-graphql/enums/index.d.ts +2 -0
- package/infra/hasura-graphql/index.d.ts +4 -0
- package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +13 -0
- package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +6 -0
- package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +8 -0
- package/infra/hasura-graphql/mixins/helpers/index.d.ts +3 -0
- package/infra/hasura-graphql/mixins/index.d.ts +7 -0
- package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +8 -0
- package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +11 -0
- package/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +7 -0
- package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +31 -0
- package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +24 -0
- package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +11 -0
- package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +14 -0
- package/infra/hasura-graphql/models/category-hasura-graphql.d.ts +6 -0
- package/infra/hasura-graphql/models/index.d.ts +4 -0
- package/infra/hasura-graphql/models/kit-product-hasura-graphql.d.ts +6 -0
- package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +9 -0
- package/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +9 -0
- package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +22 -0
- package/infra/hasura-graphql/repositories/catalog/index.d.ts +3 -0
- package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +26 -0
- package/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +13 -0
- package/infra/hasura-graphql/repositories/index.d.ts +1 -0
- package/infra/hasura-graphql/types/fields.type.d.ts +2 -0
- package/infra/hasura-graphql/types/graphql.repository.type.d.ts +21 -0
- package/infra/hasura-graphql/types/hasura-graphql-auth-options.type.d.ts +8 -0
- package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +36 -0
- package/infra/hasura-graphql/types/hasura-graphql-headers.type.d.ts +7 -0
- package/infra/hasura-graphql/types/index.d.ts +8 -0
- package/infra/hasura-graphql/types/nested-field.type.d.ts +7 -0
- package/infra/hasura-graphql/types/query-builder-options.type.d.ts +7 -0
- package/infra/hasura-graphql/types/variable-options.type.d.ts +9 -0
- package/infra/index.d.ts +1 -0
- package/package.json +5 -3
- package/utils/index.d.ts +5 -4
- package/utils/is-uuid.d.ts +1 -0
- package/utils/mixins/index.d.ts +1 -0
- package/utils/mixins/merge-constructor-params.type.d.ts +3 -0
- package/utils/mixins/mixin-ctor.type.d.ts +1 -1
- package/utils/parse-datetime.d.ts +1 -0
- package/utils/types/array-element.type.d.ts +1 -0
- package/utils/types/index.d.ts +1 -0
- package/domain/general/model/base-model-with-identifier-fields.d.ts +0 -3
- package/domain/general/model/base.model.d.ts +0 -6
- package/domain/general/model/types/base-model-builder.type.d.ts +0 -5
- package/domain/general/model/types/non-function-properties.type.d.ts +0 -2
- package/domain/general/model/types/non-function-property-name.type.d.ts +0 -3
- package/domain/general/repository/create.repository.d.ts +0 -5
- package/domain/general/repository/crud.repository.d.ts +0 -7
- package/domain/general/repository/delete.repository.d.ts +0 -5
- package/domain/general/repository/find.repository.d.ts +0 -5
- package/domain/general/repository/get.repository.d.ts +0 -5
- package/domain/general/repository/read.repository.d.ts +0 -5
- package/domain/general/repository/types/repository-find-filters.type.d.ts +0 -14
- package/domain/general/repository/update.repository.d.ts +0 -5
- package/domain/shopping/models/coupons/club-coupon.d.ts +0 -7
- package/domain/shopping/models/coupons/enums/discount-type.enum.d.ts +0 -5
- package/domain/shopping/models/coupons/store-coupon.d.ts +0 -8
- package/esm2015/domain/general/model/base-model-with-identifier-fields.js +0 -2
- package/esm2015/domain/general/model/base.model.js +0 -13
- package/esm2015/domain/general/model/index.js +0 -5
- package/esm2015/domain/general/model/types/base-model-builder.type.js +0 -2
- package/esm2015/domain/general/model/types/index.js +0 -4
- package/esm2015/domain/general/model/types/non-function-properties.type.js +0 -2
- package/esm2015/domain/general/model/types/non-function-property-name.type.js +0 -2
- package/esm2015/domain/general/repository/create.repository.js +0 -2
- package/esm2015/domain/general/repository/crud.repository.js +0 -2
- package/esm2015/domain/general/repository/delete.repository.js +0 -2
- package/esm2015/domain/general/repository/enums/where.enum.js +0 -12
- package/esm2015/domain/general/repository/find.repository.js +0 -2
- package/esm2015/domain/general/repository/get.repository.js +0 -2
- package/esm2015/domain/general/repository/read.repository.js +0 -2
- package/esm2015/domain/general/repository/types/index.js +0 -6
- package/esm2015/domain/general/repository/types/repository-find-filters.type.js +0 -2
- package/esm2015/domain/general/repository/types/repository-update-params.type.js +0 -2
- package/esm2015/domain/general/repository/update.repository.js +0 -2
- package/esm2015/domain/shopping/models/coupons/club-coupon.js +0 -18
- package/esm2015/domain/shopping/models/coupons/enums/discount-type.enum.js +0 -7
- package/esm2015/domain/shopping/models/coupons/store-coupon.js +0 -23
- /package/domain/{general → generic}/index.d.ts +0 -0
- /package/domain/{general → generic}/model/identifier-fields.d.ts +0 -0
- /package/domain/{general → generic}/repository/enums/index.d.ts +0 -0
- /package/domain/{general → generic}/repository/enums/update-option-actions.enum.d.ts +0 -0
- /package/domain/{general → generic}/repository/index.d.ts +0 -0
- /package/domain/{general → generic}/repository/types/repository-find-result.type.d.ts +0 -0
- /package/domain/{general → generic}/repository/types/repository-limit-options.type.d.ts +0 -0
- /package/domain/{general → generic}/repository/types/repository-order-by-list.type.d.ts +0 -0
|
@@ -1,35 +1,52 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import {
|
|
3
|
-
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transformer';
|
|
3
|
+
import { __decorate, __metadata, __awaiter, __rest } from 'tslib';
|
|
4
|
+
import { parseISO } from 'date-fns';
|
|
5
|
+
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
6
|
+
import { isString, isNil, isNumber, isDate, set, isObject, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
|
|
7
|
+
export { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set } from 'lodash';
|
|
8
|
+
import { CustomError } from 'ts-custom-error';
|
|
9
|
+
import { Md5 } from 'ts-md5';
|
|
7
10
|
import axios from 'axios';
|
|
8
11
|
import firebase from 'firebase';
|
|
9
|
-
import
|
|
12
|
+
import { mutation, query } from 'gql-query-builder';
|
|
13
|
+
import fetch from 'node-fetch';
|
|
10
14
|
|
|
11
15
|
class BaseModel {
|
|
16
|
+
get identifier() {
|
|
17
|
+
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
18
|
+
return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: this[field] })), {});
|
|
19
|
+
}
|
|
20
|
+
get identifiersFields() {
|
|
21
|
+
return this.constructor.identifiersFields;
|
|
22
|
+
}
|
|
12
23
|
constructor(args) {
|
|
13
24
|
Object.assign(this, args);
|
|
14
25
|
}
|
|
15
26
|
static toInstance(data) {
|
|
16
|
-
return
|
|
27
|
+
return plainToInstance(this, data || {});
|
|
28
|
+
}
|
|
29
|
+
static isModel(value) {
|
|
30
|
+
return value instanceof this;
|
|
17
31
|
}
|
|
18
32
|
toPlain() {
|
|
19
|
-
return
|
|
33
|
+
return instanceToPlain(this);
|
|
20
34
|
}
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
var Where;
|
|
24
38
|
(function (Where) {
|
|
25
39
|
Where["EQUALS"] = "==";
|
|
26
|
-
Where["NOTEQUALS"] = "!=";
|
|
27
40
|
Where["GT"] = ">";
|
|
28
41
|
Where["GTE"] = ">=";
|
|
29
42
|
Where["IN"] = "in";
|
|
43
|
+
Where["NOTIN"] = "not in";
|
|
30
44
|
Where["LT"] = "<";
|
|
31
45
|
Where["LTE"] = "<=";
|
|
32
46
|
Where["LIKE"] = "like";
|
|
47
|
+
Where["NOTLIKE"] = "not like";
|
|
48
|
+
Where["ISNULL"] = "is null";
|
|
49
|
+
Where["ISNOTNULL"] = "is not null";
|
|
33
50
|
})(Where || (Where = {}));
|
|
34
51
|
|
|
35
52
|
var UpdateOptionActions;
|
|
@@ -262,13 +279,13 @@ var Status;
|
|
|
262
279
|
})(Status || (Status = {}));
|
|
263
280
|
|
|
264
281
|
class Edition extends BaseModel {
|
|
265
|
-
|
|
266
|
-
return ['id'];
|
|
282
|
+
static get identifiersFields() {
|
|
283
|
+
return ['id', 'subscriptionId'];
|
|
267
284
|
}
|
|
268
285
|
}
|
|
269
286
|
|
|
270
287
|
class Payment extends BaseModel {
|
|
271
|
-
|
|
288
|
+
static get identifiersFields() {
|
|
272
289
|
return ['id'];
|
|
273
290
|
}
|
|
274
291
|
}
|
|
@@ -434,8 +451,8 @@ __decorate([
|
|
|
434
451
|
], Payment.prototype, "pixExpirationDate", void 0);
|
|
435
452
|
|
|
436
453
|
class SubscriptionPayment extends BaseModel {
|
|
437
|
-
|
|
438
|
-
return ['id'];
|
|
454
|
+
static get identifiersFields() {
|
|
455
|
+
return ['id', 'subscriptionId'];
|
|
439
456
|
}
|
|
440
457
|
}
|
|
441
458
|
__decorate([
|
|
@@ -444,6 +461,9 @@ __decorate([
|
|
|
444
461
|
], SubscriptionPayment.prototype, "payment", void 0);
|
|
445
462
|
|
|
446
463
|
class Address extends BaseModel {
|
|
464
|
+
static get identifiersFields() {
|
|
465
|
+
return ['id'];
|
|
466
|
+
}
|
|
447
467
|
}
|
|
448
468
|
|
|
449
469
|
var CheckoutTypes;
|
|
@@ -458,12 +478,33 @@ class Base {
|
|
|
458
478
|
}
|
|
459
479
|
}
|
|
460
480
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
481
|
+
const isUUID = (value) => isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
|
|
482
|
+
|
|
483
|
+
const parseDateTime = (value) => {
|
|
484
|
+
if (!isString(value))
|
|
485
|
+
return value;
|
|
486
|
+
if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
|
|
487
|
+
!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T\d{2}:\d{2}:\d{2}/.test(value))
|
|
488
|
+
return value;
|
|
489
|
+
const date = parseISO(value);
|
|
490
|
+
if (isNaN(date.getTime()))
|
|
491
|
+
return value;
|
|
492
|
+
return date;
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
var CouponTypes;
|
|
496
|
+
(function (CouponTypes) {
|
|
497
|
+
CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
|
|
498
|
+
CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
|
|
499
|
+
CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
|
|
500
|
+
CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
|
|
501
|
+
})(CouponTypes || (CouponTypes = {}));
|
|
502
|
+
|
|
503
|
+
var CouponSubtypes;
|
|
504
|
+
(function (CouponSubtypes) {
|
|
505
|
+
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
506
|
+
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
507
|
+
})(CouponSubtypes || (CouponSubtypes = {}));
|
|
467
508
|
|
|
468
509
|
var Exclusivities;
|
|
469
510
|
(function (Exclusivities) {
|
|
@@ -476,17 +517,9 @@ class Coupon extends BaseModel {
|
|
|
476
517
|
get isInfluencer() {
|
|
477
518
|
return !isNil(this.influencerEmail);
|
|
478
519
|
}
|
|
479
|
-
|
|
520
|
+
static get identifiersFields() {
|
|
480
521
|
return ['id'];
|
|
481
522
|
}
|
|
482
|
-
calculeDiscount(amount) {
|
|
483
|
-
switch (this.discountType) {
|
|
484
|
-
case DiscountType.ABSOLUTE:
|
|
485
|
-
return this.discount < amount ? this.discount : amount;
|
|
486
|
-
case DiscountType.PERCENTAGE:
|
|
487
|
-
return this.discount * 0.01 * amount;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
523
|
}
|
|
491
524
|
__decorate([
|
|
492
525
|
Expose({ name: 'checkout_type' }),
|
|
@@ -498,7 +531,7 @@ __decorate([
|
|
|
498
531
|
], Coupon.prototype, "exclusivityType", void 0);
|
|
499
532
|
|
|
500
533
|
class SubscriptionPlan extends BaseModel {
|
|
501
|
-
|
|
534
|
+
static get identifiersFields() {
|
|
502
535
|
return ['id'];
|
|
503
536
|
}
|
|
504
537
|
}
|
|
@@ -509,8 +542,8 @@ class BeautyProfile extends BaseModel {
|
|
|
509
542
|
delete plain.id;
|
|
510
543
|
return plain;
|
|
511
544
|
}
|
|
512
|
-
|
|
513
|
-
return ['id'];
|
|
545
|
+
static get identifiersFields() {
|
|
546
|
+
return ['id', 'userId'];
|
|
514
547
|
}
|
|
515
548
|
}
|
|
516
549
|
|
|
@@ -521,14 +554,14 @@ class User extends BaseModel {
|
|
|
521
554
|
instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
|
|
522
555
|
return instance;
|
|
523
556
|
}
|
|
524
|
-
identifierFields() {
|
|
525
|
-
return ['id'];
|
|
526
|
-
}
|
|
527
557
|
toPlain() {
|
|
528
558
|
const plain = super.toPlain();
|
|
529
559
|
delete plain.beautyProfile;
|
|
530
560
|
return plain;
|
|
531
561
|
}
|
|
562
|
+
static get identifiersFields() {
|
|
563
|
+
return ['id'];
|
|
564
|
+
}
|
|
532
565
|
}
|
|
533
566
|
__decorate([
|
|
534
567
|
Type(() => BeautyProfile),
|
|
@@ -536,7 +569,7 @@ __decorate([
|
|
|
536
569
|
], User.prototype, "beautyProfile", void 0);
|
|
537
570
|
|
|
538
571
|
class Subscription extends BaseModel {
|
|
539
|
-
|
|
572
|
+
static get identifiersFields() {
|
|
540
573
|
return ['id'];
|
|
541
574
|
}
|
|
542
575
|
}
|
|
@@ -570,24 +603,24 @@ __decorate([
|
|
|
570
603
|
], Subscription.prototype, "payment", void 0);
|
|
571
604
|
|
|
572
605
|
class UserAddress extends Address {
|
|
573
|
-
|
|
574
|
-
return ['id'];
|
|
606
|
+
static get identifiersFields() {
|
|
607
|
+
return ['id', 'userId'];
|
|
575
608
|
}
|
|
576
609
|
}
|
|
577
610
|
|
|
578
611
|
class UserPaymentMethod extends BaseModel {
|
|
579
|
-
|
|
580
|
-
return ['id'];
|
|
612
|
+
static get identifiersFields() {
|
|
613
|
+
return ['id', 'userId'];
|
|
581
614
|
}
|
|
582
615
|
}
|
|
583
616
|
|
|
584
617
|
class Lead extends BaseModel {
|
|
585
|
-
|
|
618
|
+
static get identifiersFields() {
|
|
586
619
|
return ['id'];
|
|
587
620
|
}
|
|
588
621
|
}
|
|
589
622
|
|
|
590
|
-
class UnauthorizedError extends
|
|
623
|
+
class UnauthorizedError extends CustomError {
|
|
591
624
|
constructor(message) {
|
|
592
625
|
super(message);
|
|
593
626
|
this.message = message;
|
|
@@ -630,14 +663,14 @@ class Authentication {
|
|
|
630
663
|
}
|
|
631
664
|
}
|
|
632
665
|
|
|
633
|
-
class UserAlreadyRegisteredError extends
|
|
666
|
+
class UserAlreadyRegisteredError extends CustomError {
|
|
634
667
|
constructor(message) {
|
|
635
668
|
super(message);
|
|
636
669
|
this.message = message;
|
|
637
670
|
}
|
|
638
671
|
}
|
|
639
672
|
|
|
640
|
-
class WeakPasswordError extends
|
|
673
|
+
class WeakPasswordError extends CustomError {
|
|
641
674
|
constructor(message = 'Weak password') {
|
|
642
675
|
super(message);
|
|
643
676
|
this.message = message;
|
|
@@ -697,6 +730,15 @@ class RecoveryPassword {
|
|
|
697
730
|
}
|
|
698
731
|
}
|
|
699
732
|
|
|
733
|
+
class Category extends BaseModel {
|
|
734
|
+
identifierFields() {
|
|
735
|
+
return ['id'];
|
|
736
|
+
}
|
|
737
|
+
static get identifiersFields() {
|
|
738
|
+
return ['id'];
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
700
742
|
var Shops;
|
|
701
743
|
(function (Shops) {
|
|
702
744
|
Shops["MENSMARKET"] = "mensmarket";
|
|
@@ -704,12 +746,6 @@ var Shops;
|
|
|
704
746
|
Shops["GLAMPOINTS"] = "Glampoints";
|
|
705
747
|
})(Shops || (Shops = {}));
|
|
706
748
|
|
|
707
|
-
class Category extends BaseModel {
|
|
708
|
-
identifierFields() {
|
|
709
|
-
return ['id'];
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
|
|
713
749
|
class Product extends BaseModel {
|
|
714
750
|
identifierFields() {
|
|
715
751
|
return ['id'];
|
|
@@ -718,45 +754,61 @@ class Product extends BaseModel {
|
|
|
718
754
|
var _a, _b, _c, _d, _e, _f;
|
|
719
755
|
return Object.assign(Object.assign(Object.assign({}, (((_b = (_a = this.description) === null || _a === void 0 ? void 0 : _a[shop]) === null || _b === void 0 ? void 0 : _b.description) ? { description: (_d = (_c = this.description) === null || _c === void 0 ? void 0 : _c[shop]) === null || _d === void 0 ? void 0 : _d.description } : {})), (((_e = this.price) === null || _e === void 0 ? void 0 : _e[shop]) || {})), (((_f = this.stock) === null || _f === void 0 ? void 0 : _f[shop]) || {}));
|
|
720
756
|
}
|
|
757
|
+
static get identifiersFields() {
|
|
758
|
+
return ['id'];
|
|
759
|
+
}
|
|
721
760
|
}
|
|
761
|
+
__decorate([
|
|
762
|
+
Type(() => KitProduct),
|
|
763
|
+
__metadata("design:type", Array)
|
|
764
|
+
], Product.prototype, "kitProducts", void 0);
|
|
722
765
|
|
|
723
|
-
class
|
|
724
|
-
|
|
725
|
-
return ['
|
|
766
|
+
class KitProduct extends BaseModel {
|
|
767
|
+
static get identifiersFields() {
|
|
768
|
+
return ['productId', 'kitProducId'];
|
|
726
769
|
}
|
|
727
770
|
}
|
|
771
|
+
__decorate([
|
|
772
|
+
Type(() => Product),
|
|
773
|
+
__metadata("design:type", Product)
|
|
774
|
+
], KitProduct.prototype, "kit", void 0);
|
|
775
|
+
__decorate([
|
|
776
|
+
Type(() => Product),
|
|
777
|
+
__metadata("design:type", Product)
|
|
778
|
+
], KitProduct.prototype, "product", void 0);
|
|
728
779
|
|
|
729
|
-
class
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
this.checkoutType = CheckoutTypes.SUBSCRIPTION;
|
|
780
|
+
class Variant extends BaseModel {
|
|
781
|
+
identifierFields() {
|
|
782
|
+
return ['id'];
|
|
733
783
|
}
|
|
734
|
-
static
|
|
735
|
-
return
|
|
784
|
+
static get identifiersFields() {
|
|
785
|
+
return ['id', 'productId'];
|
|
736
786
|
}
|
|
737
787
|
}
|
|
738
|
-
__decorate([
|
|
739
|
-
Expose({ name: 'checkout_type' }),
|
|
740
|
-
__metadata("design:type", Object)
|
|
741
|
-
], ClubCoupon.prototype, "checkoutType", void 0);
|
|
742
788
|
|
|
743
|
-
|
|
789
|
+
const COUPON_EXPIRATION = 60 * 60 * 24 * 30;
|
|
790
|
+
class FinancialCoupon extends Coupon {
|
|
744
791
|
constructor() {
|
|
745
792
|
super(...arguments);
|
|
746
|
-
this.
|
|
747
|
-
}
|
|
748
|
-
static
|
|
749
|
-
return coupon
|
|
793
|
+
this.type = CouponTypes.FINANCIAL;
|
|
794
|
+
}
|
|
795
|
+
static isFinancialCoupon(coupon) {
|
|
796
|
+
return coupon.type === CouponTypes.FINANCIAL && !!coupon.subtype;
|
|
797
|
+
}
|
|
798
|
+
static createCoupon(userId) {
|
|
799
|
+
return this.toInstance({
|
|
800
|
+
name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
|
|
801
|
+
nickname: `${Date.now()}`,
|
|
802
|
+
type: CouponTypes.FINANCIAL,
|
|
803
|
+
subtype: CouponSubtypes.PERCENTAGE,
|
|
804
|
+
checkoutType: CheckoutTypes.ECOMMERCE,
|
|
805
|
+
discount: 30,
|
|
806
|
+
user: userId,
|
|
807
|
+
createdAt: new Date(Date.now()),
|
|
808
|
+
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
809
|
+
});
|
|
750
810
|
}
|
|
751
811
|
}
|
|
752
|
-
__decorate([
|
|
753
|
-
Expose({ name: 'checkout_type' }),
|
|
754
|
-
__metadata("design:type", Object)
|
|
755
|
-
], StoreCoupon.prototype, "checkoutType", void 0);
|
|
756
|
-
__decorate([
|
|
757
|
-
Type(() => Category),
|
|
758
|
-
__metadata("design:type", Array)
|
|
759
|
-
], StoreCoupon.prototype, "categories", void 0);
|
|
760
812
|
|
|
761
813
|
var OrderStatus;
|
|
762
814
|
(function (OrderStatus) {
|
|
@@ -774,21 +826,13 @@ class LineItem extends Product {
|
|
|
774
826
|
}
|
|
775
827
|
|
|
776
828
|
class ShippingMethod extends BaseModel {
|
|
777
|
-
|
|
829
|
+
static get identifiersFields() {
|
|
778
830
|
return ['id'];
|
|
779
831
|
}
|
|
780
832
|
}
|
|
781
833
|
|
|
782
834
|
class Checkout extends BaseModel {
|
|
783
|
-
get
|
|
784
|
-
return this.lineItems.reduce((total, item) => {
|
|
785
|
-
return total + item.pricePaid;
|
|
786
|
-
}, 0);
|
|
787
|
-
}
|
|
788
|
-
get totalPrice() {
|
|
789
|
-
return this.totalPrice - this.discount;
|
|
790
|
-
}
|
|
791
|
-
identifierFields() {
|
|
835
|
+
static get identifiersFields() {
|
|
792
836
|
return ['id'];
|
|
793
837
|
}
|
|
794
838
|
}
|
|
@@ -813,8 +857,8 @@ __decorate([
|
|
|
813
857
|
__metadata("design:type", ShippingMethod)
|
|
814
858
|
], Checkout.prototype, "shipping", void 0);
|
|
815
859
|
__decorate([
|
|
816
|
-
Type(() =>
|
|
817
|
-
__metadata("design:type",
|
|
860
|
+
Type(() => Coupon),
|
|
861
|
+
__metadata("design:type", Coupon)
|
|
818
862
|
], Checkout.prototype, "coupon", void 0);
|
|
819
863
|
|
|
820
864
|
class Order extends Checkout {
|
|
@@ -825,7 +869,7 @@ __decorate([
|
|
|
825
869
|
], Order.prototype, "payment", void 0);
|
|
826
870
|
|
|
827
871
|
class CheckoutSubscription extends BaseModel {
|
|
828
|
-
|
|
872
|
+
static get identifiersFields() {
|
|
829
873
|
return ['id'];
|
|
830
874
|
}
|
|
831
875
|
}
|
|
@@ -847,7 +891,7 @@ __decorate([
|
|
|
847
891
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
848
892
|
|
|
849
893
|
class Buy2Win extends BaseModel {
|
|
850
|
-
|
|
894
|
+
static get identifiersFields() {
|
|
851
895
|
return ['id'];
|
|
852
896
|
}
|
|
853
897
|
}
|
|
@@ -943,25 +987,25 @@ class BeautyQuestionsHelper {
|
|
|
943
987
|
}
|
|
944
988
|
|
|
945
989
|
class Home extends BaseModel {
|
|
946
|
-
|
|
990
|
+
static get identifiersFields() {
|
|
947
991
|
return ['id'];
|
|
948
992
|
}
|
|
949
993
|
}
|
|
950
994
|
|
|
951
995
|
class ShopMenu extends BaseModel {
|
|
952
|
-
|
|
996
|
+
static get identifiersFields() {
|
|
953
997
|
return ['id'];
|
|
954
998
|
}
|
|
955
999
|
}
|
|
956
1000
|
|
|
957
|
-
class InvalidArgumentError extends
|
|
1001
|
+
class InvalidArgumentError extends CustomError {
|
|
958
1002
|
constructor(message) {
|
|
959
1003
|
super(message);
|
|
960
1004
|
this.message = message;
|
|
961
1005
|
}
|
|
962
1006
|
}
|
|
963
1007
|
|
|
964
|
-
class RequiredArgumentError extends
|
|
1008
|
+
class RequiredArgumentError extends CustomError {
|
|
965
1009
|
constructor(args) {
|
|
966
1010
|
super(`Required arguments: ${args.join(', ')}`);
|
|
967
1011
|
this.args = args;
|
|
@@ -969,14 +1013,14 @@ class RequiredArgumentError extends Error {
|
|
|
969
1013
|
}
|
|
970
1014
|
}
|
|
971
1015
|
|
|
972
|
-
class NotFoundError extends
|
|
1016
|
+
class NotFoundError extends CustomError {
|
|
973
1017
|
constructor(message) {
|
|
974
1018
|
super(message);
|
|
975
1019
|
this.message = message;
|
|
976
1020
|
}
|
|
977
1021
|
}
|
|
978
1022
|
|
|
979
|
-
class DuplicatedResultsError extends
|
|
1023
|
+
class DuplicatedResultsError extends CustomError {
|
|
980
1024
|
constructor(message) {
|
|
981
1025
|
super(message);
|
|
982
1026
|
this.message = message;
|
|
@@ -987,6 +1031,21 @@ class AxiosAdapter {
|
|
|
987
1031
|
constructor(config) {
|
|
988
1032
|
this.config = config;
|
|
989
1033
|
}
|
|
1034
|
+
get(index) {
|
|
1035
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1036
|
+
try {
|
|
1037
|
+
const { data } = yield axios({
|
|
1038
|
+
url: `${this.config.url}/${index}`,
|
|
1039
|
+
method: 'GET',
|
|
1040
|
+
headers: { Authorization: `Basic ${this.config.credential}` },
|
|
1041
|
+
});
|
|
1042
|
+
return data._source;
|
|
1043
|
+
}
|
|
1044
|
+
catch (error) {
|
|
1045
|
+
throw new NotFoundError(error.message);
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
990
1049
|
query(index, query) {
|
|
991
1050
|
return __awaiter(this, void 0, void 0, function* () {
|
|
992
1051
|
const { data } = yield axios({
|
|
@@ -1001,12 +1060,37 @@ class AxiosAdapter {
|
|
|
1001
1060
|
};
|
|
1002
1061
|
});
|
|
1003
1062
|
}
|
|
1063
|
+
save(index, data) {
|
|
1064
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1065
|
+
yield axios({
|
|
1066
|
+
url: `${this.config.url}/${index}`,
|
|
1067
|
+
method: 'PUT',
|
|
1068
|
+
headers: { Authorization: `Basic ${this.config.credential}` },
|
|
1069
|
+
data,
|
|
1070
|
+
});
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
delete(index) {
|
|
1074
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1075
|
+
yield axios({
|
|
1076
|
+
url: `${this.config.url}/${index}`,
|
|
1077
|
+
method: 'DELETE',
|
|
1078
|
+
headers: { Authorization: `Basic ${this.config.credential}` },
|
|
1079
|
+
});
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1004
1082
|
}
|
|
1005
1083
|
|
|
1006
1084
|
class ProductsIndex {
|
|
1007
1085
|
constructor(adapter) {
|
|
1008
1086
|
this.adapter = adapter;
|
|
1009
1087
|
}
|
|
1088
|
+
get(id) {
|
|
1089
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1090
|
+
const data = yield this.adapter.get(`products/_doc/${id}`);
|
|
1091
|
+
return Product.toInstance(data);
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1010
1094
|
findById(ids, options) {
|
|
1011
1095
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1012
1096
|
const publishedField = options.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
@@ -1058,13 +1142,38 @@ class ProductsIndex {
|
|
|
1058
1142
|
return hits.map((hit) => Product.toInstance(hit._source));
|
|
1059
1143
|
});
|
|
1060
1144
|
}
|
|
1145
|
+
save(product) {
|
|
1146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1147
|
+
delete product.createdAt;
|
|
1148
|
+
delete product.updatedAt;
|
|
1149
|
+
delete product.kitProducts;
|
|
1150
|
+
try {
|
|
1151
|
+
if (!product.firestoreId)
|
|
1152
|
+
throw new Error('Is not a product from firestore');
|
|
1153
|
+
yield this.get(product.firestoreId);
|
|
1154
|
+
yield this.adapter.save(`products/_doc/${product.firestoreId}`, product.toPlain());
|
|
1155
|
+
}
|
|
1156
|
+
catch (error) {
|
|
1157
|
+
console.info(error.message);
|
|
1158
|
+
yield this.adapter.save(`products/_doc/${product.id}`, product.toPlain());
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
delete(product) {
|
|
1163
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1164
|
+
try {
|
|
1165
|
+
yield this.get(product.firestoreId);
|
|
1166
|
+
yield this.adapter.delete(`products/_doc/${product.firestoreId}`);
|
|
1167
|
+
}
|
|
1168
|
+
catch (error) {
|
|
1169
|
+
yield this.adapter.delete(`products/_doc/${product.id}`);
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1061
1173
|
}
|
|
1062
1174
|
|
|
1063
1175
|
const withFirestore = (MixinBase) => {
|
|
1064
1176
|
return class extends MixinBase {
|
|
1065
|
-
constructor(...args) {
|
|
1066
|
-
super(args);
|
|
1067
|
-
}
|
|
1068
1177
|
collection(path) {
|
|
1069
1178
|
return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
|
|
1070
1179
|
}
|
|
@@ -1074,7 +1183,7 @@ const withFirestore = (MixinBase) => {
|
|
|
1074
1183
|
fromFirestore: (snap) => {
|
|
1075
1184
|
const data = snap.data();
|
|
1076
1185
|
Object.keys(data).forEach((key) => {
|
|
1077
|
-
if (data[key]
|
|
1186
|
+
if (data[key] && typeof data[key] === 'object' && '_seconds' in data[key]) {
|
|
1078
1187
|
data[key] = data[key].toDate();
|
|
1079
1188
|
}
|
|
1080
1189
|
});
|
|
@@ -1154,16 +1263,16 @@ const withFindFirestore = (MixinBase) => {
|
|
|
1154
1263
|
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
1155
1264
|
return queryReference.where(firestoreFieldName, 'array-contains', options.value);
|
|
1156
1265
|
if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value)) {
|
|
1157
|
-
return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName}.${key}`, options[key]), queryReference);
|
|
1266
|
+
return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName.toString()}.${key}`, options[key]), queryReference);
|
|
1158
1267
|
}
|
|
1159
1268
|
return queryReference.where(firestoreFieldName, (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
|
|
1160
1269
|
};
|
|
1161
1270
|
}
|
|
1162
|
-
find(filters, limits, orderBy) {
|
|
1271
|
+
find({ filters, limits, orderBy, } = {}) {
|
|
1163
1272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1164
|
-
let query = this.collection(this.buildCollectionPathForFind(filters));
|
|
1165
|
-
|
|
1166
|
-
orderBy
|
|
1273
|
+
let query = this.collection(this.buildCollectionPathForFind(filters || {}));
|
|
1274
|
+
query = this.makeFirestoreWhere(query, filters || {});
|
|
1275
|
+
Object.keys(orderBy || {}).forEach((fieldName) => (query = query.orderBy(fieldName, orderBy[fieldName])));
|
|
1167
1276
|
query = yield this.defineLimits(query, filters, limits);
|
|
1168
1277
|
const docs = yield query.get();
|
|
1169
1278
|
const data = docs.docs.map((doc) => doc.data());
|
|
@@ -1174,19 +1283,18 @@ const withFindFirestore = (MixinBase) => {
|
|
|
1174
1283
|
});
|
|
1175
1284
|
}
|
|
1176
1285
|
buildCollectionPathForFind(filters) {
|
|
1177
|
-
var _a;
|
|
1178
1286
|
if (!this.isSubCollection(this))
|
|
1179
1287
|
return this.collectionName;
|
|
1180
1288
|
const parentIdField = this.parentIdField;
|
|
1181
|
-
const parentId = getValueFromFilter(
|
|
1289
|
+
const parentId = getValueFromFilter(filters === null || filters === void 0 ? void 0 : filters[parentIdField]);
|
|
1182
1290
|
return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
|
|
1183
1291
|
}
|
|
1184
1292
|
defineLimits(query, filters, limits) {
|
|
1185
1293
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1186
1294
|
if (limits === null || limits === void 0 ? void 0 : limits.offset) {
|
|
1187
|
-
if (limits.offset
|
|
1295
|
+
if (this.model.isModel(limits.offset))
|
|
1188
1296
|
query = query.startAfter(yield this.collection(this.buildCollectionPathForFind(filters))
|
|
1189
|
-
.doc(limits.offset[limits.offset.
|
|
1297
|
+
.doc(limits.offset[limits.offset.identifiersFields.shift()])
|
|
1190
1298
|
.get());
|
|
1191
1299
|
else if (isNumber(limits.offset) || isString(limits.offset))
|
|
1192
1300
|
query = query.startAt(limits.offset);
|
|
@@ -1218,7 +1326,7 @@ const withCreateFirestore = (MixinBase) => {
|
|
|
1218
1326
|
save(data) {
|
|
1219
1327
|
var _a;
|
|
1220
1328
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1221
|
-
const id = (_a = data[data.
|
|
1329
|
+
const id = (_a = data[data.identifiersFields.shift()]) === null || _a === void 0 ? void 0 : _a.toString();
|
|
1222
1330
|
const collectionPath = this.buildCollectionPathForAdd(data);
|
|
1223
1331
|
if (isEmpty(id))
|
|
1224
1332
|
return this.collection(collectionPath).add(data);
|
|
@@ -1255,7 +1363,7 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
1255
1363
|
update(data) {
|
|
1256
1364
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1257
1365
|
const model = new this.model();
|
|
1258
|
-
const keyField = model.
|
|
1366
|
+
const keyField = model.identifiersFields.shift();
|
|
1259
1367
|
const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
|
|
1260
1368
|
yield docRef.set(this.paramsToPlain(data), { merge: true });
|
|
1261
1369
|
const doc = yield docRef.get();
|
|
@@ -1269,8 +1377,8 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
1269
1377
|
}
|
|
1270
1378
|
paramsToPlain(params) {
|
|
1271
1379
|
const model = this.model;
|
|
1272
|
-
if (params
|
|
1273
|
-
return params;
|
|
1380
|
+
if (model.isModel(params))
|
|
1381
|
+
return params.toPlain();
|
|
1274
1382
|
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(params[currentKey]) })), {});
|
|
1275
1383
|
}
|
|
1276
1384
|
};
|
|
@@ -1319,7 +1427,7 @@ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
1319
1427
|
}
|
|
1320
1428
|
|
|
1321
1429
|
class UserSearch extends BaseModel {
|
|
1322
|
-
|
|
1430
|
+
static get identifiersFields() {
|
|
1323
1431
|
return ['id'];
|
|
1324
1432
|
}
|
|
1325
1433
|
}
|
|
@@ -1354,7 +1462,7 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
1354
1462
|
}
|
|
1355
1463
|
checkIfExistsByField(field, value) {
|
|
1356
1464
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1357
|
-
const result = yield this.userSearchFirestoreRepository.find(
|
|
1465
|
+
const result = yield this.userSearchFirestoreRepository.find({ [field]: { operator: Where.EQUALS, value } });
|
|
1358
1466
|
return result.count > 0;
|
|
1359
1467
|
});
|
|
1360
1468
|
}
|
|
@@ -1512,7 +1620,9 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
|
|
|
1512
1620
|
for (const productIds of chunks) {
|
|
1513
1621
|
if ((options === null || options === void 0 ? void 0 : options.limit) && products.length >= (options === null || options === void 0 ? void 0 : options.limit))
|
|
1514
1622
|
break;
|
|
1515
|
-
let query = yield this.collection('
|
|
1623
|
+
let query = yield this.collection('productsErpVitrine')
|
|
1624
|
+
.where(publishedField, '==', true)
|
|
1625
|
+
.where('id', 'in', productIds);
|
|
1516
1626
|
if (options === null || options === void 0 ? void 0 : options.hasStock)
|
|
1517
1627
|
query = query.where('stock.quantity', '>', 0);
|
|
1518
1628
|
if (options === null || options === void 0 ? void 0 : options.limit)
|
|
@@ -1531,19 +1641,48 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
1531
1641
|
constructor(firestore) {
|
|
1532
1642
|
super();
|
|
1533
1643
|
this.firestore = firestore;
|
|
1534
|
-
this.
|
|
1644
|
+
this.reviews = {};
|
|
1645
|
+
this.collectionName = 'productsErpVitrine';
|
|
1535
1646
|
this.model = Product;
|
|
1536
1647
|
}
|
|
1537
|
-
getBySlug(slug
|
|
1648
|
+
getBySlug(slug) {
|
|
1538
1649
|
var _a;
|
|
1539
1650
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1540
|
-
const result = yield this.find(
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1651
|
+
const result = yield this.find({
|
|
1652
|
+
filters: {
|
|
1653
|
+
slug: { operator: Where.EQUALS, value: slug },
|
|
1654
|
+
},
|
|
1655
|
+
});
|
|
1544
1656
|
return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
1545
1657
|
});
|
|
1546
1658
|
}
|
|
1659
|
+
fetchReviews(status) {
|
|
1660
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1661
|
+
const { data: products } = yield this.find();
|
|
1662
|
+
products.forEach((product) => {
|
|
1663
|
+
var _a;
|
|
1664
|
+
if ([undefined, 0].includes((_a = product.reviews) === null || _a === void 0 ? void 0 : _a.length))
|
|
1665
|
+
return;
|
|
1666
|
+
const productInfo = {
|
|
1667
|
+
productId: product.id,
|
|
1668
|
+
productName: product.name,
|
|
1669
|
+
productSku: product.sku,
|
|
1670
|
+
};
|
|
1671
|
+
this.reviews.pending = [];
|
|
1672
|
+
this.reviews.approved = [];
|
|
1673
|
+
this.reviews.rejected = [];
|
|
1674
|
+
product.reviews.forEach((review) => {
|
|
1675
|
+
if ([null, undefined].includes(review.status))
|
|
1676
|
+
return this.reviews.pending.push(Object.assign(Object.assign({}, review), productInfo));
|
|
1677
|
+
if (review.status === false)
|
|
1678
|
+
return this.reviews.rejected.push(Object.assign(Object.assign({}, review), productInfo));
|
|
1679
|
+
if (!!review.status)
|
|
1680
|
+
return this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
|
|
1681
|
+
});
|
|
1682
|
+
});
|
|
1683
|
+
return this.reviews[status];
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1547
1686
|
}
|
|
1548
1687
|
|
|
1549
1688
|
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
|
|
@@ -1583,28 +1722,19 @@ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirest
|
|
|
1583
1722
|
this.model = Coupon;
|
|
1584
1723
|
}
|
|
1585
1724
|
buildModelInstance() {
|
|
1725
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
1586
1726
|
return {
|
|
1587
1727
|
toFirestore: (data) => {
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
plain.categories = (_a = plain === null || plain === void 0 ? void 0 : plain.categories) === null || _a === void 0 ? void 0 : _a.map((category) => category.id);
|
|
1728
|
+
const plain = toFirestore(data);
|
|
1729
|
+
if (!!data.expiresIn)
|
|
1730
|
+
plain.expiresIn = data.expiresIn.getTime();
|
|
1592
1731
|
return plain;
|
|
1593
1732
|
},
|
|
1594
1733
|
fromFirestore: (snap) => {
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
data[key] = data[key].toDate();
|
|
1600
|
-
}
|
|
1601
|
-
});
|
|
1602
|
-
data.categories = (_a = data === null || data === void 0 ? void 0 : data.categories) === null || _a === void 0 ? void 0 : _a.map((category) => ({ id: category }));
|
|
1603
|
-
if (data.checkout_type === CheckoutTypes.SUBSCRIPTION)
|
|
1604
|
-
return ClubCoupon.toInstance(Object.assign({ id: snap.id }, data));
|
|
1605
|
-
if (data.checkout_type === CheckoutTypes.ECOMMERCE)
|
|
1606
|
-
return StoreCoupon.toInstance(Object.assign({ id: snap.id }, data));
|
|
1607
|
-
return this.model.toInstance(Object.assign({ id: snap.id }, data));
|
|
1734
|
+
const instance = fromFirestore(snap);
|
|
1735
|
+
if (!isNil(instance.expiresIn))
|
|
1736
|
+
instance.expiresIn = new Date(snap.data().expiresIn);
|
|
1737
|
+
return instance;
|
|
1608
1738
|
},
|
|
1609
1739
|
};
|
|
1610
1740
|
}
|
|
@@ -1743,7 +1873,7 @@ class AuthenticationFirebaseAuthService {
|
|
|
1743
1873
|
}
|
|
1744
1874
|
signInWithGoogle() {
|
|
1745
1875
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1746
|
-
const credentials = yield this.firebaseAuth.signInWithPopup(new firebase
|
|
1876
|
+
const credentials = yield this.firebaseAuth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
|
|
1747
1877
|
const user = credentials.user;
|
|
1748
1878
|
return {
|
|
1749
1879
|
id: user.uid,
|
|
@@ -1798,9 +1928,1107 @@ class RegisterFirebaseAuthService {
|
|
|
1798
1928
|
}
|
|
1799
1929
|
}
|
|
1800
1930
|
|
|
1931
|
+
class AttributeOptionHelper {
|
|
1932
|
+
}
|
|
1933
|
+
AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
|
|
1934
|
+
if (fields.includes(attributeName))
|
|
1935
|
+
return { columnName: attributeName.toString(), attributeName };
|
|
1936
|
+
const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
|
|
1937
|
+
const fieldOption = field === null || field === void 0 ? void 0 : field[attributeName.toString()];
|
|
1938
|
+
if (isNil(fieldOption))
|
|
1939
|
+
return { columnName: attributeName.toString(), attributeName };
|
|
1940
|
+
if (Array.isArray(fieldOption))
|
|
1941
|
+
return { columnName: attributeName.toString(), attributeName, fields: fieldOption };
|
|
1942
|
+
return Object.assign({ attributeName, columnName: attributeName.toString() }, fieldOption);
|
|
1943
|
+
};
|
|
1944
|
+
AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue.columnName;
|
|
1945
|
+
AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
|
|
1946
|
+
if (fields.includes(columnName))
|
|
1947
|
+
return { columnName, attributeName: columnName };
|
|
1948
|
+
const field = fields.find((columnOption) => {
|
|
1949
|
+
var _a;
|
|
1950
|
+
return isObject(columnOption) &&
|
|
1951
|
+
((_a = Object.values(columnOption).find((option) => AttributeOptionHelper.CheckIsColumnOption(option) && option.columnName === columnName)) === null || _a === void 0 ? void 0 : _a.columnName) === columnName;
|
|
1952
|
+
}) || {};
|
|
1953
|
+
const attributeName = Object.keys(field).find((fieldOptionFromList) => AttributeOptionHelper.CheckIsColumnOption(field[fieldOptionFromList]) ||
|
|
1954
|
+
Array.isArray(field[fieldOptionFromList]));
|
|
1955
|
+
const fieldOption = field === null || field === void 0 ? void 0 : field[attributeName];
|
|
1956
|
+
if (Array.isArray(fieldOption))
|
|
1957
|
+
return { attributeName: attributeName, fields: fieldOption };
|
|
1958
|
+
return Object.assign({ attributeName: attributeName || columnName, columnName }, fieldOption);
|
|
1959
|
+
};
|
|
1960
|
+
|
|
1961
|
+
class GraphQLFieldHelper {
|
|
1962
|
+
}
|
|
1963
|
+
GraphQLFieldHelper.CheckIsGraphQLParams = (params) => !isString(params) && Array.isArray(params) && params.length >= 0 && !!params[0].operation;
|
|
1964
|
+
GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = (fields) => {
|
|
1965
|
+
return fields === null || fields === void 0 ? void 0 : fields.map((field) => {
|
|
1966
|
+
if (isString(field))
|
|
1967
|
+
return field.toString();
|
|
1968
|
+
const fieldName = Object.keys(field).shift();
|
|
1969
|
+
const fieldValue = field[fieldName];
|
|
1970
|
+
if (Array.isArray(fieldValue))
|
|
1971
|
+
return { [fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue) };
|
|
1972
|
+
if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
|
|
1973
|
+
return;
|
|
1974
|
+
if (fieldValue.fields)
|
|
1975
|
+
return {
|
|
1976
|
+
[fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
1977
|
+
};
|
|
1978
|
+
return fieldValue.columnName;
|
|
1979
|
+
}).filter((field) => !!field);
|
|
1980
|
+
};
|
|
1981
|
+
GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).reduce((result, columnName) => {
|
|
1982
|
+
const { attributeName, fields: attributeFields, from, } = AttributeOptionHelper.FindColumnOptionFromList(columnName, fields);
|
|
1983
|
+
if (!!attributeFields && Array.isArray(attributeFields)) {
|
|
1984
|
+
if (Array.isArray(data[columnName]))
|
|
1985
|
+
return Object.assign(Object.assign({}, result), { [attributeName]: from
|
|
1986
|
+
? from(data[columnName], data)
|
|
1987
|
+
: data[columnName].map((value) => GraphQLFieldHelper.ConvertFieldValueFrom(value, attributeFields)) });
|
|
1988
|
+
if (isObject(data[columnName]))
|
|
1989
|
+
return Object.assign(Object.assign({}, result), { [attributeName]: !!from
|
|
1990
|
+
? from(data[columnName])
|
|
1991
|
+
: GraphQLFieldHelper.ConvertFieldValueFrom(data[columnName], attributeFields) });
|
|
1992
|
+
}
|
|
1993
|
+
if (!!from)
|
|
1994
|
+
return Object.assign(Object.assign({}, result), { [attributeName]: from(data[columnName], data) });
|
|
1995
|
+
return Object.assign(Object.assign({}, result), { [attributeName]: parseDateTime(data[columnName]) });
|
|
1996
|
+
}, {});
|
|
1997
|
+
GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
|
|
1998
|
+
var _a;
|
|
1999
|
+
const data = ((_a = instance.toPlain) === null || _a === void 0 ? void 0 : _a.call(instance)) || instance;
|
|
2000
|
+
return Object.keys(data).reduce((result, attributeName) => {
|
|
2001
|
+
const { columnName, fields: attributeFields, foreignKeyColumn, to, bindPersistData, } = AttributeOptionHelper.FindByAttribute(attributeName, fields);
|
|
2002
|
+
if (bindPersistData)
|
|
2003
|
+
return Object.assign(Object.assign({}, result), bindPersistData(data[attributeName], instance));
|
|
2004
|
+
if (isNil(columnName))
|
|
2005
|
+
return result;
|
|
2006
|
+
if (!!foreignKeyColumn &&
|
|
2007
|
+
!isEmpty(foreignKeyColumn) &&
|
|
2008
|
+
!Object.keys(foreignKeyColumn).filter((key) => { var _a; return !((_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[key]); }).length)
|
|
2009
|
+
return Object.keys(foreignKeyColumn).reduce((object, current) => { var _a; return (Object.assign(Object.assign({}, object), { [foreignKeyColumn[current]]: (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current] })); }, Object.assign({}, result));
|
|
2010
|
+
if (update && isObject(data[attributeName]) && !isNil(attributeFields) && !isDate(data[attributeName]))
|
|
2011
|
+
return result;
|
|
2012
|
+
if (!!columnName && Array.isArray(attributeFields) && isObject(data[attributeName])) {
|
|
2013
|
+
const converted = !isNil(columnName) && to ? to(instance[attributeName], instance) : data[attributeName];
|
|
2014
|
+
return Object.assign(Object.assign({}, result), (converted !== undefined
|
|
2015
|
+
? {
|
|
2016
|
+
[columnName]: {
|
|
2017
|
+
data: instance[attributeName] instanceof BaseModel
|
|
2018
|
+
? GraphQLFieldHelper.ConvertFieldValueTo(data[attributeName], attributeFields)
|
|
2019
|
+
: converted,
|
|
2020
|
+
},
|
|
2021
|
+
}
|
|
2022
|
+
: {}));
|
|
2023
|
+
}
|
|
2024
|
+
if (!!to)
|
|
2025
|
+
return Object.assign(Object.assign({}, result), { [columnName]: to(instance[attributeName], instance) });
|
|
2026
|
+
return Object.assign(Object.assign({}, result), { [columnName]: data[attributeName] });
|
|
2027
|
+
}, {});
|
|
2028
|
+
};
|
|
2029
|
+
|
|
2030
|
+
class FilterOptionHelper {
|
|
2031
|
+
}
|
|
2032
|
+
FilterOptionHelper.CheckIfIsFilterOption = (filter) => !isNil(filter === null || filter === void 0 ? void 0 : filter.operator);
|
|
2033
|
+
FilterOptionHelper.GetValueFromFilter = (filter, fieldOption) => {
|
|
2034
|
+
if (!FilterOptionHelper.CheckIfIsFilterOption(filter))
|
|
2035
|
+
return filter;
|
|
2036
|
+
if (filter.operator === Where.ISNULL)
|
|
2037
|
+
return true;
|
|
2038
|
+
if (filter.operator === Where.ISNOTNULL)
|
|
2039
|
+
return false;
|
|
2040
|
+
const converter = fieldOption.to ? fieldOption.to : (value) => value;
|
|
2041
|
+
return Array.isArray(filter.value) && !fieldOption.fields && [Where.IN, Where.NOTIN].includes(filter.operator)
|
|
2042
|
+
? filter.value.map((fieldValue) => converter(fieldValue))
|
|
2043
|
+
: converter(filter.value);
|
|
2044
|
+
};
|
|
2045
|
+
|
|
2046
|
+
const withCreateHasuraGraphQL = (MixinBase) => {
|
|
2047
|
+
return class CreateHasuraGraphQLMixin extends MixinBase {
|
|
2048
|
+
constructor(...params) {
|
|
2049
|
+
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
2050
|
+
super(...params);
|
|
2051
|
+
this.insertGraphQLOperation = (options === null || options === void 0 ? void 0 : options.insertGraphQLOperation) || `insert_${this.tableName}_one`;
|
|
2052
|
+
this.insertGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.insertGraphQLObjectType) || `${this.tableName}_insert_input`;
|
|
2053
|
+
}
|
|
2054
|
+
create(data) {
|
|
2055
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2056
|
+
const newData = yield this.save(this.model.toInstance(data));
|
|
2057
|
+
return this.model.toInstance(newData);
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
save(data) {
|
|
2061
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2062
|
+
const primaryKeyColumns = this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName);
|
|
2063
|
+
const foreignKeyColumns = this.fields
|
|
2064
|
+
.map((field) => {
|
|
2065
|
+
const columnOptions = Object.values(field).shift();
|
|
2066
|
+
return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
|
|
2067
|
+
columnOptions.foreignKeyColumn && [
|
|
2068
|
+
...Object.values(columnOptions.foreignKeyColumn),
|
|
2069
|
+
{
|
|
2070
|
+
[columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => {
|
|
2071
|
+
var _a;
|
|
2072
|
+
return ((_a = AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions === null || columnOptions === void 0 ? void 0 : columnOptions.fields)) === null || _a === void 0 ? void 0 : _a.columnName) ||
|
|
2073
|
+
foreignKeyField;
|
|
2074
|
+
}),
|
|
2075
|
+
},
|
|
2076
|
+
]);
|
|
2077
|
+
})
|
|
2078
|
+
.filter(Boolean)
|
|
2079
|
+
.reduce((keys, current) => [...keys, ...current], []);
|
|
2080
|
+
const result = yield this.mutation(this.insertGraphQLOperation, [...primaryKeyColumns, ...foreignKeyColumns], {
|
|
2081
|
+
object: { type: this.insertGraphQLObjectType, required: true, value: this.convertDataToHasura(data) },
|
|
2082
|
+
});
|
|
2083
|
+
return Object.assign(Object.assign({}, data.toPlain()), this.convertDataFromHasura(result[this.insertGraphQLOperation]).toPlain());
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
};
|
|
2087
|
+
};
|
|
2088
|
+
|
|
2089
|
+
const withDeleteHasuraGraphQL = (MixinBase) => {
|
|
2090
|
+
return class DeleteHasuraGraphQLMixin extends MixinBase {
|
|
2091
|
+
constructor(...params) {
|
|
2092
|
+
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
2093
|
+
super(...params);
|
|
2094
|
+
this.deleteGraphQLOperation = (options === null || options === void 0 ? void 0 : options.deleteGraphQLOperation) || `delete_${this.tableName}_by_pk`;
|
|
2095
|
+
}
|
|
2096
|
+
delete(identifiers) {
|
|
2097
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2098
|
+
const instance = this.model.toInstance(identifiers);
|
|
2099
|
+
yield this.mutation(this.deleteGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), this.model.identifiersFields.reduce((ids, identifier) => {
|
|
2100
|
+
if (isNil(instance[identifier]))
|
|
2101
|
+
return ids;
|
|
2102
|
+
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
2103
|
+
const value = columnOption.to(identifiers[identifier.toString()], instance);
|
|
2104
|
+
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: {
|
|
2105
|
+
type: this.getAttributeGraphQLTypeOf(columnOption.type || value),
|
|
2106
|
+
value,
|
|
2107
|
+
required: true,
|
|
2108
|
+
} });
|
|
2109
|
+
}, {}));
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
};
|
|
2114
|
+
|
|
2115
|
+
const withHasuraGraphQL = (MixinBase) => {
|
|
2116
|
+
return class HasuraGraphQLMixin extends MixinBase {
|
|
2117
|
+
constructor(...params) {
|
|
2118
|
+
const options = params[0];
|
|
2119
|
+
super(...params);
|
|
2120
|
+
this.tableName = options.tableName;
|
|
2121
|
+
this.endpoint = options.endpoint;
|
|
2122
|
+
this.authOptions = options.authOptions;
|
|
2123
|
+
this.model = options.model;
|
|
2124
|
+
this.fields = options.fields || this.model.identifiersFields;
|
|
2125
|
+
}
|
|
2126
|
+
get headers() {
|
|
2127
|
+
return Object.assign(Object.assign(Object.assign({ 'Content-Type': 'application/json' }, (isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken })), (isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret })), (isNil(this.authOptions.authRole)
|
|
2128
|
+
? {}
|
|
2129
|
+
: { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }));
|
|
2130
|
+
}
|
|
2131
|
+
mutation(operation, fields, variables) {
|
|
2132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2133
|
+
const resultQuery = mutation({
|
|
2134
|
+
operation,
|
|
2135
|
+
variables,
|
|
2136
|
+
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
|
|
2137
|
+
});
|
|
2138
|
+
return this.fetch(resultQuery);
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
query(operation, fields, variables) {
|
|
2142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2143
|
+
const resultQuery = GraphQLFieldHelper.CheckIsGraphQLParams(operation)
|
|
2144
|
+
? query(operation.map((option) => ({
|
|
2145
|
+
operation: option.operation,
|
|
2146
|
+
variables: option.variables,
|
|
2147
|
+
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
|
|
2148
|
+
})))
|
|
2149
|
+
: query({
|
|
2150
|
+
operation,
|
|
2151
|
+
variables,
|
|
2152
|
+
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
|
|
2153
|
+
});
|
|
2154
|
+
return this.fetch(resultQuery);
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
2157
|
+
fetch(params) {
|
|
2158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2159
|
+
const headers = this.headers;
|
|
2160
|
+
const response = yield fetch(`${this.endpoint}`, {
|
|
2161
|
+
method: 'POST',
|
|
2162
|
+
body: JSON.stringify(params),
|
|
2163
|
+
headers,
|
|
2164
|
+
});
|
|
2165
|
+
const result = yield response.json();
|
|
2166
|
+
if (!isNil(result.errors))
|
|
2167
|
+
throw new Error(JSON.stringify(result.errors));
|
|
2168
|
+
return result.data;
|
|
2169
|
+
});
|
|
2170
|
+
}
|
|
2171
|
+
getAttributeGraphQLTypeOf(value) {
|
|
2172
|
+
if (isUUID(value))
|
|
2173
|
+
return 'uuid';
|
|
2174
|
+
if (isString(value))
|
|
2175
|
+
return 'String';
|
|
2176
|
+
if (isBoolean(value))
|
|
2177
|
+
return 'Boolean';
|
|
2178
|
+
if (value instanceof Date)
|
|
2179
|
+
return 'timestamptz';
|
|
2180
|
+
if (isInteger(value))
|
|
2181
|
+
return 'Int';
|
|
2182
|
+
if (isNumber(value))
|
|
2183
|
+
return 'numeric';
|
|
2184
|
+
throw new Error('Type not implemented yet');
|
|
2185
|
+
}
|
|
2186
|
+
checkIfIsDateTimeAndParse(value) {
|
|
2187
|
+
if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value))
|
|
2188
|
+
return value;
|
|
2189
|
+
const date = parseISO(value);
|
|
2190
|
+
if (isNaN$1(date.getTime()))
|
|
2191
|
+
return value;
|
|
2192
|
+
return date;
|
|
2193
|
+
}
|
|
2194
|
+
convertDataFromHasura(data) {
|
|
2195
|
+
const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
|
|
2196
|
+
return this.model.toInstance(plain);
|
|
2197
|
+
}
|
|
2198
|
+
convertDataToHasura(instance, update = false) {
|
|
2199
|
+
return GraphQLFieldHelper.ConvertFieldValueTo(instance, this.fields, update);
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
};
|
|
2203
|
+
|
|
2204
|
+
const withUpdateHasuraGraphQL = (MixinBase) => {
|
|
2205
|
+
const getValueByAction = (options) => {
|
|
2206
|
+
if (options instanceof BaseModel)
|
|
2207
|
+
return options.toPlain();
|
|
2208
|
+
if (isNil(options === null || options === void 0 ? void 0 : options.action))
|
|
2209
|
+
return options;
|
|
2210
|
+
if ([UpdateOptionActions.REMOVE_FIELD.toString(), UpdateOptionActions.NULL.toString()].includes(options.action))
|
|
2211
|
+
return null;
|
|
2212
|
+
return options.value;
|
|
2213
|
+
};
|
|
2214
|
+
return class UpdateHasuraGraphQLMixin extends MixinBase {
|
|
2215
|
+
constructor(...params) {
|
|
2216
|
+
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
2217
|
+
super(...params);
|
|
2218
|
+
this.updateGraphQLOperation = (options === null || options === void 0 ? void 0 : options.updateGraphQLOperation) || `update_${this.tableName}_by_pk`;
|
|
2219
|
+
this.updateGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.updateGraphQLObjectType) || `${this.tableName}_set_input`;
|
|
2220
|
+
this.updateGraphQLPKType = (options === null || options === void 0 ? void 0 : options.updateGraphQLPKType) || `${this.tableName}_pk_columns_input`;
|
|
2221
|
+
}
|
|
2222
|
+
update(data) {
|
|
2223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2224
|
+
const plainData = this.paramsToPlain(data);
|
|
2225
|
+
yield this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), {
|
|
2226
|
+
_set: {
|
|
2227
|
+
type: this.updateGraphQLObjectType,
|
|
2228
|
+
value: this.convertDataToHasura(this.model.toInstance(plainData), true),
|
|
2229
|
+
required: true,
|
|
2230
|
+
},
|
|
2231
|
+
pk_columns: { type: this.updateGraphQLPKType, value: this.getUpdateModelKeys(plainData), required: true },
|
|
2232
|
+
});
|
|
2233
|
+
return this.model.toInstance(plainData);
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
paramsToPlain(params) {
|
|
2237
|
+
const model = this.model;
|
|
2238
|
+
if (model.isModel(params))
|
|
2239
|
+
return params.toPlain();
|
|
2240
|
+
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), (params[currentKey] !== undefined && { [currentKey]: getValueByAction(params[currentKey]) }))), {});
|
|
2241
|
+
}
|
|
2242
|
+
getUpdateModelKeys(data) {
|
|
2243
|
+
const instance = this.model.toInstance(data);
|
|
2244
|
+
return this.model.identifiersFields.reduce((ids, identifier) => {
|
|
2245
|
+
var _a;
|
|
2246
|
+
if (isNil(instance[identifier]))
|
|
2247
|
+
return ids;
|
|
2248
|
+
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
2249
|
+
const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[identifier.toString()], instance)) || data[columnOption.attributeName];
|
|
2250
|
+
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: value });
|
|
2251
|
+
}, {});
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
};
|
|
2255
|
+
|
|
2256
|
+
const withGetHasuraGraphQL = (MixinBase) => {
|
|
2257
|
+
return class GetHasuraGraphQLMixin extends MixinBase {
|
|
2258
|
+
constructor(...params) {
|
|
2259
|
+
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
2260
|
+
super(...params);
|
|
2261
|
+
this.getGraphQLOperation = (options === null || options === void 0 ? void 0 : options.getGraphQLOperation) || `${this.tableName}_by_pk`;
|
|
2262
|
+
}
|
|
2263
|
+
get(identifiers) {
|
|
2264
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2265
|
+
const instance = this.model.toInstance(identifiers);
|
|
2266
|
+
const result = yield this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce((ids, identifier) => {
|
|
2267
|
+
var _a;
|
|
2268
|
+
if (isNil(instance[identifier]))
|
|
2269
|
+
return ids;
|
|
2270
|
+
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
2271
|
+
const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, identifiers[identifier.toString()], instance)) || identifiers[identifier.toString()];
|
|
2272
|
+
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: {
|
|
2273
|
+
type: this.getAttributeGraphQLTypeOf(columnOption.type || value),
|
|
2274
|
+
value,
|
|
2275
|
+
required: true,
|
|
2276
|
+
} });
|
|
2277
|
+
}, {}));
|
|
2278
|
+
const data = result[this.getGraphQLOperation];
|
|
2279
|
+
if (isNil(data))
|
|
2280
|
+
throw new NotFoundError(`${instance.constructor.name} not found`);
|
|
2281
|
+
return this.convertDataFromHasura(result[this.getGraphQLOperation]);
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
};
|
|
2285
|
+
};
|
|
2286
|
+
|
|
2287
|
+
var HasuraGraphQLWhere;
|
|
2288
|
+
(function (HasuraGraphQLWhere) {
|
|
2289
|
+
HasuraGraphQLWhere["EQUALS"] = "_eq";
|
|
2290
|
+
HasuraGraphQLWhere["GT"] = "_gt";
|
|
2291
|
+
HasuraGraphQLWhere["GTE"] = "_gte";
|
|
2292
|
+
HasuraGraphQLWhere["IN"] = "_in";
|
|
2293
|
+
HasuraGraphQLWhere["NOTIN"] = "_nin";
|
|
2294
|
+
HasuraGraphQLWhere["LT"] = "_lt";
|
|
2295
|
+
HasuraGraphQLWhere["LTE"] = "_lte";
|
|
2296
|
+
HasuraGraphQLWhere["LIKE"] = "_like";
|
|
2297
|
+
HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
|
|
2298
|
+
HasuraGraphQLWhere["ISNULL"] = "_is_null";
|
|
2299
|
+
HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
|
|
2300
|
+
})(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
|
|
2301
|
+
|
|
2302
|
+
var HasuraGraphQLColumnType;
|
|
2303
|
+
(function (HasuraGraphQLColumnType) {
|
|
2304
|
+
HasuraGraphQLColumnType["Int"] = "Int";
|
|
2305
|
+
HasuraGraphQLColumnType["Float"] = "Float";
|
|
2306
|
+
HasuraGraphQLColumnType["Boolean"] = "Boolean";
|
|
2307
|
+
HasuraGraphQLColumnType["String"] = "String";
|
|
2308
|
+
HasuraGraphQLColumnType["DateTime"] = "timestampz";
|
|
2309
|
+
HasuraGraphQLColumnType["Json"] = "json";
|
|
2310
|
+
HasuraGraphQLColumnType["Jsonb"] = "jsonb";
|
|
2311
|
+
HasuraGraphQLColumnType["Enum"] = "enum";
|
|
2312
|
+
HasuraGraphQLColumnType["Uuid"] = "uuid";
|
|
2313
|
+
})(HasuraGraphQLColumnType || (HasuraGraphQLColumnType = {}));
|
|
2314
|
+
|
|
2315
|
+
const withFindHasuraGraphQL = (MixinBase) => {
|
|
2316
|
+
return class FindHasuraGraphQLMixin extends MixinBase {
|
|
2317
|
+
constructor() {
|
|
2318
|
+
super(...arguments);
|
|
2319
|
+
this.makeGraphQLWhere = (filter, fields) => Object.keys(filter).reduce((variables, fieldName) => {
|
|
2320
|
+
const columnOption = AttributeOptionHelper.FindByAttribute(fieldName, fields);
|
|
2321
|
+
if (!columnOption.bindFindFilter)
|
|
2322
|
+
return Object.assign(Object.assign({}, variables), { [columnOption.columnName]: this.buildWhereSentence(fieldName, filter[fieldName], fields) });
|
|
2323
|
+
const builtFilter = columnOption.bindFindFilter(filter[fieldName]);
|
|
2324
|
+
return Object.assign(Object.assign({}, variables), Object.keys(builtFilter).reduce((variablesList, columnName) => (Object.assign(Object.assign({}, variablesList), { [columnName]: this.buildWhereSentence(fieldName, builtFilter[columnName], fields) })), {}));
|
|
2325
|
+
}, {});
|
|
2326
|
+
this.buildWhereSentence = (field, options, fields) => {
|
|
2327
|
+
const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
|
|
2328
|
+
if (!Array.isArray(options) &&
|
|
2329
|
+
isObject(options) &&
|
|
2330
|
+
isNil(options === null || options === void 0 ? void 0 : options.operator) &&
|
|
2331
|
+
isNil(options === null || options === void 0 ? void 0 : options.value) &&
|
|
2332
|
+
isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to))
|
|
2333
|
+
return Object.keys(options).reduce((variables, key) => {
|
|
2334
|
+
const fieldOptions = AttributeOptionHelper.FindByAttribute(key, (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || fields);
|
|
2335
|
+
const columnName = fieldOptions.columnName;
|
|
2336
|
+
const columnFields = fieldOptions.fields;
|
|
2337
|
+
return Object.assign(Object.assign({}, variables), { [columnName]: this.buildWhereSentence(key, options[key], columnFields || []) });
|
|
2338
|
+
}, {});
|
|
2339
|
+
if (!Array.isArray(options) && !isNil(fieldSentenceOptions.fields))
|
|
2340
|
+
return {
|
|
2341
|
+
[fieldSentenceOptions.fields[0]]: this.buildOperatorSentence(options, fieldSentenceOptions),
|
|
2342
|
+
};
|
|
2343
|
+
if (isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
|
|
2344
|
+
options = Object.values(options)[0];
|
|
2345
|
+
return Array.isArray(options)
|
|
2346
|
+
? options.reduce((whereSentence, option) => (Object.assign(Object.assign({}, whereSentence), this.buildOperatorSentence(option, fieldSentenceOptions))), {})
|
|
2347
|
+
: this.buildOperatorSentence(options, fieldSentenceOptions);
|
|
2348
|
+
};
|
|
2349
|
+
this.buildOperatorSentence = (options, fieldOption) => ({
|
|
2350
|
+
[this.getHasuraOperator(options, fieldOption)]: FilterOptionHelper.GetValueFromFilter(options, fieldOption),
|
|
2351
|
+
});
|
|
2352
|
+
this.getHasuraOperator = (options, fieldOption) => FilterOptionHelper.CheckIfIsFilterOption(options)
|
|
2353
|
+
? fieldOption.type === HasuraGraphQLColumnType.Jsonb
|
|
2354
|
+
? this.getHasuraJsonbOperator(options)
|
|
2355
|
+
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator === Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))]
|
|
2356
|
+
: HasuraGraphQLWhere.EQUALS;
|
|
2357
|
+
this.getHasuraJsonbOperator = (options) => options.operator === Where.IN
|
|
2358
|
+
? '_contains'
|
|
2359
|
+
: options.operator === Where.LIKE
|
|
2360
|
+
? '_has_keys_any'
|
|
2361
|
+
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator === Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))];
|
|
2362
|
+
}
|
|
2363
|
+
find(options) {
|
|
2364
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2365
|
+
const { filters, limits, orderBy } = options || {};
|
|
2366
|
+
const variablesCount = Object.assign(Object.assign({}, (isNil(orderBy) ? {} : { order_by: { type: `${this.tableName}_order_by!`, list: true, value: orderBy } })), (isNil(filters)
|
|
2367
|
+
? {}
|
|
2368
|
+
: {
|
|
2369
|
+
where: {
|
|
2370
|
+
value: this.makeGraphQLWhere(filters, this.fields),
|
|
2371
|
+
type: `${this.tableName}_bool_exp`,
|
|
2372
|
+
required: true,
|
|
2373
|
+
},
|
|
2374
|
+
}));
|
|
2375
|
+
const variables = Object.assign(Object.assign({}, (isNil(limits) ? {} : limits)), variablesCount);
|
|
2376
|
+
const result = yield this.query([
|
|
2377
|
+
{
|
|
2378
|
+
operation: this.tableName,
|
|
2379
|
+
fields: options.fields
|
|
2380
|
+
? options.fields
|
|
2381
|
+
.map((fieldName) => {
|
|
2382
|
+
var _a;
|
|
2383
|
+
return (_a = this.fields.find((fieldOption) => fieldOption === fieldName)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName);
|
|
2384
|
+
})
|
|
2385
|
+
.filter(Boolean)
|
|
2386
|
+
: this.fields,
|
|
2387
|
+
variables,
|
|
2388
|
+
},
|
|
2389
|
+
{
|
|
2390
|
+
operation: `${this.tableName}_aggregate`,
|
|
2391
|
+
fields: [{ aggregate: ['count'] }],
|
|
2392
|
+
variables: variablesCount,
|
|
2393
|
+
},
|
|
2394
|
+
]);
|
|
2395
|
+
const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
|
|
2396
|
+
const count = result[`${this.tableName}_aggregate`].aggregate.count;
|
|
2397
|
+
return { count, data };
|
|
2398
|
+
});
|
|
2399
|
+
}
|
|
2400
|
+
};
|
|
2401
|
+
};
|
|
2402
|
+
|
|
2403
|
+
const withCrudHasuraGraphQL = (MixinBase) => {
|
|
2404
|
+
return class CrudHasuraGraphQLMixin extends withUpdateHasuraGraphQL(withGetHasuraGraphQL(withFindHasuraGraphQL(withDeleteHasuraGraphQL(withCreateHasuraGraphQL(MixinBase))))) {
|
|
2405
|
+
};
|
|
2406
|
+
};
|
|
2407
|
+
|
|
2408
|
+
class CategoryHasuraGraphQL extends Category {
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
class ProductHasuraGraphQL extends Product {
|
|
2412
|
+
}
|
|
2413
|
+
__decorate([
|
|
2414
|
+
Type(() => KitProductHasuraGraphQL),
|
|
2415
|
+
__metadata("design:type", Array)
|
|
2416
|
+
], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
|
|
2417
|
+
|
|
2418
|
+
class KitProductHasuraGraphQL extends KitProduct {
|
|
2419
|
+
}
|
|
2420
|
+
__decorate([
|
|
2421
|
+
Type(() => ProductHasuraGraphQL),
|
|
2422
|
+
__metadata("design:type", ProductHasuraGraphQL)
|
|
2423
|
+
], KitProductHasuraGraphQL.prototype, "kit", void 0);
|
|
2424
|
+
__decorate([
|
|
2425
|
+
Type(() => ProductHasuraGraphQL),
|
|
2426
|
+
__metadata("design:type", ProductHasuraGraphQL)
|
|
2427
|
+
], KitProductHasuraGraphQL.prototype, "product", void 0);
|
|
2428
|
+
|
|
2429
|
+
class VariantHasuraGraphQL extends Variant {
|
|
2430
|
+
constructor() {
|
|
2431
|
+
super(...arguments);
|
|
2432
|
+
this.name = '';
|
|
2433
|
+
this.hasVariants = false;
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2438
|
+
constructor(endpoint, authOptions, productRepository) {
|
|
2439
|
+
super({
|
|
2440
|
+
tableName: 'category',
|
|
2441
|
+
model: Category,
|
|
2442
|
+
endpoint,
|
|
2443
|
+
authOptions,
|
|
2444
|
+
fields: [
|
|
2445
|
+
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
2446
|
+
{ firestoreId: { columnName: 'firestore_id' } },
|
|
2447
|
+
'name',
|
|
2448
|
+
'description',
|
|
2449
|
+
'image',
|
|
2450
|
+
'published',
|
|
2451
|
+
'shop',
|
|
2452
|
+
'slug',
|
|
2453
|
+
{ brandCategory: { columnName: 'brand_category' } },
|
|
2454
|
+
{ brandCategoryBanner: { columnName: 'brand_banner' } },
|
|
2455
|
+
{ brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
|
|
2456
|
+
{ brandLogo: { columnName: 'brand_logo' } },
|
|
2457
|
+
{ brandCondition: { columnName: 'brand_condition' } },
|
|
2458
|
+
{
|
|
2459
|
+
conditions: {
|
|
2460
|
+
columnName: 'tag_condition',
|
|
2461
|
+
type: HasuraGraphQLColumnType.Jsonb,
|
|
2462
|
+
from: (tags, row) => ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }),
|
|
2463
|
+
bindPersistData: (value) => {
|
|
2464
|
+
var _a, _b;
|
|
2465
|
+
return {
|
|
2466
|
+
brand_condition: value.brand,
|
|
2467
|
+
tag_condition: `{"${((_b = (_a = value === null || value === void 0 ? void 0 : value.tags) === null || _a === void 0 ? void 0 : _a.join) === null || _b === void 0 ? void 0 : _b.call(_a, '","')) || ''}"}`,
|
|
2468
|
+
};
|
|
2469
|
+
},
|
|
2470
|
+
bindFindFilter: (sentence) => {
|
|
2471
|
+
return Object.assign(Object.assign({}, (sentence.brand ? { brand_condition: sentence.brand } : {})), (sentence.tags ? { tag_condition: sentence.tags } : {}));
|
|
2472
|
+
},
|
|
2473
|
+
},
|
|
2474
|
+
},
|
|
2475
|
+
'filters',
|
|
2476
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
2477
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
2478
|
+
{
|
|
2479
|
+
products: {
|
|
2480
|
+
columnName: 'products',
|
|
2481
|
+
fields: ['product_id'],
|
|
2482
|
+
from: (value) => value.map((product) => product.product_id.toString()),
|
|
2483
|
+
to: (productIds) => productIds.map((productId) => ({
|
|
2484
|
+
product_id: +productId,
|
|
2485
|
+
})),
|
|
2486
|
+
},
|
|
2487
|
+
},
|
|
2488
|
+
],
|
|
2489
|
+
});
|
|
2490
|
+
this.productRepository = productRepository;
|
|
2491
|
+
}
|
|
2492
|
+
get(identifiers) {
|
|
2493
|
+
const _super = Object.create(null, {
|
|
2494
|
+
get: { get: () => super.get }
|
|
2495
|
+
});
|
|
2496
|
+
var _a;
|
|
2497
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2498
|
+
return Number.isNaN(+identifiers.id)
|
|
2499
|
+
? (_a = (yield this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
2500
|
+
: _super.get.call(this, identifiers);
|
|
2501
|
+
});
|
|
2502
|
+
}
|
|
2503
|
+
getCategoryBySlug(slug, shop) {
|
|
2504
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2505
|
+
if (!slug)
|
|
2506
|
+
return;
|
|
2507
|
+
const { data, count } = yield this.find({ filters: { slug, shop, published: true } });
|
|
2508
|
+
if (count > 1)
|
|
2509
|
+
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
2510
|
+
if (!count)
|
|
2511
|
+
throw new NotFoundError(`Category with slug ${slug} not found`);
|
|
2512
|
+
return data.shift();
|
|
2513
|
+
});
|
|
2514
|
+
}
|
|
2515
|
+
getCategoriesForHome(categoryIds, limit = 4) {
|
|
2516
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2517
|
+
const { data: categories, count } = yield this.find({
|
|
2518
|
+
filters: { firestoreId: { operator: Where.IN, value: categoryIds.filter(Boolean) }, published: true },
|
|
2519
|
+
});
|
|
2520
|
+
if (!count)
|
|
2521
|
+
throw new NotFoundError('Categories not found');
|
|
2522
|
+
const homeSections = yield Promise.all(categories.map((category) => __awaiter(this, void 0, void 0, function* () {
|
|
2523
|
+
return ({
|
|
2524
|
+
category,
|
|
2525
|
+
products: yield this.mountCategory(category, { limit, hasStock: true }),
|
|
2526
|
+
});
|
|
2527
|
+
})));
|
|
2528
|
+
return homeSections;
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
mountCategory(category, options) {
|
|
2532
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2533
|
+
if (!category.products)
|
|
2534
|
+
throw new RequiredArgumentError(['Category products is empty']);
|
|
2535
|
+
const products = [];
|
|
2536
|
+
const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
2537
|
+
const { data: productsData } = yield this.productRepository.find(Object.assign({ filters: Object.assign({ id: { operator: Where.IN, value: category.products }, [publishedField]: true }, ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {})), fields: [
|
|
2538
|
+
'id',
|
|
2539
|
+
'name',
|
|
2540
|
+
'slug',
|
|
2541
|
+
'images',
|
|
2542
|
+
'miniatures',
|
|
2543
|
+
'price',
|
|
2544
|
+
'fullPrice',
|
|
2545
|
+
'subscriberDiscountPercentage',
|
|
2546
|
+
'subscriberPrice',
|
|
2547
|
+
'stock',
|
|
2548
|
+
'published',
|
|
2549
|
+
'publishedGlam',
|
|
2550
|
+
'CEST',
|
|
2551
|
+
'EAN',
|
|
2552
|
+
'NCM',
|
|
2553
|
+
'brand',
|
|
2554
|
+
'costPrice',
|
|
2555
|
+
'hasVariants',
|
|
2556
|
+
'isKit',
|
|
2557
|
+
'shopAvailability',
|
|
2558
|
+
'sku',
|
|
2559
|
+
'rate',
|
|
2560
|
+
] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})));
|
|
2561
|
+
products.push(...productsData);
|
|
2562
|
+
return products;
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2568
|
+
constructor(endpoint, authOptions) {
|
|
2569
|
+
super({
|
|
2570
|
+
tableName: 'product',
|
|
2571
|
+
model: ProductHasuraGraphQL,
|
|
2572
|
+
endpoint,
|
|
2573
|
+
authOptions,
|
|
2574
|
+
fields: [],
|
|
2575
|
+
});
|
|
2576
|
+
this.bindReviewToModel = (plain) => (Object.assign(Object.assign({}, omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id'])), { createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at, updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at, personId: plain.person_id, orderId: plain.order_id }));
|
|
2577
|
+
this.bindReviewToHasura = (review) => (Object.assign(Object.assign({}, omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId'])), { person_id: review.personId, order_id: review.orderId }));
|
|
2578
|
+
const commonFields = [
|
|
2579
|
+
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
2580
|
+
{ firestoreId: { columnName: 'firestore_id' } },
|
|
2581
|
+
{ CEST: { columnName: 'cest' } },
|
|
2582
|
+
{ EAN: { columnName: 'ean' } },
|
|
2583
|
+
{ NCM: { columnName: 'ncm' } },
|
|
2584
|
+
'brand',
|
|
2585
|
+
{ costPrice: { columnName: 'cost_price' } },
|
|
2586
|
+
{
|
|
2587
|
+
description: {
|
|
2588
|
+
columnName: 'description',
|
|
2589
|
+
from: (description) => Object.values(Shops).reduce((shops, shop) => (Object.assign(Object.assign({}, shops), { [shop]: { description } })), {}),
|
|
2590
|
+
to: (value) => Object.values(value).shift().description,
|
|
2591
|
+
},
|
|
2592
|
+
},
|
|
2593
|
+
{ hasVariants: { columnName: 'has_variants' } },
|
|
2594
|
+
{ images: { columnName: 'images', to: (value) => { var _a; return `{"${((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, `","`)) || ''}"}`; } } },
|
|
2595
|
+
{ miniatures: { columnName: 'miniatures', to: (value) => { var _a; return `{"${((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, `","`)) || ''}"}`; } } },
|
|
2596
|
+
'name',
|
|
2597
|
+
{
|
|
2598
|
+
price: {
|
|
2599
|
+
columnName: 'price',
|
|
2600
|
+
from: (price, data) => Object.values(Shops).reduce((prices, shop) => (Object.assign(Object.assign({}, prices), { [shop]: {
|
|
2601
|
+
price,
|
|
2602
|
+
fullPrice: data.full_price,
|
|
2603
|
+
subscriberDiscountPercentage: data.subscriber_discount_percentage,
|
|
2604
|
+
subscriberPrice: data.subscriber_price,
|
|
2605
|
+
} })), {}),
|
|
2606
|
+
bindFindFilter: (sentence) => {
|
|
2607
|
+
const filters = Object.values(sentence).shift();
|
|
2608
|
+
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) && {
|
|
2609
|
+
subscriber_discount_percentage: filters.subscriberDiscountPercentage,
|
|
2610
|
+
})), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
2611
|
+
subscriber_price: filters.subscriberPrice,
|
|
2612
|
+
}));
|
|
2613
|
+
},
|
|
2614
|
+
bindPersistData: (value) => {
|
|
2615
|
+
const priceData = Object.values(value).shift();
|
|
2616
|
+
return 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 && {
|
|
2617
|
+
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
2618
|
+
})), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }));
|
|
2619
|
+
},
|
|
2620
|
+
},
|
|
2621
|
+
},
|
|
2622
|
+
{ fullPrice: { columnName: 'full_price' } },
|
|
2623
|
+
{ subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
|
|
2624
|
+
{ subscriberPrice: { columnName: 'subscriber_price' } },
|
|
2625
|
+
'published',
|
|
2626
|
+
{ publishedGlam: { columnName: 'published_glam' } },
|
|
2627
|
+
'sku',
|
|
2628
|
+
{
|
|
2629
|
+
stock: {
|
|
2630
|
+
columnName: 'stock',
|
|
2631
|
+
from: (quantity) => ({ quantity }),
|
|
2632
|
+
to: (value) => (isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity),
|
|
2633
|
+
},
|
|
2634
|
+
},
|
|
2635
|
+
'slug',
|
|
2636
|
+
'type',
|
|
2637
|
+
'video',
|
|
2638
|
+
'weight',
|
|
2639
|
+
{
|
|
2640
|
+
shopAvailability: {
|
|
2641
|
+
columnName: 'shop_availabilities',
|
|
2642
|
+
fields: ['shop'],
|
|
2643
|
+
from: (shop) => (Array.isArray(shop) ? shop.map((row) => row.shop) : []),
|
|
2644
|
+
bindPersistData: (shops) => ({ shop_availabilities: { data: shops.map((shop) => ({ shop })) } }),
|
|
2645
|
+
},
|
|
2646
|
+
},
|
|
2647
|
+
{ tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
|
|
2648
|
+
{ isKit: { columnName: 'is_kit' } },
|
|
2649
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
2650
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
2651
|
+
{
|
|
2652
|
+
rate: {
|
|
2653
|
+
columnName: 'reviews_aggregate',
|
|
2654
|
+
fields: [{ aggregate: [{ avg: ['rate'] }] }],
|
|
2655
|
+
from: (value) => value.aggregate.avg.rate,
|
|
2656
|
+
},
|
|
2657
|
+
},
|
|
2658
|
+
];
|
|
2659
|
+
this.fields = [
|
|
2660
|
+
...commonFields,
|
|
2661
|
+
{
|
|
2662
|
+
categories: {
|
|
2663
|
+
columnName: 'categories',
|
|
2664
|
+
fields: ['category_id'],
|
|
2665
|
+
bindPersistData: (value) => ({
|
|
2666
|
+
categories: { data: value.map((category) => ({ category_id: +category })) },
|
|
2667
|
+
}),
|
|
2668
|
+
to: (categories) => categories.map((categoryId) => +categoryId),
|
|
2669
|
+
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(); })) || [],
|
|
2670
|
+
},
|
|
2671
|
+
},
|
|
2672
|
+
{
|
|
2673
|
+
kitProducts: {
|
|
2674
|
+
columnName: 'kit_products',
|
|
2675
|
+
foreignKeyColumn: { productId: 'id' },
|
|
2676
|
+
fields: [
|
|
2677
|
+
{ productId: { columnName: 'product_id' } },
|
|
2678
|
+
{ kitProductId: { columnName: 'kit_product_id' } },
|
|
2679
|
+
'quantity',
|
|
2680
|
+
{ product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
|
|
2681
|
+
],
|
|
2682
|
+
},
|
|
2683
|
+
},
|
|
2684
|
+
];
|
|
2685
|
+
}
|
|
2686
|
+
get reviewsFields() {
|
|
2687
|
+
return [
|
|
2688
|
+
'id',
|
|
2689
|
+
'shop',
|
|
2690
|
+
'rate',
|
|
2691
|
+
'author',
|
|
2692
|
+
'email',
|
|
2693
|
+
'location',
|
|
2694
|
+
'review',
|
|
2695
|
+
'status',
|
|
2696
|
+
'title',
|
|
2697
|
+
'person_id',
|
|
2698
|
+
'points',
|
|
2699
|
+
'order_id',
|
|
2700
|
+
'created_at',
|
|
2701
|
+
'updated_at',
|
|
2702
|
+
];
|
|
2703
|
+
}
|
|
2704
|
+
create(data) {
|
|
2705
|
+
const _super = Object.create(null, {
|
|
2706
|
+
create: { get: () => super.create }
|
|
2707
|
+
});
|
|
2708
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2709
|
+
const product = yield _super.create.call(this, omit(data, ['reviews']));
|
|
2710
|
+
try {
|
|
2711
|
+
product.reviews = yield this.updateReviews(+product.id, data);
|
|
2712
|
+
}
|
|
2713
|
+
catch (error) {
|
|
2714
|
+
yield this.delete({ id: product.id });
|
|
2715
|
+
throw error;
|
|
2716
|
+
}
|
|
2717
|
+
return product;
|
|
2718
|
+
});
|
|
2719
|
+
}
|
|
2720
|
+
get(identifiers) {
|
|
2721
|
+
const _super = Object.create(null, {
|
|
2722
|
+
get: { get: () => super.get }
|
|
2723
|
+
});
|
|
2724
|
+
var _a;
|
|
2725
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2726
|
+
const product = Number.isNaN(+identifiers.id)
|
|
2727
|
+
? (_a = (yield this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
2728
|
+
: yield _super.get.call(this, identifiers);
|
|
2729
|
+
product.reviews = yield this.findReviewsByProduct(+product.id);
|
|
2730
|
+
return product;
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
getBySlug(slug) {
|
|
2734
|
+
var _a;
|
|
2735
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2736
|
+
const result = yield this.find({
|
|
2737
|
+
filters: {
|
|
2738
|
+
slug,
|
|
2739
|
+
},
|
|
2740
|
+
});
|
|
2741
|
+
const product = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
2742
|
+
product.reviews = yield this.findReviewsByProduct(+product.id);
|
|
2743
|
+
return product;
|
|
2744
|
+
});
|
|
2745
|
+
}
|
|
2746
|
+
update(params) {
|
|
2747
|
+
const _super = Object.create(null, {
|
|
2748
|
+
update: { get: () => super.update }
|
|
2749
|
+
});
|
|
2750
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2751
|
+
const { categories, kitProducts, reviews, id: checkId, shopAvailability, rate } = params, data = __rest(params, ["categories", "kitProducts", "reviews", "id", "shopAvailability", "rate"]);
|
|
2752
|
+
const plainData = this.paramsToPlain({ id: checkId });
|
|
2753
|
+
const id = yield this.getId(plainData.id);
|
|
2754
|
+
const product = yield _super.update.call(this, Object.assign({ id }, data));
|
|
2755
|
+
product.categories = categories && (yield this.updateCategories(+id, { categories }));
|
|
2756
|
+
product.kitProducts = kitProducts && (yield this.updateKitProducts(+id, { kitProducts }));
|
|
2757
|
+
product.reviews = reviews && (yield this.updateReviews(+id, { reviews }));
|
|
2758
|
+
return product;
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2761
|
+
fetchReviews(status) {
|
|
2762
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2763
|
+
const reviews = {
|
|
2764
|
+
status: status === 'pending'
|
|
2765
|
+
? { [HasuraGraphQLWhere.ISNULL]: true }
|
|
2766
|
+
: { [HasuraGraphQLWhere.EQUALS]: status === 'approved' },
|
|
2767
|
+
};
|
|
2768
|
+
const { product: data } = yield this.query('product', ['id', 'name', 'sku', { reviews: { columnName: 'reviews', fields: this.reviewsFields } }], {
|
|
2769
|
+
where: { value: { reviews }, type: 'product_bool_exp', required: true },
|
|
2770
|
+
});
|
|
2771
|
+
return data.reduce((reviews, product) => [
|
|
2772
|
+
...reviews,
|
|
2773
|
+
...product.reviews
|
|
2774
|
+
.filter((review) => (status === 'pending' && [undefined, null].includes(review.status)) ||
|
|
2775
|
+
(status === 'approved' && review.status === true) ||
|
|
2776
|
+
(status === 'rejected' && review.status === false))
|
|
2777
|
+
.map((review) => (Object.assign(Object.assign({}, this.bindReviewToModel(review)), { productId: product.id, productName: product.name, productSku: product.sku }))),
|
|
2778
|
+
], []);
|
|
2779
|
+
});
|
|
2780
|
+
}
|
|
2781
|
+
updateCategories(productId, { categories }) {
|
|
2782
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2783
|
+
const plainData = this.paramsToPlain({ categories });
|
|
2784
|
+
yield this.mutation('delete_category_product', ['affected_rows'], {
|
|
2785
|
+
where: {
|
|
2786
|
+
type: 'category_product_bool_exp',
|
|
2787
|
+
required: true,
|
|
2788
|
+
value: { product_id: { _eq: productId } },
|
|
2789
|
+
},
|
|
2790
|
+
});
|
|
2791
|
+
yield this.mutation('insert_category_product', ['affected_rows'], {
|
|
2792
|
+
objects: {
|
|
2793
|
+
type: '[category_product_insert_input!]',
|
|
2794
|
+
required: true,
|
|
2795
|
+
value: plainData.categories.map((categoryId) => ({ category_id: categoryId, product_id: productId })),
|
|
2796
|
+
},
|
|
2797
|
+
});
|
|
2798
|
+
return plainData.categories;
|
|
2799
|
+
});
|
|
2800
|
+
}
|
|
2801
|
+
updateKitProducts(productId, { kitProducts }) {
|
|
2802
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2803
|
+
const plainData = this.paramsToPlain({ kitProducts });
|
|
2804
|
+
yield this.mutation('delete_product_kit', ['affected_rows'], {
|
|
2805
|
+
where: {
|
|
2806
|
+
type: 'product_kit_bool_exp',
|
|
2807
|
+
required: true,
|
|
2808
|
+
value: { product_id: { _eq: productId } },
|
|
2809
|
+
},
|
|
2810
|
+
});
|
|
2811
|
+
yield this.mutation('insert_product_kit', ['affected_rows'], {
|
|
2812
|
+
objects: {
|
|
2813
|
+
type: '[product_kit_insert_input!]',
|
|
2814
|
+
required: true,
|
|
2815
|
+
value: plainData.kitProducts.map((kitProduct) => ({
|
|
2816
|
+
kit_product_id: kitProduct.productId || kitProduct.product.id,
|
|
2817
|
+
product_id: productId,
|
|
2818
|
+
quantity: kitProduct.quantity,
|
|
2819
|
+
})),
|
|
2820
|
+
},
|
|
2821
|
+
});
|
|
2822
|
+
return plainData.kitProducts;
|
|
2823
|
+
});
|
|
2824
|
+
}
|
|
2825
|
+
updateReviews(productId, { reviews }) {
|
|
2826
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2827
|
+
if (!reviews)
|
|
2828
|
+
return [];
|
|
2829
|
+
if ('action' in reviews && reviews.action === 'remove') {
|
|
2830
|
+
const reviewIds = yield Promise.all(reviews.value.map((reviewData) => __awaiter(this, void 0, void 0, function* () {
|
|
2831
|
+
const review = yield this.findReview(reviewData, productId);
|
|
2832
|
+
return review === null || review === void 0 ? void 0 : review.id;
|
|
2833
|
+
})));
|
|
2834
|
+
yield this.mutation('delete_product_review', ['affected_rows'], {
|
|
2835
|
+
where: { value: { id: { _in: reviewIds.filter(Boolean) } }, type: 'product_review_bool_exp', required: true },
|
|
2836
|
+
});
|
|
2837
|
+
return reviews.value.map((review, index) => !reviewIds[index] && review).filter(Boolean);
|
|
2838
|
+
}
|
|
2839
|
+
const plainData = this.paramsToPlain({ reviews });
|
|
2840
|
+
return Promise.all(plainData.reviews.map((reviewData) => __awaiter(this, void 0, void 0, function* () {
|
|
2841
|
+
const review = yield this.findReview(reviewData, productId);
|
|
2842
|
+
if (review.id)
|
|
2843
|
+
return this.bindReviewToModel((yield this.mutation('update_product_review_by_pk', this.reviewsFields, {
|
|
2844
|
+
pk_columns: {
|
|
2845
|
+
value: { id: review.id },
|
|
2846
|
+
type: 'product_review_pk_columns_input',
|
|
2847
|
+
required: true,
|
|
2848
|
+
},
|
|
2849
|
+
_set: {
|
|
2850
|
+
value: omit(this.bindReviewToHasura(reviewData), ['id', 'product_id']),
|
|
2851
|
+
type: 'product_review_set_input',
|
|
2852
|
+
required: true,
|
|
2853
|
+
},
|
|
2854
|
+
})).update_product_review_by_pk);
|
|
2855
|
+
return this.bindReviewToModel((yield this.mutation('insert_product_review_one', this.reviewsFields, {
|
|
2856
|
+
object: {
|
|
2857
|
+
value: omit(Object.assign(Object.assign({}, this.bindReviewToHasura(reviewData)), { product_id: productId }), ['id']),
|
|
2858
|
+
type: 'product_review_insert_input',
|
|
2859
|
+
required: true,
|
|
2860
|
+
},
|
|
2861
|
+
})).insert_product_review_one);
|
|
2862
|
+
})));
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2865
|
+
getId(id) {
|
|
2866
|
+
var _a, _b;
|
|
2867
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2868
|
+
if (!Number.isNaN(+id))
|
|
2869
|
+
return id;
|
|
2870
|
+
const { data } = yield this.find({ filters: { firestoreId: id } });
|
|
2871
|
+
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
2872
|
+
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
2873
|
+
throw new NotFoundError(`Product with id ${id} not found`);
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2876
|
+
findReviewsByProduct(productId) {
|
|
2877
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2878
|
+
const { product_review: data } = yield this.query('product_review', this.reviewsFields, {
|
|
2879
|
+
where: {
|
|
2880
|
+
value: {
|
|
2881
|
+
product_id: { _eq: productId },
|
|
2882
|
+
},
|
|
2883
|
+
type: 'product_review_bool_exp',
|
|
2884
|
+
required: true,
|
|
2885
|
+
},
|
|
2886
|
+
});
|
|
2887
|
+
return data && data.map((review) => this.bindReviewToModel(review));
|
|
2888
|
+
});
|
|
2889
|
+
}
|
|
2890
|
+
findReview(review, productId) {
|
|
2891
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2892
|
+
if (review.id)
|
|
2893
|
+
return review;
|
|
2894
|
+
let loadedReview;
|
|
2895
|
+
if (review.personId)
|
|
2896
|
+
loadedReview = yield this.getReviewByPersonId(review.personId, productId);
|
|
2897
|
+
if (!loadedReview && review.author && review.email)
|
|
2898
|
+
loadedReview = yield this.getReviewByAuthorAndEmail(review.author, review.email, productId);
|
|
2899
|
+
return loadedReview || review;
|
|
2900
|
+
});
|
|
2901
|
+
}
|
|
2902
|
+
getReviewByPersonId(personId, productId) {
|
|
2903
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2904
|
+
const { product_review: data } = yield this.query('product_review', this.reviewsFields, {
|
|
2905
|
+
where: {
|
|
2906
|
+
value: {
|
|
2907
|
+
product_id: { _eq: productId },
|
|
2908
|
+
person_id: { _eq: personId },
|
|
2909
|
+
},
|
|
2910
|
+
type: `product_review_bool_exp`,
|
|
2911
|
+
required: true,
|
|
2912
|
+
},
|
|
2913
|
+
});
|
|
2914
|
+
return data && data[0] && this.bindReviewToModel(data[0]);
|
|
2915
|
+
});
|
|
2916
|
+
}
|
|
2917
|
+
getReviewByAuthorAndEmail(author, email, productId) {
|
|
2918
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2919
|
+
const { product_review: data } = yield this.query('product_review', this.reviewsFields, {
|
|
2920
|
+
where: {
|
|
2921
|
+
value: {
|
|
2922
|
+
product_id: { _eq: productId },
|
|
2923
|
+
author: { _eq: author },
|
|
2924
|
+
email: { _eq: email },
|
|
2925
|
+
},
|
|
2926
|
+
type: `product_review_bool_exp`,
|
|
2927
|
+
required: true,
|
|
2928
|
+
},
|
|
2929
|
+
});
|
|
2930
|
+
return data && data[0] && this.bindReviewToModel(data[0]);
|
|
2931
|
+
});
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2936
|
+
constructor(endpoint, authOptions) {
|
|
2937
|
+
super({
|
|
2938
|
+
tableName: 'product',
|
|
2939
|
+
model: VariantHasuraGraphQL,
|
|
2940
|
+
endpoint,
|
|
2941
|
+
authOptions,
|
|
2942
|
+
fields: [
|
|
2943
|
+
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
2944
|
+
{ firestoreId: { columnName: 'firestore_id' } },
|
|
2945
|
+
{ productId: { columnName: 'main_product_id', to: (value) => +value, from: (value) => value === null || value === void 0 ? void 0 : value.toString() } },
|
|
2946
|
+
{ EAN: { columnName: 'ean' } },
|
|
2947
|
+
{ costPrice: { columnName: 'cost_price' } },
|
|
2948
|
+
{
|
|
2949
|
+
price: {
|
|
2950
|
+
columnName: 'price',
|
|
2951
|
+
from: (price, data) => Object.values(Shops).reduce((prices, shop) => (Object.assign(Object.assign({}, prices), { [shop]: {
|
|
2952
|
+
price,
|
|
2953
|
+
fullPrice: data.full_price,
|
|
2954
|
+
subscriberDiscountPercentage: data.subscriber_discount_percentage,
|
|
2955
|
+
subscriberPrice: data.subscriber_price,
|
|
2956
|
+
} })), {}),
|
|
2957
|
+
bindFindFilter: (sentence) => {
|
|
2958
|
+
const filters = Object.values(sentence).shift();
|
|
2959
|
+
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) && {
|
|
2960
|
+
subscriber_discount_percentage: filters.subscriberDiscountPercentage,
|
|
2961
|
+
})), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
2962
|
+
subscriber_price: filters.subscriberPrice,
|
|
2963
|
+
}));
|
|
2964
|
+
},
|
|
2965
|
+
bindPersistData: (value) => {
|
|
2966
|
+
const priceData = Object.values(value).shift();
|
|
2967
|
+
return 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 && {
|
|
2968
|
+
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
2969
|
+
})), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }));
|
|
2970
|
+
},
|
|
2971
|
+
},
|
|
2972
|
+
},
|
|
2973
|
+
{ fullPrice: { columnName: 'full_price' } },
|
|
2974
|
+
{ subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
|
|
2975
|
+
{ subscriberPrice: { columnName: 'subscriber_price' } },
|
|
2976
|
+
'sku',
|
|
2977
|
+
{
|
|
2978
|
+
stock: {
|
|
2979
|
+
columnName: 'stock',
|
|
2980
|
+
from: (quantity) => ({ quantity }),
|
|
2981
|
+
to: (value) => (isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity),
|
|
2982
|
+
},
|
|
2983
|
+
},
|
|
2984
|
+
'weight',
|
|
2985
|
+
{ name: { to: () => '', from: () => undefined } },
|
|
2986
|
+
{ hasVariants: { columnName: 'has_variants', to: () => false, from: () => undefined } },
|
|
2987
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
2988
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
2989
|
+
],
|
|
2990
|
+
});
|
|
2991
|
+
}
|
|
2992
|
+
get(identifiers) {
|
|
2993
|
+
const _super = Object.create(null, {
|
|
2994
|
+
get: { get: () => super.get }
|
|
2995
|
+
});
|
|
2996
|
+
var _a;
|
|
2997
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2998
|
+
return Number.isNaN(+identifiers.id)
|
|
2999
|
+
? (_a = (yield this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
3000
|
+
: _super.get.call(this, identifiers);
|
|
3001
|
+
});
|
|
3002
|
+
}
|
|
3003
|
+
update(params) {
|
|
3004
|
+
const _super = Object.create(null, {
|
|
3005
|
+
update: { get: () => super.update }
|
|
3006
|
+
});
|
|
3007
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3008
|
+
const { productId, id: checkId } = params, data = __rest(params, ["productId", "id"]);
|
|
3009
|
+
const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
|
|
3010
|
+
const id = yield this.getId(dataWithProductId.id);
|
|
3011
|
+
const product = yield _super.update.call(this, Object.assign({ id }, data));
|
|
3012
|
+
product.productId = dataWithProductId.productId;
|
|
3013
|
+
return product;
|
|
3014
|
+
});
|
|
3015
|
+
}
|
|
3016
|
+
getId(id) {
|
|
3017
|
+
var _a, _b;
|
|
3018
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3019
|
+
if (!Number.isNaN(+id))
|
|
3020
|
+
return id;
|
|
3021
|
+
const { data } = yield this.find({ filters: { firestoreId: id } });
|
|
3022
|
+
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
3023
|
+
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
3024
|
+
throw new NotFoundError(`Product with id ${id} not found`);
|
|
3025
|
+
});
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
|
|
1801
3029
|
/**
|
|
1802
3030
|
* Generated bundle index. Do not edit.
|
|
1803
3031
|
*/
|
|
1804
3032
|
|
|
1805
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes,
|
|
3033
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, FilterType, FinancialCoupon, FragranceImportances, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserSearchFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
1806
3034
|
//# sourceMappingURL=infrab4a-connect.js.map
|