Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@testring/plugin-api

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testring/plugin-api - npm Package Compare versions

Comparing version
0.5.15
to
0.5.16
+15
dist/modules/http-server.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const abstract_1 = require("./abstract");
class HttpServerAPI extends abstract_1.AbstractAPI {
beforeRequest(handler) {
this.registryWritePlugin("beforeRequest" /* beforeRequest */, handler);
}
beforeResponse(handler) {
this.registryWritePlugin("beforeResponse" /* beforeResponse */, handler);
}
beforeError(handler) {
this.registryWritePlugin("beforeError" /* beforeError */, handler);
}
}
exports.HttpServerAPI = HttpServerAPI;
import { AbstractAPI } from './abstract';
import { HttpServerPlugins, IHttpRequest, IHttpRequestMessage, IHttpResponse } from '@testring/types';
export class HttpServerAPI extends AbstractAPI {
beforeRequest(handler: (request: IHttpRequest, data: IHttpRequestMessage) => Promise<IHttpRequest>) {
this.registryWritePlugin(HttpServerPlugins.beforeRequest, handler);
}
beforeResponse(
handler: (request: IHttpRequest, response: IHttpResponse, data: IHttpRequestMessage) => Promise<IHttpResponse>
) {
this.registryWritePlugin(HttpServerPlugins.beforeResponse, handler);
}
beforeError<T>(handler: (error: T, data: IHttpRequestMessage) => Promise<T>) {
this.registryWritePlugin(HttpServerPlugins.beforeError, handler);
}
}
+4
-0

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

const devtool_1 = require("./modules/devtool");
const http_server_1 = require("./modules/http-server");
class PluginAPI {

@@ -33,2 +34,5 @@ constructor(pluginName, modules) {

}
getHttpServer() {
return new http_server_1.HttpServerAPI(this.pluginName, this.modules.httpServer);
}
getHttpClient() {

@@ -35,0 +39,0 @@ return this.modules.httpClientInstance;

+4
-4
{
"name": "@testring/plugin-api",
"version": "0.5.15",
"version": "0.5.16",
"main": "./dist/index.js",

@@ -13,5 +13,5 @@ "types": "./src/index.ts",

"dependencies": {
"@testring/logger": "0.5.15",
"@testring/types": "0.5.15",
"@testring/utils": "0.5.15"
"@testring/logger": "0.5.16",
"@testring/types": "0.5.16",
"@testring/utils": "0.5.16"
},

@@ -18,0 +18,0 @@ "devDependencies": {

import { AbstractAPI } from './abstract';
import { LoggerPlugins } from '@testring/types';
import { ILogEntity, ILogMeta, LoggerPlugins } from '@testring/types';
export class LoggerAPI extends AbstractAPI {
beforeLog(handler: (log) => void) {
beforeLog(handler: (logEntity: ILogEntity, meta: ILogMeta) => ILogEntity) {
this.registryWritePlugin(LoggerPlugins.beforeLog, handler);
}
onLog(handler: (log) => void) {
onLog(handler: (logEntity: ILogEntity, meta: ILogMeta) => void) {
this.registryReadPlugin(LoggerPlugins.onLog, handler);
}
onError(handler: (log) => void) {
onError(handler: (error: any, meta: ILogMeta) => void) {
this.registryWritePlugin(LoggerPlugins.onError, handler);
}
}

@@ -8,2 +8,3 @@ import { IPluginModules } from '@testring/types';

import { DevtoolAPI } from './modules/devtool';
import { HttpServerAPI } from './modules/http-server';

@@ -37,2 +38,6 @@ export class PluginAPI {

}
getHttpServer() {
return new HttpServerAPI(this.pluginName, this.modules.httpServer);
}

@@ -39,0 +44,0 @@ getHttpClient() {