New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@qiwi/uniconfig-core

Package Overview
Dependencies
Maintainers
5
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qiwi/uniconfig-core - npm Package Compare versions

Comparing version

to
3.4.0

7

CHANGELOG.md

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

# [@qiwi/uniconfig-core-v3.4.0](https://github.com/qiwi/uniconfig/compare/v3.3.1...v3.4.0) (2020-05-21)
### Features
* **core:** add logging for failed pipe ([05dd364](https://github.com/qiwi/uniconfig/commit/05dd3643cb4a773660921dac66c4ed592e55a9c7)), closes [#248](https://github.com/qiwi/uniconfig/issues/248)
# [@qiwi/uniconfig-core-v3.3.1](https://github.com/qiwi/uniconfig/compare/v3.3.0...v3.3.1) (2020-05-04)

@@ -2,0 +9,0 @@

2

package.json
{
"name": "@qiwi/uniconfig-core",
"version": "3.3.1",
"version": "3.4.0",
"description": "Core uniconfig library",

@@ -5,0 +5,0 @@ "main": "target/es5/index.js",

@@ -12,2 +12,3 @@ import { IPipe, IPipeline, IPipeRef, IPipeRefExt, IPipeLink, IPipeOpts, IMode, IAny, IRegistry, IContext } from '../interface';

};
export declare const invokePipe: (mode: IMode, { name, handle, handleSync, }: IPipe, context: IContext, data: any, opts: any[]) => any;
export default function executor(data: IAny, pipeline: IPipeline, mode: IMode, context: IContext): IAny | Promise<IAny>;

@@ -14,0 +15,0 @@ export declare function resolvePipeline(pipeline?: IPipeline, registry?: IRegistry): IResolvedPipe[];

@@ -14,2 +14,18 @@ "use strict";

};
exports.invokePipe = function (mode, _a, context, data, opts) {
var name = _a.name, handle = _a.handle, handleSync = _a.handleSync;
var handleException = function (e, name, data, opts) {
console.error('Pipe exec failure', 'name=', name, 'data=', data, 'opts=', opts);
console.error(e);
throw e;
};
try {
return mode === 'async'
? handle.apply(void 0, tslib_1.__spreadArrays([context, data], opts)).catch(function (e) { return handleException(e, name, data, opts); })
: handleSync.apply(void 0, tslib_1.__spreadArrays([context, data], opts));
}
catch (e) {
handleException(e, name, data, opts);
}
};
function executor(data, pipeline, mode, context) {

@@ -19,9 +35,9 @@ var resolvedPipes = resolvePipeline(pipeline, context.pipe);

return util_1.reduce(resolvedPipes, function (promise, _a) {
var handle = _a.pipe.handle, opts = _a.opts;
return promise.then(function (data) { return handle.apply(void 0, tslib_1.__spreadArrays([context, data], opts)); });
var pipe = _a.pipe, opts = _a.opts;
return promise.then(function (data) { return exports.invokePipe(mode, pipe, context, data, opts); });
}, Promise.resolve(data));
}
return util_1.reduce(resolvedPipes, function (prev, _a) {
var handleSync = _a.pipe.handleSync, opts = _a.opts;
return handleSync.apply(void 0, tslib_1.__spreadArrays([context, prev], opts));
var pipe = _a.pipe, opts = _a.opts;
return exports.invokePipe(mode, pipe, context, prev, opts);
}, data);

@@ -28,0 +44,0 @@ }

@@ -12,2 +12,3 @@ import { IPipe, IPipeline, IPipeRef, IPipeRefExt, IPipeLink, IPipeOpts, IMode, IAny, IRegistry, IContext } from '../interface';

};
export declare const invokePipe: (mode: IMode, { name, handle, handleSync, }: IPipe, context: IContext, data: any, opts: any[]) => any;
export default function executor(data: IAny, pipeline: IPipeline, mode: IMode, context: IContext): IAny | Promise<IAny>;

@@ -14,0 +15,0 @@ export declare function resolvePipeline(pipeline?: IPipeline, registry?: IRegistry): IResolvedPipe[];

@@ -11,8 +11,23 @@ import { reduce } from '../base/util';

};
export const invokePipe = (mode, { name, handle, handleSync, }, context, data, opts) => {
const handleException = (e, name, data, opts) => {
console.error('Pipe exec failure', 'name=', name, 'data=', data, 'opts=', opts);
console.error(e);
throw e;
};
try {
return mode === 'async'
? handle(context, data, ...opts).catch((e) => handleException(e, name, data, opts))
: handleSync(context, data, ...opts);
}
catch (e) {
handleException(e, name, data, opts);
}
};
export default function executor(data, pipeline, mode, context) {
const resolvedPipes = resolvePipeline(pipeline, context.pipe);
if (mode === 'async') {
return reduce(resolvedPipes, (promise, { pipe: { handle }, opts }) => promise.then(data => handle(context, data, ...opts)), Promise.resolve(data));
return reduce(resolvedPipes, (promise, { pipe, opts }) => promise.then(data => invokePipe(mode, pipe, context, data, opts)), Promise.resolve(data));
}
return reduce(resolvedPipes, (prev, { pipe: { handleSync }, opts }) => handleSync(context, prev, ...opts), data);
return reduce(resolvedPipes, (prev, { pipe, opts }) => invokePipe(mode, pipe, context, prev, opts), data);
}

@@ -19,0 +34,0 @@ export function resolvePipeline(pipeline, registry) {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet