Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@artus/core

Package Overview
Dependencies
Maintainers
8
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@artus/core - npm Package Compare versions

Comparing version 2.0.4-alpha.0 to 2.0.4

24

lib/exception/utils.js

@@ -6,2 +6,3 @@ "use strict";

const impl_1 = require("./impl");
const is_1 = require("../utils/is");
const matchExceptionFilterClazz = (err, container) => {

@@ -14,16 +15,19 @@ const filterMap = container.get(constant_1.EXCEPTION_FILTER_MAP_INJECT_ID, {

}
let targetFilterClazz = null;
// handle ArtusStdError with code simply
if (err instanceof impl_1.ArtusStdError && filterMap.has(err.code)) {
// handle ArtusStdError with code simply
targetFilterClazz = filterMap.get(err.code);
return filterMap.get(err.code);
}
else if (filterMap.has(err['constructor'])) {
// handle CustomErrorClazz
targetFilterClazz = filterMap.get(err['constructor']);
// handle CustomErrorClazz, loop inherit class
let errConstructor = err['constructor'];
while ((0, is_1.isClass)(errConstructor)) { // until parent/self is not class
if (filterMap.has(errConstructor)) {
return filterMap.get(errConstructor);
}
errConstructor = Object.getPrototypeOf(errConstructor); // get parent clazz by prototype
}
else if (filterMap.has(constant_1.EXCEPTION_FILTER_DEFAULT_SYMBOL)) {
// handle default ExceptionFilter
targetFilterClazz = filterMap.get(constant_1.EXCEPTION_FILTER_DEFAULT_SYMBOL);
// handle default ExceptionFilter
if (filterMap.has(constant_1.EXCEPTION_FILTER_DEFAULT_SYMBOL)) {
return filterMap.get(constant_1.EXCEPTION_FILTER_DEFAULT_SYMBOL);
}
return targetFilterClazz;
return null;
};

@@ -30,0 +34,0 @@ exports.matchExceptionFilterClazz = matchExceptionFilterClazz;

@@ -38,5 +38,7 @@ "use strict";

// A util function of get package path for plugin
function getPackagePath(packageName, paths) {
const opts = paths ? { paths } : undefined;
return path_1.default.resolve(require.resolve(packageName, opts), '..');
function getPackagePath(packageName, paths = []) {
const opts = {
paths: paths.concat(__dirname),
};
return path_1.default.dirname(require.resolve(packageName, opts));
}

@@ -43,0 +45,0 @@ exports.getPackagePath = getPackagePath;

@@ -48,8 +48,12 @@ "use strict";

checkDepExisted(pluginMap) {
var _a, _b;
for (const { name: pluginName, optional } of (_a = this.metadata.dependencies) !== null && _a !== void 0 ? _a : []) {
var _a;
if (!this.metadata.dependencies) {
return;
}
for (let i = 0; i < this.metadata.dependencies.length; i++) {
const { name: pluginName, optional } = this.metadata.dependencies[i];
const instance = pluginMap.get(pluginName);
if (!instance || !instance.enable) {
if (optional) {
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.warn(`Plugin ${this.name} need have optional dependency: ${pluginName}.`);
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.warn(`Plugin ${this.name} need have optional dependency: ${pluginName}.`);
}

@@ -60,2 +64,6 @@ else {

}
else {
// Plugin exist and enabled, need calc edge
this.metadata.dependencies[i]._enabled = true;
}
}

@@ -65,3 +73,3 @@ }

var _a, _b, _c;
return (_c = (_b = (_a = this.metadata.dependencies) === null || _a === void 0 ? void 0 : _a.filter(({ optional }) => !optional)) === null || _b === void 0 ? void 0 : _b.map(({ name: depPluginName }) => [this.name, depPluginName])) !== null && _c !== void 0 ? _c : [];
return (_c = (_b = (_a = this.metadata.dependencies) === null || _a === void 0 ? void 0 : _a.filter(({ optional, _enabled }) => !optional || _enabled)) === null || _b === void 0 ? void 0 : _b.map(({ name: depPluginName }) => [this.name, depPluginName])) !== null && _c !== void 0 ? _c : [];
}

@@ -68,0 +76,0 @@ async checkAndLoadMetadata() {

@@ -15,2 +15,3 @@ import { LoggerType } from '../logger';

optional?: boolean;
_enabled?: boolean;
}

@@ -17,0 +18,0 @@ export interface PluginConfigItem {

{
"name": "@artus/core",
"version": "2.0.4-alpha.0",
"version": "2.0.4",
"description": "Core package of Artus",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc