@vendure/core 2.1.0-next.3 → 2.1.0-next.5
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/request-context.d.ts +1 -1
- package/dist/api/common/request-context.js +1 -1
- package/dist/api/decorators/allow.decorator.d.ts +2 -2
- package/dist/api/decorators/allow.decorator.js +2 -2
- package/dist/api/decorators/api.decorator.d.ts +1 -1
- package/dist/api/decorators/api.decorator.js +1 -1
- package/dist/api/decorators/relations.decorator.d.ts +3 -3
- package/dist/api/decorators/relations.decorator.js +3 -3
- package/dist/api/decorators/request-context.decorator.d.ts +1 -1
- package/dist/api/decorators/request-context.decorator.js +1 -1
- package/dist/api/decorators/transaction.decorator.d.ts +2 -2
- package/dist/api/decorators/transaction.decorator.js +1 -1
- package/dist/api/decorators/transaction.decorator.js.map +1 -1
- package/dist/api/middleware/transaction-interceptor.js.map +1 -1
- package/dist/bootstrap.d.ts +3 -3
- package/dist/bootstrap.js +3 -3
- package/dist/common/configurable-operation.d.ts +5 -5
- package/dist/common/configurable-operation.js +1 -1
- package/dist/common/error/error-result.d.ts +2 -2
- package/dist/common/error/error-result.js.map +1 -1
- package/dist/common/finite-state-machine/types.d.ts +1 -1
- package/dist/common/permission-definition.d.ts +6 -6
- package/dist/common/permission-definition.js +6 -6
- package/dist/common/types/common-types.d.ts +2 -1
- package/dist/common/types/entity-relation-paths.d.ts +1 -1
- package/dist/common/types/injectable-strategy.d.ts +1 -1
- package/dist/common/utils.d.ts +1 -1
- package/dist/common/utils.js +1 -1
- package/dist/config/asset-import-strategy/asset-import-strategy.d.ts +7 -0
- package/dist/config/asset-naming-strategy/asset-naming-strategy.d.ts +7 -0
- package/dist/config/asset-preview-strategy/asset-preview-strategy.d.ts +8 -0
- package/dist/config/asset-storage-strategy/asset-storage-strategy.d.ts +7 -0
- package/dist/config/auth/authentication-strategy.d.ts +9 -2
- package/dist/config/auth/password-hashing-strategy.d.ts +7 -0
- package/dist/config/auth/password-validation-strategy.d.ts +7 -0
- package/dist/config/catalog/collection-filter.d.ts +1 -1
- package/dist/config/catalog/collection-filter.js +1 -1
- package/dist/config/catalog/product-variant-price-calculation-strategy.d.ts +7 -0
- package/dist/config/catalog/product-variant-price-selection-strategy.d.ts +7 -0
- package/dist/config/catalog/stock-display-strategy.d.ts +7 -0
- package/dist/config/catalog/stock-location-strategy.d.ts +7 -0
- package/dist/config/custom-field/custom-field-types.d.ts +1 -66
- package/dist/config/entity/entity-id-strategy.d.ts +9 -2
- package/dist/config/entity/money-strategy.d.ts +10 -3
- package/dist/config/entity/uuid-id-strategy.d.ts +1 -1
- package/dist/config/entity/uuid-id-strategy.js +1 -1
- package/dist/config/entity-metadata/entity-metadata-modifier.d.ts +4 -4
- package/dist/config/fulfillment/fulfillment-handler.d.ts +3 -3
- package/dist/config/fulfillment/fulfillment-handler.js +3 -3
- package/dist/config/job-queue/job-queue-strategy.d.ts +7 -0
- package/dist/config/merge-config.d.ts +1 -1
- package/dist/config/merge-config.js +1 -1
- package/dist/config/order/active-order-strategy.d.ts +2 -2
- package/dist/config/order/changed-price-handling-strategy.d.ts +7 -0
- package/dist/config/order/default-guest-checkout-strategy.d.ts +1 -1
- package/dist/config/order/default-guest-checkout-strategy.js +1 -1
- package/dist/config/order/default-order-process.d.ts +1 -1
- package/dist/config/order/default-order-process.js +1 -1
- package/dist/config/order/guest-checkout-strategy.d.ts +7 -0
- package/dist/config/order/order-by-code-access-strategy.d.ts +8 -1
- package/dist/config/order/order-by-code-access-strategy.js.map +1 -1
- package/dist/config/order/order-code-strategy.d.ts +8 -1
- package/dist/config/order/order-code-strategy.js.map +1 -1
- package/dist/config/order/order-item-price-calculation-strategy.d.ts +8 -1
- package/dist/config/order/order-merge-strategy.d.ts +7 -0
- package/dist/config/order/order-placed-strategy.d.ts +7 -0
- package/dist/config/order/order-process.d.ts +7 -0
- package/dist/config/order/order-seller-strategy.d.ts +7 -0
- package/dist/config/order/stock-allocation-strategy.d.ts +7 -0
- package/dist/config/payment/payment-process.d.ts +7 -0
- package/dist/config/promotion/utils/facet-value-checker.d.ts +1 -1
- package/dist/config/promotion/utils/facet-value-checker.js +1 -1
- package/dist/config/session-cache/session-cache-strategy.d.ts +8 -1
- package/dist/config/shipping-method/shipping-eligibility-checker.d.ts +1 -1
- package/dist/config/shipping-method/shipping-eligibility-checker.js.map +1 -1
- package/dist/config/shipping-method/shipping-line-assignment-strategy.d.ts +34 -0
- package/dist/config/system/health-check-strategy.d.ts +7 -1
- package/dist/config/tax/tax-line-calculation-strategy.d.ts +7 -0
- package/dist/config/tax/tax-zone-strategy.d.ts +7 -0
- package/dist/config/vendure-config.d.ts +4 -4
- package/dist/connection/transactional-connection.d.ts +1 -1
- package/dist/data-import/providers/import-parser/import-parser.d.ts +1 -1
- package/dist/data-import/providers/import-parser/import-parser.js +1 -1
- package/dist/data-import/providers/importer/importer.d.ts +1 -1
- package/dist/data-import/providers/importer/importer.js +1 -1
- package/dist/entity/channel/channel.entity.d.ts +9 -0
- package/dist/entity/channel/channel.entity.js.map +1 -1
- package/dist/entity/entity-id.decorator.d.ts +4 -0
- package/dist/entity/entity-id.decorator.js +4 -0
- package/dist/entity/entity-id.decorator.js.map +1 -1
- package/dist/entity/index.d.ts +2 -0
- package/dist/entity/index.js +2 -0
- package/dist/entity/index.js.map +1 -1
- package/dist/entity/money.decorator.d.ts +1 -0
- package/dist/entity/money.decorator.js +1 -0
- package/dist/entity/money.decorator.js.map +1 -1
- package/dist/event-bus/event-bus.d.ts +1 -1
- package/dist/event-bus/event-bus.js +1 -1
- package/dist/health-check/health-check-registry.service.d.ts +1 -1
- package/dist/health-check/health-check-registry.service.js +1 -1
- package/dist/health-check/http-health-check-strategy.d.ts +1 -1
- package/dist/health-check/http-health-check-strategy.js +1 -1
- package/dist/health-check/typeorm-health-check-strategy.d.ts +1 -1
- package/dist/health-check/typeorm-health-check-strategy.js +1 -1
- package/dist/job-queue/in-memory-job-queue-strategy.d.ts +1 -1
- package/dist/job-queue/in-memory-job-queue-strategy.js +1 -1
- package/dist/job-queue/job-buffer/job-buffer-storage-strategy.d.ts +9 -2
- package/dist/job-queue/job-buffer/job-buffer.d.ts +2 -2
- package/dist/job-queue/job-queue.d.ts +2 -2
- package/dist/job-queue/job-queue.js +2 -2
- package/dist/job-queue/job-queue.service.d.ts +2 -2
- package/dist/job-queue/job-queue.service.js +2 -2
- package/dist/plugin/default-job-queue-plugin/default-job-queue-plugin.d.ts +5 -5
- package/dist/plugin/default-job-queue-plugin/default-job-queue-plugin.js +4 -4
- package/dist/plugin/default-search-plugin/default-search-plugin.d.ts +4 -4
- package/dist/plugin/default-search-plugin/default-search-plugin.js +4 -4
- package/dist/plugin/default-search-plugin/search-strategy/search-strategy.d.ts +7 -0
- package/dist/plugin/default-search-plugin/types.d.ts +2 -2
- package/dist/plugin/vendure-plugin.d.ts +3 -3
- package/dist/plugin/vendure-plugin.js +1 -1
- package/dist/process-context/process-context.d.ts +1 -1
- package/dist/process-context/process-context.js +1 -1
- package/dist/service/helpers/entity-hydrator/entity-hydrator.service.d.ts +3 -3
- package/dist/service/helpers/entity-hydrator/entity-hydrator.service.js +3 -3
- package/dist/service/helpers/list-query-builder/list-query-builder.d.ts +2 -2
- package/dist/service/helpers/list-query-builder/list-query-builder.js +2 -2
- package/dist/service/helpers/product-price-applicator/product-price-applicator.d.ts +1 -1
- package/dist/service/helpers/product-price-applicator/product-price-applicator.js +1 -1
- package/dist/service/helpers/translatable-saver/translatable-saver.d.ts +1 -1
- package/dist/service/helpers/translatable-saver/translatable-saver.js +1 -1
- package/dist/service/helpers/translator/translator.service.d.ts +33 -0
- package/dist/service/helpers/translator/translator.service.js +33 -0
- package/dist/service/helpers/translator/translator.service.js.map +1 -1
- package/dist/service/services/asset.service.d.ts +1 -1
- package/dist/service/services/asset.service.js +1 -1
- package/dist/service/services/history.service.d.ts +6 -6
- package/dist/service/services/history.service.js +6 -6
- package/dist/service/services/order.service.d.ts +1 -2
- package/dist/service/services/order.service.js +1 -2
- package/dist/service/services/order.service.js.map +1 -1
- package/dist/service/services/product.service.js +6 -1
- package/dist/service/services/product.service.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -6
|
@@ -42,12 +42,12 @@ const search_job_buffer_service_1 = require("./search-job-buffer/search-job-buff
|
|
|
42
42
|
*
|
|
43
43
|
* The DefaultSearchPlugin is bundled with the `\@vendure/core` package. If you are not using an alternative search
|
|
44
44
|
* plugin, then make sure this one is used, otherwise you will not be able to search products via the
|
|
45
|
-
* [`search` query](/
|
|
45
|
+
* [`search` query](/reference/graphql-api/shop/queries#search).
|
|
46
46
|
*
|
|
47
|
-
*
|
|
47
|
+
* :::caution
|
|
48
48
|
* Note that the quality of the fulltext search capabilities varies depending on the underlying database being used. For example,
|
|
49
49
|
* the MySQL & Postgres implementations will typically yield better results than the SQLite implementation.
|
|
50
|
-
*
|
|
50
|
+
* :::
|
|
51
51
|
*
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
@@ -65,7 +65,7 @@ const search_job_buffer_service_1 = require("./search-job-buffer/search-job-buff
|
|
|
65
65
|
* };
|
|
66
66
|
* ```
|
|
67
67
|
*
|
|
68
|
-
* @docsCategory
|
|
68
|
+
* @docsCategory DefaultSearchPlugin
|
|
69
69
|
*/
|
|
70
70
|
let DefaultSearchPlugin = DefaultSearchPlugin_1 = class DefaultSearchPlugin {
|
|
71
71
|
/** @internal */
|
|
@@ -5,6 +5,13 @@ import { InjectableStrategy } from '../../../common';
|
|
|
5
5
|
/**
|
|
6
6
|
* This interface defines the contract that any database-specific search implementations
|
|
7
7
|
* should follow.
|
|
8
|
+
*
|
|
9
|
+
* :::info
|
|
10
|
+
*
|
|
11
|
+
* This is configured via the `searchStrategy` property of
|
|
12
|
+
* the {@link DefaultSearchPluginInitOptions}.
|
|
13
|
+
*
|
|
14
|
+
* :::
|
|
8
15
|
*/
|
|
9
16
|
export interface SearchStrategy extends InjectableStrategy {
|
|
10
17
|
getSearchResults(ctx: RequestContext, input: SearchInput, enabledOnly: boolean): Promise<SearchResult[]>;
|
|
@@ -7,7 +7,7 @@ import { SearchStrategy } from './search-strategy/search-strategy';
|
|
|
7
7
|
* @description
|
|
8
8
|
* Options which configure the behaviour of the DefaultSearchPlugin
|
|
9
9
|
*
|
|
10
|
-
* @docsCategory
|
|
10
|
+
* @docsCategory DefaultSearchPlugin
|
|
11
11
|
*/
|
|
12
12
|
export interface DefaultSearchPluginInitOptions {
|
|
13
13
|
/**
|
|
@@ -40,7 +40,7 @@ export interface DefaultSearchPluginInitOptions {
|
|
|
40
40
|
* such as {@link MysqlSearchStrategy}, {@link PostgresSearchStrategy} or {@link SqliteSearchStrategy}.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
|
-
* ```
|
|
43
|
+
* ```ts
|
|
44
44
|
* export class MySearchStrategy implements SearchStrategy {
|
|
45
45
|
* private readonly minTermLength = 2;
|
|
46
46
|
* private connection: TransactionalConnection;
|
|
@@ -47,7 +47,7 @@ export interface VendurePluginMetadata extends ModuleMetadata {
|
|
|
47
47
|
* To effectively disable this check for a plugin, you can use an overly-permissive string such as `>0.0.0`.
|
|
48
48
|
*
|
|
49
49
|
* @example
|
|
50
|
-
* ```
|
|
50
|
+
* ```ts
|
|
51
51
|
* compatibility: '^2.0.0'
|
|
52
52
|
* ```
|
|
53
53
|
*
|
|
@@ -68,7 +68,7 @@ export interface APIExtensionDefinition {
|
|
|
68
68
|
* Extensions to the schema.
|
|
69
69
|
*
|
|
70
70
|
* @example
|
|
71
|
-
* ```
|
|
71
|
+
* ```ts
|
|
72
72
|
* const schema = gql`extend type SearchReindexResponse {
|
|
73
73
|
* timeTaken: Int!
|
|
74
74
|
* indexedItemCount: Int!
|
|
@@ -110,7 +110,7 @@ export type PluginConfigurationFn = (config: RuntimeVendureConfig) => RuntimeVen
|
|
|
110
110
|
* entirely new types. Database entities and resolvers can also be defined to handle the extended GraphQL types.
|
|
111
111
|
*
|
|
112
112
|
* @example
|
|
113
|
-
* ```
|
|
113
|
+
* ```ts
|
|
114
114
|
* import { Controller, Get } from '\@nestjs/common';
|
|
115
115
|
* import { Ctx, PluginCommonModule, ProductService, RequestContext, VendurePlugin } from '\@vendure/core';
|
|
116
116
|
*
|
|
@@ -16,7 +16,7 @@ const plugin_metadata_1 = require("./plugin-metadata");
|
|
|
16
16
|
* entirely new types. Database entities and resolvers can also be defined to handle the extended GraphQL types.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
|
-
* ```
|
|
19
|
+
* ```ts
|
|
20
20
|
* import { Controller, Get } from '\@nestjs/common';
|
|
21
21
|
* import { Ctx, PluginCommonModule, ProductService, RequestContext, VendurePlugin } from '\@vendure/core';
|
|
22
22
|
*
|
|
@@ -5,7 +5,7 @@ type ProcessContextType = 'server' | 'worker';
|
|
|
5
5
|
* is being executed in the context of the main Vendure server or the worker.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* ```
|
|
8
|
+
* ```ts
|
|
9
9
|
* import { Injectable, OnApplicationBootstrap } from '\@nestjs/common';
|
|
10
10
|
* import { ProcessContext } from '\@vendure/core';
|
|
11
11
|
*
|
|
@@ -8,7 +8,7 @@ let currentContext = 'server';
|
|
|
8
8
|
* is being executed in the context of the main Vendure server or the worker.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
|
-
* ```
|
|
11
|
+
* ```ts
|
|
12
12
|
* import { Injectable, OnApplicationBootstrap } from '\@nestjs/common';
|
|
13
13
|
* import { ProcessContext } from '\@vendure/core';
|
|
14
14
|
*
|
|
@@ -11,7 +11,7 @@ import { HydrateOptions } from './entity-hydrator-types';
|
|
|
11
11
|
* and you need to ensure that one or more relations are present.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
|
-
* ```
|
|
14
|
+
* ```ts
|
|
15
15
|
* const product = await this.productVariantService
|
|
16
16
|
* .getProductForVariant(ctx, variantId);
|
|
17
17
|
*
|
|
@@ -30,7 +30,7 @@ import { HydrateOptions } from './entity-hydrator-types';
|
|
|
30
30
|
* Custom field relations may also be hydrated:
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
|
-
* ```
|
|
33
|
+
* ```ts
|
|
34
34
|
* const customer = await this.customerService
|
|
35
35
|
* .findOne(ctx, id);
|
|
36
36
|
*
|
|
@@ -52,7 +52,7 @@ export declare class EntityHydrator {
|
|
|
52
52
|
* mutates the `target` entity.
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
|
-
* ```
|
|
55
|
+
* ```ts
|
|
56
56
|
* await this.entityHydrator.hydrate(ctx, product, {
|
|
57
57
|
* relations: [
|
|
58
58
|
* 'variants.stockMovements'
|
|
@@ -25,7 +25,7 @@ const translator_service_1 = require("../translator/translator.service");
|
|
|
25
25
|
* and you need to ensure that one or more relations are present.
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
|
-
* ```
|
|
28
|
+
* ```ts
|
|
29
29
|
* const product = await this.productVariantService
|
|
30
30
|
* .getProductForVariant(ctx, variantId);
|
|
31
31
|
*
|
|
@@ -44,7 +44,7 @@ const translator_service_1 = require("../translator/translator.service");
|
|
|
44
44
|
* Custom field relations may also be hydrated:
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
|
-
* ```
|
|
47
|
+
* ```ts
|
|
48
48
|
* const customer = await this.customerService
|
|
49
49
|
* .findOne(ctx, id);
|
|
50
50
|
*
|
|
@@ -67,7 +67,7 @@ let EntityHydrator = class EntityHydrator {
|
|
|
67
67
|
* mutates the `target` entity.
|
|
68
68
|
*
|
|
69
69
|
* @example
|
|
70
|
-
* ```
|
|
70
|
+
* ```ts
|
|
71
71
|
* await this.entityHydrator.hydrate(ctx, product, {
|
|
72
72
|
* relations: [
|
|
73
73
|
* 'variants.stockMovements'
|
|
@@ -136,7 +136,7 @@ export type ExtendedListQueryOptions<T extends VendureEntity> = {
|
|
|
136
136
|
*
|
|
137
137
|
* Your resolver function will then look like this:
|
|
138
138
|
*
|
|
139
|
-
* ```
|
|
139
|
+
* ```ts
|
|
140
140
|
* \@Resolver()
|
|
141
141
|
* export class BlogPostResolver
|
|
142
142
|
* constructor(private blogPostService: BlogPostService) {}
|
|
@@ -153,7 +153,7 @@ export type ExtendedListQueryOptions<T extends VendureEntity> = {
|
|
|
153
153
|
*
|
|
154
154
|
* and the corresponding service will use the ListQueryBuilder:
|
|
155
155
|
*
|
|
156
|
-
* ```
|
|
156
|
+
* ```ts
|
|
157
157
|
* \@Injectable()
|
|
158
158
|
* export class BlogPostService {
|
|
159
159
|
* constructor(private listQueryBuilder: ListQueryBuilder) {}
|
|
@@ -58,7 +58,7 @@ const parse_sort_params_1 = require("./parse-sort-params");
|
|
|
58
58
|
*
|
|
59
59
|
* Your resolver function will then look like this:
|
|
60
60
|
*
|
|
61
|
-
* ```
|
|
61
|
+
* ```ts
|
|
62
62
|
* \@Resolver()
|
|
63
63
|
* export class BlogPostResolver
|
|
64
64
|
* constructor(private blogPostService: BlogPostService) {}
|
|
@@ -75,7 +75,7 @@ const parse_sort_params_1 = require("./parse-sort-params");
|
|
|
75
75
|
*
|
|
76
76
|
* and the corresponding service will use the ListQueryBuilder:
|
|
77
77
|
*
|
|
78
|
-
* ```
|
|
78
|
+
* ```ts
|
|
79
79
|
* \@Injectable()
|
|
80
80
|
* export class BlogPostService {
|
|
81
81
|
* constructor(private listQueryBuilder: ListQueryBuilder) {}
|
|
@@ -13,7 +13,7 @@ import { ZoneService } from '../../services/zone.service';
|
|
|
13
13
|
* always be `0` until you use the `applyChannelPriceAndTax()` method:
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
|
-
* ```
|
|
16
|
+
* ```ts
|
|
17
17
|
* export class MyCustomService {
|
|
18
18
|
* constructor(private connection: TransactionalConnection,
|
|
19
19
|
* private productPriceApplicator: ProductPriceApplicator) {}
|
|
@@ -24,7 +24,7 @@ const zone_service_1 = require("../../services/zone.service");
|
|
|
24
24
|
* always be `0` until you use the `applyChannelPriceAndTax()` method:
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
|
-
* ```
|
|
27
|
+
* ```ts
|
|
28
28
|
* export class MyCustomService {
|
|
29
29
|
* constructor(private connection: TransactionalConnection,
|
|
30
30
|
* private productPriceApplicator: ProductPriceApplicator) {}
|
|
@@ -21,7 +21,7 @@ export interface UpdateTranslatableOptions<T extends Translatable> extends Creat
|
|
|
21
21
|
* A helper which contains methods for creating and updating entities which implement the {@link Translatable} interface.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
|
-
* ```
|
|
24
|
+
* ```ts
|
|
25
25
|
* export class MyService {
|
|
26
26
|
* constructor(private translatableSaver: TranslatableSaver) {}
|
|
27
27
|
*
|
|
@@ -20,7 +20,7 @@ const translation_differ_1 = require("./translation-differ");
|
|
|
20
20
|
* A helper which contains methods for creating and updating entities which implement the {@link Translatable} interface.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
|
-
* ```
|
|
23
|
+
* ```ts
|
|
24
24
|
* export class MyService {
|
|
25
25
|
* constructor(private translatableSaver: TranslatableSaver) {}
|
|
26
26
|
*
|
|
@@ -3,6 +3,39 @@ import { Translatable } from '../../../common/types/locale-types';
|
|
|
3
3
|
import { ConfigService } from '../../../config';
|
|
4
4
|
import { VendureEntity } from '../../../entity';
|
|
5
5
|
import { DeepTranslatableRelations } from '../utils/translate-entity';
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* The TranslatorService is used to translate entities into the current language.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { Injectable } from '\@nestjs/common';
|
|
13
|
+
* import { ID, Product, RequestContext, TransactionalConnection, TranslatorService } from '\@vendure/core';
|
|
14
|
+
*
|
|
15
|
+
* \@Injectable()
|
|
16
|
+
* export class ProductService {
|
|
17
|
+
*
|
|
18
|
+
* constructor(private connection: TransactionalConnection,
|
|
19
|
+
* private translator: TranslatorService){}
|
|
20
|
+
*
|
|
21
|
+
* async findOne(ctx: RequestContext, productId: ID): Promise<Product | undefined> {
|
|
22
|
+
* const product = await this.connection.findOneInChannel(ctx, Product, productId, ctx.channelId, {
|
|
23
|
+
* relations: {
|
|
24
|
+
* facetValues: {
|
|
25
|
+
* facet: true,
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* });
|
|
29
|
+
* if (!product) {
|
|
30
|
+
* return;
|
|
31
|
+
* }
|
|
32
|
+
* return this.translator.translate(product, ctx, ['facetValues', ['facetValues', 'facet']]);
|
|
33
|
+
* }
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @docsCategory service-helpers
|
|
38
|
+
*/
|
|
6
39
|
export declare class TranslatorService {
|
|
7
40
|
private configService;
|
|
8
41
|
constructor(configService: ConfigService);
|
|
@@ -13,6 +13,39 @@ exports.TranslatorService = void 0;
|
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const config_1 = require("../../../config");
|
|
15
15
|
const translate_entity_1 = require("../utils/translate-entity");
|
|
16
|
+
/**
|
|
17
|
+
* @description
|
|
18
|
+
* The TranslatorService is used to translate entities into the current language.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { Injectable } from '\@nestjs/common';
|
|
23
|
+
* import { ID, Product, RequestContext, TransactionalConnection, TranslatorService } from '\@vendure/core';
|
|
24
|
+
*
|
|
25
|
+
* \@Injectable()
|
|
26
|
+
* export class ProductService {
|
|
27
|
+
*
|
|
28
|
+
* constructor(private connection: TransactionalConnection,
|
|
29
|
+
* private translator: TranslatorService){}
|
|
30
|
+
*
|
|
31
|
+
* async findOne(ctx: RequestContext, productId: ID): Promise<Product | undefined> {
|
|
32
|
+
* const product = await this.connection.findOneInChannel(ctx, Product, productId, ctx.channelId, {
|
|
33
|
+
* relations: {
|
|
34
|
+
* facetValues: {
|
|
35
|
+
* facet: true,
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* });
|
|
39
|
+
* if (!product) {
|
|
40
|
+
* return;
|
|
41
|
+
* }
|
|
42
|
+
* return this.translator.translate(product, ctx, ['facetValues', ['facetValues', 'facet']]);
|
|
43
|
+
* }
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @docsCategory service-helpers
|
|
48
|
+
*/
|
|
16
49
|
let TranslatorService = class TranslatorService {
|
|
17
50
|
constructor(configService) {
|
|
18
51
|
this.configService = configService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translator.service.js","sourceRoot":"","sources":["../../../../src/service/helpers/translator/translator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAI5C,4CAAgD;AAEhD,gEAAqF;
|
|
1
|
+
{"version":3,"file":"translator.service.js","sourceRoot":"","sources":["../../../../src/service/helpers/translator/translator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAI5C,4CAAgD;AAEhD,gEAAqF;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC1B,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAEpD,SAAS,CACL,YAAe,EACf,GAAmB,EACnB,wBAAsD,EAAE;QAExD,OAAO,IAAA,gCAAa,EAChB,YAAY,EACZ,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,EAC3F,qBAAqB,CACxB,CAAC;IACN,CAAC;CACJ,CAAA;AAdY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAE0B,sBAAa;GADvC,iBAAiB,CAc7B;AAdY,8CAAiB"}
|
|
@@ -79,7 +79,7 @@ export declare class AssetService {
|
|
|
79
79
|
* using the [GraphQL multipart request specification](https://github.com/jaydenseric/graphql-multipart-request-spec),
|
|
80
80
|
* e.g. using the [apollo-upload-client](https://github.com/jaydenseric/apollo-upload-client) npm package.
|
|
81
81
|
*
|
|
82
|
-
* See the [Uploading Files docs](/
|
|
82
|
+
* See the [Uploading Files docs](/guides/developer-guide/uploading-files) for an example of usage.
|
|
83
83
|
*/
|
|
84
84
|
create(ctx: RequestContext, input: CreateAssetInput): Promise<CreateAssetResult>;
|
|
85
85
|
/**
|
|
@@ -217,7 +217,7 @@ let AssetService = class AssetService {
|
|
|
217
217
|
* using the [GraphQL multipart request specification](https://github.com/jaydenseric/graphql-multipart-request-spec),
|
|
218
218
|
* e.g. using the [apollo-upload-client](https://github.com/jaydenseric/apollo-upload-client) npm package.
|
|
219
219
|
*
|
|
220
|
-
* See the [Uploading Files docs](/
|
|
220
|
+
* See the [Uploading Files docs](/guides/developer-guide/uploading-files) for an example of usage.
|
|
221
221
|
*/
|
|
222
222
|
async create(ctx, input) {
|
|
223
223
|
return new Promise(async (resolve, reject) => {
|
|
@@ -138,7 +138,7 @@ export interface UpdateCustomerHistoryEntryArgs<T extends keyof CustomerHistoryE
|
|
|
138
138
|
* First of all we'd extend the GraphQL `HistoryEntryType` enum for our new type as part of a plugin
|
|
139
139
|
*
|
|
140
140
|
* @example
|
|
141
|
-
* ```
|
|
141
|
+
* ```ts
|
|
142
142
|
* import { PluginCommonModule, VendurePlugin } from '\@vendure/core';
|
|
143
143
|
* import { VerificationService } from './verification.service';
|
|
144
144
|
*
|
|
@@ -161,7 +161,7 @@ export interface UpdateCustomerHistoryEntryArgs<T extends keyof CustomerHistoryE
|
|
|
161
161
|
* and [ambient modules](https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules) features.
|
|
162
162
|
*
|
|
163
163
|
* @example
|
|
164
|
-
* ```
|
|
164
|
+
* ```ts
|
|
165
165
|
* // types.ts
|
|
166
166
|
* import { CustomerHistoryEntryData } from '\@vendure/core';
|
|
167
167
|
*
|
|
@@ -185,7 +185,7 @@ export interface UpdateCustomerHistoryEntryArgs<T extends keyof CustomerHistoryE
|
|
|
185
185
|
* Now that we have our types set up, we can use the HistoryService to add a new HistoryEntry in a type-safe manner:
|
|
186
186
|
*
|
|
187
187
|
* @example
|
|
188
|
-
* ```
|
|
188
|
+
* ```ts
|
|
189
189
|
* // verification.service.ts
|
|
190
190
|
* import { Injectable } from '\@nestjs/common';
|
|
191
191
|
* import { RequestContext } from '\@vendure/core';
|
|
@@ -212,10 +212,10 @@ export interface UpdateCustomerHistoryEntryArgs<T extends keyof CustomerHistoryE
|
|
|
212
212
|
* }
|
|
213
213
|
* }
|
|
214
214
|
* ```
|
|
215
|
-
*
|
|
215
|
+
* :::info
|
|
216
216
|
* It is also possible to define a UI component to display custom history entry types. See the
|
|
217
|
-
* [Custom History Timeline Components guide](
|
|
218
|
-
*
|
|
217
|
+
* [Custom History Timeline Components guide](/guides/extending-the-admin-ui/custom-timeline-components/).
|
|
218
|
+
* :::
|
|
219
219
|
*
|
|
220
220
|
* @docsCategory services
|
|
221
221
|
*/
|
|
@@ -37,7 +37,7 @@ const administrator_service_1 = require("./administrator.service");
|
|
|
37
37
|
* First of all we'd extend the GraphQL `HistoryEntryType` enum for our new type as part of a plugin
|
|
38
38
|
*
|
|
39
39
|
* @example
|
|
40
|
-
* ```
|
|
40
|
+
* ```ts
|
|
41
41
|
* import { PluginCommonModule, VendurePlugin } from '\@vendure/core';
|
|
42
42
|
* import { VerificationService } from './verification.service';
|
|
43
43
|
*
|
|
@@ -60,7 +60,7 @@ const administrator_service_1 = require("./administrator.service");
|
|
|
60
60
|
* and [ambient modules](https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules) features.
|
|
61
61
|
*
|
|
62
62
|
* @example
|
|
63
|
-
* ```
|
|
63
|
+
* ```ts
|
|
64
64
|
* // types.ts
|
|
65
65
|
* import { CustomerHistoryEntryData } from '\@vendure/core';
|
|
66
66
|
*
|
|
@@ -84,7 +84,7 @@ const administrator_service_1 = require("./administrator.service");
|
|
|
84
84
|
* Now that we have our types set up, we can use the HistoryService to add a new HistoryEntry in a type-safe manner:
|
|
85
85
|
*
|
|
86
86
|
* @example
|
|
87
|
-
* ```
|
|
87
|
+
* ```ts
|
|
88
88
|
* // verification.service.ts
|
|
89
89
|
* import { Injectable } from '\@nestjs/common';
|
|
90
90
|
* import { RequestContext } from '\@vendure/core';
|
|
@@ -111,10 +111,10 @@ const administrator_service_1 = require("./administrator.service");
|
|
|
111
111
|
* }
|
|
112
112
|
* }
|
|
113
113
|
* ```
|
|
114
|
-
*
|
|
114
|
+
* :::info
|
|
115
115
|
* It is also possible to define a UI component to display custom history entry types. See the
|
|
116
|
-
* [Custom History Timeline Components guide](
|
|
117
|
-
*
|
|
116
|
+
* [Custom History Timeline Components guide](/guides/extending-the-admin-ui/custom-timeline-components/).
|
|
117
|
+
* :::
|
|
118
118
|
*
|
|
119
119
|
* @docsCategory services
|
|
120
120
|
*/
|
|
@@ -177,8 +177,7 @@ export declare class OrderService {
|
|
|
177
177
|
removeCouponCode(ctx: RequestContext, orderId: ID, couponCode: string): Promise<Order>;
|
|
178
178
|
/**
|
|
179
179
|
* @description
|
|
180
|
-
* Returns all {@link Promotion}s associated with an Order.
|
|
181
|
-
* and Order once the order has been placed (see {@link OrderPlacedStrategy}).
|
|
180
|
+
* Returns all {@link Promotion}s associated with an Order.
|
|
182
181
|
*/
|
|
183
182
|
getOrderPromotions(ctx: RequestContext, orderId: ID): Promise<Promotion[]>;
|
|
184
183
|
/**
|
|
@@ -556,8 +556,7 @@ let OrderService = class OrderService {
|
|
|
556
556
|
}
|
|
557
557
|
/**
|
|
558
558
|
* @description
|
|
559
|
-
* Returns all {@link Promotion}s associated with an Order.
|
|
560
|
-
* and Order once the order has been placed (see {@link OrderPlacedStrategy}).
|
|
559
|
+
* Returns all {@link Promotion}s associated with an Order.
|
|
561
560
|
*/
|
|
562
561
|
async getOrderPromotions(ctx, orderId) {
|
|
563
562
|
const order = await this.connection.getEntityOrThrow(ctx, order_entity_1.Order, orderId, {
|