@sidequest/engine
Version:
@sidequest/engine is the core engine of SideQuest, a distributed background job processing system for Node.js and TypeScript.
28 lines (25 loc) • 1.16 kB
TypeScript
import { JobData, JobResult } from '@sidequest/core';
import { EngineConfig } from '../engine.js';
/**
* Runs a job by dynamically importing its script and executing the specified class.
* @param jobData The job data containing script and class information
* @param config The non-nullable engine configuration.
* @returns A promise resolving to the job result.
*/
declare function run({ jobData, config }: {
jobData: JobData;
config: EngineConfig;
}): Promise<JobResult>;
/**
* Injects the provided Sidequest engine configuration into the job script.
*
* Dynamically imports the `Sidequest` module and applies the configuration,
* ensuring migrations are skipped. Logs the process and handles errors gracefully,
* allowing execution to proceed even if configuration injection fails.
*
* @param config - The engine configuration object to inject into Sidequest.
* @returns A promise that resolves to `true` if the configuration was injected successfully,
* or `false` if an error occurred.
*/
declare function injectSidequestConfig(config: EngineConfig): Promise<boolean>;
export { run as default, injectSidequestConfig };