@vendure/cloud-config 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +298 -0
  2. package/dist/cloud-config.d.ts +55 -0
  3. package/dist/cloud-config.d.ts.map +1 -0
  4. package/dist/cloud-config.js +2 -0
  5. package/dist/cloud-config.js.map +1 -0
  6. package/dist/cloud-dashboard-plugin.d.ts +28 -0
  7. package/dist/cloud-dashboard-plugin.d.ts.map +1 -0
  8. package/dist/cloud-dashboard-plugin.js +91 -0
  9. package/dist/cloud-dashboard-plugin.js.map +1 -0
  10. package/dist/cloud-plugin-declaration.d.ts +12 -0
  11. package/dist/cloud-plugin-declaration.d.ts.map +1 -0
  12. package/dist/cloud-plugin-declaration.js +53 -0
  13. package/dist/cloud-plugin-declaration.js.map +1 -0
  14. package/dist/composition.d.ts +23 -0
  15. package/dist/composition.d.ts.map +1 -0
  16. package/dist/composition.js +147 -0
  17. package/dist/composition.js.map +1 -0
  18. package/dist/define-cloud-config.d.ts +19 -0
  19. package/dist/define-cloud-config.d.ts.map +1 -0
  20. package/dist/define-cloud-config.js +47 -0
  21. package/dist/define-cloud-config.js.map +1 -0
  22. package/dist/errors.d.ts +4 -0
  23. package/dist/errors.d.ts.map +1 -0
  24. package/dist/errors.js +13 -0
  25. package/dist/errors.js.map +1 -0
  26. package/dist/index.d.ts +15 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +14 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/migrations.d.ts +32 -0
  31. package/dist/migrations.d.ts.map +1 -0
  32. package/dist/migrations.js +250 -0
  33. package/dist/migrations.js.map +1 -0
  34. package/dist/outbound-hosts.d.ts +16 -0
  35. package/dist/outbound-hosts.d.ts.map +1 -0
  36. package/dist/outbound-hosts.js +211 -0
  37. package/dist/outbound-hosts.js.map +1 -0
  38. package/dist/path.d.ts +2 -0
  39. package/dist/path.d.ts.map +1 -0
  40. package/dist/path.js +18 -0
  41. package/dist/path.js.map +1 -0
  42. package/dist/platform-fields.d.ts +71 -0
  43. package/dist/platform-fields.d.ts.map +1 -0
  44. package/dist/platform-fields.js +94 -0
  45. package/dist/platform-fields.js.map +1 -0
  46. package/dist/plugin-attribution.d.ts +27 -0
  47. package/dist/plugin-attribution.d.ts.map +1 -0
  48. package/dist/plugin-attribution.js +97 -0
  49. package/dist/plugin-attribution.js.map +1 -0
  50. package/dist/runtime-backstop.d.ts +8 -0
  51. package/dist/runtime-backstop.d.ts.map +1 -0
  52. package/dist/runtime-backstop.js +20 -0
  53. package/dist/runtime-backstop.js.map +1 -0
  54. package/dist/secrets.d.ts +14 -0
  55. package/dist/secrets.d.ts.map +1 -0
  56. package/dist/secrets.js +109 -0
  57. package/dist/secrets.js.map +1 -0
  58. package/dist/stack.d.ts +3 -0
  59. package/dist/stack.d.ts.map +1 -0
  60. package/dist/stack.js +58 -0
  61. package/dist/stack.js.map +1 -0
  62. package/dist/superseded-plugins.d.ts +19 -0
  63. package/dist/superseded-plugins.d.ts.map +1 -0
  64. package/dist/superseded-plugins.js +41 -0
  65. package/dist/superseded-plugins.js.map +1 -0
  66. package/dist/vendure-extension.d.ts +38 -0
  67. package/dist/vendure-extension.d.ts.map +1 -0
  68. package/dist/vendure-extension.js +111 -0
  69. package/dist/vendure-extension.js.map +1 -0
  70. package/package.json +64 -0
