@vendure/core 2.2.0-next.0 → 2.2.0-next.2
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/common/graphql-value-transformer.js +4 -0
- package/dist/api/common/graphql-value-transformer.js.map +1 -1
- package/dist/api/common/validate-custom-field-value.d.ts +2 -2
- package/dist/api/common/validate-custom-field-value.js +5 -5
- package/dist/api/common/validate-custom-field-value.js.map +1 -1
- package/dist/api/config/generate-list-options.js +19 -15
- package/dist/api/config/generate-list-options.js.map +1 -1
- package/dist/api/config/get-custom-fields-config-without-interfaces.d.ts +1 -1
- package/dist/api/config/get-custom-fields-config-without-interfaces.js +2 -1
- package/dist/api/config/get-custom-fields-config-without-interfaces.js.map +1 -1
- package/dist/api/config/graphql-custom-fields.js +14 -0
- package/dist/api/config/graphql-custom-fields.js.map +1 -1
- package/dist/api/middleware/exception-logger.filter.d.ts +5 -2
- package/dist/api/middleware/exception-logger.filter.js +21 -2
- package/dist/api/middleware/exception-logger.filter.js.map +1 -1
- package/dist/api/middleware/id-codec-plugin.js +2 -0
- package/dist/api/middleware/id-codec-plugin.js.map +1 -1
- package/dist/api/middleware/validate-custom-fields-interceptor.js +7 -7
- package/dist/api/middleware/validate-custom-fields-interceptor.js.map +1 -1
- package/dist/api/resolvers/admin/global-settings.resolver.d.ts +1 -0
- package/dist/api/resolvers/admin/global-settings.resolver.js +29 -3
- package/dist/api/resolvers/admin/global-settings.resolver.js.map +1 -1
- package/dist/api/resolvers/admin/order.resolver.d.ts +2 -1
- package/dist/api/resolvers/admin/order.resolver.js +13 -0
- package/dist/api/resolvers/admin/order.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/administrator-entity.resolver.d.ts +3 -3
- package/dist/api/resolvers/entity/administrator-entity.resolver.js +9 -9
- package/dist/api/resolvers/entity/administrator-entity.resolver.js.map +1 -1
- package/dist/api/resolvers/entity/product-variant-entity.resolver.js +2 -1
- package/dist/api/resolvers/entity/product-variant-entity.resolver.js.map +1 -1
- package/dist/api/schema/admin-api/global-settings.type.graphql +1 -0
- package/dist/api/schema/admin-api/order.api.graphql +41 -0
- package/dist/api/schema/admin-api/product-admin.type.graphql +0 -1
- package/dist/api/schema/admin-api/product.api.graphql +1 -0
- package/dist/api/schema/common/history-entry.type.graphql +1 -0
- package/dist/api/schema/common/product.type.graphql +1 -0
- package/dist/bootstrap.d.ts +65 -3
- package/dist/bootstrap.js +33 -10
- package/dist/bootstrap.js.map +1 -1
- package/dist/common/error/generated-graphql-admin-errors.d.ts +9 -0
- package/dist/common/error/generated-graphql-admin-errors.js +12 -2
- package/dist/common/error/generated-graphql-admin-errors.js.map +1 -1
- package/dist/common/types/common-types.d.ts +3 -0
- package/dist/config/config.module.js +2 -1
- package/dist/config/config.module.js.map +1 -1
- package/dist/config/custom-field/custom-field-types.d.ts +7 -3
- package/dist/config/default-config.js +2 -0
- package/dist/config/default-config.js.map +1 -1
- package/dist/config/entity/bigint-money-strategy.d.ts +1 -0
- package/dist/config/entity/bigint-money-strategy.js +1 -0
- package/dist/config/entity/bigint-money-strategy.js.map +1 -1
- package/dist/config/entity/default-money-strategy.d.ts +1 -0
- package/dist/config/entity/default-money-strategy.js +1 -0
- package/dist/config/entity/default-money-strategy.js.map +1 -1
- package/dist/config/entity/money-strategy.d.ts +35 -4
- 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/system/error-handler-strategy.d.ts +75 -0
- package/dist/config/system/error-handler-strategy.js +3 -0
- package/dist/config/system/error-handler-strategy.js.map +1 -0
- package/dist/config/vendure-config.d.ts +10 -0
- package/dist/entity/custom-entity-fields.d.ts +2 -0
- package/dist/entity/custom-entity-fields.js +4 -1
- package/dist/entity/custom-entity-fields.js.map +1 -1
- package/dist/entity/product-variant/product-variant-price.entity.d.ts +4 -1
- package/dist/entity/product-variant/product-variant-price.entity.js +5 -0
- package/dist/entity/product-variant/product-variant-price.entity.js.map +1 -1
- package/dist/entity/refund/refund.entity.d.ts +12 -0
- package/dist/entity/refund/refund.entity.js.map +1 -1
- package/dist/entity/register-custom-entity-fields.js +43 -55
- package/dist/entity/register-custom-entity-fields.js.map +1 -1
- package/dist/health-check/health-check-registry.service.d.ts +2 -2
- package/dist/health-check/health-check-registry.service.js +2 -2
- package/dist/health-check/health-check.module.js +2 -1
- package/dist/health-check/health-check.module.js.map +1 -1
- package/dist/health-check/http-health-check-strategy.d.ts +17 -2
- package/dist/health-check/http-health-check-strategy.js +57 -5
- package/dist/health-check/http-health-check-strategy.js.map +1 -1
- package/dist/i18n/messages/de.json +3 -3
- package/dist/i18n/messages/en.json +2 -0
- package/dist/job-queue/in-memory-job-queue-strategy.js +3 -0
- package/dist/job-queue/in-memory-job-queue-strategy.js.map +1 -1
- package/dist/job-queue/job-queue.service.d.ts +5 -0
- package/dist/job-queue/job-queue.service.js +22 -0
- package/dist/job-queue/job-queue.service.js.map +1 -1
- package/dist/job-queue/polling-job-queue-strategy.d.ts +34 -1
- package/dist/job-queue/polling-job-queue-strategy.js +54 -24
- package/dist/job-queue/polling-job-queue-strategy.js.map +1 -1
- package/dist/plugin/default-job-queue-plugin/default-job-queue-plugin.d.ts +12 -0
- package/dist/plugin/default-job-queue-plugin/default-job-queue-plugin.js +2 -1
- package/dist/plugin/default-job-queue-plugin/default-job-queue-plugin.js.map +1 -1
- package/dist/plugin/default-search-plugin/indexer/indexer.controller.d.ts +4 -3
- package/dist/plugin/default-search-plugin/indexer/indexer.controller.js +12 -3
- package/dist/plugin/default-search-plugin/indexer/indexer.controller.js.map +1 -1
- package/dist/plugin/default-search-plugin/indexer/search-index.service.js +2 -2
- 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.js +7 -6
- 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 -7
- package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js +9 -7
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js.map +1 -1
- package/dist/service/helpers/list-query-builder/list-query-builder.d.ts +14 -1
- package/dist/service/helpers/list-query-builder/list-query-builder.js +73 -31
- package/dist/service/helpers/list-query-builder/list-query-builder.js.map +1 -1
- package/dist/service/helpers/list-query-builder/parse-filter-params.d.ts +12 -3
- package/dist/service/helpers/list-query-builder/parse-filter-params.js +44 -28
- package/dist/service/helpers/list-query-builder/parse-filter-params.js.map +1 -1
- package/dist/service/helpers/order-calculator/order-calculator.js +5 -0
- package/dist/service/helpers/order-calculator/order-calculator.js.map +1 -1
- package/dist/service/helpers/order-modifier/order-modifier.d.ts +9 -4
- package/dist/service/helpers/order-modifier/order-modifier.js +118 -34
- package/dist/service/helpers/order-modifier/order-modifier.js.map +1 -1
- package/dist/service/helpers/translatable-saver/translatable-saver.js +1 -0
- package/dist/service/helpers/translatable-saver/translatable-saver.js.map +1 -1
- package/dist/service/services/administrator.service.js +4 -4
- package/dist/service/services/administrator.service.js.map +1 -1
- package/dist/service/services/collection.service.js +3 -0
- package/dist/service/services/collection.service.js.map +1 -1
- package/dist/service/services/customer.service.js +1 -2
- package/dist/service/services/customer.service.js.map +1 -1
- package/dist/service/services/history.service.d.ts +7 -0
- package/dist/service/services/history.service.js.map +1 -1
- package/dist/service/services/order.service.d.ts +12 -8
- package/dist/service/services/order.service.js +63 -67
- package/dist/service/services/order.service.js.map +1 -1
- package/dist/service/services/payment.service.d.ts +8 -2
- package/dist/service/services/payment.service.js +54 -25
- package/dist/service/services/payment.service.js.map +1 -1
- package/dist/service/services/product-variant.service.js +10 -5
- package/dist/service/services/product-variant.service.js.map +1 -1
- package/dist/service/services/product.service.js +6 -2
- package/dist/service/services/product.service.js.map +1 -1
- package/dist/service/services/role.service.d.ts +1 -0
- package/dist/service/services/role.service.js +28 -5
- package/dist/service/services/role.service.js.map +1 -1
- package/package.json +4 -3
|
@@ -5,7 +5,6 @@ const shared_utils_1 = require("@vendure/common/lib/shared-utils");
|
|
|
5
5
|
const typeorm_1 = require("typeorm");
|
|
6
6
|
const DateUtils_1 = require("typeorm/util/DateUtils");
|
|
7
7
|
const vendure_logger_1 = require("../config/logger/vendure-logger");
|
|
8
|
-
const custom_entity_fields_1 = require("./custom-entity-fields");
|
|
9
8
|
/**
|
|
10
9
|
* The maximum length of the "length" argument of a MySQL varchar column.
|
|
11
10
|
*/
|
|
@@ -197,60 +196,49 @@ function assertLocaleFieldsNotSpecified(config, entityName) {
|
|
|
197
196
|
* stage of the app lifecycle, before the AppModule is initialized.
|
|
198
197
|
*/
|
|
199
198
|
function registerCustomEntityFields(config) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
assertLocaleFieldsNotSpecified(config, 'GlobalSettings');
|
|
244
|
-
registerCustomFieldsForEntity(config, 'Region', custom_entity_fields_1.CustomRegionFields);
|
|
245
|
-
registerCustomFieldsForEntity(config, 'Region', custom_entity_fields_1.CustomRegionFieldsTranslation, true);
|
|
246
|
-
registerCustomFieldsForEntity(config, 'Seller', custom_entity_fields_1.CustomSellerFields);
|
|
247
|
-
assertLocaleFieldsNotSpecified(config, 'Seller');
|
|
248
|
-
registerCustomFieldsForEntity(config, 'ShippingMethod', custom_entity_fields_1.CustomShippingMethodFields);
|
|
249
|
-
registerCustomFieldsForEntity(config, 'ShippingMethod', custom_entity_fields_1.CustomShippingMethodFieldsTranslation, true);
|
|
250
|
-
registerCustomFieldsForEntity(config, 'StockLocation', custom_entity_fields_1.CustomStockLocationFields);
|
|
251
|
-
assertLocaleFieldsNotSpecified(config, 'StockLocation');
|
|
252
|
-
registerCustomFieldsForEntity(config, 'Zone', custom_entity_fields_1.CustomZoneFields);
|
|
253
|
-
assertLocaleFieldsNotSpecified(config, 'Zone');
|
|
199
|
+
var _a;
|
|
200
|
+
// In order to determine the classes used for the custom field embedded types, we need
|
|
201
|
+
// to introspect the metadata args storage.
|
|
202
|
+
const metadataArgsStorage = (0, typeorm_1.getMetadataArgsStorage)();
|
|
203
|
+
for (const [entityName, customFieldsConfig] of Object.entries((_a = config.customFields) !== null && _a !== void 0 ? _a : {})) {
|
|
204
|
+
if (customFieldsConfig && customFieldsConfig.length) {
|
|
205
|
+
const customFieldsMetadata = getCustomFieldsMetadata(entityName);
|
|
206
|
+
const customFieldsClass = customFieldsMetadata.type();
|
|
207
|
+
if (customFieldsClass && typeof customFieldsClass !== 'string') {
|
|
208
|
+
registerCustomFieldsForEntity(config, entityName, customFieldsClass);
|
|
209
|
+
}
|
|
210
|
+
const translationsMetadata = metadataArgsStorage
|
|
211
|
+
.filterRelations(customFieldsMetadata.target)
|
|
212
|
+
.find(m => m.propertyName === 'translations');
|
|
213
|
+
if (translationsMetadata) {
|
|
214
|
+
// This entity is translatable, which means that we should
|
|
215
|
+
// also register any localized custom fields on the related
|
|
216
|
+
// EntityTranslation entity.
|
|
217
|
+
const translationType = translationsMetadata.type();
|
|
218
|
+
const customFieldsTranslationsMetadata = getCustomFieldsMetadata(translationType);
|
|
219
|
+
const customFieldsTranslationClass = customFieldsTranslationsMetadata.type();
|
|
220
|
+
if (customFieldsTranslationClass && typeof customFieldsTranslationClass !== 'string') {
|
|
221
|
+
registerCustomFieldsForEntity(config, entityName, customFieldsTranslationClass, true);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
assertLocaleFieldsNotSpecified(config, entityName);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function getCustomFieldsMetadata(entity) {
|
|
230
|
+
const entityName = typeof entity === 'string' ? entity : entity.name;
|
|
231
|
+
const metadataArgs = metadataArgsStorage.embeddeds.find(item => {
|
|
232
|
+
if (item.propertyName === 'customFields') {
|
|
233
|
+
const targetName = typeof item.target === 'string' ? item.target : item.target.name;
|
|
234
|
+
return targetName === entityName;
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
if (!metadataArgs) {
|
|
238
|
+
throw new Error(`Could not find embedded CustomFields property on entity "${entityName}"`);
|
|
239
|
+
}
|
|
240
|
+
return metadataArgs;
|
|
241
|
+
}
|
|
254
242
|
}
|
|
255
243
|
exports.registerCustomEntityFields = registerCustomEntityFields;
|
|
256
244
|
//# sourceMappingURL=register-custom-entity-fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-custom-entity-fields.js","sourceRoot":"","sources":["../../src/entity/register-custom-entity-fields.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"register-custom-entity-fields.js","sourceRoot":"","sources":["../../src/entity/register-custom-entity-fields.ts"],"names":[],"mappings":";;;AAEA,mEAA+D;AAC/D,qCAWiB;AAEjB,sDAAmD;AAGnD,oEAAyD;AAGzD;;GAEG;AACH,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC;;GAEG;AACH,SAAS,6BAA6B,CAClC,MAAqB,EACrB,UAA8B;AAC9B,mEAAmE;AACnE,IAAqB,EACrB,WAAW,GAAG,KAAK;IAEnB,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,M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C,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;gBACpF,OAAO,UAAU,KAAK,UAAU,CAAC;aACpC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,4DAA4D,UAAU,GAAG,CAAC,CAAC;SAC9F;QACD,OAAO,YAAY,CAAC;IACxB,CAAC;AACL,CAAC;AAlDD,gEAkDC"}
|
|
@@ -14,8 +14,8 @@ import { HealthIndicatorFunction } from '@nestjs/terminus';
|
|
|
14
14
|
* service to add a check for that dependency to the Vendure health check.
|
|
15
15
|
*
|
|
16
16
|
*
|
|
17
|
-
* Since v1.6.0, the preferred way to implement a custom health check is by creating a new
|
|
18
|
-
*
|
|
17
|
+
* Since v1.6.0, the preferred way to implement a custom health check is by creating a new {@link HealthCheckStrategy}
|
|
18
|
+
* and then passing it to the `systemOptions.healthChecks` array.
|
|
19
19
|
* See the {@link HealthCheckStrategy} docs for an example configuration.
|
|
20
20
|
*
|
|
21
21
|
* The alternative way to register a health check is by injecting this service directly into your
|
|
@@ -16,8 +16,8 @@ exports.HealthCheckRegistryService = void 0;
|
|
|
16
16
|
* service to add a check for that dependency to the Vendure health check.
|
|
17
17
|
*
|
|
18
18
|
*
|
|
19
|
-
* Since v1.6.0, the preferred way to implement a custom health check is by creating a new
|
|
20
|
-
*
|
|
19
|
+
* Since v1.6.0, the preferred way to implement a custom health check is by creating a new {@link HealthCheckStrategy}
|
|
20
|
+
* and then passing it to the `systemOptions.healthChecks` array.
|
|
21
21
|
* See the {@link HealthCheckStrategy} docs for an example configuration.
|
|
22
22
|
*
|
|
23
23
|
* The alternative way to register a health check is by injecting this service directly into your
|
|
@@ -17,6 +17,7 @@ const config_service_1 = require("../config/config.service");
|
|
|
17
17
|
const job_queue_module_1 = require("../job-queue/job-queue.module");
|
|
18
18
|
const health_check_registry_service_1 = require("./health-check-registry.service");
|
|
19
19
|
const health_check_controller_1 = require("./health-check.controller");
|
|
20
|
+
const http_health_check_strategy_1 = require("./http-health-check-strategy");
|
|
20
21
|
let HealthCheckModule = class HealthCheckModule {
|
|
21
22
|
constructor(configService, healthCheckRegistryService) {
|
|
22
23
|
this.configService = configService;
|
|
@@ -31,7 +32,7 @@ HealthCheckModule = __decorate([
|
|
|
31
32
|
(0, common_1.Module)({
|
|
32
33
|
imports: [terminus_1.TerminusModule, config_module_1.ConfigModule, job_queue_module_1.JobQueueModule],
|
|
33
34
|
controllers: [health_check_controller_1.HealthController],
|
|
34
|
-
providers: [health_check_registry_service_1.HealthCheckRegistryService],
|
|
35
|
+
providers: [health_check_registry_service_1.HealthCheckRegistryService, http_health_check_strategy_1.CustomHttpHealthIndicator],
|
|
35
36
|
exports: [health_check_registry_service_1.HealthCheckRegistryService],
|
|
36
37
|
}),
|
|
37
38
|
__metadata("design:paramtypes", [config_service_1.ConfigService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health-check.module.js","sourceRoot":"","sources":["../../src/health-check/health-check.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,+CAAkD;AAElD,2DAAuD;AACvD,6DAAyD;AAEzD,oEAA+D;AAE/D,mFAA6E;AAC7E,uEAA6D;
|
|
1
|
+
{"version":3,"file":"health-check.module.js","sourceRoot":"","sources":["../../src/health-check/health-check.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,+CAAkD;AAElD,2DAAuD;AACvD,6DAAyD;AAEzD,oEAA+D;AAE/D,mFAA6E;AAC7E,uEAA6D;AAC7D,6EAAyE;AAQlE,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC1B,YACY,aAA4B,EAC5B,0BAAsD;QADtD,kBAAa,GAAb,aAAa,CAAe;QAC5B,+BAA0B,GAA1B,0BAA0B,CAA4B;QAE9D,wCAAwC;QACxC,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,YAAY,EAAE;YAClE,IAAI,CAAC,0BAA0B,CAAC,yBAAyB,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC;SAC5F;IACL,CAAC;CACJ,CAAA;AAVY,iBAAiB;IAN7B,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE,CAAC,yBAAc,EAAE,4BAAY,EAAE,iCAAc,CAAC;QACvD,WAAW,EAAE,CAAC,0CAAgB,CAAC;QAC/B,SAAS,EAAE,CAAC,0DAA0B,EAAE,sDAAyB,CAAC;QAClE,OAAO,EAAE,CAAC,0DAA0B,CAAC;KACxC,CAAC;qCAG6B,8BAAa;QACA,0DAA0B;GAHzD,iBAAiB,CAU7B;AAVY,8CAAiB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { HealthIndicatorFunction } from '@nestjs/terminus';
|
|
1
|
+
import { HealthIndicatorFunction, HealthIndicatorResult } from '@nestjs/terminus';
|
|
2
|
+
import { HealthIndicator } from '@nestjs/terminus/dist/health-indicator/index';
|
|
2
3
|
import { Injector } from '../common/index';
|
|
3
4
|
import { HealthCheckStrategy } from '../config/system/health-check-strategy';
|
|
4
5
|
export interface HttpHealthCheckOptions {
|
|
@@ -31,6 +32,20 @@ export interface HttpHealthCheckOptions {
|
|
|
31
32
|
export declare class HttpHealthCheckStrategy implements HealthCheckStrategy {
|
|
32
33
|
private options;
|
|
33
34
|
constructor(options: HttpHealthCheckOptions);
|
|
34
|
-
|
|
35
|
+
private injector;
|
|
36
|
+
init(injector: Injector): void;
|
|
35
37
|
getHealthIndicator(): HealthIndicatorFunction;
|
|
36
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* A much simplified version of the Terminus Modules' `HttpHealthIndicator` which has no
|
|
41
|
+
* dependency on the @nestjs/axios package.
|
|
42
|
+
*/
|
|
43
|
+
export declare class CustomHttpHealthIndicator extends HealthIndicator {
|
|
44
|
+
/**
|
|
45
|
+
* Prepares and throw a HealthCheckError
|
|
46
|
+
*
|
|
47
|
+
* @throws {HealthCheckError}
|
|
48
|
+
*/
|
|
49
|
+
private generateHttpError;
|
|
50
|
+
pingCheck(key: string, url: string, timeout?: number): Promise<HealthIndicatorResult>;
|
|
51
|
+
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpHealthCheckStrategy = void 0;
|
|
12
|
+
exports.CustomHttpHealthIndicator = exports.HttpHealthCheckStrategy = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
4
14
|
const terminus_1 = require("@nestjs/terminus");
|
|
5
|
-
|
|
15
|
+
const index_1 = require("@nestjs/terminus/dist/health-indicator/index");
|
|
16
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
6
17
|
/**
|
|
7
18
|
* @description
|
|
8
19
|
* A {@link HealthCheckStrategy} used to check health by pinging a url. Internally it uses
|
|
@@ -29,13 +40,54 @@ class HttpHealthCheckStrategy {
|
|
|
29
40
|
constructor(options) {
|
|
30
41
|
this.options = options;
|
|
31
42
|
}
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
init(injector) {
|
|
44
|
+
this.injector = injector;
|
|
34
45
|
}
|
|
35
46
|
getHealthIndicator() {
|
|
36
47
|
const { key, url, timeout } = this.options;
|
|
37
|
-
return () =>
|
|
48
|
+
return async () => {
|
|
49
|
+
const indicator = await this.injector.resolve(CustomHttpHealthIndicator);
|
|
50
|
+
return indicator.pingCheck(key, url, timeout);
|
|
51
|
+
};
|
|
38
52
|
}
|
|
39
53
|
}
|
|
40
54
|
exports.HttpHealthCheckStrategy = HttpHealthCheckStrategy;
|
|
55
|
+
/**
|
|
56
|
+
* A much simplified version of the Terminus Modules' `HttpHealthIndicator` which has no
|
|
57
|
+
* dependency on the @nestjs/axios package.
|
|
58
|
+
*/
|
|
59
|
+
let CustomHttpHealthIndicator = class CustomHttpHealthIndicator extends index_1.HealthIndicator {
|
|
60
|
+
/**
|
|
61
|
+
* Prepares and throw a HealthCheckError
|
|
62
|
+
*
|
|
63
|
+
* @throws {HealthCheckError}
|
|
64
|
+
*/
|
|
65
|
+
generateHttpError(key, error) {
|
|
66
|
+
const response = {
|
|
67
|
+
message: error.message,
|
|
68
|
+
};
|
|
69
|
+
if (error.response) {
|
|
70
|
+
response.statusCode = error.response.status;
|
|
71
|
+
response.statusText = error.response.statusText;
|
|
72
|
+
}
|
|
73
|
+
throw new terminus_1.HealthCheckError(error.message, this.getStatus(key, false, response));
|
|
74
|
+
}
|
|
75
|
+
async pingCheck(key, url, timeout) {
|
|
76
|
+
let isHealthy = false;
|
|
77
|
+
try {
|
|
78
|
+
await (0, node_fetch_1.default)(url, { timeout });
|
|
79
|
+
isHealthy = true;
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
this.generateHttpError(key, err);
|
|
83
|
+
}
|
|
84
|
+
return this.getStatus(key, isHealthy);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
CustomHttpHealthIndicator = __decorate([
|
|
88
|
+
(0, common_1.Injectable)({
|
|
89
|
+
scope: common_1.Scope.TRANSIENT,
|
|
90
|
+
})
|
|
91
|
+
], CustomHttpHealthIndicator);
|
|
92
|
+
exports.CustomHttpHealthIndicator = CustomHttpHealthIndicator;
|
|
41
93
|
//# sourceMappingURL=http-health-check-strategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-health-check-strategy.js","sourceRoot":"","sources":["../../src/health-check/http-health-check-strategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-health-check-strategy.js","sourceRoot":"","sources":["../../src/health-check/http-health-check-strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmD;AACnD,+CAAoG;AACpG,wEAA+E;AAC/E,4DAA+B;AAW/B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,uBAAuB;IAChC,YAAoB,OAA+B;QAA/B,YAAO,GAAP,OAAO,CAAwB;IAAG,CAAC;IAGvD,IAAI,CAAC,QAAkB;QACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,kBAAkB;QACd,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3C,OAAO,KAAK,IAAI,EAAE;YACd,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;YACzE,OAAO,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC;IACN,CAAC;CACJ;AAfD,0DAeC;AAED;;;GAGG;AAII,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,uBAAe;IAC1D;;;;OAIG;IACK,iBAAiB,CAAC,GAAW,EAAE,KAAU;QAC7C,MAAM,QAAQ,GAA2B;YACrC,OAAO,EAAE,KAAK,CAAC,OAAO;SACzB,CAAC;QACF,IAAI,KAAK,CAAC,QAAQ,EAAE;YAChB,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC5C,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC;SACnD;QACD,MAAM,IAAI,2BAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IACpF,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAW,EAAE,GAAW,EAAE,OAAgB;QACtD,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,IAAI;YACA,MAAM,IAAA,oBAAK,EAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9B,SAAS,GAAG,IAAI,CAAC;SACpB;QAAC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;SACpC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC1C,CAAC;CACJ,CAAA;AA7BY,yBAAyB;IAHrC,IAAA,mBAAU,EAAC;QACR,KAAK,EAAE,cAAK,CAAC,SAAS;KACzB,CAAC;GACW,yBAAyB,CA6BrC;AA7BY,8DAAyB"}
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"ORDER_LIMIT_ERROR": "Der Artikel konnte nicht hinzugefügt werden. Eine Bestellung kann maximal { maxItems } Artikel enthalten",
|
|
74
74
|
"ORDER_MODIFICATION_ERROR": "Der Inhalt der Bestellung kann nur im Status \"AddingItems\" geändert werden",
|
|
75
75
|
"ORDER_PAYMENT_STATE_ERROR": "Eine Zahlung kann nur im Status \"ArrangingPayment\" hinzugefügt werden",
|
|
76
|
-
"ORDER_STATE_TRANSITION_ERROR": "Der Status der Bestellung
|
|
76
|
+
"ORDER_STATE_TRANSITION_ERROR": "Der Status der Bestellung kann nicht von \"{ fromState }\" zu \"{ toState }\" geändert werden",
|
|
77
77
|
"PASSWORD_ALREADY_SET_ERROR": "Ein Passwort wurde während der Registrierung bereits festgelegt",
|
|
78
|
-
"PASSWORD_RESET_TOKEN_EXPIRED_ERROR": "Das Token zum
|
|
79
|
-
"PASSWORD_RESET_TOKEN_INVALID_ERROR": "Das Token zum
|
|
78
|
+
"PASSWORD_RESET_TOKEN_EXPIRED_ERROR": "Das Token zum Zurücksetzen des Passwortes ist leider abgelaufen",
|
|
79
|
+
"PASSWORD_RESET_TOKEN_INVALID_ERROR": "Das Token zum Zurücksetzen des Passwortes ist leider falsch",
|
|
80
80
|
"PAYMENT_DECLINED_ERROR": "Die Zahlung wurde abgelehnt",
|
|
81
81
|
"PAYMENT_FAILED_ERROR": "Zahlung fehlgeschlagen",
|
|
82
82
|
"PAYMENT_ORDER_MISMATCH_ERROR": "Die Zahlung und OrderLines gehören nicht zueinander",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"promotion-channels-can-only-be-changed-from-default-channel": "Promotions channels may only be changed from the Default Channel",
|
|
51
51
|
"stockonhand-cannot-be-negative": "stockOnHand cannot be a negative value",
|
|
52
52
|
"superadmin-must-have-superadmin-role": "Cannot remove the SuperAdmin role from the sole SuperAdmin",
|
|
53
|
+
"target-customer-not-assigned-to-order-channels": "The target Customer is not assigned to the same Channels as the Order. Missing channels IDs: { missingChannelIds }",
|
|
53
54
|
"unauthorized": "The credentials did not match. Please check and try again"
|
|
54
55
|
},
|
|
55
56
|
"errorResult": {
|
|
@@ -94,6 +95,7 @@
|
|
|
94
95
|
"PAYMENT_STATE_TRANSITION_ERROR": "Cannot transition Payment from \"{ fromState }\" to \"{ toState }\"",
|
|
95
96
|
"PRODUCT_OPTION_IN_USE_ERROR": "Cannot remove ProductOptionGroup \"{ optionGroupCode }\" as it is used by {productVariantCount, plural, one {1 ProductVariant} other {# ProductVariants}}. Use the `force` argument to remove it anyway",
|
|
96
97
|
"QUANTITY_TOO_GREAT_ERROR": "The specified quantity is greater than the available OrderItems",
|
|
98
|
+
"REFUND_AMOUNT_ERROR": "The amount specified exceeds the refundable amount for this payment",
|
|
97
99
|
"REFUND_ORDER_STATE_ERROR": "Cannot refund an Order in the \"{ orderState }\" state",
|
|
98
100
|
"SETTLE_PAYMENT_ERROR": "Settling the payment failed",
|
|
99
101
|
"VERIFICATION_TOKEN_EXPIRED_ERROR": "Verification token has expired. Use refreshCustomerVerification to send a new token.",
|
|
@@ -155,6 +155,9 @@ class InMemoryJobQueueStrategy extends polling_job_queue_strategy_1.PollingJobQu
|
|
|
155
155
|
applyFilters(items, filters) {
|
|
156
156
|
for (const [prop, operator] of Object.entries(filters)) {
|
|
157
157
|
const key = prop;
|
|
158
|
+
if (Array.isArray(operator)) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
158
161
|
if ((operator === null || operator === void 0 ? void 0 : operator.eq) !== undefined) {
|
|
159
162
|
items = items.filter(i => i[key] === operator.eq);
|
|
160
163
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory-job-queue-strategy.js","sourceRoot":"","sources":["../../src/job-queue/in-memory-job-queue-strategy.ts"],"names":[],"mappings":";;;AAAA,yEAQ6C;AAE7C,mEAAsE;AAItE,oEAAyD;AACzD,wEAAoE;AAGpE,6EAAuE;AAGvE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,wBAAyB,SAAQ,oDAAuB;IAArE;;QACc,SAAI,GAAG,IAAI,GAAG,EAAW,CAAC;QAC1B,kBAAa,GAAkE,EAAE,CAAC;QAEpF,qBAAgB,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU;QAEjD,0BAAqB,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"in-memory-job-queue-strategy.js","sourceRoot":"","sources":["../../src/job-queue/in-memory-job-queue-strategy.ts"],"names":[],"mappings":";;;AAAA,yEAQ6C;AAE7C,mEAAsE;AAItE,oEAAyD;AACzD,wEAAoE;AAGpE,6EAAuE;AAGvE;;;;;;;;;;;;;;;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 @@ export declare class JobQueueService implements OnModuleDestroy {
|
|
|
114
114
|
* registered JobQueue.
|
|
115
115
|
*/
|
|
116
116
|
getJobQueues(): GraphQlJobQueue[];
|
|
117
|
+
/**
|
|
118
|
+
* We wrap the process function in order to catch any errors thrown and pass them to
|
|
119
|
+
* any configured ErrorHandlerStrategies.
|
|
120
|
+
*/
|
|
121
|
+
private createWrappedProcessFn;
|
|
117
122
|
private shouldStartQueue;
|
|
118
123
|
}
|
|
@@ -73,6 +73,8 @@ let JobQueueService = class JobQueueService {
|
|
|
73
73
|
if (this.configService.jobQueueOptions.prefix) {
|
|
74
74
|
options = Object.assign(Object.assign({}, options), { name: `${this.configService.jobQueueOptions.prefix}${options.name}` });
|
|
75
75
|
}
|
|
76
|
+
const wrappedProcessFn = this.createWrappedProcessFn(options.process);
|
|
77
|
+
options = Object.assign(Object.assign({}, options), { process: wrappedProcessFn });
|
|
76
78
|
const queue = new job_queue_1.JobQueue(options, this.jobQueueStrategy, this.jobBufferService);
|
|
77
79
|
if (this.hasStarted && this.shouldStartQueue(queue.name)) {
|
|
78
80
|
await queue.start();
|
|
@@ -158,6 +160,26 @@ let JobQueueService = class JobQueueService {
|
|
|
158
160
|
running: queue.started,
|
|
159
161
|
}));
|
|
160
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* We wrap the process function in order to catch any errors thrown and pass them to
|
|
165
|
+
* any configured ErrorHandlerStrategies.
|
|
166
|
+
*/
|
|
167
|
+
createWrappedProcessFn(processFn) {
|
|
168
|
+
const { errorHandlers } = this.configService.systemOptions;
|
|
169
|
+
return async (job) => {
|
|
170
|
+
try {
|
|
171
|
+
return await processFn(job);
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
for (const handler of errorHandlers) {
|
|
175
|
+
if (e instanceof Error) {
|
|
176
|
+
void handler.handleWorkerError(e, { job });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
throw e;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
161
183
|
shouldStartQueue(queueName) {
|
|
162
184
|
if (this.configService.jobQueueOptions.activeQueues.length > 0) {
|
|
163
185
|
if (!this.configService.jobQueueOptions.activeQueues.includes(queueName)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-queue.service.js","sourceRoot":"","sources":["../../src/job-queue/job-queue.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA6D;AAG7D,sCAAoE;AAEpE,2CAAwC;AAGxC,wEAAmE;AACnE,2CAAuC;AAGvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IAIxB,IAAY,gBAAgB;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,gBAAgB,CAAC;IAC/D,CAAC;IAED,YAAoB,aAA4B,EAAU,gBAAkC;QAAxE,kBAAa,GAAb,aAAa,CAAe;QAAU,qBAAgB,GAAhB,gBAAgB,CAAkB;QAPpF,WAAM,GAAyB,EAAE,CAAC;QAClC,eAAU,GAAG,KAAK,CAAC;IAMoE,CAAC;IAEhG,gBAAgB;IAChB,eAAe;QACX,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CACb,OAAiC;QAEjC,IAAI,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,EAAE;YAC3C,OAAO,mCAAQ,OAAO,KAAE,IAAI,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,GAAE,CAAC;SACjG;QACD,MAAM,KAAK,GAAG,IAAI,oBAAQ,CAAC,OAAO,EAAE,IAAI,C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AC,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;gBACtE,OAAO,KAAK,CAAC;aAChB;SACJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAvJY,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAS0B,sBAAa,EAA4B,qCAAgB;GARnF,eAAe,CAuJ3B;AAvJY,0CAAe"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ID } from '@vendure/common/lib/shared-types';
|
|
2
2
|
import { InjectableJobQueueStrategy } from './injectable-job-queue-strategy';
|
|
3
3
|
import { Job } from './job';
|
|
4
|
+
import { QueueNameProcessStorage } from './queue-name-process-storage';
|
|
4
5
|
import { JobData } from './types';
|
|
5
6
|
/**
|
|
6
7
|
* @description
|
|
@@ -41,6 +42,36 @@ export interface PollingJobQueueStrategyConfig {
|
|
|
41
42
|
* @default () => 1000
|
|
42
43
|
*/
|
|
43
44
|
backoffStrategy?: BackoffStrategy;
|
|
45
|
+
/**
|
|
46
|
+
* @description
|
|
47
|
+
* The timeout in ms which the queue will use when attempting a graceful shutdown.
|
|
48
|
+
* That means, when the server is shut down but a job is running, the job queue will
|
|
49
|
+
* wait for the job to complete before allowing the server to shut down. If the job
|
|
50
|
+
* does not complete within this timeout window, the job will be forced to stop
|
|
51
|
+
* and the server will shut down anyway.
|
|
52
|
+
*
|
|
53
|
+
* @since 2.2.0
|
|
54
|
+
* @default 20_000
|
|
55
|
+
*/
|
|
56
|
+
gracefulShutdownTimeout?: number;
|
|
57
|
+
}
|
|
58
|
+
declare class ActiveQueue<Data extends JobData<Data> = object> {
|
|
59
|
+
private readonly queueName;
|
|
60
|
+
private readonly process;
|
|
61
|
+
private readonly jobQueueStrategy;
|
|
62
|
+
private timer;
|
|
63
|
+
private running;
|
|
64
|
+
private activeJobs;
|
|
65
|
+
private errorNotifier$;
|
|
66
|
+
private queueStopped$;
|
|
67
|
+
private subscription;
|
|
68
|
+
private readonly pollInterval;
|
|
69
|
+
constructor(queueName: string, process: (job: Job<Data>) => Promise<any>, jobQueueStrategy: PollingJobQueueStrategy);
|
|
70
|
+
start(): void;
|
|
71
|
+
stop(stopActiveQueueTimeout?: number): Promise<void>;
|
|
72
|
+
private awaitRunningJobsOrTimeout;
|
|
73
|
+
private onFailOrComplete;
|
|
74
|
+
private removeJobFromActive;
|
|
44
75
|
}
|
|
45
76
|
/**
|
|
46
77
|
* @description
|
|
@@ -57,7 +88,8 @@ export declare abstract class PollingJobQueueStrategy extends InjectableJobQueue
|
|
|
57
88
|
pollInterval: number | ((queueName: string) => number);
|
|
58
89
|
setRetries: (queueName: string, job: Job) => number;
|
|
59
90
|
backOffStrategy?: BackoffStrategy;
|
|
60
|
-
|
|
91
|
+
gracefulShutdownTimeout: number;
|
|
92
|
+
protected activeQueues: QueueNameProcessStorage<ActiveQueue<any>>;
|
|
61
93
|
constructor(config?: PollingJobQueueStrategyConfig);
|
|
62
94
|
constructor(concurrency?: number, pollInterval?: number);
|
|
63
95
|
start<Data extends JobData<Data> = object>(queueName: string, process: (job: Job<Data>) => Promise<any>): Promise<void>;
|
|
@@ -81,3 +113,4 @@ export declare abstract class PollingJobQueueStrategy extends InjectableJobQueue
|
|
|
81
113
|
*/
|
|
82
114
|
abstract findOne(id: ID): Promise<Job | undefined>;
|
|
83
115
|
}
|
|
116
|
+
export {};
|