Skip to content

Commit e362475

Browse files
feat(core): Add means to selectively ignore plugin compatibility errors
Closes #2958
1 parent dde738d commit e362475

22 files changed

+303
-56
lines changed

docs/docs/reference/core-plugins/asset-server-plugin/asset-server-options.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ interface AssetServerOptions {
2626
imageTransformStrategy?: ImageTransformStrategy | ImageTransformStrategy[];
2727
namingStrategy?: AssetNamingStrategy;
2828
previewStrategy?: AssetPreviewStrategy;
29-
storageStrategyFactory?: (
30-
options: AssetServerOptions,
29+
storageStrategyFactory?: (
30+
options: AssetServerOptions,
3131
) => AssetStorageStrategy | Promise<AssetStorageStrategy>;
3232
cacheHeader?: CacheConfig | string;
3333
}
@@ -49,12 +49,12 @@ The local directory to which assets will be uploaded when using the <a href='/re
4949

5050
<MemberInfo kind="property" type={`string | ((ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, identifier: string) =&#62; string)`} />
5151

52-
The complete URL prefix of the asset files. For example, "https://demo.vendure.io/assets/". A
53-
function can also be provided to handle more complex cases, such as serving multiple domains
54-
from a single server. In this case, the function should return a string url prefix.
55-
56-
If not provided, the plugin will attempt to guess based off the incoming
57-
request and the configured route. However, in all but the simplest cases,
52+
The complete URL prefix of the asset files. For example, "https://demo.vendure.io/assets/". A
53+
function can also be provided to handle more complex cases, such as serving multiple domains
54+
from a single server. In this case, the function should return a string url prefix.
55+
56+
If not provided, the plugin will attempt to guess based off the incoming
57+
request and the configured route. However, in all but the simplest cases,
5858
this guess may not yield correct results.
5959
### previewMaxWidth
6060

@@ -75,12 +75,12 @@ An array of additional <a href='/reference/core-plugins/asset-server-plugin/imag
7575

7676
<MemberInfo kind="property" type={`<a href='/reference/core-plugins/asset-server-plugin/image-transform-strategy#imagetransformstrategy'>ImageTransformStrategy</a> | <a href='/reference/core-plugins/asset-server-plugin/image-transform-strategy#imagetransformstrategy'>ImageTransformStrategy</a>[]`} default={`[]`} since="3.1.0" />
7777

78-
The strategy or strategies to use to determine the parameters for transforming an image.
79-
This can be used to implement custom image transformation logic, for example to
80-
limit transform parameters to a known set of presets.
81-
82-
If multiple strategies are provided, they will be executed in the order in which they are defined.
83-
If a strategy throws an error, the image transformation will be aborted and the error
78+
The strategy or strategies to use to determine the parameters for transforming an image.
79+
This can be used to implement custom image transformation logic, for example to
80+
limit transform parameters to a known set of presets.
81+
82+
If multiple strategies are provided, they will be executed in the order in which they are defined.
83+
If a strategy throws an error, the image transformation will be aborted and the error
8484
will be logged, with an HTTP 400 response sent to the client.
8585
### namingStrategy
8686

@@ -91,19 +91,19 @@ Defines how asset files and preview images are named before being saved.
9191

9292
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/assets/asset-preview-strategy#assetpreviewstrategy'>AssetPreviewStrategy</a>`} since="1.7.0" />
9393

94-
Defines how previews are generated for a given Asset binary. By default, this uses
94+
Defines how previews are generated for a given Asset binary. By default, this uses
9595
the <a href='/reference/core-plugins/asset-server-plugin/sharp-asset-preview-strategy#sharpassetpreviewstrategy'>SharpAssetPreviewStrategy</a>
9696
### storageStrategyFactory
9797

98-
<MemberInfo kind="property" type={`( options: <a href='/reference/core-plugins/asset-server-plugin/asset-server-options#assetserveroptions'>AssetServerOptions</a>, ) =&#62; <a href='/reference/typescript-api/assets/asset-storage-strategy#assetstoragestrategy'>AssetStorageStrategy</a> | Promise&#60;<a href='/reference/typescript-api/assets/asset-storage-strategy#assetstoragestrategy'>AssetStorageStrategy</a>&#62;`} default={`() =&#62; <a href='/reference/core-plugins/asset-server-plugin/local-asset-storage-strategy#localassetstoragestrategy'>LocalAssetStorageStrategy</a>`} />
98+
<MemberInfo kind="property" type={`( options: <a href='/reference/core-plugins/asset-server-plugin/asset-server-options#assetserveroptions'>AssetServerOptions</a>, ) =&#62; <a href='/reference/typescript-api/assets/asset-storage-strategy#assetstoragestrategy'>AssetStorageStrategy</a> | Promise&#60;<a href='/reference/typescript-api/assets/asset-storage-strategy#assetstoragestrategy'>AssetStorageStrategy</a>&#62;`} default={`() =&#62; <a href='/reference/core-plugins/asset-server-plugin/local-asset-storage-strategy#localassetstoragestrategy'>LocalAssetStorageStrategy</a>`} />
9999

100-
A function which can be used to configure an <a href='/reference/typescript-api/assets/asset-storage-strategy#assetstoragestrategy'>AssetStorageStrategy</a>. This is useful e.g. if you wish to store your assets
100+
A function which can be used to configure an <a href='/reference/typescript-api/assets/asset-storage-strategy#assetstoragestrategy'>AssetStorageStrategy</a>. This is useful e.g. if you wish to store your assets
101101
using a cloud storage provider. By default, the <a href='/reference/core-plugins/asset-server-plugin/local-asset-storage-strategy#localassetstoragestrategy'>LocalAssetStorageStrategy</a> is used.
102102
### cacheHeader
103103

104104
<MemberInfo kind="property" type={`<a href='/reference/core-plugins/asset-server-plugin/cache-config#cacheconfig'>CacheConfig</a> | string`} default={`'public, max-age=15552000'`} since="1.9.3" />
105105

106-
Configures the `Cache-Control` directive for response to control caching in browsers and shared caches (e.g. Proxies, CDNs).
106+
Configures the `Cache-Control` directive for response to control caching in browsers and shared caches (e.g. Proxies, CDNs).
107107
Defaults to publicly cached for 6 months.
108108

109109

docs/docs/reference/core-plugins/asset-server-plugin/s3asset-storage-strategy.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ Using type `any` in order to avoid the need to include `aws-sdk` dependency in g
151151

152152
<GenerationInfo sourceFile="packages/asset-server-plugin/src/config/s3-asset-storage-strategy.ts" sourceLine="119" packageName="@vendure/asset-server-plugin" />
153153

154-
Returns a configured instance of the <a href='/reference/core-plugins/asset-server-plugin/s3asset-storage-strategy#s3assetstoragestrategy'>S3AssetStorageStrategy</a> which can then be passed to the <a href='/reference/core-plugins/asset-server-plugin/asset-server-options#assetserveroptions'>AssetServerOptions</a>`storageStrategyFactory` property.
154+
Returns a configured instance of the <a href='/reference/core-plugins/asset-server-plugin/s3asset-storage-strategy#s3assetstoragestrategy'>S3AssetStorageStrategy</a> which can then be passed to the <a href='/reference/core-plugins/asset-server-plugin/asset-server-options#assetserveroptions'>AssetServerOptions</a>
155+
`storageStrategyFactory` property.
155156

156157
Before using this strategy, make sure you have the `@aws-sdk/client-s3` and `@aws-sdk/lib-storage` package installed:
157158

docs/docs/reference/graphql-api/admin/object-types.md

+36
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
134134

135135
<div class="graphql-code-line ">orderLine: <a href="/reference/graphql-api/admin/object-types#orderline">OrderLine</a>!</div>
136136

137+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
138+
137139

138140
<div class="graphql-code-line top-level">&#125;</div>
139141
</div>
@@ -356,6 +358,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
356358

357359
<div class="graphql-code-line ">orderLine: <a href="/reference/graphql-api/admin/object-types#orderline">OrderLine</a>!</div>
358360

361+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
362+
359363

360364
<div class="graphql-code-line top-level">&#125;</div>
361365
</div>
@@ -847,10 +851,14 @@ import MemberDescription from '@site/src/components/MemberDescription';
847851

848852
<div class="graphql-code-line ">GlobalSettings: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
849853

854+
<div class="graphql-code-line ">HistoryEntry: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
855+
850856
<div class="graphql-code-line ">Order: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
851857

852858
<div class="graphql-code-line ">OrderLine: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
853859

860+
<div class="graphql-code-line ">Payment: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
861+
854862
<div class="graphql-code-line ">PaymentMethod: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
855863

856864
<div class="graphql-code-line ">Product: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
@@ -865,14 +873,24 @@ import MemberDescription from '@site/src/components/MemberDescription';
865873

866874
<div class="graphql-code-line ">Promotion: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
867875

876+
<div class="graphql-code-line ">Refund: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
877+
868878
<div class="graphql-code-line ">Region: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
869879

870880
<div class="graphql-code-line ">Seller: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
871881

882+
<div class="graphql-code-line ">Session: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
883+
884+
<div class="graphql-code-line ">ShippingLine: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
885+
872886
<div class="graphql-code-line ">ShippingMethod: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
873887

888+
<div class="graphql-code-line ">StockLevel: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
889+
874890
<div class="graphql-code-line ">StockLocation: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
875891

892+
<div class="graphql-code-line ">StockMovement: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
893+
876894
<div class="graphql-code-line ">TaxCategory: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
877895

878896
<div class="graphql-code-line ">TaxRate: [<a href="/reference/graphql-api/admin/object-types#customfieldconfig">CustomFieldConfig</a>!]!</div>
@@ -1516,6 +1534,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
15161534

15171535
<div class="graphql-code-line ">data: <a href="/reference/graphql-api/admin/object-types#json">JSON</a>!</div>
15181536

1537+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
1538+
15191539

15201540
<div class="graphql-code-line top-level">&#125;</div>
15211541
</div>
@@ -2593,6 +2613,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
25932613

25942614
<div class="graphql-code-line ">metadata: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
25952615

2616+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
2617+
25962618

25972619
<div class="graphql-code-line top-level">&#125;</div>
25982620
</div>
@@ -3226,6 +3248,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
32263248

32273249
<div class="graphql-code-line ">metadata: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
32283250

3251+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
3252+
32293253

32303254
<div class="graphql-code-line top-level">&#125;</div>
32313255
</div>
@@ -3393,6 +3417,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
33933417

33943418
<div class="graphql-code-line ">quantity: <a href="/reference/graphql-api/admin/object-types#int">Int</a>!</div>
33953419

3420+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
3421+
33963422

33973423
<div class="graphql-code-line top-level">&#125;</div>
33983424
</div>
@@ -3434,6 +3460,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
34343460

34353461
<div class="graphql-code-line ">quantity: <a href="/reference/graphql-api/admin/object-types#int">Int</a>!</div>
34363462

3463+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
3464+
34373465

34383466
<div class="graphql-code-line top-level">&#125;</div>
34393467
</div>
@@ -3488,6 +3516,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
34883516

34893517
<div class="graphql-code-line ">quantity: <a href="/reference/graphql-api/admin/object-types#int">Int</a>!</div>
34903518

3519+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
3520+
34913521

34923522
<div class="graphql-code-line top-level">&#125;</div>
34933523
</div>
@@ -3713,6 +3743,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
37133743

37143744
<div class="graphql-code-line ">discounts: [<a href="/reference/graphql-api/admin/object-types#discount">Discount</a>!]!</div>
37153745

3746+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
3747+
37163748

37173749
<div class="graphql-code-line top-level">&#125;</div>
37183750
</div>
@@ -3837,6 +3869,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
38373869

38383870
<div class="graphql-code-line ">quantity: <a href="/reference/graphql-api/admin/object-types#int">Int</a>!</div>
38393871

3872+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
3873+
38403874

38413875
<div class="graphql-code-line top-level">&#125;</div>
38423876
</div>
@@ -3859,6 +3893,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
38593893

38603894
<div class="graphql-code-line ">stockLocation: <a href="/reference/graphql-api/admin/object-types#stocklocation">StockLocation</a>!</div>
38613895

3896+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/admin/object-types#json">JSON</a></div>
3897+
38623898

38633899
<div class="graphql-code-line top-level">&#125;</div>
38643900
</div>

docs/docs/reference/graphql-api/shop/object-types.md

+8
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
10721072

10731073
<div class="graphql-code-line ">data: <a href="/reference/graphql-api/shop/object-types#json">JSON</a>!</div>
10741074

1075+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/shop/object-types#json">JSON</a></div>
1076+
10751077

10761078
<div class="graphql-code-line top-level">&#125;</div>
10771079
</div>
@@ -1942,6 +1944,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
19421944

19431945
<div class="graphql-code-line ">metadata: <a href="/reference/graphql-api/shop/object-types#json">JSON</a></div>
19441946

1947+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/shop/object-types#json">JSON</a></div>
1948+
19451949

19461950
<div class="graphql-code-line top-level">&#125;</div>
19471951
</div>
@@ -2470,6 +2474,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
24702474

24712475
<div class="graphql-code-line ">metadata: <a href="/reference/graphql-api/shop/object-types#json">JSON</a></div>
24722476

2477+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/shop/object-types#json">JSON</a></div>
2478+
24732479

24742480
<div class="graphql-code-line top-level">&#125;</div>
24752481
</div>
@@ -2757,6 +2763,8 @@ import MemberDescription from '@site/src/components/MemberDescription';
27572763

27582764
<div class="graphql-code-line ">discounts: [<a href="/reference/graphql-api/shop/object-types#discount">Discount</a>!]!</div>
27592765

2766+
<div class="graphql-code-line ">customFields: <a href="/reference/graphql-api/shop/object-types#json">JSON</a></div>
2767+
27602768

27612769
<div class="graphql-code-line top-level">&#125;</div>
27622770
</div>

docs/docs/reference/typescript-api/common/bootstrap.md

+46-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
1111

1212
## bootstrap
1313

14-
<GenerationInfo sourceFile="packages/core/src/bootstrap.ts" sourceLine="106" packageName="@vendure/core" />
14+
<GenerationInfo sourceFile="packages/core/src/bootstrap.ts" sourceLine="159" packageName="@vendure/core" />
1515

1616
Bootstraps the Vendure server. This is the entry point to the application.
1717

@@ -49,6 +49,27 @@ bootstrap(config, {
4949
});
5050
```
5151

52+
### Ignoring compatibility errors for plugins
53+
54+
Since v3.1.0, you can ignore compatibility errors for specific plugins by passing the `ignoreCompatibilityErrorsForPlugins` option.
55+
56+
This should be used with caution, only if you are sure that the plugin will still work as expected with the current version of Vendure.
57+
58+
*Example*
59+
60+
```ts
61+
import { bootstrap } from '@vendure/core';
62+
import { config } from './vendure-config';
63+
import { MyPlugin } from './plugins/my-plugin';
64+
65+
bootstrap(config, {
66+
// Let's say that `MyPlugin` is not yet compatible with the current version of Vendure
67+
// but we know that it will still work as expected, and we are not able to publish
68+
// a new version of the plugin right now.
69+
ignoreCompatibilityErrorsForPlugins: [MyPlugin],
70+
});
71+
```
72+
5273
```ts title="Signature"
5374
function bootstrap(userConfig: Partial<VendureConfig>, options?: BootstrapOptions): Promise<INestApplication>
5475
```
@@ -73,7 +94,8 @@ Vendure server.
7394

7495
```ts title="Signature"
7596
interface BootstrapOptions {
76-
nestApplicationOptions: NestApplicationOptions;
97+
nestApplicationOptions?: NestApplicationOptions;
98+
ignoreCompatibilityErrorsForPlugins?: Array<DynamicModule | Type<any>>;
7799
}
78100
```
79101

@@ -84,6 +106,28 @@ interface BootstrapOptions {
84106
<MemberInfo kind="property" type={`NestApplicationOptions`} />
85107

86108
These options get passed directly to the `NestFactory.create()` method.
109+
### ignoreCompatibilityErrorsForPlugins
110+
111+
<MemberInfo kind="property" type={`Array&#60;DynamicModule | Type&#60;any&#62;&#62;`} default={`[]`} since="3.1.0" />
112+
113+
By default, if a plugin specifies a compatibility range which does not include the current
114+
Vendure version, the bootstrap process will fail. This option allows you to ignore compatibility
115+
errors for specific plugins.
116+
117+
This setting should be used with caution, only if you are sure that the plugin will still
118+
work as expected with the current version of Vendure.
119+
120+
*Example*
121+
122+
```ts
123+
import { bootstrap } from '@vendure/core';
124+
import { config } from './vendure-config';
125+
import { MyPlugin } from './plugins/my-plugin';
126+
127+
bootstrap(config, {
128+
ignoreCompatibilityErrorsForPlugins: [MyPlugin],
129+
});
130+
```
87131

88132

89133
</div>

docs/docs/reference/typescript-api/common/currency-code.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
1111

1212
## CurrencyCode
1313

14-
<GenerationInfo sourceFile="packages/common/src/generated-types.ts" sourceLine="992" packageName="@vendure/common" />
14+
<GenerationInfo sourceFile="packages/common/src/generated-types.ts" sourceLine="994" packageName="@vendure/common" />
1515

1616
ISO 4217 currency code
1717

docs/docs/reference/typescript-api/common/job-state.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
1111

1212
## JobState
1313

14-
<GenerationInfo sourceFile="packages/common/src/generated-types.ts" sourceLine="2228" packageName="@vendure/common" />
14+
<GenerationInfo sourceFile="packages/common/src/generated-types.ts" sourceLine="2238" packageName="@vendure/common" />
1515

1616
The state of a Job in the JobQueue
1717

docs/docs/reference/typescript-api/common/language-code.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';
1111

1212
## LanguageCode
1313

14-
<GenerationInfo sourceFile="packages/common/src/generated-types.ts" sourceLine="2246" packageName="@vendure/common" />
14+
<GenerationInfo sourceFile="packages/common/src/generated-types.ts" sourceLine="2256" packageName="@vendure/common" />
1515

1616
Languages in the form of a ISO 639-1 language code with optional
1717
region or script modifier (e.g. de_AT). The selection available is based

0 commit comments

Comments
 (0)