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

@syntest/module

Package Overview
Dependencies
Maintainers
4
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@syntest/module - npm Package Compare versions

Comparing version

to
0.1.0-beta.20

2

dist/lib/extension/plugins/MetricMiddlewarePlugin.d.ts
import { Metric, MiddleWare } from "@syntest/metric";
import { Plugin } from "../Plugin";
export declare abstract class MetricMiddlewarePlugin extends Plugin {
protected metrics: Metric[];
constructor(name: string, describe: string);
abstract createMetricMiddleware(metrics: Metric[]): MiddleWare;
setMetrics(metrics: Metric[]): void;
getOptionChoices(option: string): string[];
}
//# sourceMappingURL=MetricMiddlewarePlugin.d.ts.map

@@ -10,2 +10,5 @@ "use strict";

}
setMetrics(metrics) {
this.metrics = metrics;
}
getOptionChoices(option) {

@@ -12,0 +15,0 @@ // for every tool/label

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

}
for (const pluginsOfType of this.plugins.values()) {
for (const [pluginType, pluginsOfType] of this.plugins.entries()) {
if (pluginType === PluginType_1.PluginType.METRIC_MIDDLEWARE) {
continue;
}
for (const plugin of pluginsOfType.values()) {

@@ -121,2 +124,24 @@ if (plugin.getMetrics) {

}
if (!this.plugins.has(PluginType_1.PluginType.METRIC_MIDDLEWARE)) {
return metrics;
}
const metricMiddlewarePlugins = [
...this.plugins.get(PluginType_1.PluginType.METRIC_MIDDLEWARE).values(),
];
// sort based on pipeline
const order = this.args
.metricMiddlewarePipeline;
metricMiddlewarePlugins.sort((a, b) => order.indexOf(`metric-middleware-${a.name}`) -
order.indexOf(`metric-middleware-${b.name}`));
for (const plugin of metricMiddlewarePlugins) {
// set previous metrics for this plugin
plugin.setMetrics(metrics);
if (plugin.getMetrics) {
const pluginMetrics = await plugin.getMetrics();
ModuleManager.LOGGER.info(`Metric Middleware Plugin ${plugin.name} has ${pluginMetrics.length} metrics: [${pluginMetrics
.map((metric) => Object.values(metric).join("."))
.join(", ")}]`);
metrics.push(...pluginMetrics);
}
}
return metrics;

@@ -141,3 +166,4 @@ }

.metricMiddlewarePipeline;
metricPlugins.sort((a, b) => order.indexOf(a.name) - order.indexOf(b.name));
metricPlugins.sort((a, b) => order.indexOf(`metric-middleware-${a.name}`) -
order.indexOf(`metric-middleware-${b.name}`));
const metricMiddleWare = metricPlugins.map((plugin) => plugin.createMetricMiddleware(this._metricManager.metrics));

@@ -144,0 +170,0 @@ await this._metricManager.runPipeline(metricMiddleWare);

6

package.json
{
"name": "@syntest/module",
"version": "0.1.0-beta.19",
"version": "0.1.0-beta.20",
"description": "The module library of the SynTest Framework",

@@ -51,3 +51,3 @@ "keywords": [

"@syntest/logging": "*",
"@syntest/metric": "^0.1.0-beta.6",
"@syntest/metric": "^0.1.0-beta.7",
"@syntest/storage": "^0.1.0-beta.0",

@@ -63,3 +63,3 @@ "global-modules": "2.0.0",

},
"gitHead": "4e453bb642fb47f9889d839dc22b9dccc6f29004"
"gitHead": "4baeab279e9cd11a4eb4769744db6e88be600555"
}

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

Sorry, the diff of this file is not supported yet