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

@sitecore-jss/sitecore-jss-proxy

Package Overview
Dependencies
Maintainers
5
Versions
1399
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sitecore-jss/sitecore-jss-proxy - npm Package Compare versions

Comparing version 12.0.0 to 13.0.0

23

dist/index.js

@@ -14,6 +14,7 @@ "use strict";

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -55,2 +56,3 @@ });

var set_cookie_parser_1 = __importDefault(require("set-cookie-parser"));
var http_status_codes_1 = __importDefault(require("http-status-codes"));
var zlib_1 = __importDefault(require("zlib")); // node.js standard lib

@@ -86,3 +88,3 @@ var util_1 = require("./util");

return __generator(this, function (_a) {
if (proxyResponse.statusCode === 200 || proxyResponse.statusCode === 404) {
if (proxyResponse.statusCode === http_status_codes_1.default.OK || proxyResponse.statusCode === http_status_codes_1.default.NOT_FOUND) {
responseString = void 0;

@@ -123,3 +125,3 @@ if (contentEncoding &&

errorResponse = {
statusCode: proxyResponse.statusCode || 500,
statusCode: proxyResponse.statusCode || http_status_codes_1.default.INTERNAL_SERVER_ERROR,
content: proxyResponse.statusMessage || 'Internal Server Error',

@@ -131,3 +133,3 @@ };

onError = _a.sent();
errorResponse = __assign({}, errorResponse, onError);
errorResponse = __assign(__assign({}, errorResponse), onError);
_a.label = 2;

@@ -177,3 +179,3 @@ case 2:

}
finalStatusCode = result.status || proxyResponse.statusCode || 200;
finalStatusCode = result.status || proxyResponse.statusCode || http_status_codes_1.default.OK;
if (config.debug) {

@@ -194,3 +196,4 @@ console.log('DEBUG: FINAL response headers for client', JSON.stringify(proxyResponse.headers, null, 2));

originalWriteHead.apply(serverResponse, [statusCode, headers]);
originalWrite.call(serverResponse, content);
if (content)
originalWrite.call(serverResponse, content);
originalEnd.call(serverResponse);

@@ -212,3 +215,3 @@ }

customViewBag = _a.sent();
viewBag = __assign({}, viewBag, customViewBag);
viewBag = __assign(__assign({}, viewBag), customViewBag);
_a.label = 2;

@@ -241,3 +244,3 @@ case 2: return [2 /*return*/, viewBag];

// we are going to set our own status code if rendering fails
serverResponse.writeHead = function () { };
serverResponse.writeHead = function () { return serverResponse; };
buf = Buffer.from('');

@@ -258,2 +261,6 @@ serverResponse.write = function (data, encoding) {

};
if (request.method === 'HEAD') {
completeProxyResponse(null, proxyResponse.statusCode || http_status_codes_1.default.OK);
return [2 /*return*/];
}
// as the response is ending, we parse the current response body which is JSON, then

@@ -260,0 +267,0 @@ // render the app using that JSON, but return HTML to the final response.

{
"name": "@sitecore-jss/sitecore-jss-proxy",
"version": "12.0.0",
"version": "13.0.0",
"description": "Proxy middleware for express.js server.",

@@ -27,3 +27,4 @@ "main": "dist/index.js",

"dependencies": {
"http-proxy-middleware": "^0.19.0",
"http-proxy-middleware": "^0.20.0",
"http-status-codes": "^1.3.2",
"set-cookie-parser": "^2.2.1"

@@ -33,15 +34,15 @@ },

"@types/chai": "^4.1.6",
"@types/http-proxy-middleware": "^0.17.5",
"@types/http-proxy-middleware": "^0.19.3",
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.0",
"@types/set-cookie-parser": "^0.0.3",
"@types/node": "^12.7.11",
"@types/set-cookie-parser": "^0.0.5",
"chai": "^4.2.0",
"del-cli": "^1.1.0",
"mocha": "^5.2.0",
"del-cli": "^3.0.0",
"mocha": "^6.2.1",
"sinon": "^7.0.0",
"ts-node": "^7.0.1",
"ts-node": "^8.4.1",
"typescript": "^3.1.3"
},
"types": "types/index.d.ts",
"gitHead": "2f4820efddf4454eeee58ed1b2cc251969efdf5b"
"gitHead": "74452d5eaf9046673a8d437a545ad4739fadc8bc"
}
/// <reference types="node" />
import { ClientRequest, IncomingMessage, ServerResponse } from 'http';
import { IncomingMessage, ServerResponse } from 'http';
import { Config as HttpProxyConfig } from 'http-proxy-middleware';

@@ -35,9 +35,9 @@ import { RenderResponse } from './RenderResponse';

/** Enables transforming SSR'ed HTML after it is rendered, i.e. to replace paths. */
transformSSRContent?: (response: RenderResponse, request: ClientRequest, serverResponse: ServerResponse) => Promise<string>;
transformSSRContent?: (response: RenderResponse, request: IncomingMessage, serverResponse: ServerResponse) => Promise<string>;
/** Hook to fill the SSR viewBag object; if you're customizing the viewBag in Sitecore integrated SSR mode, do the same here. */
createViewBag?: (request: ClientRequest, response: ServerResponse, proxyResponse: IncomingMessage, layoutServiceData: any) => Promise<object>;
createViewBag?: (request: IncomingMessage, response: ServerResponse, proxyResponse: IncomingMessage, layoutServiceData: any) => Promise<object>;
/** Hook to alter HTTP headers in a custom way. */
setHeaders?: (request: ClientRequest, response: ServerResponse, proxyResponse: IncomingMessage) => void;
setHeaders?: (request: IncomingMessage, response: ServerResponse, proxyResponse: IncomingMessage) => void;
/** Responses from the proxy greater than this size (in bytes) are rejected. */
maxResponseSizeBytes?: number;
}
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