@@ -0,0 +1,147 @@
1
+ import { isCloudPluginDeclaration } from "./cloud-plugin-declaration.js";
2
+ import { readCloudConfig } from "./define-cloud-config.js";
3
+ import { CloudConfigError } from "./errors.js";
4
+ import { readPath } from "./path.js";
5
+ import { PLATFORM_OWNED_FIELDS, formatPlatformFieldDetail, } from "./platform-fields.js";
6
+ import { assertNoCustomerPluginWroteAPlatformField, pluginName, recordPlatformFieldWrites, } from "./plugin-attribution.js";
7
+ import { assertNoSupersededPluginDeclared } from "./superseded-plugins.js";
8
+ // The Vendure versions a Cloud Plugin declares itself compatible with. One name because the
9
+ // platform's plugins have to move together: a wrapper built for a version core no longer accepts
10
+ // is refused at boot, and finding out one plugin at a time is the slow way to learn it.
11
+ export const CLOUD_PLUGIN_COMPATIBILITY = "^3.7.0";
12
+ export function platformDefaultFieldValues(sessionCacheStrategy) {
13
+ return {
14
+ "authOptions.sessionCacheStrategy": sessionCacheStrategy,
15
+ // Five minutes avoids a database read on every authenticated request without making a revoked
16
+ // session linger for an operationally surprising interval.
17
+ "authOptions.sessionCacheTTL": 300,
18
+ "systemOptions.healthChecks": [],
19
+ "schedulerOptions.runTasksInWorkerOnly": false,
20
+ };
21
+ }
22
+ // The one composition boundary shared by the local and managed runtimes. The caller supplies the
23
+ // decorator from its own copy of Vendure core; keeping that value out of this package's imports is
24
+ // what prevents the Cloud Config interface from loading a second copy of core.
25
+ export function composeCloudConfig(handle, options) {
26
+ const contents = readCloudConfig(handle);
27
+ const declaredPlugins = [...contents.config.plugins];
28
+ // Before anything else composition does, because a customer who declared a plugin the platform
29
+ // supplies should read that message rather than one about a field their plugin went on to write.
30
+ assertNoSupersededPluginDeclared(declaredPlugins, contents.extensionOf);
31
+ // A Cloud Plugin declaration is a marker carrying the customer's options, not a plugin core can
32
+ // run. The caller has already read the options out of the array and built the plugins that
33
+ // implement them, so the markers are removed here.
34
+ const customerPlugins = declaredPlugins.filter((plugin) => !isCloudPluginDeclaration(plugin));
35
+ const pendingWrites = recordPlatformFieldWrites(customerPlugins, contents.extensionOf);
36
+ const cloudPluginNames = options.cloudPlugins.map(pluginName);
37
+ const values = { ...options.values };
38
+ const config = copyCustomerConfig(contents.config);
39
+ applyPlatformFields(config, values);
40
+ const guardPlugin = configurationGuardNamed(options.guardPluginName);
41
+ options.vendurePlugin({
42
+ compatibility: CLOUD_PLUGIN_COMPATIBILITY,
43
+ configuration: (runtimeConfig) => {
44
+ assertNoCustomerPluginWroteAPlatformField(pendingWrites.writes, cloudPluginNames);
45
+ // Vendure merges the caller's config over its defaults before plugin configuration runs. Keep
46
+ // the entity catalog and other defaults it added while making the platform connection values
47
+ // authoritative at the final boundary.
48
+ values.dbConnectionOptions = {
49
+ ...copyObject(runtimeConfig.dbConnectionOptions),
50
+ ...copyObject(values.dbConnectionOptions),
51
+ };
52
+ applyPlatformFields(runtimeConfig, values);
53
+ assertPlatformFieldsHold(runtimeConfig, values);
54
+ return runtimeConfig;
55
+ },
56
+ })(guardPlugin);
57
+ const plugins = [...hoistCloudPluginsLast(customerPlugins, options.cloudPlugins), guardPlugin];
58
+ config.plugins = plugins;
59
+ return {
60
+ ...config,
61
+ apiOptions: config.apiOptions,
62
+ authOptions: config.authOptions,
63
+ dbConnectionOptions: config.dbConnectionOptions,
64
+ paymentOptions: contents.config.paymentOptions ?? { paymentMethodHandlers: [] },
65
+ plugins: plugins,
66
+ };
67
+ }
68
+ function writePath(target, path, value) {
69
+ const segments = path.split(".");
70
+ const leaf = segments.pop();
71
+ if (leaf === undefined)
72
+ return;
73
+ let current = target;
74
+ for (const segment of segments) {
75
+ const next = current[segment];
76
+ if (typeof next !== "object" || next === null) {
77
+ current[segment] = {};
78
+ }
79
+ current = current[segment];
80
+ }
81
+ current[leaf] = value;
82
+ }
83
+ // ADR-0017 requires Cloud Plugins to run last: core runs the configuration chain in array
84
+ // order, so the last write wins for the fields Vendure Cloud owns. The hoist is
85
+ // unconditional, so a Cloud Plugin the customer declared early still runs last. Its written
86
+ // position therefore does not predict when it runs, which this comment records and no type
87
+ // prevents.
88
+ export function hoistCloudPluginsLast(customerPlugins, cloudPlugins) {
89
+ const cloud = new Set(cloudPlugins);
90
+ return [...customerPlugins.filter((plugin) => !cloud.has(plugin)), ...cloudPlugins];
91
+ }
92
+ export function applyPlatformFields(config, values) {
93
+ const target = config;
94
+ for (const [path, value] of Object.entries(values)) {
95
+ if (value === undefined)
96
+ continue;
97
+ writePath(target, path, value);
98
+ }
99
+ }
100
+ // ADR-0017's forward assertion: after composition, the fields Vendure Cloud owns must still
101
+ // hold the values it set. This catches a plugin that rewrote one of them after the Cloud
102
+ // Plugin ran, which the ordering rule alone cannot prevent.
103
+ //
104
+ // Scoped to the specific paths rather than whole option objects, because a customer adding
105
+ // TypeORM `extra` options or an entity subscriber alongside is legitimate.
106
+ export class PlatformFieldOverwrittenError extends CloudConfigError {
107
+ fields;
108
+ constructor(fields) {
109
+ const detail = formatPlatformFieldDetail(fields);
110
+ super(`Vendure Cloud: ${fields.length} platform-owned field${fields.length === 1 ? " no longer holds the value" : "s no longer hold the values"} the platform set. Refusing to boot.\n\n${detail}\n`);
111
+ this.fields = fields;
112
+ }
113
+ }
114
+ export function assertPlatformFieldsHold(config, values) {
115
+ const overwritten = PLATFORM_OWNED_FIELDS.filter((field) => {
116
+ const expected = values[field.path];
117
+ if (expected === undefined)
118
+ return false;
119
+ return !Object.is(readPath(config, field.path), expected);
120
+ });
121
+ if (overwritten.length > 0) {
122
+ throw new PlatformFieldOverwrittenError(overwritten);
123
+ }
124
+ }
125
+ function copyCustomerConfig(config) {
126
+ const source = config;
127
+ return {
128
+ ...source,
129
+ apiOptions: copyObject(source.apiOptions),
130
+ authOptions: copyObject(source.authOptions),
131
+ assetOptions: copyObject(source.assetOptions),
132
+ systemOptions: copyObject(source.systemOptions),
133
+ jobQueueOptions: copyObject(source.jobQueueOptions),
134
+ schedulerOptions: copyObject(source.schedulerOptions),
135
+ plugins: [...source.plugins],
136
+ };
137
+ }
138
+ function copyObject(value) {
139
+ return typeof value === "object" && value !== null ? { ...value } : {};
140
+ }
141
+ function configurationGuardNamed(name) {
142
+ class ConfigurationGuardPlugin {
143
+ }
144
+ Object.defineProperty(ConfigurationGuardPlugin, "name", { value: name });
145
+ return ConfigurationGuardPlugin;
146
+ }
147
+ //# sourceMappingURL=composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.js","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAA0B,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACnF,OA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AAU,CAAC,MAAM,CAAC,WAAW,CAAC;QAC3C,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC;QAC7C,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC;QAC/C,eAAe,EAAE,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC;QACnD,gBAAgB,EAAE,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACrD,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;KAC7B,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACzE,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAY;IAC3C,MAAM,wBAAwB;KAAG;IACjC,MAAM,CAAC,cAAc,CAAC,wBAAwB,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACzE,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { CloudConfig, FlattenedCloudConfig } from "./cloud-config.js";
2
+ import { type LoadedMigration } from "./migrations.js";
3
+ import type { PluginLike } from "./plugin-attribution.js";
4
+ import { type VendureExtension } from "./vendure-extension.js";
5
+ declare const HANDLE: unique symbol;
6
+ export interface CloudConfigContents {
7
+ readonly config: FlattenedCloudConfig;
8
+ readonly extensions: readonly VendureExtension[];
9
+ readonly extensionOf: ReadonlyMap<PluginLike, VendureExtension>;
10
+ readonly loadMigrations: () => Promise<readonly LoadedMigration[]>;
11
+ }
12
+ export type CloudConfigHandle = {
13
+ readonly [HANDLE]: CloudConfigContents;
14
+ };
15
+ export declare function defineCloudConfig(config: CloudConfig): CloudConfigHandle;
16
+ export declare function isCloudConfigHandle(value: unknown): value is CloudConfigHandle;
17
+ export declare function readCloudConfig(handle: CloudConfigHandle): CloudConfigContents;
18
+ export {};
19
+ //# sourceMappingURL=define-cloud-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-cloud-config.d.ts","sourceRoot":"","sources":["../src/define-cloud-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,KAAK,eAAe,EAA2B,MAAM,iBAAiB,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,KAAK,gBAAgB,EAA4B,MAAM,wBAAwB,CAAC;AAMzF,QAAA,MAAM,MAAM,eAA4C,CAAC;AAMzD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACjD,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAMhE,QAAQ,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAAC;CACpE;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;CACxC,CAAC;AASF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,iBAAiB,CAyBxE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAE9E;AAGD,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,mBAAmB,CAE9E"}
@@ -0,0 +1,47 @@
1
+ import { loadExtensionMigrations } from "./migrations.js";
2
+ import { PlatformFieldSetByConfigError, listPlatformOwnedFieldsSetIn } from "./runtime-backstop.js";
3
+ import { assertNoMissingSecrets } from "./secrets.js";
4
+ import { flattenVendureExtensions } from "./vendure-extension.js";
5
+ // Registered rather than a module-local symbol, so the platform loader can read a handle
6
+ // produced by a different copy of this package. ADR-0043 guards against a second copy of
7
+ // @vendure/core at boot; this makes a second copy of the interface package survivable
8
+ // instead of producing a handle the loader silently fails to recognise.
9
+ const HANDLE = Symbol.for("vendure-cloud.config-handle");
10
+ // Returns an opaque handle rather than a composed VendureConfig. Returning the composed
11
+ // config would hand back every field the input type takes away (ADR-0043), and composing
12
+ // eagerly would mean that merely importing the config file acquires live resources —
13
+ // the database connection's token refresher is a timer.
14
+ //
15
+ // Flattening the extensions is not composition and happens here: it reads the array and
16
+ // acquires nothing.
17
+ export function defineCloudConfig(config) {
18
+ const platformOwned = listPlatformOwnedFieldsSetIn(config);
19
+ if (platformOwned.length > 0) {
20
+ throw new PlatformFieldSetByConfigError(platformOwned);
21
+ }
22
+ // Every `secret()` call in the argument above has already run by the time this does — the
23
+ // object is built before the call. So this is the first point at which the whole declared
24
+ // set is known, which is what lets the failure name every unset secret at once instead of
25
+ // the first one (CLO-411).
26
+ assertNoMissingSecrets();
27
+ const { plugins, extensions, extensionOf } = flattenVendureExtensions(config.plugins ?? []);
28
+ // Composition mutates the configuration object it is given, so the customer's own object
29
+ // is copied rather than written into.
30
+ const flattened = { ...config, plugins: [...plugins] };
31
+ return {
32
+ [HANDLE]: {
33
+ config: flattened,
34
+ extensions,
35
+ extensionOf,
36
+ loadMigrations: () => loadExtensionMigrations(extensions),
37
+ },
38
+ };
39
+ }
40
+ export function isCloudConfigHandle(value) {
41
+ return typeof value === "object" && value !== null && HANDLE in value;
42
+ }
43
+ // The platform entrypoint's accessor. Not part of the surface a customer uses.
44
+ export function readCloudConfig(handle) {
45
+ return handle[HANDLE];
46
+ }
47
+ //# sourceMappingURL=define-cloud-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-cloud-config.js","sourceRoot":"","sources":["../src/define-cloud-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,uBAAuB,EAAE,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AK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC;AACxE,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,eAAe,CAAC,MAAyB;IACvD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare abstract class CloudConfigError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAMA,8BAAsB,gBAAiB,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B"}
package/dist/errors.js ADDED
@@ -0,0 +1,13 @@
1
+ // Base for the refusals this package raises. `name` is taken from the constructor actually
2
+ // invoked, so renaming a subclass cannot leave a stale string behind it.
3
+ //
4
+ // This reads the class name at runtime, so a build that mangles class names would produce a
5
+ // mangled `name`. `errors.test.ts` asserts each name matches its class and would fail such a
6
+ // build rather than shipping errors a customer cannot search for.
7
+ export class CloudConfigError extends Error {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = new.target.name;
11
+ }
12
+ }
13
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,yEAAyE;AACzE,EAAE;AACF,4FAA4F;AAC5F,6FAA6F;AAC7F,kEAAkE;AAClE,MAAM,OAAgB,gBAAiB,SAAQ,KAAK;IAClD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;IAC9B,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ export { defineCloudConfig, isCloudConfigHandle, readCloudConfig, type CloudConfigContents, type CloudConfigHandle, } from "./define-cloud-config.js";
2
+ export { DuplicateVendureExtensionIdError, InvalidVendureExtensionError, defineVendureExtension, isVendureExtension, resolveExtensionMigrations, type CloudPluginEntry, type VendureExtension, type VendureExtensionInput, type VendurePluginEntry, } from "./vendure-extension.js";
3
+ export { InvalidMigrationNameError, MigrationGlobMatchedNoMigrationsError, MigrationNotConstructibleError, type LoadedMigration, type MigrationClass, type MigrationLike, } from "./migrations.js";
4
+ export type { CloudApiOptions, CloudAssetOptions, CloudAuthOptions, CloudConfig, CloudJobQueueOptions, CloudSchedulerOptions, CloudSystemOptions, FlattenedCloudConfig, PlatformOwned, } from "./cloud-config.js";
5
+ export { PLATFORM_OWNED_FIELDS, findPlatformOwnedField, type PlatformOwnedField, type PlatformOwnedFieldPath, } from "./platform-fields.js";
6
+ export { PlatformFieldSetByConfigError, listPlatformOwnedFieldsSetIn, } from "./runtime-backstop.js";
7
+ export { PlatformFieldSetByPluginError, PLUGIN_CONFIGURATION_METADATA_KEY, assertNoCustomerPluginWroteAPlatformField, pluginName, recordPlatformFieldWrites, type ExtensionOfPlugin, type PendingPlatformFieldWrites, type PlatformFieldWrite, type PluginConstructor, type PluginLike, } from "./plugin-attribution.js";
8
+ export { CLOUD_PLUGIN_COMPATIBILITY, composeCloudConfig, PlatformFieldOverwrittenError, applyPlatformFields, assertPlatformFieldsHold, hoistCloudPluginsLast, platformDefaultFieldValues, type ComposeCloudConfigOptions, type PlatformFieldValues, } from "./composition.js";
9
+ export { CLOUD_DASHBOARD_PLUGIN_KIND, CloudDashboardPlugin, DEFAULT_DASHBOARD_ROUTE, InvalidDashboardRouteError, PLATFORM_SUPPLIED_DASHBOARD_OPTIONS, resolveDashboardSettings, type CloudDashboardPluginOptions, type CloudDashboardSettings, } from "./cloud-dashboard-plugin.js";
10
+ export { declareCloudPlugin, isCloudPluginDeclaration, listCloudPluginDeclarations, readCloudPluginDeclaration, type CloudPluginDeclaration, } from "./cloud-plugin-declaration.js";
11
+ export { SUPERSEDED_PLUGINS, SupersededPluginDeclaredError, assertNoSupersededPluginDeclared, findSupersededPlugin, type SupersededPlugin, type SupersededPluginDeclaration, } from "./superseded-plugins.js";
12
+ export { MissingSecretsError, assertNoMissingSecrets, listDeclaredSecrets, listMissingSecrets, redactSecrets, secret, } from "./secrets.js";
13
+ export { installOutboundHostCheck, type OutboundHostCheckOptions, type UndeclaredHostReport, type UndeclaredHostReporter, } from "./outbound-hosts.js";
14
+ export { CloudConfigError } from "./errors.js";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,gCAAgC,EAChC,4BAA4B,EAC5B,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,EACzB,qCAAqC,EACrC,8BAA8B,EAC9B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,EACjC,yCAAyC,EACzC,UAAU,EACV,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,UAAU,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,6BAA6B,EAC7B,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,mCAAmC,EACnC,wBAAwB,EACxB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,GAC5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,gCAAgC,EAChC,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,GACjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,MAAM,GACP,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ export { defineCloudConfig, isCloudConfigHandle, readCloudConfig, } from "./define-cloud-config.js";
2
+ export { DuplicateVendureExtensionIdError, InvalidVendureExtensionError, defineVendureExtension, isVendureExtension, resolveExtensionMigrations, } from "./vendure-extension.js";
3
+ export { InvalidMigrationNameError, MigrationGlobMatchedNoMigrationsError, MigrationNotConstructibleError, } from "./migrations.js";
4
+ export { PLATFORM_OWNED_FIELDS, findPlatformOwnedField, } from "./platform-fields.js";
5
+ export { PlatformFieldSetByConfigError, listPlatformOwnedFieldsSetIn, } from "./runtime-backstop.js";
6
+ export { PlatformFieldSetByPluginError, PLUGIN_CONFIGURATION_METADATA_KEY, assertNoCustomerPluginWroteAPlatformField, pluginName, recordPlatformFieldWrites, } from "./plugin-attribution.js";
7
+ export { CLOUD_PLUGIN_COMPATIBILITY, composeCloudConfig, PlatformFieldOverwrittenError, applyPlatformFields, assertPlatformFieldsHold, hoistCloudPluginsLast, platformDefaultFieldValues, } from "./composition.js";
8
+ export { CLOUD_DASHBOARD_PLUGIN_KIND, CloudDashboardPlugin, DEFAULT_DASHBOARD_ROUTE, InvalidDashboardRouteError, PLATFORM_SUPPLIED_DASHBOARD_OPTIONS, resolveDashboardSettings, } from "./cloud-dashboard-plugin.js";
9
+ export { declareCloudPlugin, isCloudPluginDeclaration, listCloudPluginDeclarations, readCloudPluginDeclaration, } from "./cloud-plugin-declaration.js";
10
+ export { SUPERSEDED_PLUGINS, SupersededPluginDeclaredError, assertNoSupersededPluginDeclared, findSupersededPlugin, } from "./superseded-plugins.js";
11
+ export { MissingSecretsError, assertNoMissingSecrets, listDeclaredSecrets, listMissingSecrets, redactSecrets, secret, } from "./secrets.js";
12
+ export { installOutboundHostCheck, } from "./outbound-hosts.js";
13
+ export { CloudConfigError } from "./errors.js";
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,GAGhB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,gCAAgC,EAChC,4BAA4B,EAC5B,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,GAK3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,EACzB,qCAAqC,EACrC,8BAA8B,GAI/B,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAGvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,EACjC,yCAAyC,EACzC,UAAU,EACV,yBAAyB,GAM1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,6BAA6B,EAC7B,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,GAG3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,mCAAmC,EACnC,wBAAwB,GAGzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,GAE3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,gCAAgC,EAChC,oBAAoB,GAGrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,MAAM,GACP,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,wBAAwB,GAIzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { CloudConfigError } from "./errors.js";
2
+ import { type VendureExtension } from "./vendure-extension.js";
3
+ export interface MigrationLike {
4
+ readonly name?: string;
5
+ }
6
+ export type MigrationClass = new () => MigrationLike;
7
+ export interface LoadedMigration {
8
+ readonly migration: MigrationClass;
9
+ readonly name: string;
10
+ readonly timestamp: number;
11
+ readonly file: string;
12
+ readonly extension: VendureExtension;
13
+ }
14
+ export declare class MigrationGlobMatchedNoMigrationsError extends CloudConfigError {
15
+ readonly extensionId: string;
16
+ readonly pattern: string;
17
+ readonly resolved: string;
18
+ readonly matchedFiles: readonly string[];
19
+ constructor(extensionId: string, pattern: string, resolved: string, matchedFiles: string[]);
20
+ }
21
+ export declare class MigrationNotConstructibleError extends CloudConfigError {
22
+ readonly extensionId: string;
23
+ readonly exportName: string;
24
+ constructor(extensionId: string, exportName: string, file: string, cause: unknown);
25
+ }
26
+ export declare class InvalidMigrationNameError extends CloudConfigError {
27
+ readonly extensionId: string;
28
+ readonly migrationName: string;
29
+ constructor(extensionId: string, migrationName: string, file: string);
30
+ }
31
+ export declare function loadExtensionMigrations(extensions: readonly VendureExtension[]): Promise<readonly LoadedMigration[]>;
32
+ //# sourceMappingURL=migrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,KAAK,gBAAgB,EAAwB,MAAM,wBAAwB,CAAC;AAQrF,MAAM,WAAW,aAAa;IAK5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,aAAa,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IAKnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAGtB,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;CACtC;AAeD,qBAAa,qCAAsC,SAAQ,gBAAgB;IACzE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;gBAE7B,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE;CAuB3F;AAeD,qBAAa,8BAA+B,SAAQ,gBAAgB;IAClE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAalF;AAED,qBAAa,yBAA0B,SAAQ,gBAAgB;IAC7D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;gBAEnB,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAarE;AAsID,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,SAAS,gBAAgB,EAAE,GACtC,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAkCrC"}
@@ -0,0 +1,250 @@
1
+ import { pathToFileURL } from "node:url";
2
+ // The second runtime dependency of a package customers install, so: Node's own `fs.glob`
3
+ // landed in 22.2.0 and is absent from Node 20, which `SUPPORTED_NODE_MAJORS` offers as a Cloud
4
+ // Runtime and which is this package's `engines` floor. Hand-rolling the matcher is worse than
5
+ // a dependency, because a glob that fails to match is a migration that never runs and that
6
+ // surfaces as schema drift on a customer's database rather than as an error. tinyglobby over
7
+ // `fast-glob` or `glob` for size — three packages against roughly ten. It also extends the
8
+ // module graph ADR-0049 bars top-level await from, which the CommonJS half of
9
+ // `managed-build.test.ts` is what checks.
10
+ import { glob } from "tinyglobby";
11
+ import { CloudConfigError } from "./errors.js";
12
+ import { resolveMigrationGlob } from "./vendure-extension.js";
13
+ // Any message here long enough to exceed `published-output.test.ts`'s emitted-line cap — which
14
+ // reads a long line as evidence that the build minified the package — is written as a line per
15
+ // line and joined, because biome's `useTemplate` refuses the other way of breaking one up. The
16
+ // trailing empty entry is the message's own closing newline. Shorter messages elsewhere in this
17
+ // package stay single template literals rather than being converted to match.
18
+ function message(lines) {
19
+ return [...lines, ""].join("\n");
20
+ }
21
+ // Raised for a glob that contributed no migrations, which is two different states and used to
22
+ // be reported as one. A glob matching nothing at all is a wrong path; a glob matching files
23
+ // none of which is a migration is a glob that is too wide. Telling a customer "it matches
24
+ // nothing" in the second case sends them looking for a typo that is not there.
25
+ export class MigrationGlobMatchedNoMigrationsError extends CloudConfigError {
26
+ extensionId;
27
+ pattern;
28
+ resolved;
29
+ matchedFiles;
30
+ constructor(extensionId, pattern, resolved, matchedFiles) {
31
+ const declared = `Vendure Cloud: the Vendure Extension "${extensionId}" declares the migrations glob "${pattern}"`;
32
+ const resolvedLine = ` Resolved against the file that declared the extension, it reads "${resolved}".`;
33
+ super(matchedFiles.length === 0
34
+ ? message([
35
+ `${declared}, and it matches nothing.`,
36
+ resolvedLine,
37
+ " A glob that matches nothing is far more often a path that is wrong — a directory the build does not emit, or an extension declaration copied between files — than an extension with no migrations.",
38
+ " Drop the entry if there are none.",
39
+ ])
40
+ : message([
41
+ `${declared}, and none of the ${matchedFiles.length} files it matches is a migration.`,
42
+ resolvedLine,
43
+ ` A migration is a ${MIGRATION_FILE_SUFFIXES.join(", ")} file that is not a declaration file. Matched: ${describeFiles(matchedFiles)}`,
44
+ ' Narrow the glob to what the build emits, such as "./migrations/*.js".',
45
+ ]));
46
+ this.extensionId = extensionId;
47
+ this.pattern = pattern;
48
+ this.resolved = resolved;
49
+ this.matchedFiles = matchedFiles;
50
+ }
51
+ }
52
+ // Capped, because a wide glob over a build output directory can match a great many files and
53
+ // an error message that prints all of them is not one anybody reads.
54
+ function describeFiles(files) {
55
+ const shown = files.slice(0, 3).join(", ");
56
+ return files.length > 3 ? `${shown}, and ${files.length - 3} more` : shown;
57
+ }
58
+ // `isMigrationClass` takes every exported function, because that is as far as a runtime value
59
+ // can be read and is what TypeORM does. Not every function can be constructed: an arrow
60
+ // function exported from a migrations file — a shared helper, which is exactly what people
61
+ // leave in a migrations directory — throws `TypeError: X is not a constructor`. Without this
62
+ // that reaches the customer raw, naming neither the extension nor the file, which is the one
63
+ // failure path here that had no message of its own.
64
+ export class MigrationNotConstructibleError extends CloudConfigError {
65
+ extensionId;
66
+ exportName;
67
+ constructor(extensionId, exportName, file, cause) {
68
+ super(message([
69
+ `Vendure Cloud: the Vendure Extension "${extensionId}" matched an export named "${exportName}" that is not a migration class.`,
70
+ ` Loaded from ${file}.`,
71
+ " A migrations glob reads every exported function in a file it matches as a migration, so an arrow function or any other value that cannot be constructed fails here.",
72
+ " Move helpers out of the directory the glob covers, or narrow the glob to the migrations themselves.",
73
+ ]));
74
+ this.extensionId = extensionId;
75
+ this.exportName = exportName;
76
+ this.cause = cause;
77
+ }
78
+ }
79
+ export class InvalidMigrationNameError extends CloudConfigError {
80
+ extensionId;
81
+ migrationName;
82
+ constructor(extensionId, migrationName, file) {
83
+ super(message([
84
+ `Vendure Cloud: the Vendure Extension "${extensionId}" declares a migration named "${migrationName}", which does not end in a timestamp.`,
85
+ ` Loaded from ${file}.`,
86
+ " TypeORM reads a migration's timestamp out of the last 13 characters of its name and orders the whole set by it, so a name without one cannot be placed.",
87
+ " Generate the migration with Vendure's own tooling, which appends the timestamp, or append it by hand.",
88
+ " A file matched by a migrations glob that exports a class which is not a migration reaches this message too, because every exported class in it is read as one.",
89
+ ]));
90
+ this.extensionId = extensionId;
91
+ this.migrationName = migrationName;
92
+ }
93
+ }
94
+ // TypeORM's own list, from `importClassesFromDirectories` in 0.3.30: a glob's matches are
95
+ // filtered to these suffixes before anything is imported. Restated because the glob is
96
+ // resolved here now and never reaches that function, and a customer who wrote
97
+ // `./migrations/*` would otherwise have us importing the source map beside each migration.
98
+ const MIGRATION_FILE_SUFFIXES = [".js", ".mjs", ".cjs", ".ts", ".mts", ".cts"];
99
+ // TypeORM drops `.d.ts` and does not consider the other two spellings. A declaration file is
100
+ // never a migration whichever suffix it carries, so all three are dropped here.
101
+ const DECLARATION_FILE_SUFFIXES = [".d.ts", ".d.mts", ".d.cts"];
102
+ function isMigrationFile(file) {
103
+ if (DECLARATION_FILE_SUFFIXES.some((suffix) => file.endsWith(suffix)))
104
+ return false;
105
+ return MIGRATION_FILE_SUFFIXES.some((suffix) => file.endsWith(suffix));
106
+ }
107
+ // Every function is taken, which is what TypeORM does and is as far as either of us can tell
108
+ // from a value at runtime. A migrations file that also exports a helper has that helper read
109
+ // as a migration, and which refusal it reaches depends on what kind of function it is: a
110
+ // `function` declaration constructs and fails `InvalidMigrationNameError` on its name, and an
111
+ // arrow function cannot be constructed at all and fails `MigrationNotConstructibleError`.
112
+ function isMigrationClass(value) {
113
+ return typeof value === "function";
114
+ }
115
+ // The walk `importClassesFromDirectories` does over what a migration file exported. It has to
116
+ // be a walk rather than a read of the module's named exports, because a file emitted as
117
+ // CommonJS is seen through `import()` as a namespace whose `default` is the whole
118
+ // `module.exports` object, so its classes sit one level down — and are then reachable twice,
119
+ // once through `default` and once through the named re-export Node synthesizes. `seen`
120
+ // collapses that second sighting, and terminates on an export that refers to itself, which
121
+ // TypeORM's version does not.
122
+ function collectMigrationClasses(exported, seen, into) {
123
+ if (isMigrationClass(exported)) {
124
+ if (seen.has(exported))
125
+ return;
126
+ seen.add(exported);
127
+ into.push(exported);
128
+ return;
129
+ }
130
+ if (typeof exported !== "object" || exported === null || seen.has(exported))
131
+ return;
132
+ seen.add(exported);
133
+ // Arrays included: `Object.values` yields their elements, so `export default [A, B]` is
134
+ // read without a branch of its own.
135
+ for (const value of Object.values(exported)) {
136
+ collectMigrationClasses(value, seen, into);
137
+ }
138
+ }
139
+ // `MigrationExecutor.getMigrations` reads `migration.name || migration.constructor.name` from
140
+ // an *instance* — `DataSource` constructs every migration class before the executor sees one
141
+ // — and parses the timestamp out of the last 13 characters of that string. Both are mirrored
142
+ // rather than approximated. Reading the static class name instead is the same answer for
143
+ // every migration that does not declare `name`, and a different one for every migration that
144
+ // does, and in that case the ledger, this order and the ownership snapshot would disagree
145
+ // about what the migration is called.
146
+ //
147
+ // This is a second construction rather than a free one: TypeORM builds its own instance of the
148
+ // same class when the DataSource starts, so a migration whose constructor has side effects runs
149
+ // them twice. Migration constructors are empty in everything Vendure's own tooling generates,
150
+ // and the alternative is an identity that can disagree with the ledger, which is worse.
151
+ function identify(migration, extension, file) {
152
+ let instance;
153
+ try {
154
+ instance = new migration();
155
+ }
156
+ catch (error) {
157
+ throw new MigrationNotConstructibleError(extension.id, migration.name, file, error);
158
+ }
159
+ const name = instance.name || instance.constructor.name;
160
+ const timestamp = Number.parseInt(name.slice(-13), 10);
161
+ // TypeORM's guard is `!timestamp || isNaN(timestamp)`: it rejects a name that parses to
162
+ // nothing and a name that parses to zero. `<= 0` is the same two cases, because a class
163
+ // name cannot contain a minus sign for `parseInt` to read.
164
+ if (Number.isNaN(timestamp) || timestamp <= 0) {
165
+ throw new InvalidMigrationNameError(extension.id, name, file);
166
+ }
167
+ return { name, timestamp };
168
+ }
169
+ async function loadOneExtension(extension) {
170
+ const loaded = [];
171
+ const importedFiles = new Set();
172
+ const seenExports = new Set();
173
+ for (const pattern of extension.migrations) {
174
+ const resolved = resolveMigrationGlob(extension, pattern);
175
+ // `expandDirectories` off, so a glob means exactly what the customer wrote instead of
176
+ // silently acquiring a `/**/*` when it happens to name a directory.
177
+ // Sorted so that neither what gets imported first nor what an error message lists depends
178
+ // on the order the directory happened to be walked in. The sort that decides execution is
179
+ // the one in `loadExtensionMigrations`; this one only keeps the steps before it
180
+ // reproducible.
181
+ const matched = (await glob(resolved, { absolute: true, onlyFiles: true, expandDirectories: false })).sort();
182
+ const files = matched.filter(isMigrationFile);
183
+ // `matched` rather than `files`, so the message can tell a wrong path apart from a glob
184
+ // whose every match was filtered out as not being a migration file.
185
+ if (files.length === 0) {
186
+ throw new MigrationGlobMatchedNoMigrationsError(extension.id, pattern, resolved, matched);
187
+ }
188
+ for (const file of files) {
189
+ // A second glob in the same extension matching a file the first already matched adds
190
+ // nothing. Across extensions the file is imported once by the module cache but claimed
191
+ // twice, which is a real ownership collision rather than an overlap, and is left for
192
+ // TypeORM to reject by name.
193
+ if (importedFiles.has(file))
194
+ continue;
195
+ importedFiles.add(file);
196
+ const exported = await import(pathToFileURL(file).href);
197
+ const classes = [];
198
+ collectMigrationClasses(exported, seenExports, classes);
199
+ for (const migration of classes) {
200
+ const { name, timestamp } = identify(migration, extension, file);
201
+ loaded.push({ migration, name, timestamp, file, extension });
202
+ }
203
+ }
204
+ }
205
+ return loaded;
206
+ }
207
+ // ADR-0048 part 2. TypeORM sorts the whole migration set by timestamp and
208
+ // `Array.prototype.sort` is stable, so migrations carrying equal timestamps run in whatever
209
+ // order the array it was handed holds them. Today that array comes from `glob.sync`, which
210
+ // does not sort, so a tie resolves by filesystem walk order and can differ between the
211
+ // customer's machine and the managed build. The order below is a value computed here instead.
212
+ //
213
+ // **Ordering across extensions is not a contract and this does not make it one.** An
214
+ // extension cannot declare that it must migrate after another; extensions own their own
215
+ // tables and the coupling is unsupported. The keys exist so a tie resolves the same way
216
+ // everywhere, not so a dependency can be expressed.
217
+ export async function loadExtensionMigrations(extensions) {
218
+ const found = [];
219
+ // Serial rather than concurrent. The work is a handful of directory reads and the module
220
+ // cache absorbs the rest, and a concurrent version would have to sort its results back into
221
+ // declaration order before the tie-break below could read it.
222
+ for (const [declarationOrder, extension] of extensions.entries()) {
223
+ for (const loaded of await loadOneExtension(extension)) {
224
+ found.push({ loaded, declarationOrder });
225
+ }
226
+ }
227
+ found.sort((a, b) => {
228
+ if (a.loaded.timestamp !== b.loaded.timestamp) {
229
+ return a.loaded.timestamp - b.loaded.timestamp;
230
+ }
231
+ // Not load-bearing as this function is written: the array is built by walking the
232
+ // extensions in declaration order and `sort` is stable, so the key agrees with the order
233
+ // the entries are already in. It is written out because ADR-0048 makes the order a value
234
+ // we computed rather than one we inherited, and because loading the extensions
235
+ // concurrently — the obvious future change to the loop above — would take the input order
236
+ // away without any test noticing.
237
+ if (a.declarationOrder !== b.declarationOrder) {
238
+ return a.declarationOrder - b.declarationOrder;
239
+ }
240
+ // Codepoint comparison rather than `localeCompare`, which reads the runtime's locale and
241
+ // would order the same two migrations differently on two machines — the one thing this
242
+ // whole function exists to stop. A tie that survives all three keys is two migrations
243
+ // with one ledger identity, which TypeORM's own duplicate check rejects by name.
244
+ if (a.loaded.name < b.loaded.name)
245
+ return -1;
246
+ return a.loaded.name > b.loaded.name ? 1 : 0;
247
+ });
248
+ return found.map((entry) => entry.loaded);
249
+ }
250
+ //# sourceMappingURL=migrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrations.js","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,yFAAyF;AACzF,+FAA+F;AAC/F,8FAA8F;AAC9F,2FAA2F;AAC3F,6FAA6F;AAC7F,2FAA2F;AAC3F,8EAA8E;AAC9E,0CAA0C;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAyB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAgCrF,+FAA+F;AAC/F,+FAA+F;AAC/F,+FAA+F;AAC/F,gGAAgG;AAChG,8EAA8E;AAC9E,SAAS,OAAO,CAAC,KAAe;IAC9B,OAAO,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,8FAA8F;AAC9F,4FAA4F;AAC5F,0FAA0F;AAC1F,+EAA+E;AAC/E,MAAM,OAAO,qCAAsC,SAAQ,gBAAgB;IAChE,WAAW,CAAS;IACpB,OAAO,CAAS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