@artus/core
Advanced tools
Comparing version 1.0.0-beta.5 to 1.0.0-beta.6
@@ -6,4 +6,3 @@ import 'reflect-metadata'; | ||
import { LoaderFactory, Manifest } from './loader'; | ||
import { Application, ApplicationInitOptions } from './types'; | ||
import Trigger from './trigger'; | ||
import { Application, ApplicationInitOptions, TriggerType } from './types'; | ||
import ConfigurationHandler from './configuration'; | ||
@@ -22,3 +21,3 @@ import { Logger } from './logger'; | ||
get packages(): Record<string, any>; | ||
get trigger(): Trigger; | ||
get trigger(): TriggerType; | ||
get exceptionHandler(): ExceptionHandler; | ||
@@ -25,0 +24,0 @@ get configurationHandler(): ConfigurationHandler; |
@@ -15,3 +15,3 @@ "use strict"; | ||
let importPath = (_a = configItem.path) !== null && _a !== void 0 ? _a : ''; | ||
if (!importPath && configItem.package) { | ||
if (configItem.package) { | ||
importPath = path_1.default.resolve(require.resolve(`${configItem.package}/package.json`), '..'); | ||
@@ -18,0 +18,0 @@ } |
@@ -1,3 +0,4 @@ | ||
import { Input, Context, MiddlewareInput } from '@artus/pipeline'; | ||
export default class Trigger { | ||
import { Input, Context, MiddlewareInput, Output } from '@artus/pipeline'; | ||
import { TriggerType } from '../types'; | ||
export default class Trigger implements TriggerType { | ||
private pipeline; | ||
@@ -7,4 +8,4 @@ private app; | ||
use(middleware: MiddlewareInput): Promise<void>; | ||
initContext(input: Input): Promise<Context>; | ||
startPipeline(input?: Input): Promise<Context>; | ||
initContext(input?: Input, output?: Output): Promise<Context>; | ||
startPipeline(ctx: Context): Promise<void>; | ||
} |
@@ -24,11 +24,9 @@ "use strict"; | ||
} | ||
async initContext(input) { | ||
const ctx = new pipeline_1.Context(input, new pipeline_1.Output()); | ||
async initContext(input = new pipeline_1.Input(), output = new pipeline_1.Output()) { | ||
const ctx = new pipeline_1.Context(input, output); | ||
ctx.container = new injection_1.ExecutionContainer(ctx, this.app.getContainer()); | ||
return ctx; | ||
} | ||
async startPipeline(input = new pipeline_1.Input()) { | ||
const ctx = await this.initContext(input); | ||
async startPipeline(ctx) { | ||
await this.pipeline.run(ctx); | ||
return ctx; | ||
} | ||
@@ -35,0 +33,0 @@ }; |
import { Container } from '@artus/injection'; | ||
import { BaseContext } from '@artus/pipeline'; | ||
import { HookFunction } from './lifecycle'; | ||
import { Manifest } from './loader'; | ||
import Trigger from './trigger'; | ||
export interface ApplicationLifecycle { | ||
@@ -19,3 +19,3 @@ configWillLoad?: HookFunction; | ||
config?: Record<string, any>; | ||
get trigger(): Trigger; | ||
get trigger(): TriggerType; | ||
load(manifest: Manifest): Promise<this>; | ||
@@ -26,2 +26,7 @@ run(): Promise<void>; | ||
} | ||
export interface TriggerType { | ||
use(...args: any[]): Promise<void>; | ||
initContext(...args: any[]): Promise<BaseContext>; | ||
startPipeline(...args: any[]): Promise<void>; | ||
} | ||
export * from './loader/types'; |
{ | ||
"name": "@artus/core", | ||
"version": "1.0.0-beta.5", | ||
"version": "1.0.0-beta.6", | ||
"description": "Core package of Artus", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118107
2750