@vendure/core 2.0.0-next.1 → 2.0.0-next.10
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/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.js +9 -4
- 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 +24 -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 +6 -5
- package/dist/api/resolvers/admin/order.resolver.js +24 -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 +3 -2
- package/dist/api/resolvers/admin/product-option.resolver.js +8 -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/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/order-line-entity.resolver.d.ts +6 -3
- package/dist/api/resolvers/entity/order-line-entity.resolver.js +19 -2
- package/dist/api/resolvers/entity/order-line-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 +12 -1
- 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 +32 -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 +4 -0
- package/dist/api/schema/common/common-error-results.graphql +22 -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 +8 -3
- 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/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 +29 -0
- package/dist/common/error/generated-graphql-admin-errors.js +33 -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/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.module.js +4 -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-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/index.d.ts +4 -0
- package/dist/config/index.js +4 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/payment/dummy-payment-method-handler.js +2 -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 +7 -8
- package/dist/config/payment/payment-method-handler.js +6 -6
- 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/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 +70 -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 +5 -5
- 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 +26 -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/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/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/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 +15 -11
- 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 +16 -12
- 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.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 +15 -11
- 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/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/list-query-builder/list-query-builder.d.ts +40 -1
- package/dist/service/helpers/list-query-builder/list-query-builder.js +153 -23
- 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 +4 -1
- package/dist/service/helpers/locale-string-hydrator/locale-string-hydrator.js +4 -1
- package/dist/service/helpers/locale-string-hydrator/locale-string-hydrator.js.map +1 -1
- package/dist/service/helpers/order-calculator/order-calculator.js +4 -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 +8 -1
- package/dist/service/helpers/order-modifier/order-modifier.js +101 -9
- 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/slug-validator/slug-validator.js +15 -6
- package/dist/service/helpers/slug-validator/slug-validator.js.map +1 -1
- 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.js +1 -2
- package/dist/service/helpers/utils/translate-entity.js.map +1 -1
- package/dist/service/index.d.ts +1 -0
- package/dist/service/index.js +1 -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/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 +8 -5
- package/dist/service/services/collection.service.js +49 -17
- package/dist/service/services/collection.service.js.map +1 -1
- package/dist/service/services/country.service.d.ts +3 -2
- package/dist/service/services/country.service.js +4 -4
- 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 +3 -2
- package/dist/service/services/customer.service.js +4 -4
- package/dist/service/services/customer.service.js.map +1 -1
- package/dist/service/services/facet-value.service.d.ts +4 -0
- package/dist/service/services/facet-value.service.js +8 -4
- package/dist/service/services/facet-value.service.js.map +1 -1
- package/dist/service/services/facet.service.d.ts +7 -2
- package/dist/service/services/facet.service.js +22 -10
- package/dist/service/services/facet.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.service.d.ts +30 -7
- package/dist/service/services/order.service.js +138 -69
- 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.js +4 -4
- package/dist/service/services/payment.service.js.map +1 -1
- package/dist/service/services/product-option-group.service.d.ts +3 -2
- package/dist/service/services/product-option-group.service.js +4 -4
- package/dist/service/services/product-option-group.service.js.map +1 -1
- package/dist/service/services/product-variant.service.d.ts +11 -3
- package/dist/service/services/product-variant.service.js +58 -42
- package/dist/service/services/product-variant.service.js.map +1 -1
- package/dist/service/services/product.service.d.ts +5 -4
- package/dist/service/services/product.service.js +18 -8
- 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 +9 -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 +3 -2
- package/dist/service/services/shipping-method.service.js +6 -6
- package/dist/service/services/shipping-method.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.js +2 -1
- package/dist/service/services/user.service.js.map +1 -1
- package/dist/service/services/zone.service.d.ts +2 -2
- package/dist/service/services/zone.service.js +2 -2
- package/dist/service/services/zone.service.js.map +1 -1
- package/package.json +5 -4
|
@@ -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
|
}
|
|
@@ -816,6 +849,35 @@ export interface EntityOptions {
|
|
|
816
849
|
* @default 30000
|
|
817
850
|
*/
|
|
818
851
|
zoneCacheTtl?: number;
|
|
852
|
+
/**
|
|
853
|
+
* @description
|
|
854
|
+
* Allows the metadata of the built-in TypeORM entities to be manipulated. This allows you
|
|
855
|
+
* to do things like altering data types, adding indices etc. This is an advanced feature
|
|
856
|
+
* which should be used with some caution as it will result in DB schema changes. For examples
|
|
857
|
+
* see {@link EntityMetadataModifier}.
|
|
858
|
+
*
|
|
859
|
+
* @since 1.6.0
|
|
860
|
+
* @default []
|
|
861
|
+
*/
|
|
862
|
+
metadataModifiers?: EntityMetadataModifier[];
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* @description
|
|
866
|
+
* Options relating to system functions.
|
|
867
|
+
*
|
|
868
|
+
* @since 1.6.0
|
|
869
|
+
* @docsCategory configuration
|
|
870
|
+
*/
|
|
871
|
+
export interface SystemOptions {
|
|
872
|
+
/**
|
|
873
|
+
* @description
|
|
874
|
+
* Defines an array of {@link HealthCheckStrategy} instances which are used by the `/health` endpoint to verify
|
|
875
|
+
* that any critical systems which the Vendure server depends on are also healthy.
|
|
876
|
+
*
|
|
877
|
+
* @default [TypeORMHealthCheckStrategy]
|
|
878
|
+
* @since 1.6.0
|
|
879
|
+
*/
|
|
880
|
+
healthChecks?: HealthCheckStrategy[];
|
|
819
881
|
}
|
|
820
882
|
/**
|
|
821
883
|
* @description
|
|
@@ -938,6 +1000,13 @@ export interface VendureConfig {
|
|
|
938
1000
|
* Configures how the job queue is persisted and processed.
|
|
939
1001
|
*/
|
|
940
1002
|
jobQueueOptions?: JobQueueOptions;
|
|
1003
|
+
/**
|
|
1004
|
+
* @description
|
|
1005
|
+
* Configures system options
|
|
1006
|
+
*
|
|
1007
|
+
* @since 1.6.0
|
|
1008
|
+
*/
|
|
1009
|
+
systemOptions?: SystemOptions;
|
|
941
1010
|
}
|
|
942
1011
|
/**
|
|
943
1012
|
* @description
|
|
@@ -959,6 +1028,7 @@ export interface RuntimeVendureConfig extends Required<VendureConfig> {
|
|
|
959
1028
|
promotionOptions: Required<PromotionOptions>;
|
|
960
1029
|
shippingOptions: Required<ShippingOptions>;
|
|
961
1030
|
taxOptions: Required<TaxOptions>;
|
|
1031
|
+
systemOptions: Required<SystemOptions>;
|
|
962
1032
|
}
|
|
963
1033
|
declare type DeepPartialSimple<T> = {
|
|
964
1034
|
[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,7 +3,19 @@ import { EntityManager } from 'typeorm/entity-manager/EntityManager';
|
|
|
3
3
|
import { QueryRunner } from 'typeorm/query-runner/QueryRunner';
|
|
4
4
|
import { TransactionCommitEvent } from 'typeorm/subscriber/event/TransactionCommitEvent';
|
|
5
5
|
import { TransactionRollbackEvent } from 'typeorm/subscriber/event/TransactionRollbackEvent';
|
|
6
|
+
/**
|
|
7
|
+
* This error should be thrown by an event subscription if types do not match
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class TransactionSubscriberError extends Error {
|
|
12
|
+
}
|
|
13
|
+
export declare type TransactionSubscriberEventType = 'commit' | 'rollback';
|
|
6
14
|
export interface TransactionSubscriberEvent {
|
|
15
|
+
/**
|
|
16
|
+
* Event type. Either commit or rollback.
|
|
17
|
+
*/
|
|
18
|
+
type: TransactionSubscriberEventType;
|
|
7
19
|
/**
|
|
8
20
|
* Connection used in the event.
|
|
9
21
|
*/
|
|
@@ -28,10 +40,12 @@ export interface TransactionSubscriberEvent {
|
|
|
28
40
|
*/
|
|
29
41
|
export declare class TransactionSubscriber implements EntitySubscriberInterface {
|
|
30
42
|
private connection;
|
|
31
|
-
private
|
|
32
|
-
private rollback$;
|
|
43
|
+
private subject$;
|
|
33
44
|
constructor(connection: Connection);
|
|
34
45
|
afterTransactionCommit(event: TransactionCommitEvent): void;
|
|
35
46
|
afterTransactionRollback(event: TransactionRollbackEvent): void;
|
|
47
|
+
awaitCommit(queryRunner: QueryRunner): Promise<QueryRunner>;
|
|
48
|
+
awaitRollback(queryRunner: QueryRunner): Promise<QueryRunner>;
|
|
36
49
|
awaitRelease(queryRunner: QueryRunner): Promise<QueryRunner>;
|
|
50
|
+
private awaitTransactionEvent;
|
|
37
51
|
}
|
|
@@ -13,12 +13,20 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
var TransactionSubscriber_1;
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.TransactionSubscriber = void 0;
|
|
16
|
+
exports.TransactionSubscriber = exports.TransactionSubscriberError = void 0;
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
18
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
19
|
const rxjs_1 = require("rxjs");
|
|
20
20
|
const operators_1 = require("rxjs/operators");
|
|
21
21
|
const typeorm_2 = require("typeorm");
|
|
22
|
+
/**
|
|
23
|
+
* This error should be thrown by an event subscription if types do not match
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
class TransactionSubscriberError extends Error {
|
|
28
|
+
}
|
|
29
|
+
exports.TransactionSubscriberError = TransactionSubscriberError;
|
|
22
30
|
/**
|
|
23
31
|
* This subscriber listens to all transaction commit/rollback events emitted by TypeORM
|
|
24
32
|
* so that we can be notified as soon as a particular queryRunner's transactions ends.
|
|
@@ -29,21 +37,34 @@ const typeorm_2 = require("typeorm");
|
|
|
29
37
|
let TransactionSubscriber = TransactionSubscriber_1 = class TransactionSubscriber {
|
|
30
38
|
constructor(connection) {
|
|
31
39
|
this.connection = connection;
|
|
32
|
-
this.
|
|
33
|
-
this.rollback$ = new rxjs_1.Subject();
|
|
40
|
+
this.subject$ = new rxjs_1.Subject();
|
|
34
41
|
if (!connection.subscribers.find(subscriber => subscriber.constructor === TransactionSubscriber_1)) {
|
|
35
42
|
connection.subscribers.push(this);
|
|
36
43
|
}
|
|
37
44
|
}
|
|
38
45
|
afterTransactionCommit(event) {
|
|
39
|
-
this.
|
|
46
|
+
this.subject$.next(Object.assign({ type: 'commit' }, event));
|
|
40
47
|
}
|
|
41
48
|
afterTransactionRollback(event) {
|
|
42
|
-
this.
|
|
49
|
+
this.subject$.next(Object.assign({ type: 'rollback' }, event));
|
|
50
|
+
}
|
|
51
|
+
awaitCommit(queryRunner) {
|
|
52
|
+
return this.awaitTransactionEvent(queryRunner, 'commit');
|
|
53
|
+
}
|
|
54
|
+
awaitRollback(queryRunner) {
|
|
55
|
+
return this.awaitTransactionEvent(queryRunner, 'rollback');
|
|
43
56
|
}
|
|
44
57
|
awaitRelease(queryRunner) {
|
|
58
|
+
return this.awaitTransactionEvent(queryRunner);
|
|
59
|
+
}
|
|
60
|
+
awaitTransactionEvent(queryRunner, type) {
|
|
45
61
|
if (queryRunner.isTransactionActive) {
|
|
46
|
-
return (0, rxjs_1.lastValueFrom)(
|
|
62
|
+
return (0, rxjs_1.lastValueFrom)(this.subject$
|
|
63
|
+
.pipe((0, operators_1.filter)(event => !event.queryRunner.isTransactionActive && event.queryRunner === queryRunner), (0, operators_1.take)(1), (0, operators_1.tap)(event => {
|
|
64
|
+
if (type && event.type !== type) {
|
|
65
|
+
throw new TransactionSubscriberError(`Unexpected event type: ${event.type}. Expected ${type}.`);
|
|
66
|
+
}
|
|
67
|
+
}), (0, operators_1.map)(event => event.queryRunner),
|
|
47
68
|
// This `delay(0)` call appears to be necessary with the upgrade to TypeORM
|
|
48
69
|
// v0.2.41, otherwise an active queryRunner can still get picked up in an event
|
|
49
70
|
// subscriber function. This is manifested by the e2e test
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-subscriber.js","sourceRoot":"","sources":["../../src/connection/transaction-subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,+
|
|
1
|
+
{"version":3,"file":"transaction-subscriber.js","sourceRoot":"","sources":["../../src/connection/transaction-subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,+BAAsE;AACtE,8CAA+D;AAC/D,qCAAgE;AAMhE;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,KAAK;CAAG;AAAxD,gEAAwD;AA0BxD;;;;;;GAMG;AAEH,IAAa,qBAAqB,6BAAlC,MAAa,qBAAqB;IAG9B,YAAwC,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAFtD,aAAQ,GAAG,IAAI,cAAO,EAA8B,CAAC;QAGzD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,KAAK,uBAAqB,CAAC,EAAE;YAC9F,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrC;IACL,CAAC;IAED,sBAAsB,CAAC,KAA6B;QAChD,IAAI,CAAC,QAAQ,CAAC,IAAI,iBACd,IAAI,EAAE,QAAQ,IACX,KAAK,EACV,CAAC;IACP,CAAC;IAED,wBAAwB,CAAC,KAA+B;QACpD,IAAI,CAAC,QAAQ,CAAC,IAAI,iBACd,IAAI,EAAE,UAAU,IACb,KAAK,EACV,CAAC;IACP,CAAC;IAED,WAAW,CAAC,WAAwB;QAChC,OAAO,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAED,aAAa,CAAC,WAAwB;QAClC,OAAO,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAC/D,CAAC;IAED,YAAY,CAAC,WAAwB;QACjC,OAAO,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IAEO,qBAAqB,CACzB,WAAwB,EACxB,IAAqC;QAErC,IAAI,WAAW,CAAC,mBAAmB,EAAE;YACjC,OAAO,IAAA,oBAAa,EAAC,IAAI,CAAC,QAAQ;iBAC7B,IAAI,CACD,IAAA,kBAAM,EACF,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,mBAAmB,IAAI,KAAK,CAAC,WAAW,KAAK,WAAW,CACvF,EACD,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE;gBACR,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE;oBAC7B,MAAM,IAAI,0BAA0B,CAAC,0BAA0B,KAAK,CAAC,IAAI,cAAc,IAAI,GAAG,CAAC,CAAC;iBACnG;YACL,CAAC,CAAC,EACF,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;YAC/B,2EAA2E;YAC3E,+EAA+E;YAC/E,0DAA0D;YAC1D,0EAA0E;YAC1E,wEAAwE;YACxE,mEAAmE;YACnE,IAAA,iBAAK,EAAC,CAAC,CAAC,CACX,CACJ,CAAC;SACL;aAAM;YACH,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACvC;IACL,CAAC;CACJ,CAAA;AAjEY,qBAAqB;IADjC,IAAA,mBAAU,GAAE;IAII,WAAA,IAAA,0BAAgB,GAAE,CAAA;qCAAqB,oBAAU;GAHrD,qBAAqB,CAiEjC;AAjEY,sDAAqB"}
|
|
@@ -13,8 +13,12 @@ export declare class TransactionWrapper {
|
|
|
13
13
|
* Executes the `work` function within the context of a transaction. If the `work` function
|
|
14
14
|
* resolves / completes, then all the DB operations it contains will be committed. If it
|
|
15
15
|
* throws an error or rejects, then all DB operations will be rolled back.
|
|
16
|
+
*
|
|
17
|
+
* @note
|
|
18
|
+
* This function does not mutate your context. Instead, this function makes a copy and passes
|
|
19
|
+
* context to work function.
|
|
16
20
|
*/
|
|
17
|
-
executeInTransaction<T>(
|
|
21
|
+
executeInTransaction<T>(originalCtx: RequestContext, work: (ctx: RequestContext) => Observable<T> | Promise<T>, mode: TransactionMode, connection: Connection): Promise<T>;
|
|
18
22
|
/**
|
|
19
23
|
* Attempts to start a DB transaction, with retry logic in the case that a transaction
|
|
20
24
|
* is already started for the connection (which is mainly a problem with SQLite/Sql.js)
|
|
@@ -16,23 +16,23 @@ class TransactionWrapper {
|
|
|
16
16
|
* Executes the `work` function within the context of a transaction. If the `work` function
|
|
17
17
|
* resolves / completes, then all the DB operations it contains will be committed. If it
|
|
18
18
|
* throws an error or rejects, then all DB operations will be rolled back.
|
|
19
|
+
*
|
|
20
|
+
* @note
|
|
21
|
+
* This function does not mutate your context. Instead, this function makes a copy and passes
|
|
22
|
+
* context to work function.
|
|
19
23
|
*/
|
|
20
|
-
async executeInTransaction(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// as usual without needing to further wrap in a transaction.
|
|
26
|
-
return (0, rxjs_1.lastValueFrom)((0, rxjs_1.from)(work()));
|
|
27
|
-
}
|
|
28
|
-
const queryRunner = connection.createQueryRunner();
|
|
24
|
+
async executeInTransaction(originalCtx, work, mode, connection) {
|
|
25
|
+
// Copy to make sure original context will remain valid after transaction completes
|
|
26
|
+
const ctx = originalCtx.copy();
|
|
27
|
+
const entityManager = ctx[constants_1.TRANSACTION_MANAGER_KEY];
|
|
28
|
+
const queryRunner = (entityManager === null || entityManager === void 0 ? void 0 : entityManager.queryRunner) || connection.createQueryRunner();
|
|
29
29
|
if (mode === 'auto') {
|
|
30
30
|
await this.startTransaction(queryRunner);
|
|
31
31
|
}
|
|
32
32
|
ctx[constants_1.TRANSACTION_MANAGER_KEY] = queryRunner.manager;
|
|
33
33
|
try {
|
|
34
34
|
const maxRetries = 5;
|
|
35
|
-
const result = await (0, rxjs_1.lastValueFrom)((0, rxjs_1.from)(work()).pipe((0, operators_1.retryWhen)(errors => errors.pipe((0, operators_1.tap)(err => {
|
|
35
|
+
const result = await (0, rxjs_1.lastValueFrom)((0, rxjs_1.from)(work(ctx)).pipe((0, operators_1.retryWhen)(errors => errors.pipe((0, operators_1.tap)(err => {
|
|
36
36
|
if (!this.isRetriableError(err)) {
|
|
37
37
|
throw err;
|
|
38
38
|
}
|
|
@@ -49,7 +49,10 @@ class TransactionWrapper {
|
|
|
49
49
|
throw error;
|
|
50
50
|
}
|
|
51
51
|
finally {
|
|
52
|
-
if (
|
|
52
|
+
if (!queryRunner.isTransactionActive
|
|
53
|
+
&& queryRunner.isReleased === false) {
|
|
54
|
+
// There is a check for an active transaction
|
|
55
|
+
// because this could be a nested transaction (savepoint).
|
|
53
56
|
await queryRunner.release();
|
|
54
57
|
}
|
|
55
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-wrapper.js","sourceRoot":"","sources":["../../src/connection/transaction-wrapper.ts"],"names":[],"mappings":";;;AAAA,+BAA2D;AAC3D,8CAAsD;AAEtD,iGAA8F;AAI9F,mDAA8D;AAE9D;;;;GAIG;AACH,MAAa,kBAAkB;IAC3B
|
|
1
|
+
{"version":3,"file":"transaction-wrapper.js","sourceRoot":"","sources":["../../src/connection/transaction-wrapper.ts"],"names":[],"mappings":";;;AAAA,+BAA2D;AAC3D,8CAAsD;AAEtD,iGAA8F;AAI9F,mDAA8D;AAE9D;;;;GAIG;AACH,MAAa,kBAAkB;IAC3B;;;;;;;;;OASG;IACH,KAAK,CAAC,oBAAoB,CACtB,WAA2B,EAC3B,IAAyD,EACzD,IAAqB,EACrB,UAAsB;QAEtB,mFAAmF;QACnF,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI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ACL,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,gBAAgB,CAAC,WAAwB;QACnD,MAAM,UAAU,GAAG,EAAE,CAAC;QACtB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,SAAc,CAAC;QAEnB,wDAAwD;QACxD,KAAK,UAAU,uBAAuB;YAClC,IAAI;gBACA,MAAM,WAAW,CAAC,gBAAgB,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC;aACf;YAAC,OAAO,GAAQ,EAAE;gBACf,SAAS,GAAG,GAAG,CAAC;gBAChB,IAAI,GAAG,YAAY,+DAA8B,EAAE;oBAC/C,OAAO,KAAK,CAAC;iBAChB;gBACD,MAAM,GAAG,CAAC;aACb;QACL,CAAC;QAED,OAAO,QAAQ,GAAG,UAAU,EAAE;YAC1B,MAAM,MAAM,GAAG,MAAM,uBAAuB,EAAE,CAAC;YAC/C,IAAI,MAAM,EAAE;gBACR,OAAO;aACV;YACD,QAAQ,EAAE,CAAC;YACX,6CAA6C;YAC7C,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC;SACpE;QACD,MAAM,SAAS,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACK,gBAAgB,CAAC,GAAQ;QAC7B,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,KAAK,kBAAkB,CAAC;QACtD,MAAM,gBAAgB,GAAG,GAAG,CAAC,IAAI,KAAK,mBAAmB,CAAC;QAC1D,OAAO,aAAa,IAAI,gBAAgB,CAAC;IAC7C,CAAC;CACJ;AA7GD,gDA6GC"}
|
|
@@ -33,6 +33,8 @@ export declare class TransactionalConnection {
|
|
|
33
33
|
* Returns a TypeORM repository. Note that when no RequestContext is supplied, the repository will not
|
|
34
34
|
* be aware of any existing transaction. Therefore calling this method without supplying a RequestContext
|
|
35
35
|
* is discouraged without a deliberate reason.
|
|
36
|
+
*
|
|
37
|
+
* @deprecated since 1.7.0: Use {@link TransactionalConnection.rawConnection rawConnection.getRepository()} function instead.
|
|
36
38
|
*/
|
|
37
39
|
getRepository<Entity>(target: ObjectType<Entity> | EntitySchema<Entity> | string): Repository<Entity>;
|
|
38
40
|
/**
|
|
@@ -58,16 +60,20 @@ export declare class TransactionalConnection {
|
|
|
58
60
|
* of Vendure internal services.
|
|
59
61
|
*
|
|
60
62
|
* If there is already a {@link RequestContext} object available, you should pass it in as the first
|
|
61
|
-
* argument in order to
|
|
63
|
+
* argument in order to create transactional context as the copy. If not, omit the first argument and an empty
|
|
62
64
|
* RequestContext object will be created, which is then used to propagate the transaction to
|
|
63
65
|
* all inner method calls.
|
|
64
66
|
*
|
|
65
67
|
* @example
|
|
66
68
|
* ```TypeScript
|
|
67
|
-
* private async transferCredit(fromId: ID, toId: ID, amount: number) {
|
|
68
|
-
* await this.connection.withTransaction(ctx => {
|
|
69
|
+
* private async transferCredit(outerCtx: RequestContext, fromId: ID, toId: ID, amount: number) {
|
|
70
|
+
* await this.connection.withTransaction(outerCtx, ctx => {
|
|
69
71
|
* await this.giftCardService.updateCustomerCredit(fromId, -amount);
|
|
70
72
|
*
|
|
73
|
+
* // Note you must not use outerCtx here, instead use ctx. Otherwise this query
|
|
74
|
+
* // will be executed outside of transaction
|
|
75
|
+
* await this.connection.getRepository(ctx, GiftCard).update(fromId, { transferred: true })
|
|
76
|
+
*
|
|
71
77
|
* // If some intermediate logic here throws an Error,
|
|
72
78
|
* // then all DB transactions will be rolled back and neither Customer's
|
|
73
79
|
* // credit balance will have changed.
|
|
@@ -58,20 +58,20 @@ let TransactionalConnection = class TransactionalConnection {
|
|
|
58
58
|
return this.connection;
|
|
59
59
|
}
|
|
60
60
|
getRepository(ctxOrTarget, maybeTarget) {
|
|
61
|
-
var _a;
|
|
62
61
|
if (ctxOrTarget instanceof request_context_1.RequestContext) {
|
|
63
62
|
const transactionManager = this.getTransactionManager(ctxOrTarget);
|
|
64
|
-
if (transactionManager
|
|
63
|
+
if (transactionManager) {
|
|
64
|
+
// tslint:disable-next-line:no-non-null-assertion
|
|
65
65
|
return transactionManager.getRepository(maybeTarget);
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
68
|
// tslint:disable-next-line:no-non-null-assertion
|
|
69
|
-
return
|
|
69
|
+
return this.rawConnection.getRepository(maybeTarget);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
// tslint:disable-next-line:no-non-null-assertion
|
|
74
|
-
return
|
|
74
|
+
return this.rawConnection.getRepository(ctxOrTarget !== null && ctxOrTarget !== void 0 ? ctxOrTarget : maybeTarget);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
async withTransaction(ctxOrWork, maybeWork) {
|
|
@@ -86,7 +86,7 @@ let TransactionalConnection = class TransactionalConnection {
|
|
|
86
86
|
ctx = request_context_1.RequestContext.empty();
|
|
87
87
|
work = ctxOrWork;
|
|
88
88
|
}
|
|
89
|
-
return this.transactionWrapper.executeInTransaction(ctx,
|
|
89
|
+
return this.transactionWrapper.executeInTransaction(ctx, work, 'auto', this.rawConnection);
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
92
|
* @description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactional-connection.js","sourceRoot":"","sources":["../../src/connection/transactional-connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AAEnD,
|
|
1
|
+
{"version":3,"file":"transactional-connection.js","sourceRoot":"","sources":["../../src/connection/transactional-connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AAEnD,qCAQiB;AAEjB,mEAA+D;AAC/D,mDAA8D;AAC9D,mDAA6D;AAI7D,+DAA2D;AAG3D;;;;;;;;;;;GAWG;AAEH,IAAa,uBAAuB,GAApC,MAAa,uBAAuB;IAChC,YACgC,UAAsB,EAC1C,kBAA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O,CAAC,CAAC;QAC7E,IAAI,OAAO,CAAC,kBAAkB,KAAK,KAAK,EAAE;YACtC,iDAAiD;YACjD,0BAAgB,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,SAAU,CAAC,QAAQ,CAAC,CAAC;SAC3F;QACD,OAAO,EAAE;aACJ,QAAQ,CAAC,iBAAiB,EAAE,SAAS,CAAC;aACtC,QAAQ,CAAC,wBAAwB,EAAE,EAAE,GAAG,EAAE,CAAC;aAC3C,QAAQ,CAAC,yBAAyB,EAAE,EAAE,SAAS,EAAE,CAAC;aAClD,OAAO,EAAE,CAAC;IACnB,CAAC;IAEO,qBAAqB,CAAC,GAAmB;QAC7C,OAAQ,GAAW,CAAC,mCAAuB,CAAC,CAAC;IACjD,CAAC;CACJ,CAAA;AAnRY,uBAAuB;IADnC,IAAA,mBAAU,GAAE;IAGJ,WAAA,IAAA,0BAAgB,GAAE,CAAA;qCAAqB,oBAAU;QACtB,wCAAkB;GAHzC,uBAAuB,CAmRnC;AAnRY,0DAAuB"}
|
|
@@ -8,14 +8,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.AssetImporter = void 0;
|
|
16
13
|
const common_1 = require("@nestjs/common");
|
|
17
|
-
const
|
|
18
|
-
const path_1 = __importDefault(require("path"));
|
|
14
|
+
const index_1 = require("../../../common/index");
|
|
19
15
|
const config_service_1 = require("../../../config/config.service");
|
|
20
16
|
const asset_service_1 = require("../../../service/services/asset.service");
|
|
21
17
|
/**
|
|
@@ -41,7 +37,7 @@ let AssetImporter = class AssetImporter {
|
|
|
41
37
|
async getAssets(assetPaths, ctx) {
|
|
42
38
|
const assets = [];
|
|
43
39
|
const errors = [];
|
|
44
|
-
const {
|
|
40
|
+
const { assetImportStrategy } = this.configService.importExportOptions;
|
|
45
41
|
const uniqueAssetPaths = new Set(assetPaths);
|
|
46
42
|
for (const assetPath of uniqueAssetPaths.values()) {
|
|
47
43
|
const cachedAsset = this.assetMap.get(assetPath);
|
|
@@ -49,23 +45,21 @@ let AssetImporter = class AssetImporter {
|
|
|
49
45
|
assets.push(cachedAsset);
|
|
50
46
|
}
|
|
51
47
|
else {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
try {
|
|
49
|
+
const stream = await assetImportStrategy.getStreamFromPath(assetPath);
|
|
50
|
+
if (stream) {
|
|
51
|
+
const asset = await this.assetService.createFromFileStream(stream, assetPath, ctx);
|
|
52
|
+
if ((0, index_1.isGraphQlErrorResult)(asset)) {
|
|
53
|
+
errors.push(asset.message);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
59
56
|
this.assetMap.set(assetPath, asset);
|
|
60
57
|
assets.push(asset);
|
|
61
58
|
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
errors.push(err.toString());
|
|
64
|
-
}
|
|
65
59
|
}
|
|
66
60
|
}
|
|
67
|
-
|
|
68
|
-
errors.push(
|
|
61
|
+
catch (e) {
|
|
62
|
+
errors.push(e.message);
|
|
69
63
|
}
|
|
70
64
|
}
|
|
71
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-importer.js","sourceRoot":"","sources":["../../../../src/data-import/providers/asset-importer/asset-importer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"asset-importer.js","sourceRoot":"","sources":["../../../../src/data-import/providers/asset-importer/asset-importer.ts"],"names":[],"mappings":";;;;;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,CAAC;4BAC7C,MAAM,CAAC,IAAI,CAAC,KAAc,CAAC,CAAC;yBAC/B;qBACJ;iBACJ;gBAAC,OAAO,CAAM,EAAE;oBACb,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;iBAC1B;aACJ;SACJ;QACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;CACJ,CAAA;AA1CY,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAK0B,8BAAa,EAAwB,4BAAY;GAJ3E,aAAa,CA0CzB;AA1CY,sCAAa"}
|
|
@@ -63,7 +63,7 @@ let FastImporterService = class FastImporterService {
|
|
|
63
63
|
channelOrToken: channel,
|
|
64
64
|
})
|
|
65
65
|
: request_context_1.RequestContext.empty();
|
|
66
|
-
this.defaultChannel = await this.channelService.getDefaultChannel();
|
|
66
|
+
this.defaultChannel = await this.channelService.getDefaultChannel(this.importCtx);
|
|
67
67
|
}
|
|
68
68
|
async createProduct(input) {
|
|
69
69
|
this.ensureInitialized();
|
|
@@ -88,7 +88,9 @@ let FastImporterService = class FastImporterService {
|
|
|
88
88
|
productId: product.id,
|
|
89
89
|
position: i,
|
|
90
90
|
}));
|
|
91
|
-
await this.connection
|
|
91
|
+
await this.connection
|
|
92
|
+
.getRepository(this.importCtx, product_asset_entity_1.ProductAsset)
|
|
93
|
+
.save(productAssets, { reload: false });
|
|
92
94
|
}
|
|
93
95
|
return product.id;
|
|
94
96
|
}
|
|
@@ -116,7 +118,7 @@ let FastImporterService = class FastImporterService {
|
|
|
116
118
|
async addOptionGroupToProduct(productId, optionGroupId) {
|
|
117
119
|
this.ensureInitialized();
|
|
118
120
|
await this.connection
|
|
119
|
-
.getRepository(product_entity_1.Product)
|
|
121
|
+
.getRepository(this.importCtx, product_entity_1.Product)
|
|
120
122
|
.createQueryBuilder()
|
|
121
123
|
.relation('optionGroups')
|
|
122
124
|
.of(productId)
|
|
@@ -159,7 +161,9 @@ let FastImporterService = class FastImporterService {
|
|
|
159
161
|
productVariantId: createdVariant.id,
|
|
160
162
|
position: i,
|
|
161
163
|
}));
|
|
162
|
-
await this.connection
|
|
164
|
+
await this.connection
|
|
165
|
+
.getRepository(this.importCtx, product_variant_asset_entity_1.ProductVariantAsset)
|
|
166
|
+
.save(variantAssets, { reload: false });
|
|
163
167
|
}
|
|
164
168
|
if (input.stockOnHand != null && input.stockOnHand !== 0) {
|
|
165
169
|
await this.stockMovementService.adjustProductVariantStock(this.importCtx, createdVariant.id, 0, input.stockOnHand);
|
|
@@ -171,7 +175,9 @@ let FastImporterService = class FastImporterService {
|
|
|
171
175
|
channelId,
|
|
172
176
|
});
|
|
173
177
|
variantPrice.variant = createdVariant;
|
|
174
|
-
await this.connection
|
|
178
|
+
await this.connection
|
|
179
|
+
.getRepository(this.importCtx, product_variant_price_entity_1.ProductVariantPrice)
|
|
180
|
+
.save(variantPrice, { reload: false });
|
|
175
181
|
}
|
|
176
182
|
return createdVariant.id;
|
|
177
183
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fast-importer.service.js","sourceRoot":"","sources":["../../../../src/data-import/providers/importer/fast-importer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAQ5C,uDAAoD;AAEpD,yEAAqE;AACrE,2FAAuF;AAEvF,0IAA6H;AAC7H,kHAAsG;AACtG,wHAA4G;AAC5G,gGAAqF;AACrF,+GAAmG;AACnG,+GAAmG;AACnG,2HAA+G;AAC/G,mGAAwF;AACxF,uFAA4E;AAC5E,mGAAwF;AACxF,2EAAiE;AACjE,uGAAmG;AACnG,kDAA+D;AAC/D,+EAA2E;AAC3E,6FAAwF;AAExF;;;;;;;;;GASG;AAEH,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAI5B,gBAAgB;IAChB,YACY,UAAmC,EACnC,cAA8B,EAC9B,oBAA0C,EAC1C,iBAAoC,EACpC,qBAA4C;QAJ5C,eAAU,GAAV,UAAU,CAAyB;QACnC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,0BAAqB,GAArB,qBAAqB,CAAuB;IACrD,CAAC;IAEJ;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CAAC,OAAiB;QAC9B,IAAI,CAAC,SAAS,GAAG,OAAO;YACpB,CAAC,CAAC,MAAM,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC;gBACpC,OAAO,EAAE,OAAO;gBAChB,cAAc,EAAE,OAAO;aAC1B,CAAC;YACJ,CAAC,CAAC,gCAAc,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"fast-importer.service.js","sourceRoot":"","sources":["../../../../src/data-import/providers/importer/fast-importer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAQ5C,uDAAoD;AAEpD,yEAAqE;AACrE,2FAAuF;AAEvF,0IAA6H;AAC7H,kHAAsG;AACtG,wHAA4G;AAC5G,gGAAqF;AACrF,+GAAmG;AACnG,+GAAmG;AACnG,2HAA+G;AAC/G,mGAAwF;AACxF,uFAA4E;AAC5E,mGAAwF;AACxF,2EAAiE;AACjE,uGAAmG;AACnG,kDAA+D;AAC/D,+EAA2E;AAC3E,6FAAwF;AAExF;;;;;;;;;GASG;AAEH,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAI5B,gBAAgB;IAChB,YACY,UAAmC,EACnC,cAA8B,EAC9B,oBAA0C,EAC1C,iBAAoC,EACpC,qBAA4C;QAJ5C,eAAU,GAAV,UAAU,CAAyB;QACnC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,0BAAqB,GAArB,qBAAqB,CAAuB;IACrD,CAAC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CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACtG,KAAK,MAAM,SAAS,IAAI,kBAAkB,EAAE;YACxC,MAAM,YAAY,GAAG,IAAI,kDAAmB,CAAC;gBACzC,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,SAAS;aACZ,CAAC,CAAC;YACH,YAAY,CAAC,OAAO,GAAG,cAAc,CAAC;YACtC,MAAM,IAAI,CAAC,UAAU;iBAChB,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,kDAAmB,CAAC;iBAClD,IAAI,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;SAC9C;QAED,OAAO,cAAc,CAAC,EAAE,CAAC;IAC7B,CAAC;IAEO,iBAAiB;QACrB,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACzC,MAAM,IAAI,KAAK,CACX,iGAAiG,CACpG,CAAC;SACL;IACL,CAAC;CACJ,CAAA;AA/KY,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAOe,kDAAuB;QACnB,gCAAc;QACR,6CAAoB;QACvB,sCAAiB;QACb,6BAAqB;GAV/C,mBAAmB,CA+K/B;AA/KY,kDAAmB"}
|
|
@@ -9,7 +9,7 @@ import { FacetValueService } from '../../../service/services/facet-value.service
|
|
|
9
9
|
import { FacetService } from '../../../service/services/facet.service';
|
|
10
10
|
import { TaxCategoryService } from '../../../service/services/tax-category.service';
|
|
11
11
|
import { AssetImporter } from '../asset-importer/asset-importer';
|
|
12
|
-
import { ImportParser } from '../import-parser/import-parser';
|
|
12
|
+
import { ImportParser, ParsedProductWithVariants } from '../import-parser/import-parser';
|
|
13
13
|
import { FastImporterService } from './fast-importer.service';
|
|
14
14
|
export interface ImportProgress extends ImportInfo {
|
|
15
15
|
currentProduct: string;
|
|
@@ -50,9 +50,10 @@ export declare class Importer {
|
|
|
50
50
|
private doParseAndImport;
|
|
51
51
|
private getRequestContext;
|
|
52
52
|
/**
|
|
53
|
+
* @description
|
|
53
54
|
* Imports the products specified in the rows object. Return an array of error messages.
|
|
54
55
|
*/
|
|
55
|
-
|
|
56
|
+
importProducts(ctx: RequestContext, rows: ParsedProductWithVariants[], onProgress: OnProgressFn): Promise<string[]>;
|
|
56
57
|
private getFacetValueIds;
|
|
57
58
|
private processCustomFieldValues;
|
|
58
59
|
/**
|