@infrab4a/connect 1.0.0-beta.8 → 1.0.0-beta.9
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 +1148 -182
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/category.d.ts +3 -2
- package/domain/catalog/models/product.d.ts +3 -2
- package/domain/catalog/models/variant.d.ts +4 -2
- package/domain/catalog/repositories/category.repository.d.ts +1 -1
- package/domain/catalog/repositories/product.repository.d.ts +1 -1
- 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 +5 -0
- package/domain/{general → generic}/repository/enums/where.enum.d.ts +5 -2
- package/domain/generic/repository/find.repository.d.ts +10 -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 +2 -2
- 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/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/esm2015/domain/catalog/models/category.js +5 -2
- package/esm2015/domain/catalog/models/product.js +5 -2
- 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 -15
- 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/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/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 +8 -9
- package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +1 -4
- 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/product-firestore.repository.js +7 -5
- 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 +4 -0
- package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +15 -0
- package/esm2015/infra/hasura-graphql/mixins/helpers/index.js +2 -0
- package/esm2015/infra/hasura-graphql/mixins/index.js +8 -0
- package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +26 -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 +21 -0
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +95 -0
- package/esm2015/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.js +31 -0
- package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +168 -0
- package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +45 -0
- package/esm2015/infra/hasura-graphql/models/category-hasura-graphql.js +4 -0
- package/esm2015/infra/hasura-graphql/models/index.js +2 -0
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +104 -0
- package/esm2015/infra/hasura-graphql/repositories/catalog/index.js +3 -0
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +86 -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/index.js +8 -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 +729 -120
- package/fesm2015/infrab4a-connect.js.map +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 +1 -42
- 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 +3 -0
- package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +10 -0
- package/infra/hasura-graphql/mixins/helpers/index.d.ts +1 -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 +30 -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 +4 -0
- package/infra/hasura-graphql/models/index.d.ts +1 -0
- package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +22 -0
- package/infra/hasura-graphql/repositories/catalog/index.d.ts +2 -0
- package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +10 -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 +40 -0
- package/infra/hasura-graphql/types/index.d.ts +7 -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 +2 -1
- 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,24 +1,47 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('axios'), require('firebase'), require('firebase/app')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'axios', 'firebase', 'firebase/app'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global.axios, global.firebase, global.firebase$1));
|
|
5
|
-
})(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, axios, firebase, firebase$1) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('ts-md5'), require('axios'), require('firebase'), require('firebase/app'), require('gql-query-builder'), require('node-fetch')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-md5', 'axios', 'firebase', 'firebase/app', 'gql-query-builder', 'node-fetch'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global.tsMd5, global.axios, global.firebase, global.firebase$1, global["gql-query-builder"], global.fetch));
|
|
5
|
+
})(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsMd5, axios, firebase, firebase$1, gqlQueryBuilder, fetch) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
9
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
10
10
|
var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
|
|
11
11
|
var firebase__default$1 = /*#__PURE__*/_interopDefaultLegacy(firebase$1);
|
|
12
|
+
var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
|
|
12
13
|
|
|
13
14
|
var BaseModel = /** @class */ (function () {
|
|
14
15
|
function BaseModel(args) {
|
|
15
16
|
Object.assign(this, args);
|
|
16
17
|
}
|
|
18
|
+
Object.defineProperty(BaseModel.prototype, "identifier", {
|
|
19
|
+
get: function () {
|
|
20
|
+
var _this = this;
|
|
21
|
+
var fields = this.constructor.identifiersFields.filter(function (field) { return field !== 'identifier'; });
|
|
22
|
+
return fields.reduce(function (object, field) {
|
|
23
|
+
var _a;
|
|
24
|
+
return (Object.assign(Object.assign({}, object), (_a = {}, _a[field] = _this[field], _a)));
|
|
25
|
+
}, {});
|
|
26
|
+
},
|
|
27
|
+
enumerable: false,
|
|
28
|
+
configurable: true
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(BaseModel.prototype, "identifiersFields", {
|
|
31
|
+
get: function () {
|
|
32
|
+
return this.constructor.identifiersFields;
|
|
33
|
+
},
|
|
34
|
+
enumerable: false,
|
|
35
|
+
configurable: true
|
|
36
|
+
});
|
|
17
37
|
BaseModel.toInstance = function (data) {
|
|
18
|
-
return classTransformer.plainToClass(this, data);
|
|
38
|
+
return classTransformer.plainToClass(this, data || {});
|
|
39
|
+
};
|
|
40
|
+
BaseModel.isModel = function (value) {
|
|
41
|
+
return value instanceof this;
|
|
19
42
|
};
|
|
20
43
|
BaseModel.prototype.toPlain = function () {
|
|
21
|
-
return classTransformer.classToPlain(this
|
|
44
|
+
return classTransformer.classToPlain(this);
|
|
22
45
|
};
|
|
23
46
|
return BaseModel;
|
|
24
47
|
}());
|
|
@@ -26,13 +49,16 @@
|
|
|
26
49
|
exports.Where = void 0;
|
|
27
50
|
(function (Where) {
|
|
28
51
|
Where["EQUALS"] = "==";
|
|
29
|
-
Where["NOTEQUALS"] = "!=";
|
|
30
52
|
Where["GT"] = ">";
|
|
31
53
|
Where["GTE"] = ">=";
|
|
32
54
|
Where["IN"] = "in";
|
|
55
|
+
Where["NOTIN"] = "not in";
|
|
33
56
|
Where["LT"] = "<";
|
|
34
57
|
Where["LTE"] = "<=";
|
|
35
58
|
Where["LIKE"] = "like";
|
|
59
|
+
Where["NOTLIKE"] = "not like";
|
|
60
|
+
Where["ISNULL"] = "is null";
|
|
61
|
+
Where["ISNOTNULL"] = "is not null";
|
|
36
62
|
})(exports.Where || (exports.Where = {}));
|
|
37
63
|
|
|
38
64
|
exports.UpdateOptionActions = void 0;
|
|
@@ -587,9 +613,13 @@
|
|
|
587
613
|
function Edition() {
|
|
588
614
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
589
615
|
}
|
|
590
|
-
Edition
|
|
591
|
-
|
|
592
|
-
|
|
616
|
+
Object.defineProperty(Edition, "identifiersFields", {
|
|
617
|
+
get: function () {
|
|
618
|
+
return ['id', 'subscriptionId'];
|
|
619
|
+
},
|
|
620
|
+
enumerable: false,
|
|
621
|
+
configurable: true
|
|
622
|
+
});
|
|
593
623
|
return Edition;
|
|
594
624
|
}(BaseModel));
|
|
595
625
|
|
|
@@ -598,9 +628,13 @@
|
|
|
598
628
|
function Payment() {
|
|
599
629
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
600
630
|
}
|
|
601
|
-
Payment
|
|
602
|
-
|
|
603
|
-
|
|
631
|
+
Object.defineProperty(Payment, "identifiersFields", {
|
|
632
|
+
get: function () {
|
|
633
|
+
return ['id'];
|
|
634
|
+
},
|
|
635
|
+
enumerable: false,
|
|
636
|
+
configurable: true
|
|
637
|
+
});
|
|
604
638
|
return Payment;
|
|
605
639
|
}(BaseModel));
|
|
606
640
|
__decorate([
|
|
@@ -769,9 +803,13 @@
|
|
|
769
803
|
function SubscriptionPayment() {
|
|
770
804
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
771
805
|
}
|
|
772
|
-
SubscriptionPayment
|
|
773
|
-
|
|
774
|
-
|
|
806
|
+
Object.defineProperty(SubscriptionPayment, "identifiersFields", {
|
|
807
|
+
get: function () {
|
|
808
|
+
return ['id', 'subscriptionId'];
|
|
809
|
+
},
|
|
810
|
+
enumerable: false,
|
|
811
|
+
configurable: true
|
|
812
|
+
});
|
|
775
813
|
return SubscriptionPayment;
|
|
776
814
|
}(BaseModel));
|
|
777
815
|
__decorate([
|
|
@@ -784,6 +822,13 @@
|
|
|
784
822
|
function Address() {
|
|
785
823
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
786
824
|
}
|
|
825
|
+
Object.defineProperty(Address, "identifiersFields", {
|
|
826
|
+
get: function () {
|
|
827
|
+
return ['id'];
|
|
828
|
+
},
|
|
829
|
+
enumerable: false,
|
|
830
|
+
configurable: true
|
|
831
|
+
});
|
|
787
832
|
return Address;
|
|
788
833
|
}(BaseModel));
|
|
789
834
|
|
|
@@ -798,19 +843,19 @@
|
|
|
798
843
|
return Base;
|
|
799
844
|
}());
|
|
800
845
|
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
}
|
|
846
|
+
var isUUID = function (value) { return lodash.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); };
|
|
847
|
+
|
|
848
|
+
var parseDateTime = function (value) {
|
|
849
|
+
if (!lodash.isString(value))
|
|
850
|
+
return value;
|
|
851
|
+
if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
|
|
852
|
+
!/^\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))
|
|
853
|
+
return value;
|
|
854
|
+
var date = dateFns.parseISO(value);
|
|
855
|
+
if (isNaN(date.getTime()))
|
|
856
|
+
return value;
|
|
857
|
+
return date;
|
|
858
|
+
};
|
|
814
859
|
|
|
815
860
|
var Coupon = /** @class */ (function (_super) {
|
|
816
861
|
__extends(Coupon, _super);
|
|
@@ -824,17 +869,13 @@
|
|
|
824
869
|
enumerable: false,
|
|
825
870
|
configurable: true
|
|
826
871
|
});
|
|
827
|
-
Coupon
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
case exports.DiscountType.PERCENTAGE:
|
|
835
|
-
return this.discount * 0.01 * amount;
|
|
836
|
-
}
|
|
837
|
-
};
|
|
872
|
+
Object.defineProperty(Coupon, "identifiersFields", {
|
|
873
|
+
get: function () {
|
|
874
|
+
return ['id'];
|
|
875
|
+
},
|
|
876
|
+
enumerable: false,
|
|
877
|
+
configurable: true
|
|
878
|
+
});
|
|
838
879
|
return Coupon;
|
|
839
880
|
}(BaseModel));
|
|
840
881
|
__decorate([
|
|
@@ -851,9 +892,13 @@
|
|
|
851
892
|
function SubscriptionPlan() {
|
|
852
893
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
853
894
|
}
|
|
854
|
-
SubscriptionPlan
|
|
855
|
-
|
|
856
|
-
|
|
895
|
+
Object.defineProperty(SubscriptionPlan, "identifiersFields", {
|
|
896
|
+
get: function () {
|
|
897
|
+
return ['id'];
|
|
898
|
+
},
|
|
899
|
+
enumerable: false,
|
|
900
|
+
configurable: true
|
|
901
|
+
});
|
|
857
902
|
return SubscriptionPlan;
|
|
858
903
|
}(BaseModel));
|
|
859
904
|
|
|
@@ -867,9 +912,13 @@
|
|
|
867
912
|
delete plain.id;
|
|
868
913
|
return plain;
|
|
869
914
|
};
|
|
870
|
-
BeautyProfile
|
|
871
|
-
|
|
872
|
-
|
|
915
|
+
Object.defineProperty(BeautyProfile, "identifiersFields", {
|
|
916
|
+
get: function () {
|
|
917
|
+
return ['id', 'userId'];
|
|
918
|
+
},
|
|
919
|
+
enumerable: false,
|
|
920
|
+
configurable: true
|
|
921
|
+
});
|
|
873
922
|
return BeautyProfile;
|
|
874
923
|
}(BaseModel));
|
|
875
924
|
|
|
@@ -884,14 +933,18 @@
|
|
|
884
933
|
instance.displayName = "" + data.firstName + (!lodash.isNil(data.lastName) ? " " + data.lastName : '');
|
|
885
934
|
return instance;
|
|
886
935
|
};
|
|
887
|
-
User.prototype.identifierFields = function () {
|
|
888
|
-
return ['id'];
|
|
889
|
-
};
|
|
890
936
|
User.prototype.toPlain = function () {
|
|
891
937
|
var plain = _super.prototype.toPlain.call(this);
|
|
892
938
|
delete plain.beautyProfile;
|
|
893
939
|
return plain;
|
|
894
940
|
};
|
|
941
|
+
Object.defineProperty(User, "identifiersFields", {
|
|
942
|
+
get: function () {
|
|
943
|
+
return ['id'];
|
|
944
|
+
},
|
|
945
|
+
enumerable: false,
|
|
946
|
+
configurable: true
|
|
947
|
+
});
|
|
895
948
|
return User;
|
|
896
949
|
}(BaseModel));
|
|
897
950
|
__decorate([
|
|
@@ -904,9 +957,13 @@
|
|
|
904
957
|
function Subscription() {
|
|
905
958
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
906
959
|
}
|
|
907
|
-
Subscription
|
|
908
|
-
|
|
909
|
-
|
|
960
|
+
Object.defineProperty(Subscription, "identifiersFields", {
|
|
961
|
+
get: function () {
|
|
962
|
+
return ['id'];
|
|
963
|
+
},
|
|
964
|
+
enumerable: false,
|
|
965
|
+
configurable: true
|
|
966
|
+
});
|
|
910
967
|
return Subscription;
|
|
911
968
|
}(BaseModel));
|
|
912
969
|
__decorate([
|
|
@@ -943,9 +1000,13 @@
|
|
|
943
1000
|
function UserAddress() {
|
|
944
1001
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
945
1002
|
}
|
|
946
|
-
UserAddress
|
|
947
|
-
|
|
948
|
-
|
|
1003
|
+
Object.defineProperty(UserAddress, "identifiersFields", {
|
|
1004
|
+
get: function () {
|
|
1005
|
+
return ['id', 'userId'];
|
|
1006
|
+
},
|
|
1007
|
+
enumerable: false,
|
|
1008
|
+
configurable: true
|
|
1009
|
+
});
|
|
949
1010
|
return UserAddress;
|
|
950
1011
|
}(Address));
|
|
951
1012
|
|
|
@@ -954,9 +1015,13 @@
|
|
|
954
1015
|
function UserPaymentMethod() {
|
|
955
1016
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
956
1017
|
}
|
|
957
|
-
UserPaymentMethod
|
|
958
|
-
|
|
959
|
-
|
|
1018
|
+
Object.defineProperty(UserPaymentMethod, "identifiersFields", {
|
|
1019
|
+
get: function () {
|
|
1020
|
+
return ['id', 'userId'];
|
|
1021
|
+
},
|
|
1022
|
+
enumerable: false,
|
|
1023
|
+
configurable: true
|
|
1024
|
+
});
|
|
960
1025
|
return UserPaymentMethod;
|
|
961
1026
|
}(BaseModel));
|
|
962
1027
|
|
|
@@ -965,9 +1030,13 @@
|
|
|
965
1030
|
function Lead() {
|
|
966
1031
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
967
1032
|
}
|
|
968
|
-
Lead
|
|
969
|
-
|
|
970
|
-
|
|
1033
|
+
Object.defineProperty(Lead, "identifiersFields", {
|
|
1034
|
+
get: function () {
|
|
1035
|
+
return ['id'];
|
|
1036
|
+
},
|
|
1037
|
+
enumerable: false,
|
|
1038
|
+
configurable: true
|
|
1039
|
+
});
|
|
971
1040
|
return Lead;
|
|
972
1041
|
}(BaseModel));
|
|
973
1042
|
|
|
@@ -1150,6 +1219,13 @@
|
|
|
1150
1219
|
Category.prototype.identifierFields = function () {
|
|
1151
1220
|
return ['id'];
|
|
1152
1221
|
};
|
|
1222
|
+
Object.defineProperty(Category, "identifiersFields", {
|
|
1223
|
+
get: function () {
|
|
1224
|
+
return ['id'];
|
|
1225
|
+
},
|
|
1226
|
+
enumerable: false,
|
|
1227
|
+
configurable: true
|
|
1228
|
+
});
|
|
1153
1229
|
return Category;
|
|
1154
1230
|
}(BaseModel));
|
|
1155
1231
|
|
|
@@ -1165,6 +1241,13 @@
|
|
|
1165
1241
|
var _a, _b, _c, _d, _e, _f;
|
|
1166
1242
|
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]) || {}));
|
|
1167
1243
|
};
|
|
1244
|
+
Object.defineProperty(Product, "identifiersFields", {
|
|
1245
|
+
get: function () {
|
|
1246
|
+
return ['id'];
|
|
1247
|
+
},
|
|
1248
|
+
enumerable: false,
|
|
1249
|
+
configurable: true
|
|
1250
|
+
});
|
|
1168
1251
|
return Product;
|
|
1169
1252
|
}(BaseModel));
|
|
1170
1253
|
|
|
@@ -1176,52 +1259,69 @@
|
|
|
1176
1259
|
Variant.prototype.identifierFields = function () {
|
|
1177
1260
|
return ['id'];
|
|
1178
1261
|
};
|
|
1262
|
+
Object.defineProperty(Variant, "identifiersFields", {
|
|
1263
|
+
get: function () {
|
|
1264
|
+
return ['id', 'productId'];
|
|
1265
|
+
},
|
|
1266
|
+
enumerable: false,
|
|
1267
|
+
configurable: true
|
|
1268
|
+
});
|
|
1179
1269
|
return Variant;
|
|
1180
1270
|
}(BaseModel));
|
|
1181
1271
|
|
|
1272
|
+
exports.CouponTypes = void 0;
|
|
1273
|
+
(function (CouponTypes) {
|
|
1274
|
+
CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
|
|
1275
|
+
CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
|
|
1276
|
+
CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
|
|
1277
|
+
CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
|
|
1278
|
+
})(exports.CouponTypes || (exports.CouponTypes = {}));
|
|
1279
|
+
|
|
1280
|
+
exports.CouponSubtypes = void 0;
|
|
1281
|
+
(function (CouponSubtypes) {
|
|
1282
|
+
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
1283
|
+
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
1284
|
+
})(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
|
|
1285
|
+
|
|
1286
|
+
exports.Exclusivities = void 0;
|
|
1287
|
+
(function (Exclusivities) {
|
|
1288
|
+
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
1289
|
+
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
1290
|
+
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
1291
|
+
})(exports.Exclusivities || (exports.Exclusivities = {}));
|
|
1292
|
+
|
|
1182
1293
|
exports.CheckoutTypes = void 0;
|
|
1183
1294
|
(function (CheckoutTypes) {
|
|
1184
1295
|
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
1185
1296
|
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
1186
1297
|
})(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
|
|
1187
1298
|
|
|
1188
|
-
var
|
|
1189
|
-
|
|
1190
|
-
|
|
1299
|
+
var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
|
|
1300
|
+
var FinancialCoupon = /** @class */ (function (_super) {
|
|
1301
|
+
__extends(FinancialCoupon, _super);
|
|
1302
|
+
function FinancialCoupon() {
|
|
1191
1303
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
1192
|
-
_this.
|
|
1304
|
+
_this.type = exports.CouponTypes.FINANCIAL;
|
|
1193
1305
|
return _this;
|
|
1194
1306
|
}
|
|
1195
|
-
|
|
1196
|
-
return coupon
|
|
1307
|
+
FinancialCoupon.isFinancialCoupon = function (coupon) {
|
|
1308
|
+
return coupon.type === exports.CouponTypes.FINANCIAL && !!coupon.subtype;
|
|
1197
1309
|
};
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
return _this;
|
|
1211
|
-
}
|
|
1212
|
-
StoreCoupon.isStoreCoupon = function (coupon) {
|
|
1213
|
-
return coupon instanceof StoreCoupon;
|
|
1310
|
+
FinancialCoupon.createCoupon = function (userId) {
|
|
1311
|
+
return this.toInstance({
|
|
1312
|
+
name: tsMd5.Md5.hashStr(userId + "_" + Date.now).toString(),
|
|
1313
|
+
nickname: "" + Date.now(),
|
|
1314
|
+
type: exports.CouponTypes.FINANCIAL,
|
|
1315
|
+
subtype: exports.CouponSubtypes.PERCENTAGE,
|
|
1316
|
+
checkoutType: exports.CheckoutTypes.ECOMMERCE,
|
|
1317
|
+
discount: 30,
|
|
1318
|
+
user: userId,
|
|
1319
|
+
createdAt: new Date(Date.now()),
|
|
1320
|
+
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
1321
|
+
});
|
|
1214
1322
|
};
|
|
1215
|
-
return
|
|
1323
|
+
return FinancialCoupon;
|
|
1216
1324
|
}(Coupon));
|
|
1217
|
-
__decorate([
|
|
1218
|
-
classTransformer.Expose({ name: 'checkout_type' }),
|
|
1219
|
-
__metadata("design:type", Object)
|
|
1220
|
-
], StoreCoupon.prototype, "checkoutType", void 0);
|
|
1221
|
-
__decorate([
|
|
1222
|
-
classTransformer.Type(function () { return Category; }),
|
|
1223
|
-
__metadata("design:type", Array)
|
|
1224
|
-
], StoreCoupon.prototype, "categories", void 0);
|
|
1225
1325
|
|
|
1226
1326
|
exports.OrderStatus = void 0;
|
|
1227
1327
|
(function (OrderStatus) {
|
|
@@ -1248,9 +1348,13 @@
|
|
|
1248
1348
|
function ShippingMethod() {
|
|
1249
1349
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1250
1350
|
}
|
|
1251
|
-
ShippingMethod
|
|
1252
|
-
|
|
1253
|
-
|
|
1351
|
+
Object.defineProperty(ShippingMethod, "identifiersFields", {
|
|
1352
|
+
get: function () {
|
|
1353
|
+
return ['id'];
|
|
1354
|
+
},
|
|
1355
|
+
enumerable: false,
|
|
1356
|
+
configurable: true
|
|
1357
|
+
});
|
|
1254
1358
|
return ShippingMethod;
|
|
1255
1359
|
}(BaseModel));
|
|
1256
1360
|
|
|
@@ -1259,26 +1363,13 @@
|
|
|
1259
1363
|
function Checkout() {
|
|
1260
1364
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1261
1365
|
}
|
|
1262
|
-
Object.defineProperty(Checkout
|
|
1366
|
+
Object.defineProperty(Checkout, "identifiersFields", {
|
|
1263
1367
|
get: function () {
|
|
1264
|
-
return
|
|
1265
|
-
return total + item.pricePaid;
|
|
1266
|
-
}, 0);
|
|
1368
|
+
return ['id'];
|
|
1267
1369
|
},
|
|
1268
1370
|
enumerable: false,
|
|
1269
1371
|
configurable: true
|
|
1270
1372
|
});
|
|
1271
|
-
Object.defineProperty(Checkout.prototype, "totalPrice", {
|
|
1272
|
-
get: function () {
|
|
1273
|
-
var _a;
|
|
1274
|
-
return this.subTotalPrice + ((_a = this.shipping) === null || _a === void 0 ? void 0 : _a.ShippingPrice) - this.discount;
|
|
1275
|
-
},
|
|
1276
|
-
enumerable: false,
|
|
1277
|
-
configurable: true
|
|
1278
|
-
});
|
|
1279
|
-
Checkout.prototype.identifierFields = function () {
|
|
1280
|
-
return ['id'];
|
|
1281
|
-
};
|
|
1282
1373
|
return Checkout;
|
|
1283
1374
|
}(BaseModel));
|
|
1284
1375
|
__decorate([
|
|
@@ -1302,8 +1393,8 @@
|
|
|
1302
1393
|
__metadata("design:type", ShippingMethod)
|
|
1303
1394
|
], Checkout.prototype, "shipping", void 0);
|
|
1304
1395
|
__decorate([
|
|
1305
|
-
classTransformer.Type(function () { return
|
|
1306
|
-
__metadata("design:type",
|
|
1396
|
+
classTransformer.Type(function () { return Coupon; }),
|
|
1397
|
+
__metadata("design:type", Coupon)
|
|
1307
1398
|
], Checkout.prototype, "coupon", void 0);
|
|
1308
1399
|
|
|
1309
1400
|
var Order = /** @class */ (function (_super) {
|
|
@@ -1323,9 +1414,13 @@
|
|
|
1323
1414
|
function CheckoutSubscription() {
|
|
1324
1415
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1325
1416
|
}
|
|
1326
|
-
CheckoutSubscription
|
|
1327
|
-
|
|
1328
|
-
|
|
1417
|
+
Object.defineProperty(CheckoutSubscription, "identifiersFields", {
|
|
1418
|
+
get: function () {
|
|
1419
|
+
return ['id'];
|
|
1420
|
+
},
|
|
1421
|
+
enumerable: false,
|
|
1422
|
+
configurable: true
|
|
1423
|
+
});
|
|
1329
1424
|
return CheckoutSubscription;
|
|
1330
1425
|
}(BaseModel));
|
|
1331
1426
|
__decorate([
|
|
@@ -1350,9 +1445,13 @@
|
|
|
1350
1445
|
function Buy2Win() {
|
|
1351
1446
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1352
1447
|
}
|
|
1353
|
-
Buy2Win
|
|
1354
|
-
|
|
1355
|
-
|
|
1448
|
+
Object.defineProperty(Buy2Win, "identifiersFields", {
|
|
1449
|
+
get: function () {
|
|
1450
|
+
return ['id'];
|
|
1451
|
+
},
|
|
1452
|
+
enumerable: false,
|
|
1453
|
+
configurable: true
|
|
1454
|
+
});
|
|
1356
1455
|
return Buy2Win;
|
|
1357
1456
|
}(BaseModel));
|
|
1358
1457
|
__decorate([
|
|
@@ -1454,9 +1553,13 @@
|
|
|
1454
1553
|
function Home() {
|
|
1455
1554
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1456
1555
|
}
|
|
1457
|
-
Home
|
|
1458
|
-
|
|
1459
|
-
|
|
1556
|
+
Object.defineProperty(Home, "identifiersFields", {
|
|
1557
|
+
get: function () {
|
|
1558
|
+
return ['id'];
|
|
1559
|
+
},
|
|
1560
|
+
enumerable: false,
|
|
1561
|
+
configurable: true
|
|
1562
|
+
});
|
|
1460
1563
|
return Home;
|
|
1461
1564
|
}(BaseModel));
|
|
1462
1565
|
|
|
@@ -1465,9 +1568,13 @@
|
|
|
1465
1568
|
function ShopMenu() {
|
|
1466
1569
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1467
1570
|
}
|
|
1468
|
-
ShopMenu
|
|
1469
|
-
|
|
1470
|
-
|
|
1571
|
+
Object.defineProperty(ShopMenu, "identifiersFields", {
|
|
1572
|
+
get: function () {
|
|
1573
|
+
return ['id'];
|
|
1574
|
+
},
|
|
1575
|
+
enumerable: false,
|
|
1576
|
+
configurable: true
|
|
1577
|
+
});
|
|
1471
1578
|
return ShopMenu;
|
|
1472
1579
|
}(BaseModel));
|
|
1473
1580
|
|
|
@@ -1610,11 +1717,7 @@
|
|
|
1610
1717
|
return /** @class */ (function (_super) {
|
|
1611
1718
|
__extends(class_1, _super);
|
|
1612
1719
|
function class_1() {
|
|
1613
|
-
|
|
1614
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1615
|
-
args[_i] = arguments[_i];
|
|
1616
|
-
}
|
|
1617
|
-
return _super.call(this, args) || this;
|
|
1720
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1618
1721
|
}
|
|
1619
1722
|
class_1.prototype.collection = function (path) {
|
|
1620
1723
|
return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
|
|
@@ -1725,28 +1828,28 @@
|
|
|
1725
1828
|
if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
1726
1829
|
return queryReference.where(firestoreFieldName, 'array-contains', options.value);
|
|
1727
1830
|
if (lodash.isObject(options) && lodash.isNil(options === null || options === void 0 ? void 0 : options.operator) && lodash.isNil(options === null || options === void 0 ? void 0 : options.value)) {
|
|
1728
|
-
return Object.keys(options).reduce(function (queryReferenceWithWhere, key) { return _this.buildWhereSentence(queryReferenceWithWhere, fieldName + "." + key, options[key]); }, queryReference);
|
|
1831
|
+
return Object.keys(options).reduce(function (queryReferenceWithWhere, key) { return _this.buildWhereSentence(queryReferenceWithWhere, fieldName.toString() + "." + key, options[key]); }, queryReference);
|
|
1729
1832
|
}
|
|
1730
1833
|
return queryReference.where(firestoreFieldName, (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
|
|
1731
1834
|
};
|
|
1732
1835
|
return _this;
|
|
1733
1836
|
}
|
|
1734
|
-
FindFirestore.prototype.find = function (
|
|
1837
|
+
FindFirestore.prototype.find = function (_a) {
|
|
1838
|
+
var filters = _a.filters, limits = _a.limits, orderBy = _a.orderBy;
|
|
1735
1839
|
return __awaiter(this, void 0, void 0, function () {
|
|
1736
1840
|
var query, docs, data;
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
switch (_b.label) {
|
|
1841
|
+
return __generator(this, function (_a) {
|
|
1842
|
+
switch (_a.label) {
|
|
1740
1843
|
case 0:
|
|
1741
1844
|
query = this.collection(this.buildCollectionPathForFind(filters));
|
|
1742
|
-
|
|
1743
|
-
|
|
1845
|
+
query = this.makeFirestoreWhere(query, filters);
|
|
1846
|
+
Object.keys(orderBy).forEach(function (fieldName) { return (query = query.orderBy(fieldName, orderBy[fieldName])); });
|
|
1744
1847
|
return [4 /*yield*/, this.defineLimits(query, filters, limits)];
|
|
1745
1848
|
case 1:
|
|
1746
|
-
query =
|
|
1849
|
+
query = _a.sent();
|
|
1747
1850
|
return [4 /*yield*/, query.get()];
|
|
1748
1851
|
case 2:
|
|
1749
|
-
docs =
|
|
1852
|
+
docs = _a.sent();
|
|
1750
1853
|
data = docs.docs.map(function (doc) { return doc.data(); });
|
|
1751
1854
|
return [2 /*return*/, {
|
|
1752
1855
|
data: data,
|
|
@@ -1757,32 +1860,31 @@
|
|
|
1757
1860
|
});
|
|
1758
1861
|
};
|
|
1759
1862
|
FindFirestore.prototype.buildCollectionPathForFind = function (filters) {
|
|
1760
|
-
var _a;
|
|
1761
1863
|
if (!this.isSubCollection(this))
|
|
1762
1864
|
return this.collectionName;
|
|
1763
1865
|
var parentIdField = this.parentIdField;
|
|
1764
|
-
var parentId = getValueFromFilter(
|
|
1866
|
+
var parentId = getValueFromFilter(filters === null || filters === void 0 ? void 0 : filters[parentIdField]);
|
|
1765
1867
|
return this.parentRepository.collectionName + "/" + parentId + "/" + this.collectionName;
|
|
1766
1868
|
};
|
|
1767
1869
|
FindFirestore.prototype.defineLimits = function (query, filters, limits) {
|
|
1768
1870
|
return __awaiter(this, void 0, void 0, function () {
|
|
1769
|
-
var
|
|
1770
|
-
return __generator(this, function (
|
|
1771
|
-
switch (
|
|
1871
|
+
var _a, _b;
|
|
1872
|
+
return __generator(this, function (_c) {
|
|
1873
|
+
switch (_c.label) {
|
|
1772
1874
|
case 0:
|
|
1773
1875
|
if (!(limits === null || limits === void 0 ? void 0 : limits.offset)) return [3 /*break*/, 3];
|
|
1774
|
-
if (!(limits.offset
|
|
1775
|
-
|
|
1876
|
+
if (!this.model.isModel(limits.offset)) return [3 /*break*/, 2];
|
|
1877
|
+
_b = (_a = query).startAfter;
|
|
1776
1878
|
return [4 /*yield*/, this.collection(this.buildCollectionPathForFind(filters))
|
|
1777
|
-
.doc(limits.offset[limits.offset.
|
|
1879
|
+
.doc(limits.offset[limits.offset.identifiersFields.shift()])
|
|
1778
1880
|
.get()];
|
|
1779
1881
|
case 1:
|
|
1780
|
-
query =
|
|
1882
|
+
query = _b.apply(_a, [_c.sent()]);
|
|
1781
1883
|
return [3 /*break*/, 3];
|
|
1782
1884
|
case 2:
|
|
1783
1885
|
if (lodash.isNumber(limits.offset) || lodash.isString(limits.offset))
|
|
1784
1886
|
query = query.startAt(limits.offset);
|
|
1785
|
-
|
|
1887
|
+
_c.label = 3;
|
|
1786
1888
|
case 3:
|
|
1787
1889
|
if (limits === null || limits === void 0 ? void 0 : limits.limit)
|
|
1788
1890
|
query = query.limit(limits.limit);
|
|
@@ -1831,7 +1933,7 @@
|
|
|
1831
1933
|
return __generator(this, function (_b) {
|
|
1832
1934
|
switch (_b.label) {
|
|
1833
1935
|
case 0:
|
|
1834
|
-
id = (_a = data[data.
|
|
1936
|
+
id = (_a = data[data.identifiersFields.shift()]) === null || _a === void 0 ? void 0 : _a.toString();
|
|
1835
1937
|
collectionPath = this.buildCollectionPathForAdd(data);
|
|
1836
1938
|
if (lodash.isEmpty(id))
|
|
1837
1939
|
return [2 /*return*/, this.collection(collectionPath).add(data)];
|
|
@@ -1881,7 +1983,7 @@
|
|
|
1881
1983
|
switch (_b.label) {
|
|
1882
1984
|
case 0:
|
|
1883
1985
|
model = new this.model();
|
|
1884
|
-
keyField = model.
|
|
1986
|
+
keyField = model.identifiersFields.shift();
|
|
1885
1987
|
docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
|
|
1886
1988
|
return [4 /*yield*/, docRef.set(this.paramsToPlain(data), { merge: true })];
|
|
1887
1989
|
case 1:
|
|
@@ -1901,8 +2003,8 @@
|
|
|
1901
2003
|
};
|
|
1902
2004
|
UpdateFirestore.prototype.paramsToPlain = function (params) {
|
|
1903
2005
|
var model = this.model;
|
|
1904
|
-
if (params
|
|
1905
|
-
return params;
|
|
2006
|
+
if (model.isModel(params))
|
|
2007
|
+
return params.toPlain();
|
|
1906
2008
|
return Object.keys(params).reduce(function (data, currentKey) {
|
|
1907
2009
|
var _b;
|
|
1908
2010
|
return (Object.assign(Object.assign({}, data), (_b = {}, _b[currentKey] = getValueByAction(params[currentKey]), _b)));
|
|
@@ -1985,9 +2087,13 @@
|
|
|
1985
2087
|
function UserSearch() {
|
|
1986
2088
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1987
2089
|
}
|
|
1988
|
-
UserSearch
|
|
1989
|
-
|
|
1990
|
-
|
|
2090
|
+
Object.defineProperty(UserSearch, "identifiersFields", {
|
|
2091
|
+
get: function () {
|
|
2092
|
+
return ['id'];
|
|
2093
|
+
},
|
|
2094
|
+
enumerable: false,
|
|
2095
|
+
configurable: true
|
|
2096
|
+
});
|
|
1991
2097
|
return UserSearch;
|
|
1992
2098
|
}(BaseModel));
|
|
1993
2099
|
|
|
@@ -2044,7 +2150,7 @@
|
|
|
2044
2150
|
var _a;
|
|
2045
2151
|
return __generator(this, function (_b) {
|
|
2046
2152
|
switch (_b.label) {
|
|
2047
|
-
case 0: return [4 /*yield*/, this.userSearchFirestoreRepository.find(
|
|
2153
|
+
case 0: return [4 /*yield*/, this.userSearchFirestoreRepository.find((_a = {}, _a[field] = { operator: exports.Where.EQUALS, value: value }, _a))];
|
|
2048
2154
|
case 1:
|
|
2049
2155
|
result = _b.sent();
|
|
2050
2156
|
return [2 /*return*/, result.count > 0];
|
|
@@ -2323,10 +2429,12 @@
|
|
|
2323
2429
|
var result;
|
|
2324
2430
|
return __generator(this, function (_b) {
|
|
2325
2431
|
switch (_b.label) {
|
|
2326
|
-
case 0: return [4 /*yield*/, this.find(
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2432
|
+
case 0: return [4 /*yield*/, this.find({
|
|
2433
|
+
filters: {
|
|
2434
|
+
slug: { operator: exports.Where.EQUALS, value: slug },
|
|
2435
|
+
shopAvailability: { operator: exports.Where.IN, value: [shop] },
|
|
2436
|
+
},
|
|
2437
|
+
})];
|
|
2330
2438
|
case 1:
|
|
2331
2439
|
result = _b.sent();
|
|
2332
2440
|
return [2 /*return*/, (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift()];
|
|
@@ -2385,29 +2493,19 @@
|
|
|
2385
2493
|
return _this;
|
|
2386
2494
|
}
|
|
2387
2495
|
CouponFirestoreRepository.prototype.buildModelInstance = function () {
|
|
2388
|
-
var
|
|
2496
|
+
var _a = _super.prototype.buildModelInstance.call(this), fromFirestore = _a.fromFirestore, toFirestore = _a.toFirestore;
|
|
2389
2497
|
return {
|
|
2390
2498
|
toFirestore: function (data) {
|
|
2391
|
-
var
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
plain.categories = (_a = plain === null || plain === void 0 ? void 0 : plain.categories) === null || _a === void 0 ? void 0 : _a.map(function (category) { return category.id; });
|
|
2499
|
+
var plain = toFirestore(data);
|
|
2500
|
+
if (!!data.expiresIn)
|
|
2501
|
+
plain.expiresIn = data.expiresIn.getTime();
|
|
2395
2502
|
return plain;
|
|
2396
2503
|
},
|
|
2397
2504
|
fromFirestore: function (snap) {
|
|
2398
|
-
var
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
data[key] = data[key].toDate();
|
|
2403
|
-
}
|
|
2404
|
-
});
|
|
2405
|
-
data.categories = (_a = data === null || data === void 0 ? void 0 : data.categories) === null || _a === void 0 ? void 0 : _a.map(function (category) { return ({ id: category }); });
|
|
2406
|
-
if (data.checkout_type === exports.CheckoutTypes.SUBSCRIPTION)
|
|
2407
|
-
return ClubCoupon.toInstance(Object.assign({ id: snap.id }, data));
|
|
2408
|
-
if (data.checkout_type === exports.CheckoutTypes.ECOMMERCE)
|
|
2409
|
-
return StoreCoupon.toInstance(Object.assign({ id: snap.id }, data));
|
|
2410
|
-
return _this.model.toInstance(Object.assign({ id: snap.id }, data));
|
|
2505
|
+
var instance = fromFirestore(snap);
|
|
2506
|
+
if (!lodash.isNil(instance.expiresIn))
|
|
2507
|
+
instance.expiresIn = new Date(snap.data().expiresIn);
|
|
2508
|
+
return instance;
|
|
2411
2509
|
},
|
|
2412
2510
|
};
|
|
2413
2511
|
};
|
|
@@ -2663,6 +2761,812 @@
|
|
|
2663
2761
|
return RegisterFirebaseAuthService;
|
|
2664
2762
|
}());
|
|
2665
2763
|
|
|
2764
|
+
var withCreateHasuraGraphQL = function (MixinBase) {
|
|
2765
|
+
return /** @class */ (function (_super) {
|
|
2766
|
+
__extends(CreateHasuraGraphQLMixin, _super);
|
|
2767
|
+
function CreateHasuraGraphQLMixin() {
|
|
2768
|
+
var params = [];
|
|
2769
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2770
|
+
params[_i] = arguments[_i];
|
|
2771
|
+
}
|
|
2772
|
+
var _this = this;
|
|
2773
|
+
var options = params === null || params === void 0 ? void 0 : params[0];
|
|
2774
|
+
_this = _super.apply(this, __spreadArray([], __read(params))) || this;
|
|
2775
|
+
_this.insertGraphQLOperation = (options === null || options === void 0 ? void 0 : options.insertGraphQLOperation) || "insert_" + _this.tableName + "_one";
|
|
2776
|
+
_this.insertGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.insertGraphQLObjectType) || _this.tableName + "_insert_input";
|
|
2777
|
+
return _this;
|
|
2778
|
+
}
|
|
2779
|
+
CreateHasuraGraphQLMixin.prototype.create = function (data) {
|
|
2780
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2781
|
+
var newData;
|
|
2782
|
+
return __generator(this, function (_a) {
|
|
2783
|
+
switch (_a.label) {
|
|
2784
|
+
case 0: return [4 /*yield*/, this.save(this.model.toInstance(data))];
|
|
2785
|
+
case 1:
|
|
2786
|
+
newData = _a.sent();
|
|
2787
|
+
return [2 /*return*/, this.model.toInstance(newData)];
|
|
2788
|
+
}
|
|
2789
|
+
});
|
|
2790
|
+
});
|
|
2791
|
+
};
|
|
2792
|
+
CreateHasuraGraphQLMixin.prototype.save = function (data) {
|
|
2793
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2794
|
+
var result;
|
|
2795
|
+
return __generator(this, function (_a) {
|
|
2796
|
+
switch (_a.label) {
|
|
2797
|
+
case 0: return [4 /*yield*/, this.mutation(this.insertGraphQLOperation, this.model.identifiersFields, {
|
|
2798
|
+
object: { type: this.insertGraphQLObjectType, required: true, value: this.convertDataToHasura(data) },
|
|
2799
|
+
})];
|
|
2800
|
+
case 1:
|
|
2801
|
+
result = _a.sent();
|
|
2802
|
+
return [2 /*return*/, Object.assign(Object.assign({}, data.toPlain()), this.convertDataFromHasura(result[this.insertGraphQLOperation]).toPlain())];
|
|
2803
|
+
}
|
|
2804
|
+
});
|
|
2805
|
+
});
|
|
2806
|
+
};
|
|
2807
|
+
return CreateHasuraGraphQLMixin;
|
|
2808
|
+
}(MixinBase));
|
|
2809
|
+
};
|
|
2810
|
+
|
|
2811
|
+
var withDeleteHasuraGraphQL = function (MixinBase) {
|
|
2812
|
+
return /** @class */ (function (_super) {
|
|
2813
|
+
__extends(DeleteHasuraGraphQLMixin, _super);
|
|
2814
|
+
function DeleteHasuraGraphQLMixin() {
|
|
2815
|
+
var params = [];
|
|
2816
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2817
|
+
params[_i] = arguments[_i];
|
|
2818
|
+
}
|
|
2819
|
+
var _this = this;
|
|
2820
|
+
var options = params === null || params === void 0 ? void 0 : params[0];
|
|
2821
|
+
_this = _super.apply(this, __spreadArray([], __read(params))) || this;
|
|
2822
|
+
_this.deleteGraphQLOperation = (options === null || options === void 0 ? void 0 : options.deleteGraphQLOperation) || "delete_" + _this.tableName + "_by_pk";
|
|
2823
|
+
return _this;
|
|
2824
|
+
}
|
|
2825
|
+
DeleteHasuraGraphQLMixin.prototype.delete = function (identifiers) {
|
|
2826
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2827
|
+
var instance;
|
|
2828
|
+
var _this = this;
|
|
2829
|
+
return __generator(this, function (_a) {
|
|
2830
|
+
switch (_a.label) {
|
|
2831
|
+
case 0:
|
|
2832
|
+
instance = this.model.toInstance(identifiers);
|
|
2833
|
+
return [4 /*yield*/, this.mutation(this.deleteGraphQLOperation, this.model.identifiersFields, Object.keys(instance.identifier).reduce(function (variables, key) {
|
|
2834
|
+
var _a;
|
|
2835
|
+
return (Object.assign(Object.assign({}, variables), (_a = {}, _a[key] = {
|
|
2836
|
+
type: _this.getAttributeGraphQLTypeOf(instance[key]),
|
|
2837
|
+
required: true,
|
|
2838
|
+
value: instance.identifier[key],
|
|
2839
|
+
}, _a)));
|
|
2840
|
+
}, {}))];
|
|
2841
|
+
case 1:
|
|
2842
|
+
_a.sent();
|
|
2843
|
+
return [2 /*return*/];
|
|
2844
|
+
}
|
|
2845
|
+
});
|
|
2846
|
+
});
|
|
2847
|
+
};
|
|
2848
|
+
return DeleteHasuraGraphQLMixin;
|
|
2849
|
+
}(MixinBase));
|
|
2850
|
+
};
|
|
2851
|
+
|
|
2852
|
+
var AttributeOptionHelper = /** @class */ (function () {
|
|
2853
|
+
function AttributeOptionHelper() {
|
|
2854
|
+
}
|
|
2855
|
+
return AttributeOptionHelper;
|
|
2856
|
+
}());
|
|
2857
|
+
AttributeOptionHelper.findByAttribute = function (attributeName, fields) {
|
|
2858
|
+
if (fields.includes(attributeName))
|
|
2859
|
+
return { columnName: attributeName.toString(), attributeName: attributeName };
|
|
2860
|
+
var field = fields.find(function (columnOption) { return lodash.isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()); });
|
|
2861
|
+
var fieldOption = field === null || field === void 0 ? void 0 : field[attributeName.toString()];
|
|
2862
|
+
if (lodash.isNil(fieldOption))
|
|
2863
|
+
return { columnName: attributeName.toString(), attributeName: attributeName };
|
|
2864
|
+
if (Array.isArray(fieldOption))
|
|
2865
|
+
return { columnName: attributeName.toString(), attributeName: attributeName, fields: fieldOption };
|
|
2866
|
+
return Object.assign({ attributeName: attributeName, columnName: attributeName.toString() }, fieldOption);
|
|
2867
|
+
};
|
|
2868
|
+
|
|
2869
|
+
var withHasuraGraphQL = function (MixinBase) {
|
|
2870
|
+
var checkIsGraphQLParams = function (params) { return !lodash.isString(params) && Array.isArray(params) && params.length >= 0 && !!params[0].operation; };
|
|
2871
|
+
var checkIsColumnModelOption = function (fieldValue) { return !!fieldValue.columnName && !!fieldValue.fields; };
|
|
2872
|
+
var checkIsColumnOption = function (fieldValue) { return checkIsColumnModelOption(fieldValue) || !!fieldValue.columnName; };
|
|
2873
|
+
var convertModelFieldsToGraphQLFields = function (fields) {
|
|
2874
|
+
return fields
|
|
2875
|
+
.map(function (field) {
|
|
2876
|
+
var _b, _c;
|
|
2877
|
+
if (lodash.isString(field))
|
|
2878
|
+
return field.toString();
|
|
2879
|
+
var fieldName = Object.keys(field).shift();
|
|
2880
|
+
var fieldValue = field[fieldName];
|
|
2881
|
+
if (Array.isArray(fieldValue))
|
|
2882
|
+
return _b = {}, _b[fieldName] = convertModelFieldsToGraphQLFields(fieldValue), _b;
|
|
2883
|
+
if (checkIsColumnModelOption(fieldValue))
|
|
2884
|
+
return _c = {}, _c[fieldValue.columnName || fieldName] = convertModelFieldsToGraphQLFields(fieldValue.fields), _c;
|
|
2885
|
+
if (checkIsColumnOption(fieldValue))
|
|
2886
|
+
return fieldValue.columnName;
|
|
2887
|
+
return;
|
|
2888
|
+
})
|
|
2889
|
+
.filter(function (field) { return !!field; });
|
|
2890
|
+
};
|
|
2891
|
+
var findColumnOptionFromList = function (columnName, fields) {
|
|
2892
|
+
if (fields.includes(columnName))
|
|
2893
|
+
return { columnName: columnName, attributeName: columnName };
|
|
2894
|
+
var field = fields.find(function (columnOption) {
|
|
2895
|
+
var _a;
|
|
2896
|
+
return lodash.isObject(columnOption) &&
|
|
2897
|
+
((_a = Object.values(columnOption).find(function (option) { return checkIsColumnOption(option) && option.columnName === columnName; })) === null || _a === void 0 ? void 0 : _a.columnName) === columnName;
|
|
2898
|
+
}) || {};
|
|
2899
|
+
var attributeName = Object.keys(field).find(function (fieldOption) { return checkIsColumnOption(field[fieldOption]) || Array.isArray(field[fieldOption]); });
|
|
2900
|
+
var fieldOption = field === null || field === void 0 ? void 0 : field[attributeName];
|
|
2901
|
+
if (Array.isArray(fieldOption))
|
|
2902
|
+
return { attributeName: attributeName, fields: fieldOption };
|
|
2903
|
+
return Object.assign({ attributeName: attributeName || columnName, columnName: columnName }, fieldOption);
|
|
2904
|
+
};
|
|
2905
|
+
var convertFieldValueFrom = function (data, fields) { return Object.keys(data).reduce(function (result, columnName) {
|
|
2906
|
+
var _b, _c, _d, _e;
|
|
2907
|
+
var _f = findColumnOptionFromList(columnName, fields), attributeName = _f.attributeName, attributeFields = _f.fields, from = _f.from;
|
|
2908
|
+
if (!!attributeFields && Array.isArray(attributeFields)) {
|
|
2909
|
+
if (Array.isArray(data[columnName]))
|
|
2910
|
+
return Object.assign(Object.assign({}, result), (_b = {}, _b[attributeName] = from
|
|
2911
|
+
? from(data[columnName], data)
|
|
2912
|
+
: data[columnName].map(function (value) { return convertFieldValueFrom(value, attributeFields); }), _b));
|
|
2913
|
+
if (lodash.isObject(data[columnName]))
|
|
2914
|
+
return Object.assign(Object.assign({}, result), (_c = {}, _c[attributeName] = convertFieldValueFrom(data[columnName], attributeFields), _c));
|
|
2915
|
+
}
|
|
2916
|
+
if (!!from)
|
|
2917
|
+
return Object.assign(Object.assign({}, result), (_d = {}, _d[attributeName] = from(data[columnName], data), _d));
|
|
2918
|
+
return Object.assign(Object.assign({}, result), (_e = {}, _e[attributeName] = parseDateTime(data[columnName]), _e));
|
|
2919
|
+
}, {}); };
|
|
2920
|
+
var convertFieldValueTo = function (instance, fields, update) {
|
|
2921
|
+
if (update === void 0) { update = false; }
|
|
2922
|
+
var _a;
|
|
2923
|
+
var data = ((_a = instance.toPlain) === null || _a === void 0 ? void 0 : _a.call(instance)) || instance;
|
|
2924
|
+
return Object.keys(data)
|
|
2925
|
+
.filter(function (key) { return !lodash.isNil(data[key]); })
|
|
2926
|
+
.reduce(function (result, attributeName) {
|
|
2927
|
+
var _b, _c, _d;
|
|
2928
|
+
var _e = AttributeOptionHelper.findByAttribute(attributeName, fields), columnName = _e.columnName, attributeFields = _e.fields, foreignKeyColumn = _e.foreignKeyColumn, to = _e.to;
|
|
2929
|
+
if (lodash.isNil(columnName))
|
|
2930
|
+
return result;
|
|
2931
|
+
if (!!foreignKeyColumn &&
|
|
2932
|
+
!lodash.isEmpty(foreignKeyColumn) &&
|
|
2933
|
+
!Object.keys(foreignKeyColumn).filter(function (key) { return !data[attributeName][key]; }).length)
|
|
2934
|
+
return Object.keys(foreignKeyColumn).reduce(function (object, current) {
|
|
2935
|
+
var _b;
|
|
2936
|
+
return (Object.assign(Object.assign({}, object), (_b = {}, _b[foreignKeyColumn[current]] = data[attributeName][current], _b)));
|
|
2937
|
+
}, Object.assign({}, result));
|
|
2938
|
+
if (update && lodash.isObject(data[attributeName]) && !lodash.isDate(data[attributeName]))
|
|
2939
|
+
return result;
|
|
2940
|
+
if (!!columnName && Array.isArray(attributeFields) && lodash.isObject(data[attributeName])) {
|
|
2941
|
+
var converted = !lodash.isNil(columnName) ? to(instance[attributeName], instance) : data[attributeName];
|
|
2942
|
+
return Object.assign(Object.assign({}, result), (converted !== undefined
|
|
2943
|
+
? (_b = {}, _b[columnName] = { data: convertFieldValueTo(data[attributeName], attributeFields) }, _b) : {}));
|
|
2944
|
+
}
|
|
2945
|
+
if (!!to)
|
|
2946
|
+
return Object.assign(Object.assign({}, result), (_c = {}, _c[columnName] = to(instance[attributeName], instance), _c));
|
|
2947
|
+
return Object.assign(Object.assign({}, result), (_d = {}, _d[columnName] = data[attributeName], _d));
|
|
2948
|
+
}, {});
|
|
2949
|
+
};
|
|
2950
|
+
return /** @class */ (function (_super) {
|
|
2951
|
+
__extends(HasuraGraphQLMixin, _super);
|
|
2952
|
+
function HasuraGraphQLMixin() {
|
|
2953
|
+
var params = [];
|
|
2954
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2955
|
+
params[_i] = arguments[_i];
|
|
2956
|
+
}
|
|
2957
|
+
var _this = this;
|
|
2958
|
+
var options = params[0];
|
|
2959
|
+
_this = _super.apply(this, __spreadArray([], __read(params))) || this;
|
|
2960
|
+
_this.tableName = options.tableName;
|
|
2961
|
+
_this.endpoint = options.endpoint;
|
|
2962
|
+
_this.authOptions = options.authOptions;
|
|
2963
|
+
_this.model = options.model;
|
|
2964
|
+
_this.fields = options.fields || _this.model.identifiersFields;
|
|
2965
|
+
return _this;
|
|
2966
|
+
}
|
|
2967
|
+
Object.defineProperty(HasuraGraphQLMixin.prototype, "headers", {
|
|
2968
|
+
get: function () {
|
|
2969
|
+
return Object.assign(Object.assign(Object.assign({ 'Content-Type': 'application/json' }, (lodash.isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken })), (lodash.isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret })), (lodash.isNil(this.authOptions.authRole)
|
|
2970
|
+
? {}
|
|
2971
|
+
: { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }));
|
|
2972
|
+
},
|
|
2973
|
+
enumerable: false,
|
|
2974
|
+
configurable: true
|
|
2975
|
+
});
|
|
2976
|
+
HasuraGraphQLMixin.prototype.mutation = function (operation, fields, variables) {
|
|
2977
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2978
|
+
var resultQuery;
|
|
2979
|
+
return __generator(this, function (_b) {
|
|
2980
|
+
resultQuery = gqlQueryBuilder.mutation({
|
|
2981
|
+
operation: operation,
|
|
2982
|
+
variables: variables,
|
|
2983
|
+
fields: convertModelFieldsToGraphQLFields(fields),
|
|
2984
|
+
});
|
|
2985
|
+
return [2 /*return*/, this.fetch(resultQuery)];
|
|
2986
|
+
});
|
|
2987
|
+
});
|
|
2988
|
+
};
|
|
2989
|
+
HasuraGraphQLMixin.prototype.query = function (operation, fields, variables) {
|
|
2990
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2991
|
+
var resultQuery;
|
|
2992
|
+
return __generator(this, function (_b) {
|
|
2993
|
+
resultQuery = checkIsGraphQLParams(operation)
|
|
2994
|
+
? gqlQueryBuilder.query(operation.map(function (option) { return ({
|
|
2995
|
+
operation: option.operation,
|
|
2996
|
+
variables: option.variables,
|
|
2997
|
+
fields: convertModelFieldsToGraphQLFields(option.fields),
|
|
2998
|
+
}); }))
|
|
2999
|
+
: gqlQueryBuilder.query({
|
|
3000
|
+
operation: operation,
|
|
3001
|
+
variables: variables,
|
|
3002
|
+
fields: convertModelFieldsToGraphQLFields(fields),
|
|
3003
|
+
});
|
|
3004
|
+
return [2 /*return*/, this.fetch(resultQuery)];
|
|
3005
|
+
});
|
|
3006
|
+
});
|
|
3007
|
+
};
|
|
3008
|
+
HasuraGraphQLMixin.prototype.fetch = function (params) {
|
|
3009
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3010
|
+
var headers, response, result;
|
|
3011
|
+
return __generator(this, function (_b) {
|
|
3012
|
+
switch (_b.label) {
|
|
3013
|
+
case 0:
|
|
3014
|
+
headers = this.headers;
|
|
3015
|
+
return [4 /*yield*/, fetch__default["default"]("" + this.endpoint, {
|
|
3016
|
+
method: 'POST',
|
|
3017
|
+
body: JSON.stringify(params),
|
|
3018
|
+
headers: headers,
|
|
3019
|
+
})];
|
|
3020
|
+
case 1:
|
|
3021
|
+
response = _b.sent();
|
|
3022
|
+
return [4 /*yield*/, response.json()];
|
|
3023
|
+
case 2:
|
|
3024
|
+
result = _b.sent();
|
|
3025
|
+
if (!lodash.isNil(result.errors))
|
|
3026
|
+
throw new Error(JSON.stringify(result.errors));
|
|
3027
|
+
return [2 /*return*/, result.data];
|
|
3028
|
+
}
|
|
3029
|
+
});
|
|
3030
|
+
});
|
|
3031
|
+
};
|
|
3032
|
+
HasuraGraphQLMixin.prototype.getAttributeGraphQLTypeOf = function (value) {
|
|
3033
|
+
if (isUUID(value))
|
|
3034
|
+
return 'uuid';
|
|
3035
|
+
if (lodash.isString(value))
|
|
3036
|
+
return 'String';
|
|
3037
|
+
if (lodash.isBoolean(value))
|
|
3038
|
+
return 'Boolean';
|
|
3039
|
+
if (value instanceof Date)
|
|
3040
|
+
return 'timestamptz';
|
|
3041
|
+
if (lodash.isInteger(value))
|
|
3042
|
+
return 'Int';
|
|
3043
|
+
if (lodash.isNumber(value))
|
|
3044
|
+
return 'numeric';
|
|
3045
|
+
throw new Error('Type not implemented yet');
|
|
3046
|
+
};
|
|
3047
|
+
HasuraGraphQLMixin.prototype.checkIfIsDateTimeAndParse = function (value) {
|
|
3048
|
+
if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value))
|
|
3049
|
+
return value;
|
|
3050
|
+
var date = dateFns.parseISO(value);
|
|
3051
|
+
if (lodash.isNaN(date.getTime()))
|
|
3052
|
+
return value;
|
|
3053
|
+
return date;
|
|
3054
|
+
};
|
|
3055
|
+
HasuraGraphQLMixin.prototype.convertDataFromHasura = function (data) {
|
|
3056
|
+
var plain = convertFieldValueFrom(data, this.fields);
|
|
3057
|
+
return this.model.toInstance(plain);
|
|
3058
|
+
};
|
|
3059
|
+
HasuraGraphQLMixin.prototype.convertDataToHasura = function (instance, update) {
|
|
3060
|
+
if (update === void 0) { update = false; }
|
|
3061
|
+
return convertFieldValueTo(instance, this.fields, update);
|
|
3062
|
+
};
|
|
3063
|
+
return HasuraGraphQLMixin;
|
|
3064
|
+
}(MixinBase));
|
|
3065
|
+
};
|
|
3066
|
+
|
|
3067
|
+
var withUpdateHasuraGraphQL = function (MixinBase) {
|
|
3068
|
+
var getValueByAction = function (options) {
|
|
3069
|
+
if (lodash.isNil(options.action))
|
|
3070
|
+
return options;
|
|
3071
|
+
if (options.action === exports.UpdateOptionActions.REMOVE_FIELD)
|
|
3072
|
+
return null;
|
|
3073
|
+
return options.value;
|
|
3074
|
+
};
|
|
3075
|
+
return /** @class */ (function (_super) {
|
|
3076
|
+
__extends(UpdateHasuraGraphQLMixin, _super);
|
|
3077
|
+
function UpdateHasuraGraphQLMixin() {
|
|
3078
|
+
var params = [];
|
|
3079
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3080
|
+
params[_i] = arguments[_i];
|
|
3081
|
+
}
|
|
3082
|
+
var _this = this;
|
|
3083
|
+
var options = params === null || params === void 0 ? void 0 : params[0];
|
|
3084
|
+
_this = _super.apply(this, __spreadArray([], __read(params))) || this;
|
|
3085
|
+
_this.updateGraphQLOperation = (options === null || options === void 0 ? void 0 : options.updateGraphQLOperation) || "update_" + _this.tableName + "_by_pk";
|
|
3086
|
+
_this.updateGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.updateGraphQLObjectType) || _this.tableName + "_set_input";
|
|
3087
|
+
_this.updateGraphQLPKType = (options === null || options === void 0 ? void 0 : options.updateGraphQLPKType) || _this.tableName + "_pk_columns_input";
|
|
3088
|
+
return _this;
|
|
3089
|
+
}
|
|
3090
|
+
UpdateHasuraGraphQLMixin.prototype.update = function (data) {
|
|
3091
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3092
|
+
var plainData;
|
|
3093
|
+
return __generator(this, function (_a) {
|
|
3094
|
+
switch (_a.label) {
|
|
3095
|
+
case 0:
|
|
3096
|
+
plainData = this.paramsToPlain(data);
|
|
3097
|
+
return [4 /*yield*/, this.mutation(this.updateGraphQLOperation, this.model.identifiersFields, {
|
|
3098
|
+
_set: {
|
|
3099
|
+
type: this.updateGraphQLObjectType,
|
|
3100
|
+
value: this.convertDataToHasura(this.model.toInstance(plainData), true),
|
|
3101
|
+
required: true,
|
|
3102
|
+
},
|
|
3103
|
+
pk_columns: { type: this.updateGraphQLPKType, value: this.getUpdateModelKeys(plainData), required: true },
|
|
3104
|
+
})];
|
|
3105
|
+
case 1:
|
|
3106
|
+
_a.sent();
|
|
3107
|
+
return [2 /*return*/, this.model.toInstance(plainData)];
|
|
3108
|
+
}
|
|
3109
|
+
});
|
|
3110
|
+
});
|
|
3111
|
+
};
|
|
3112
|
+
UpdateHasuraGraphQLMixin.prototype.paramsToPlain = function (params) {
|
|
3113
|
+
var model = this.model;
|
|
3114
|
+
if (model.isModel(params))
|
|
3115
|
+
return params.toPlain();
|
|
3116
|
+
return Object.keys(params).reduce(function (data, currentKey) {
|
|
3117
|
+
var _a;
|
|
3118
|
+
return (Object.assign(Object.assign({}, data), (_a = {}, _a[currentKey] = getValueByAction(params[currentKey]), _a)));
|
|
3119
|
+
}, {});
|
|
3120
|
+
};
|
|
3121
|
+
UpdateHasuraGraphQLMixin.prototype.getUpdateModelKeys = function (data) {
|
|
3122
|
+
return this.model.identifiersFields.reduce(function (columns, key) {
|
|
3123
|
+
var _a;
|
|
3124
|
+
return (Object.assign(Object.assign({}, columns), (_a = {}, _a[key] = data[key], _a)));
|
|
3125
|
+
}, {});
|
|
3126
|
+
};
|
|
3127
|
+
return UpdateHasuraGraphQLMixin;
|
|
3128
|
+
}(MixinBase));
|
|
3129
|
+
};
|
|
3130
|
+
|
|
3131
|
+
var withGetHasuraGraphQL = function (MixinBase) {
|
|
3132
|
+
return /** @class */ (function (_super) {
|
|
3133
|
+
__extends(GetHasuraGraphQLMixin, _super);
|
|
3134
|
+
function GetHasuraGraphQLMixin() {
|
|
3135
|
+
var params = [];
|
|
3136
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3137
|
+
params[_i] = arguments[_i];
|
|
3138
|
+
}
|
|
3139
|
+
var _this = this;
|
|
3140
|
+
var options = params === null || params === void 0 ? void 0 : params[0];
|
|
3141
|
+
_this = _super.apply(this, __spreadArray([], __read(params))) || this;
|
|
3142
|
+
_this.getGraphQLOperation = (options === null || options === void 0 ? void 0 : options.getGraphQLOperation) || _this.tableName + "_by_pk";
|
|
3143
|
+
return _this;
|
|
3144
|
+
}
|
|
3145
|
+
GetHasuraGraphQLMixin.prototype.get = function (identifiers) {
|
|
3146
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3147
|
+
var instance, result, data;
|
|
3148
|
+
var _this = this;
|
|
3149
|
+
return __generator(this, function (_a) {
|
|
3150
|
+
switch (_a.label) {
|
|
3151
|
+
case 0:
|
|
3152
|
+
instance = this.model.toInstance(identifiers);
|
|
3153
|
+
return [4 /*yield*/, this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce(function (ids, identifier) {
|
|
3154
|
+
var _a;
|
|
3155
|
+
return (Object.assign(Object.assign({}, ids), (instance[identifier] === undefined
|
|
3156
|
+
? {}
|
|
3157
|
+
: (_a = {},
|
|
3158
|
+
_a[identifier] = {
|
|
3159
|
+
type: _this.getAttributeGraphQLTypeOf(instance[identifier]),
|
|
3160
|
+
value: identifiers[identifier],
|
|
3161
|
+
required: true,
|
|
3162
|
+
},
|
|
3163
|
+
_a))));
|
|
3164
|
+
}, {}))];
|
|
3165
|
+
case 1:
|
|
3166
|
+
result = _a.sent();
|
|
3167
|
+
data = result[this.getGraphQLOperation];
|
|
3168
|
+
if (lodash.isNil(data))
|
|
3169
|
+
throw new NotFoundError(instance.constructor.name + " not found");
|
|
3170
|
+
return [2 /*return*/, this.convertDataFromHasura(result[this.getGraphQLOperation])];
|
|
3171
|
+
}
|
|
3172
|
+
});
|
|
3173
|
+
});
|
|
3174
|
+
};
|
|
3175
|
+
return GetHasuraGraphQLMixin;
|
|
3176
|
+
}(MixinBase));
|
|
3177
|
+
};
|
|
3178
|
+
|
|
3179
|
+
var HasuraGraphQLWhere;
|
|
3180
|
+
(function (HasuraGraphQLWhere) {
|
|
3181
|
+
HasuraGraphQLWhere["EQUALS"] = "_eq";
|
|
3182
|
+
HasuraGraphQLWhere["GT"] = "_gt";
|
|
3183
|
+
HasuraGraphQLWhere["GTE"] = "_gte";
|
|
3184
|
+
HasuraGraphQLWhere["IN"] = "_in";
|
|
3185
|
+
HasuraGraphQLWhere["NOTIN"] = "_nin";
|
|
3186
|
+
HasuraGraphQLWhere["LT"] = "_lt";
|
|
3187
|
+
HasuraGraphQLWhere["LTE"] = "_lte";
|
|
3188
|
+
HasuraGraphQLWhere["LIKE"] = "_like";
|
|
3189
|
+
HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
|
|
3190
|
+
HasuraGraphQLWhere["ISNULL"] = "_is_null";
|
|
3191
|
+
HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
|
|
3192
|
+
})(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
|
|
3193
|
+
|
|
3194
|
+
var HasuraGraphQLColumnType;
|
|
3195
|
+
(function (HasuraGraphQLColumnType) {
|
|
3196
|
+
HasuraGraphQLColumnType["Int"] = "Int";
|
|
3197
|
+
HasuraGraphQLColumnType["Float"] = "Float";
|
|
3198
|
+
HasuraGraphQLColumnType["Boolean"] = "Boolean";
|
|
3199
|
+
HasuraGraphQLColumnType["String"] = "String";
|
|
3200
|
+
HasuraGraphQLColumnType["DateTime"] = "timestampz";
|
|
3201
|
+
HasuraGraphQLColumnType["Json"] = "json";
|
|
3202
|
+
HasuraGraphQLColumnType["Jsonb"] = "jsonb";
|
|
3203
|
+
HasuraGraphQLColumnType["Enum"] = "enum";
|
|
3204
|
+
HasuraGraphQLColumnType["Uuid"] = "uuid";
|
|
3205
|
+
})(HasuraGraphQLColumnType || (HasuraGraphQLColumnType = {}));
|
|
3206
|
+
|
|
3207
|
+
var withFindHasuraGraphQL = function (MixinBase) {
|
|
3208
|
+
var checkIfIsFilterOption = function (filter) { return !lodash.isNil(filter === null || filter === void 0 ? void 0 : filter.operator); };
|
|
3209
|
+
var getValueFromFilter = function (filter, fieldOption) {
|
|
3210
|
+
if (!checkIfIsFilterOption(filter))
|
|
3211
|
+
return filter;
|
|
3212
|
+
if (filter.operator === exports.Where.ISNULL)
|
|
3213
|
+
return true;
|
|
3214
|
+
if (filter.operator === exports.Where.ISNOTNULL)
|
|
3215
|
+
return false;
|
|
3216
|
+
var converter = fieldOption.to ? fieldOption.to : function (value) { return value; };
|
|
3217
|
+
return Array.isArray(filter.value) && [exports.Where.IN, exports.Where.NOTIN].includes(filter.operator)
|
|
3218
|
+
? filter.value.map(function (fieldValue) { return converter(fieldValue); })
|
|
3219
|
+
: converter(filter.value);
|
|
3220
|
+
};
|
|
3221
|
+
return /** @class */ (function (_super) {
|
|
3222
|
+
__extends(FindHasuraGraphQLMixin, _super);
|
|
3223
|
+
function FindHasuraGraphQLMixin() {
|
|
3224
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3225
|
+
_this.makeGraphQLWhere = function (filter, fields) { return Object.keys(filter).reduce(function (variables, fieldName) {
|
|
3226
|
+
var _a;
|
|
3227
|
+
return (Object.assign(Object.assign({}, variables), (_a = {}, _a[AttributeOptionHelper.findByAttribute(fieldName, fields)
|
|
3228
|
+
.columnName] = _this.buildWhereSentence(fieldName, filter[fieldName], fields), _a)));
|
|
3229
|
+
}, {}); };
|
|
3230
|
+
_this.buildWhereSentence = function (field, options, fields) {
|
|
3231
|
+
var _a;
|
|
3232
|
+
var fieldSentenceOptions = AttributeOptionHelper.findByAttribute(field, fields);
|
|
3233
|
+
if (!Array.isArray(options) &&
|
|
3234
|
+
lodash.isObject(options) &&
|
|
3235
|
+
lodash.isNil(options === null || options === void 0 ? void 0 : options.operator) &&
|
|
3236
|
+
lodash.isNil(options === null || options === void 0 ? void 0 : options.value) &&
|
|
3237
|
+
lodash.isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to))
|
|
3238
|
+
return Object.keys(options).reduce(function (variables, key) {
|
|
3239
|
+
var _a;
|
|
3240
|
+
var fieldOptions = AttributeOptionHelper.findByAttribute(key, fields);
|
|
3241
|
+
var columnName = fieldOptions.columnName;
|
|
3242
|
+
var columnFields = fieldOptions.fields;
|
|
3243
|
+
return Object.assign(Object.assign({}, variables), (_a = {}, _a[columnName] = _this.buildWhereSentence(key, options[key], columnFields || []), _a));
|
|
3244
|
+
}, {});
|
|
3245
|
+
if (!Array.isArray(options) && !lodash.isNil(fieldSentenceOptions.fields))
|
|
3246
|
+
return _a = {},
|
|
3247
|
+
_a[fieldSentenceOptions.fields[0]] = _this.buildOperatorSentence(options, fieldSentenceOptions),
|
|
3248
|
+
_a;
|
|
3249
|
+
if (lodash.isObject(options) && !checkIfIsFilterOption(options))
|
|
3250
|
+
options = Object.values(options)[0];
|
|
3251
|
+
return Array.isArray(options)
|
|
3252
|
+
? options.reduce(function (whereSentence, option) { return (Object.assign(Object.assign({}, whereSentence), _this.buildOperatorSentence(option, fieldSentenceOptions))); }, {})
|
|
3253
|
+
: _this.buildOperatorSentence(options, fieldSentenceOptions);
|
|
3254
|
+
};
|
|
3255
|
+
_this.buildOperatorSentence = function (options, fieldOption) {
|
|
3256
|
+
var _a;
|
|
3257
|
+
return (_a = {},
|
|
3258
|
+
_a[_this.getHasuraOperator(options, fieldOption)] = getValueFromFilter(options, fieldOption),
|
|
3259
|
+
_a);
|
|
3260
|
+
};
|
|
3261
|
+
_this.getHasuraOperator = function (options, fieldOption) { return checkIfIsFilterOption(options)
|
|
3262
|
+
? fieldOption.type === HasuraGraphQLColumnType.Jsonb
|
|
3263
|
+
? _this.getHasuraJsonbOperator(options)
|
|
3264
|
+
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find(function (graphQLOperator) { return graphQLOperator === Object.keys(exports.Where).find(function (operator) { return exports.Where[operator] === (options === null || options === void 0 ? void 0 : options.operator); }); })]
|
|
3265
|
+
: HasuraGraphQLWhere.EQUALS; };
|
|
3266
|
+
_this.getHasuraJsonbOperator = function (options) { return options.operator === exports.Where.IN
|
|
3267
|
+
? '_contains'
|
|
3268
|
+
: options.operator === exports.Where.LIKE
|
|
3269
|
+
? '_has_keys_any'
|
|
3270
|
+
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find(function (graphQLOperator) { return graphQLOperator === Object.keys(exports.Where).find(function (operator) { return exports.Where[operator] === (options === null || options === void 0 ? void 0 : options.operator); }); })]; };
|
|
3271
|
+
return _this;
|
|
3272
|
+
}
|
|
3273
|
+
FindHasuraGraphQLMixin.prototype.find = function (options) {
|
|
3274
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3275
|
+
var _a, filters, limits, orderBy, variablesCount, variables, result, data, count;
|
|
3276
|
+
var _this = this;
|
|
3277
|
+
return __generator(this, function (_b) {
|
|
3278
|
+
switch (_b.label) {
|
|
3279
|
+
case 0:
|
|
3280
|
+
_a = options || {}, filters = _a.filters, limits = _a.limits, orderBy = _a.orderBy;
|
|
3281
|
+
variablesCount = Object.assign(Object.assign({}, (lodash.isNil(orderBy) ? {} : { order_by: { type: this.tableName + "_order_by!", list: true, value: orderBy } })), (lodash.isNil(filters)
|
|
3282
|
+
? {}
|
|
3283
|
+
: {
|
|
3284
|
+
where: {
|
|
3285
|
+
value: this.makeGraphQLWhere(filters, this.fields),
|
|
3286
|
+
type: this.tableName + "_bool_exp",
|
|
3287
|
+
required: true,
|
|
3288
|
+
},
|
|
3289
|
+
}));
|
|
3290
|
+
variables = Object.assign(Object.assign({}, (lodash.isNil(limits) ? {} : limits)), variablesCount);
|
|
3291
|
+
console.log(JSON.stringify(variables));
|
|
3292
|
+
return [4 /*yield*/, this.query([
|
|
3293
|
+
{
|
|
3294
|
+
operation: this.tableName,
|
|
3295
|
+
fields: this.fields,
|
|
3296
|
+
variables: variables,
|
|
3297
|
+
},
|
|
3298
|
+
{
|
|
3299
|
+
operation: this.tableName + "_aggregate",
|
|
3300
|
+
fields: [{ aggregate: ['count'] }],
|
|
3301
|
+
variables: variablesCount,
|
|
3302
|
+
},
|
|
3303
|
+
])];
|
|
3304
|
+
case 1:
|
|
3305
|
+
result = _b.sent();
|
|
3306
|
+
data = result[this.tableName].map(function (data) { return _this.convertDataFromHasura(data); });
|
|
3307
|
+
count = result[this.tableName + "_aggregate"].aggregate.count;
|
|
3308
|
+
return [2 /*return*/, { count: count, data: data }];
|
|
3309
|
+
}
|
|
3310
|
+
});
|
|
3311
|
+
});
|
|
3312
|
+
};
|
|
3313
|
+
return FindHasuraGraphQLMixin;
|
|
3314
|
+
}(MixinBase));
|
|
3315
|
+
};
|
|
3316
|
+
|
|
3317
|
+
var withCrudHasuraGraphQL = function (MixinBase) {
|
|
3318
|
+
return /** @class */ (function (_super) {
|
|
3319
|
+
__extends(CrudHasuraGraphQLMixin, _super);
|
|
3320
|
+
function CrudHasuraGraphQLMixin() {
|
|
3321
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3322
|
+
}
|
|
3323
|
+
return CrudHasuraGraphQLMixin;
|
|
3324
|
+
}(withUpdateHasuraGraphQL(withGetHasuraGraphQL(withFindHasuraGraphQL(withDeleteHasuraGraphQL(withCreateHasuraGraphQL(MixinBase)))))));
|
|
3325
|
+
};
|
|
3326
|
+
|
|
3327
|
+
var CategoryHasuraGraphQLRepository = /** @class */ (function (_super_1) {
|
|
3328
|
+
__extends(CategoryHasuraGraphQLRepository, _super_1);
|
|
3329
|
+
function CategoryHasuraGraphQLRepository(endpoint, authOptions, productRepository) {
|
|
3330
|
+
var _this = _super_1.call(this, {
|
|
3331
|
+
tableName: 'category',
|
|
3332
|
+
model: Category,
|
|
3333
|
+
endpoint: endpoint,
|
|
3334
|
+
authOptions: authOptions,
|
|
3335
|
+
fields: [
|
|
3336
|
+
{ id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
|
|
3337
|
+
'firestore_id',
|
|
3338
|
+
'name',
|
|
3339
|
+
'description',
|
|
3340
|
+
'image',
|
|
3341
|
+
'published',
|
|
3342
|
+
'shop',
|
|
3343
|
+
'slug',
|
|
3344
|
+
{ brandCategory: { columnName: 'brand_category' } },
|
|
3345
|
+
{ brandCategoryBanner: { columnName: 'brand_banner' } },
|
|
3346
|
+
{ brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
|
|
3347
|
+
{ brandLogo: { columnName: 'brand_logo' } },
|
|
3348
|
+
{ conditions: { columnName: 'brand_condition' } },
|
|
3349
|
+
{
|
|
3350
|
+
conditions: {
|
|
3351
|
+
columnName: 'tag_condition',
|
|
3352
|
+
from: function (tags, row) { return ({ brand: row.brand_condition, tags: tags }); },
|
|
3353
|
+
},
|
|
3354
|
+
},
|
|
3355
|
+
'filters',
|
|
3356
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
3357
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
3358
|
+
{
|
|
3359
|
+
products: {
|
|
3360
|
+
columnName: 'products',
|
|
3361
|
+
fields: ['product_id'],
|
|
3362
|
+
from: function (value) { return value.map(function (product) { return product.product_id.toString(); }); },
|
|
3363
|
+
},
|
|
3364
|
+
},
|
|
3365
|
+
],
|
|
3366
|
+
}) || this;
|
|
3367
|
+
_this.productRepository = productRepository;
|
|
3368
|
+
return _this;
|
|
3369
|
+
}
|
|
3370
|
+
CategoryHasuraGraphQLRepository.prototype.get = function (identifiers) {
|
|
3371
|
+
var _super = Object.create(null, {
|
|
3372
|
+
get: { get: function () { return _super_1.prototype.get; } }
|
|
3373
|
+
});
|
|
3374
|
+
var _a;
|
|
3375
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3376
|
+
var _b;
|
|
3377
|
+
return __generator(this, function (_c) {
|
|
3378
|
+
switch (_c.label) {
|
|
3379
|
+
case 0:
|
|
3380
|
+
if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
|
|
3381
|
+
return [4 /*yield*/, this.find({ filters: { firestore_id: identifiers.id } })];
|
|
3382
|
+
case 1:
|
|
3383
|
+
_b = (_a = (_c.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
|
|
3384
|
+
return [3 /*break*/, 3];
|
|
3385
|
+
case 2:
|
|
3386
|
+
_b = _super.get.call(this, identifiers);
|
|
3387
|
+
_c.label = 3;
|
|
3388
|
+
case 3: return [2 /*return*/, _b];
|
|
3389
|
+
}
|
|
3390
|
+
});
|
|
3391
|
+
});
|
|
3392
|
+
};
|
|
3393
|
+
CategoryHasuraGraphQLRepository.prototype.getCategoryBySlug = function (slug, shop) {
|
|
3394
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3395
|
+
var _b, data, count;
|
|
3396
|
+
return __generator(this, function (_c) {
|
|
3397
|
+
switch (_c.label) {
|
|
3398
|
+
case 0:
|
|
3399
|
+
if (!slug)
|
|
3400
|
+
return [2 /*return*/];
|
|
3401
|
+
return [4 /*yield*/, this.find({ filters: { slug: slug, shop: shop, published: true } })];
|
|
3402
|
+
case 1:
|
|
3403
|
+
_b = _c.sent(), data = _b.data, count = _b.count;
|
|
3404
|
+
if (count > 1)
|
|
3405
|
+
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
3406
|
+
if (!count)
|
|
3407
|
+
throw new NotFoundError("Category with slug " + slug + " not found");
|
|
3408
|
+
return [2 /*return*/, data.shift()];
|
|
3409
|
+
}
|
|
3410
|
+
});
|
|
3411
|
+
});
|
|
3412
|
+
};
|
|
3413
|
+
CategoryHasuraGraphQLRepository.prototype.getCategoriesForHome = function (categoryIds, limit) {
|
|
3414
|
+
if (limit === void 0) { limit = 4; }
|
|
3415
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3416
|
+
var _b, categories, count, homeSections;
|
|
3417
|
+
var _this = this;
|
|
3418
|
+
return __generator(this, function (_c) {
|
|
3419
|
+
switch (_c.label) {
|
|
3420
|
+
case 0: return [4 /*yield*/, this.find({
|
|
3421
|
+
filters: { firestore_id: { operator: exports.Where.IN, value: categoryIds.filter(Boolean) }, published: true },
|
|
3422
|
+
})];
|
|
3423
|
+
case 1:
|
|
3424
|
+
_b = _c.sent(), categories = _b.data, count = _b.count;
|
|
3425
|
+
if (!count)
|
|
3426
|
+
throw new NotFoundError('Categories not found');
|
|
3427
|
+
return [4 /*yield*/, Promise.all(categories.map(function (category) { return __awaiter(_this, void 0, void 0, function () {
|
|
3428
|
+
var _b;
|
|
3429
|
+
return __generator(this, function (_c) {
|
|
3430
|
+
switch (_c.label) {
|
|
3431
|
+
case 0:
|
|
3432
|
+
_b = {
|
|
3433
|
+
category: category
|
|
3434
|
+
};
|
|
3435
|
+
return [4 /*yield*/, this.mountCategory(category, { limit: limit, hasStock: true })];
|
|
3436
|
+
case 1: return [2 /*return*/, (_b.products = _c.sent(),
|
|
3437
|
+
_b)];
|
|
3438
|
+
}
|
|
3439
|
+
});
|
|
3440
|
+
}); }))];
|
|
3441
|
+
case 2:
|
|
3442
|
+
homeSections = _c.sent();
|
|
3443
|
+
return [2 /*return*/, homeSections];
|
|
3444
|
+
}
|
|
3445
|
+
});
|
|
3446
|
+
});
|
|
3447
|
+
};
|
|
3448
|
+
CategoryHasuraGraphQLRepository.prototype.mountCategory = function (category, options) {
|
|
3449
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3450
|
+
var products, publishedField, productsData;
|
|
3451
|
+
var _b;
|
|
3452
|
+
return __generator(this, function (_c) {
|
|
3453
|
+
switch (_c.label) {
|
|
3454
|
+
case 0:
|
|
3455
|
+
if (!category.products)
|
|
3456
|
+
throw new RequiredArgumentError(['Category products is empty']);
|
|
3457
|
+
console.log(category);
|
|
3458
|
+
console.log(category.products);
|
|
3459
|
+
products = [];
|
|
3460
|
+
publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
3461
|
+
return [4 /*yield*/, this.productRepository.find(Object.assign({ filters: (_b = {
|
|
3462
|
+
id: { operator: exports.Where.IN, value: category.products }
|
|
3463
|
+
},
|
|
3464
|
+
_b[publishedField] = true,
|
|
3465
|
+
_b) }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})))];
|
|
3466
|
+
case 1:
|
|
3467
|
+
productsData = (_c.sent()).data;
|
|
3468
|
+
products.push.apply(products, __spreadArray([], __read(productsData)));
|
|
3469
|
+
return [2 /*return*/, products];
|
|
3470
|
+
}
|
|
3471
|
+
});
|
|
3472
|
+
});
|
|
3473
|
+
};
|
|
3474
|
+
return CategoryHasuraGraphQLRepository;
|
|
3475
|
+
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
3476
|
+
|
|
3477
|
+
var ProductHasuraGraphQLRepository = /** @class */ (function (_super) {
|
|
3478
|
+
__extends(ProductHasuraGraphQLRepository, _super);
|
|
3479
|
+
function ProductHasuraGraphQLRepository(endpoint, authOptions) {
|
|
3480
|
+
return _super.call(this, {
|
|
3481
|
+
tableName: 'product',
|
|
3482
|
+
model: Product,
|
|
3483
|
+
endpoint: endpoint,
|
|
3484
|
+
authOptions: authOptions,
|
|
3485
|
+
fields: [
|
|
3486
|
+
{ id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
|
|
3487
|
+
{ CEST: { columnName: 'cest' } },
|
|
3488
|
+
{ EAN: { columnName: 'ean' } },
|
|
3489
|
+
{ NCM: { columnName: 'ncm' } },
|
|
3490
|
+
'brand',
|
|
3491
|
+
{ costPrice: { columnName: 'cost_price' } },
|
|
3492
|
+
'description',
|
|
3493
|
+
{ hasVariants: { columnName: 'has_variants' } },
|
|
3494
|
+
'images',
|
|
3495
|
+
'miniatures',
|
|
3496
|
+
'name',
|
|
3497
|
+
{ price: { columnName: 'full_price' } },
|
|
3498
|
+
{ price: { columnName: 'subscriber_discount_percentage' } },
|
|
3499
|
+
{ price: { columnName: 'subscriber_price' } },
|
|
3500
|
+
{
|
|
3501
|
+
price: {
|
|
3502
|
+
columnName: 'price',
|
|
3503
|
+
from: function (price, data) { return Object.values(exports.Shops).reduce(function (prices, shop) {
|
|
3504
|
+
var _b;
|
|
3505
|
+
return (Object.assign(Object.assign({}, prices), (_b = {}, _b[shop] = {
|
|
3506
|
+
price: price,
|
|
3507
|
+
fullPrice: data.full_price,
|
|
3508
|
+
subscriberDiscountPercentage: data.subscriber_discount_percentage,
|
|
3509
|
+
subscriberPrice: data.subscriber_price,
|
|
3510
|
+
}, _b)));
|
|
3511
|
+
}, {}); },
|
|
3512
|
+
},
|
|
3513
|
+
},
|
|
3514
|
+
'published',
|
|
3515
|
+
{ publishedGlam: { columnName: 'published_glam' } },
|
|
3516
|
+
'sku',
|
|
3517
|
+
{
|
|
3518
|
+
stock: {
|
|
3519
|
+
columnName: 'stock',
|
|
3520
|
+
from: function (quantity) { return ({ quantity: quantity }); },
|
|
3521
|
+
to: function (value) { return (value === null || value === void 0 ? void 0 : value.quantity) || value; },
|
|
3522
|
+
},
|
|
3523
|
+
},
|
|
3524
|
+
'type',
|
|
3525
|
+
'video',
|
|
3526
|
+
'weight',
|
|
3527
|
+
{
|
|
3528
|
+
categories: {
|
|
3529
|
+
columnName: 'categories',
|
|
3530
|
+
fields: ['category_id'],
|
|
3531
|
+
to: function (category_id) { return +category_id; },
|
|
3532
|
+
from: function (categories) { return (categories === null || categories === void 0 ? void 0 : categories.map(function (category) { var _a; return (_a = category === null || category === void 0 ? void 0 : category.category_id) === null || _a === void 0 ? void 0 : _a.toString(); })) || []; },
|
|
3533
|
+
},
|
|
3534
|
+
},
|
|
3535
|
+
{
|
|
3536
|
+
shopAvailability: {
|
|
3537
|
+
columnName: 'shop_availabilities',
|
|
3538
|
+
fields: ['shop'],
|
|
3539
|
+
from: function (shop) { return (Array.isArray(shop) ? shop.map(function (row) { return row.shop; }) : []); },
|
|
3540
|
+
},
|
|
3541
|
+
},
|
|
3542
|
+
{ tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
|
|
3543
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
3544
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
3545
|
+
],
|
|
3546
|
+
}) || this;
|
|
3547
|
+
}
|
|
3548
|
+
ProductHasuraGraphQLRepository.prototype.getBySlug = function (slug, shop) {
|
|
3549
|
+
var _a;
|
|
3550
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3551
|
+
var result;
|
|
3552
|
+
return __generator(this, function (_b) {
|
|
3553
|
+
switch (_b.label) {
|
|
3554
|
+
case 0: return [4 /*yield*/, this.find({
|
|
3555
|
+
filters: {
|
|
3556
|
+
slug: { operator: exports.Where.EQUALS, value: slug },
|
|
3557
|
+
shopAvailability: { operator: exports.Where.IN, value: [shop] },
|
|
3558
|
+
},
|
|
3559
|
+
})];
|
|
3560
|
+
case 1:
|
|
3561
|
+
result = _b.sent();
|
|
3562
|
+
return [2 /*return*/, (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift()];
|
|
3563
|
+
}
|
|
3564
|
+
});
|
|
3565
|
+
});
|
|
3566
|
+
};
|
|
3567
|
+
return ProductHasuraGraphQLRepository;
|
|
3568
|
+
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
3569
|
+
|
|
2666
3570
|
/**
|
|
2667
3571
|
* Generated bundle index. Do not edit.
|
|
2668
3572
|
*/
|
|
@@ -2671,6 +3575,42 @@
|
|
|
2671
3575
|
enumerable: true,
|
|
2672
3576
|
get: function () { return dateFns.add; }
|
|
2673
3577
|
});
|
|
3578
|
+
Object.defineProperty(exports, 'addBusinessDays', {
|
|
3579
|
+
enumerable: true,
|
|
3580
|
+
get: function () { return dateFns.addBusinessDays; }
|
|
3581
|
+
});
|
|
3582
|
+
Object.defineProperty(exports, 'addDays', {
|
|
3583
|
+
enumerable: true,
|
|
3584
|
+
get: function () { return dateFns.addDays; }
|
|
3585
|
+
});
|
|
3586
|
+
Object.defineProperty(exports, 'addMonths', {
|
|
3587
|
+
enumerable: true,
|
|
3588
|
+
get: function () { return dateFns.addMonths; }
|
|
3589
|
+
});
|
|
3590
|
+
Object.defineProperty(exports, 'addYears', {
|
|
3591
|
+
enumerable: true,
|
|
3592
|
+
get: function () { return dateFns.addYears; }
|
|
3593
|
+
});
|
|
3594
|
+
Object.defineProperty(exports, 'endOfDay', {
|
|
3595
|
+
enumerable: true,
|
|
3596
|
+
get: function () { return dateFns.endOfDay; }
|
|
3597
|
+
});
|
|
3598
|
+
Object.defineProperty(exports, 'format', {
|
|
3599
|
+
enumerable: true,
|
|
3600
|
+
get: function () { return dateFns.format; }
|
|
3601
|
+
});
|
|
3602
|
+
Object.defineProperty(exports, 'formatISO9075', {
|
|
3603
|
+
enumerable: true,
|
|
3604
|
+
get: function () { return dateFns.formatISO9075; }
|
|
3605
|
+
});
|
|
3606
|
+
Object.defineProperty(exports, 'parseISO', {
|
|
3607
|
+
enumerable: true,
|
|
3608
|
+
get: function () { return dateFns.parseISO; }
|
|
3609
|
+
});
|
|
3610
|
+
Object.defineProperty(exports, 'startOfDay', {
|
|
3611
|
+
enumerable: true,
|
|
3612
|
+
get: function () { return dateFns.startOfDay; }
|
|
3613
|
+
});
|
|
2674
3614
|
Object.defineProperty(exports, 'sub', {
|
|
2675
3615
|
enumerable: true,
|
|
2676
3616
|
get: function () { return dateFns.sub; }
|
|
@@ -2679,9 +3619,9 @@
|
|
|
2679
3619
|
enumerable: true,
|
|
2680
3620
|
get: function () { return lodash.chunk; }
|
|
2681
3621
|
});
|
|
2682
|
-
Object.defineProperty(exports, '
|
|
3622
|
+
Object.defineProperty(exports, 'isBoolean', {
|
|
2683
3623
|
enumerable: true,
|
|
2684
|
-
get: function () { return lodash.
|
|
3624
|
+
get: function () { return lodash.isBoolean; }
|
|
2685
3625
|
});
|
|
2686
3626
|
Object.defineProperty(exports, 'isDate', {
|
|
2687
3627
|
enumerable: true,
|
|
@@ -2691,6 +3631,14 @@
|
|
|
2691
3631
|
enumerable: true,
|
|
2692
3632
|
get: function () { return lodash.isEmpty; }
|
|
2693
3633
|
});
|
|
3634
|
+
Object.defineProperty(exports, 'isInteger', {
|
|
3635
|
+
enumerable: true,
|
|
3636
|
+
get: function () { return lodash.isInteger; }
|
|
3637
|
+
});
|
|
3638
|
+
Object.defineProperty(exports, 'isNaN', {
|
|
3639
|
+
enumerable: true,
|
|
3640
|
+
get: function () { return lodash.isNaN; }
|
|
3641
|
+
});
|
|
2694
3642
|
Object.defineProperty(exports, 'isNil', {
|
|
2695
3643
|
enumerable: true,
|
|
2696
3644
|
get: function () { return lodash.isNil; }
|
|
@@ -2707,6 +3655,14 @@
|
|
|
2707
3655
|
enumerable: true,
|
|
2708
3656
|
get: function () { return lodash.isString; }
|
|
2709
3657
|
});
|
|
3658
|
+
Object.defineProperty(exports, 'now', {
|
|
3659
|
+
enumerable: true,
|
|
3660
|
+
get: function () { return lodash.now; }
|
|
3661
|
+
});
|
|
3662
|
+
Object.defineProperty(exports, 'omit', {
|
|
3663
|
+
enumerable: true,
|
|
3664
|
+
get: function () { return lodash.omit; }
|
|
3665
|
+
});
|
|
2710
3666
|
Object.defineProperty(exports, 'pick', {
|
|
2711
3667
|
enumerable: true,
|
|
2712
3668
|
get: function () { return lodash.pick; }
|
|
@@ -2727,15 +3683,16 @@
|
|
|
2727
3683
|
exports.Buy2WinFirestoreRepository = Buy2WinFirestoreRepository;
|
|
2728
3684
|
exports.Category = Category;
|
|
2729
3685
|
exports.CategoryFirestoreRepository = CategoryFirestoreRepository;
|
|
3686
|
+
exports.CategoryHasuraGraphQLRepository = CategoryHasuraGraphQLRepository;
|
|
2730
3687
|
exports.Checkout = Checkout;
|
|
2731
3688
|
exports.CheckoutFirestoreRepository = CheckoutFirestoreRepository;
|
|
2732
3689
|
exports.CheckoutSubscription = CheckoutSubscription;
|
|
2733
3690
|
exports.CheckoutSubscriptionFirestoreRepository = CheckoutSubscriptionFirestoreRepository;
|
|
2734
|
-
exports.ClubCoupon = ClubCoupon;
|
|
2735
3691
|
exports.Coupon = Coupon;
|
|
2736
3692
|
exports.CouponFirestoreRepository = CouponFirestoreRepository;
|
|
2737
3693
|
exports.DuplicatedResultsError = DuplicatedResultsError;
|
|
2738
3694
|
exports.Edition = Edition;
|
|
3695
|
+
exports.FinancialCoupon = FinancialCoupon;
|
|
2739
3696
|
exports.Home = Home;
|
|
2740
3697
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
2741
3698
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
@@ -2750,6 +3707,7 @@
|
|
|
2750
3707
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|
|
2751
3708
|
exports.Product = Product;
|
|
2752
3709
|
exports.ProductFirestoreRepository = ProductFirestoreRepository;
|
|
3710
|
+
exports.ProductHasuraGraphQLRepository = ProductHasuraGraphQLRepository;
|
|
2753
3711
|
exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
|
|
2754
3712
|
exports.ProductsIndex = ProductsIndex;
|
|
2755
3713
|
exports.RecoveryPassword = RecoveryPassword;
|
|
@@ -2760,7 +3718,6 @@
|
|
|
2760
3718
|
exports.ShopMenu = ShopMenu;
|
|
2761
3719
|
exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
|
|
2762
3720
|
exports.SignOut = SignOut;
|
|
2763
|
-
exports.StoreCoupon = StoreCoupon;
|
|
2764
3721
|
exports.Subscription = Subscription;
|
|
2765
3722
|
exports.SubscriptionEditionFirestoreRepository = SubscriptionEditionFirestoreRepository;
|
|
2766
3723
|
exports.SubscriptionFirestoreRepository = SubscriptionFirestoreRepository;
|
|
@@ -2781,15 +3738,24 @@
|
|
|
2781
3738
|
exports.UserSearchFirestoreRepository = UserSearchFirestoreRepository;
|
|
2782
3739
|
exports.Variant = Variant;
|
|
2783
3740
|
exports.WeakPasswordError = WeakPasswordError;
|
|
3741
|
+
exports.isUUID = isUUID;
|
|
3742
|
+
exports.parseDateTime = parseDateTime;
|
|
2784
3743
|
exports.withCreateFirestore = withCreateFirestore;
|
|
3744
|
+
exports.withCreateHasuraGraphQL = withCreateHasuraGraphQL;
|
|
2785
3745
|
exports.withCrudFirestore = withCrudFirestore;
|
|
3746
|
+
exports.withCrudHasuraGraphQL = withCrudHasuraGraphQL;
|
|
2786
3747
|
exports.withDeleteFirestore = withDeleteFirestore;
|
|
3748
|
+
exports.withDeleteHasuraGraphQL = withDeleteHasuraGraphQL;
|
|
2787
3749
|
exports.withFindFirestore = withFindFirestore;
|
|
3750
|
+
exports.withFindHasuraGraphQL = withFindHasuraGraphQL;
|
|
2788
3751
|
exports.withFirestore = withFirestore;
|
|
2789
3752
|
exports.withGetFirestore = withGetFirestore;
|
|
3753
|
+
exports.withGetHasuraGraphQL = withGetHasuraGraphQL;
|
|
3754
|
+
exports.withHasuraGraphQL = withHasuraGraphQL;
|
|
2790
3755
|
exports.withHelpers = withHelpers;
|
|
2791
3756
|
exports.withSubCollection = withSubCollection;
|
|
2792
3757
|
exports.withUpdateFirestore = withUpdateFirestore;
|
|
3758
|
+
exports.withUpdateHasuraGraphQL = withUpdateHasuraGraphQL;
|
|
2793
3759
|
|
|
2794
3760
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2795
3761
|
|