import { DynamicModule, INestApplication } from '@nestjs/common'; import { NestApplicationContextOptions } from '@nestjs/common/interfaces/nest-application-context-options.interface'; import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface'; import { Type } from '@vendure/common/lib/shared-types'; import { RuntimeVendureConfig, VendureConfig } from './config/vendure-config'; import { VendureWorker } from './worker/vendure-worker'; export type VendureBootstrapFunction = (config: VendureConfig) => Promise; /** * @description * Additional options that can be used to configure the bootstrap process of the * Vendure server. * * @since 2.2.0 * @docsCategory common * @docsPage bootstrap */ export interface BootstrapOptions { /** * @description * These options get passed directly to the `NestFactory.create()` method. */ nestApplicationOptions?: NestApplicationOptions; /** * @description * By default, if a plugin specifies a compatibility range which does not include the current * Vendure version, the bootstrap process will fail. This option allows you to ignore compatibility * errors for specific plugins. * * This setting should be used with caution, only if you are sure that the plugin will still * work as expected with the current version of Vendure. * * @example * ```ts * import { bootstrap } from '\@vendure/core'; * import { config } from './vendure-config'; * import { MyPlugin } from './plugins/my-plugin'; * * bootstrap(config, { * ignoreCompatibilityErrorsForPlugins: [MyPlugin], * }); * ``` * * @default [] * @since 3.1.0 */ ignoreCompatibilityErrorsForPlugins?: Array>; } /** * @description * Additional options that can be used to configure the bootstrap process of the * Vendure worker. * * @since 2.2.0 * @docsCategory worker * @docsPage bootstrapWorker */ export interface BootstrapWorkerOptions { /** * @description * These options get passed directly to the `NestFactory.createApplicationContext` method. */ nestApplicationContextOptions?: NestApplicationContextOptions; /** * @description * See the `ignoreCompatibilityErrorsForPlugins` option in {@link BootstrapOptions}. * * @default [] * @since 3.1.0 */ ignoreCompatibilityErrorsForPlugins?: Array>; } /** * @description * Bootstraps the Vendure server. This is the entry point to the application. * * @example * ```ts * import { bootstrap } from '\@vendure/core'; * import { config } from './vendure-config'; * * bootstrap(config).catch(err => { * console.log(err); * process.exit(1); * }); * ``` * * ### Passing additional options * * Since v2.2.0, you can pass additional options to the NestJs application via the `options` parameter. * For example, to integrate with the [Nest Devtools](https://docs.nestjs.com/devtools/overview), you need to * pass the `snapshot` option: * * ```ts * import { bootstrap } from '\@vendure/core'; * import { config } from './vendure-config'; * * bootstrap(config, { * nestApplicationOptions: { // [!code highlight] * snapshot: true, // [!code highlight] * } // [!code highlight] * }).catch(err => { * console.log(err); * process.exit(1); * }); * ``` * * ### Ignoring compatibility errors for plugins * * Since v3.1.0, you can ignore compatibility errors for specific plugins by passing the `ignoreCompatibilityErrorsForPlugins` option. * * 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. * * @example * ```ts * import { bootstrap } from '\@vendure/core'; * import { config } from './vendure-config'; * import { MyPlugin } from './plugins/my-plugin'; * * bootstrap(config, { * // Let's say that `MyPlugin` is not yet compatible with the current version of Vendure * // but we know that it will still work as expected, and we are not able to publish * // a new version of the plugin right now. * ignoreCompatibilityErrorsForPlugins: [MyPlugin], * }); * ``` * * @docsCategory common * @docsPage bootstrap * @docsWeight 0 * */ export declare function bootstrap(userConfig: Partial, options?: BootstrapOptions): Promise; /** * @description * Bootstraps a Vendure worker. Resolves to a {@link VendureWorker} object containing a reference to the underlying * NestJs [standalone application](https://docs.nestjs.com/standalone-applications) as well as convenience * methods for starting the job queue and health check server. * * Read more about the [Vendure Worker](/developer-guide/worker-job-queue/). * * @example * ```ts * import { bootstrapWorker } from '\@vendure/core'; * import { config } from './vendure-config'; * * bootstrapWorker(config) * .then(worker => worker.startJobQueue()) * .then(worker => worker.startHealthCheckServer({ port: 3020 })) * .catch(err => { * console.log(err); * process.exit(1); * }); * ``` * @docsCategory worker * @docsPage bootstrapWorker * @docsWeight 0 * */ export declare function bootstrapWorker(userConfig: Partial, options?: BootstrapWorkerOptions): Promise; /** * Setting the global config must be done prior to loading the AppModule. */ export declare function preBootstrapConfig(userConfig: Partial): Promise>; /** * Run the configuration functions of all plugins and return the final config object. */ export declare function runPluginConfigurations(config: RuntimeVendureConfig): Promise; /** * Returns an array of core entities and any additional entities defined in plugins. */ export declare function getAllEntities(userConfig: Partial): Array>; export declare function configureSessionCookies(app: INestApplication, userConfig: Readonly): void;