@vendure/core 2.0.0-next.1 → 2.0.0-next.12
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/dist/api/api-internal-modules.d.ts +2 -1
- package/dist/api/api-internal-modules.js +2 -0
- package/dist/api/api-internal-modules.js.map +1 -1
- package/dist/api/common/configurable-operation-codec.js +2 -2
- package/dist/api/common/configurable-operation-codec.js.map +1 -1
- package/dist/api/common/custom-field-relation-resolver.service.d.ts +3 -1
- package/dist/api/common/custom-field-relation-resolver.service.js +7 -5
- package/dist/api/common/custom-field-relation-resolver.service.js.map +1 -1
- package/dist/api/common/id-codec.js +6 -2
- package/dist/api/common/id-codec.js.map +1 -1
- package/dist/api/config/configure-graphql-module.js +2 -0
- package/dist/api/config/configure-graphql-module.js.map +1 -1
- package/dist/api/config/generate-permissions.js +29 -4
- package/dist/api/config/generate-permissions.js.map +1 -1
- package/dist/api/config/generate-resolvers.d.ts +3 -0
- package/dist/api/config/generate-resolvers.js +16 -5
- package/dist/api/config/generate-resolvers.js.map +1 -1
- package/dist/api/decorators/relations.decorator.d.ts +116 -0
- package/dist/api/decorators/relations.decorator.js +202 -0
- package/dist/api/decorators/relations.decorator.js.map +1 -0
- package/dist/api/decorators/request-context.decorator.js +9 -2
- package/dist/api/decorators/request-context.decorator.js.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/middleware/transaction-interceptor.d.ts +9 -0
- package/dist/api/middleware/transaction-interceptor.js +16 -1
- package/dist/api/middleware/transaction-interceptor.js.map +1 -1
- package/dist/api/resolvers/admin/administrator.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/administrator.resolver.js +10 -6
- package/dist/api/resolvers/admin/administrator.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/asset.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/asset.resolver.js +10 -6
- package/dist/api/resolvers/admin/asset.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/channel.resolver.js +2 -2
- package/dist/api/resolvers/admin/channel.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/collection.resolver.d.ts +5 -3
- package/dist/api/resolvers/admin/collection.resolver.js +30 -7
- package/dist/api/resolvers/admin/collection.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/country.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/country.resolver.js +10 -6
- package/dist/api/resolvers/admin/country.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/customer-group.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/customer-group.resolver.js +8 -4
- package/dist/api/resolvers/admin/customer-group.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/customer.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/customer.resolver.js +10 -6
- package/dist/api/resolvers/admin/customer.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/facet.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/facet.resolver.js +10 -6
- package/dist/api/resolvers/admin/facet.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/order.resolver.d.ts +8 -6
- package/dist/api/resolvers/admin/order.resolver.js +37 -11
- package/dist/api/resolvers/admin/order.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/payment-method.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/payment-method.resolver.js +10 -6
- package/dist/api/resolvers/admin/payment-method.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/product-option.resolver.d.ts +5 -3
- package/dist/api/resolvers/admin/product-option.resolver.js +21 -4
- package/dist/api/resolvers/admin/product-option.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/product.resolver.d.ts +4 -3
- package/dist/api/resolvers/admin/product.resolver.js +16 -10
- package/dist/api/resolvers/admin/product.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/promotion.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/promotion.resolver.js +9 -6
- package/dist/api/resolvers/admin/promotion.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/role.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/role.resolver.js +10 -6
- package/dist/api/resolvers/admin/role.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/shipping-method.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/shipping-method.resolver.js +10 -6
- package/dist/api/resolvers/admin/shipping-method.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/tax-rate.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/tax-rate.resolver.js +10 -6
- package/dist/api/resolvers/admin/tax-rate.resolver.js.map +1 -1
- package/dist/api/resolvers/base/base-auth.resolver.d.ts +2 -2
- package/dist/api/resolvers/base/base-auth.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/collection-entity.resolver.d.ts +3 -1
- package/dist/api/resolvers/entity/collection-entity.resolver.js +17 -4
- package/dist/api/resolvers/entity/collection-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/country-entity.resolver.d.ts +1 -0
- package/dist/api/resolvers/entity/country-entity.resolver.js +11 -0
- package/dist/api/resolvers/entity/country-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/customer-entity.resolver.d.ts +2 -1
- package/dist/api/resolvers/entity/customer-entity.resolver.js +5 -3
- package/dist/api/resolvers/entity/customer-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/facet-entity.resolver.d.ts +1 -0
- package/dist/api/resolvers/entity/facet-entity.resolver.js +11 -0
- package/dist/api/resolvers/entity/facet-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/facet-value-entity.resolver.d.ts +1 -0
- package/dist/api/resolvers/entity/facet-value-entity.resolver.js +11 -0
- package/dist/api/resolvers/entity/facet-value-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/fulfillment-entity.resolver.d.ts +8 -2
- package/dist/api/resolvers/entity/fulfillment-entity.resolver.js +17 -3
- package/dist/api/resolvers/entity/fulfillment-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/order-item-entity.resolver.d.ts +3 -1
- package/dist/api/resolvers/entity/order-item-entity.resolver.js +9 -3
- package/dist/api/resolvers/entity/order-item-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/order-line-entity.resolver.d.ts +8 -3
- package/dist/api/resolvers/entity/order-line-entity.resolver.js +36 -2
- package/dist/api/resolvers/entity/order-line-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/payment-entity.resolver.d.ts +3 -1
- package/dist/api/resolvers/entity/payment-entity.resolver.js +6 -3
- package/dist/api/resolvers/entity/payment-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/product-entity.resolver.d.ts +4 -2
- package/dist/api/resolvers/entity/product-entity.resolver.js +21 -6
- package/dist/api/resolvers/entity/product-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/product-option-entity.resolver.d.ts +1 -0
- package/dist/api/resolvers/entity/product-option-entity.resolver.js +11 -0
- package/dist/api/resolvers/entity/product-option-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/product-option-group-entity.resolver.d.ts +1 -0
- package/dist/api/resolvers/entity/product-option-group-entity.resolver.js +19 -3
- package/dist/api/resolvers/entity/product-option-group-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/product-variant-entity.resolver.d.ts +1 -0
- package/dist/api/resolvers/entity/product-variant-entity.resolver.js +12 -0
- package/dist/api/resolvers/entity/product-variant-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/shipping-method-entity.resolver.d.ts +10 -0
- package/dist/api/resolvers/entity/shipping-method-entity.resolver.js +64 -0
- package/dist/api/resolvers/entity/shipping-method-entity.resolver.js.map +1 -0
- package/dist/api/resolvers/shop/shop-order.resolver.d.ts +4 -3
- package/dist/api/resolvers/shop/shop-order.resolver.js +16 -8
- package/dist/api/resolvers/shop/shop-order.resolver.js.map +1 -1
- package/dist/api/resolvers/shop/shop-products.resolver.d.ts +8 -8
- package/dist/api/resolvers/shop/shop-products.resolver.js +38 -21
- package/dist/api/resolvers/shop/shop-products.resolver.js.map +1 -1
- package/dist/api/schema/admin-api/collection.api.graphql +8 -0
- package/dist/api/schema/admin-api/order.api.graphql +15 -0
- package/dist/api/schema/admin-api/product-option-group.api.graphql +2 -0
- package/dist/api/schema/common/common-error-results.graphql +22 -0
- package/dist/api/schema/common/order.type.graphql +7 -0
- package/dist/api/schema/common/shipping-method.type.graphql +1 -0
- package/dist/api/schema/shop-api/shop-error-results.graphql +0 -29
- package/dist/bootstrap.js +10 -6
- package/dist/bootstrap.js.map +1 -1
- package/dist/common/calculated-decorator.d.ts +16 -3
- package/dist/common/calculated-decorator.js +3 -0
- package/dist/common/calculated-decorator.js.map +1 -1
- package/dist/common/configurable-operation.js +9 -4
- package/dist/common/configurable-operation.js.map +1 -1
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +2 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/error/errors.d.ts +1 -0
- package/dist/common/error/errors.js.map +1 -1
- package/dist/common/error/generated-graphql-admin-errors.d.ts +41 -0
- package/dist/common/error/generated-graphql-admin-errors.js +48 -2
- package/dist/common/error/generated-graphql-admin-errors.js.map +1 -1
- package/dist/common/finite-state-machine/finite-state-machine.js +2 -1
- package/dist/common/finite-state-machine/finite-state-machine.js.map +1 -1
- package/dist/common/self-refreshing-cache.d.ts +5 -2
- package/dist/common/self-refreshing-cache.js +9 -7
- package/dist/common/self-refreshing-cache.js.map +1 -1
- package/dist/common/types/entity-relation-paths.d.ts +1 -1
- package/dist/config/asset-import-strategy/asset-import-strategy.d.ts +24 -0
- package/dist/config/asset-import-strategy/asset-import-strategy.js +3 -0
- package/dist/config/asset-import-strategy/asset-import-strategy.js.map +1 -0
- package/dist/config/asset-import-strategy/default-asset-import-strategy.d.ts +24 -0
- package/dist/config/asset-import-strategy/default-asset-import-strategy.js +89 -0
- package/dist/config/asset-import-strategy/default-asset-import-strategy.js.map +1 -0
- package/dist/config/asset-naming-strategy/default-asset-naming-strategy.js +1 -1
- package/dist/config/asset-naming-strategy/default-asset-naming-strategy.js.map +1 -1
- package/dist/config/catalog/collection-filter.d.ts +32 -0
- package/dist/config/catalog/collection-filter.js +32 -0
- package/dist/config/catalog/collection-filter.js.map +1 -1
- package/dist/config/catalog/default-collection-filters.d.ts +100 -0
- package/dist/config/catalog/default-collection-filters.js +154 -21
- package/dist/config/catalog/default-collection-filters.js.map +1 -1
- package/dist/config/config-helpers.d.ts +4 -0
- package/dist/config/config-helpers.js +8 -1
- package/dist/config/config-helpers.js.map +1 -1
- package/dist/config/config.module.js +13 -0
- package/dist/config/config.module.js.map +1 -1
- package/dist/config/config.service.d.ts +2 -1
- package/dist/config/config.service.js +3 -0
- package/dist/config/config.service.js.map +1 -1
- package/dist/config/custom-field/custom-field-types.d.ts +3 -0
- package/dist/config/default-config.js +8 -0
- package/dist/config/default-config.js.map +1 -1
- package/dist/config/entity-id-strategy/entity-id-strategy.d.ts +7 -0
- package/dist/config/entity-metadata/add-foreign-key-indices.d.ts +12 -0
- package/dist/config/entity-metadata/add-foreign-key-indices.js +33 -0
- package/dist/config/entity-metadata/add-foreign-key-indices.js.map +1 -0
- package/dist/config/entity-metadata/entity-metadata-modifier.d.ts +55 -0
- package/dist/config/entity-metadata/entity-metadata-modifier.js +3 -0
- package/dist/config/entity-metadata/entity-metadata-modifier.js.map +1 -0
- package/dist/config/fulfillment/custom-fulfillment-process.d.ts +2 -2
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.js +4 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/logger/vendure-logger.d.ts +1 -0
- package/dist/config/logger/vendure-logger.js.map +1 -1
- package/dist/config/order/custom-order-process.d.ts +2 -2
- package/dist/config/order/order-item-price-calculation-strategy.d.ts +3 -0
- package/dist/config/payment/custom-payment-process.d.ts +2 -2
- package/dist/config/payment/dummy-payment-method-handler.js +10 -2
- package/dist/config/payment/dummy-payment-method-handler.js.map +1 -1
- package/dist/config/payment/example-payment-method-handler.js +2 -2
- package/dist/config/payment/example-payment-method-handler.js.map +1 -1
- package/dist/config/payment/payment-method-eligibility-checker.d.ts +3 -3
- package/dist/config/payment/payment-method-eligibility-checker.js +2 -2
- package/dist/config/payment/payment-method-eligibility-checker.js.map +1 -1
- package/dist/config/payment/payment-method-handler.d.ts +73 -8
- package/dist/config/payment/payment-method-handler.js +17 -7
- package/dist/config/payment/payment-method-handler.js.map +1 -1
- package/dist/config/promotion/actions/facet-values-percentage-discount-action.js +1 -1
- package/dist/config/promotion/actions/facet-values-percentage-discount-action.js.map +1 -1
- package/dist/config/promotion/actions/order-fixed-discount-action.js +1 -1
- package/dist/config/promotion/actions/order-fixed-discount-action.js.map +1 -1
- package/dist/config/promotion/conditions/has-facet-values-condition.js +1 -1
- package/dist/config/promotion/conditions/has-facet-values-condition.js.map +1 -1
- package/dist/config/promotion/index.d.ts +4 -0
- package/dist/config/promotion/index.js +4 -0
- package/dist/config/promotion/index.js.map +1 -1
- package/dist/config/promotion/utils/facet-value-checker.d.ts +2 -1
- package/dist/config/promotion/utils/facet-value-checker.js +2 -2
- package/dist/config/promotion/utils/facet-value-checker.js.map +1 -1
- package/dist/config/shipping-method/shipping-calculator.d.ts +3 -3
- package/dist/config/shipping-method/shipping-calculator.js +2 -2
- package/dist/config/shipping-method/shipping-calculator.js.map +1 -1
- package/dist/config/shipping-method/shipping-eligibility-checker.d.ts +4 -4
- package/dist/config/shipping-method/shipping-eligibility-checker.js +5 -5
- package/dist/config/shipping-method/shipping-eligibility-checker.js.map +1 -1
- package/dist/config/system/health-check-strategy.d.ts +47 -0
- package/dist/config/system/health-check-strategy.js +3 -0
- package/dist/config/system/health-check-strategy.js.map +1 -0
- package/dist/config/vendure-config.d.ts +79 -0
- package/dist/connection/connection.module.d.ts +1 -1
- package/dist/connection/remove-custom-fields-with-eager-relations.d.ts +34 -0
- package/dist/connection/remove-custom-fields-with-eager-relations.js +55 -0
- package/dist/connection/remove-custom-fields-with-eager-relations.js.map +1 -0
- package/dist/connection/transaction-subscriber.d.ts +16 -2
- package/dist/connection/transaction-subscriber.js +27 -6
- package/dist/connection/transaction-subscriber.js.map +1 -1
- package/dist/connection/transaction-wrapper.d.ts +5 -1
- package/dist/connection/transaction-wrapper.js +14 -11
- package/dist/connection/transaction-wrapper.js.map +1 -1
- package/dist/connection/transactional-connection.d.ts +9 -3
- package/dist/connection/transactional-connection.js +27 -8
- package/dist/connection/transactional-connection.js.map +1 -1
- package/dist/data-import/providers/asset-importer/asset-importer.js +12 -18
- package/dist/data-import/providers/asset-importer/asset-importer.js.map +1 -1
- package/dist/data-import/providers/importer/fast-importer.service.js +11 -5
- package/dist/data-import/providers/importer/fast-importer.service.js.map +1 -1
- package/dist/data-import/providers/importer/importer.d.ts +3 -2
- package/dist/data-import/providers/importer/importer.js +15 -9
- package/dist/data-import/providers/importer/importer.js.map +1 -1
- package/dist/data-import/providers/populator/populator.js +1 -1
- package/dist/data-import/providers/populator/populator.js.map +1 -1
- package/dist/entity/address/address.entity.js +2 -0
- package/dist/entity/address/address.entity.js.map +1 -1
- package/dist/entity/asset/orderable-asset.entity.js +1 -0
- package/dist/entity/asset/orderable-asset.entity.js.map +1 -1
- package/dist/entity/authentication-method/authentication-method.entity.js +1 -0
- package/dist/entity/authentication-method/authentication-method.entity.js.map +1 -1
- package/dist/entity/channel/channel.entity.js +2 -0
- package/dist/entity/channel/channel.entity.js.map +1 -1
- package/dist/entity/collection/collection-translation.entity.js +1 -0
- package/dist/entity/collection/collection-translation.entity.js.map +1 -1
- package/dist/entity/collection/collection.entity.js +1 -0
- package/dist/entity/collection/collection.entity.js.map +1 -1
- package/dist/entity/country/country-translation.entity.js +1 -0
- package/dist/entity/country/country-translation.entity.js.map +1 -1
- package/dist/entity/facet/facet-translation.entity.js +1 -0
- package/dist/entity/facet/facet-translation.entity.js.map +1 -1
- package/dist/entity/facet-value/facet-value-translation.entity.js +1 -0
- package/dist/entity/facet-value/facet-value-translation.entity.js.map +1 -1
- package/dist/entity/facet-value/facet-value.entity.js +1 -0
- package/dist/entity/facet-value/facet-value.entity.js.map +1 -1
- package/dist/entity/history-entry/customer-history-entry.entity.js +1 -0
- package/dist/entity/history-entry/customer-history-entry.entity.js.map +1 -1
- package/dist/entity/history-entry/history-entry.entity.js +1 -0
- package/dist/entity/history-entry/history-entry.entity.js.map +1 -1
- package/dist/entity/history-entry/order-history-entry.entity.js +1 -0
- package/dist/entity/history-entry/order-history-entry.entity.js.map +1 -1
- package/dist/entity/order/order.entity.js +5 -2
- package/dist/entity/order/order.entity.js.map +1 -1
- package/dist/entity/order-item/order-item.entity.js +2 -0
- package/dist/entity/order-item/order-item.entity.js.map +1 -1
- package/dist/entity/order-line/order-line.entity.js +30 -22
- package/dist/entity/order-line/order-line.entity.js.map +1 -1
- package/dist/entity/order-modification/order-modification.entity.js +1 -0
- package/dist/entity/order-modification/order-modification.entity.js.map +1 -1
- package/dist/entity/payment/payment.entity.js +1 -0
- package/dist/entity/payment/payment.entity.js.map +1 -1
- package/dist/entity/product/product-translation.entity.js +1 -0
- package/dist/entity/product/product-translation.entity.js.map +1 -1
- package/dist/entity/product/product.entity.js +1 -0
- package/dist/entity/product/product.entity.js.map +1 -1
- package/dist/entity/product-option/product-option-translation.entity.js +1 -0
- package/dist/entity/product-option/product-option-translation.entity.js.map +1 -1
- package/dist/entity/product-option/product-option.entity.js +1 -0
- package/dist/entity/product-option/product-option.entity.js.map +1 -1
- package/dist/entity/product-option-group/product-option-group-translation.entity.js +1 -0
- package/dist/entity/product-option-group/product-option-group-translation.entity.js.map +1 -1
- package/dist/entity/product-option-group/product-option-group.entity.js +1 -0
- package/dist/entity/product-option-group/product-option-group.entity.js.map +1 -1
- package/dist/entity/product-variant/product-variant-price.entity.js +1 -0
- package/dist/entity/product-variant/product-variant-price.entity.js.map +1 -1
- package/dist/entity/product-variant/product-variant-translation.entity.js +1 -0
- package/dist/entity/product-variant/product-variant-translation.entity.js.map +1 -1
- package/dist/entity/product-variant/product-variant.entity.js +3 -0
- package/dist/entity/product-variant/product-variant.entity.js.map +1 -1
- package/dist/entity/refund/refund.entity.js +1 -0
- package/dist/entity/refund/refund.entity.js.map +1 -1
- package/dist/entity/register-custom-entity-fields.js +17 -2
- package/dist/entity/register-custom-entity-fields.js.map +1 -1
- package/dist/entity/run-entity-metadata-modifiers.d.ts +2 -0
- package/dist/entity/run-entity-metadata-modifiers.js +15 -0
- package/dist/entity/run-entity-metadata-modifiers.js.map +1 -0
- package/dist/entity/session/authenticated-session.entity.js +1 -0
- package/dist/entity/session/authenticated-session.entity.js.map +1 -1
- package/dist/entity/session/session.entity.js +2 -0
- package/dist/entity/session/session.entity.js.map +1 -1
- package/dist/entity/shipping-line/shipping-line.entity.js +2 -0
- package/dist/entity/shipping-line/shipping-line.entity.js.map +1 -1
- package/dist/entity/shipping-method/shipping-method-translation.entity.js +1 -0
- package/dist/entity/shipping-method/shipping-method-translation.entity.js.map +1 -1
- package/dist/entity/shipping-method/shipping-method.entity.js +2 -2
- package/dist/entity/shipping-method/shipping-method.entity.js.map +1 -1
- package/dist/entity/stock-movement/allocation.entity.js +1 -0
- package/dist/entity/stock-movement/allocation.entity.js.map +1 -1
- package/dist/entity/stock-movement/cancellation.entity.js.map +1 -1
- package/dist/entity/stock-movement/release.entity.js +1 -0
- package/dist/entity/stock-movement/release.entity.js.map +1 -1
- package/dist/entity/stock-movement/sale.entity.js.map +1 -1
- package/dist/entity/stock-movement/stock-movement.entity.js +1 -0
- package/dist/entity/stock-movement/stock-movement.entity.js.map +1 -1
- package/dist/entity/surcharge/surcharge.entity.js +2 -0
- package/dist/entity/surcharge/surcharge.entity.js.map +1 -1
- package/dist/entity/tax-rate/tax-rate.entity.js +3 -0
- package/dist/entity/tax-rate/tax-rate.entity.js.map +1 -1
- package/dist/event-bus/event-bus.js +24 -4
- package/dist/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/events/initializer-event.d.ts +12 -0
- package/dist/event-bus/events/initializer-event.js +19 -0
- package/dist/event-bus/events/initializer-event.js.map +1 -0
- package/dist/event-bus/events/product-option-event.d.ts +1 -1
- package/dist/event-bus/events/product-option-event.js.map +1 -1
- package/dist/event-bus/events/product-option-group-event.d.ts +1 -1
- package/dist/event-bus/events/product-option-group-event.js.map +1 -1
- package/dist/event-bus/events/role-event.d.ts +1 -1
- package/dist/event-bus/events/role-event.js +1 -1
- package/dist/event-bus/events/search-event.d.ts +20 -0
- package/dist/event-bus/events/search-event.js +21 -0
- package/dist/event-bus/events/search-event.js.map +1 -0
- package/dist/event-bus/index.d.ts +2 -0
- package/dist/event-bus/index.js +2 -0
- package/dist/event-bus/index.js.map +1 -1
- package/dist/health-check/health-check-registry.service.d.ts +7 -1
- package/dist/health-check/health-check-registry.service.js +7 -1
- package/dist/health-check/health-check-registry.service.js.map +1 -1
- package/dist/health-check/health-check.module.d.ts +1 -3
- package/dist/health-check/health-check.module.js +6 -5
- package/dist/health-check/health-check.module.js.map +1 -1
- package/dist/health-check/http-health-check-strategy.d.ts +36 -0
- package/dist/health-check/http-health-check-strategy.js +41 -0
- package/dist/health-check/http-health-check-strategy.js.map +1 -0
- package/dist/health-check/index.d.ts +2 -0
- package/dist/health-check/index.js +2 -0
- package/dist/health-check/index.js.map +1 -1
- package/dist/health-check/typeorm-health-check-strategy.d.ts +36 -0
- package/dist/health-check/typeorm-health-check-strategy.js +44 -0
- package/dist/health-check/typeorm-health-check-strategy.js.map +1 -0
- package/dist/i18n/messages/en.json +3 -0
- package/dist/job-queue/subscribable-job.d.ts +23 -6
- package/dist/job-queue/subscribable-job.js +4 -4
- package/dist/job-queue/subscribable-job.js.map +1 -1
- package/dist/migrate.js +14 -0
- package/dist/migrate.js.map +1 -1
- package/dist/plugin/default-job-queue-plugin/sql-job-buffer-storage-strategy.js +5 -3
- package/dist/plugin/default-job-queue-plugin/sql-job-buffer-storage-strategy.js.map +1 -1
- package/dist/plugin/default-search-plugin/default-search-plugin.d.ts +9 -3
- package/dist/plugin/default-search-plugin/default-search-plugin.js +25 -2
- package/dist/plugin/default-search-plugin/default-search-plugin.js.map +1 -1
- package/dist/plugin/default-search-plugin/fulltext-search.service.d.ts +3 -1
- package/dist/plugin/default-search-plugin/fulltext-search.service.js +29 -19
- package/dist/plugin/default-search-plugin/fulltext-search.service.js.map +1 -1
- package/dist/plugin/default-search-plugin/indexer/indexer.controller.js +31 -25
- package/dist/plugin/default-search-plugin/indexer/indexer.controller.js.map +1 -1
- package/dist/plugin/default-search-plugin/indexer/search-index.service.js +1 -1
- package/dist/plugin/default-search-plugin/indexer/search-index.service.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.d.ts +4 -4
- package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js +46 -42
- package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.d.ts +4 -4
- package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js +23 -19
- package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/search-strategy-common.d.ts +1 -0
- package/dist/plugin/default-search-plugin/search-strategy/search-strategy-common.js +8 -1
- package/dist/plugin/default-search-plugin/search-strategy/search-strategy-common.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/search-strategy-utils.d.ts +11 -1
- package/dist/plugin/default-search-plugin/search-strategy/search-strategy-utils.js +31 -1
- package/dist/plugin/default-search-plugin/search-strategy/search-strategy-utils.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/search-strategy.d.ts +2 -1
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.d.ts +4 -4
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js +41 -37
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js.map +1 -1
- package/dist/plugin/default-search-plugin/types.d.ts +85 -1
- package/dist/plugin/plugin-metadata.js +2 -1
- package/dist/plugin/plugin-metadata.js.map +1 -1
- package/dist/plugin/vendure-plugin.d.ts +11 -2
- package/dist/plugin/vendure-plugin.js.map +1 -1
- package/dist/service/helpers/config-arg/config-arg.service.d.ts +1 -0
- package/dist/service/helpers/config-arg/config-arg.service.js +12 -1
- package/dist/service/helpers/config-arg/config-arg.service.js.map +1 -1
- package/dist/service/helpers/entity-hydrator/entity-hydrator.service.d.ts +3 -1
- package/dist/service/helpers/entity-hydrator/entity-hydrator.service.js +6 -4
- package/dist/service/helpers/entity-hydrator/entity-hydrator.service.js.map +1 -1
- package/dist/service/helpers/external-authentication/external-authentication.service.js +1 -1
- package/dist/service/helpers/external-authentication/external-authentication.service.js.map +1 -1
- package/dist/service/helpers/fulfillment-state-machine/fulfillment-state.d.ts +9 -1
- package/dist/service/helpers/fulfillment-state-machine/fulfillment-state.js.map +1 -1
- package/dist/service/helpers/list-query-builder/connection-utils.js +7 -1
- package/dist/service/helpers/list-query-builder/connection-utils.js.map +1 -1
- package/dist/service/helpers/list-query-builder/list-query-builder.d.ts +50 -6
- package/dist/service/helpers/list-query-builder/list-query-builder.js +167 -28
- package/dist/service/helpers/list-query-builder/list-query-builder.js.map +1 -1
- package/dist/service/helpers/list-query-builder/parse-channel-param.d.ts +1 -1
- package/dist/service/helpers/list-query-builder/parse-channel-param.js +2 -2
- package/dist/service/helpers/list-query-builder/parse-channel-param.js.map +1 -1
- package/dist/service/helpers/list-query-builder/parse-filter-params.d.ts +1 -1
- package/dist/service/helpers/list-query-builder/parse-filter-params.js +3 -2
- package/dist/service/helpers/list-query-builder/parse-filter-params.js.map +1 -1
- package/dist/service/helpers/list-query-builder/parse-sort-params.d.ts +2 -1
- package/dist/service/helpers/list-query-builder/parse-sort-params.js +12 -4
- package/dist/service/helpers/list-query-builder/parse-sort-params.js.map +1 -1
- package/dist/service/helpers/locale-string-hydrator/locale-string-hydrator.d.ts +7 -2
- package/dist/service/helpers/locale-string-hydrator/locale-string-hydrator.js +10 -5
- package/dist/service/helpers/locale-string-hydrator/locale-string-hydrator.js.map +1 -1
- package/dist/service/helpers/order-calculator/order-calculator.d.ts +18 -0
- package/dist/service/helpers/order-calculator/order-calculator.js +22 -4
- package/dist/service/helpers/order-calculator/order-calculator.js.map +1 -1
- package/dist/service/helpers/order-calculator/prorate.js +1 -1
- package/dist/service/helpers/order-calculator/prorate.js.map +1 -1
- package/dist/service/helpers/order-modifier/order-modifier.d.ts +26 -1
- package/dist/service/helpers/order-modifier/order-modifier.js +147 -19
- package/dist/service/helpers/order-modifier/order-modifier.js.map +1 -1
- package/dist/service/helpers/order-state-machine/order-state-machine.js +1 -1
- package/dist/service/helpers/order-state-machine/order-state-machine.js.map +1 -1
- package/dist/service/helpers/order-state-machine/order-state.d.ts +9 -1
- package/dist/service/helpers/order-state-machine/order-state.js.map +1 -1
- package/dist/service/helpers/payment-state-machine/payment-state.d.ts +9 -1
- package/dist/service/helpers/payment-state-machine/payment-state.js.map +1 -1
- package/dist/service/helpers/product-price-applicator/product-price-applicator.d.ts +26 -2
- package/dist/service/helpers/product-price-applicator/product-price-applicator.js +26 -2
- package/dist/service/helpers/product-price-applicator/product-price-applicator.js.map +1 -1
- package/dist/service/helpers/slug-validator/slug-validator.d.ts +16 -0
- package/dist/service/helpers/slug-validator/slug-validator.js +26 -7
- package/dist/service/helpers/slug-validator/slug-validator.js.map +1 -1
- package/dist/service/helpers/translatable-saver/translatable-saver.d.ts +28 -1
- package/dist/service/helpers/translatable-saver/translatable-saver.js +28 -1
- package/dist/service/helpers/translatable-saver/translatable-saver.js.map +1 -1
- package/dist/service/helpers/translator/translator.service.d.ts +10 -0
- package/dist/service/helpers/translator/translator.service.js +29 -0
- package/dist/service/helpers/translator/translator.service.js.map +1 -0
- package/dist/service/helpers/utils/order-utils.js +1 -1
- package/dist/service/helpers/utils/order-utils.js.map +1 -1
- package/dist/service/helpers/utils/translate-entity.d.ts +3 -3
- package/dist/service/helpers/utils/translate-entity.js +12 -4
- package/dist/service/helpers/utils/translate-entity.js.map +1 -1
- package/dist/service/index.d.ts +2 -0
- package/dist/service/index.js +2 -0
- package/dist/service/index.js.map +1 -1
- package/dist/service/initializer.service.d.ts +3 -1
- package/dist/service/initializer.service.js +8 -3
- package/dist/service/initializer.service.js.map +1 -1
- package/dist/service/service.module.js +2 -0
- package/dist/service/service.module.js.map +1 -1
- package/dist/service/services/administrator.service.d.ts +4 -3
- package/dist/service/services/administrator.service.js +16 -13
- package/dist/service/services/administrator.service.js.map +1 -1
- package/dist/service/services/asset.service.d.ts +5 -3
- package/dist/service/services/asset.service.js +25 -8
- package/dist/service/services/asset.service.js.map +1 -1
- package/dist/service/services/channel.service.d.ts +2 -1
- package/dist/service/services/channel.service.js +29 -18
- package/dist/service/services/channel.service.js.map +1 -1
- package/dist/service/services/collection.service.d.ts +11 -6
- package/dist/service/services/collection.service.js +63 -29
- package/dist/service/services/collection.service.js.map +1 -1
- package/dist/service/services/country.service.d.ts +6 -3
- package/dist/service/services/country.service.js +13 -11
- package/dist/service/services/country.service.js.map +1 -1
- package/dist/service/services/customer-group.service.d.ts +6 -3
- package/dist/service/services/customer-group.service.js +12 -7
- package/dist/service/services/customer-group.service.js.map +1 -1
- package/dist/service/services/customer.service.d.ts +6 -3
- package/dist/service/services/customer.service.js +12 -10
- package/dist/service/services/customer.service.js.map +1 -1
- package/dist/service/services/facet-value.service.d.ts +7 -1
- package/dist/service/services/facet-value.service.js +17 -9
- package/dist/service/services/facet-value.service.js.map +1 -1
- package/dist/service/services/facet.service.d.ts +10 -3
- package/dist/service/services/facet.service.js +31 -15
- package/dist/service/services/facet.service.js.map +1 -1
- package/dist/service/services/fulfillment.service.d.ts +9 -0
- package/dist/service/services/fulfillment.service.js +48 -8
- package/dist/service/services/fulfillment.service.js.map +1 -1
- package/dist/service/services/global-settings.service.js +5 -3
- package/dist/service/services/global-settings.service.js.map +1 -1
- package/dist/service/services/order-testing.service.d.ts +3 -1
- package/dist/service/services/order-testing.service.js +6 -4
- package/dist/service/services/order-testing.service.js.map +1 -1
- package/dist/service/services/order.service.d.ts +40 -9
- package/dist/service/services/order.service.js +194 -95
- package/dist/service/services/order.service.js.map +1 -1
- package/dist/service/services/payment-method.service.d.ts +6 -3
- package/dist/service/services/payment-method.service.js +15 -8
- package/dist/service/services/payment-method.service.js.map +1 -1
- package/dist/service/services/payment.service.d.ts +2 -0
- package/dist/service/services/payment.service.js +34 -14
- package/dist/service/services/payment.service.js.map +1 -1
- package/dist/service/services/product-option-group.service.d.ts +27 -4
- package/dist/service/services/product-option-group.service.js +96 -10
- package/dist/service/services/product-option-group.service.js.map +1 -1
- package/dist/service/services/product-option.service.d.ts +15 -2
- package/dist/service/services/product-option.service.js +66 -5
- package/dist/service/services/product-option.service.js.map +1 -1
- package/dist/service/services/product-variant.service.d.ts +14 -4
- package/dist/service/services/product-variant.service.js +68 -50
- package/dist/service/services/product-variant.service.js.map +1 -1
- package/dist/service/services/product.service.d.ts +10 -5
- package/dist/service/services/product.service.js +72 -27
- package/dist/service/services/product.service.js.map +1 -1
- package/dist/service/services/promotion.service.d.ts +3 -2
- package/dist/service/services/promotion.service.js +12 -7
- package/dist/service/services/promotion.service.js.map +1 -1
- package/dist/service/services/role.service.d.ts +5 -4
- package/dist/service/services/role.service.js +16 -13
- package/dist/service/services/role.service.js.map +1 -1
- package/dist/service/services/session.service.js +7 -7
- package/dist/service/services/session.service.js.map +1 -1
- package/dist/service/services/shipping-method.service.d.ts +6 -3
- package/dist/service/services/shipping-method.service.js +14 -12
- package/dist/service/services/shipping-method.service.js.map +1 -1
- package/dist/service/services/stock-movement.service.js +8 -7
- package/dist/service/services/stock-movement.service.js.map +1 -1
- package/dist/service/services/tax-rate.service.d.ts +3 -2
- package/dist/service/services/tax-rate.service.js +4 -4
- package/dist/service/services/tax-rate.service.js.map +1 -1
- package/dist/service/services/user.service.d.ts +1 -1
- package/dist/service/services/user.service.js +15 -1
- package/dist/service/services/user.service.js.map +1 -1
- package/dist/service/services/zone.service.d.ts +5 -3
- package/dist/service/services/zone.service.js +10 -8
- package/dist/service/services/zone.service.js.map +1 -1
- package/package.json +5 -4
|
@@ -63,7 +63,7 @@ class PaymentMethodHandler extends configurable_operation_1.ConfigurableOperatio
|
|
|
63
63
|
super(config);
|
|
64
64
|
this.createPaymentFn = config.createPayment;
|
|
65
65
|
this.settlePaymentFn = config.settlePayment;
|
|
66
|
-
this.
|
|
66
|
+
this.cancelPaymentFn = config.cancelPayment;
|
|
67
67
|
this.createRefundFn = config.createRefund;
|
|
68
68
|
this.onTransitionStartFn = config.onStateTransitionStart;
|
|
69
69
|
}
|
|
@@ -73,8 +73,8 @@ class PaymentMethodHandler extends configurable_operation_1.ConfigurableOperatio
|
|
|
73
73
|
*
|
|
74
74
|
* @internal
|
|
75
75
|
*/
|
|
76
|
-
async createPayment(ctx, order, amount, args, metadata) {
|
|
77
|
-
const paymentConfig = await this.createPaymentFn(ctx, order, amount, this.argsArrayToHash(args), metadata);
|
|
76
|
+
async createPayment(ctx, order, amount, args, metadata, method) {
|
|
77
|
+
const paymentConfig = await this.createPaymentFn(ctx, order, amount, this.argsArrayToHash(args), metadata, method);
|
|
78
78
|
return Object.assign({ method: this.code, metadata: {} }, paymentConfig);
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
@@ -83,8 +83,18 @@ class PaymentMethodHandler extends configurable_operation_1.ConfigurableOperatio
|
|
|
83
83
|
*
|
|
84
84
|
* @internal
|
|
85
85
|
*/
|
|
86
|
-
async settlePayment(ctx, order, payment, args) {
|
|
87
|
-
return this.settlePaymentFn(ctx, order, payment, this.argsArrayToHash(args));
|
|
86
|
+
async settlePayment(ctx, order, payment, args, method) {
|
|
87
|
+
return this.settlePaymentFn(ctx, order, payment, this.argsArrayToHash(args), method);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @description
|
|
91
|
+
* Called internally to cancel a payment
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
async cancelPayment(ctx, order, payment, args, method) {
|
|
96
|
+
var _a;
|
|
97
|
+
return (_a = this.cancelPaymentFn) === null || _a === void 0 ? void 0 : _a.call(this, ctx, order, payment, this.argsArrayToHash(args), method);
|
|
88
98
|
}
|
|
89
99
|
/**
|
|
90
100
|
* @description
|
|
@@ -92,9 +102,9 @@ class PaymentMethodHandler extends configurable_operation_1.ConfigurableOperatio
|
|
|
92
102
|
*
|
|
93
103
|
* @internal
|
|
94
104
|
*/
|
|
95
|
-
async createRefund(ctx, input, amount, order, payment, args) {
|
|
105
|
+
async createRefund(ctx, input, amount, order, payment, args, method) {
|
|
96
106
|
return this.createRefundFn
|
|
97
|
-
? this.createRefundFn(ctx, input, amount, order, payment, this.argsArrayToHash(args))
|
|
107
|
+
? this.createRefundFn(ctx, input, amount, order, payment, this.argsArrayToHash(args), method)
|
|
98
108
|
: false;
|
|
99
109
|
}
|
|
100
110
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-method-handler.js","sourceRoot":"","sources":["../../../src/config/payment/payment-method-handler.ts"],"names":[],"mappings":";;;AAGA,gFAK6C;
|
|
1
|
+
{"version":3,"file":"payment-method-handler.js","sourceRoot":"","sources":["../../../src/config/payment/payment-method-handler.ts"],"names":[],"mappings":";;;AAGA,gFAK6C;AAiS7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAa,oBAAwD,SAAQ,iDAA2B;IAOpG,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC;QAC5C,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC;QAC5C,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC;QAC5C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,sBAAsB,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CACf,GAAmB,EACnB,KAAY,EACZ,MAAc,EACd,IAAiB,EACjB,QAAyB,EACzB,MAAqB;QAErB,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,eAAe,CAC5C,GAAG,EACH,KAAK,EACL,MAAM,EACN,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAC1B,QAAQ,EACR,MAAM,CACT,CAAC;QACF,uBACI,MAAM,EAAE,IAAI,CAAC,IAAI,EACjB,QAAQ,EAAE,EAAE,IACT,aAAa,EAClB;IACN,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CACf,GAAmB,EACnB,KAAY,EACZ,OAAgB,EAChB,IAAiB,EACjB,MAAqB;QAErB,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IACzF,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CACf,GAAmB,EACnB,KAAY,EACZ,OAAgB,EAChB,IAAiB,EACjB,MAAqB;;QAErB,OAAO,MAAA,IAAI,CAAC,eAAe,+CAApB,IAAI,EAAmB,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CACd,GAAmB,EACnB,KAAuB,EACvB,MAAc,EACd,KAAY,EACZ,OAAgB,EAChB,IAAiB,EACjB,MAAqB;QAErB,OAAO,IAAI,CAAC,cAAc;YACtB,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAC7F,CAAC,CAAC,KAAK,CAAC;IAChB,CAAC;IAED;;;;;;;OAOG;IACH,sBAAsB,CAClB,SAAuB,EACvB,OAAqB,EACrB,IAA2B;QAE3B,IAAI,OAAO,IAAI,CAAC,mBAAmB,KAAK,UAAU,EAAE;YAChD,OAAO,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;SAC7D;aAAM;YACH,OAAO,IAAI,CAAC;SACf;IACL,CAAC;CACJ;AApHD,oDAoHC"}
|
|
@@ -26,7 +26,7 @@ exports.discountOnItemWithFacets = new promotion_action_1.PromotionItemAction({
|
|
|
26
26
|
facetValueChecker = new facet_value_checker_1.FacetValueChecker(injector.get(transactional_connection_1.TransactionalConnection));
|
|
27
27
|
},
|
|
28
28
|
async execute(ctx, orderItem, orderLine, args) {
|
|
29
|
-
if (await facetValueChecker.hasFacetValues(orderLine, args.facets)) {
|
|
29
|
+
if (await facetValueChecker.hasFacetValues(orderLine, args.facets, ctx)) {
|
|
30
30
|
const unitPrice = ctx.channel.pricesIncludeTax ? orderLine.unitPriceWithTax : orderLine.unitPrice;
|
|
31
31
|
return -unitPrice * (args.discount / 100);
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet-values-percentage-discount-action.js","sourceRoot":"","sources":["../../../../src/config/promotion/actions/facet-values-percentage-discount-action.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE,2FAAuF;AACvF,0DAA0D;AAC1D,sEAAiE;AAEjE,IAAI,iBAAoC,CAAC;AAE5B,QAAA,wBAAwB,GAAG,IAAI,sCAAmB,CAAC;IAC5D,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACF,QAAQ,EAAE;YACN,IAAI,EAAE,KAAK;YACX,EAAE,EAAE;gBACA,SAAS,EAAE,mBAAmB;gBAC9B,MAAM,EAAE,GAAG;aACd;SACJ;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,EAAE,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE;SAC9C;KACJ;IACD,IAAI,CAAC,QAAQ;QACT,iBAAiB,GAAG,IAAI,uCAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,kDAAuB,CAAC,CAAC,CAAC;IACrF,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI;QACzC,IAAI,MAAM,iBAAiB,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"facet-values-percentage-discount-action.js","sourceRoot":"","sources":["../../../../src/config/promotion/actions/facet-values-percentage-discount-action.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE,2FAAuF;AACvF,0DAA0D;AAC1D,sEAAiE;AAEjE,IAAI,iBAAoC,CAAC;AAE5B,QAAA,wBAAwB,GAAG,IAAI,sCAAmB,CAAC;IAC5D,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACF,QAAQ,EAAE;YACN,IAAI,EAAE,KAAK;YACX,EAAE,EAAE;gBACA,SAAS,EAAE,mBAAmB;gBAC9B,MAAM,EAAE,GAAG;aACd;SACJ;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,EAAE,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE;SAC9C;KACJ;IACD,IAAI,CAAC,QAAQ;QACT,iBAAiB,GAAG,IAAI,uCAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,kDAAuB,CAAC,CAAC,CAAC;IACrF,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI;QACzC,IAAI,MAAM,iBAAiB,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;YACrE,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC;YAClG,OAAO,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC;SAC7C;QACD,OAAO,CAAC,CAAC;IACb,CAAC;IACD,WAAW,EAAE;QACT,EAAE,YAAY,EAAE,8BAAY,CAAC,EAAE,EAAE,KAAK,EAAE,sDAAsD,EAAE;KACnG;CACJ,CAAC,CAAC"}
|
|
@@ -14,7 +14,7 @@ exports.orderFixedDiscount = new promotion_action_1.PromotionOrderAction({
|
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
execute(ctx, order, args) {
|
|
17
|
-
return -args.discount;
|
|
17
|
+
return -Math.min(args.discount, order.total);
|
|
18
18
|
},
|
|
19
19
|
description: [{ languageCode: generated_types_1.LanguageCode.en, value: 'Discount order by fixed amount' }],
|
|
20
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-fixed-discount-action.js","sourceRoot":"","sources":["../../../../src/config/promotion/actions/order-fixed-discount-action.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE,0DAA2D;AAE9C,QAAA,kBAAkB,GAAG,IAAI,uCAAoB,CAAC;IACvD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACF,QAAQ,EAAE;YACN,IAAI,EAAE,KAAK;YACX,EAAE,EAAE;gBACA,SAAS,EAAE,qBAAqB;aACnC;SACJ;KACJ;IACD,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI;QACpB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"order-fixed-discount-action.js","sourceRoot":"","sources":["../../../../src/config/promotion/actions/order-fixed-discount-action.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE,0DAA2D;AAE9C,QAAA,kBAAkB,GAAG,IAAI,uCAAoB,CAAC;IACvD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACF,QAAQ,EAAE;YACN,IAAI,EAAE,KAAK;YACX,EAAE,EAAE;gBACA,SAAS,EAAE,qBAAqB;aACnC;SACJ;KACJ;IACD,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI;QACpB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IACD,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,8BAAY,CAAC,EAAE,EAAE,KAAK,EAAE,gCAAgC,EAAE,CAAC;CAC5F,CAAC,CAAC"}
|
|
@@ -22,7 +22,7 @@ exports.hasFacetValues = new promotion_condition_1.PromotionCondition({
|
|
|
22
22
|
async check(ctx, order, args) {
|
|
23
23
|
let matches = 0;
|
|
24
24
|
for (const line of order.lines) {
|
|
25
|
-
if (await facetValueChecker.hasFacetValues(line, args.facets)) {
|
|
25
|
+
if (await facetValueChecker.hasFacetValues(line, args.facets, ctx)) {
|
|
26
26
|
matches += line.quantity;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-facet-values-condition.js","sourceRoot":"","sources":["../../../../src/config/promotion/conditions/has-facet-values-condition.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE,2FAAuF;AACvF,gEAA4D;AAC5D,sEAAiE;AAEjE,IAAI,iBAAoC,CAAC;AAE5B,QAAA,cAAc,GAAG,IAAI,wCAAkB,CAAC;IACjD,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE;QACT,EAAE,YAAY,EAAE,8BAAY,CAAC,EAAE,EAAE,KAAK,EAAE,yDAAyD,EAAE;KACtG;IACD,IAAI,EAAE;QACF,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE;QACzC,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,EAAE;KAClF;IACD,IAAI,CAAC,QAAQ;QACT,iBAAiB,GAAG,IAAI,uCAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,kDAAuB,CAAC,CAAC,CAAC;IACrF,CAAC;IACD,gDAAgD;IAChD,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI;QACxB,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;YAC5B,IAAI,MAAM,iBAAiB,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"has-facet-values-condition.js","sourceRoot":"","sources":["../../../../src/config/promotion/conditions/has-facet-values-condition.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE,2FAAuF;AACvF,gEAA4D;AAC5D,sEAAiE;AAEjE,IAAI,iBAAoC,CAAC;AAE5B,QAAA,cAAc,GAAG,IAAI,wCAAkB,CAAC;IACjD,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE;QACT,EAAE,YAAY,EAAE,8BAAY,CAAC,EAAE,EAAE,KAAK,EAAE,yDAAyD,EAAE;KACtG;IACD,IAAI,EAAE;QACF,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE;QACzC,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,EAAE;KAClF;IACD,IAAI,CAAC,QAAQ;QACT,iBAAiB,GAAG,IAAI,uCAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,kDAAuB,CAAC,CAAC,CAAC;IACrF,CAAC;IACD,gDAAgD;IAChD,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI;QACxB,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;YAC5B,IAAI,MAAM,iBAAiB,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;gBAChE,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC;aAC5B;SACJ;QACD,OAAO,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC;IACnC,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -3,10 +3,14 @@ export * from './promotion-condition';
|
|
|
3
3
|
export * from './actions/facet-values-percentage-discount-action';
|
|
4
4
|
export * from './actions/order-percentage-discount-action';
|
|
5
5
|
export * from './actions/product-percentage-discount-action';
|
|
6
|
+
export * from './actions/free-shipping-action';
|
|
7
|
+
export * from './actions/buy-x-get-y-free-action';
|
|
8
|
+
export * from './actions/order-fixed-discount-action';
|
|
6
9
|
export * from './conditions/has-facet-values-condition';
|
|
7
10
|
export * from './conditions/min-order-amount-condition';
|
|
8
11
|
export * from './conditions/contains-products-condition';
|
|
9
12
|
export * from './conditions/customer-group-condition';
|
|
13
|
+
export * from './conditions/buy-x-get-y-free-condition';
|
|
10
14
|
export * from './utils/facet-value-checker';
|
|
11
15
|
export declare const defaultPromotionActions: (import("./promotion-action").PromotionItemAction<{}, import("./promotion-condition").PromotionCondition<{
|
|
12
16
|
amountX: {
|
|
@@ -27,10 +27,14 @@ __exportStar(require("./promotion-condition"), exports);
|
|
|
27
27
|
__exportStar(require("./actions/facet-values-percentage-discount-action"), exports);
|
|
28
28
|
__exportStar(require("./actions/order-percentage-discount-action"), exports);
|
|
29
29
|
__exportStar(require("./actions/product-percentage-discount-action"), exports);
|
|
30
|
+
__exportStar(require("./actions/free-shipping-action"), exports);
|
|
31
|
+
__exportStar(require("./actions/buy-x-get-y-free-action"), exports);
|
|
32
|
+
__exportStar(require("./actions/order-fixed-discount-action"), exports);
|
|
30
33
|
__exportStar(require("./conditions/has-facet-values-condition"), exports);
|
|
31
34
|
__exportStar(require("./conditions/min-order-amount-condition"), exports);
|
|
32
35
|
__exportStar(require("./conditions/contains-products-condition"), exports);
|
|
33
36
|
__exportStar(require("./conditions/customer-group-condition"), exports);
|
|
37
|
+
__exportStar(require("./conditions/buy-x-get-y-free-condition"), exports);
|
|
34
38
|
__exportStar(require("./utils/facet-value-checker"), exports);
|
|
35
39
|
exports.defaultPromotionActions = [
|
|
36
40
|
order_fixed_discount_action_1.orderFixedDiscount,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/promotion/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+EAAuE;AACvE,+GAA6F;AAC7F,yEAA8D;AAC9D,uFAA2E;AAC3E,iGAAqF;AACrF,qGAA0F;AAC1F,wFAAgF;AAChF,0FAA4E;AAC5E,oFAAsE;AACtE,wFAAyE;AACzE,wFAA6E;AAE7E,qDAAmC;AACnC,wDAAsC;AACtC,oFAAkE;AAClE,6EAA2D;AAC3D,+EAA6D;AAC7D,0EAAwD;AACxD,0EAAwD;AACxD,2EAAyD;AACzD,wEAAsD;AACtD,8DAA4C;AAE/B,QAAA,uBAAuB,GAAG;IACnC,gDAAkB;IAClB,0DAAuB;IACvB,kEAAwB;IACxB,+DAA0B;IAC1B,mCAAY;IACZ,4CAAkB;CACrB,CAAC;AACW,QAAA,0BAA0B,GAAG;IACtC,+CAAkB;IAClB,2CAAc;IACd,8CAAgB;IAChB,wCAAa;IACb,kDAAqB;CACxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/promotion/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+EAAuE;AACvE,+GAA6F;AAC7F,yEAA8D;AAC9D,uFAA2E;AAC3E,iGAAqF;AACrF,qGAA0F;AAC1F,wFAAgF;AAChF,0FAA4E;AAC5E,oFAAsE;AACtE,wFAAyE;AACzE,wFAA6E;AAE7E,qDAAmC;AACnC,wDAAsC;AACtC,oFAAkE;AAClE,6EAA2D;AAC3D,+EAA6D;AAC7D,iEAA+C;AAC/C,oEAAkD;AAClD,wEAAsD;AACtD,0EAAwD;AACxD,0EAAwD;AACxD,2EAAyD;AACzD,wEAAsD;AACtD,0EAAwD;AACxD,8DAA4C;AAE/B,QAAA,uBAAuB,GAAG;IACnC,gDAAkB;IAClB,0DAAuB;IACvB,kEAAwB;IACxB,+DAA0B;IAC1B,mCAAY;IACZ,4CAAkB;CACrB,CAAC;AACW,QAAA,0BAA0B,GAAG;IACtC,+CAAkB;IAClB,2CAAc;IACd,8CAAgB;IAChB,wCAAa;IACb,kDAAqB;CACxB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ID } from '@vendure/common/lib/shared-types';
|
|
2
|
+
import { RequestContext } from '../../../api';
|
|
2
3
|
import { TransactionalConnection } from '../../../connection/transactional-connection';
|
|
3
4
|
import { OrderLine } from '../../../entity/order-line/order-line.entity';
|
|
4
5
|
/**
|
|
@@ -49,5 +50,5 @@ export declare class FacetValueChecker {
|
|
|
49
50
|
* `true` if the associated {@link ProductVariant} & {@link Product} together
|
|
50
51
|
* have *all* the specified {@link FacetValue}s.
|
|
51
52
|
*/
|
|
52
|
-
hasFacetValues(orderLine: OrderLine, facetValueIds: ID[]): Promise<boolean>;
|
|
53
|
+
hasFacetValues(orderLine: OrderLine, facetValueIds: ID[], ctx?: RequestContext): Promise<boolean>;
|
|
53
54
|
}
|
|
@@ -54,11 +54,11 @@ class FacetValueChecker {
|
|
|
54
54
|
* `true` if the associated {@link ProductVariant} & {@link Product} together
|
|
55
55
|
* have *all* the specified {@link FacetValue}s.
|
|
56
56
|
*/
|
|
57
|
-
async hasFacetValues(orderLine, facetValueIds) {
|
|
57
|
+
async hasFacetValues(orderLine, facetValueIds, ctx) {
|
|
58
58
|
let variant = this.variantCache.get(orderLine.productVariant.id);
|
|
59
59
|
if (!variant) {
|
|
60
60
|
variant = await this.connection
|
|
61
|
-
.getRepository(product_variant_entity_1.ProductVariant)
|
|
61
|
+
.getRepository(ctx, product_variant_entity_1.ProductVariant)
|
|
62
62
|
.findOne(orderLine.productVariant.id, {
|
|
63
63
|
relations: ['product', 'product.facetValues', 'facetValues'],
|
|
64
64
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facet-value-checker.js","sourceRoot":"","sources":["../../../../src/config/promotion/utils/facet-value-checker.ts"],"names":[],"mappings":";;;AACA,uDAAoD;
|
|
1
|
+
{"version":3,"file":"facet-value-checker.js","sourceRoot":"","sources":["../../../../src/config/promotion/utils/facet-value-checker.ts"],"names":[],"mappings":";;;AACA,uDAAoD;AAGpD,yDAAqD;AACrD,iDAAoD;AAGpD,mGAAwF;AAExF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAa,iBAAiB;IAG1B,YAAoB,UAAmC;QAAnC,eAAU,GAAV,UAAU,CAAyB;QAF/C,iBAAY,GAAG,IAAI,oBAAQ,CAAqB,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IAEb,CAAC;IAC3D;;;;;OAKG;IACH,KAAK,CAAC,cAAc,CAAC,SAAoB,EAAE,aAAmB,EAAE,GAAoB;QAChF,IAAI,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,OAAO,EAAE;YACV,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU;iBAC1B,aAAa,CAAC,GAAG,EAAE,uCAAc,CAAC;iBAClC,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE;gBAClC,SAAS,EAAE,CAAC,SAAS,EAAE,qBAAqB,EAAE,aAAa,CAAC;aAC/D,CAAC,CAAC;YACP,IAAI,CAAC,OAAO,EAAE;gBACV,OAAO,KAAK,CAAC;aAChB;YACD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;SAC9C;QACD,MAAM,cAAc,GAAG,IAAA,eAAM,EAAC,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,CAAC;QAC9F,OAAO,aAAa,CAAC,MAAM,CACvB,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,IAAI,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IAAA,mBAAW,EAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAC7E,IAAe,CAClB,CAAC;IACN,CAAC;CACJ;AA7BD,8CA6BC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConfigArg } from '@vendure/common/lib/generated-types';
|
|
2
2
|
import { RequestContext } from '../../api/common/request-context';
|
|
3
3
|
import { ConfigArgs, ConfigArgValues, ConfigurableOperationDef, ConfigurableOperationDefOptions } from '../../common/configurable-operation';
|
|
4
|
-
import { Order } from '../../entity
|
|
4
|
+
import { ShippingMethod, Order } from '../../entity';
|
|
5
5
|
export interface ShippingCalculatorConfig<T extends ConfigArgs> extends ConfigurableOperationDefOptions<T> {
|
|
6
6
|
calculate: CalculateShippingFn<T>;
|
|
7
7
|
}
|
|
@@ -46,7 +46,7 @@ export declare class ShippingCalculator<T extends ConfigArgs = ConfigArgs> exten
|
|
|
46
46
|
*
|
|
47
47
|
* @internal
|
|
48
48
|
*/
|
|
49
|
-
calculate(ctx: RequestContext, order: Order, args: ConfigArg[]): CalculateShippingFnResult;
|
|
49
|
+
calculate(ctx: RequestContext, order: Order, args: ConfigArg[], method: ShippingMethod): CalculateShippingFnResult;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* @description
|
|
@@ -90,4 +90,4 @@ export declare type CalculateShippingFnResult = ShippingCalculationResult | Prom
|
|
|
90
90
|
* @docsCategory shipping
|
|
91
91
|
* @docsPage ShippingCalculator
|
|
92
92
|
*/
|
|
93
|
-
export declare type CalculateShippingFn<T extends ConfigArgs> = (ctx: RequestContext, order: Order, args: ConfigArgValues<T
|
|
93
|
+
export declare type CalculateShippingFn<T extends ConfigArgs> = (ctx: RequestContext, order: Order, args: ConfigArgValues<T>, method: ShippingMethod) => CalculateShippingFnResult;
|
|
@@ -45,8 +45,8 @@ class ShippingCalculator extends configurable_operation_1.ConfigurableOperationD
|
|
|
45
45
|
*
|
|
46
46
|
* @internal
|
|
47
47
|
*/
|
|
48
|
-
calculate(ctx, order, args) {
|
|
49
|
-
return this.calculateFn(ctx, order, this.argsArrayToHash(args));
|
|
48
|
+
calculate(ctx, order, args, method) {
|
|
49
|
+
return this.calculateFn(ctx, order, this.argsArrayToHash(args), method);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
exports.ShippingCalculator = ShippingCalculator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shipping-calculator.js","sourceRoot":"","sources":["../../../src/config/shipping-method/shipping-calculator.ts"],"names":[],"mappings":";;;AAGA,gFAK6C;AAO7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAa,kBAAsD,SAAQ,iDAA2B;IAGlG,YAAY,MAAmC;QAC3C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,GAAmB,EAAE,KAAY,EAAE,IAAiB;
|
|
1
|
+
{"version":3,"file":"shipping-calculator.js","sourceRoot":"","sources":["../../../src/config/shipping-method/shipping-calculator.ts"],"names":[],"mappings":";;;AAGA,gFAK6C;AAO7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAa,kBAAsD,SAAQ,iDAA2B;IAGlG,YAAY,MAAmC;QAC3C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,GAAmB,EAAE,KAAY,EAAE,IAAiB,EAAE,MAAsB;QAClF,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAC5E,CAAC;CACJ;AAjBD,gDAiBC"}
|
|
@@ -2,7 +2,7 @@ import { ConfigArg } from '@vendure/common/lib/generated-types';
|
|
|
2
2
|
import { Json } from '@vendure/common/lib/shared-types';
|
|
3
3
|
import { RequestContext } from '../../api/common/request-context';
|
|
4
4
|
import { ConfigArgs, ConfigArgValues, ConfigurableOperationDef, ConfigurableOperationDefOptions } from '../../common/configurable-operation';
|
|
5
|
-
import { Order } from '../../entity
|
|
5
|
+
import { ShippingMethod, Order } from '../../entity';
|
|
6
6
|
/**
|
|
7
7
|
* @description
|
|
8
8
|
* Configuration passed into the constructor of a {@link ShippingEligibilityChecker} to
|
|
@@ -47,7 +47,7 @@ export declare class ShippingEligibilityChecker<T extends ConfigArgs = ConfigArg
|
|
|
47
47
|
*
|
|
48
48
|
* @internal
|
|
49
49
|
*/
|
|
50
|
-
check(ctx: RequestContext, order: Order, args: ConfigArg[]): Promise<boolean>;
|
|
50
|
+
check(ctx: RequestContext, order: Order, args: ConfigArg[], method: ShippingMethod): Promise<boolean>;
|
|
51
51
|
/**
|
|
52
52
|
* Determines whether the check function needs to be run, based on the presence and
|
|
53
53
|
* result of any defined `shouldRunCheckFn`.
|
|
@@ -66,7 +66,7 @@ export declare class ShippingEligibilityChecker<T extends ConfigArgs = ConfigArg
|
|
|
66
66
|
*
|
|
67
67
|
* @docsCategory shipping
|
|
68
68
|
*/
|
|
69
|
-
export declare type CheckShippingEligibilityCheckerFn<T extends ConfigArgs> = (ctx: RequestContext, order: Order, args: ConfigArgValues<T
|
|
69
|
+
export declare type CheckShippingEligibilityCheckerFn<T extends ConfigArgs> = (ctx: RequestContext, order: Order, args: ConfigArgValues<T>, method: ShippingMethod) => boolean | Promise<boolean>;
|
|
70
70
|
/**
|
|
71
71
|
* @description
|
|
72
72
|
* An optional method which is used to decide whether to run the `check()` function.
|
|
@@ -95,4 +95,4 @@ export declare type CheckShippingEligibilityCheckerFn<T extends ConfigArgs> = (c
|
|
|
95
95
|
*
|
|
96
96
|
* @docsCategory shipping
|
|
97
97
|
*/
|
|
98
|
-
export declare type ShouldRunCheckFn<T extends ConfigArgs> = (ctx: RequestContext, order: Order, args: ConfigArgValues<T
|
|
98
|
+
export declare type ShouldRunCheckFn<T extends ConfigArgs> = (ctx: RequestContext, order: Order, args: ConfigArgValues<T>, method: ShippingMethod) => Json | Promise<Json>;
|
|
@@ -39,20 +39,20 @@ class ShippingEligibilityChecker extends configurable_operation_1.ConfigurableOp
|
|
|
39
39
|
*
|
|
40
40
|
* @internal
|
|
41
41
|
*/
|
|
42
|
-
async check(ctx, order, args) {
|
|
43
|
-
const shouldRunCheck = await this.shouldRunCheck(ctx, order, args);
|
|
44
|
-
return shouldRunCheck ? this.checkFn(ctx, order, this.argsArrayToHash(args)) : true;
|
|
42
|
+
async check(ctx, order, args, method) {
|
|
43
|
+
const shouldRunCheck = await this.shouldRunCheck(ctx, order, args, method);
|
|
44
|
+
return shouldRunCheck ? this.checkFn(ctx, order, this.argsArrayToHash(args), method) : true;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Determines whether the check function needs to be run, based on the presence and
|
|
48
48
|
* result of any defined `shouldRunCheckFn`.
|
|
49
49
|
*/
|
|
50
|
-
async shouldRunCheck(ctx, order, args) {
|
|
50
|
+
async shouldRunCheck(ctx, order, args, method) {
|
|
51
51
|
var _a;
|
|
52
52
|
if (typeof this.shouldRunCheckFn === 'function') {
|
|
53
53
|
const cacheKey = (_a = ctx.session) === null || _a === void 0 ? void 0 : _a.id;
|
|
54
54
|
if (cacheKey) {
|
|
55
|
-
const checkResult = await this.shouldRunCheckFn(ctx, order, this.argsArrayToHash(args));
|
|
55
|
+
const checkResult = await this.shouldRunCheckFn(ctx, order, this.argsArrayToHash(args), method);
|
|
56
56
|
const checkResultHash = (0, crypto_1.createHash)('sha1')
|
|
57
57
|
.update(JSON.stringify(checkResult))
|
|
58
58
|
.digest('base64');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shipping-eligibility-checker.js","sourceRoot":"","sources":["../../../src/config/shipping-method/shipping-eligibility-checker.ts"],"names":[],"mappings":";;;AAEA,mCAAoC;AAGpC,gFAK6C;AAC7C,sDAAkD;AAelD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,0BAA8D,SAAQ,iDAElF;IAKG,YAAY,MAA2C;QACnD,KAAK,CAAC,MAAM,CAAC,CAAC;QAHV,wBAAmB,GAAG,IAAI,oBAAQ,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAIrF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,GAAmB,EAAE,KAAY,EAAE,IAAiB;
|
|
1
|
+
{"version":3,"file":"shipping-eligibility-checker.js","sourceRoot":"","sources":["../../../src/config/shipping-method/shipping-eligibility-checker.ts"],"names":[],"mappings":";;;AAEA,mCAAoC;AAGpC,gFAK6C;AAC7C,sDAAkD;AAelD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,0BAA8D,SAAQ,iDAElF;IAKG,YAAY,MAA2C;QACnD,KAAK,CAAC,MAAM,CAAC,CAAC;QAHV,wBAAmB,GAAG,IAAI,oBAAQ,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAIrF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,GAAmB,EAAE,KAAY,EAAE,IAAiB,EAAE,MAAsB;QACpF,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3E,OAAO,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChG,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,cAAc,CAAC,GAAmB,EAAE,KAAY,EAAE,IAAiB,EAAE,MAAsB;;QACrG,IAAI,OAAO,IAAI,CAAC,gBAAgB,KAAK,UAAU,EAAE;YAC7C,MAAM,QAAQ,GAAG,MAAA,GAAG,CAAC,OAAO,0CAAE,EAAE,CAAC;YACjC,IAAI,QAAQ,EAAE;gBACV,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;gBAChG,MAAM,eAAe,GAAG,IAAA,mBAAU,EAAC,MAAM,CAAC;qBACrC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;qBACnC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACtB,MAAM,cAAc,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC9D,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;gBACxD,IAAI,eAAe,KAAK,cAAc,EAAE;oBACpC,OAAO,KAAK,CAAC;iBAChB;aACJ;SACJ;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA7CD,gEA6CC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { HealthIndicatorFunction } from '@nestjs/terminus';
|
|
2
|
+
import { InjectableStrategy } from '../../common/types/injectable-strategy';
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* This strategy defines health checks which are included as part of the
|
|
6
|
+
* `/health` endpoint. They should only be used to monitor _critical_ systems
|
|
7
|
+
* on which proper functioning of the Vendure server depends.
|
|
8
|
+
*
|
|
9
|
+
* For more information on the underlying mechanism, see the
|
|
10
|
+
* [NestJS Terminus module docs](https://docs.nestjs.com/recipes/terminus).
|
|
11
|
+
*
|
|
12
|
+
* Custom strategies should be added to the `systemOptions.healthChecks` array.
|
|
13
|
+
* By default, Vendure includes the `TypeORMHealthCheckStrategy`, so if you set the value of the `healthChecks`
|
|
14
|
+
* array, be sure to include it manually.
|
|
15
|
+
*
|
|
16
|
+
* Vendure also ships with the {@link HttpHealthCheckStrategy}, which is convenient
|
|
17
|
+
* for adding a health check dependent on an HTTP ping.
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```TypeScript
|
|
23
|
+
* import { HttpHealthCheckStrategy, TypeORMHealthCheckStrategy } from '\@vendure/core';
|
|
24
|
+
* import { MyCustomHealthCheckStrategy } from './config/custom-health-check-strategy';
|
|
25
|
+
*
|
|
26
|
+
* export const config = {
|
|
27
|
+
* // ...
|
|
28
|
+
* systemOptions: {
|
|
29
|
+
* healthChecks: [
|
|
30
|
+
* new TypeORMHealthCheckStrategy(),
|
|
31
|
+
* new HttpHealthCheckStrategy({ key: 'my-service', url: 'https://my-service.com' }),
|
|
32
|
+
* new MyCustomHealthCheckStrategy(),
|
|
33
|
+
* ],
|
|
34
|
+
* },
|
|
35
|
+
* };
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @docsCategory health-check
|
|
39
|
+
*/
|
|
40
|
+
export interface HealthCheckStrategy extends InjectableStrategy {
|
|
41
|
+
/**
|
|
42
|
+
* @description
|
|
43
|
+
* Should return a `HealthIndicatorFunction`, as defined by the
|
|
44
|
+
* [NestJS Terminus module](https://docs.nestjs.com/recipes/terminus).
|
|
45
|
+
*/
|
|
46
|
+
getHealthIndicator(): HealthIndicatorFunction;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-check-strategy.js","sourceRoot":"","sources":["../../../src/config/system/health-check-strategy.ts"],"names":[],"mappings":""}
|
|
@@ -7,6 +7,7 @@ import { ConnectionOptions } from 'typeorm';
|
|
|
7
7
|
import { Middleware } from '../common';
|
|
8
8
|
import { PermissionDefinition } from '../common/permission-definition';
|
|
9
9
|
import { JobBufferStorageStrategy } from '../job-queue/job-buffer/job-buffer-storage-strategy';
|
|
10
|
+
import { AssetImportStrategy } from './asset-import-strategy/asset-import-strategy';
|
|
10
11
|
import { AssetNamingStrategy } from './asset-naming-strategy/asset-naming-strategy';
|
|
11
12
|
import { AssetPreviewStrategy } from './asset-preview-strategy/asset-preview-strategy';
|
|
12
13
|
import { AssetStorageStrategy } from './asset-storage-strategy/asset-storage-strategy';
|
|
@@ -18,6 +19,7 @@ import { ProductVariantPriceCalculationStrategy } from './catalog/product-varian
|
|
|
18
19
|
import { StockDisplayStrategy } from './catalog/stock-display-strategy';
|
|
19
20
|
import { CustomFields } from './custom-field/custom-field-types';
|
|
20
21
|
import { EntityIdStrategy } from './entity-id-strategy/entity-id-strategy';
|
|
22
|
+
import { EntityMetadataModifier } from './entity-metadata/entity-metadata-modifier';
|
|
21
23
|
import { CustomFulfillmentProcess } from './fulfillment/custom-fulfillment-process';
|
|
22
24
|
import { FulfillmentHandler } from './fulfillment/fulfillment-handler';
|
|
23
25
|
import { JobQueueStrategy } from './job-queue/job-queue-strategy';
|
|
@@ -38,6 +40,7 @@ import { PromotionCondition } from './promotion/promotion-condition';
|
|
|
38
40
|
import { SessionCacheStrategy } from './session-cache/session-cache-strategy';
|
|
39
41
|
import { ShippingCalculator } from './shipping-method/shipping-calculator';
|
|
40
42
|
import { ShippingEligibilityChecker } from './shipping-method/shipping-eligibility-checker';
|
|
43
|
+
import { HealthCheckStrategy } from './system/health-check-strategy';
|
|
41
44
|
import { TaxLineCalculationStrategy } from './tax/tax-line-calculation-strategy';
|
|
42
45
|
import { TaxZoneStrategy } from './tax/tax-zone-strategy';
|
|
43
46
|
/**
|
|
@@ -174,6 +177,26 @@ export interface ApiOptions {
|
|
|
174
177
|
* @default []
|
|
175
178
|
*/
|
|
176
179
|
apolloServerPlugins?: PluginDefinition[];
|
|
180
|
+
/**
|
|
181
|
+
* @description
|
|
182
|
+
* Controls whether introspection of the GraphQL APIs is enabled. For production, it is recommended to disable
|
|
183
|
+
* introspection, since exposing your entire schema can allow an attacker to trivially learn all operations
|
|
184
|
+
* and much more easily find any potentially exploitable queries.
|
|
185
|
+
*
|
|
186
|
+
* **Note:** when introspection is disabled, tooling which relies on it for things like autocompletion
|
|
187
|
+
* will not work.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```TypeScript
|
|
191
|
+
* {
|
|
192
|
+
* introspection: process.env.NODE_ENV !== 'production'
|
|
193
|
+
* }
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* @default true
|
|
197
|
+
* @since 1.5.0
|
|
198
|
+
*/
|
|
199
|
+
introspection?: boolean;
|
|
177
200
|
}
|
|
178
201
|
/**
|
|
179
202
|
* @description
|
|
@@ -725,6 +748,14 @@ export interface ImportExportOptions {
|
|
|
725
748
|
* @default __dirname
|
|
726
749
|
*/
|
|
727
750
|
importAssetsDir?: string;
|
|
751
|
+
/**
|
|
752
|
+
* @description
|
|
753
|
+
* This strategy determines how asset files get imported based on the path given in the
|
|
754
|
+
* import CSV or via the {@link AssetImporter} `getAssets()` method.
|
|
755
|
+
*
|
|
756
|
+
* @since 1.7.0
|
|
757
|
+
*/
|
|
758
|
+
assetImportStrategy?: AssetImportStrategy;
|
|
728
759
|
}
|
|
729
760
|
/**
|
|
730
761
|
* @description
|
|
@@ -772,6 +803,8 @@ export interface JobQueueOptions {
|
|
|
772
803
|
*
|
|
773
804
|
* For example, we might have a staging and a production deployment in the same account/project and
|
|
774
805
|
* each one will need its own task queue. We can achieve this with a prefix.
|
|
806
|
+
*
|
|
807
|
+
* @since 1.5.0
|
|
775
808
|
*/
|
|
776
809
|
prefix?: string;
|
|
777
810
|
}
|
|
@@ -781,6 +814,8 @@ export interface JobQueueOptions {
|
|
|
781
814
|
*
|
|
782
815
|
* @since 1.3.0
|
|
783
816
|
* @docsCategory configuration
|
|
817
|
+
* @docsPage EntityOptions
|
|
818
|
+
* @docsWeight 0
|
|
784
819
|
*/
|
|
785
820
|
export interface EntityOptions {
|
|
786
821
|
/**
|
|
@@ -790,6 +825,13 @@ export interface EntityOptions {
|
|
|
790
825
|
* entities via the API. The default uses a simple auto-increment integer
|
|
791
826
|
* strategy.
|
|
792
827
|
*
|
|
828
|
+
* {{% alert "warning" %}}
|
|
829
|
+
* Note: changing from an integer-based strategy to a uuid-based strategy
|
|
830
|
+
* on an existing Vendure database will lead to problems with broken foreign-key
|
|
831
|
+
* references. To change primary key types like this, you'll need to start with
|
|
832
|
+
* a fresh database.
|
|
833
|
+
* {{% /alert %}}
|
|
834
|
+
*
|
|
793
835
|
* @since 1.3.0
|
|
794
836
|
* @default AutoIncrementIdStrategy
|
|
795
837
|
*/
|
|
@@ -816,6 +858,35 @@ export interface EntityOptions {
|
|
|
816
858
|
* @default 30000
|
|
817
859
|
*/
|
|
818
860
|
zoneCacheTtl?: number;
|
|
861
|
+
/**
|
|
862
|
+
* @description
|
|
863
|
+
* Allows the metadata of the built-in TypeORM entities to be manipulated. This allows you
|
|
864
|
+
* to do things like altering data types, adding indices etc. This is an advanced feature
|
|
865
|
+
* which should be used with some caution as it will result in DB schema changes. For examples
|
|
866
|
+
* see {@link EntityMetadataModifier}.
|
|
867
|
+
*
|
|
868
|
+
* @since 1.6.0
|
|
869
|
+
* @default []
|
|
870
|
+
*/
|
|
871
|
+
metadataModifiers?: EntityMetadataModifier[];
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* @description
|
|
875
|
+
* Options relating to system functions.
|
|
876
|
+
*
|
|
877
|
+
* @since 1.6.0
|
|
878
|
+
* @docsCategory configuration
|
|
879
|
+
*/
|
|
880
|
+
export interface SystemOptions {
|
|
881
|
+
/**
|
|
882
|
+
* @description
|
|
883
|
+
* Defines an array of {@link HealthCheckStrategy} instances which are used by the `/health` endpoint to verify
|
|
884
|
+
* that any critical systems which the Vendure server depends on are also healthy.
|
|
885
|
+
*
|
|
886
|
+
* @default [TypeORMHealthCheckStrategy]
|
|
887
|
+
* @since 1.6.0
|
|
888
|
+
*/
|
|
889
|
+
healthChecks?: HealthCheckStrategy[];
|
|
819
890
|
}
|
|
820
891
|
/**
|
|
821
892
|
* @description
|
|
@@ -938,6 +1009,13 @@ export interface VendureConfig {
|
|
|
938
1009
|
* Configures how the job queue is persisted and processed.
|
|
939
1010
|
*/
|
|
940
1011
|
jobQueueOptions?: JobQueueOptions;
|
|
1012
|
+
/**
|
|
1013
|
+
* @description
|
|
1014
|
+
* Configures system options
|
|
1015
|
+
*
|
|
1016
|
+
* @since 1.6.0
|
|
1017
|
+
*/
|
|
1018
|
+
systemOptions?: SystemOptions;
|
|
941
1019
|
}
|
|
942
1020
|
/**
|
|
943
1021
|
* @description
|
|
@@ -959,6 +1037,7 @@ export interface RuntimeVendureConfig extends Required<VendureConfig> {
|
|
|
959
1037
|
promotionOptions: Required<PromotionOptions>;
|
|
960
1038
|
shippingOptions: Required<ShippingOptions>;
|
|
961
1039
|
taxOptions: Required<TaxOptions>;
|
|
1040
|
+
systemOptions: Required<SystemOptions>;
|
|
962
1041
|
}
|
|
963
1042
|
declare type DeepPartialSimple<T> = {
|
|
964
1043
|
[P in keyof T]?: null | (T[P] extends Array<infer U> ? Array<DeepPartialSimple<U>> : T[P] extends ReadonlyArray<infer X> ? ReadonlyArray<DeepPartialSimple<X>> : T[P] extends Type<any> ? T[P] : DeepPartialSimple<T[P]>);
|
|
@@ -3,5 +3,5 @@ import { ConnectionOptions } from 'typeorm';
|
|
|
3
3
|
export declare class ConnectionModule {
|
|
4
4
|
static forRoot(): DynamicModule;
|
|
5
5
|
static forPlugin(): DynamicModule;
|
|
6
|
-
static getTypeOrmLogger(dbConnectionOptions: ConnectionOptions): import("typeorm").Logger | "
|
|
6
|
+
static getTypeOrmLogger(dbConnectionOptions: ConnectionOptions): "debug" | import("typeorm").Logger | "advanced-console" | "simple-console" | "file";
|
|
7
7
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SelectQueryBuilder } from 'typeorm';
|
|
2
|
+
/**
|
|
3
|
+
* This is a work-around for this issue: https://github.com/vendure-ecommerce/vendure/issues/1664
|
|
4
|
+
*
|
|
5
|
+
* Explanation:
|
|
6
|
+
* When calling `FindOptionsUtils.joinEagerRelations()`, there appears to be a bug in TypeORM whereby
|
|
7
|
+
* it will throw the following error *if* the `options.relations` array contains any customField relations
|
|
8
|
+
* where the related entity itself has eagerly-loaded relations.
|
|
9
|
+
*
|
|
10
|
+
* For example, let's say we define a custom field on the Product entity like this:
|
|
11
|
+
* ```
|
|
12
|
+
* Product: [{
|
|
13
|
+
* name: 'featuredFacet',
|
|
14
|
+
* type: 'relation',
|
|
15
|
+
* entity: Facet,
|
|
16
|
+
* }],
|
|
17
|
+
* ```
|
|
18
|
+
* and then we pass into `TransactionalConnection.findOneInChannel()` an options array of:
|
|
19
|
+
*
|
|
20
|
+
* ```
|
|
21
|
+
* { relations: ['customFields.featuredFacet'] }
|
|
22
|
+
* ```
|
|
23
|
+
* it will throw an error because the `Facet` entity itself has eager relations (namely the `translations` property).
|
|
24
|
+
* This will cause TypeORM to throw the error:
|
|
25
|
+
* ```
|
|
26
|
+
* TypeORMError: "entity__customFields" alias was not found. Maybe you forgot to join it?
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* So this method introspects the QueryBuilder metadata and checks for any custom field relations which
|
|
30
|
+
* themselves have eager relations. If found, it removes those items from the `options.relations` array.
|
|
31
|
+
*
|
|
32
|
+
* TODO: Ideally create a minimal reproduction case and report in the TypeORM repo for an upstream fix.
|
|
33
|
+
*/
|
|
34
|
+
export declare function removeCustomFieldsWithEagerRelations(qb: SelectQueryBuilder<any>, relations?: string[]): string[];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeCustomFieldsWithEagerRelations = void 0;
|
|
4
|
+
const index_1 = require("../config/index");
|
|
5
|
+
/**
|
|
6
|
+
* This is a work-around for this issue: https://github.com/vendure-ecommerce/vendure/issues/1664
|
|
7
|
+
*
|
|
8
|
+
* Explanation:
|
|
9
|
+
* When calling `FindOptionsUtils.joinEagerRelations()`, there appears to be a bug in TypeORM whereby
|
|
10
|
+
* it will throw the following error *if* the `options.relations` array contains any customField relations
|
|
11
|
+
* where the related entity itself has eagerly-loaded relations.
|
|
12
|
+
*
|
|
13
|
+
* For example, let's say we define a custom field on the Product entity like this:
|
|
14
|
+
* ```
|
|
15
|
+
* Product: [{
|
|
16
|
+
* name: 'featuredFacet',
|
|
17
|
+
* type: 'relation',
|
|
18
|
+
* entity: Facet,
|
|
19
|
+
* }],
|
|
20
|
+
* ```
|
|
21
|
+
* and then we pass into `TransactionalConnection.findOneInChannel()` an options array of:
|
|
22
|
+
*
|
|
23
|
+
* ```
|
|
24
|
+
* { relations: ['customFields.featuredFacet'] }
|
|
25
|
+
* ```
|
|
26
|
+
* it will throw an error because the `Facet` entity itself has eager relations (namely the `translations` property).
|
|
27
|
+
* This will cause TypeORM to throw the error:
|
|
28
|
+
* ```
|
|
29
|
+
* TypeORMError: "entity__customFields" alias was not found. Maybe you forgot to join it?
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* So this method introspects the QueryBuilder metadata and checks for any custom field relations which
|
|
33
|
+
* themselves have eager relations. If found, it removes those items from the `options.relations` array.
|
|
34
|
+
*
|
|
35
|
+
* TODO: Ideally create a minimal reproduction case and report in the TypeORM repo for an upstream fix.
|
|
36
|
+
*/
|
|
37
|
+
function removeCustomFieldsWithEagerRelations(qb, relations = []) {
|
|
38
|
+
let resultingRelations = relations;
|
|
39
|
+
const mainAlias = qb.expressionMap.mainAlias;
|
|
40
|
+
const customFieldsMetadata = mainAlias === null || mainAlias === void 0 ? void 0 : mainAlias.metadata.embeddeds.find(metadata => metadata.propertyName === 'customFields');
|
|
41
|
+
if (customFieldsMetadata) {
|
|
42
|
+
const customFieldRelationsWithEagerRelations = customFieldsMetadata.relations.filter(relation => !!relation.inverseEntityMetadata.ownRelations.find(or => or.isEager === true));
|
|
43
|
+
for (const relation of customFieldRelationsWithEagerRelations) {
|
|
44
|
+
const propertyName = relation.propertyName;
|
|
45
|
+
const relationsToRemove = relations.filter(r => r.startsWith(`customFields.${propertyName}`));
|
|
46
|
+
if (relationsToRemove.length) {
|
|
47
|
+
index_1.Logger.debug(`TransactionalConnection.findOneInChannel cannot automatically join relation [${mainAlias === null || mainAlias === void 0 ? void 0 : mainAlias.metadata.name}.customFields.${propertyName}]`);
|
|
48
|
+
resultingRelations = relations.filter(r => !r.startsWith(`customFields.${propertyName}`));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return resultingRelations;
|
|
53
|
+
}
|
|
54
|
+
exports.removeCustomFieldsWithEagerRelations = removeCustomFieldsWithEagerRelations;
|
|
55
|
+
//# sourceMappingURL=remove-custom-fields-with-eager-relations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-custom-fields-with-eager-relations.js","sourceRoot":"","sources":["../../src/connection/remove-custom-fields-with-eager-relations.ts"],"names":[],"mappings":";;;AAEA,2CAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,SAAgB,oCAAoC,CAChD,EAA2B,EAC3B,YAAsB,EAAE;IAExB,IAAI,kBAAkB,GAAG,SAAS,CAAC;IACnC,MAAM,SAAS,GAAG,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC;IAC7C,MAAM,oBAAoB,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,CAC3D,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,KAAK,cAAc,CACvD,CAAC;IACF,IAAI,oBAAoB,EAAE;QACtB,MAAM,sCAAsC,GAAG,oBAAoB,CAAC,SAAS,CAAC,MAAM,CAChF,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,KAAK,IAAI,CAAC,CAC5F,CAAC;QACF,KAAK,MAAM,QAAQ,IAAI,sCAAsC,EAAE;YAC3D,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;YAC3C,MAAM,iBAAiB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,gBAAgB,YAAY,EAAE,CAAC,CAAC,CAAC;YAC9F,IAAI,iBAAiB,CAAC,MAAM,EAAE;gBAC1B,cAAM,CAAC,KAAK,CACR,gFAAgF,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,CAAC,IAAI,iBAAiB,YAAY,GAAG,CAC3I,CAAC;gBACF,kBAAkB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,gBAAgB,YAAY,EAAE,CAAC,CAAC,CAAC;aAC7F;SACJ;KACJ;IACD,OAAO,kBAAkB,CAAC;AAC9B,CAAC;AAzBD,oFAyBC"}
|