graphql-http
Advanced tools
Comparing version 1.9.0 to 1.10.0
@@ -11,3 +11,3 @@ /** | ||
*/ | ||
export declare type AuditRequirement = 'MUST' | 'SHOULD' | 'MAY'; | ||
export type AuditRequirement = 'MUST' | 'SHOULD' | 'MAY'; | ||
/** | ||
@@ -18,3 +18,3 @@ * Audit name starting with the audit requirement level. | ||
*/ | ||
export declare type AuditName = `${AuditRequirement} ${string}`; | ||
export type AuditName = `${AuditRequirement} ${string}`; | ||
/** | ||
@@ -60,2 +60,2 @@ * Actual audit test returning an result. | ||
*/ | ||
export declare type AuditResult = AuditOk | AuditFail; | ||
export type AuditResult = AuditOk | AuditFail; |
@@ -13,3 +13,3 @@ /** | ||
*/ | ||
export declare type RequestHeaders = { | ||
export type RequestHeaders = { | ||
/** | ||
@@ -58,3 +58,3 @@ * Always an array in Node. Duplicates are added to it. | ||
*/ | ||
export declare type ResponseHeaders = { | ||
export type ResponseHeaders = { | ||
accept?: string; | ||
@@ -70,3 +70,3 @@ allow?: string; | ||
*/ | ||
export declare type ResponseBody = string; | ||
export type ResponseBody = string; | ||
/** | ||
@@ -89,3 +89,3 @@ * Server agnostic response options (ex. status and headers) returned from | ||
*/ | ||
export declare type Response = readonly [body: ResponseBody | null, init: ResponseInit]; | ||
export type Response = readonly [body: ResponseBody | null, init: ResponseInit]; | ||
/** | ||
@@ -107,5 +107,5 @@ * Checks whether the passed value is the `graphql-http` server agnostic response. | ||
*/ | ||
export declare type OperationContext = Record<PropertyKey, unknown> | symbol | number | string | boolean | undefined | null; | ||
export type OperationContext = Record<PropertyKey, unknown> | symbol | number | string | boolean | undefined | null; | ||
/** @category Server */ | ||
export declare type OperationArgs<Context extends OperationContext = undefined> = ExecutionArgs & { | ||
export type OperationArgs<Context extends OperationContext = undefined> = ExecutionArgs & { | ||
contextValue?: Context; | ||
@@ -159,2 +159,11 @@ }; | ||
/** | ||
* The GraphQL root value or resolvers to go alongside the execution. | ||
* Learn more about them here: https://graphql.org/learn/execution/#root-fields-resolvers. | ||
* | ||
* If you return from `onSubscribe`, and the returned value is | ||
* missing the `rootValue` field, the relevant operation root | ||
* will be used instead. | ||
*/ | ||
rootValue?: unknown; | ||
/** | ||
* The subscribe callback executed right after processing the request | ||
@@ -213,3 +222,3 @@ * before proceeding with the GraphQL operation execution. | ||
*/ | ||
export declare type Handler<RequestRaw = unknown, RequestContext = unknown> = (req: Request<RequestRaw, RequestContext>) => Promise<Response>; | ||
export type Handler<RequestRaw = unknown, RequestContext = unknown> = (req: Request<RequestRaw, RequestContext>) => Promise<Response>; | ||
/** | ||
@@ -276,3 +285,3 @@ * Makes a GraphQL over HTTP Protocol compliant server handler. The handler can | ||
*/ | ||
export declare type AcceptableMediaType = 'application/graphql-response+json' | 'application/json'; | ||
export type AcceptableMediaType = 'application/graphql-response+json' | 'application/json'; | ||
/** | ||
@@ -279,0 +288,0 @@ * Inspects the request and detects the appropriate/acceptable Media-Type |
@@ -79,3 +79,3 @@ "use strict"; | ||
function createHandler(options) { | ||
const { schema, context, validate = graphql_1.validate, execute = graphql_1.execute, parse = graphql_1.parse, getOperationAST = graphql_1.getOperationAST, onSubscribe, onOperation, } = options; | ||
const { schema, context, validate = graphql_1.validate, execute = graphql_1.execute, parse = graphql_1.parse, getOperationAST = graphql_1.getOperationAST, rootValue, onSubscribe, onOperation, } = options; | ||
return async function handler(req) { | ||
@@ -264,2 +264,5 @@ var _a, _b; | ||
} | ||
if (!('rootValue' in args)) { | ||
args.rootValue = rootValue; | ||
} | ||
if (!('contextValue' in args)) { | ||
@@ -266,0 +269,0 @@ const resOrContext = typeof context === 'function' ? await context(req, params) : context; |
{ | ||
"name": "graphql-http", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"description": "Simple, pluggable, zero-dependency, GraphQL over HTTP Protocol compliant server and client", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
}, | ||
"packageManager": "yarn@3.2.4", | ||
"packageManager": "yarn@3.3.1", | ||
"main": "lib/index.js", | ||
@@ -76,3 +76,5 @@ "module": "lib/index.mjs", | ||
"gendocs": "typedoc --options typedoc.js src/", | ||
"lint": "eslint 'src'", | ||
"lint:eslint": "eslint 'src'", | ||
"lint:prettier": "prettier -c .", | ||
"lint": "yarn lint:eslint && yarn lint:prettier", | ||
"type-check": "tsc --noEmit", | ||
@@ -82,3 +84,3 @@ "test": "NODE_OPTIONS=--experimental-vm-modules jest", | ||
"build:cjs": "tsc -b tsconfig.cjs.json", | ||
"build:umd": "rollup -c && gzip umd/graphql-http.min.js -c > umd/graphql-http.min.js.gz", | ||
"build:umd": "rollup --bundleConfigAsCjs --config rollup.config.ts --configPlugin typescript && gzip umd/graphql-http.min.js -c > umd/graphql-http.min.js.gz", | ||
"build": "yarn build:esm && yarn build:cjs && yarn build:umd", | ||
@@ -94,35 +96,36 @@ "release": "semantic-release" | ||
"devDependencies": { | ||
"@babel/core": "^7.20.2", | ||
"@babel/core": "^7.20.7", | ||
"@babel/plugin-proposal-class-properties": "^7.18.6", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.20.2", | ||
"@babel/plugin-proposal-optional-chaining": "^7.18.9", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.20.7", | ||
"@babel/plugin-proposal-optional-chaining": "^7.20.7", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/preset-typescript": "^7.18.6", | ||
"@rollup/plugin-typescript": "^9.0.2", | ||
"@semantic-release/changelog": "^6.0.1", | ||
"@rollup/plugin-terser": "^0.2.1", | ||
"@rollup/plugin-typescript": "^10.0.1", | ||
"@semantic-release/changelog": "^6.0.2", | ||
"@semantic-release/git": "^10.0.1", | ||
"@types/express": "^4.17.14", | ||
"@types/jest": "^29.2.2", | ||
"@typescript-eslint/eslint-plugin": "^5.42.1", | ||
"@typescript-eslint/parser": "^5.42.1", | ||
"@whatwg-node/fetch": "^0.5.1", | ||
"babel-jest": "^29.3.0", | ||
"eslint": "^8.27.0", | ||
"@types/eslint": "^8.4.10", | ||
"@types/express": "^4.17.15", | ||
"@types/glob": "^8.0.0", | ||
"@types/jest": "^29.2.4", | ||
"@typescript-eslint/eslint-plugin": "^5.47.0", | ||
"@typescript-eslint/parser": "^5.47.0", | ||
"@whatwg-node/fetch": "^0.5.3", | ||
"babel-jest": "^29.3.1", | ||
"eslint": "^8.30.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"express": "^4.18.2", | ||
"fastify": "^4.9.2", | ||
"fastify": "^4.10.2", | ||
"graphql": "^16.6.0", | ||
"jest": "^29.3.0", | ||
"jest-jasmine2": "^29.3.0", | ||
"node-fetch": "^3.2.10", | ||
"prettier": "^2.7.1", | ||
"rollup": "^3.2.5", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"jest": "^29.3.1", | ||
"jest-jasmine2": "^29.3.1", | ||
"node-fetch": "^3.3.0", | ||
"prettier": "^2.8.1", | ||
"rollup": "^3.8.1", | ||
"semantic-release": "^19.0.5", | ||
"tslib": "^2.4.1", | ||
"typedoc": "^0.23.20", | ||
"typedoc-plugin-markdown": "^3.13.6", | ||
"typescript": "^4.8.4" | ||
"typedoc": "^0.23.23", | ||
"typedoc-plugin-markdown": "^3.14.0", | ||
"typescript": "^4.9.4" | ||
}, | ||
@@ -129,0 +132,0 @@ "resolutions": { |
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
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
241616
4457
34