Socket
Socket
Sign inDemoInstall

@kronoslive/mockttp

Package Overview
Dependencies
129
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.4 to 0.7.5

4

dist/client/mocked-endpoint-client.js

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -24,0 +24,0 @@ case 0: case 1: t = op; break;

@@ -33,5 +33,5 @@ /**

constructor(mockServerOptions?: MockttpOptions);
private requestFromStandalone<T>(path, options?);
private requestFromMockServer<T>(path, options?);
private queryMockServer<T>(query, variables?);
private requestFromStandalone;
private requestFromMockServer;
private queryMockServer;
start(port?: number): Promise<void>;

@@ -38,0 +38,0 @@ stop(): Promise<void>;

@@ -30,4 +30,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -34,0 +34,0 @@ case 0: case 1: t = op; break;

@@ -0,1 +1,4 @@

/**
* @module Mockttp
*/
import { MockttpStandalone, StandaloneServerOptions } from "./standalone/mockttp-standalone";

@@ -2,0 +5,0 @@ import { Mockttp, MockttpOptions } from "./mockttp";

@@ -127,3 +127,3 @@ /**

protected debug: boolean;
readonly abstract url: string;
abstract readonly url: string;
abstract addRule: (ruleData: MockRuleData) => Promise<MockedEndpoint>;

@@ -130,0 +130,0 @@ abstract on(event: 'request', callback: (req: OngoingRequest) => void): Promise<void>;

@@ -0,1 +1,4 @@

/**
* @module MockRuleData
*/
/// <reference types="node" />

@@ -14,4 +17,4 @@ import http = require('http');

status: number;
data: string | undefined;
headers: http.OutgoingHttpHeaders | undefined;
data?: string | undefined;
headers?: http.OutgoingHttpHeaders | undefined;
readonly type: 'simple';

@@ -18,0 +21,0 @@ constructor(status: number, data?: string | undefined, headers?: http.OutgoingHttpHeaders | undefined);

@@ -28,4 +28,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -32,0 +32,0 @@ case 0: case 1: t = op; break;

@@ -0,1 +1,4 @@

/**
* @module MockRuleData
*/
import { Method } from "../types";

@@ -17,3 +20,3 @@ import { RequestMatcher, MockRuleCtx } from "./mock-rule-types";

path: string;
ctx: MockRuleCtx | undefined;
ctx?: MockRuleCtx | undefined;
readonly type: 'simple';

@@ -20,0 +23,0 @@ constructor(method: Method, path: string, ctx?: MockRuleCtx | undefined);

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -123,2 +123,5 @@ case 0: case 1: t = op; break;

}
if (data.ctx && data.ctx.matchByPartOfPath === true) {
return request.method === methodName && matchUrl.indexOf(url) > -1;
}
return request.method === methodName && matchUrl === url;

@@ -125,0 +128,0 @@ }, { explain: function () { return "making " + methodName + "s for " + data.path; } });

@@ -1,5 +0,5 @@

/// <reference types="node" />
/**
* @module MockRule
*/
/// <reference types="node" />
import { CompletedRequest, Method, MockedEndpoint } from "../types";

@@ -6,0 +6,0 @@ import { MockRuleData, MockRuleCtx } from "./mock-rule-types";

@@ -17,2 +17,3 @@ /**

matchByPath?: boolean;
matchByPartOfPath?: boolean;
}

@@ -19,0 +20,0 @@ export interface MockRuleData {

@@ -0,1 +1,4 @@

/**
* @module MockRule
*/
import { CompletedRequest } from "../types";

@@ -17,5 +20,5 @@ import { MockRule as MockRuleInterface, RuleCompletionChecker, RequestHandler, RequestMatcher, MockRuleData } from "./mock-rule-types";

requests: Promise<CompletedRequest>[];
constructor({matchers, handler, completionChecker}: MockRuleData);
private recordRequests(handler);
constructor({ matchers, handler, completionChecker }: MockRuleData);
private recordRequests;
explain(): string;
}

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -24,0 +24,0 @@ case 0: case 1: t = op; break;

@@ -0,1 +1,4 @@

/**
* @module Mockttp
*/
import { OngoingRequest } from "../types";

@@ -27,7 +30,7 @@ import { MockRuleData } from "../rules/mock-rule-types";

on(event: 'request', callback: (req: OngoingRequest) => void): Promise<void>;
private announceRequestAsync(request);
private handleRequest(request, response);
private announceRequestAsync;
private handleRequest;
private isComplete;
private explainRequest(request);
private suggestRule(request);
private explainRequest;
private suggestRule;
}

