@vendure/cloud-config 0.4.0 → 0.5.0-dev.20261014172655.g652e750
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/README.md +13 -4
- package/dist/cloud-asset-server-plugin.d.ts.map +1 -1
- package/dist/cloud-asset-server-plugin.js +22 -38
- package/dist/cloud-asset-server-plugin.js.map +1 -1
- package/dist/cloud-config.d.ts.map +1 -1
- package/dist/cloud-dashboard-plugin.d.ts.map +1 -1
- package/dist/cloud-dashboard-plugin.js +20 -36
- package/dist/cloud-dashboard-plugin.js.map +1 -1
- package/dist/cloud-plugin-declaration.d.ts.map +1 -1
- package/dist/cloud-plugin-declaration.js +18 -23
- package/dist/cloud-plugin-declaration.js.map +1 -1
- package/dist/composition.d.ts.map +1 -1
- package/dist/composition.js +22 -32
- package/dist/composition.js.map +1 -1
- package/dist/define-cloud-config.d.ts.map +1 -1
- package/dist/define-cloud-config.js +12 -17
- package/dist/define-cloud-config.js.map +1 -1
- package/dist/durable-workflow-reads.d.ts +20 -0
- package/dist/durable-workflow-reads.d.ts.map +1 -0
- package/dist/durable-workflow-reads.js +57 -0
- package/dist/durable-workflow-reads.js.map +1 -0
- package/dist/durable-workflows.d.ts +74 -0
- package/dist/durable-workflows.d.ts.map +1 -0
- package/dist/durable-workflows.js +102 -0
- package/dist/durable-workflows.js.map +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +3 -6
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +70 -104
- package/dist/migrations.js.map +1 -1
- package/dist/outbound-hosts.d.ts +6 -0
- package/dist/outbound-hosts.d.ts.map +1 -1
- package/dist/outbound-hosts.js +114 -55
- package/dist/outbound-hosts.js.map +1 -1
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +6 -7
- package/dist/path.js.map +1 -1
- package/dist/platform-capabilities.d.ts.map +1 -1
- package/dist/platform-capabilities.js +12 -18
- package/dist/platform-capabilities.js.map +1 -1
- package/dist/platform-fields.d.ts.map +1 -1
- package/dist/platform-fields.js +10 -15
- package/dist/platform-fields.js.map +1 -1
- package/dist/plugin-attribution.d.ts.map +1 -1
- package/dist/plugin-attribution.js +22 -31
- package/dist/plugin-attribution.js.map +1 -1
- package/dist/runtime-backstop.d.ts.map +1 -1
- package/dist/runtime-backstop.js +2 -5
- package/dist/runtime-backstop.js.map +1 -1
- package/dist/secrets.d.ts.map +1 -1
- package/dist/secrets.js +20 -50
- package/dist/secrets.js.map +1 -1
- package/dist/stack.d.ts.map +1 -1
- package/dist/stack.js +12 -21
- package/dist/stack.js.map +1 -1
- package/dist/superseded-plugins.d.ts.map +1 -1
- package/dist/superseded-plugins.js +4 -7
- package/dist/superseded-plugins.js.map +1 -1
- package/dist/vendure-extension.d.ts +2 -0
- package/dist/vendure-extension.d.ts.map +1 -1
- package/dist/vendure-extension.js +53 -34
- package/dist/vendure-extension.js.map +1 -1
- package/package.json +10 -3
- package/dist/tenant-workflows.d.ts +0 -44
- package/dist/tenant-workflows.d.ts.map +0 -1
- package/dist/tenant-workflows.js +0 -219
- package/dist/tenant-workflows.js.map +0 -1
package/README.md
CHANGED
|
@@ -163,6 +163,15 @@ Vendure Cloud: Extension acme.erp attempted outbound access to api.other-erp.exa
|
|
|
163
163
|
Declared outbound hosts: erp.acme.com
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
+
`defineVendureExtension` accepts only bare public hostnames and stores each in the form the check
|
|
167
|
+
compares: lowercase, without a trailing dot, and in Punycode. It refuses a URL, port, path,
|
|
168
|
+
credentials, IP address, wildcard or local-network name. The error, an `InvalidOutboundHostsError`
|
|
169
|
+
(a subclass of `InvalidVendureExtensionError`), names each refused entry by its position and does
|
|
170
|
+
not quote it. The managed build evaluates the configuration before it creates an image, so the
|
|
171
|
+
refusal fails the build, and the build's failure summary says which declaration to fix. This is
|
|
172
|
+
syntax only; a public name that resolves to a private address is not detected. A report about a host
|
|
173
|
+
that cannot be declared says so instead of suggesting the declaration.
|
|
174
|
+
|
|
166
175
|
The check runs inside the customer's own process rather than in the network path, and
|
|
167
176
|
attribution is the reason. A firewall sees a source address and a TLS server name and cannot
|
|
168
177
|
say which extension made the call, so it cannot produce that message. Reading the stack can.
|
|
@@ -193,10 +202,10 @@ further down the same stack, and the suite covers all three.
|
|
|
193
202
|
|
|
194
203
|
### What it costs, and where it is imprecise
|
|
195
204
|
|
|
196
|
-
An allowed call costs one `Set` lookup. The host is compared against
|
|
197
|
-
declared host first, and only a host that appears in none of them is
|
|
198
|
-
capturing a stack is the expensive part. The cost of that ordering is that an
|
|
199
|
-
reaching a host *another* extension declared is not reported.
|
|
205
|
+
An allowed call costs a host normalisation and one `Set` lookup. The host is compared against
|
|
206
|
+
the union of every declared host first, and only a host that appears in none of them is
|
|
207
|
+
attributed, because capturing a stack is the expensive part. The cost of that ordering is that an
|
|
208
|
+
extension reaching a host *another* extension declared is not reported.
|
|
200
209
|
|
|
201
210
|
Interception is `globalThis.fetch` plus `net.Socket.prototype.connect`. The socket is where
|
|
202
211
|
`http.request`, `https.request`, `net.connect` and every client library end up, and — unlike
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-asset-server-plugin.d.ts","sourceRoot":"","sources":["../src/cloud-asset-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"cloud-asset-server-plugin.d.ts","sourceRoot":"","sources":["../src/cloud-asset-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAUjE,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAK7D,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAK1C,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAKlD,eAAO,MAAM,sCAAsC;;;;;CASzC,CAAC;AAIX,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,kBAAkB,EAClB,MAAM,OAAO,sCAAsC,CACpD,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,0BAA0B,GAAG;IACvE,sBAAsB,CAAC,EAAE,aAAa,CACpC,CAAC,OAAO,sCAAsC,CAAC,CAAC,wBAAwB,CAAC,CAC1E,CAAC;IACF,cAAc,CAAC,EAAE,aAAa,CAAC,CAAC,OAAO,sCAAsC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAClG,cAAc,CAAC,EAAE,aAAa,CAAC,CAAC,OAAO,sCAAsC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAClG,KAAK,CAAC,EAAE,aAAa,CAAC,CAAC,OAAO,sCAAsC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACjF,CAAC;AAIF,MAAM,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AASlE,eAAO,MAAM,sBAAsB;;;mBAOjB,6BAA6B,GAAQ,kBAAkB;CAQxE,CAAC;AAiBF,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,oBAAoB,GAAG,wBAAwB,CAMjG"}
|
|
@@ -1,30 +1,22 @@
|
|
|
1
1
|
import { declareCloudPlugin, listCloudPluginDeclarations } from "./cloud-plugin-declaration.js";
|
|
2
|
-
// ADR-0044
|
|
3
|
-
//
|
|
4
|
-
// their configuration file. The plugin that serves and stores assets is built by the platform
|
|
5
|
-
// runtime, which is the only place that knows the bucket, the credential chain and the hostname.
|
|
2
|
+
// ADR-0044 and ADR-0051 own what the platform supplies. This file is the declaration side; the
|
|
3
|
+
// platform runtime builds the plugin that serves and stores assets.
|
|
6
4
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// against a second copy that check fails and every asset request takes the local-filesystem
|
|
12
|
-
// branch.
|
|
5
|
+
// `@vendure/asset-server-plugin` is a peer dependency here and a direct dependency of
|
|
6
|
+
// `@vendure/cloud`, so the tree holds one copy. `AssetServer.sanitizeFilePath` branches on
|
|
7
|
+
// `instanceof S3AssetStorageStrategy`; with a second copy that check fails and every asset request
|
|
8
|
+
// takes the local-filesystem branch.
|
|
13
9
|
export const CLOUD_ASSET_SERVER_PLUGIN_KIND = "asset-server";
|
|
14
|
-
// Fixed platform-wide (ADR-0051). The
|
|
15
|
-
//
|
|
16
|
-
//
|
|
10
|
+
// Fixed platform-wide (ADR-0051). The control plane applies the `/assets/*` cache path pattern
|
|
11
|
+
// without reading customer code, so a customer-set route would move assets out from under it
|
|
12
|
+
// unreported.
|
|
17
13
|
export const CLOUD_ASSET_ROUTE = "assets";
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// for by anyone. It is set well above what a storefront asks for so that nobody meets it by
|
|
22
|
-
// accident, and it is documented because a store legitimately serving something wider discovers it
|
|
23
|
-
// as a smaller image rather than as an error.
|
|
14
|
+
// Upper bound, in pixels on either axis, on an unauthenticated amplification vector: without it,
|
|
15
|
+
// `?w=1` through `?w=10000` is ten thousand `sharp` runs and stored objects. Set above storefront
|
|
16
|
+
// needs; a wider request is served as a smaller image, not an error.
|
|
24
17
|
export const MAX_IMAGE_TRANSFORM_DIMENSION = 6000;
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
// explanation is what TypeScript prints when the field is set, so it is the message and not a key
|
|
18
|
+
// Options removed from the customer type, each with the explanation its build-time error prints.
|
|
19
|
+
// Literals, for the reason given in `platform-fields.ts`.
|
|
28
20
|
// into one.
|
|
29
21
|
export const PLATFORM_SUPPLIED_ASSET_SERVER_OPTIONS = {
|
|
30
22
|
storageStrategyFactory: "Assets are stored in a bucket Vendure Cloud creates for this environment and only this environment's task can read. Remove storageStrategyFactory. To move assets you already hold, copy them in rather than pointing the platform at your own bucket.",
|
|
@@ -33,19 +25,16 @@ export const PLATFORM_SUPPLIED_ASSET_SERVER_OPTIONS = {
|
|
|
33
25
|
route: "Assets are served at /assets, and the platform's cache sits on that exact path. Moving the route would take the asset path out from under it. Remove route.",
|
|
34
26
|
};
|
|
35
27
|
const PLATFORM_SUPPLIED_OPTION_NAMES = Object.keys(PLATFORM_SUPPLIED_ASSET_SERVER_OPTIONS);
|
|
36
|
-
// A
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
// second is redundant, because the platform injects the default declaration when the customer
|
|
40
|
-
// writes neither, and it is supported so that writing it is not read as a plugin nobody recognises.
|
|
28
|
+
// A bare `CloudAssetServerPlugin` is the default declaration and `.init({ ... })` carries customer
|
|
29
|
+
// options. The platform injects the default when neither is written, so the bare form only makes
|
|
30
|
+
// assets visible in the file.
|
|
41
31
|
export const CloudAssetServerPlugin = Object.assign(declareCloudPlugin("CloudAssetServerPlugin", CLOUD_ASSET_SERVER_PLUGIN_KIND, {}), {
|
|
42
32
|
init(options = {}) {
|
|
43
33
|
return declareCloudPlugin("CloudAssetServerPlugin", CLOUD_ASSET_SERVER_PLUGIN_KIND, withoutPlatformSuppliedOptions(options));
|
|
44
34
|
},
|
|
45
35
|
});
|
|
46
|
-
// The branded options
|
|
47
|
-
//
|
|
48
|
-
// makes the platform's values authoritative in both cases, and it costs one object copy at boot.
|
|
36
|
+
// The type blocks branded options only in TypeScript; a configuration compiled from JavaScript is
|
|
37
|
+
// not type-checked. Dropping them at runtime keeps the platform's values authoritative in both.
|
|
49
38
|
function withoutPlatformSuppliedOptions(options) {
|
|
50
39
|
const customer = { ...options };
|
|
51
40
|
for (const name of PLATFORM_SUPPLIED_OPTION_NAMES) {
|
|
@@ -53,14 +42,9 @@ function withoutPlatformSuppliedOptions(options) {
|
|
|
53
42
|
}
|
|
54
43
|
return customer;
|
|
55
44
|
}
|
|
56
|
-
// ADR-0044
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
// A configuration declaring it more than once takes the last, which is what the upstream plugin's
|
|
61
|
-
// static options do and therefore what a customer who has met that plugin expects. ADR-0044 calls a
|
|
62
|
-
// double declaration a documentation problem rather than something to defend against, so this
|
|
63
|
-
// resolves it quietly rather than refusing the boot over it.
|
|
45
|
+
// ADR-0044: a customer declaration replaces the platform's injected default. With several
|
|
46
|
+
// declarations the last wins, as in the upstream plugin's static options; ADR-0044 treats a double
|
|
47
|
+
// declaration as a documentation problem.
|
|
64
48
|
export function resolveAssetServerSettings(config) {
|
|
65
49
|
const declarations = listCloudPluginDeclarations(config.plugins, CLOUD_ASSET_SERVER_PLUGIN_KIND);
|
|
66
50
|
return declarations[declarations.length - 1]?.options ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-asset-server-plugin.js","sourceRoot":"","sources":["../src/cloud-asset-server-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAIhG
|
|
1
|
+
{"version":3,"file":"cloud-asset-server-plugin.js","sourceRoot":"","sources":["../src/cloud-asset-server-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAIhG,+FAA+F;AAC/F,oEAAoE;AACpE,EAAE;AACF,sFAAsF;AACtF,2FAA2F;AAC3F,mGAAmG;AACnG,qCAAqC;AAErC,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;AAE7D,+FAA+F;AAC/F,6FAA6F;AAC7F,cAAc;AACd,MAAM,CAAC,MAAM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,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-config.d.ts","sourceRoot":"","sources":["../src/cloud-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEnF,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"cloud-config.d.ts","sourceRoot":"","sources":["../src/cloud-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEnF,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAC;AAKhD,MAAM,MAAM,aAAa,CAAC,WAAW,SAAS,MAAM,IAAI;IACtD,QAAQ,CAAC,CAAC,kBAAkB,CAAC,EAAE,WAAW,CAAC;CAC5C,CAAC;AAIF,KAAK,SAAS,CAAC,IAAI,SAAS,sBAAsB,IAAI,OAAO,CAC3D,sBAAsB,EACtB;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CACf,CAAC,QAAQ,CAAC,CAAC;AAQZ,KAAK,UAAU,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AAC9C,KAAK,WAAW,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;AAChD,KAAK,YAAY,GAAG,WAAW,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC;AAC/D,KAAK,aAAa,GAAG,WAAW,CAAC,aAAa,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|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
import { declareCloudPlugin, listCloudPluginDeclarations } from "./cloud-plugin-declaration.js";
|
|
2
2
|
import { CloudConfigError } from "./errors.js";
|
|
3
3
|
// ADR-0044 rules `DashboardPlugin` platform-supplied and wrapped, with `route` the only option the
|
|
4
|
-
// customer keeps. This is the
|
|
5
|
-
//
|
|
6
|
-
// is the only place that knows where the managed build put the Dashboard's files.
|
|
4
|
+
// customer keeps. This file is the declaration side; the platform runtime builds the plugin that
|
|
5
|
+
// serves the Dashboard.
|
|
7
6
|
export const CLOUD_DASHBOARD_PLUGIN_KIND = "dashboard";
|
|
8
|
-
// The
|
|
9
|
-
// Vendure Cloud finds the Dashboard where they left it.
|
|
7
|
+
// The upstream plugin's documented default.
|
|
10
8
|
export const DEFAULT_DASHBOARD_ROUTE = "dashboard";
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// explanation is what TypeScript prints when the field is set, so it is the message and not a key
|
|
14
|
-
// into one.
|
|
9
|
+
// Options removed from the customer type, each with the explanation its build-time error prints.
|
|
10
|
+
// Literals, for the reason given in `platform-fields.ts`.
|
|
15
11
|
export const PLATFORM_SUPPLIED_DASHBOARD_OPTIONS = {
|
|
16
12
|
appDir: "The Dashboard's files are produced by the managed build, and Vendure Cloud tells the plugin where they are. A path set here would not exist in the runtime image. Remove appDir.",
|
|
17
13
|
viteDevServerPort: "The Vite dev server does not run in a Vendure Cloud process, so there is nothing to probe for and no request is proxied to it. Remove viteDevServerPort. It still applies when you run the same configuration locally.",
|
|
18
14
|
};
|
|
19
15
|
const DEFAULT_DASHBOARD_SETTINGS = { route: DEFAULT_DASHBOARD_ROUTE };
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
// digit rules out `.` and `..`, which resolve to somewhere else again.
|
|
16
|
+
// One path segment. Nest mounts the Dashboard's middleware at the route and `index.html` carries it
|
|
17
|
+
// as a `<base>` tag; a slash makes the two disagree and the Dashboard loads nothing. Starting with
|
|
18
|
+
// a letter or digit rules out `.` and `..`.
|
|
24
19
|
const ROUTE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._~-]*$/;
|
|
25
|
-
// Vendure's
|
|
26
|
-
// still serves them there and this check runs before core has filled them in.
|
|
20
|
+
// Vendure's defaults for the two API paths; this check runs before core fills them in.
|
|
27
21
|
const DEFAULT_ADMIN_API_PATH = "admin-api";
|
|
28
22
|
const DEFAULT_SHOP_API_PATH = "shop-api";
|
|
29
23
|
export class InvalidDashboardRouteError extends CloudConfigError {
|
|
@@ -33,9 +27,8 @@ export class InvalidDashboardRouteError extends CloudConfigError {
|
|
|
33
27
|
this.route = route;
|
|
34
28
|
}
|
|
35
29
|
}
|
|
36
|
-
// Runs where the customer wrote the route, so the
|
|
37
|
-
//
|
|
38
|
-
// rejects are ordinary strings too.
|
|
30
|
+
// Runs where the customer wrote the route, so the error arrives before anything is deployed. The
|
|
31
|
+
// type system cannot reach it: both the route and the values it rejects are plain strings.
|
|
39
32
|
function assertRouteShape(route) {
|
|
40
33
|
if (route.length === 0) {
|
|
41
34
|
throw new InvalidDashboardRouteError(route, "The route is empty.");
|
|
@@ -44,11 +37,9 @@ function assertRouteShape(route) {
|
|
|
44
37
|
throw new InvalidDashboardRouteError(route, "A route is one path segment: letters, digits, and then any of . _ ~ - after the first character. Slashes, spaces and a leading dot are not part of one.");
|
|
45
38
|
}
|
|
46
39
|
}
|
|
47
|
-
// A
|
|
48
|
-
//
|
|
49
|
-
// Dashboard visible in
|
|
50
|
-
// redundant, because the platform injects the default declaration when the customer writes
|
|
51
|
-
// neither, and it is supported so that writing it is not read as a plugin nobody recognises.
|
|
40
|
+
// A bare `CloudDashboardPlugin` is the default declaration and `.init({ route })` moves the
|
|
41
|
+
// Dashboard. The platform injects the default when neither is written, so the bare form only makes
|
|
42
|
+
// the Dashboard visible in the file.
|
|
52
43
|
export const CloudDashboardPlugin = Object.assign(declareCloudPlugin("CloudDashboardPlugin", CLOUD_DASHBOARD_PLUGIN_KIND, DEFAULT_DASHBOARD_SETTINGS), {
|
|
53
44
|
init(options = {}) {
|
|
54
45
|
const route = options.route ?? DEFAULT_DASHBOARD_ROUTE;
|
|
@@ -56,17 +47,11 @@ export const CloudDashboardPlugin = Object.assign(declareCloudPlugin("CloudDashb
|
|
|
56
47
|
return declareCloudPlugin("CloudDashboardPlugin", CLOUD_DASHBOARD_PLUGIN_KIND, { route });
|
|
57
48
|
},
|
|
58
49
|
});
|
|
59
|
-
// ADR-0044
|
|
60
|
-
//
|
|
61
|
-
//
|
|
50
|
+
// ADR-0044: a customer declaration replaces the platform's injected default. With several
|
|
51
|
+
// declarations the last wins, as in the upstream plugin's static options; ADR-0044 treats a double
|
|
52
|
+
// declaration as a documentation problem.
|
|
62
53
|
//
|
|
63
|
-
//
|
|
64
|
-
// static options do and therefore what a customer who has met that plugin expects. ADR-0044 calls a
|
|
65
|
-
// double declaration a documentation problem rather than something to defend against, so this
|
|
66
|
-
// resolves it quietly rather than refusing the boot over it.
|
|
67
|
-
//
|
|
68
|
-
// It takes the whole configuration rather than the plugins array, because the route has to be
|
|
69
|
-
// checked against the paths the customer's own API options claim.
|
|
54
|
+
// Takes the whole configuration because the route is checked against the customer's API paths.
|
|
70
55
|
export function resolveDashboardSettings(config) {
|
|
71
56
|
const declarations = listCloudPluginDeclarations(config.plugins, CLOUD_DASHBOARD_PLUGIN_KIND);
|
|
72
57
|
const settings = declarations[declarations.length - 1] ?? { options: DEFAULT_DASHBOARD_SETTINGS };
|
|
@@ -74,9 +59,8 @@ export function resolveDashboardSettings(config) {
|
|
|
74
59
|
assertRouteIsFree(settings.options.route, config);
|
|
75
60
|
return settings.options;
|
|
76
61
|
}
|
|
77
|
-
// A route
|
|
78
|
-
//
|
|
79
|
-
// the only point at which the route and the API paths are both known.
|
|
62
|
+
// A route equal to an API path is served by whichever Nest matches first, so one of the two is
|
|
63
|
+
// lost silently. Checked here because only here are the route and the API paths both known.
|
|
80
64
|
function assertRouteIsFree(route, config) {
|
|
81
65
|
const claimed = [
|
|
82
66
|
["the Admin API", config.apiOptions?.adminApiPath ?? DEFAULT_ADMIN_API_PATH],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-dashboard-plugin.js","sourceRoot":"","sources":["../src/cloud-dashboard-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI/C,mGAAmG;AACnG,
|
|
1
|
+
{"version":3,"file":"cloud-dashboard-plugin.js","sourceRoot":"","sources":["../src/cloud-dashboard-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI/C,mGAAmG;AACnG,iGAAiG;AACjG,wBAAwB;AAExB,MAAM,CAAC,MAAM,2BAA2B,GAAG,WAAW,CAAC;AAEvD,4CAA4C;AAC5C,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAEnD,iGAAiG;AACjG,0DAA0D;AAC1D,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,MAAM,EACJ,kLAAkL;IACpL,iBAAiB,EACf,wNAAwN;CAClN,CAAC;AAgBX,MAAM,0BAA0B,GAA2B,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC;AAE9F,oGAAoG;AACpG,mGAAmG;AACnG,4CAA4C;AAC5C,MAAM,aAAa,GAAG,+BAA+B,CAAC;AAEtD,uFAAuF;AACvF,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAC3C,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAEzC,MAAM,OAAO,0BAA2B,SAAQ,gBAAgB;IACrD,KAAK,CAAS;IAEvB,YAAY,KAAa,EAAE,MAAc;QACvC,KAAK,CACH,qDAAqD,KAAK,SAAS,MA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AAC,CAAC;IACzC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC;AAED,+FAA+F;AAC/F,4FAA4F;AAC5F,SAAS,iBAAiB,CAAC,KAAa,EAAE,MAA4B;IACpE,MAAM,OAAO,GAAuB;QAClC,CAAC,eAAe,EAAE,MAAM,CAAC,UAAU,EAAE,YAAY,IAAI,sBAAsB,CAAC;QAC5E,CAAC,cAAc,EAAE,MAAM,CAAC,UAAU,EAAE,WAAW,IAAI,qBAAqB,CAAC;KAC1E,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,OAAO,EAAE,CAAC;QACnC,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;YACnB,MAAM,IAAI,0BAA0B,CAClC,KAAK,EACL,GAAG,IAAI,mDAAmD,CAC3D,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-plugin-declaration.d.ts","sourceRoot":"","sources":["../src/cloud-plugin-declaration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"cloud-plugin-declaration.d.ts","sourceRoot":"","sources":["../src/cloud-plugin-declaration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAgB1D,MAAM,WAAW,sBAAsB,CAAC,OAAO,GAAG,OAAO;IAEvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAMD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;;EAUvF;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,GAAG,SAAS,CAK7F;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEhE;AAGD,wBAAgB,2BAA2B,CAAC,OAAO,EACjD,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,IAAI,EAAE,MAAM,GACX,sBAAsB,CAAC,OAAO,CAAC,EAAE,CASnC"}
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
// How a customer declares a wrapped platform plugin (ADR-0044, shape 2).
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// and the platform runtime builds the plugin that implements it during composition.
|
|
1
|
+
// How a customer declares a wrapped platform plugin (ADR-0044, shape 2). The plugin that runs needs
|
|
2
|
+
// `@vendure/core` and the platform's values, and build tooling imports the configuration file where
|
|
3
|
+
// neither exists. So `CloudDashboardPlugin.init({ route })` returns a marker carrying only the
|
|
4
|
+
// options, and the platform runtime builds the real plugin during composition.
|
|
6
5
|
//
|
|
7
|
-
// The marker is a class
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// it before core sees it.
|
|
6
|
+
// The marker is a class so it is an ordinary member of the plugins array: it satisfies
|
|
7
|
+
// `VendurePluginEntry` and extension flattening and attribution wrapping pass over it. Composition
|
|
8
|
+
// removes it before core sees it.
|
|
11
9
|
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
10
|
+
// The symbol is registered, as the config handle's is (ADR-0043). With a second copy of this
|
|
11
|
+
// package in the tree, a module-local symbol would give markers the composing copy does not
|
|
12
|
+
// recognise, and the customer's route would be ignored silently.
|
|
15
13
|
const DECLARATION = Symbol.for("vendure-cloud.cloud-plugin-declaration");
|
|
16
|
-
// The return type is inferred
|
|
17
|
-
//
|
|
14
|
+
// The return type is inferred so a caller can add a static `init` and keep an ordinary plugins
|
|
15
|
+
// array member.
|
|
18
16
|
export function declareCloudPlugin(name, kind, options) {
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
17
|
+
// A class expression takes its name from its binding, and this one is returned, so the name is
|
|
18
|
+
// set through a computed key. It reaches boot messages and build logs; `pluginName` reports a
|
|
19
|
+
// class without one as "an anonymous plugin".
|
|
22
20
|
const marker = { [name]: class {
|
|
23
21
|
} }[name];
|
|
24
22
|
const declaration = { kind, options };
|
|
25
|
-
// Non-enumerable, so the marker spreads and serialises as an
|
|
26
|
-
//
|
|
27
|
-
// dump — as configuration the customer did not write.
|
|
23
|
+
// Non-enumerable, so the marker spreads and serialises as an empty class and inspecting the
|
|
24
|
+
// plugins array shows no configuration the customer did not write.
|
|
28
25
|
Object.defineProperty(marker, DECLARATION, { value: declaration });
|
|
29
26
|
return marker;
|
|
30
27
|
}
|
|
@@ -37,9 +34,7 @@ export function readCloudPluginDeclaration(entry) {
|
|
|
37
34
|
export function isCloudPluginDeclaration(entry) {
|
|
38
35
|
return readCloudPluginDeclaration(entry) !== undefined;
|
|
39
36
|
}
|
|
40
|
-
// The declarations of one kind, in the order the customer wrote them.
|
|
41
|
-
// these to build the plugins that implement them, and composition drops the markers from the array
|
|
42
|
-
// it hands core.
|
|
37
|
+
// The declarations of one kind, in the order the customer wrote them.
|
|
43
38
|
export function listCloudPluginDeclarations(plugins, kind) {
|
|
44
39
|
const declarations = [];
|
|
45
40
|
for (const plugin of plugins) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-plugin-declaration.js","sourceRoot":"","sources":["../src/cloud-plugin-declaration.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"cloud-plugin-declaration.js","sourceRoot":"","sources":["../src/cloud-plugin-declaration.ts"],"names":[],"mappings":"AAEA,oGAAoG;AACpG,oGAAoG;AACpG,+FAA+F;AAC/F,+EAA+E;AAC/E,EAAE;AACF,uFAAuF;AACvF,mGAAmG;AACnG,kCAAkC;AAClC,EAAE;AACF,6FAA6F;AAC7F,4FAA4F;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IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAChG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAE5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,UAAU,EAIhB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAChG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAE5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,UAAU,EAIhB,MAAM,yBAAyB,CAAC;AAKjC,eAAO,MAAM,0BAA0B,WAAW,CAAC;AAInD,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC,CAAC;AAEnF,wBAAgB,0BAA0B,CAAC,oBAAoB,EAAE,OAAO,GAAG,mBAAmB,CAS7F;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,YAAY,EAAE,SAAS,UAAU,EAAE,CAAC;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,cAAc,CAAC;CACpE;AAED,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,KAAK,aAAa,CAAC;CACrF;AAOD,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,oBAAoB,GAAG,aAAa,EAC5C,OAAO,EAAE,uBAAuB,GAC/B,aAAa,CAEf;AAID,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,yBAAyB,GACjC,aAAa,CA4Cf;AAqBD,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,SAAS,UAAU,EAAE,EACtC,YAAY,EAAE,SAAS,UAAU,EAAE,GAClC,UAAU,EAAE,CAGd;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAMrF;AAKD,qBAAa,6BAA8B,SAAQ,gBAAgB;IACjE,QAAQ,CAAC,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC;gBAEnC,MAAM,EAAE,SAAS,kBAAkB,EAAE;CASlD;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAU3F"}
|
package/dist/composition.js
CHANGED
|
@@ -5,41 +5,37 @@ import { readPath } from "./path.js";
|
|
|
5
5
|
import { PLATFORM_OWNED_FIELDS, formatPlatformFieldDetail, } from "./platform-fields.js";
|
|
6
6
|
import { assertNoCustomerPluginWroteAPlatformField, pluginName, recordPlatformFieldWrites, } from "./plugin-attribution.js";
|
|
7
7
|
import { assertNoSupersededPluginDeclared } from "./superseded-plugins.js";
|
|
8
|
-
// The Vendure versions a Cloud Plugin declares itself compatible with.
|
|
9
|
-
//
|
|
10
|
-
// is refused at boot, and finding out one plugin at a time is the slow way to learn it.
|
|
8
|
+
// The Vendure versions a Cloud Plugin declares itself compatible with. Shared so the platform's
|
|
9
|
+
// plugins move together; core refuses at boot a plugin built for a version it does not accept.
|
|
11
10
|
export const CLOUD_PLUGIN_COMPATIBILITY = "^3.7.0";
|
|
12
11
|
export function platformDefaultFieldValues(sessionCacheStrategy) {
|
|
13
12
|
return {
|
|
14
13
|
"authOptions.sessionCacheStrategy": sessionCacheStrategy,
|
|
15
|
-
// Five minutes avoids a database read on every authenticated request
|
|
16
|
-
//
|
|
14
|
+
// Five minutes avoids a database read on every authenticated request; a revoked session lingers
|
|
15
|
+
// at most that long.
|
|
17
16
|
"authOptions.sessionCacheTTL": 300,
|
|
18
17
|
"systemOptions.healthChecks": [],
|
|
19
18
|
"schedulerOptions.runTasksInWorkerOnly": false,
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
|
-
// The Dashboard compiler reads API and authentication settings before Vendure boots, so it
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
// even though defineCloudConfig has already refused those fields before producing the handle.
|
|
21
|
+
// The Dashboard compiler reads API and authentication settings before Vendure boots, so it gets
|
|
22
|
+
// neither Vendure's defaults nor later plugin changes. Platform-owned defaults are inert here:
|
|
23
|
+
// compiling a Dashboard boots no services, and managed composition has replaced the database value.
|
|
24
|
+
// The cast is needed because FlattenedCloudConfig brands platform-owned fields and is not
|
|
25
|
+
// assignable to PartialVendureConfig; defineCloudConfig has already refused those fields.
|
|
28
26
|
export function mergeDashboardConfigWithDefaults(config, options) {
|
|
29
27
|
return options.mergeConfig(options.defaultConfig, config);
|
|
30
28
|
}
|
|
31
|
-
// The
|
|
32
|
-
// decorator from its own copy of Vendure core
|
|
33
|
-
// what prevents the Cloud Config interface from loading a second copy of core.
|
|
29
|
+
// The composition boundary shared by the local and managed runtimes. The caller supplies the
|
|
30
|
+
// decorator from its own copy of Vendure core so this package never loads a second copy.
|
|
34
31
|
export function composeCloudConfig(handle, options) {
|
|
35
32
|
const contents = readCloudConfig(handle);
|
|
36
33
|
const declaredPlugins = [...contents.config.plugins];
|
|
37
|
-
//
|
|
38
|
-
//
|
|
34
|
+
// First, so a customer who declared a plugin the platform supplies reads that message and not one
|
|
35
|
+
// about a field their plugin wrote.
|
|
39
36
|
assertNoSupersededPluginDeclared(declaredPlugins, contents.extensionOf);
|
|
40
|
-
// A Cloud Plugin declaration is a marker
|
|
41
|
-
//
|
|
42
|
-
// implement them, so the markers are removed here.
|
|
37
|
+
// A Cloud Plugin declaration is a marker, not a plugin core can run. The caller has already built
|
|
38
|
+
// the plugins that implement them, so the markers are removed here.
|
|
43
39
|
const customerPlugins = declaredPlugins.filter((plugin) => !isCloudPluginDeclaration(plugin));
|
|
44
40
|
const pendingWrites = recordPlatformFieldWrites(customerPlugins, contents.extensionOf);
|
|
45
41
|
const cloudPluginNames = options.cloudPlugins.map(pluginName);
|
|
@@ -52,8 +48,7 @@ export function composeCloudConfig(handle, options) {
|
|
|
52
48
|
configuration: (runtimeConfig) => {
|
|
53
49
|
assertNoCustomerPluginWroteAPlatformField(pendingWrites.writes, cloudPluginNames);
|
|
54
50
|
// Vendure merges the caller's config over its defaults before plugin configuration runs. Keep
|
|
55
|
-
// the entity catalog and other defaults it added
|
|
56
|
-
// authoritative at the final boundary.
|
|
51
|
+
// the entity catalog and other defaults it added; the platform connection values win here.
|
|
57
52
|
values.dbConnectionOptions = {
|
|
58
53
|
...copyObject(runtimeConfig.dbConnectionOptions),
|
|
59
54
|
...copyObject(values.dbConnectionOptions),
|
|
@@ -89,11 +84,9 @@ function writePath(target, path, value) {
|
|
|
89
84
|
}
|
|
90
85
|
current[leaf] = value;
|
|
91
86
|
}
|
|
92
|
-
// ADR-0017
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
// position therefore does not predict when it runs, which this comment records and no type
|
|
96
|
-
// prevents.
|
|
87
|
+
// ADR-0017: Cloud Plugins run last, so the last write wins for the fields Vendure Cloud owns (core
|
|
88
|
+
// runs the configuration chain in array order). The hoist is unconditional: a Cloud Plugin declared
|
|
89
|
+
// early still runs last.
|
|
97
90
|
export function hoistCloudPluginsLast(customerPlugins, cloudPlugins) {
|
|
98
91
|
const cloud = new Set(cloudPlugins);
|
|
99
92
|
return [...customerPlugins.filter((plugin) => !cloud.has(plugin)), ...cloudPlugins];
|
|
@@ -106,12 +99,9 @@ export function applyPlatformFields(config, values) {
|
|
|
106
99
|
writePath(target, path, value);
|
|
107
100
|
}
|
|
108
101
|
}
|
|
109
|
-
// ADR-0017's forward assertion: after composition,
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
// Scoped to the specific paths rather than whole option objects, because a customer adding
|
|
114
|
-
// TypeORM `extra` options or an entity subscriber alongside is legitimate.
|
|
102
|
+
// ADR-0017's forward assertion: after composition, platform-owned fields must hold the values the
|
|
103
|
+
// platform set. It catches a plugin that rewrote one after the Cloud Plugin ran. Scoped to specific
|
|
104
|
+
// paths because a customer adding TypeORM `extra` options or an entity subscriber is legitimate.
|
|
115
105
|
export class PlatformFieldOverwrittenError extends CloudConfigError {
|
|
116
106
|
fields;
|
|
117
107
|
constructor(fields) {
|
package/dist/composition.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition.js","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAA0B,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EACL,qBAAqB,EAGrB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OA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|
@@ -2,31 +2,26 @@ import { loadExtensionMigrations } from "./migrations.js";
|
|
|
2
2
|
import { PlatformFieldSetByConfigError, listPlatformOwnedFieldsSetIn } from "./runtime-backstop.js";
|
|
3
3
|
import { assertNoMissingSecrets } from "./secrets.js";
|
|
4
4
|
import { flattenVendureExtensions } from "./vendure-extension.js";
|
|
5
|
-
// Registered
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// instead of producing a handle the loader silently fails to recognise.
|
|
5
|
+
// Registered so the platform loader can read a handle produced by another copy of this package.
|
|
6
|
+
// ADR-0043 guards against a second copy of @vendure/core at boot; this covers a second copy of the
|
|
7
|
+
// interface package.
|
|
9
8
|
const HANDLE = Symbol.for("vendure-cloud.config-handle");
|
|
10
|
-
// Returns an opaque handle
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// the database connection's token refresher is a timer.
|
|
9
|
+
// Returns an opaque handle and not a composed VendureConfig. A composed config would hand back
|
|
10
|
+
// every field the input type takes away (ADR-0043), and composing here would make importing the
|
|
11
|
+
// config file acquire live resources: the database connection's token refresher is a timer.
|
|
14
12
|
//
|
|
15
|
-
// Flattening
|
|
16
|
-
// acquires nothing.
|
|
13
|
+
// Flattening extensions reads the array and acquires nothing, so it happens here.
|
|
17
14
|
export function defineCloudConfig(config) {
|
|
18
15
|
const platformOwned = listPlatformOwnedFieldsSetIn(config);
|
|
19
16
|
if (platformOwned.length > 0) {
|
|
20
17
|
throw new PlatformFieldSetByConfigError(platformOwned);
|
|
21
18
|
}
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
// the first one (CLO-411).
|
|
19
|
+
// The argument object is built before this call, so every `secret()` in it has run. This is the
|
|
20
|
+
// first point where the whole declared set is known, so the failure can name every unset secret
|
|
21
|
+
// at once (CLO-411).
|
|
26
22
|
assertNoMissingSecrets();
|
|
27
23
|
const { plugins, extensions, extensionOf } = flattenVendureExtensions(config.plugins ?? []);
|
|
28
|
-
// Composition mutates the configuration object
|
|
29
|
-
// is copied rather than written into.
|
|
24
|
+
// Composition mutates the configuration object, so the customer's object is copied.
|
|
30
25
|
const flattened = { ...config, plugins: [...plugins] };
|
|
31
26
|
return {
|
|
32
27
|
[HANDLE]: {
|
|
@@ -40,7 +35,7 @@ export function defineCloudConfig(config) {
|
|
|
40
35
|
export function isCloudConfigHandle(value) {
|
|
41
36
|
return typeof value === "object" && value !== null && HANDLE in value;
|
|
42
37
|
}
|
|
43
|
-
// The platform entrypoint's accessor
|
|
38
|
+
// The platform entrypoint's accessor, outside the customer-facing surface.
|
|
44
39
|
export function readCloudConfig(handle) {
|
|
45
40
|
return handle[HANDLE];
|
|
46
41
|
}
|