@artus/pipeline
Advanced tools
Comparing version 0.1.2 to 0.1.4
{ | ||
"name": "@artus/pipeline", | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"main": "dist/index.js", | ||
@@ -19,2 +19,3 @@ "scripts": { | ||
"dependencies": { | ||
"@artus/injection": "^0.1.1", | ||
"tslib": "^2.3.1" | ||
@@ -21,0 +22,0 @@ }, |
@@ -0,6 +1,8 @@ | ||
import { Container, ExecutionContainer } from '@artus/injection'; | ||
import { | ||
BaseContext, BaseInput, BaseOutput, | ||
ContextStorage, ParamsDictionary, Next | ||
} from "./types"; | ||
ContextStorage, ParamsDictionary, Next, ContextInitOptions | ||
} from './types'; | ||
const DEFAULT_EXECUTION_CONTAINER_NAME = 'artus#execution'; | ||
const ContextStorageSymbol = Symbol('ARTUS::ContextStorage'); | ||
@@ -33,14 +35,20 @@ | ||
public output: BaseOutput = new Output(); | ||
private stogrageMap = new Map<string, ContextStorage<any>>(); | ||
private storageMap = new Map<string, ContextStorage<any>>(); | ||
protected container: ExecutionContainer; | ||
constructor(input?: Input, output?: Output) { | ||
constructor(input?: Input, output?: Output, opts?: ContextInitOptions) { | ||
this.input = input ?? this.input; | ||
this.output = output ?? this.output; | ||
this.container = new ExecutionContainer( | ||
this, | ||
opts?.parentContainer ?? new Container(DEFAULT_EXECUTION_CONTAINER_NAME) | ||
); | ||
} | ||
namespace(namespace: string): ContextStorage<any> { | ||
let storage = this.stogrageMap.get(namespace); | ||
let storage = this.storageMap.get(namespace); | ||
if (!storage) { | ||
storage = new Storage(); | ||
this.stogrageMap.set(namespace, storage); | ||
this.storageMap.set(namespace, storage); | ||
} | ||
@@ -47,0 +55,0 @@ |
@@ -0,1 +1,3 @@ | ||
import { Container } from '@artus/injection'; | ||
export interface ParamsDictionary { | ||
@@ -19,2 +21,6 @@ [key: string]: any; | ||
export interface ContextInitOptions { | ||
parentContainer?: Container; | ||
} | ||
export type ContextStorage<T> = { | ||
@@ -21,0 +27,0 @@ set: (value: T, key?: string | symbol) => void, |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
11373
2
11
267
1
+ Added@artus/injection@^0.1.1
+ Added@artus/injection@0.1.3(transitive)