🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@artus/pipeline

Package Overview
Dependencies
Maintainers
7
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@artus/pipeline - npm Package Compare versions

Comparing version

to
0.2.0

.github/workflows/npm-publish.yml

11

dist/base.d.ts

@@ -1,3 +0,3 @@

import { ExecutionContainer } from '@artus/injection';
import { BaseContext, BaseInput, BaseOutput, ContextStorage, ParamsDictionary, Next, ContextInitOptions } from './types';
import type { ExecutionContainer } from '@artus/injection';
import { BaseContext, BaseInput, BaseOutput, ContextStorage, ParamsDictionary, Next } from './types';
export declare class Input implements BaseInput {

@@ -17,6 +17,9 @@ params: ParamsDictionary;

output: BaseOutput;
container: ExecutionContainer;
private _container;
private storageMap;
constructor(input?: Input, output?: Output, opts?: ContextInitOptions);
constructor(input?: Input, output?: Output);
get container(): ExecutionContainer | null;
set container(container: ExecutionContainer | null);
namespace(namespace: string): ContextStorage<any>;
restore(): void;
}

@@ -23,0 +26,0 @@ export declare type Middleware = (context: Context, next: Next) => void;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Context = exports.Storage = exports.Output = exports.Input = void 0;
const injection_1 = require("@artus/injection");
const DEFAULT_EXECUTION_CONTAINER_NAME = 'artus#execution';
const ContextStorageSymbol = Symbol('ARTUS::ContextStorage');

@@ -34,4 +32,3 @@ class Input {

class Context {
constructor(input, output, opts) {
var _a;
constructor(input, output) {
this.input = new Input();

@@ -42,4 +39,9 @@ this.output = new Output();

this.output = output !== null && output !== void 0 ? output : this.output;
this.container = new injection_1.ExecutionContainer(this, (_a = opts === null || opts === void 0 ? void 0 : opts.parentContainer) !== null && _a !== void 0 ? _a : new injection_1.Container(DEFAULT_EXECUTION_CONTAINER_NAME));
}
get container() {
return this._container;
}
set container(container) {
this._container = container;
}
namespace(namespace) {

@@ -53,5 +55,10 @@ let storage = this.storageMap.get(namespace);

}
;
restore() {
this.storageMap.clear();
this.input.params.clear();
this.output.data.clear();
this.container = null;
}
}
exports.Context = Context;
//# sourceMappingURL=base.js.map
export * from './pipeline';
export * from "./types";
export * from "./base";
export * from "./context_pool";
export * from './reusify';

@@ -7,2 +7,4 @@ "use strict";

tslib_1.__exportStar(require("./base"), exports);
tslib_1.__exportStar(require("./context_pool"), exports);
tslib_1.__exportStar(require("./reusify"), exports);
//# sourceMappingURL=index.js.map

@@ -1,2 +0,1 @@

import { Container } from '@artus/injection';
export interface ParamsDictionary {

@@ -15,6 +14,4 @@ [key: string]: any;

namespace: (namespace: string) => ContextStorage<any>;
restore?: () => void;
}
export interface ContextInitOptions {
parentContainer?: Container;
}
export declare type ContextStorage<T> = {

@@ -21,0 +18,0 @@ set: (value: T, key?: string | symbol) => void;

{
"name": "@artus/pipeline",
"version": "0.1.6",
"version": "0.2.0",
"main": "dist/index.js",
"scripts": {
"build": "npm run build:dist",
"build:dist": "tsc --version && tsc -b ./tsconfig.json",
"test": "tsc --version && jest",
"build:dist": "tsc --version && tsc -b ./tsconfig.build.json",
"test": "tsc --version && jest --coverage",
"ci": "npm run test"
},
"devDependencies": {
"@artus/injection": "^0.2.0",
"@types/jest": "^27.4.1",

@@ -19,3 +20,2 @@ "egg-ci": "^1.19.0",

"dependencies": {
"@artus/injection": "^0.1.1",
"tslib": "^2.3.1"

@@ -28,4 +28,4 @@ },

},
"version": "12, 14, 16"
"version": "16"
}
}

@@ -1,8 +0,7 @@

import { Container, ExecutionContainer } from '@artus/injection';
import type { ExecutionContainer } from '@artus/injection';
import {
BaseContext, BaseInput, BaseOutput,
ContextStorage, ParamsDictionary, Next, ContextInitOptions
ContextStorage, ParamsDictionary, Next
} from './types';
const DEFAULT_EXECUTION_CONTAINER_NAME = 'artus#execution';
const ContextStorageSymbol = Symbol('ARTUS::ContextStorage');

@@ -36,16 +35,18 @@

// 不建议对外使用
public container: ExecutionContainer;
private _container!: ExecutionContainer | null;
private storageMap = new Map<string, ContextStorage<any>>();
constructor(input?: Input, output?: Output, opts?: ContextInitOptions) {
constructor(input?: Input, output?: Output) {
this.input = input ?? this.input;
this.output = output ?? this.output;
}
this.container = new ExecutionContainer(
this,
opts?.parentContainer ?? new Container(DEFAULT_EXECUTION_CONTAINER_NAME)
);
get container() {
return this._container;
}
set container(container: ExecutionContainer | null) {
this._container = container;
}
namespace(namespace: string): ContextStorage<any> {

@@ -59,3 +60,10 @@ let storage = this.storageMap.get(namespace);

return storage;
};
}
restore() {
this.storageMap.clear();
this.input.params.clear();
this.output.data.clear();
this.container = null;
}
}

@@ -62,0 +70,0 @@

export * from './pipeline';
export * from "./types";
export * from "./base";
export * from "./context_pool";
export * from './reusify';

@@ -1,3 +0,1 @@

import { Container } from '@artus/injection';
export interface ParamsDictionary {

@@ -19,8 +17,5 @@ [key: string]: any;

namespace: (namespace: string) => ContextStorage<any>,
restore?: () => void,
};
export interface ContextInitOptions {
parentContainer?: Container;
}
export type ContextStorage<T> = {

@@ -27,0 +22,0 @@ set: (value: T, key?: string | symbol) => void,

@@ -25,13 +25,9 @@ {

],
"rootDir": "./src",
"outDir": "./dist",
"composite": true
},
"include": [
"src"
],
"types": [
"node",
"jest",
],
"composite": true,
"types": [
"node",
"jest",
],
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet