@vendure/core 1.6.3 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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/config/generate-resolvers.d.ts +3 -0
- package/dist/api/config/generate-resolvers.js +7 -1
- package/dist/api/config/generate-resolvers.js.map +1 -1
- package/dist/api/resolvers/admin/collection.resolver.js +8 -2
- package/dist/api/resolvers/admin/collection.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/order.resolver.d.ts +3 -2
- package/dist/api/resolvers/admin/order.resolver.js +15 -3
- package/dist/api/resolvers/admin/order.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/product-option.resolver.d.ts +2 -1
- package/dist/api/resolvers/admin/product-option.resolver.js +13 -0
- package/dist/api/resolvers/admin/product-option.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/collection-entity.resolver.d.ts +1 -0
- package/dist/api/resolvers/entity/collection-entity.resolver.js +11 -0
- 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/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 +5 -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/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 +1 -0
- package/dist/api/resolvers/entity/product-entity.resolver.js +11 -0
- 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-products.resolver.js +8 -2
- package/dist/api/resolvers/shop/shop-products.resolver.js.map +1 -1
- package/dist/api/schema/admin-api/order.api.graphql +11 -0
- package/dist/api/schema/admin-api/product-option-group.api.graphql +2 -0
- package/dist/api/schema/common/order.type.graphql +7 -0
- package/dist/api/schema/common/shipping-method.type.graphql +1 -0
- package/dist/bootstrap.js +2 -3
- package/dist/bootstrap.js.map +1 -1
- package/dist/common/configurable-operation.js +9 -4
- package/dist/common/configurable-operation.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 +10 -0
- package/dist/common/error/generated-graphql-admin-errors.js +17 -2
- package/dist/common/error/generated-graphql-admin-errors.js.map +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 +91 -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/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 +11 -0
- package/dist/config/config.module.js.map +1 -1
- package/dist/config/default-config.js +3 -1
- 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/fulfillment/custom-fulfillment-process.d.ts +2 -2
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +1 -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 +8 -0
- package/dist/config/payment/dummy-payment-method-handler.js.map +1 -1
- package/dist/config/payment/payment-method-handler.d.ts +66 -0
- package/dist/config/payment/payment-method-handler.js +11 -1
- package/dist/config/payment/payment-method-handler.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/vendure-config.d.ts +18 -0
- package/dist/connection/connection.module.d.ts +1 -1
- package/dist/connection/transaction-subscriber.d.ts +16 -2
- package/dist/connection/transaction-subscriber.js +27 -7
- package/dist/connection/transaction-subscriber.js.map +1 -1
- package/dist/connection/transaction-wrapper.js +6 -9
- package/dist/connection/transaction-wrapper.js.map +1 -1
- package/dist/connection/transactional-connection.d.ts +35 -0
- package/dist/connection/transactional-connection.js +53 -2
- 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/entity/order-line/order-line.entity.js +4 -0
- package/dist/entity/order-line/order-line.entity.js.map +1 -1
- package/dist/entity/product-option/product-option-translation.entity.js.map +1 -1
- package/dist/entity/product-option-group/product-option-group-translation.entity.js.map +1 -1
- package/dist/event-bus/event-bus.js +14 -3
- 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/index.d.ts +1 -0
- package/dist/event-bus/index.js +1 -0
- package/dist/event-bus/index.js.map +1 -1
- package/dist/i18n/messages/en.json +3 -0
- package/dist/migrate.js +14 -0
- package/dist/migrate.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js +31 -31
- 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.js +5 -5
- 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 +33 -1
- package/dist/plugin/default-search-plugin/search-strategy/search-strategy-utils.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js +31 -28
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js.map +1 -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/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 +10 -5
- package/dist/service/helpers/list-query-builder/list-query-builder.js +17 -8
- package/dist/service/helpers/list-query-builder/list-query-builder.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 +18 -0
- package/dist/service/helpers/order-calculator/order-calculator.js.map +1 -1
- package/dist/service/helpers/order-modifier/order-modifier.d.ts +19 -1
- package/dist/service/helpers/order-modifier/order-modifier.js +57 -21
- 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 +11 -1
- 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/translate-entity.d.ts +3 -3
- package/dist/service/helpers/utils/translate-entity.js +11 -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 +7 -2
- 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/asset.service.d.ts +2 -1
- package/dist/service/services/asset.service.js +19 -4
- package/dist/service/services/asset.service.js.map +1 -1
- package/dist/service/services/collection.service.d.ts +3 -1
- package/dist/service/services/collection.service.js +16 -16
- package/dist/service/services/collection.service.js.map +1 -1
- package/dist/service/services/country.service.d.ts +3 -1
- package/dist/service/services/country.service.js +9 -7
- package/dist/service/services/country.service.js.map +1 -1
- package/dist/service/services/customer.service.d.ts +3 -1
- package/dist/service/services/customer.service.js +8 -6
- package/dist/service/services/customer.service.js.map +1 -1
- package/dist/service/services/facet-value.service.d.ts +3 -1
- package/dist/service/services/facet-value.service.js +11 -6
- package/dist/service/services/facet-value.service.js.map +1 -1
- package/dist/service/services/facet.service.d.ts +3 -1
- package/dist/service/services/facet.service.js +18 -8
- 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/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 +10 -2
- package/dist/service/services/order.service.js +57 -27
- package/dist/service/services/order.service.js.map +1 -1
- package/dist/service/services/payment.service.d.ts +2 -0
- package/dist/service/services/payment.service.js +30 -10
- package/dist/service/services/payment.service.js.map +1 -1
- package/dist/service/services/product-option-group.service.d.ts +24 -2
- package/dist/service/services/product-option-group.service.js +92 -6
- 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 +3 -1
- package/dist/service/services/product-variant.service.js +12 -10
- package/dist/service/services/product-variant.service.js.map +1 -1
- package/dist/service/services/product.service.d.ts +5 -1
- package/dist/service/services/product.service.js +53 -20
- package/dist/service/services/product.service.js.map +1 -1
- package/dist/service/services/promotion.service.js +4 -1
- package/dist/service/services/promotion.service.js.map +1 -1
- package/dist/service/services/shipping-method.service.d.ts +3 -1
- package/dist/service/services/shipping-method.service.js +8 -6
- 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/user.service.js +8 -0
- package/dist/service/services/user.service.js.map +1 -1
- package/dist/service/services/zone.service.d.ts +3 -1
- package/dist/service/services/zone.service.js +8 -6
- package/dist/service/services/zone.service.js.map +1 -1
- package/package.json +4 -4
|
@@ -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
|
/**
|
|
@@ -119,6 +121,39 @@ export declare class TransactionalConnection {
|
|
|
119
121
|
* the given Channel.
|
|
120
122
|
*/
|
|
121
123
|
findOneInChannel<T extends ChannelAware & VendureEntity>(ctx: RequestContext, entity: Type<T>, id: ID, channelId: ID, options?: FindOneOptions): Promise<T | undefined>;
|
|
124
|
+
/**
|
|
125
|
+
* This is a work-around for this issue: https://github.com/vendure-ecommerce/vendure/issues/1664
|
|
126
|
+
*
|
|
127
|
+
* Explanation:
|
|
128
|
+
* When calling `FindOptionsUtils.joinEagerRelations()`, there appears to be a bug in TypeORM whereby
|
|
129
|
+
* it will throw the following error *if* the `options.relations` array contains any customField relations
|
|
130
|
+
* where the related entity itself has eagerly-loaded relations.
|
|
131
|
+
*
|
|
132
|
+
* For example, let's say we define a custom field on the Product entity like this:
|
|
133
|
+
* ```
|
|
134
|
+
* Product: [{
|
|
135
|
+
* name: 'featuredFacet',
|
|
136
|
+
* type: 'relation',
|
|
137
|
+
* entity: Facet,
|
|
138
|
+
* }],
|
|
139
|
+
* ```
|
|
140
|
+
* and then we pass into `TransactionalConnection.findOneInChannel()` an options array of:
|
|
141
|
+
*
|
|
142
|
+
* ```
|
|
143
|
+
* { relations: ['customFields.featuredFacet'] }
|
|
144
|
+
* ```
|
|
145
|
+
* it will throw an error because the `Facet` entity itself has eager relations (namely the `translations` property).
|
|
146
|
+
* This will cause TypeORM to throw the error:
|
|
147
|
+
* ```
|
|
148
|
+
* TypeORMError: "entity__customFields" alias was not found. Maybe you forgot to join it?
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* So this method introspects the QueryBuilder metadata and checks for any custom field relations which
|
|
152
|
+
* themselves have eager relations. If found, it removes those items from the `options.relations` array.
|
|
153
|
+
*
|
|
154
|
+
* TODO: Ideally create a minimal reproduction case and report in the TypeORM repo for an upstream fix.
|
|
155
|
+
*/
|
|
156
|
+
private removeCustomFieldsWithEagerRelations;
|
|
122
157
|
/**
|
|
123
158
|
* @description
|
|
124
159
|
* Like the TypeOrm `Repository.findByIds()` method, but limits the results to
|
|
@@ -30,6 +30,7 @@ const typeorm_2 = require("typeorm");
|
|
|
30
30
|
const request_context_1 = require("../api/common/request-context");
|
|
31
31
|
const constants_1 = require("../common/constants");
|
|
32
32
|
const errors_1 = require("../common/error/errors");
|
|
33
|
+
const index_1 = require("../config/index");
|
|
33
34
|
const transaction_wrapper_1 = require("./transaction-wrapper");
|
|
34
35
|
/**
|
|
35
36
|
* @description
|
|
@@ -66,12 +67,12 @@ let TransactionalConnection = class TransactionalConnection {
|
|
|
66
67
|
}
|
|
67
68
|
else {
|
|
68
69
|
// tslint:disable-next-line:no-non-null-assertion
|
|
69
|
-
return
|
|
70
|
+
return this.rawConnection.getRepository(maybeTarget);
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
else {
|
|
73
74
|
// tslint:disable-next-line:no-non-null-assertion
|
|
74
|
-
return
|
|
75
|
+
return this.rawConnection.getRepository(ctxOrTarget !== null && ctxOrTarget !== void 0 ? ctxOrTarget : maybeTarget);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
async withTransaction(ctxOrWork, maybeWork) {
|
|
@@ -180,6 +181,7 @@ let TransactionalConnection = class TransactionalConnection {
|
|
|
180
181
|
*/
|
|
181
182
|
findOneInChannel(ctx, entity, id, channelId, options = {}) {
|
|
182
183
|
const qb = this.getRepository(ctx, entity).createQueryBuilder('entity');
|
|
184
|
+
options.relations = this.removeCustomFieldsWithEagerRelations(qb, options.relations);
|
|
183
185
|
typeorm_2.FindOptionsUtils.applyFindManyOptionsOrConditionsToQueryBuilder(qb, options);
|
|
184
186
|
if (options.loadEagerRelations !== false) {
|
|
185
187
|
// tslint:disable-next-line:no-non-null-assertion
|
|
@@ -191,6 +193,55 @@ let TransactionalConnection = class TransactionalConnection {
|
|
|
191
193
|
.andWhere('channel.id = :channelId', { channelId })
|
|
192
194
|
.getOne();
|
|
193
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* This is a work-around for this issue: https://github.com/vendure-ecommerce/vendure/issues/1664
|
|
198
|
+
*
|
|
199
|
+
* Explanation:
|
|
200
|
+
* When calling `FindOptionsUtils.joinEagerRelations()`, there appears to be a bug in TypeORM whereby
|
|
201
|
+
* it will throw the following error *if* the `options.relations` array contains any customField relations
|
|
202
|
+
* where the related entity itself has eagerly-loaded relations.
|
|
203
|
+
*
|
|
204
|
+
* For example, let's say we define a custom field on the Product entity like this:
|
|
205
|
+
* ```
|
|
206
|
+
* Product: [{
|
|
207
|
+
* name: 'featuredFacet',
|
|
208
|
+
* type: 'relation',
|
|
209
|
+
* entity: Facet,
|
|
210
|
+
* }],
|
|
211
|
+
* ```
|
|
212
|
+
* and then we pass into `TransactionalConnection.findOneInChannel()` an options array of:
|
|
213
|
+
*
|
|
214
|
+
* ```
|
|
215
|
+
* { relations: ['customFields.featuredFacet'] }
|
|
216
|
+
* ```
|
|
217
|
+
* it will throw an error because the `Facet` entity itself has eager relations (namely the `translations` property).
|
|
218
|
+
* This will cause TypeORM to throw the error:
|
|
219
|
+
* ```
|
|
220
|
+
* TypeORMError: "entity__customFields" alias was not found. Maybe you forgot to join it?
|
|
221
|
+
* ```
|
|
222
|
+
*
|
|
223
|
+
* So this method introspects the QueryBuilder metadata and checks for any custom field relations which
|
|
224
|
+
* themselves have eager relations. If found, it removes those items from the `options.relations` array.
|
|
225
|
+
*
|
|
226
|
+
* TODO: Ideally create a minimal reproduction case and report in the TypeORM repo for an upstream fix.
|
|
227
|
+
*/
|
|
228
|
+
removeCustomFieldsWithEagerRelations(qb, relations = []) {
|
|
229
|
+
let resultingRelations = relations;
|
|
230
|
+
const mainAlias = qb.expressionMap.mainAlias;
|
|
231
|
+
const customFieldsMetadata = mainAlias === null || mainAlias === void 0 ? void 0 : mainAlias.metadata.embeddeds.find(metadata => metadata.propertyName === 'customFields');
|
|
232
|
+
if (customFieldsMetadata) {
|
|
233
|
+
const customFieldRelationsWithEagerRelations = customFieldsMetadata.relations.filter(relation => !!relation.inverseEntityMetadata.ownRelations.find(or => or.isEager === true));
|
|
234
|
+
for (const relation of customFieldRelationsWithEagerRelations) {
|
|
235
|
+
const propertyName = relation.propertyName;
|
|
236
|
+
const relationsToRemove = relations.filter(r => r.startsWith(`customFields.${propertyName}`));
|
|
237
|
+
if (relationsToRemove.length) {
|
|
238
|
+
index_1.Logger.debug(`TransactionalConnection.findOneInChannel cannot automatically join relation [${mainAlias === null || mainAlias === void 0 ? void 0 : mainAlias.metadata.name}.customFields.${propertyName}]`);
|
|
239
|
+
resultingRelations = relations.filter(r => !r.startsWith(`customFields.${propertyName}`));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return resultingRelations;
|
|
244
|
+
}
|
|
194
245
|
/**
|
|
195
246
|
* @description
|
|
196
247
|
* Like the TypeOrm `Repository.findByIds()` method, but limits the results to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactional-connection.js","sourceRoot":"","sources":["../../src/connection/transactional-connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AAEnD,qCASiB;AAEjB,mEAA+D;AAC/D,mDAA8D;AAC9D,mDAA6D;
|
|
1
|
+
{"version":3,"file":"transactional-connection.js","sourceRoot":"","sources":["../../src/connection/transactional-connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AAEnD,qCASiB;AAEjB,mEAA+D;AAC/D,mDAA8D;AAC9D,mDAA6D;AAE7D,2CAAyC;AAGzC,+DAA2D;AAG3D;;;;;;;;;;;GAWG;AAEH,IAAa,uBAAuB,GAApC,MAAa,uBAAuB;IAChC,YACgC,UAAsB,EAC1C,kBAAsC;QADlB,eAAU,GAAV,UAAU,CAAY;QAC1C,uBAAkB,GAAlB,kBAAkB,CAAoB;IAC/C,CAAC;IAEJ;;;;;OAKG;IACH,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAqBD,aAAa,CACT,WAA4F,EAC5F,WAAgE;QAEhE,IAAI,WAAW,YAAY,gCAAc,EAAE;YACvC,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;YACnE,IAAI,kBAAkB,EAAE;gBACpB,iDAA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S,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;AA/UY,uBAAuB;IADnC,mBAAU,EAAE;IAGJ,WAAA,0BAAgB,EAAE,CAAA;qCAAqB,oBAAU;QACtB,wCAAkB;GAHzC,uBAAuB,CA+UnC;AA/UY,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 (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":";;;;;;;;;;;;AAAA,2CAA4C;AAI5C,iDAA6D;AAC7D,mEAA+D;AAE/D,2EAAuE;AAEvE;;;;;;;GAOG;AAEH,IAAa,aAAa,GAA1B,MAAa,aAAa;IAGtB,gBAAgB;IAChB,YAAoB,aAA4B,EAAU,YAA0B;QAAhE,kBAAa,GAAb,aAAa,CAAe;QAAU,iBAAY,GAAZ,YAAY,CAAc;QAH5E,aAAQ,GAAG,IAAI,GAAG,EAAiB,CAA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qCAK0B,8BAAa,EAAwB,4BAAY;GAJ3E,aAAa,CA0CzB;AA1CY,sCAAa"}
|
|
@@ -14,6 +14,7 @@ const shared_utils_1 = require("@vendure/common/lib/shared-utils");
|
|
|
14
14
|
const typeorm_1 = require("typeorm");
|
|
15
15
|
const calculated_decorator_1 = require("../../common/calculated-decorator");
|
|
16
16
|
const tax_utils_1 = require("../../common/tax-utils");
|
|
17
|
+
const index_1 = require("../../config/index");
|
|
17
18
|
const asset_entity_1 = require("../asset/asset.entity");
|
|
18
19
|
const base_entity_1 = require("../base/base.entity");
|
|
19
20
|
const custom_entity_fields_1 = require("../custom-entity-fields");
|
|
@@ -203,6 +204,9 @@ let OrderLine = class OrderLine extends base_entity_1.VendureEntity {
|
|
|
203
204
|
* Returns all non-cancelled OrderItems on this line.
|
|
204
205
|
*/
|
|
205
206
|
get activeItems() {
|
|
207
|
+
if (this.items == null) {
|
|
208
|
+
index_1.Logger.warn(`Attempted to access OrderLine.items without first joining the relation: { relations: ['items'] }`);
|
|
209
|
+
}
|
|
206
210
|
return (this.items || []).filter(i => !i.cancelled);
|
|
207
211
|
}
|
|
208
212
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-line.entity.js","sourceRoot":"","sources":["../../../src/entity/order-line/order-line.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,mEAA2D;AAC3D,qCAA+D;AAE/D,4EAA+D;AAC/D,sDAAkE;AAElE,wDAA8C;AAC9C,qDAAoD;AACpD,kEAAgE;AAChE,uEAA4D;AAC5D,wDAA8C;AAC9C,sFAA2E;AAC3E,6EAAkE;AAElE;;;;;GAKG;AAEH,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,2BAAa;IACxC,YAAY,KAA8B;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAoBD;;;OAGG;IAEH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,CAAC,CAAC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AE,CAAC;;;wCAGpC;AASD;IADC,iCAAU,CAAC,EAAE,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;;;kDAGpC;AAOD;IADC,iCAAU,CAAC,EAAE,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;;;yDAGpC;AAGD;IADC,iCAAU,CAAC,EAAE,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;;;gDAGpC;AA3OQ,SAAS;IADrB,gBAAM,EAAE;;GACI,SAAS,CAsRrB;AAtRY,8BAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-option-translation.entity.js","sourceRoot":"","sources":["../../../src/entity/product-option/product-option-translation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAmE;AAEnE,qCAAoD;AAIpD,qDAAoD;AACpD,kEAA+E;AAE/E,mEAAwD;AAGxD,IAAa,wBAAwB,GAArC,MAAa,
|
|
1
|
+
{"version":3,"file":"product-option-translation.entity.js","sourceRoot":"","sources":["../../../src/entity/product-option/product-option-translation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAmE;AAEnE,qCAAoD;AAIpD,qDAAoD;AACpD,kEAA+E;AAE/E,mEAAwD;AAGxD,IAAa,wBAAwB,GAArC,MAAa,wBACT,SAAQ,2BAAa;IAGrB,YAAY,KAA+C;QACvD,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;CAYJ,CAAA;AAVsB;IAAlB,gBAAM,CAAC,SAAS,CAAC;;8DAA4B;AAEpC;IAAT,gBAAM,EAAE;;sDAAc;AAIvB;IADC,mBAAS,CAAC,IAAI,CAAC,EAAE,CAAC,qCAAa,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC;8BACtD,qCAAa;sDAAC;AAGpB;IADC,gBAAM,CAAC,IAAI,CAAC,EAAE,CAAC,2DAAoC,CAAC;8BACvC,2DAAoC;8DAAC;AAjB1C,wBAAwB;IADpC,gBAAM,EAAE;;GACI,wBAAwB,CAkBpC;AAlBY,4DAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-option-group-translation.entity.js","sourceRoot":"","sources":["../../../src/entity/product-option-group/product-option-group-translation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAmE;AAEnE,qCAAoD;AAIpD,qDAAoD;AACpD,kEAAoF;AAEpF,+EAAmE;AAGnE,IAAa,6BAA6B,GAA1C,MAAa,
|
|
1
|
+
{"version":3,"file":"product-option-group-translation.entity.js","sourceRoot":"","sources":["../../../src/entity/product-option-group/product-option-group-translation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAmE;AAEnE,qCAAoD;AAIpD,qDAAoD;AACpD,kEAAoF;AAEpF,+EAAmE;AAGnE,IAAa,6BAA6B,GAA1C,MAAa,6BACT,SAAQ,2BAAa;IAGrB,YAAY,KAAoD;QAC5D,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;CAYJ,CAAA;AAVsB;IAAlB,gBAAM,CAAC,SAAS,CAAC;;mEAA4B;AAEpC;IAAT,gBAAM,EAAE;;2DAAc;AAIvB;IADC,mBAAS,CAAC,IAAI,CAAC,EAAE,CAAC,gDAAkB,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC;8BAC3D,gDAAkB;2DAAC;AAGzB;IADC,gBAAM,CAAC,IAAI,CAAC,EAAE,CAAC,gEAAyC,CAAC;8BAC5C,gEAAyC;mEAAC;AAjB/C,6BAA6B;IADzC,gBAAM,EAAE;;GACI,6BAA6B,CAkBzC;AAlBY,sEAA6B"}
|
|
@@ -13,6 +13,7 @@ exports.EventBus = void 0;
|
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const rxjs_1 = require("rxjs");
|
|
15
15
|
const operators_1 = require("rxjs/operators");
|
|
16
|
+
const shared_utils_1 = require("../../../common/lib/shared-utils");
|
|
16
17
|
const request_context_1 = require("../api/common/request-context");
|
|
17
18
|
const constants_1 = require("../common/constants");
|
|
18
19
|
const transaction_subscriber_1 = require("../connection/transaction-subscriber");
|
|
@@ -82,7 +83,7 @@ let EventBus = class EventBus {
|
|
|
82
83
|
* data related to the event.
|
|
83
84
|
*/
|
|
84
85
|
ofType(type) {
|
|
85
|
-
return this.eventStream.asObservable().pipe(operators_1.takeUntil(this.destroy$), operators_1.filter(e => e.constructor === type), operators_1.mergeMap(event => this.awaitActiveTransactions(event)));
|
|
86
|
+
return this.eventStream.asObservable().pipe(operators_1.takeUntil(this.destroy$), operators_1.filter(e => e.constructor === type), operators_1.mergeMap(event => this.awaitActiveTransactions(event)), operators_1.filter(shared_utils_1.notNullOrUndefined));
|
|
86
87
|
}
|
|
87
88
|
/** @internal */
|
|
88
89
|
onModuleDestroy() {
|
|
@@ -117,7 +118,8 @@ let EventBus = class EventBus {
|
|
|
117
118
|
if (!(transactionManager === null || transactionManager === void 0 ? void 0 : transactionManager.queryRunner)) {
|
|
118
119
|
return event;
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
+
try {
|
|
122
|
+
await this.transactionSubscriber.awaitCommit(transactionManager.queryRunner);
|
|
121
123
|
// Copy context and remove transaction manager
|
|
122
124
|
// This will prevent queries to released query runner
|
|
123
125
|
const newContext = ctx.copy();
|
|
@@ -125,7 +127,16 @@ let EventBus = class EventBus {
|
|
|
125
127
|
// Reassign new context
|
|
126
128
|
event[key] = newContext;
|
|
127
129
|
return event;
|
|
128
|
-
}
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
if (e instanceof transaction_subscriber_1.TransactionSubscriberError) {
|
|
133
|
+
// Expected commit, but rollback or something else happened.
|
|
134
|
+
// This is still reliable behavior, return undefined
|
|
135
|
+
// as event should not be exposed from this transaction
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
throw e;
|
|
139
|
+
}
|
|
129
140
|
}
|
|
130
141
|
};
|
|
131
142
|
EventBus = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../src/event-bus/event-bus.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA6D;AAE7D,+BAA2C;AAC3C,8CAA6D;
|
|
1
|
+
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../src/event-bus/event-bus.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA6D;AAE7D,+BAA2C;AAC3C,8CAA6D;AAE7D,mEAAsE;AAEtE,mEAA+D;AAC/D,mDAA8D;AAC9D,iFAAyG;AAIzG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0CK;AAEL,IAAa,QAAQ,GAArB,MAAa,QAAQ;IAIjB,YAAoB,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;QAHxD,gBAAW,GAAG,IAAI,cAAO,EAAgB,CAAC;QAC1C,aAAQ,GAAG,IAAI,cAAO,EAAE,CAAC;IAEkC,CAAC;IAEpE;;;OAGG;IACH,OAAO,CAAyB,KAAQ;QACpC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAyB,IAAa;QACxC,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,IAAI,CACvC,qBAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EACxB,kBAAM,CAAC,CAAC,CAAC,EAAE,CAAE,CAAS,CAAC,WAAW,KAAK,IAAI,CAAC,EAC5C,oBAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,EACtD,kBAAM,CAAC,iCAAkB,CAAC,CACZ,CAAC;IACvB,CAAC;IAED,gBAAgB;IAChB,eAAe;QACX,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACK,KAAK,CAAC,uBAAuB,CAAyB,KAAQ;QAClE,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,YAAY,gCAAc,CAAC,CAAC;QAE1F,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,KAAK,CAAC;SAChB;QAED,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAA6B,KAAK,CAAC;QAEnD,MAAM,kBAAkB,GAA+B,GAAW,CAAC,mCAAuB,CAAC,CAAC;QAC5F,IAAI,CAAC,CAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,WAAW,CAAA,EAAE;YAClC,OAAO,KAAK,CAAC;SAChB;QAED,IAAI;YACA,MAAM,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAE7E,8CAA8C;YAC9C,qDAAqD;YACrD,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,OAAQ,UAAkB,CAAC,mCAAuB,CAAC,CAAC;YAEpD,uBAAuB;YACtB,KAAa,CAAC,GAAG,CAAC,GAAG,UAAU,CAAA;YAEhC,OAAO,KAAK,CAAC;SAChB;QAAC,OAAO,CAAM,EAAE;YACb,IAAI,CAAC,YAAY,mDAA0B,EAAE;gBACzC,4DAA4D;gBAC5D,oDAAoD;gBACpD,uDAAuD;gBACvD,OAAO;aACV;YAED,MAAM,CAAC,CAAC;SACX;IACL,CAAC;CACJ,CAAA;AA7FY,QAAQ;IADpB,mBAAU,EAAE;qCAKkC,8CAAqB;GAJvD,QAAQ,CA6FpB;AA7FY,4BAAQ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VendureEvent } from '../vendure-event';
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
* This event is fired when vendure finished initializing its services inside the {@code InitializerService}
|
|
5
|
+
*
|
|
6
|
+
* @docsCategory events
|
|
7
|
+
* @docsPage Event Types
|
|
8
|
+
* @since 1.7.0
|
|
9
|
+
*/
|
|
10
|
+
export declare class InitializerEvent extends VendureEvent {
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InitializerEvent = void 0;
|
|
4
|
+
const vendure_event_1 = require("../vendure-event");
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* This event is fired when vendure finished initializing its services inside the {@code InitializerService}
|
|
8
|
+
*
|
|
9
|
+
* @docsCategory events
|
|
10
|
+
* @docsPage Event Types
|
|
11
|
+
* @since 1.7.0
|
|
12
|
+
*/
|
|
13
|
+
class InitializerEvent extends vendure_event_1.VendureEvent {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.InitializerEvent = InitializerEvent;
|
|
19
|
+
//# sourceMappingURL=initializer-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializer-event.js","sourceRoot":"","sources":["../../../src/event-bus/events/initializer-event.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEhD;;;;;;;GAOG;AACH,MAAa,gBAAiB,SAAQ,4BAAY;IAC9C;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;CACJ;AAJD,4CAIC"}
|
|
@@ -13,6 +13,6 @@ declare type ProductOptionInputTypes = CreateGroupOptionInput | CreateProductOpt
|
|
|
13
13
|
* @since 1.4
|
|
14
14
|
*/
|
|
15
15
|
export declare class ProductOptionEvent extends VendureEntityEvent<ProductOption, ProductOptionInputTypes> {
|
|
16
|
-
constructor(ctx: RequestContext, entity: ProductOption, type: 'created' | 'updated', input?: ProductOptionInputTypes);
|
|
16
|
+
constructor(ctx: RequestContext, entity: ProductOption, type: 'created' | 'updated' | 'deleted', input?: ProductOptionInputTypes);
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-option-event.js","sourceRoot":"","sources":["../../../src/event-bus/events/product-option-event.ts"],"names":[],"mappings":";;;AASA,kEAA6D;AAQ7D;;;;;;;GAOG;AACH,MAAa,kBAAmB,SAAQ,yCAA0D;IAC9F,YACI,GAAmB,EACnB,MAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"product-option-event.js","sourceRoot":"","sources":["../../../src/event-bus/events/product-option-event.ts"],"names":[],"mappings":";;;AASA,kEAA6D;AAQ7D;;;;;;;GAOG;AACH,MAAa,kBAAmB,SAAQ,yCAA0D;IAC9F,YACI,GAAmB,EACnB,MAAqB,EACrB,IAAuC,EACvC,KAA+B;QAE/B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;CACJ;AATD,gDASC"}
|
|
@@ -13,6 +13,6 @@ declare type ProductOptionGroupInputTypes = CreateProductOptionGroupInput | Upda
|
|
|
13
13
|
* @since 1.4
|
|
14
14
|
*/
|
|
15
15
|
export declare class ProductOptionGroupEvent extends VendureEntityEvent<ProductOptionGroup, ProductOptionGroupInputTypes> {
|
|
16
|
-
constructor(ctx: RequestContext, entity: ProductOptionGroup, type: 'created' | 'updated', input?: ProductOptionGroupInputTypes);
|
|
16
|
+
constructor(ctx: RequestContext, entity: ProductOptionGroup, type: 'created' | 'updated' | 'deleted', input?: ProductOptionGroupInputTypes);
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-option-group-event.js","sourceRoot":"","sources":["../../../src/event-bus/events/product-option-group-event.ts"],"names":[],"mappings":";;;AAQA,kEAA6D;AAI7D;;;;;;;GAOG;AACH,MAAa,uBAAwB,SAAQ,yCAG5C;IACG,YACI,GAAmB,EACnB,MAA0B,EAC1B,
|
|
1
|
+
{"version":3,"file":"product-option-group-event.js","sourceRoot":"","sources":["../../../src/event-bus/events/product-option-group-event.ts"],"names":[],"mappings":";;;AAQA,kEAA6D;AAI7D;;;;;;;GAOG;AACH,MAAa,uBAAwB,SAAQ,yCAG5C;IACG,YACI,GAAmB,EACnB,MAA0B,EAC1B,IAAuC,EACvC,KAAoC;QAEpC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;CACJ;AAZD,0DAYC"}
|
|
@@ -25,6 +25,7 @@ export * from './events/global-settings-event';
|
|
|
25
25
|
export * from './events/history-entry-event';
|
|
26
26
|
export * from './events/identifier-change-event';
|
|
27
27
|
export * from './events/identifier-change-request-event';
|
|
28
|
+
export * from './events/initializer-event';
|
|
28
29
|
export * from './events/login-event';
|
|
29
30
|
export * from './events/logout-event';
|
|
30
31
|
export * from './events/order-event';
|
package/dist/event-bus/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __exportStar(require("./events/global-settings-event"), exports);
|
|
|
37
37
|
__exportStar(require("./events/history-entry-event"), exports);
|
|
38
38
|
__exportStar(require("./events/identifier-change-event"), exports);
|
|
39
39
|
__exportStar(require("./events/identifier-change-request-event"), exports);
|
|
40
|
+
__exportStar(require("./events/initializer-event"), exports);
|
|
40
41
|
__exportStar(require("./events/login-event"), exports);
|
|
41
42
|
__exportStar(require("./events/logout-event"), exports);
|
|
42
43
|
__exportStar(require("./events/order-event"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/event-bus/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B;AAC5B,qDAAmC;AACnC,kDAAgC;AAEhC,sEAAoD;AACpD,kEAAgD;AAChD,+DAA6C;AAC7C,+DAA6C;AAC7C,uDAAqC;AACrC,iEAA+C;AAC/C,gEAA8C;AAC9C,yDAAuC;AACvC,4DAA0C;AAC1C,yEAAuD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AAC5C,wEAAsD;AACtD,gEAA8C;AAC9C,yEAAuD;AACvD,gEAA8C;AAC9C,0EAAwD;AACxD,iEAA+C;AAC/C,yDAAuC;AACvC,gEAA8C;AAC9C,6EAA2D;AAC3D,sEAAoD;AACpD,yEAAuD;AACvD,iEAA+C;AAC/C,2DAAyC;AACzC,yEAAuD;AACvD,6DAA2C;AAC3C,sDAAoC;AACpC,wDAAsC;AACtC,iEAA+C;AAC/C,gEAA8C;AAC9C,8DAA4C;AAC5C,0DAAwC;AACxC,uEAAqD;AACrD,sDAAoC;AACpC,8DAA4C"}
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"products-cannot-be-removed-from-default-channel": "Products cannot be removed from the default Channel",
|
|
41
41
|
"product-id-or-slug-must-be-provided": "Either the Product id or slug must be provided",
|
|
42
42
|
"product-id-slug-mismatch": "The provided id and slug refer to different Products",
|
|
43
|
+
"product-option-group-already-assigned": "The ProductOptionGroup \"{ groupCode }\" is already assigned to the Product \"{ productName }\"",
|
|
43
44
|
"product-variant-option-ids-not-compatible": "ProductVariant optionIds must include one optionId from each of the groups: {groupNames}",
|
|
44
45
|
"product-variant-options-combination-already-exists": "A ProductVariant with the selected options already exists: {variantName}",
|
|
45
46
|
"promotion-channels-can-only-be-changed-from-default-channel": "Promotions channels may only be changed from the Default Channel",
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
"ALREADY_LOGGED_IN_ERROR": "Cannot set a Customer for the Order when already logged in",
|
|
52
53
|
"ALREADY_REFUNDED_ERROR": "Cannot refund an OrderItem which has already been refunded",
|
|
53
54
|
"CANCEL_ACTIVE_ORDER_ERROR": "Cannot cancel OrderLines from an Order in the \"{ orderState }\" state",
|
|
55
|
+
"CANCEL_PAYMENT_ERROR": "Cancelling the payment failed",
|
|
54
56
|
"CHANNEL_DEFAULT_LANGUAGE_ERROR": "Cannot make language \"{ language }\" unavailable as it is used as the defaultLanguage by the channel \"{ channelCode }\"",
|
|
55
57
|
"COUPON_CODE_EXPIRED_ERROR": "Coupon code \"{ couponCode }\" has expired",
|
|
56
58
|
"COUPON_CODE_INVALID_ERROR": "Coupon code \"{ couponCode }\" is not valid",
|
|
@@ -116,6 +118,7 @@
|
|
|
116
118
|
"facet-value-force-deleted": "The selected FacetValue was removed from {products, plural, =0 {} one {1 Product} other {# Products}}{both, select, both { , } single {}}{variants, plural, =0 {} one {1 ProductVariant} other {# ProductVariants}} and deleted",
|
|
117
119
|
"facet-value-used": "The selected FacetValue is assigned to {products, plural, =0 {} one {1 Product} other {# Products}}{both, select, both { , } single {}}{variants, plural, =0 {} one {1 ProductVariant} other {# ProductVariants}}",
|
|
118
120
|
"payment-method-used-in-channels": "The selected PaymentMethod is assigned to the following Channels: { channelCodes }. Set \"force: true\" to delete from all Channels.",
|
|
121
|
+
"product-option-used": "Cannot delete the option \"{code}\" as it is being used by {count, plural, =0 {} one {1 ProductVariant} other {# ProductVariants}}",
|
|
119
122
|
"zone-used-in-channels": "The selected Zone cannot be deleted as it used as a default in the following Channels: { channelCodes }",
|
|
120
123
|
"zone-used-in-tax-rates": "The selected Zone cannot be deleted as it is used in the following TaxRates: { taxRateNames }"
|
|
121
124
|
}
|
package/dist/migrate.js
CHANGED
|
@@ -12,6 +12,7 @@ const typeorm_1 = require("typeorm");
|
|
|
12
12
|
const MysqlDriver_1 = require("typeorm/driver/mysql/MysqlDriver");
|
|
13
13
|
const StringUtils_1 = require("typeorm/util/StringUtils");
|
|
14
14
|
const bootstrap_1 = require("./bootstrap");
|
|
15
|
+
const config_helpers_1 = require("./config/config-helpers");
|
|
15
16
|
/**
|
|
16
17
|
* @description
|
|
17
18
|
* Runs any pending database migrations. See [TypeORM migration docs](https://typeorm.io/#/migrations)
|
|
@@ -34,10 +35,21 @@ async function runMigrations(userConfig) {
|
|
|
34
35
|
process.exitCode = 1;
|
|
35
36
|
}
|
|
36
37
|
finally {
|
|
38
|
+
await checkMigrationStatus(connection);
|
|
37
39
|
await connection.close();
|
|
40
|
+
config_helpers_1.resetConfig();
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
exports.runMigrations = runMigrations;
|
|
44
|
+
async function checkMigrationStatus(connection) {
|
|
45
|
+
const builderLog = await connection.driver.createSchemaBuilder().log();
|
|
46
|
+
if (builderLog.upQueries.length) {
|
|
47
|
+
console.log(chalk_1.default.yellow(`Your database schema does not match your current configuration. Generate a new migration for the following changes:`));
|
|
48
|
+
for (const query of builderLog.upQueries) {
|
|
49
|
+
console.log(' - ' + chalk_1.default.yellow(query.query));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
41
53
|
/**
|
|
42
54
|
* @description
|
|
43
55
|
* Reverts the last applied database migration. See [TypeORM migration docs](https://typeorm.io/#/migrations)
|
|
@@ -58,6 +70,7 @@ async function revertLastMigration(userConfig) {
|
|
|
58
70
|
}
|
|
59
71
|
finally {
|
|
60
72
|
await connection.close();
|
|
73
|
+
config_helpers_1.resetConfig();
|
|
61
74
|
}
|
|
62
75
|
}
|
|
63
76
|
exports.revertLastMigration = revertLastMigration;
|
|
@@ -129,6 +142,7 @@ async function generateMigration(userConfig, options) {
|
|
|
129
142
|
console.log(chalk_1.default.yellow(`No changes in database schema were found - cannot generate a migration.`));
|
|
130
143
|
}
|
|
131
144
|
await connection.close();
|
|
145
|
+
config_helpers_1.resetConfig();
|
|
132
146
|
}
|
|
133
147
|
exports.generateMigration = generateMigration;
|
|
134
148
|
function createConnectionOptions(userConfig) {
|
package/dist/migrate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA+B;AAC/B,kDAA0B;AAC1B,wDAA0B;AAC1B,gDAAwB;AACxB,qCAA0E;AAC1E,kEAA+D;AAC/D,0DAAqD;AAErD,2CAAiD;
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":";;;;;;AAAA,+BA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