@@ -30,4 +30,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -111,4 +111,4 @@ case 0: case 1: t = op; break;

return __awaiter(this, void 0, void 0, function () {
var port, _a, ca_1, defaultCert;
var _this = this;
var port, _a, ca_1, defaultCert;
return __generator(this, function (_b) {

@@ -295,4 +295,4 @@ switch (_b.label) {

return __awaiter(this, void 0, void 0, function () {
var matchingRules_1, nextRule, requestExplanation, _a, _b, e_1;
var _this = this;
var matchingRules_1, nextRule, requestExplanation, _a, _b, e_1;
return __generator(this, function (_c) {

@@ -299,0 +299,0 @@ switch (_c.label) {

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

/// <reference types="express" />
/**
* @module Internal
*/
import * as express from 'express';
export declare const parseBody: (req: express.Request, res: express.Response, next: express.NextFunction) => void;

@@ -0,1 +1,4 @@

/**
* @module Mockttp
*/
export interface StandaloneServerOptions {

@@ -10,7 +13,7 @@ debug?: boolean;

constructor(options?: StandaloneServerOptions);
private loadSchema(schemaFilename, mockServer);
private loadSchema;
start(): Promise<void>;
private routers;
private subscriptionServers;
private startMockServer(options, port?);
private startMockServer;
stop(): Promise<void>;

@@ -17,0 +20,0 @@ }

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -159,4 +159,4 @@ case 0: case 1: t = op; break;

return __awaiter(this, void 0, void 0, function () {
var mockServer, mockPort, mockServerRouter, schema;
var _this = this;
var mockServer, mockPort, mockServerRouter, schema;
return __generator(this, function (_a) {

@@ -163,0 +163,0 @@ switch (_a.label) {

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

#!/usr/bin/env node
export {};

@@ -18,4 +18,4 @@ #!/usr/bin/env node

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -22,0 +22,0 @@ case 0: case 1: t = op; break;

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

/**
* @module Internal
*/
import { IResolvers } from "graphql-tools/dist/Interfaces";
import MockttpServer from "../server/mockttp-server";
export declare function buildStandaloneModel(mockServer: MockttpServer): IResolvers;

@@ -28,4 +28,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -32,0 +32,0 @@ case 0: case 1: t = op; break;

@@ -1,5 +0,5 @@

/// <reference types="node" />
/**
* @module Internal
*/
/// <reference types="node" />
import stream = require('stream');

@@ -14,3 +14,3 @@ import express = require("express");

PATCH = 4,
OPTIONS = 5,
OPTIONS = 5
}

@@ -17,0 +17,0 @@ export interface Request {

@@ -1,5 +0,5 @@

/// <reference types="node" />
/**
* @module Internal
*/
/// <reference types="node" />
import net = require("net");

@@ -6,0 +6,0 @@ export interface DestroyableServer extends net.Server {

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

/**
* @module Internal
*/
/// <reference types="node" />
export declare function readFile(filename: string, encoding: null): Promise<Buffer>;
export declare function readFile(filename: string, encoding: string): Promise<string>;

@@ -0,1 +1,4 @@

/**
* @module Internal
*/
export default function normalize(url: string): string;

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -24,0 +24,0 @@ case 0: case 1: t = op; break;

@@ -0,1 +1,4 @@

/**
* @module Internal
*/
/// <reference types="node" />

@@ -2,0 +5,0 @@ import { OngoingRequest } from "../types";

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -24,0 +24,0 @@ case 0: case 1: t = op; break;

@@ -0,1 +1,4 @@

/**
* @module Internal
*/
/// <reference types="node" />

@@ -2,0 +5,0 @@ export declare type CAOptions = HttpsOptions | HttpsPathOptions;

@@ -20,4 +20,4 @@ "use strict";

while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {

@@ -24,0 +24,0 @@ case 0: case 1: t = op; break;

{
"name": "@kronoslive/mockttp",
"version": "0.7.4",
"version": "0.7.5",
"description": "Mock HTTP server for testing HTTP clients and stubbing webservices",

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

@@ -99,2 +99,5 @@ /**

}
if (data.ctx && data.ctx.matchByPartOfPath === true) {
return request.method === methodName && matchUrl.indexOf(url) > -1;
}
return request.method === methodName && matchUrl === url

@@ -127,2 +130,2 @@ }, { explain: () => `making ${methodName}s for ${data.path}` });

);
};
};

@@ -21,3 +21,4 @@ /**

export interface MockRuleCtx {
matchByPath?: boolean
matchByPath?: boolean;
matchByPartOfPath?: boolean;
}

@@ -24,0 +25,0 @@

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc