graphql-sse
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import type { DocumentNode, GraphQLError } from 'graphql'; | ||
import type { GraphQLError } from 'graphql'; | ||
/** | ||
@@ -34,6 +34,6 @@ * Header key through which the event stream token is transmitted | ||
export interface RequestParams { | ||
operationName?: string | undefined; | ||
query: DocumentNode | string; | ||
variables?: Record<string, unknown> | undefined; | ||
extensions?: Record<string, unknown> | undefined; | ||
operationName?: string; | ||
query: string; | ||
variables?: Record<string, unknown>; | ||
extensions?: Record<string, unknown>; | ||
} | ||
@@ -40,0 +40,0 @@ /** |
@@ -196,28 +196,26 @@ "use strict"; | ||
const { operationName, variables } = params; | ||
let { query } = params; | ||
if (typeof query === 'string') { | ||
try { | ||
query = (0, graphql_1.parse)(query); | ||
} | ||
catch (err) { | ||
return [ | ||
JSON.stringify({ | ||
errors: [ | ||
err instanceof Error | ||
? { | ||
message: err.message, | ||
// TODO: stack might leak sensitive information | ||
// stack: err.stack, | ||
} | ||
: err, | ||
], | ||
}), | ||
{ | ||
status: 400, | ||
statusText: 'Bad Request', | ||
headers: { 'content-type': 'application/json; charset=utf-8' }, | ||
}, | ||
]; | ||
} | ||
let query; | ||
try { | ||
query = (0, graphql_1.parse)(params.query); | ||
} | ||
catch (err) { | ||
return [ | ||
JSON.stringify({ | ||
errors: [ | ||
err instanceof Error | ||
? { | ||
message: err.message, | ||
// TODO: stack might leak sensitive information | ||
// stack: err.stack, | ||
} | ||
: err, | ||
], | ||
}), | ||
{ | ||
status: 400, | ||
statusText: 'Bad Request', | ||
headers: { 'content-type': 'application/json; charset=utf-8' }, | ||
}, | ||
]; | ||
} | ||
const argsWithoutSchema = { | ||
@@ -224,0 +222,0 @@ operationName, |
{ | ||
"name": "graphql-sse", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Zero-dependency, HTTP/1 safe, simple, GraphQL over Server-Sent Events Protocol server and client", | ||
@@ -29,3 +29,3 @@ "keywords": [ | ||
}, | ||
"packageManager": "yarn@3.5.1", | ||
"packageManager": "yarn@3.6.0", | ||
"main": "lib/index.js", | ||
@@ -87,4 +87,5 @@ "module": "lib/index.mjs", | ||
"gendocs": "typedoc --options typedoc.js src/ && node scripts/post-gendocs.mjs", | ||
"lint:eslint": "eslint 'src'", | ||
"lint:prettier": "prettier -c .", | ||
"lint:eslint": "eslint src", | ||
"lint:prettier": "prettier --check .", | ||
"format": "yarn lint:prettier --write", | ||
"lint": "yarn lint:eslint && yarn lint:prettier", | ||
@@ -103,3 +104,3 @@ "type-check": "tsc --noEmit", | ||
"devDependencies": { | ||
"@babel/core": "^7.21.8", | ||
"@babel/core": "^7.22.5", | ||
"@babel/plugin-proposal-class-properties": "^7.18.6", | ||
@@ -109,32 +110,32 @@ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", | ||
"@babel/plugin-proposal-optional-chaining": "^7.21.0", | ||
"@babel/preset-env": "^7.21.5", | ||
"@babel/preset-typescript": "^7.21.5", | ||
"@rollup/plugin-terser": "^0.4.1", | ||
"@rollup/plugin-typescript": "^11.1.0", | ||
"@babel/preset-env": "^7.22.5", | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@rollup/plugin-terser": "^0.4.3", | ||
"@rollup/plugin-typescript": "^11.1.1", | ||
"@semantic-release/changelog": "^6.0.3", | ||
"@semantic-release/git": "^10.0.1", | ||
"@types/eslint": "^8.37.0", | ||
"@types/eslint": "^8.40.1", | ||
"@types/eventsource": "^1.1.11", | ||
"@types/express": "^4.17.17", | ||
"@types/glob": "^8.1.0", | ||
"@types/jest": "^29.5.1", | ||
"@typescript-eslint/eslint-plugin": "^5.59.5", | ||
"@typescript-eslint/parser": "^5.59.5", | ||
"@types/jest": "^29.5.2", | ||
"@typescript-eslint/eslint-plugin": "^5.59.9", | ||
"@typescript-eslint/parser": "^5.59.9", | ||
"babel-jest": "^29.5.0", | ||
"eslint": "^8.40.0", | ||
"eslint": "^8.42.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"express": "^4.18.2", | ||
"fastify": "^4.17.0", | ||
"glob": "^10.2.3", | ||
"fastify": "^4.18.0", | ||
"glob": "^10.2.7", | ||
"graphql": "^16.6.0", | ||
"jest": "^29.5.0", | ||
"prettier": "^2.8.8", | ||
"rollup": "^3.21.6", | ||
"rollup": "^3.25.1", | ||
"rollup-plugin-gzip": "^3.1.0", | ||
"semantic-release": "^21.0.2", | ||
"tslib": "^2.5.0", | ||
"typedoc": "^0.24.7", | ||
"semantic-release": "^21.0.5", | ||
"tslib": "^2.5.3", | ||
"typedoc": "^0.24.8", | ||
"typedoc-plugin-markdown": "^3.15.3", | ||
"typescript": "^5.0.4" | ||
"typescript": "^5.1.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
278791
5390