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

graphql-sse

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-sse - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

16

lib/handler.d.ts

@@ -7,6 +7,16 @@ /**

/// <reference types="node" />
/// <reference types="node" />
import type { IncomingMessage, ServerResponse } from 'http';
import type { Http2ServerRequest, Http2ServerResponse } from 'http2';
import { ExecutionArgs, GraphQLSchema, validate as graphqlValidate } from 'graphql';
import { RequestParams, ExecutionResult, ExecutionPatchResult } from './common';
/**
* @category Server
*/
export type NodeRequest = IncomingMessage | Http2ServerRequest;
/**
* @category Server
*/
export type NodeResponse = ServerResponse | Http2ServerResponse;
/**
* A concrete GraphQL execution context value type.

@@ -25,3 +35,3 @@ *

/** @category Server */
export interface HandlerOptions<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse> {
export interface HandlerOptions<Request extends NodeRequest = NodeRequest, Response extends NodeResponse = NodeResponse> {
/**

@@ -212,3 +222,3 @@ * The GraphQL schema on which the operations will

*/
export type Handler<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse> = (req: Request, res: Response, body?: unknown) => Promise<void>;
export type Handler<Request extends NodeRequest = NodeRequest, Response extends NodeResponse = NodeResponse> = (req: Request, res: Response, body?: unknown) => Promise<void>;
/**

@@ -222,3 +232,3 @@ * Makes a Protocol complient HTTP GraphQL server handler. The handler can

*/
export declare function createHandler<Request extends IncomingMessage = IncomingMessage, Response extends ServerResponse = ServerResponse>(options: HandlerOptions<Request, Response>): Handler<Request, Response>;
export declare function createHandler<Request extends NodeRequest = NodeRequest, Response extends NodeResponse = NodeResponse>(options: HandlerOptions<Request, Response>): Handler<Request, Response>;
export declare function isAsyncGenerator<T>(val: unknown): val is AsyncGenerator<T>;

10

lib/handler.js

@@ -50,3 +50,4 @@ "use strict";

return resolve(false);
response.write(msg, (err) => {
// @ts-expect-error both ServerResponse and Http2ServerResponse have this write signature
response.write(msg, 'utf-8', (err) => {
if (err)

@@ -110,3 +111,4 @@ return reject(err);

res.setHeader('Connection', 'keep-alive');
res.flushHeaders();
if ('flushHeaders' in res)
res.flushHeaders();
// write an empty message because some browsers (like Firefox and Safari)

@@ -257,2 +259,3 @@ // dont accept the header flush

})
// @ts-expect-error both ServerResponse and Http2ServerResponse have this write signature
.write(JSON.stringify({ errors: validationErrs }));

@@ -344,2 +347,3 @@ res.end();

.writeHead(201, { 'Content-Type': 'text/plain; charset=utf-8' })
// @ts-expect-error both ServerResponse and Http2ServerResponse have this write signature
.write(token);

@@ -370,3 +374,3 @@ res.end();

// only POSTs and GETs are accepted at this point
res.writeHead(405, undefined, { Allow: 'GET, POST, PUT, DELETE' }).end();
res.writeHead(405, { Allow: 'GET, POST, PUT, DELETE' }).end();
return;

@@ -373,0 +377,0 @@ }

{
"name": "graphql-sse",
"version": "1.3.1",
"version": "1.3.2",
"description": "Zero-dependency, HTTP/1 safe, simple, GraphQL over Server-Sent Events Protocol server and client",

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

"build:cjs": "tsc -b tsconfig.cjs.json",
"build:umd": "rollup -c && gzip umd/graphql-sse.min.js -c > umd/graphql-sse.min.js.gz",
"build:umd": "rollup --bundleConfigAsCjs --config rollup.config.ts --configPlugin typescript && gzip umd/graphql-sse.min.js -c > umd/graphql-sse.min.js.gz",
"build": "yarn build:esm && yarn build:cjs && yarn build:umd",

@@ -79,2 +79,3 @@ "release": "semantic-release"

"@babel/preset-typescript": "^7.18.6",
"@rollup/plugin-terser": "^0.2.0",
"@rollup/plugin-typescript": "^10.0.1",

@@ -87,4 +88,4 @@ "@semantic-release/changelog": "^6.0.2",

"@types/jest": "^28.1.8",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@typescript-eslint/eslint-plugin": "^5.45.1",
"@typescript-eslint/parser": "^5.45.1",
"babel-jest": "^28.1.3",

@@ -103,4 +104,3 @@ "eslint": "^8.29.0",

"prettier": "^2.8.0",
"rollup": "^3.5.1",
"rollup-plugin-terser": "^7.0.2",
"rollup": "^3.6.0",
"semantic-release": "^19.0.5",

@@ -107,0 +107,0 @@ "tslib": "^2.4.1",

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc