@webiny/handler-graphql 5.23.1 → 5.24.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/createGraphQLHandler.js +1 -1
- package/index.d.ts +9 -2
- package/interceptConsole.d.ts +5 -1
- package/interceptConsole.js +6 -2
- package/package.json +10 -10
- package/processRequestBody.d.ts +3 -1
- package/processRequestBody.js +5 -7
- package/responses.d.ts +2 -2
package/createGraphQLHandler.js
CHANGED
|
@@ -33,7 +33,7 @@ const DEFAULT_HEADERS = _objectSpread({
|
|
|
33
33
|
const DEFAULT_CACHE_MAX_AGE = 30758400; // 1 year
|
|
34
34
|
|
|
35
35
|
var _default = (options = {}) => {
|
|
36
|
-
let schema;
|
|
36
|
+
let schema = undefined;
|
|
37
37
|
const debug = (0, _boolean.boolean)(options.debug);
|
|
38
38
|
return [...(debug ? (0, _debugPlugins.default)() : []), {
|
|
39
39
|
type: "handler",
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { HandlerGraphQLOptions } from "./types";
|
|
2
2
|
import { Context } from "@webiny/handler/types";
|
|
3
3
|
import { GraphQLFieldResolver } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Can be anything.
|
|
6
|
+
* TODO: Figure out if required at all.
|
|
7
|
+
*/
|
|
8
|
+
interface Callable {
|
|
9
|
+
(params: any): any;
|
|
10
|
+
}
|
|
4
11
|
export * from "./errors";
|
|
5
12
|
export * from "./responses";
|
|
6
13
|
declare const _default: (options?: HandlerGraphQLOptions) => import("@webiny/plugins/types").PluginCollection[];
|
|
7
14
|
export default _default;
|
|
8
|
-
export declare const pipe: <TSource = any, TArgs = Record<string, any>, TContext = Context>(...fns:
|
|
9
|
-
export declare const compose: <TSource = any, TArgs = Record<string, any>, TContext = Context>(...fns:
|
|
15
|
+
export declare const pipe: <TSource = any, TArgs = Record<string, any>, TContext = Context>(...fns: Callable[]) => (resolver: import("graphql").GraphQLFieldResolver<TSource, TContext, TArgs>) => any;
|
|
16
|
+
export declare const compose: <TSource = any, TArgs = Record<string, any>, TContext = Context>(...fns: Callable[]) => (resolver: import("graphql").GraphQLFieldResolver<TSource, TContext, TArgs>) => any;
|
package/interceptConsole.d.ts
CHANGED
package/interceptConsole.js
CHANGED
|
@@ -10,19 +10,23 @@ const skipOriginal = ["table"];
|
|
|
10
10
|
|
|
11
11
|
const restoreOriginalMethods = () => {
|
|
12
12
|
for (const method of consoleMethods) {
|
|
13
|
+
// @ts-ignore
|
|
13
14
|
console[method] = originalMethods[method];
|
|
14
15
|
}
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
const interceptConsole = callback => {
|
|
19
|
+
// @ts-ignore
|
|
18
20
|
if (console["__WEBINY__"] === true) {
|
|
19
21
|
restoreOriginalMethods();
|
|
20
|
-
}
|
|
22
|
+
} // @ts-ignore
|
|
23
|
+
|
|
21
24
|
|
|
22
25
|
console["__WEBINY__"] = true;
|
|
23
26
|
|
|
24
27
|
for (const method of consoleMethods) {
|
|
25
|
-
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
originalMethods[method] = console[method]; // @ts-ignore
|
|
26
30
|
|
|
27
31
|
console[method] = (...args) => {
|
|
28
32
|
callback(method, args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/handler-graphql",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.24.0-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "7.16.7",
|
|
18
18
|
"@graphql-tools/schema": "7.1.5",
|
|
19
|
-
"@webiny/error": "5.
|
|
20
|
-
"@webiny/handler": "5.
|
|
21
|
-
"@webiny/handler-http": "5.
|
|
22
|
-
"@webiny/plugins": "5.
|
|
23
|
-
"@webiny/utils": "5.
|
|
19
|
+
"@webiny/error": "5.24.0-beta.0",
|
|
20
|
+
"@webiny/handler": "5.24.0-beta.0",
|
|
21
|
+
"@webiny/handler-http": "5.24.0-beta.0",
|
|
22
|
+
"@webiny/plugins": "5.24.0-beta.0",
|
|
23
|
+
"@webiny/utils": "5.24.0-beta.0",
|
|
24
24
|
"boolean": "3.1.4",
|
|
25
25
|
"graphql": "15.8.0",
|
|
26
26
|
"graphql-scalars": "1.12.0",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@babel/cli": "^7.16.0",
|
|
31
31
|
"@babel/core": "^7.16.0",
|
|
32
32
|
"@babel/preset-env": "^7.16.4",
|
|
33
|
-
"@webiny/cli": "^5.
|
|
34
|
-
"@webiny/handler-args": "^5.
|
|
35
|
-
"@webiny/project-utils": "^5.
|
|
33
|
+
"@webiny/cli": "^5.24.0-beta.0",
|
|
34
|
+
"@webiny/handler-args": "^5.24.0-beta.0",
|
|
35
|
+
"@webiny/project-utils": "^5.24.0-beta.0",
|
|
36
36
|
"jest": "^26.6.3",
|
|
37
37
|
"jest-mock-console": "^1.0.0",
|
|
38
38
|
"rimraf": "^3.0.2",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"build": "yarn webiny run build",
|
|
47
47
|
"watch": "yarn webiny run watch"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "05b90b92bbaf2ef3adf275d008c4641580cf5f42"
|
|
50
50
|
}
|
package/processRequestBody.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ExecutionResult, GraphQLSchema } from "graphql";
|
|
2
|
+
import { GraphQLRequestBody } from "./types";
|
|
1
3
|
import { Context } from "@webiny/handler/types";
|
|
2
|
-
declare const _default: (requestBody:
|
|
4
|
+
declare const _default: (requestBody: GraphQLRequestBody | GraphQLRequestBody[], schema: GraphQLSchema, context: Context) => Promise<ExecutionResult[] | ExecutionResult>;
|
|
3
5
|
export default _default;
|
package/processRequestBody.js
CHANGED
|
@@ -31,19 +31,17 @@ const processRequestBody = async (body, schema, context) => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
var _default = async (requestBody, schema, context) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (Array.isArray(requestBody)) {
|
|
37
|
-
result = [];
|
|
34
|
+
if (Array.isArray(requestBody) === true) {
|
|
35
|
+
const result = [];
|
|
38
36
|
|
|
39
37
|
for (let i = 0; i < requestBody.length; i++) {
|
|
40
38
|
result.push(await processRequestBody(requestBody[i], schema, context));
|
|
41
39
|
}
|
|
42
|
-
|
|
43
|
-
result
|
|
40
|
+
|
|
41
|
+
return result;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
return
|
|
44
|
+
return await processRequestBody(requestBody, schema, context);
|
|
47
45
|
};
|
|
48
46
|
|
|
49
47
|
exports.default = _default;
|