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

@stoplight/prism-core

Package Overview
Dependencies
Maintainers
20
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/prism-core - npm Package Compare versions

Comparing version 3.2.1 to 3.2.2

34

dist/factory.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Either = require("fp-ts/lib/Either");
const Option = require("fp-ts/lib/Option");
const TaskEither = require("fp-ts/lib/TaskEither");
const pipeable_1 = require("fp-ts/lib/pipeable");
const TaskEither = require("fp-ts/lib/TaskEither");
const lodash_1 = require("lodash");

@@ -15,2 +14,16 @@ const Apply_1 = require("fp-ts/lib/Apply");

}
function createWarningOutput(output) {
return {
output,
validations: {
input: [
{
message: 'Selected route not found',
severity: types_1.DiagnosticSeverity.Warning,
},
],
output: [],
},
};
}
function factory(defaultConfig, components) {

@@ -36,15 +49,3 @@ const inputValidation = (resource, input, config) => pipeable_1.pipe(sequenceValidation(config.validateRequest ? components.validateInput({ resource, element: input }) : Either.right(input), config.checkSecurity ? components.validateSecurity({ resource, element: input }) : Either.right(input)), Either.fold(validations => validations, () => []), validations => TaskEither.right({ resource, validations }));

if (!config.errors && isProxyConfig(config)) {
return pipeable_1.pipe(components.forward(input, config.upstream.href)(components.logger.child({ name: 'PROXY' })), TaskEither.map(output => ({
input,
output,
validations: {
input: [
{
message: "The selected route hasn't been found and the errors is set false. Prism has proxied the request to the upstream server but no validation will happen",
severity: types_1.DiagnosticSeverity.Warning,
},
],
output: [],
},
})));
return pipeable_1.pipe(components.forward(input, config.upstream.href)(components.logger.child({ name: 'PROXY' })), TaskEither.map(createWarningOutput));
}

@@ -55,6 +56,5 @@ else

const outputValidations = config.validateResponse
? pipeable_1.pipe(Option.fromEither(Either.swap(components.validateOutput({ resource, element: output }))), Option.getOrElse(() => []))
? pipeable_1.pipe(Either.swap(components.validateOutput({ resource, element: output })), Either.getOrElse(() => []))
: [];
return {
input,
output,

@@ -61,0 +61,0 @@ validations: {

@@ -21,6 +21,6 @@ import { IDiagnostic } from '@stoplight/types';

}
export declare type ValidatorFn<Resource, T> = (opts: {
resource: Resource;
element: T;
}) => Either<NonEmptyArray<IPrismDiagnostic>, T>;
export declare type ValidatorFn<R, E> = (opts: {
resource: R;
element: E;
}) => Either<NonEmptyArray<IPrismDiagnostic>, E>;
export declare type IPrismProxyConfig = IPrismConfig & {

@@ -27,0 +27,0 @@ mock: false;

{
"name": "@stoplight/prism-core",
"version": "3.2.1",
"version": "3.2.2",
"main": "dist/index.js",

@@ -26,3 +26,3 @@ "types": "dist/index.d.ts",

},
"gitHead": "64d17079cfcd3bdc791c9ffc7380f2e4c82f409a"
"gitHead": "b4026b6e45662b7b97135b6142239e3ea9068814"
}
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