graphql-http
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -241,3 +241,3 @@ /** | ||
* headers: req.headers, | ||
* body: await new Promise((resolve) => { | ||
* body: () => new Promise((resolve) => { | ||
* let body = ''; | ||
@@ -244,0 +244,0 @@ * req.on('data', (chunk) => (body += chunk)); |
@@ -58,3 +58,3 @@ "use strict"; | ||
* headers: req.headers, | ||
* body: await new Promise((resolve) => { | ||
* body: () => new Promise((resolve) => { | ||
* let body = ''; | ||
@@ -61,0 +61,0 @@ * req.on('data', (chunk) => (body += chunk)); |
export * from './common'; | ||
export * from './handler'; | ||
export * from './client'; | ||
export * from './audits'; |
@@ -20,1 +20,2 @@ "use strict"; | ||
__exportStar(require("./client"), exports); | ||
__exportStar(require("./audits"), exports); |
@@ -8,2 +8,4 @@ /** | ||
/** @private */ | ||
export declare function extendedTypeof(val: unknown): 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function' | 'array' | 'null'; | ||
/** @private */ | ||
export declare function isObject(val: unknown): val is Record<PropertyKey, any>; | ||
@@ -10,0 +12,0 @@ /** @private */ |
@@ -8,4 +8,15 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isAsyncIterable = exports.isExecutionResult = exports.areGraphQLErrors = exports.isObject = void 0; | ||
exports.isAsyncIterable = exports.isExecutionResult = exports.areGraphQLErrors = exports.isObject = exports.extendedTypeof = void 0; | ||
/** @private */ | ||
function extendedTypeof(val) { | ||
if (val === null) { | ||
return 'null'; | ||
} | ||
if (Array.isArray(val)) { | ||
return 'array'; | ||
} | ||
return typeof val; | ||
} | ||
exports.extendedTypeof = extendedTypeof; | ||
/** @private */ | ||
function isObject(val) { | ||
@@ -12,0 +23,0 @@ return typeof val === 'object' && val !== null; |
{ | ||
"name": "graphql-http", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Simple, pluggable, zero-dependency, GraphQL over HTTP Protocol compliant server and client", | ||
@@ -68,3 +68,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/core": "^7.18.10", | ||
"@babel/core": "^7.18.13", | ||
"@babel/plugin-proposal-class-properties": "^7.18.6", | ||
@@ -76,26 +76,26 @@ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", | ||
"@babel/preset-typescript": "^7.18.6", | ||
"@rollup/plugin-typescript": "^8.3.4", | ||
"@rollup/plugin-typescript": "^8.4.0", | ||
"@semantic-release/changelog": "^6.0.1", | ||
"@semantic-release/git": "^10.0.1", | ||
"@types/jest": "^28.1.7", | ||
"@typescript-eslint/eslint-plugin": "^5.33.1", | ||
"@typescript-eslint/parser": "^5.33.1", | ||
"babel-jest": "^28.1.3", | ||
"eslint": "^8.22.0", | ||
"@types/jest": "^29.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.36.1", | ||
"@typescript-eslint/parser": "^5.36.1", | ||
"babel-jest": "^29.0.1", | ||
"eslint": "^8.23.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"graphql": "^16.5.0", | ||
"jest": "^28.1.3", | ||
"jest-jasmine2": "^28.1.3", | ||
"graphql": "^16.6.0", | ||
"jest": "^29.0.1", | ||
"jest-jasmine2": "^29.0.1", | ||
"node-fetch": "^3.2.10", | ||
"prettier": "^2.7.1", | ||
"replacestream": "^4.0.3", | ||
"rollup": "^2.78.0", | ||
"rollup": "^2.78.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"semantic-release": "^19.0.3", | ||
"semantic-release": "^19.0.5", | ||
"tslib": "^2.4.0", | ||
"typedoc": "^0.23.10", | ||
"typedoc": "^0.23.11", | ||
"typedoc-plugin-markdown": "^3.13.4", | ||
"typescript": "^4.7.4" | ||
"typescript": "^4.8.2" | ||
} | ||
} |
@@ -71,7 +71,8 @@ <div align="center"> | ||
headers: req.headers, | ||
body: await new Promise((resolve) => { | ||
let body = ''; | ||
req.on('data', (chunk) => (body += chunk)); | ||
req.on('end', () => resolve(body)); | ||
}), | ||
body: () => | ||
new Promise((resolve) => { | ||
let body = ''; | ||
req.on('data', (chunk) => (body += chunk)); | ||
req.on('end', () => resolve(body)); | ||
}), | ||
raw: req, | ||
@@ -123,7 +124,8 @@ }); | ||
headers: req.headers, | ||
body: await new Promise((resolve) => { | ||
let body = ''; | ||
req.on('data', (chunk) => (body += chunk)); | ||
req.on('end', () => resolve(body)); | ||
}), | ||
body: () => | ||
new Promise((resolve) => { | ||
let body = ''; | ||
req.on('data', (chunk) => (body += chunk)); | ||
req.on('end', () => resolve(body)); | ||
}), | ||
raw: req, | ||
@@ -160,7 +162,8 @@ }); | ||
headers: req.headers, | ||
body: await new Promise((resolve) => { | ||
let body = ''; | ||
req.on('data', (chunk) => (body += chunk)); | ||
req.on('end', () => resolve(body)); | ||
}), | ||
body: () => | ||
new Promise((resolve) => { | ||
let body = ''; | ||
req.on('data', (chunk) => (body += chunk)); | ||
req.on('end', () => resolve(body)); | ||
}), | ||
raw: req, | ||
@@ -233,3 +236,3 @@ }); | ||
headers, | ||
body: await req.text(), | ||
body: () => req.text(), | ||
raw: req, | ||
@@ -693,7 +696,8 @@ }); | ||
headers: req.headers, | ||
body: await new Promise((resolve) => { | ||
let body = ''; | ||
req.on('data', (chunk) => (body += chunk)); | ||
req.on('end', () => resolve(body)); | ||
}), | ||
body: () => | ||
new Promise((resolve) => { | ||
let body = ''; | ||
req.on('data', (chunk) => (body += chunk)); | ||
req.on('end', () => resolve(body)); | ||
}), | ||
raw: req, | ||
@@ -713,2 +717,28 @@ }); | ||
<details id="audit-jest"> | ||
<summary><a href="#audit-jest">🔗</a> Audit for servers usage in <a href="https://jestjs.io">Jest</a> environment</summary> | ||
```js | ||
import { fetch } from '@whatwg-node/fetch'; | ||
import { serverAudits } from 'graphql-http'; | ||
for (const audit of serverAudits({ | ||
url: 'http://localhost:4000/graphql', | ||
fetchFn: fetch, | ||
})) { | ||
test(audit.name, async () => { | ||
const result = await audit.fn(); | ||
if (result.status === 'error') { | ||
throw result.reason; | ||
} | ||
if (result.status === 'warn') { | ||
console.warn(result.reason); // or throw if you want full compliance (warnings are not requirements) | ||
} | ||
// result.status === 'ok' | ||
}); | ||
} | ||
``` | ||
</details> | ||
## [Documentation](docs/) | ||
@@ -715,0 +745,0 @@ |
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
150061
33
3006
745
6